Conversation
Allows to compile and run all tests by running: make -j 4 build-check-all && make check-all
The shift-transform in staggered location requieres dz. To calculate the staggered dz in y direction, the parallel transform is requiered. Thus we special handel the case if dz is constant, and we can do a trivial staggering, without a parallel transform. For non-const dz, staggered dz needs to be given in an input file, so we don't have to interpolate. Also make isConst a free function, similar to min and max.
If we are deeper nested, omp_get_thread_num isn't unique anymore
* Add metric3D to cmake * cmake with -DENABLE_METRIC_3D=ON to get 3D metrics * Due to the out-of-source build we need to python dirs, one for noarch files, and one for arched ones
otherwise python finds boututils in one pythonpath, and does not look in other locations for the other file.
Some solver throw errors otherwise
Read the environment variable BOUT_SHOW_BACKTRACE. If the variable is set, show the backtrace, otherwise just show the message. The allows to get the backtrace without having to attache gdb, or catch the exception. The default behaviour is not changed.
Previously no boundary was detection because the index cannot be out of bounds in both directions
| REGION region = RGN_NOBNDRY) { \ | ||
| return func(f, outloc, toString(method), toString(region)); \ | ||
| } | ||
| #define DERIV_FUNC_REGION_ENUM_TO_STRING(func, T, Tr) \ |
There was a problem hiding this comment.
warning: function-like macro DERIV_FUNC_REGION_ENUM_TO_STRING used; consider a constexpr template function [cppcoreguidelines-macro-usage]
#define DERIV_FUNC_REGION_ENUM_TO_STRING(func, T, Tr) \
^|
|
||
| // Need to use temporary arrays to store result | ||
| Field2D gx{emptyFrom(x)}, gy{emptyFrom(y)}, gz{emptyFrom(z)}; | ||
| Coordinates::FieldMetric gx{emptyFrom(x)}, gy{emptyFrom(y)}, gz{emptyFrom(z)}; |
There was a problem hiding this comment.
warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
Coordinates::FieldMetric gx{emptyFrom(x)}, gy{emptyFrom(y)}, gz{emptyFrom(z)};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
|
||
| // Need to use temporary arrays to store result | ||
| Field2D gx{emptyFrom(x)}, gy{emptyFrom(y)}, gz{emptyFrom(z)}; | ||
| Coordinates::FieldMetric gx{emptyFrom(x)}, gy{emptyFrom(y)}, gz{emptyFrom(z)}; |
There was a problem hiding this comment.
warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
Coordinates::FieldMetric gx{emptyFrom(x)}, gy{emptyFrom(y)}, gz{emptyFrom(z)};
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Returning non-const objects has no disadvantage for const correctness and is easier to read.
* Previously, only the inner-most boundary point was set, which could cause problems with interpolation
| ////////////////// DOT PRODUCT /////////////////// | ||
|
|
||
| const Field2D Vector2D::operator*(const Vector2D &rhs) const { | ||
| const Coordinates::FieldMetric Vector2D::operator*(const Vector2D& rhs) const { |
There was a problem hiding this comment.
warning: return type const Coordinates::FieldMetric (aka const Field2D) is const-qualified at the top level, which may reduce code readability without improving const correctness [readability-const-return-type]
const Coordinates::FieldMetric Vector2D::operator*(const Vector2D& rhs) const {
^~~~~~|
|
||
| // Return the magnitude of a vector | ||
| const Field2D abs(const Vector2D &v, const std::string& region) { | ||
| const Coordinates::FieldMetric abs(const Vector2D& v, const std::string& region) { |
There was a problem hiding this comment.
warning: return type const Coordinates::FieldMetric (aka const Field2D) is const-qualified at the top level, which may reduce code readability without improving const correctness [readability-const-return-type]
const Coordinates::FieldMetric abs(const Vector2D& v, const std::string& region) {
^~~~~~| BoutReal coef1=0.0, coef2=0.0, coef3=0.0, coef4=0.0, | ||
| coef5=0.0, coef6=0.0, kwave; | ||
|
|
||
| BoutReal coef1 = 0.0, coef2 = 0.0, coef3 = 0.0, coef4 = 0.0, coef5 = 0.0, coef6 = 0.0; |
There was a problem hiding this comment.
warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
BoutReal coef1 = 0.0, coef2 = 0.0, coef3 = 0.0, coef4 = 0.0, coef5 = 0.0, coef6 = 0.0;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Return non-const should be preferred
…erged2 Conflicts: include/bout/invert/laplacexz.hxx src/invert/laplacexz/impls/petsc/laplacexz-petsc.cxx
After communication we might have invalid points, this is fixed by applying boundaries.
Merge recent changes to fix CI
[3D metric] Use Bxy.ydown() for div_a_laplace_perp
[3D metric] Ensure boundaries are valid
* next: Mark unused function arguments with MAYBE_UNUSED De-abbreviate exception message Use constants in setting default_dz for Coordinates unit test Fix expectation for default value Do not ignore default value Fix mpark_submodule if not called from local directory Add additional targets for submodules Some basic tests of Coordinates inputs Basic tests of Coordinates Enable FakeGridDataSource to provide values to Mesh
| */ | ||
| const Field2D shiftZ(const Field2D& f, const Field2D& UNUSED(zangle), | ||
| const std::string UNUSED(region) = "RGN_NOX") const { | ||
| Field2D shiftZ(const Field2D& f, const Field2D& UNUSED(zangle), |
There was a problem hiding this comment.
warning: method shiftZ can be made static [readability-convert-member-functions-to-static]
Field2D shiftZ(const Field2D& f, const Field2D& UNUSED(zangle),
^
static| const Field2D shiftZ(const Field2D& f, const Field2D& UNUSED(zangle), | ||
| const std::string UNUSED(region) = "RGN_NOX") const { | ||
| Field2D shiftZ(const Field2D& f, const Field2D& UNUSED(zangle), | ||
| const std::string UNUSED(region) = "RGN_NOX") const { |
There was a problem hiding this comment.
warning: the const qualified parameter UNUSED_region is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
const std::string UNUSED(region) = "RGN_NOX") const {
^
&
/github/workspace/include/unused.hxx:29:20: note: expanded from macro 'UNUSED'
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
^
note: expanded from here| const Field2D shiftZ(const Field2D& f, const Field2D& UNUSED(zangle), | ||
| REGION UNUSED(region)) const { | ||
| "const std::string& region = \"RGN_NOX\") instead")]] Field2D | ||
| shiftZ(const Field2D& f, const Field2D& UNUSED(zangle), REGION UNUSED(region)) const { |
There was a problem hiding this comment.
warning: method shiftZ can be made static [readability-convert-member-functions-to-static]
shiftZ(const Field2D& f, const Field2D& UNUSED(zangle), REGION UNUSED(region)) const {
^ ~~~~~~| const YDirectionType y_direction_out, | ||
| const std::string& region = "RGN_NOX") const; | ||
| Field3D shiftZ(const Field3D& f, const Tensor<dcomplex>& phs, | ||
| const YDirectionType y_direction_out, |
There was a problem hiding this comment.
warning: parameter y_direction_out is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const YDirectionType y_direction_out,
^~~~~~| const YDirectionType y_direction_out, | ||
| const std::string& region = "RGN_NOX") const; | ||
| FieldPerp shiftZ(const FieldPerp& f, const Tensor<dcomplex>& phs, | ||
| const YDirectionType y_direction_out, |
There was a problem hiding this comment.
warning: parameter y_direction_out is const-qualified in the function declaration; const-qualification of parameters only has an effect in function definitions [readability-avoid-const-params-in-decls]
const YDirectionType y_direction_out,
^~~~~~| void BoundaryFree::apply_ddt(Field2D& UNUSED(f)) { | ||
| // Do nothing for free boundary | ||
| } | ||
| int jx, jy, jz, jzp, jzm; |
There was a problem hiding this comment.
warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]
int jx, jy, jz, jzp, jzm;
^~~~~~~~~~~~~~~~~~~~~~~~~| void BoundaryFree::apply_ddt(Field2D& UNUSED(f)) { | ||
| // Do nothing for free boundary | ||
| } | ||
| int jx, jy, jz, jzp, jzm; |
There was a problem hiding this comment.
warning: variable jx is not initialized [cppcoreguidelines-init-variables]
int jx, jy, jz, jzp, jzm;
^
= 0| void BoundaryFree::apply_ddt(Field2D& UNUSED(f)) { | ||
| // Do nothing for free boundary | ||
| } | ||
| int jx, jy, jz, jzp, jzm; |
There was a problem hiding this comment.
warning: variable jy is not initialized [cppcoreguidelines-init-variables]
int jx, jy, jz, jzp, jzm;
^
= 0| void BoundaryFree::apply_ddt(Field2D& UNUSED(f)) { | ||
| // Do nothing for free boundary | ||
| } | ||
| int jx, jy, jz, jzp, jzm; |
There was a problem hiding this comment.
warning: variable jz is not initialized [cppcoreguidelines-init-variables]
int jx, jy, jz, jzp, jzm;
^
= 0| void BoundaryFree::apply_ddt(Field2D& UNUSED(f)) { | ||
| // Do nothing for free boundary | ||
| } | ||
| int jx, jy, jz, jzp, jzm; |
There was a problem hiding this comment.
warning: variable jzp is not initialized [cppcoreguidelines-init-variables]
int jx, jy, jz, jzp, jzm;
^
= 0|
@bshanahan @dschwoerer I'm happy to merge this when the tests pass, but between you please could you create one or two integrated 3D tests? Analytic answers would obviously be lovely, but a regression test would be fine! Maybe two waves in a rotating ellipsis? |
|
🥳 🍾 |
Fixes #1668
(copied from comment below for better visibility)
I tried to look at all open comments, and I think this is the list of stuff that needs to be done (feel free to edit)
@ZedThree 3D metrics #2025 (comment)
Commit f5dccc9 by @bshanahan