-
Notifications
You must be signed in to change notification settings - Fork 106
WIP: Calculate Jacobian coloring using PetscOperator matrices #3350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: petsc-operators
Are you sure you want to change the base?
Changes from all commits
b48c40b
325019a
b433faf
65185d0
4920c86
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -127,6 +127,33 @@ PetscCellMapping::PetscCellMapping(const Field3D& cell_number, | |||||
| local_indices); | ||||||
| } | ||||||
|
|
||||||
| IS PetscCellMapping::makeEvolvingIS() const { | ||||||
| // Collect global PETSc indices in mapOwnedInteriorCells order. | ||||||
| // Reserve the known count up front to avoid reallocation. | ||||||
| std::vector<PetscInt> indices; | ||||||
| indices.reserve(static_cast<std::size_t>(evolving_region.size())); | ||||||
|
|
||||||
| mapOwnedInteriorCells( | ||||||
| [&](PetscInt row, const Ind3D& /*i*/, int /*stored*/) { indices.push_back(row); }); | ||||||
|
|
||||||
| IS is; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'is' is not initialized [cppcoreguidelines-init-variables]
Suggested change
|
||||||
| BOUT_DO_PETSC(ISCreateGeneral(BoutComm::get(), static_cast<PetscInt>(indices.size()), | ||||||
| indices.data(), PETSC_COPY_VALUES, &is)); | ||||||
| return is; | ||||||
| } | ||||||
|
|
||||||
| Mat PetscCellMapping::extractEvolvingSubmatrix( | ||||||
| const PetscOperator<CellSpaceTag, CellSpaceTag>& op) const { | ||||||
| IS is = makeEvolvingIS(); | ||||||
|
|
||||||
| Mat sub; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'sub' is not initialized [cppcoreguidelines-init-variables]
Suggested change
|
||||||
| BOUT_DO_PETSC(MatCreateSubMatrix(op.raw(), is, is, MAT_INITIAL_MATRIX, &sub)); | ||||||
|
|
||||||
| BOUT_DO_PETSC(ISDestroy(&is)); | ||||||
|
|
||||||
| return sub; | ||||||
| } | ||||||
|
|
||||||
| PetscLegMapping::PetscLegMapping(int total_legs, std::vector<int> local_leg_indices) { | ||||||
| std::sort(local_leg_indices.begin(), local_leg_indices.end()); | ||||||
| local_leg_indices.erase(std::unique(local_leg_indices.begin(), local_leg_indices.end()), | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: no header providing "std::size_t" is directly included [misc-include-cleaner]
src/mesh/petsc_operators.cxx:1:
+ #include <cstddef>