Skip to content

Conversation

@dschwoerer
Copy link
Contributor

@dschwoerer dschwoerer commented Nov 6, 2025

Here a summary of the changes:

Field3DParallel

A Field3DParallel is essentially a Field3D, that preserves the parallel slices.
This allows to avoid unnecessary computation of of parallel fields, that are not needed.
It also ensures parallel slices are present (for FCI) when later parallel derivatives are computed.
So any function that will call DDY later on, can change the signature to Field3DParallel to declare that parallel slices need to be present for FCI.

New Y-Boundary Operators

Custom sheath boundary conditions can now be implemented using an abstraction. The documentation is on RTD
That allows having one code path for FCI and FA, for upper and lower sheath BC, all in one place.

Various small fixups

loadParallelMetrics

For FCI the parallel slices of the metric components are loaded, as they are sometimes needed.
This makes FCI essentially 3D only.
There is now also the option to say a field is not allow to compute the parallel slices, to avoid overwriting them: allowCalcParallelSlices.

Tracking on failure

Only if the simulation fails to evolve (Currently euler and pvode only):
The different components of timederivate are dumped to a BOUT.debug.*.nc which can be handy for figuring out which term is causing the instability. No more having to re-run the simulation with some terms disabled to debug such issues. This causes (an unkown) memory overhead - but ONLY if the solver has failed already.

More names of parallel boundary region + cleanup of code

Support things like bndry_par_xin or bndry_par_yup.

Add monotonichermitespline for all cases

Merged into hermitespline and works also in parallel.

Support several parallel slices for FCI

MYG=2 is now supported.

lower_bound takes into account the data is sorted
Ensures we all ways check for monotonicity
Tags were different for sender and receiver
Otherwise mpi might wait for the wrong request.
to avoid confusion whether the offsets are for sending or receiving
This allows to write code for FCI and non-FCI using templates.
Using a local set for each thread ensures we do not need a mutex for
adding data, at the cost of having to merge the different sets later.
Copy link
Contributor

@github-actions github-actions bot left a comment

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 267. Check the log or trigger a new build to see more.

result[i] = B[i] * (term + penalty) / (2 * dy[i] * sqrt(g_22[i]));

#if CHECK > 0
if (!std::isfinite(result[i])) {
Copy link
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 "std::isfinite" is directly included [misc-include-cleaner]

);
                                  ^


