Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow X splitting with FCI #2651

Open
wants to merge 48 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3583476
Switch hermite_spline_xz to index
dschwoerer Dec 16, 2021
4ec74ef
Switch toward regions
dschwoerer Sep 22, 2021
d096020
Switch to regions for FCI regions
dschwoerer Sep 24, 2021
d2a81bf
Use region_id in interpolation
dschwoerer Nov 19, 2021
ea5640f
Switch hermite_spline_xz to index
dschwoerer Dec 16, 2021
089ddfa
Improve hermitesplinesXZ
dschwoerer Nov 16, 2022
de7d1de
Cleanup
dschwoerer Nov 17, 2022
8a1c230
Enable splitting in X using PETSc
dschwoerer Feb 2, 2023
8234ccf
Test parallised interpolation if PETSc is found
dschwoerer Feb 2, 2023
9525e2c
Fall back to region if not shifted
dschwoerer Feb 2, 2023
b62082c
Split in X only if we have PETSc
dschwoerer Feb 2, 2023
e147bc5
Add test-interpolate for splitting in X
dschwoerer Feb 2, 2023
62d5bbe
Cleanup
dschwoerer Feb 2, 2023
5c32415
Only run in parallel if we split in X
dschwoerer Feb 2, 2023
a4a28c6
Delete object
dschwoerer Feb 3, 2023
0e28dc1
Create PetscVecs only once
dschwoerer Feb 3, 2023
66bde04
Be more general about cleaning up before BoutFinialise
dschwoerer Feb 3, 2023
adba877
Run different interpolations in the fci test
dschwoerer Feb 3, 2023
cbaf894
Fix parallel boundary region with x splitting
dschwoerer Feb 7, 2023
5673f0c
Add integrated test for FCI X splitting
dschwoerer Feb 7, 2023
9149bf4
Apply black changes
dschwoerer Feb 8, 2023
a088700
Apply clang-format changes
dschwoerer Feb 8, 2023
32ea2fd
Apply clang-format changes
dschwoerer Feb 8, 2023
faac69c
Apply clang-format changes
dschwoerer Feb 8, 2023
0ee0d07
Merge remote-tracking branch 'origin/next' into fci-splitting
dschwoerer Feb 4, 2024
49cd985
Merge remote-tracking branch 'origin/next' into fci-splitting
dschwoerer Feb 4, 2024
4566405
Apply black changes
dschwoerer Feb 4, 2024
4935742
CI: install wget
dschwoerer Feb 4, 2024
01a436c
Merge remote-tracking branch 'origin/next' into fci-splitting
dschwoerer Feb 4, 2024
147a872
Apply clang-format changes
dschwoerer Feb 4, 2024
cee68f2
Add asserts to serial methods to avoid using in parallel
dschwoerer Feb 7, 2024
15aaa05
Apply clang-format changes
dschwoerer Feb 7, 2024
eba722b
Merge branch 'par-bc-cleanup' into fci-splitting
dschwoerer Feb 7, 2024
30ea7e3
Remove accidentially added files
dschwoerer Feb 13, 2024
66ff716
Merge remote-tracking branch 'origin/next' into fci-splitting
dschwoerer Feb 13, 2024
10d320f
Use parallel_neumann as BC
dschwoerer Feb 15, 2024
4b05708
fix usage of f-string
dschwoerer Feb 15, 2024
60224e4
Use localmesh
dschwoerer Feb 19, 2024
608bb5d
add PETSc requirement for MPI test
dschwoerer Feb 19, 2024
88741c5
Update header location
dschwoerer Feb 19, 2024
09f609b
More const correctness
dschwoerer Feb 19, 2024
d46efba
Merge branch 'origin/next' into fci-splitting
dschwoerer Mar 19, 2024
b7786ff
Merge branch 'par-bc-improve' into fci-splitting
dschwoerer Apr 29, 2024
e5157ad
Fix bad merge
dschwoerer Apr 29, 2024
2a9172e
Merge branch 'next' into fci-splitting
dschwoerer May 17, 2024
25667e4
Update docs
dschwoerer May 30, 2024
1c31c29
Update test
dschwoerer May 30, 2024
2e872b4
Merge branch 'next' into fci-splitting
dschwoerer Oct 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci_fedora.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ then
# Ignore weak depencies
echo "install_weak_deps=False" >> /etc/dnf/dnf.conf
time dnf -y install dnf5
time dnf5 -y install dnf5-plugins cmake python3-zoidberg python3-natsort
time dnf5 -y install dnf5-plugins cmake python3-zoidberg python3-natsort wget
# Allow to override packages - see #2073
time dnf5 copr enable -y davidsch/fixes4bout || :
time dnf5 -y upgrade
Expand Down
16 changes: 15 additions & 1 deletion cmake/BOUT++functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ endfunction()
#
function(bout_add_integrated_or_mms_test BUILD_CHECK_TARGET TESTNAME)
set(options USE_RUNTEST USE_DATA_BOUT_INP)
set(oneValueArgs EXECUTABLE_NAME PROCESSORS)
set(oneValueArgs EXECUTABLE_NAME PROCESSORS DOWNLOAD DOWNLOAD_NAME)
set(multiValueArgs SOURCES EXTRA_FILES REQUIRES CONFLICTS TESTARGS EXTRA_DEPENDS)
cmake_parse_arguments(BOUT_TEST_OPTIONS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

Expand Down Expand Up @@ -202,6 +202,20 @@ function(bout_add_integrated_or_mms_test BUILD_CHECK_TARGET TESTNAME)
add_custom_target(${TESTNAME})
endif()

if (BOUT_TEST_OPTIONS_DOWNLOAD)
if (NOT BOUT_TEST_OPTIONS_DOWNLOAD_NAME)
message(FATAL_ERROR "We need DOWNLOAD_NAME if we should DOWNLOAD!")
endif()
set(output )
add_custom_command(OUTPUT ${BOUT_TEST_OPTIONS_DOWNLOAD_NAME}
COMMAND wget ${BOUT_TEST_OPTIONS_DOWNLOAD} -O ${BOUT_TEST_OPTIONS_DOWNLOAD_NAME}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Downloading ${BOUT_TEST_OPTIONS_DOWNLOAD_NAME}"
)
add_custom_target(download_test_data DEPENDS ${BOUT_TEST_OPTIONS_DOWNLOAD_NAME})
add_dependencies(${TESTNAME} download_test_data)
endif()

if (BOUT_TEST_OPTIONS_EXTRA_DEPENDS)
add_dependencies(${TESTNAME} ${BOUT_TEST_OPTIONS_EXTRA_DEPENDS})
endif()
Expand Down
118 changes: 77 additions & 41 deletions include/bout/interpolation_xz.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@

#include "bout/mask.hxx"

#define USE_NEW_WEIGHTS 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: macro 'USE_NEW_WEIGHTS' used to declare a constant; consider using a 'constexpr' constant [cppcoreguidelines-macro-usage]

#define USE_NEW_WEIGHTS 1
        ^

#if BOUT_HAS_PETSC
#define HS_USE_PETSC 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: macro 'HS_USE_PETSC' used to declare a constant; consider using a 'constexpr' constant [cppcoreguidelines-macro-usage]

#define HS_USE_PETSC 1
        ^

#endif

#ifdef HS_USE_PETSC
#include "bout/petsclib.hxx"
#endif

class Options;

/// Interpolate a field onto a perturbed set of points
Expand All @@ -43,57 +52,52 @@ public:
protected:
Mesh* localmesh{nullptr};

std::string region_name;
std::shared_ptr<Region<Ind3D>> region{nullptr};
int region_id{-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 'region_id' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  int region_id{-1};
      ^


public:
XZInterpolation(int y_offset = 0, Mesh* localmeshIn = nullptr)
: y_offset(y_offset),
localmesh(localmeshIn == nullptr ? bout::globals::mesh : localmeshIn) {}
XZInterpolation(const BoutMask& mask, int y_offset = 0, Mesh* mesh = nullptr)
: XZInterpolation(y_offset, mesh) {
region = regionFromMask(mask, localmesh);
setMask(mask);
}
XZInterpolation(const std::string& region_name, int y_offset = 0, Mesh* mesh = nullptr)
: y_offset(y_offset), localmesh(mesh), region_name(region_name) {}
XZInterpolation(std::shared_ptr<Region<Ind3D>> region, int y_offset = 0,
Mesh* mesh = nullptr)
: y_offset(y_offset), localmesh(mesh), region(std::move(region)) {}
: y_offset(y_offset), localmesh(mesh),
region_id(localmesh->getRegionID(region_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: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

        region_id(localmesh->getRegionID(region_name)) {}
                  ^

XZInterpolation(const Region<Ind3D>& region, int y_offset = 0, Mesh* mesh = nullptr)
: y_offset(y_offset), localmesh(mesh) {
setRegion(region);
}
virtual ~XZInterpolation() = default;

void setMask(const BoutMask& mask) {
region = regionFromMask(mask, localmesh);
region_name = "";
}
void setMask(const BoutMask& mask) { setRegion(regionFromMask(mask, localmesh)); }
void setRegion(const std::string& region_name) {
this->region_name = region_name;
this->region = nullptr;
}
void setRegion(const std::shared_ptr<Region<Ind3D>>& region) {
this->region_name = "";
this->region = region;
this->region_id = localmesh->getRegionID(region_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: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

    this->region_id = localmesh->getRegionID(region_name);
                      ^

}
void setRegion(const std::unique_ptr<Region<Ind3D>> region) { setRegion(*region); }
void setRegion(const Region<Ind3D>& region) {
this->region_name = "";
this->region = std::make_shared<Region<Ind3D>>(region);
std::string name;
int i = 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: variable name 'i' is too short, expected at least 3 characters [readability-identifier-length]

    int i = 0;
        ^

do {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: avoid do-while loops [cppcoreguidelines-avoid-do-while]

    do {
    ^

name = fmt::format("unsec_reg_xz_interp_{:d}", 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: variable name 'i' is too short, expected at least 3 characters [readability-identifier-length]

    int i = 0;
        ^

} while (localmesh->hasRegion3D(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: avoid do-while loops [cppcoreguidelines-avoid-do-while]

    do {
    ^

localmesh->addRegion(name, region);
this->region_id = localmesh->getRegionID(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: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

    this->region_id = localmesh->getRegionID(name);
                      ^

}
Region<Ind3D> getRegion() const {
if (!region_name.empty()) {
return localmesh->getRegion(region_name);
}
ASSERT1(region != nullptr);
return *region;
const Region<Ind3D>& getRegion() 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: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions]

    this->region_id = localmesh->getRegionID(name);
                      ^

ASSERT2(region_id != -1);
return localmesh->getRegion(region_id);
}
Region<Ind3D> getRegion(const std::string& region) const {
const bool has_region = !region_name.empty() or this->region != nullptr;
if (!region.empty() and region != "RGN_ALL") {
if (has_region) {
return intersection(localmesh->getRegion(region), getRegion());
}
const Region<Ind3D>& getRegion(const std::string& region) const {
if (region_id == -1) {
return localmesh->getRegion(region);
}
ASSERT1(has_region);
return getRegion();
if (region == "" or region == "RGN_ALL") {
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 comparing to an empty object [readability-container-size-empty]

Suggested change
if (region == "" or region == "RGN_ALL") {
if (region.empty() or region == "RGN_ALL") {
Additional context

/usr/include/c++/12/bits/basic_string.h:1190: method 'basic_string'::empty() defined here

      empty() const _GLIBCXX_NOEXCEPT
      ^

return getRegion();
}
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 comparing to an empty object [readability-container-size-empty]

Suggested change
}
if (region.empty() or region == "RGN_ALL") {
Additional context

/usr/include/c++/12/bits/basic_string.h:1190: method 'basic_string'::empty() defined here

      empty() const _GLIBCXX_NOEXCEPT
      ^

return localmesh->getRegion(
localmesh->getCommonRegion(localmesh->getRegionID(region), region_id));
}
virtual void calcWeights(const Field3D& delta_x, const Field3D& delta_z,
const std::string& region = "RGN_NOBNDRY") = 0;
Expand Down Expand Up @@ -134,8 +138,8 @@ protected:
/// This is protected rather than private so that it can be
/// extended and used by HermiteSplineMonotonic

Tensor<int> i_corner; // x-index of bottom-left grid point
Tensor<int> k_corner; // z-index of bottom-left grid point
Tensor<SpecificInd<IND_TYPE::IND_3D>> i_corner; // index of bottom-left grid point
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 'i_corner' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  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
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 'k_corner' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Tensor<int> k_corner;                           // z-index of bottom-left grid point
              ^


// Basis functions for cubic Hermite spline interpolation
// see http://en.wikipedia.org/wiki/Cubic_Hermite_spline
Expand All @@ -152,12 +156,32 @@ protected:
Field3D h10_z;
Field3D h11_z;

std::vector<Field3D> newWeights;
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 'h11_z' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Field3D h11_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: member variable 'newWeights' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  std::vector<Field3D> newWeights;
                       ^


#if HS_USE_PETSC
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 'newWeights' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  std::vector<Field3D> newWeights;
                       ^

PetscLib* petsclib;
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 'petsclib' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  PetscLib* petsclib;
            ^

bool isInit{false};
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 'isInit' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  bool isInit{false};
       ^

Mat petscWeights;
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 'petsclib' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  PetscLib* petsclib;
            ^

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 'petscWeights' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Mat petscWeights;
      ^

Vec rhs, result;
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 'isInit' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  bool isInit{false};
       ^

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 'rhs' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Vec rhs, result;
      ^

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 'result' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Vec rhs, result;
           ^

#endif
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 'petscWeights' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Mat petscWeights;
      ^


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 'rhs' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Vec rhs, result;
      ^

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 'result' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  Vec rhs, result;
           ^

public:
XZHermiteSpline(Mesh* mesh = nullptr) : XZHermiteSpline(0, mesh) {}
XZHermiteSpline(int y_offset = 0, Mesh* mesh = nullptr);
XZHermiteSpline(const BoutMask& mask, int y_offset = 0, Mesh* mesh = nullptr)
: XZHermiteSpline(y_offset, mesh) {
region = regionFromMask(mask, localmesh);
setRegion(regionFromMask(mask, 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: no matching member function for call to 'setRegion' [clang-diagnostic-error]

    setRegion(regionFromMask(mask, localmesh));
    ^
Additional context

include/bout/interpolation_xz.hxx:77: candidate function not viable: no known conversion from 'XZHermiteSpline' to 'XZInterpolation' for object argument

  void setRegion(const std::unique_ptr<Region<Ind3D>> region) { setRegion(*region); }
       ^

include/bout/interpolation_xz.hxx:74: candidate function not viable: no known conversion from 'XZHermiteSpline' to 'XZInterpolation' for object argument

  void setRegion(const std::string& region_name) {
       ^

include/bout/interpolation_xz.hxx:78: candidate function not viable: no known conversion from 'XZHermiteSpline' to 'XZInterpolation' for object argument

  void setRegion(const Region<Ind3D>& region) {
       ^

}
~XZHermiteSpline() {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: annotate this function with 'override' or (rarely) 'final' [cppcoreguidelines-explicit-virtual-functions]

Suggested change
~XZHermiteSpline() {
~XZHermiteSpline() override {

#if HS_USE_PETSC
if (isInit) {
MatDestroy(&petscWeights);
VecDestroy(&rhs);
VecDestroy(&result);
isInit = false;
delete petsclib;
}
#endif
}

void calcWeights(const Field3D& delta_x, const Field3D& delta_z,
Expand Down Expand Up @@ -188,11 +212,23 @@ public:
/// problems most obviously occur.
class XZMonotonicHermiteSpline : public XZHermiteSpline {
public:
XZMonotonicHermiteSpline(Mesh* mesh = nullptr) : XZHermiteSpline(0, mesh) {}
XZMonotonicHermiteSpline(Mesh* mesh = nullptr) : XZHermiteSpline(0, mesh) {
if (localmesh->getNXPE() > 1) {
throw BoutException("Do not support MPI splitting in X");
}
}
XZMonotonicHermiteSpline(int y_offset = 0, Mesh* mesh = nullptr)
: XZHermiteSpline(y_offset, mesh) {}
: XZHermiteSpline(y_offset, mesh) {
if (localmesh->getNXPE() > 1) {
throw BoutException("Do not support MPI splitting in X");
}
}
XZMonotonicHermiteSpline(const BoutMask& mask, int y_offset = 0, Mesh* mesh = nullptr)
: XZHermiteSpline(mask, y_offset, mesh) {}
: XZHermiteSpline(mask, y_offset, mesh) {
if (localmesh->getNXPE() > 1) {
throw BoutException("Do not support MPI splitting in X");
}
}

using XZHermiteSpline::interpolate;
/// Interpolate using precalculated weights.
Expand All @@ -213,7 +249,7 @@ public:
XZLagrange4pt(int y_offset = 0, Mesh* mesh = nullptr);
XZLagrange4pt(const BoutMask& mask, int y_offset = 0, Mesh* mesh = nullptr)
: XZLagrange4pt(y_offset, mesh) {
region = regionFromMask(mask, localmesh);
setRegion(regionFromMask(mask, 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: no matching member function for call to 'setRegion' [clang-diagnostic-error]

    setRegion(regionFromMask(mask, localmesh));
    ^
Additional context

include/bout/interpolation_xz.hxx:77: candidate function not viable: no known conversion from 'XZLagrange4pt' to 'XZInterpolation' for object argument

  void setRegion(const std::unique_ptr<Region<Ind3D>> region) { setRegion(*region); }
       ^

include/bout/interpolation_xz.hxx:74: candidate function not viable: no known conversion from 'XZLagrange4pt' to 'XZInterpolation' for object argument

  void setRegion(const std::string& region_name) {
       ^

include/bout/interpolation_xz.hxx:78: candidate function not viable: no known conversion from 'XZLagrange4pt' to 'XZInterpolation' for object argument

  void setRegion(const Region<Ind3D>& region) {
       ^

}

void calcWeights(const Field3D& delta_x, const Field3D& delta_z,
Expand Down Expand Up @@ -246,7 +282,7 @@ public:
XZBilinear(int y_offset = 0, Mesh* mesh = nullptr);
XZBilinear(const BoutMask& mask, int y_offset = 0, Mesh* mesh = nullptr)
: XZBilinear(y_offset, mesh) {
region = regionFromMask(mask, localmesh);
setRegion(regionFromMask(mask, 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: no matching member function for call to 'setRegion' [clang-diagnostic-error]

    setRegion(regionFromMask(mask, localmesh));
    ^
Additional context

include/bout/interpolation_xz.hxx:77: candidate function not viable: no known conversion from 'XZBilinear' to 'XZInterpolation' for object argument

  void setRegion(const std::unique_ptr<Region<Ind3D>> region) { setRegion(*region); }
       ^

include/bout/interpolation_xz.hxx:74: candidate function not viable: no known conversion from 'XZBilinear' to 'XZInterpolation' for object argument

  void setRegion(const std::string& region_name) {
       ^

include/bout/interpolation_xz.hxx:78: candidate function not viable: no known conversion from 'XZBilinear' to 'XZInterpolation' for object argument

  void setRegion(const Region<Ind3D>& region) {
       ^

}

void calcWeights(const Field3D& delta_x, const Field3D& delta_z,
Expand Down
7 changes: 7 additions & 0 deletions include/bout/utils.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ public:
ASSERT2(0 <= i.ind && i.ind < n1 * n2 * n3);
return data[i.ind];
}
T& operator[](Ind3D i) {
// ny and nz are private :-(
// ASSERT2(i.nz == n3);
// ASSERT2(i.ny == n2);
ASSERT2(0 <= i.ind && i.ind < n1 * n2 * n3);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]

    ASSERT2(0 <= i.ind && i.ind < n1 * n2 * n3);
    ^
Additional context

include/bout/assert.hxx:49: expanded from macro 'ASSERT2'

  if (!(condition)) {                                                                    \
      ^

return data[i.ind];
}

Tensor& operator=(const T& val) {
for (auto& i : data) {
Expand Down
Loading
Loading