Repository navigation
add Div_a_Grad_perp_FCI_unstructured - #3523
dschwoerer wants to merge 4 commits into
Conversation
Div_a_Grad_perp_FCI chooses automatically between structured and unstructured. This makes this completely automatic to calling code.
| #include "bout/output_bout_types.hxx" // NOLINT(unused-includes, misc-include-cleaner) | ||
| #include "bout/region.hxx" | ||
| #include "bout/vector2d.hxx" | ||
| #if BOUT_HAS_PETSC |
There was a problem hiding this comment.
warning: no header providing "BOUT_HAS_PETSC" is directly included [misc-include-cleaner]
include/bout/fv_ops.hxx:8:
- #include "bout/field.hxx"
+ #include "bout/build_defines.hxx"
+ #include "bout/field.hxx"| #include "bout/vector2d.hxx" | ||
| #if BOUT_HAS_PETSC | ||
| #include <bout/petsclib.hxx> | ||
| #include <petscmat.h> |
There was a problem hiding this comment.
warning: included header petsclib.hxx is not used directly [misc-include-cleaner]
| #include <petscmat.h> | |
| #include <petscmat.h> |
| static std::shared_ptr<Div_a_Grad_perp_FCI> create(Mesh* mesh, BoutReal rho_s0); | ||
| }; | ||
|
|
||
| class Div_a_Grad_perp_FCI_structured : public Div_a_Grad_perp_FCI { |
There was a problem hiding this comment.
warning: destructor of 'Div_a_Grad_perp_FCI_structured' is public and non-virtual [cppcoreguidelines-virtual-class-destructor]
_s0);
^Additional context
include/bout/fv_ops.hxx:224: make it public and virtual
_s0);
^| static std::map<Mesh*, std::weak_ptr<Div_a_Grad_perp_FCI>> op_cache; | ||
| }; | ||
|
|
||
| class Div_a_Grad_perp_FCI_unstructured : public Div_a_Grad_perp_FCI { |
There was a problem hiding this comment.
warning: destructor of 'Div_a_Grad_perp_FCI_unstructured' is public and non-virtual [cppcoreguidelines-virtual-class-destructor]
ache;
^Additional context
include/bout/fv_ops.hxx:250: make it public and virtual
ache;
^| #include "bout/utils.hxx" | ||
| #include <bout/yboundary_regions.hxx> | ||
|
|
||
| #if BOUT_HAS_PETSC |
There was a problem hiding this comment.
warning: no header providing "BOUT_HAS_PETSC" is directly included [misc-include-cleaner]
src/mesh/fv_ops.cxx:1:
- #include "bout/fv_ops_impl.hxx"
+ #include "bout/build_defines.hxx"
+ #include "bout/fv_ops_impl.hxx"| BOUT_DO_PETSC(MatCreateAIJ(BoutComm::get(), rowsplit.end - rowsplit.start, | ||
| colsplit.end - colsplit.start, PETSC_DETERMINE, | ||
| PETSC_DETERMINE, 0, d_nnz.data(), 0, o_nnz.data(), &mat)); | ||
| PetscInt M, N; |
There was a problem hiding this comment.
warning: variable 'N' is not initialized [cppcoreguidelines-init-variables]
PetscInt M, N;
^this fix will not be applied because it overlaps with another fix
| PETSC_DETERMINE, 0, d_nnz.data(), 0, o_nnz.data(), &mat)); | ||
| PetscInt M, N; | ||
| BOUT_DO_PETSC(MatGetSize(mat, &M, &N)); | ||
| PetscInt m, n; |
There was a problem hiding this comment.
warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
| PetscInt m, n; | |
| PetscInt m; | |
| PetscInt n; |
| PETSC_DETERMINE, 0, d_nnz.data(), 0, o_nnz.data(), &mat)); | ||
| PetscInt M, N; | ||
| BOUT_DO_PETSC(MatGetSize(mat, &M, &N)); | ||
| PetscInt m, n; |
There was a problem hiding this comment.
warning: variable 'm' is not initialized [cppcoreguidelines-init-variables]
PetscInt m, n;
^this fix will not be applied because it overlaps with another fix
| PETSC_DETERMINE, 0, d_nnz.data(), 0, o_nnz.data(), &mat)); | ||
| PetscInt M, N; | ||
| BOUT_DO_PETSC(MatGetSize(mat, &M, &N)); | ||
| PetscInt m, n; |
There was a problem hiding this comment.
warning: variable 'n' is not initialized [cppcoreguidelines-init-variables]
PetscInt m, n;
^this fix will not be applied because it overlaps with another fix
| return mat; | ||
| } | ||
| void setVecFromField(Vec vec, Field3D f) { | ||
| auto mesh = f.getMesh(); |
There was a problem hiding this comment.
warning: 'auto mesh' can be declared as 'auto *mesh' [readability-qualified-auto]
| auto mesh = f.getMesh(); | |
| auto *mesh = f.getMesh(); |
| return dagp; | ||
| } | ||
|
|
||
| Div_a_Grad_perp_FCI_unstructured::Div_a_Grad_perp_FCI_unstructured(Mesh* mesh, |
There was a problem hiding this comment.
warning: constructor does not initialize these fields: inField, inA, vecGrad, vecInterp, multiplied, result [cppcoreguidelines-pro-type-member-init]
include/bout/fv_ops.hxx:267:
- inField;
- Vec inA;
- vecGrad;
- ecInterp;
- ltiplied;
+ inField{};
+ Vec inA;{}
+ vecGrad;
+ ecIn{}terp;
+ ltiplied;{}{}include/bout/fv_ops.hxx:273:
- t;
+ t{};| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecGrad)); | ||
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecInterp)); | ||
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied)); | ||
| PetscInt M, N; |
There was a problem hiding this comment.
warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
| PetscInt M, N; | |
| PetscInt M; | |
| PetscInt N; |
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecGrad)); | ||
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecInterp)); | ||
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied)); | ||
| PetscInt M, N; |
There was a problem hiding this comment.
warning: variable 'M' is not initialized [cppcoreguidelines-init-variables]
PetscInt M, N;
^this fix will not be applied because it overlaps with another fix
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecGrad)); | ||
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecInterp)); | ||
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied)); | ||
| PetscInt M, N; |
There was a problem hiding this comment.
warning: variable 'N' is not initialized [cppcoreguidelines-init-variables]
PetscInt M, N;
^this fix will not be applied because it overlaps with another fix
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied)); | ||
| PetscInt M, N; | ||
| BOUT_DO_PETSC(MatGetSize(Div, &M, &N)); | ||
| PetscInt m, n; |
There was a problem hiding this comment.
warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
| PetscInt m, n; | |
| PetscInt m; | |
| PetscInt n; |
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied)); | ||
| PetscInt M, N; | ||
| BOUT_DO_PETSC(MatGetSize(Div, &M, &N)); | ||
| PetscInt m, n; |
There was a problem hiding this comment.
warning: variable 'm' is not initialized [cppcoreguidelines-init-variables]
PetscInt m, n;
^this fix will not be applied because it overlaps with another fix
| BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied)); | ||
| PetscInt M, N; | ||
| BOUT_DO_PETSC(MatGetSize(Div, &M, &N)); | ||
| PetscInt m, n; |
There was a problem hiding this comment.
warning: variable 'n' is not initialized [cppcoreguidelines-init-variables]
PetscInt m, n;
^this fix will not be applied because it overlaps with another fix
| BOUT_DO_PETSC(MatGetSize(Div, &M, &N)); | ||
| PetscInt m, n; | ||
| BOUT_DO_PETSC(MatGetLocalSize(Div, &m, &n)); | ||
| for (auto vec : {inField, inA, result, vecGrad, vecInterp, multiplied}) { |
There was a problem hiding this comment.
warning: 'auto vec' can be declared as 'auto *vec' [readability-qualified-auto]
| for (auto vec : {inField, inA, result, vecGrad, vecInterp, multiplied}) { | |
| for (auto *vec : {inField, inA, result, vecGrad, vecInterp, multiplied}) { |
Div_a_Grad_perp_FCI chooses automatically between structured and unstructured. This makes this completely automatic to calling code.