return standardDerivative<T, DIRECTION::X, DERIV::Standard>(f, outloc, method, region);
}
inline Field3D DDX(const Field3DParallel& f, CELL_LOC outloc = CELL_DEFAULT,
Copy link
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 "Field3DParallel" is directly included [misc-include-cleaner]

include/bout/index_derivs_interface.hxx:31:

- #include "bout/traits.hxx"
+ #include "bout/field3d.hxx"
+ #include "bout/traits.hxx"

if (f.isFci()) {
ASSERT1(f.getDirectionY() == YDirectionType::Standard);
if (!f.hasParallelSlices()) {
throw BoutException(
Copy link
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 "BoutException" is directly included [misc-include-cleaner]

include/bout/index_derivs_interface.hxx:31:

- #include "bout/traits.hxx"
+ #include "bout/boutexception.hxx"
+ #include "bout/traits.hxx"


class XZHermiteSpline : public XZInterpolation {
template <bool monotonic>
class XZHermiteSplineBase : public XZInterpolation {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: class 'XZHermiteSplineBase' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions]

class XZHermiteSplineBase : public XZInterpolation {
      ^

Tensor<SpecificInd<IND_TYPE::IND_3D>> i_corner; // index of bottom-left grid point
Tensor<int> k_corner; // z-index of bottom-left grid point

std::unique_ptr<GlobalField3DAccess> gf3daccess;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'gf3daccess' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  std::unique_ptr<GlobalField3DAccess> gf3daccess;
                                       ^

IndicesIter bndry_position;
struct Indices {
// Indices of the boundary point
Ind3D index;
Copy link
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 "Ind3D" is directly included [misc-include-cleaner]

include/bout/parallel_boundary_region.hxx:8:

- #include "bout/sys/parallel_stencils.hxx"
+ #include "bout/region.hxx"
+ #include "bout/sys/parallel_stencils.hxx"

signed char valid;
signed char offset;
unsigned char abs_offset;
Indices(Ind3D index, RealPoint&& intersection, BoutReal length, signed char valid,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: rvalue reference parameter 'intersection' is never moved from inside the function body [cppcoreguidelines-rvalue-reference-param-not-moved]

  Indices(Ind3D index, RealPoint&& intersection, BoutReal length, signed char valid,
                                   ^

switch (mode) {
case SheathLimitMode::limit_free:
case SheathLimitMode::exponential_free:
fp = SQ(fc) / fm; // Exponential
Copy link
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 "SQ" is directly included [misc-include-cleaner]

include/bout/parallel_boundary_region.hxx:9:

- #include <bout/field3d.hxx>
+ #include "bout/utils.hxx"
+ #include <bout/field3d.hxx>

fp = SQ(fc) / fm; // Exponential
break;
case SheathLimitMode::linear_free:
fp = 2.0 * fc - fm; // Linear
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
fp = 2.0 * fc - fm; // Linear
fp = (2.0 * fc) - fm; // Linear

BoutReal length, signed char valid) {
bndry_points.push_back({xyz2ind(ix, iy, iz, localmesh), {x, y, z}, length, valid});

#if CHECKLEVEL >= 2
Copy link
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 "CHECKLEVEL" is directly included [misc-include-cleaner]

include/bout/parallel_boundary_region.hxx:3:

- #include "bout/boundary_region.hxx"
+ #include "bout/assert.hxx"
+ #include "bout/boundary_region.hxx"

Copy link
Contributor

@github-actions github-actions bot left a comment

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 242. Check the log or trigger a new build to see more.

bndry_points.push_back({xyz2ind(ix, iy, iz, localmesh), {x, y, z}, length, valid});

#if CHECKLEVEL >= 2
if (!std::isfinite(fp)) {
Copy link
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 "std::isfinite" is directly included [misc-include-cleaner]

include/bout/parallel_boundary_region.hxx:5:

- #include <functional>
+ #include <cmath>
+ #include <functional>

// extrapolate a given point to the boundary
BoutReal extrapolate_sheath_o1(const Field3D& f) const { return ythis(f); }
BoutReal extrapolate_sheath_o2(const Field3D& f) const {
ASSERT3(valid() >= 0);
Copy link
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 "ASSERT3" is directly included [misc-include-cleaner]

    ASSERT3(valid() >= 0);
    ^

}
return ythis(f) * (1 + length()) - yprev(f) * length();
}
inline BoutReal
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: function 'extrapolate_sheath_o1' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]

Suggested change
inline BoutReal
BoutReal

extrapolate_sheath_o1(const std::function<BoutReal(int yoffset, Ind3D ind)>& f) const {
return ythis(f);
}
inline BoutReal
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: function 'extrapolate_sheath_o2' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]

Suggested change
inline BoutReal
BoutReal

// extrapolate a given point to the boundary
BoutReal extrapolate_o1(const Field3D& f) const { return f[ind()]; }
BoutReal extrapolate_o2(const Field3D& f) const {
inline BoutReal interpolate_sheath_o2(const Field3D& f) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: function 'interpolate_sheath_o2' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]

Suggested change
inline BoutReal interpolate_sheath_o2(const Field3D& f) const {
BoutReal interpolate_sheath_o2(const Field3D& f) const {

#endif

private:
const IndicesVec& bndry_points;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'bndry_points' of type 'const std::vectorbout::parallel_boundary_region::Indices &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]

  const IndicesVec& bndry_points;
                    ^

const BoutReal& yprev(const Field3D& f) const { return f.ynext(-dir)[ind().yp(-dir)]; }
BoutReal& yprev(Field3D& f) const { return f.ynext(-dir)[ind().yp(-dir)]; }
public:
const int dir;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'dir' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const int dir;
            ^

const BoutReal& yprev(const Field3D& f) const { return f.ynext(-dir)[ind().yp(-dir)]; }
BoutReal& yprev(Field3D& f) const { return f.ynext(-dir)[ind().yp(-dir)]; }
public:
const int dir;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'dir' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  const int dir;
            ^

BoutReal& yprev(Field3D& f) const { return f.ynext(-dir)[ind().yp(-dir)]; }
public:
const int dir;
Mesh* localmesh;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'localmesh' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Mesh* localmesh;
        ^


class BoundaryRegionPar : public BoundaryRegionBase {
public:
BoundaryRegionPar(const std::string& name, int dir, Mesh* passmesh)
Copy link
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 "std::string" is directly included [misc-include-cleaner]

include/bout/parallel_boundary_region.hxx:6:

- #include <vector>
+ #include <string>
+ #include <vector>

Copy link
Contributor

@github-actions github-actions bot left a comment

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 217. Check the log or trigger a new build to see more.

public:
BoundaryRegionPar(const std::string& name, int dir, Mesh* passmesh)
: BoundaryRegionBase(name, passmesh), dir(dir) {
ASSERT0(std::abs(dir) == 1);
Copy link
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 "ASSERT0" is directly included [misc-include-cleaner]

    ASSERT0(std::abs(dir) == 1);
    ^

public:
BoundaryRegionPar(const std::string& name, int dir, Mesh* passmesh)
: BoundaryRegionBase(name, passmesh), dir(dir) {
ASSERT0(std::abs(dir) == 1);
Copy link
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 "std::abs" is directly included [misc-include-cleaner]

include/bout/parallel_boundary_region.hxx:5:

- #include <functional>
+ #include <cstdlib>
+ #include <functional>

bool isDone() final { return (bndry_position == std::end(bndry_points)); }

bool contains(const BoundaryRegionPar& bndry) const {
ASSERT2(is_sorted);
Copy link
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 "ASSERT2" is directly included [misc-include-cleaner]

    ASSERT2(is_sorted);
    ^


bool contains(const BoundaryRegionPar& bndry) const {
ASSERT2(is_sorted);
return std::binary_search(std::begin(bndry_points), std::end(bndry_points),
Copy link
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 "std::binary_search" is directly included [misc-include-cleaner]

include/bout/parallel_boundary_region.hxx:5:

- #include <functional>
+ #include <algorithm>
+ #include <functional>


bool contains(const int ix, const int iy, const int iz) const {
const auto i2 = xyz2ind(ix, iy, iz, localmesh);
for (auto i1 : bndry_points) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: replace loop by 'std::any_of()' [readability-use-anyofallof]

    for (auto i1 : bndry_points) {
    ^

inline BoutReal dirichlet_o1(BoutReal UNUSED(spacing0), BoutReal value0) {
return value0;
}
inline BoutReal dirichlet_o2(BoutReal spacing0, BoutReal value0, BoutReal spacing1,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

inline BoutReal dirichlet_o2(BoutReal spacing0, BoutReal value0, BoutReal spacing1,
                                                ^

inline BoutReal dirichlet_o1(BoutReal UNUSED(spacing0), BoutReal value0) {
return value0;
}
inline BoutReal dirichlet_o2(BoutReal spacing0, BoutReal value0, BoutReal spacing1,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

inline BoutReal dirichlet_o2(BoutReal spacing0, BoutReal value0, BoutReal spacing1,
                             ^

inline BoutReal dirichlet_o1(BoutReal UNUSED(spacing0), BoutReal value0) {
return value0;
}
inline BoutReal dirichlet_o2(BoutReal spacing0, BoutReal value0, BoutReal spacing1,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

inline BoutReal dirichlet_o2(BoutReal spacing0, BoutReal value0, BoutReal spacing1,
       ^

return value0;
}
inline BoutReal dirichlet_o2(BoutReal spacing0, BoutReal value0, BoutReal spacing1,
BoutReal value1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

                             BoutReal value1) {
                             ^

BoutReal value1) {
return (spacing0 * value1 - spacing1 * value0) / (spacing0 - spacing1);
}
inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
                                                                       ^

This allows dependent projects to check whether BOUT++ was compiled e.g. with
3D metrics.
Copy link
Contributor

@github-actions github-actions bot left a comment

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 190. Check the log or trigger a new build to see more.

BoutReal value1) {
return (spacing0 * value1 - spacing1 * value0) / (spacing0 - spacing1);
}
inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
                                                      ^

BoutReal value1) {
return (spacing0 * value1 - spacing1 * value0) / (spacing0 - spacing1);
}
inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
                           ^

BoutReal value1) {
return (spacing0 * value1 - spacing1 * value0) / (spacing0 - spacing1);
}
inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
       ^

BoutReal value1) {
return (spacing0 * value1 - spacing1 * value0) / (spacing0 - spacing1);
}
inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'spacing0' [clang-diagnostic-error]

inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
                                           ^

return (spacing0 * value1 - spacing1 * value0) / (spacing0 - spacing1);
}
inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1,
BoutReal value1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unknown type name 'BoutReal' [clang-diagnostic-error]

                           BoutReal value1) {
                           ^


Field2D::Field2D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes directions_in)
Field2D::Field2D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes directions_in,
std::optional<size_t> UNUSED(regionID))
Copy link
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 "std::optional" is directly included [misc-include-cleaner]

src/field/field2d.cxx:40:

+ #include <optional>

/// Constructor
Field3D::Field3D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes directions_in)
: Field(localmesh, location_in, directions_in) {
Field3D::Field3D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes directions_in,
Copy link
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 "CELL_LOC" is directly included [misc-include-cleaner]

src/field/field3d.cxx:27:

- #include "bout/build_defines.hxx"
+ #include "bout/bout_types.hxx"
+ #include "bout/build_defines.hxx"

/// Constructor
Field3D::Field3D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes directions_in)
: Field(localmesh, location_in, directions_in) {
Field3D::Field3D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes directions_in,
Copy link
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 "DirectionTypes" is directly included [misc-include-cleaner]

Field3D::Field3D(Mesh* localmesh, CELL_LOC location_in, DirectionTypes directions_in,
                                                        ^

Field3DParallel::Field3DParallel(const BoutReal val, Mesh* localmesh)
: Field3D(localmesh) {

TRACE("Field3DParallel: Copy constructor from value");
Copy link
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 "TRACE" is directly included [misc-include-cleaner]

src/field/field3d.cxx:29:

- #include <bout/boutcomm.hxx>
+ #include "bout/index_derivs_interface.hxx"
+ #include <bout/boutcomm.hxx>


FieldPerp::FieldPerp(Mesh* localmesh, CELL_LOC location_in, int yindex_in,
DirectionTypes directions)
DirectionTypes directions, std::optional<size_t> UNUSED(regionID))
Copy link
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 "DirectionTypes" is directly included [misc-include-cleaner]

                     DirectionTypes directions, std::optional<size_t> UNUSED(regionID))
                     ^

Copy link
Contributor

@github-actions github-actions bot left a comment

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 165. Check the log or trigger a new build to see more.

result[index] = lhs[index] * rhs[index];
}

#if BOUT_USE_TRACK
Copy link
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_USE_TRACK" is directly included [misc-include-cleaner]

src/field/generated_fieldops.cxx:1:

- #include <bout/field2d.hxx>
+ #include "bout/build_defines.hxx"
+ #include <bout/field2d.hxx>

}

#if BOUT_USE_TRACK
result.name = fmt::format("{:s} * {:s}", lhs.name, rhs.name);
Copy link
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 "fmt::format" is directly included [misc-include-cleaner]

src/field/generated_fieldops.cxx:1:

- #include <bout/field2d.hxx>
+ #include "fmt/format.h"
+ #include <bout/field2d.hxx>


track(rhs, "operator*=");
#if BOUT_USE_TRACK
name = fmt::format("{:s} *= {:s}", this->name, rhs.name);
Copy link
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 "fmt::format" is directly included [misc-include-cleaner]

  name = fmt::format("{:s} *= {:s}", this->name, rhs.name);
              ^

}

#if BOUT_USE_TRACK
result.name = fmt::format("{:s} * {:s}", lhs.name, "BR");
Copy link
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 "fmt::format" is directly included [misc-include-cleaner]

  result.name = fmt::format("{:s} * {:s}", lhs.name, "BR");
                     ^


track(rhs, "operator*=");
#if BOUT_USE_TRACK
name = fmt::format("{:s} *= {:s}", this->name, "BR");
Copy link
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 "fmt::format" is directly included [misc-include-cleaner]

  name = fmt::format("{:s} *= {:s}", this->name, "BR");
              ^

}
// If the initial guess is not set to zero
if (!isGlobalFlagSet(INVERT_START_NEW)) {
KSPSetInitialGuessNonzero(ksp, static_cast<PetscBool>(true));
Copy link
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 "KSPSetInitialGuessNonzero" is directly included [misc-include-cleaner]

          KSPSetInitialGuessNonzero(ksp, static_cast<PetscBool>(true));
          ^

}
// If the initial guess is not set to zero
if (!isGlobalFlagSet(INVERT_START_NEW)) {
KSPSetInitialGuessNonzero(ksp, static_cast<PetscBool>(true));
Copy link
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 "PetscBool" is directly included [misc-include-cleaner]

          KSPSetInitialGuessNonzero(ksp, static_cast<PetscBool>(true));
                                                     ^

// construction of the object
if (pctype == PCSHELL) {
// User-supplied preconditioner function
PCShellSetApply(pc, laplacePCapply);
Copy link
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 "PCShellSetApply" is directly included [misc-include-cleaner]

          PCShellSetApply(pc, laplacePCapply);
          ^

if (pctype == PCSHELL) {
// User-supplied preconditioner function
PCShellSetApply(pc, laplacePCapply);
PCShellSetContext(pc, this);
Copy link
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 "PCShellSetContext" is directly included [misc-include-cleaner]

          PCShellSetContext(pc, this);
          ^

PCShellSetApply(pc, laplacePCapply);
PCShellSetContext(pc, this);
if (rightprec) {
KSPSetPCSide(ksp, PC_RIGHT); // Right preconditioning
Copy link
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 "KSPSetPCSide" is directly included [misc-include-cleaner]

            KSPSetPCSide(ksp, PC_RIGHT); // Right preconditioning
            ^

Copy link
Contributor

@github-actions github-actions bot left a comment

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 144. Check the log or trigger a new build to see more.

#endif

/// Factors to allow for some wiggleroom
BoutReal abs_fac_monotonic{1e-2};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'abs_fac_monotonic' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  BoutReal abs_fac_monotonic{1e-2};
           ^

#endif

/// Factors to allow for some wiggleroom
BoutReal abs_fac_monotonic{1e-2};
Copy link
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 "BoutReal" is directly included [misc-include-cleaner]

include/bout/interpolation_xz.hxx:26:

- #include "bout/build_defines.hxx"
+ #include "bout/bout_types.hxx"
+ #include "bout/build_defines.hxx"


/// Factors to allow for some wiggleroom
BoutReal abs_fac_monotonic{1e-2};
BoutReal rel_fac_monotonic{1e-1};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member variable 'rel_fac_monotonic' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  BoutReal rel_fac_monotonic{1e-1};
           ^

PCShellSetApply(pc, laplacePCapply);
PCShellSetContext(pc, this);
if (rightprec) {
KSPSetPCSide(ksp, PC_RIGHT); // Right preconditioning
Copy link
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 "PC_RIGHT" is directly included [misc-include-cleaner]

            KSPSetPCSide(ksp, PC_RIGHT); // Right preconditioning
                              ^

if (rightprec) {
KSPSetPCSide(ksp, PC_RIGHT); // Right preconditioning
} else {
KSPSetPCSide(ksp, PC_LEFT); // Left preconditioning
Copy link
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 "PC_LEFT" is directly included [misc-include-cleaner]

            KSPSetPCSide(ksp, PC_LEFT); // Left preconditioning
                              ^


const Coordinates::FieldMetric& Coordinates::Jg() const {
if (not JgCache.has_value()) {
auto* coords = this; //
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Suggested change
auto* coords = this; //
const auto* coords = this; //

if (_g_22_ylow.has_value()) {
return *_g_22_ylow;
}
_g_22_ylow.emplace(emptyFrom(g_22));
Copy link
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 "emptyFrom" is directly included [misc-include-cleaner]

  _g_22_ylow.emplace(emptyFrom(g_22));
                     ^

}
_g_22_ylow.emplace(emptyFrom(g_22));
//_g_22_ylow->setLocation(CELL_YLOW);
auto mesh = Bxy.getMesh();
Copy link
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 = Bxy.getMesh();
auto *mesh = Bxy.getMesh();

//_g_22_ylow->setLocation(CELL_YLOW);
auto mesh = Bxy.getMesh();
if (Bxy.isFci()) {
if (mesh->get(_g_22_ylow.value(), "g_22_cell_ylow", 0.0, false)) { //, CELL_YLOW)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]

Suggested change
if (mesh->get(_g_22_ylow.value(), "g_22_cell_ylow", 0.0, false)) { //, CELL_YLOW)) {
if (mesh->get(_g_22_ylow.value(), "g_22_cell_ylow", 0.0, false) != 0) { //, CELL_YLOW)) {

} else {
ASSERT0(mesh->ystart > 0);
BOUT_FOR(i, g_22.getRegion("RGN_NOY")) {
_g_22_ylow.value()[i] = SQ(0.5 * (sqrt(g_22[i]) + sqrt(g_22[i.ym()])));
Copy link
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 "sqrt" is directly included [misc-include-cleaner]

      _g_22_ylow.value()[i] = SQ(0.5 * (sqrt(g_22[i]) + sqrt(g_22[i.ym()])));
                                        ^

dschwoerer and others added 2 commits February 4, 2026 11:34
Copy link
Contributor

@github-actions github-actions bot left a comment

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 118. Check the log or trigger a new build to see more.

}
_g_22_yhigh.emplace(emptyFrom(g_22));
//_g_22_yhigh->setLocation(CELL_YHIGH);
auto mesh = Bxy.getMesh();
Copy link
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 = Bxy.getMesh();
auto *mesh = Bxy.getMesh();

//_g_22_yhigh->setLocation(CELL_YHIGH);
auto mesh = Bxy.getMesh();
if (Bxy.isFci()) {
if (mesh->get(_g_22_yhigh.value(), "g_22_cell_yhigh", 0.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]

src/mesh/coordinates.cxx:2083:

-                   false)) { //, CELL_YHIGH)) {
+                   false) != 0) { //, CELL_YHIGH)) {

}

Coordinates::FieldMetric& Coordinates::g_22_yhigh() {
return const_cast<Coordinates::FieldMetric&>(
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use const_cast to remove const qualifier [cppcoreguidelines-pro-type-const-cast]

  return const_cast<Coordinates::FieldMetric&>(
         ^

}

Coordinates::FieldMetric& Coordinates::g_22_ylow() {
return const_cast<Coordinates::FieldMetric&>(
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not use const_cast to remove const qualifier [cppcoreguidelines-pro-type-const-cast]

  return const_cast<Coordinates::FieldMetric&>(
         ^

if (!_jxz_ylow.has_value()) {
_compute_Jxz_cell_faces();
}
return *_jxz_ylow;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: unchecked access to optional value [bugprone-unchecked-optional-access]

  return *_jxz_ylow;
          ^

if (!fci) {
yzresult.setDirectionY(YDirectionType::Aligned);
}
yzresult.setDirectionY(YDirectionType::Aligned);
Copy link
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 "YDirectionType" is directly included [misc-include-cleaner]

 mesh);
                                 ^

} else {
result += fromFieldAligned(yzresult);
}
result += fromFieldAligned(yzresult);
Copy link
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 "fromFieldAligned" is directly included [misc-include-cleaner]

 }
                    ^

Field3D Div_par_K_Grad_par(const Field3D& Kin, const Field3D& fin, bool bndry_flux) {

if (Kin.isFci()) {
return ::Div_par_K_Grad_par(Kin, fin);
Copy link
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 "Div_par_K_Grad_par" is directly included [misc-include-cleaner]

src/mesh/fv_ops.cxx:0:

- #include <bout/fv_ops.hxx>
+ #include "bout/difops.hxx"
+ #include <bout/fv_ops.hxx>


const auto region2 =
y_offset == 0 ? "RGN_NOY" : fmt::format("RGN_YPAR_{:+d}", y_offset);
std::unique_ptr<GlobalField3DAccessInstance> gf;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'gf' of type 'std::unique_ptr' can be declared 'const' [misc-const-correctness]

Suggested change
std::unique_ptr<GlobalField3DAccessInstance> gf;
std::unique_ptr<GlobalField3DAccessInstance> const gf;


if constexpr (monotonic) {
#endif
const auto corners = {(*gf)[IndG3D(g3dinds[i][0])], (*gf)[IndG3D(g3dinds[i][1])],
Copy link
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 "IndG3D" is directly included [misc-include-cleaner]

      const auto corners = {(*gf)[IndG3D(g3dinds[i][0])], (*gf)[IndG3D(g3dinds[i][1])],
                                  ^

Copy link
Contributor

@github-actions github-actions bot left a comment

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 93. Check the log or trigger a new build to see more.

f_interp[iyp] = std::min(f_interp[iyp], minmax.second + diff);
}
#if USE_NEW_WEIGHTS and defined(HS_USE_PETSC)
ASSERT2(std::isfinite(cptr[int(i)]));
Copy link
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 "std::isfinite" is directly included [misc-include-cleaner]

    ASSERT2(std::isfinite(cptr[int(i)]));
                 ^

#if USE_NEW_WEIGHTS and defined(HS_USE_PETSC)
ASSERT2(std::isfinite(cptr[int(i)]));
}
VecRestoreArrayRead(result, &cptr);
Copy link
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 "VecRestoreArrayRead" is directly included [misc-include-cleaner]

  VecRestoreArrayRead(result, &cptr);
  ^


// Derivatives are used for tension and need to be on dimensionless
// coordinates
Field3D fx = bout::derivatives::index::DDX(f, CELL_DEFAULT, "DEFAULT");
Copy link
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 "CELL_DEFAULT" is directly included [misc-include-cleaner]

  Field3D fx = bout::derivatives::index::DDX(f, CELL_DEFAULT, "DEFAULT");
                                                ^


// Then in X
f_interp(x, y_next, z) = lagrange_4pt(xvals, t_x(x, y, z));
ASSERT2(std::isfinite(f_interp(x, y_next, z)));
Copy link
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 "ASSERT2" is directly included [misc-include-cleaner]

    ASSERT2(std::isfinite(f_interp(x, y_next, z)));
    ^


// Then in X
f_interp(x, y_next, z) = lagrange_4pt(xvals, t_x(x, y, z));
ASSERT2(std::isfinite(f_interp(x, y_next, z)));
Copy link
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 "std::isfinite" is directly included [misc-include-cleaner]

    ASSERT2(std::isfinite(f_interp(x, y_next, z)));
                 ^

proc = npe - 1;
}
}
int loc = id - local * proc;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
int loc = id - local * proc;
int loc = id - (local * proc);

proc = npe - 1;
}
}
int loc = id - local * proc;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'loc' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int loc = id - local * proc;
int const loc = id - local * proc;

#if CHECK > 1
if ((loc < 0 or loc > localwith or proc < 0 or proc >= npe)
or (periodic and (loc < mg or loc >= local + mg))) {
printf("globalToLocal1D failure: %d %d, %d %d, %d %d %s\n", id, idwo, globalwith,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]

      printf("globalToLocal1D failure: %d %d, %d %d, %d %d %s\n", id, idwo, globalwith,
      ^

#if CHECK > 1
if ((loc < 0 or loc > localwith or proc < 0 or proc >= npe)
or (periodic and (loc < mg or loc >= local + mg))) {
printf("globalToLocal1D failure: %d %d, %d %d, %d %d %s\n", id, idwo, globalwith,
Copy link
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 "printf" is directly included [misc-include-cleaner]

src/mesh/parallel/fci_comm.hxx:34:

- #include <map>
+ #include <cstdio>
+ #include <map>

};
template <class ind>
struct XYZ2Ind {
const int nx;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'nx' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const int nx;
            ^

Copy link
Contributor

@github-actions github-actions bot left a comment

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 68. Check the log or trigger a new build to see more.

template <class ind>
struct XYZ2Ind {
const int nx;
const int ny;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'ny' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const int ny;
            ^

struct XYZ2Ind {
const int nx;
const int ny;
const int nz;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'nz' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const int nz;
            ^

const int ny;
const int nz;
ind convert(const int x, const int y, const int z) const {
return {z + (y + x * ny) * nz, ny, nz};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
return {z + (y + x * ny) * nz, ny, nz};
return {z + ((y + x * ny) * nz), ny, nz};


GlobalField3DAccessInstance(const GlobalField3DAccess* gfa,
const std::vector<BoutReal>&& data)
: gfa(*gfa), data(std::move(data)){};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: std::move of the const variable 'data' has no effect; remove std::move() or make the variable non-const [performance-move-const-arg]

Suggested change
: gfa(*gfa), data(std::move(data)){};
: gfa(*gfa), data(data){};

: gfa(*gfa), data(std::move(data)){};

private:
const GlobalField3DAccess& gfa;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'gfa' of type 'const GlobalField3DAccess &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]

  const GlobalField3DAccess& gfa;
                             ^

int cnt = 0;
for ([[maybe_unused]] auto dummy : reqs) {
int ind{0};
auto ret = MPI_Waitany(reqs.size(), &reqs[0], &ind, MPI_STATUS_IGNORE);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]

Suggested change
auto ret = MPI_Waitany(reqs.size(), &reqs[0], &ind, MPI_STATUS_IGNORE);
auto ret = MPI_Waitany(reqs.size(), reqs.data(), &ind, MPI_STATUS_IGNORE);

int cnt = 0;
for ([[maybe_unused]] auto dummy : reqs) {
int ind{0};
auto ret = MPI_Waitany(reqs.size(), &reqs[0], &ind, MPI_STATUS_IGNORE);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

      auto ret = MPI_Waitany(reqs.size(), &reqs[0], &ind, MPI_STATUS_IGNORE);
                             ^

sendBufferSize += toSendSizes[ind];
toSend[ind].resize(toSendSizes[ind], -1);

ret = MPI_Irecv(static_cast<void*>(toSend[ind].data()), toSend[ind].size(), MPI_INT,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

      ret = MPI_Irecv(static_cast<void*>(toSend[ind].data()), toSend[ind].size(), MPI_INT,
                                                              ^

ASSERT0(ret == MPI_SUCCESS);
}
for (size_t proc = 0; proc < toGet.size(); ++proc) {
if (toGet[proc].size() != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]

Suggested change
if (toGet[proc].size() != 0) {
if (!toGet[proc].empty()) {
Additional context

/usr/include/c++/15/bits/stl_vector.h:1222: method 'vector'::empty() defined here

      empty() const _GLIBCXX_NOEXCEPT
      ^

for (size_t proc = 0; proc < toGet.size(); ++proc) {
if (toGet[proc].size() != 0) {
const auto ret = MPI_Send(static_cast<void*>(toGet[proc].data()),
toGet[proc].size(), MPI_INT, proc, 666 * 666, comm);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

                                  toGet[proc].size(), MPI_INT, proc, 666 * 666, comm);
                                                               ^

Copy link
Contributor

@github-actions github-actions bot left a comment

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 68. Check the log or trigger a new build to see more.

template <class ind>
struct XYZ2Ind {
const int nx;
const int ny;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'ny' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const int ny;
            ^

struct XYZ2Ind {
const int nx;
const int ny;
const int nz;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'nz' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const int nz;
            ^

const int ny;
const int nz;
ind convert(const int x, const int y, const int z) const {
return {z + (y + x * ny) * nz, ny, nz};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]

Suggested change
return {z + (y + x * ny) * nz, ny, nz};
return {z + ((y + x * ny) * nz), ny, nz};


GlobalField3DAccessInstance(const GlobalField3DAccess* gfa,
const std::vector<BoutReal>&& data)
: gfa(*gfa), data(std::move(data)){};
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: std::move of the const variable 'data' has no effect; remove std::move() or make the variable non-const [performance-move-const-arg]

Suggested change
: gfa(*gfa), data(std::move(data)){};
: gfa(*gfa), data(data){};

: gfa(*gfa), data(std::move(data)){};

private:
const GlobalField3DAccess& gfa;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'gfa' of type 'const GlobalField3DAccess &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]

  const GlobalField3DAccess& gfa;
                             ^

int cnt = 0;
for ([[maybe_unused]] auto dummy : reqs) {
int ind{0};
auto ret = MPI_Waitany(reqs.size(), &reqs[0], &ind, MPI_STATUS_IGNORE);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]

Suggested change
auto ret = MPI_Waitany(reqs.size(), &reqs[0], &ind, MPI_STATUS_IGNORE);
auto ret = MPI_Waitany(reqs.size(), reqs.data(), &ind, MPI_STATUS_IGNORE);

int cnt = 0;
for ([[maybe_unused]] auto dummy : reqs) {
int ind{0};
auto ret = MPI_Waitany(reqs.size(), &reqs[0], &ind, MPI_STATUS_IGNORE);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

      auto ret = MPI_Waitany(reqs.size(), &reqs[0], &ind, MPI_STATUS_IGNORE);
                             ^

sendBufferSize += toSendSizes[ind];
toSend[ind].resize(toSendSizes[ind], -1);

ret = MPI_Irecv(static_cast<void*>(toSend[ind].data()), toSend[ind].size(), MPI_INT,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

      ret = MPI_Irecv(static_cast<void*>(toSend[ind].data()), toSend[ind].size(), MPI_INT,
                                                              ^

ASSERT0(ret == MPI_SUCCESS);
}
for (size_t proc = 0; proc < toGet.size(); ++proc) {
if (toGet[proc].size() != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]

Suggested change
if (toGet[proc].size() != 0) {
if (!toGet[proc].empty()) {
Additional context

/usr/include/c++/15/bits/stl_vector.h:1222: method 'vector'::empty() defined here

      empty() const _GLIBCXX_NOEXCEPT
      ^

for (size_t proc = 0; proc < toGet.size(); ++proc) {
if (toGet[proc].size() != 0) {
const auto ret = MPI_Send(static_cast<void*>(toGet[proc].data()),
toGet[proc].size(), MPI_INT, proc, 666 * 666, comm);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

                                  toGet[proc].size(), MPI_INT, proc, 666 * 666, comm);
                                                               ^

Copy link
Contributor

@github-actions github-actions bot left a comment

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 43. Check the log or trigger a new build to see more.

for (size_t proc = 0; proc < toGet.size(); ++proc) {
if (toGet[proc].size() != 0) {
const auto ret = MPI_Send(static_cast<void*>(toGet[proc].data()),
toGet[proc].size(), MPI_INT, proc, 666 * 666, comm);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

                                  toGet[proc].size(), MPI_INT, proc, 666 * 666, comm);
                                  ^

std::set<int> ids;
std::map<int, int> mapping;
bool is_setup{false};
const fci_comm::globalToLocal1D g2lx;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'g2lx' of type 'const fci_comm::globalToLocal1D' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const fci_comm::globalToLocal1D g2lx;
                                  ^

std::map<int, int> mapping;
bool is_setup{false};
const fci_comm::globalToLocal1D g2lx;
const fci_comm::globalToLocal1D g2ly;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'g2ly' of type 'const fci_comm::globalToLocal1D' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const fci_comm::globalToLocal1D g2ly;
                                  ^

bool is_setup{false};
const fci_comm::globalToLocal1D g2lx;
const fci_comm::globalToLocal1D g2ly;
const fci_comm::globalToLocal1D g2lz;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'g2lz' of type 'const fci_comm::globalToLocal1D' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const fci_comm::globalToLocal1D g2lz;
                                  ^

const fci_comm::globalToLocal1D g2lz;

public:
const fci_comm::XYZ2Ind<Ind3D> xyzl;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: member 'xyzl' of type 'const fci_comm::XYZ2Ind' (aka 'const XYZ2Ind<SpecificInd<IND_TYPE::IND_3D>>') is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]

  const fci_comm::XYZ2Ind<Ind3D> xyzl;
                                 ^

(dump_at_time >= 0 && std::abs(dump_at_time - curtime) < dt) || dump_at_time < -3;
std::unique_ptr<Options> debug_ptr;
if (dump_now) {
debug_ptr = std::make_unique<Options>();
Copy link
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 "std::make_unique" is directly included [misc-include-cleaner]

    debug_ptr = std::make_unique<Options>();
                     ^

debug_ptr = std::make_unique<Options>();
Options& debug = *debug_ptr;
for (auto& f : f3d) {
f.F_var->enableTracking(fmt::format("ddt_{:s}", f.name), debug);
Copy link
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 "fmt::format" is directly included [misc-include-cleaner]

src/solver/impls/euler/euler.cxx:2:

+ #include "fmt/format.h"

Options& debug = *debug_ptr;
Mesh* mesh{nullptr};
for (auto& f : f3d) {
saveParallel(debug, f.name, *f.var);
Copy link
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 "saveParallel" is directly included [misc-include-cleaner]

      saveParallel(debug, f.name, *f.var);
      ^

}

const std::string outnumber =
dump_at_time < -3 ? fmt::format(".{}", debug_counter++) : "";
Copy link
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 "fmt::format" is directly included [misc-include-cleaner]

        dump_at_time < -3 ? fmt::format(".{}", debug_counter++) : "";
                                 ^

const std::string outnumber =
dump_at_time < -3 ? fmt::format(".{}", debug_counter++) : "";
const std::string outname =
fmt::format("{}/BOUT.debug{}.{}.nc",
Copy link
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 "fmt::format" is directly included [misc-include-cleaner]

        fmt::format("{}/BOUT.debug{}.{}.nc",
             ^

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants