Skip to content

add Div_a_Grad_perp_FCI_unstructured - #3523

Draft
dschwoerer wants to merge 4 commits into
nextfrom
dagp-fci-us
Draft

dschwoerer wants to merge 4 commits into
nextfrom
dagp-fci-us

Conversation

@dschwoerer

Copy link
Copy Markdown
Contributor

Div_a_Grad_perp_FCI chooses automatically between structured and unstructured. This makes this completely automatic to calling code.

Div_a_Grad_perp_FCI chooses automatically between structured and
unstructured. This makes this completely automatic to calling code.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 42. Check the log or trigger a new build to see more.

Comment thread include/bout/fv_ops.hxx
#include "bout/output_bout_types.hxx" // NOLINT(unused-includes, misc-include-cleaner)
#include "bout/region.hxx"
#include "bout/vector2d.hxx"
#if BOUT_HAS_PETSC

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Comment thread include/bout/fv_ops.hxx
#include "bout/vector2d.hxx"
#if BOUT_HAS_PETSC
#include <bout/petsclib.hxx>
#include <petscmat.h>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header petsclib.hxx is not used directly [misc-include-cleaner]

Suggested change
#include <petscmat.h>
#include <petscmat.h>

Comment thread include/bout/fv_ops.hxx
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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
                ^

Comment thread include/bout/fv_ops.hxx
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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
                ^

Comment thread src/mesh/fv_ops.cxx
#include "bout/utils.hxx"
#include <bout/yboundary_regions.hxx>

#if BOUT_HAS_PETSC

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Comment thread src/mesh/fv_ops.cxx
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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'N' is not initialized [cppcoreguidelines-init-variables]

  PetscInt M, N;
              ^

this fix will not be applied because it overlaps with another fix

Comment thread src/mesh/fv_ops.cxx
PETSC_DETERMINE, 0, d_nnz.data(), 0, o_nnz.data(), &mat));
PetscInt M, N;
BOUT_DO_PETSC(MatGetSize(mat, &M, &N));
PetscInt m, n;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]

Suggested change
PetscInt m, n;
PetscInt m;
PetscInt n;

Comment thread src/mesh/fv_ops.cxx
PETSC_DETERMINE, 0, d_nnz.data(), 0, o_nnz.data(), &mat));
PetscInt M, N;
BOUT_DO_PETSC(MatGetSize(mat, &M, &N));
PetscInt m, n;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'm' is not initialized [cppcoreguidelines-init-variables]

  PetscInt m, n;
           ^

this fix will not be applied because it overlaps with another fix

Comment thread src/mesh/fv_ops.cxx
PETSC_DETERMINE, 0, d_nnz.data(), 0, o_nnz.data(), &mat));
PetscInt M, N;
BOUT_DO_PETSC(MatGetSize(mat, &M, &N));
PetscInt m, n;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'n' is not initialized [cppcoreguidelines-init-variables]

  PetscInt m, n;
              ^

this fix will not be applied because it overlaps with another fix

Comment thread src/mesh/fv_ops.cxx
return mat;
}
void setVecFromField(Vec vec, Field3D f) {
auto mesh = f.getMesh();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'auto mesh' can be declared as 'auto *mesh' [readability-qualified-auto]

Suggested change
auto mesh = f.getMesh();
auto *mesh = f.getMesh();

@dschwoerer
dschwoerer marked this pull request as draft October 27, 2026 13:38

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/mesh/fv_ops.cxx
return dagp;
}

Div_a_Grad_perp_FCI_unstructured::Div_a_Grad_perp_FCI_unstructured(Mesh* mesh,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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{};

Comment thread src/mesh/fv_ops.cxx
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecGrad));
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecInterp));
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied));
PetscInt M, N;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]

Suggested change
PetscInt M, N;
PetscInt M;
PetscInt N;

Comment thread src/mesh/fv_ops.cxx
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecGrad));
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecInterp));
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied));
PetscInt M, N;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'M' is not initialized [cppcoreguidelines-init-variables]

  PetscInt M, N;
           ^

this fix will not be applied because it overlaps with another fix

Comment thread src/mesh/fv_ops.cxx
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecGrad));
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &vecInterp));
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied));
PetscInt M, N;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'N' is not initialized [cppcoreguidelines-init-variables]

  PetscInt M, N;
              ^

this fix will not be applied because it overlaps with another fix

Comment thread src/mesh/fv_ops.cxx
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied));
PetscInt M, N;
BOUT_DO_PETSC(MatGetSize(Div, &M, &N));
PetscInt m, n;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]

Suggested change
PetscInt m, n;
PetscInt m;
PetscInt n;

Comment thread src/mesh/fv_ops.cxx
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied));
PetscInt M, N;
BOUT_DO_PETSC(MatGetSize(Div, &M, &N));
PetscInt m, n;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'm' is not initialized [cppcoreguidelines-init-variables]

  PetscInt m, n;
           ^

this fix will not be applied because it overlaps with another fix

Comment thread src/mesh/fv_ops.cxx
BOUT_DO_PETSC(VecCreate(BoutComm::get(), &multiplied));
PetscInt M, N;
BOUT_DO_PETSC(MatGetSize(Div, &M, &N));
PetscInt m, n;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'n' is not initialized [cppcoreguidelines-init-variables]

  PetscInt m, n;
              ^

this fix will not be applied because it overlaps with another fix

Comment thread src/mesh/fv_ops.cxx
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}) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'auto vec' can be declared as 'auto *vec' [readability-qualified-auto]

Suggested change
for (auto vec : {inField, inA, result, vecGrad, vecInterp, multiplied}) {
for (auto *vec : {inField, inA, result, vecGrad, vecInterp, multiplied}) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant