Conversation
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.
We want to skip sending if there is no data for this process ...
The result needs to be well understood, as the indices are a mix of local and global indices, as we need to access non-local data.
| public: | ||
| BoundaryRegionPar(const std::string& name, int dir, Mesh* passmesh) | ||
| : BoundaryRegionBase(name, passmesh), dir(dir) { | ||
| ASSERT0(std::abs(dir) == 1); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
| BoutReal value1) { | ||
| return (spacing0 * value1 - spacing1 * value0) / (spacing0 - spacing1); | ||
| } | ||
| inline BoutReal neumann_o2(BoutReal UNUSED(spacing0), BoutReal value0, BoutReal spacing1, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
warning: no header providing "DirectionTypes" is directly included [misc-include-cleaner]
DirectionTypes directions, std::optional<size_t> UNUSED(regionID))
^| result[index] = lhs[index] * rhs[index]; | ||
| } | ||
|
|
||
| #if BOUT_USE_TRACK |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
warning: no header providing "KSPSetPCSide" is directly included [misc-include-cleaner]
KSPSetPCSide(ksp, PC_RIGHT); // Right preconditioning
^| #endif | ||
|
|
||
| /// Factors to allow for some wiggleroom | ||
| BoutReal abs_fac_monotonic{1e-2}; |
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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; // |
There was a problem hiding this comment.
warning: 'auto *coords' can be declared as 'const auto *coords' [readability-qualified-auto]
| auto* coords = this; // | |
| const auto* coords = this; // |
| if (_g_22_ylow.has_value()) { | ||
| return *_g_22_ylow; | ||
| } | ||
| _g_22_ylow.emplace(emptyFrom(g_22)); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
warning: 'auto mesh' can be declared as 'auto *mesh' [readability-qualified-auto]
| 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)) { |
There was a problem hiding this comment.
warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]
| 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()]))); |
There was a problem hiding this comment.
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()])));
^Co-authored-by: Peter Hill <peter.hill@york.ac.uk>
| } | ||
| _g_22_yhigh.emplace(emptyFrom(g_22)); | ||
| //_g_22_yhigh->setLocation(CELL_YHIGH); | ||
| auto mesh = Bxy.getMesh(); |
There was a problem hiding this comment.
warning: 'auto mesh' can be declared as 'auto *mesh' [readability-qualified-auto]
| 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, |
There was a problem hiding this comment.
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&>( |
There was a problem hiding this comment.
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&>( |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
warning: unchecked access to optional value [bugprone-unchecked-optional-access]
return *_jxz_ylow;
^| if (!fci) { | ||
| yzresult.setDirectionY(YDirectionType::Aligned); | ||
| } | ||
| yzresult.setDirectionY(YDirectionType::Aligned); |
There was a problem hiding this comment.
warning: no header providing "YDirectionType" is directly included [misc-include-cleaner]
mesh);
^| } else { | ||
| result += fromFieldAligned(yzresult); | ||
| } | ||
| result += fromFieldAligned(yzresult); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
warning: variable 'gf' of type 'std::unique_ptr' can be declared 'const' [misc-const-correctness]
| 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])], |
There was a problem hiding this comment.
warning: no header providing "IndG3D" is directly included [misc-include-cleaner]
const auto corners = {(*gf)[IndG3D(g3dinds[i][0])], (*gf)[IndG3D(g3dinds[i][1])],
^| 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)])); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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))); |
There was a problem hiding this comment.
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))); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
warning: '*' has higher precedence than '-'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
| int loc = id - local * proc; | |
| int loc = id - (local * proc); |
| proc = npe - 1; | ||
| } | ||
| } | ||
| int loc = id - local * proc; |
There was a problem hiding this comment.
warning: variable 'loc' of type 'int' can be declared 'const' [misc-const-correctness]
| 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, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
warning: member 'nx' of type 'const int' is const qualified [cppcoreguidelines-avoid-const-or-ref-data-members]
const int nx;
^| template <class ind> | ||
| struct XYZ2Ind { | ||
| const int nx; | ||
| const int ny; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
| 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)){}; |
There was a problem hiding this comment.
warning: std::move of the const variable 'data' has no effect; remove std::move() or make the variable non-const [performance-move-const-arg]
| : gfa(*gfa), data(std::move(data)){}; | |
| : gfa(*gfa), data(data){}; |
| : gfa(*gfa), data(std::move(data)){}; | ||
|
|
||
| private: | ||
| const GlobalField3DAccess& gfa; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]
| 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); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
| 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); |
There was a problem hiding this comment.
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);
^| template <class ind> | ||
| struct XYZ2Ind { | ||
| const int nx; | ||
| const int ny; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
warning: '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations [readability-math-missing-parentheses]
| 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)){}; |
There was a problem hiding this comment.
warning: std::move of the const variable 'data' has no effect; remove std::move() or make the variable non-const [performance-move-const-arg]
| : gfa(*gfa), data(std::move(data)){}; | |
| : gfa(*gfa), data(data){}; |
| : gfa(*gfa), data(std::move(data)){}; | ||
|
|
||
| private: | ||
| const GlobalField3DAccess& gfa; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]
| 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); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
| 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); |
There was a problem hiding this comment.
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);
^| 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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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>(); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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++) : ""; |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
warning: no header providing "fmt::format" is directly included [misc-include-cleaner]
fmt::format("{}/BOUT.debug{}.{}.nc",
^
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
DDYlater on, can change the signature toField3DParallelto 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.*.ncwhich 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_xinorbndry_par_yup.Add monotonichermitespline for all cases
Merged into hermitespline and works also in parallel.
Support several parallel slices for FCI
MYG=2is now supported.