From 1d89667b235aff59ddaac23f7bbd339ec5341171 Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 11:11:37 +0200 Subject: [PATCH 01/22] Introduce memory space shortcut --- include/LinearAlgebra/Matrix/coo_matrix.h | 2 +- include/LinearAlgebra/Matrix/csr_matrix.h | 2 +- include/LinearAlgebra/Solvers/csr_lu_solver.h | 2 +- include/LinearAlgebra/Vector/vector.h | 8 +++-- tests/LinearAlgebra/Solvers/csr_lu_solver.cpp | 34 +++++++++---------- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/include/LinearAlgebra/Matrix/coo_matrix.h b/include/LinearAlgebra/Matrix/coo_matrix.h index d7ebd462..b6e22089 100644 --- a/include/LinearAlgebra/Matrix/coo_matrix.h +++ b/include/LinearAlgebra/Matrix/coo_matrix.h @@ -21,7 +21,7 @@ namespace gmgpolar { -template +template class SparseMatrixCOO { public: diff --git a/include/LinearAlgebra/Matrix/csr_matrix.h b/include/LinearAlgebra/Matrix/csr_matrix.h index 5f7afdae..e9db4993 100644 --- a/include/LinearAlgebra/Matrix/csr_matrix.h +++ b/include/LinearAlgebra/Matrix/csr_matrix.h @@ -50,7 +50,7 @@ namespace sparse_csr_helpers } } // namespace sparse_csr_helpers -template +template class SparseMatrixCSR { public: diff --git a/include/LinearAlgebra/Solvers/csr_lu_solver.h b/include/LinearAlgebra/Solvers/csr_lu_solver.h index 21186312..c5d32838 100644 --- a/include/LinearAlgebra/Solvers/csr_lu_solver.h +++ b/include/LinearAlgebra/Solvers/csr_lu_solver.h @@ -42,7 +42,7 @@ namespace sparse_lu_helpers * @tparam T Numeric type (e.g. double, float). */ -template +template class SparseLUSolver { using ExecSpace = std::conditional_t, diff --git a/include/LinearAlgebra/Vector/vector.h b/include/LinearAlgebra/Vector/vector.h index da651bf6..78c82230 100644 --- a/include/LinearAlgebra/Vector/vector.h +++ b/include/LinearAlgebra/Vector/vector.h @@ -5,11 +5,13 @@ namespace gmgpolar { -template +using DefaultMemorySpace = Kokkos::DefaultExecutionSpace::memory_space; + +template using AllocatableVector = Kokkos::View; -template +template using Vector = Kokkos::View const; -template +template using ConstVector = Kokkos::View const; template diff --git a/tests/LinearAlgebra/Solvers/csr_lu_solver.cpp b/tests/LinearAlgebra/Solvers/csr_lu_solver.cpp index 355c2b9e..1ed0b88c 100644 --- a/tests/LinearAlgebra/Solvers/csr_lu_solver.cpp +++ b/tests/LinearAlgebra/Solvers/csr_lu_solver.cpp @@ -309,7 +309,7 @@ TEST(SparseLUSolver, TwentyByTwentyRandomSparse) HostVector h_x_true("x_true", 20); for (int i = 0; i < 20; ++i) h_x_true(i) = dist(gen); - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -357,7 +357,7 @@ TEST(SparseLUSolver, HundredByHundredRandomSparse) HostVector h_x_true("x_true", 100); for (int i = 0; i < 100; ++i) h_x_true(i) = dist(gen); - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -401,7 +401,7 @@ TEST(SparseLUSolver, TwentyByTwentyBanded) HostVector h_x_true("x_true", 20); for (int i = 0; i < 20; ++i) h_x_true(i) = std::sin(i); - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -422,7 +422,7 @@ TEST(SparseLUSolver, FiveByFiveMixedSigns) h_x_true(2) = 3.0; h_x_true(3) = -4.0; h_x_true(4) = 5.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -449,7 +449,7 @@ TEST(SparseLUSolver, 2x2Diagonal) HostVector h_x_true("x_true", 2); h_x_true(0) = 1.0; h_x_true(1) = -1.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -465,7 +465,7 @@ TEST(SparseLUSolver, 2x2General) HostVector h_x_true("x_true", 2); h_x_true(0) = 3.0; h_x_true(1) = -2.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -483,7 +483,7 @@ TEST(SparseLUSolver, 3x3Permutation) h_x_true(0) = 1.0; h_x_true(1) = 2.0; h_x_true(2) = -1.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -501,7 +501,7 @@ TEST(SparseLUSolver, 4x4parse) h_x_true(1) = 2.0; h_x_true(2) = -1.0; h_x_true(3) = 3.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -517,7 +517,7 @@ TEST(SparseLUSolver, 0Diagonal) HostVector h_x_true("x_true", 2); h_x_true(0) = 1.5; h_x_true(1) = -0.5; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -552,7 +552,7 @@ TEST(SparseLUSolver, 5x5Random) h_x_true(2) = 3.0; h_x_true(3) = -4.0; h_x_true(4) = 5.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(B, x_true); SparseLUSolver solver(B); solver.solveInPlace(b); @@ -571,7 +571,7 @@ TEST(SparseLUSolver, 10x10Diagonal) HostVector h_x_true("x_true", n); for (int i = 0; i < n; ++i) h_x_true(i) = (i % 2 == 0 ? 1.0 : -1.0); - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -605,7 +605,7 @@ TEST(SparseLUSolver, DoublePointerOverload) HostVector h_x_true("x_true", 2); h_x_true(0) = 4.0; h_x_true(1) = -1.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b_vec = csr_matvec(A, x_true); SparseLUSolver solver(A); @@ -631,7 +631,7 @@ TEST(SparseLUSolver, 6x6Block) h_x_true(3) = 0.5; h_x_true(4) = -0.5; h_x_true(5) = 1.5; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -657,7 +657,7 @@ TEST(SparseLUSolver, 5x5MixedSigns) h_x_true(2) = 0.5; h_x_true(3) = -0.5; h_x_true(4) = 1.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -703,7 +703,7 @@ TEST(SparseLUSolver, 8x8ChainGraph) HostVector h_x_true("x_true", n); for (int i = 0; i < n; ++i) h_x_true(i) = (i % 2 == 0 ? 1.0 : -1.0); - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -736,7 +736,7 @@ TEST(SparseLUSolver, 3x3Identity) h_x_true(0) = 5.0; h_x_true(1) = -3.0; h_x_true(2) = 2.0; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); @@ -754,7 +754,7 @@ TEST(SparseLUSolver, 4x4SmallDiagonal) h_x_true(1) = 2.0; h_x_true(2) = -1.0; h_x_true(3) = 0.5; - auto x_true = Kokkos::create_mirror_view_and_copy(Kokkos::DefaultExecutionSpace::memory_space(), h_x_true); + auto x_true = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x_true); Vector b = csr_matvec(A, x_true); SparseLUSolver solver(A); solver.solveInPlace(b); From 5bdf8c307cf4f217a0183f76f4291d90aacc039f Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 11:28:45 +0200 Subject: [PATCH 02/22] Allow PolarGrid to be on chosen MemorySpace for gradual porting --- include/PolarGrid/polargrid.h | 24 ++++++---- include/PolarGrid/polargrid.inl | 64 ++++++++++++++++++++------ src/PolarGrid/anisotropic_division.cpp | 7 +-- src/PolarGrid/polargrid.cpp | 59 +++++++++++------------- 4 files changed, 94 insertions(+), 60 deletions(-) diff --git a/include/PolarGrid/polargrid.h b/include/PolarGrid/polargrid.h index 4ef775f0..346da1c1 100644 --- a/include/PolarGrid/polargrid.h +++ b/include/PolarGrid/polargrid.h @@ -22,6 +22,7 @@ namespace gmgpolar { +template class PolarGrid { public: @@ -29,7 +30,8 @@ class PolarGrid explicit PolarGrid() = default; // Constructor to initialize grid using kokkos views of radii and angles. - PolarGrid(HostVector radii, HostVector angles, + template + PolarGrid(Vector radii, Vector angles, std::optional splitting_radius = std::nullopt); // Constructor to initialize grid using std::vectors of radii and angles. PolarGrid(std::vector radii, std::vector angles, @@ -84,19 +86,19 @@ class PolarGrid int nr_; // number of nodes in radial direction int ntheta_; // number of (unique) nodes in angular direction bool is_ntheta_PowerOfTwo_; - HostAllocatableVector radii_; // HostVector of radial coordiantes - HostAllocatableVector angles_; // HostVector of angular coordinates + AllocatableVector radii_; // Vector of radial coordiantes + AllocatableVector angles_; // Vector of angular coordinates // radial_spacings_ contains the distances between each consecutive radii division. // radial_spacings_ = [r_{1}-r_{0}, ..., r_{N}-r_{N-1}]. - HostAllocatableVector radial_spacings_; // size(radial_spacings_) = nr() - 1 + AllocatableVector radial_spacings_; // size(radial_spacings_) = nr() - 1 // angular_spacings_ contains the angles between each consecutive theta division. // Since we have a periodic boundary in theta direction, // we have to make sure the index wraps around correctly when accessing it. // Here theta_0 = 0.0 and theta_N = 2*pi refer to the same point. // angular_spacings_ = [theta_{1}-theta_{0}, ..., theta_{N}-theta_{N-1}]. - HostAllocatableVector angular_spacings_; // size(angular_spacings_) = ntheta() + AllocatableVector angular_spacings_; // size(angular_spacings_) = ntheta() // Circle/radial smoother division double smoother_splitting_radius_; // Radius at which the grid is split into circular and radial smoothing @@ -113,7 +115,7 @@ class PolarGrid */ // Check parameter validity - void checkParameters(HostVector radii, HostVector angles) const; + void checkParameters(Vector radii, Vector angles) const; // Initialize radial_spacings_, angular_spacings_ void initializeDistances(); @@ -132,18 +134,22 @@ class PolarGrid // Refine the grid by dividing radial and angular divisions by 2. void refineGrid(const int divideBy2); - HostVector divideVector(HostVector vec, const int divideBy2) const; + Vector divideVector(Vector vec, const int divideBy2) const; // Help constrcut radii_ when an anisotropic radial division is requested // Implementation in src/PolarGrid/anisotropic_division.cpp - HostVector RadialAnisotropicDivision(double R0, double R, const int nr_exp, double refinement_radius, + Vector RadialAnisotropicDivision(double R0, double R, const int nr_exp, double refinement_radius, const int anisotropic_factor) const; }; +template class PolarGrid; +template class PolarGrid; + // ---------------------------------------------------- // // Generates a coarser PolarGrid from a finer PolarGrid // // ---------------------------------------------------- // -PolarGrid coarseningGrid(const PolarGrid& grid); +template +PolarGrid coarseningGrid(const PolarGrid& grid); #include "polargrid.inl" // Include the inline function definitions } // namespace gmgpolar diff --git a/include/PolarGrid/polargrid.inl b/include/PolarGrid/polargrid.inl index 67b61842..fc9158f1 100755 --- a/include/PolarGrid/polargrid.inl +++ b/include/PolarGrid/polargrid.inl @@ -4,73 +4,105 @@ #include "polargrid.h" -KOKKOS_INLINE_FUNCTION int PolarGrid::nr() const +// Constructor to initialize grid using vectors of radii and angles. +template +template +PolarGrid::PolarGrid(Vector radii, Vector angles, std::optional splitting_radius) + : nr_(radii.size()) + , ntheta_(angles.size() - 1) + , is_ntheta_PowerOfTwo_((ntheta_ & (ntheta_ - 1)) == 0) + , radii_(radii) + , angles_(angles) +{ + // Check parameter validity + checkParameters(radii, angles); + // Store distances to adjacent neighboring nodes. + // Initializes radial_spacings_, angular_spacings_ + initializeDistances(); + // Initializes smoothers splitting radius for circle/radial indexing. + initializeLineSplitting(splitting_radius); +} + +template +KOKKOS_INLINE_FUNCTION int PolarGrid::nr() const { return nr_; } -KOKKOS_INLINE_FUNCTION int PolarGrid::ntheta() const +template +KOKKOS_INLINE_FUNCTION int PolarGrid::ntheta() const { return ntheta_; } -KOKKOS_INLINE_FUNCTION int PolarGrid::numberOfNodes() const +template +KOKKOS_INLINE_FUNCTION int PolarGrid::numberOfNodes() const { return nr() * ntheta(); } -KOKKOS_INLINE_FUNCTION double PolarGrid::radius(const int r_index) const +template +KOKKOS_INLINE_FUNCTION double PolarGrid::radius(const int r_index) const { assert(r_index >= 0 && r_index < std::ssize(radii_)); return radii_[r_index]; } -KOKKOS_INLINE_FUNCTION double PolarGrid::theta(const int theta_index) const +template +KOKKOS_INLINE_FUNCTION double PolarGrid::theta(const int theta_index) const { assert(theta_index >= 0 && theta_index < std::ssize(angles_)); return angles_[theta_index]; } -KOKKOS_INLINE_FUNCTION double PolarGrid::smootherSplittingRadius() const +template +KOKKOS_INLINE_FUNCTION double PolarGrid::smootherSplittingRadius() const { return smoother_splitting_radius_; } // Get the number of circles in the circular smoother. -KOKKOS_INLINE_FUNCTION int PolarGrid::numberSmootherCircles() const +template +KOKKOS_INLINE_FUNCTION int PolarGrid::numberSmootherCircles() const { return number_smoother_circles_; } // Get the length of the radial smoother lines. -KOKKOS_INLINE_FUNCTION int PolarGrid::lengthRadialSmoother() const +template +KOKKOS_INLINE_FUNCTION int PolarGrid::lengthRadialSmoother() const { return length_smoother_radial_; } // Get the number of nodes in circular smoother. -KOKKOS_INLINE_FUNCTION int PolarGrid::numberCircularSmootherNodes() const +template +KOKKOS_INLINE_FUNCTION int PolarGrid::numberCircularSmootherNodes() const { return number_circular_smoother_nodes_; } // Get the number of nodes in radial smoother. -KOKKOS_INLINE_FUNCTION int PolarGrid::numberRadialSmootherNodes() const +template +KOKKOS_INLINE_FUNCTION int PolarGrid::numberRadialSmootherNodes() const { return number_radial_smoother_nodes_; } -KOKKOS_INLINE_FUNCTION double PolarGrid::radialSpacing(const int r_index) const +template +KOKKOS_INLINE_FUNCTION double PolarGrid::radialSpacing(const int r_index) const { assert(r_index >= 0 && r_index < std::ssize(radial_spacings_)); return radial_spacings_[r_index]; } -KOKKOS_INLINE_FUNCTION double PolarGrid::angularSpacing(const int unwrapped_theta_index) const +template +KOKKOS_INLINE_FUNCTION double PolarGrid::angularSpacing(const int unwrapped_theta_index) const { // unwrapped_theta_index may be negative or larger than ntheta() to allow for periodicity. const int theta_index = wrapThetaIndex(unwrapped_theta_index); return angular_spacings_[theta_index]; } -KOKKOS_INLINE_FUNCTION int PolarGrid::wrapThetaIndex(const int unwrapped_theta_index) const +template +KOKKOS_INLINE_FUNCTION int PolarGrid::wrapThetaIndex(const int unwrapped_theta_index) const { // The unwrapped_theta_index may be negative or exceed the number of theta steps (ntheta()), // so we need to wrap it into the valid range [0, ntheta() - 1] to maintain periodicity. @@ -88,7 +120,8 @@ KOKKOS_INLINE_FUNCTION int PolarGrid::wrapThetaIndex(const int unwrapped_theta_i return theta_index; } -KOKKOS_INLINE_FUNCTION int PolarGrid::index(const int r_index, const int unwrapped_theta_index) const +template +KOKKOS_INLINE_FUNCTION int PolarGrid::index(const int r_index, const int unwrapped_theta_index) const { // unwrapped_theta_index may be negative or larger than ntheta() to allow for periodicity. assert(0 <= r_index && r_index < nr()); @@ -101,7 +134,8 @@ KOKKOS_INLINE_FUNCTION int PolarGrid::index(const int r_index, const int unwrapp return global_index; } -KOKKOS_INLINE_FUNCTION void PolarGrid::multiIndex(const int node_index, int& r_index, int& theta_index) const +template +KOKKOS_INLINE_FUNCTION void PolarGrid::multiIndex(const int node_index, int& r_index, int& theta_index) const { assert(0 <= node_index && node_index < numberOfNodes()); if (node_index < numberCircularSmootherNodes()) { diff --git a/src/PolarGrid/anisotropic_division.cpp b/src/PolarGrid/anisotropic_division.cpp index cbb96d70..d1ce08a2 100644 --- a/src/PolarGrid/anisotropic_division.cpp +++ b/src/PolarGrid/anisotropic_division.cpp @@ -1,7 +1,8 @@ #include "../../include/PolarGrid/polargrid.h" using namespace gmgpolar; -HostVector PolarGrid::RadialAnisotropicDivision(double R0, double R, const int nr_exp, double refinement_radius, +template +Vector PolarGrid::RadialAnisotropicDivision(double R0, double R, const int nr_exp, double refinement_radius, const int anisotropic_factor) const { // Calculate the percentage of refinement_radius. @@ -26,7 +27,7 @@ HostVector PolarGrid::RadialAnisotropicDivision(double R0, double R, con n_elems_equi++; double uniform_distance = (R - R0) / n_elems_equi; int nr = n_elems_equi + 1; - HostVector r_temp2("r_temp2", nr); + Vector r_temp2("r_temp2", nr); for (int i = 0; i < nr - 1; i++) r_temp2[i] = R0 + i * uniform_distance; r_temp2[nr - 1] = R; @@ -90,7 +91,7 @@ HostVector PolarGrid::RadialAnisotropicDivision(double R0, double R, con // group all in r_tmp nr = n_elems_equi - n_elems_refined + r_set.size() + 1; - HostVector r_temp("r_temp", nr); + Vector r_temp("r_temp", nr); for (int i = 0; i < se; i++) r_temp[i] = r_temp2[i]; itr = r_set.begin(); diff --git a/src/PolarGrid/polargrid.cpp b/src/PolarGrid/polargrid.cpp index b55b4852..a6a1a690 100644 --- a/src/PolarGrid/polargrid.cpp +++ b/src/PolarGrid/polargrid.cpp @@ -6,24 +6,8 @@ using namespace gmgpolar; // ------------ // // Constructor to initialize grid using vectors of radii and angles. -PolarGrid::PolarGrid(HostVector radii, HostVector angles, std::optional splitting_radius) - : nr_(radii.size()) - , ntheta_(angles.size() - 1) - , is_ntheta_PowerOfTwo_((ntheta_ & (ntheta_ - 1)) == 0) - , radii_(radii) - , angles_(angles) -{ - // Check parameter validity - checkParameters(radii, angles); - // Store distances to adjacent neighboring nodes. - // Initializes radial_spacings_, angular_spacings_ - initializeDistances(); - // Initializes smoothers splitting radius for circle/radial indexing. - initializeLineSplitting(splitting_radius); -} - -// Constructor to initialize grid using vectors of radii and angles. -PolarGrid::PolarGrid(std::vector radii, std::vector angles, std::optional splitting_radius) +template +PolarGrid::PolarGrid(std::vector radii, std::vector angles, std::optional splitting_radius) : nr_(radii.size()) , ntheta_(angles.size() - 1) , is_ntheta_PowerOfTwo_((ntheta_ & (ntheta_ - 1)) == 0) @@ -49,7 +33,8 @@ PolarGrid::PolarGrid(std::vector radii, std::vector angles, std: } // Constructor to initialize grid using parameters from GMGPolar. -PolarGrid::PolarGrid(double R0, double Rmax, const int nr_exp, const int ntheta_exp, double refinement_radius, +template +PolarGrid::PolarGrid(double R0, double Rmax, const int nr_exp, const int ntheta_exp, double refinement_radius, const int anisotropic_factor, const int divideBy2, std::optional splitting_radius) { assert(R0 > 0.0 && Rmax > R0 && !equals(R0, Rmax)); @@ -71,18 +56,19 @@ PolarGrid::PolarGrid(double R0, double Rmax, const int nr_exp, const int ntheta_ // ------------------- // // Construct radial divisions for grid generation. -void PolarGrid::constructRadialDivisions(double R0, double R, const int nr_exp, double refinement_radius, +template +void PolarGrid::constructRadialDivisions(double R0, double R, const int nr_exp, double refinement_radius, const int anisotropic_factor) { // r_temp contains the values before we refine one last time for extrapolation. // Therefore we first consider 2^(nr_exp-1) points. - HostAllocatableVector r_temp; + AllocatableVector r_temp; if (anisotropic_factor == 0) { // nr = 2**(nr_exp-1) + 1 int nr = (1 << (nr_exp - 1)) + 1; double uniform_distance = (R - R0) / (nr - 1); assert(uniform_distance > 0.0); - r_temp = HostVector("r_temp", nr); + r_temp = Vector("r_temp", nr); for (int i = 0; i < nr - 1; i++) { r_temp[i] = R0 + i * uniform_distance; } @@ -94,7 +80,7 @@ void PolarGrid::constructRadialDivisions(double R0, double R, const int nr_exp, } // Refine division in the middle for extrapolation nr_ = 2 * r_temp.size() - 1; - radii_ = HostAllocatableVector("radii_", nr_); + radii_ = AllocatableVector("radii_", nr_); for (int i = 0; i < nr_; i++) { if (!(i % 2)) radii_[i] = r_temp[i / 2]; @@ -105,7 +91,8 @@ void PolarGrid::constructRadialDivisions(double R0, double R, const int nr_exp, // Construct angular divisions for grid generation. // Currently we dont allow anisotropic refinement in angular direction -void PolarGrid::constructAngularDivisions(const int ntheta_exp, const int nr) +template +void PolarGrid::constructAngularDivisions(const int ntheta_exp, const int nr) { if (ntheta_exp < 0) { // Choose number of theta divisions similar to radial divisions. @@ -128,7 +115,8 @@ void PolarGrid::constructAngularDivisions(const int ntheta_exp, const int nr) } // divideBy2: Number of times to divide both radial and angular divisions by 2. -void PolarGrid::refineGrid(const int divideBy2) +template +void PolarGrid::refineGrid(const int divideBy2) { radii_ = divideVector(radii_, divideBy2); angles_ = divideVector(angles_, divideBy2); @@ -137,12 +125,13 @@ void PolarGrid::refineGrid(const int divideBy2) is_ntheta_PowerOfTwo_ = (ntheta_ & (ntheta_ - 1)) == 0; } -HostVector PolarGrid::divideVector(HostVector vec, const int divideBy2) const +template +Vector PolarGrid::divideVector(Vector vec, const int divideBy2) const { const int powerOfTwo = 1 << divideBy2; size_t vecSize = vec.size(); size_t resultSize = vecSize + (vecSize - 1) * (powerOfTwo - 1); - HostVector result("result", resultSize); + Vector result("result", resultSize); for (size_t i = 0; i < vecSize - 1; ++i) { size_t baseIndex = i * powerOfTwo; @@ -156,7 +145,8 @@ HostVector PolarGrid::divideVector(HostVector vec, const int div return result; } -void PolarGrid::initializeDistances() +template +void PolarGrid::initializeDistances() { // radial_spacings contains the distances between each consecutive radii division. // radial_spacings = [R_1-R0, ..., R_{N} - R_{N-1}]. @@ -180,7 +170,8 @@ void PolarGrid::initializeDistances() // If std::nullopt, automatic line-splitting is enabled. // If the splitting radius is less than R0, only Radial indexing is used. // If the splitting radius is greater than or equal to R, only Circular indexing is used. -void PolarGrid::initializeLineSplitting(std::optional splitting_radius) +template +void PolarGrid::initializeLineSplitting(std::optional splitting_radius) { if (splitting_radius.has_value()) { if (splitting_radius.value() < radii_(0)) { @@ -241,14 +232,15 @@ void PolarGrid::initializeLineSplitting(std::optional splitting_radius) namespace gmgpolar { -PolarGrid coarseningGrid(const PolarGrid& fineGrid) +template +PolarGrid coarseningGrid(const PolarGrid& fineGrid) { assert((fineGrid.nr() - 1) % 2 == 0 && (fineGrid.ntheta()) % 2 == 0); const int coarse_nr = (fineGrid.nr() + 1) / 2; const int coarse_ntheta = fineGrid.ntheta() / 2; - HostVector coarse_r("coarse_r", coarse_nr); - HostVector coarse_theta("coarse_theta", coarse_ntheta + 1); + Vector coarse_r("coarse_r", coarse_nr); + Vector coarse_theta("coarse_theta", coarse_ntheta + 1); for (int i = 0; i < coarse_nr; i++) { coarse_r[i] = fineGrid.radius(2 * i); @@ -273,7 +265,8 @@ PolarGrid coarseningGrid(const PolarGrid& fineGrid) // Check parameter validity // // ------------------------ // -void PolarGrid::checkParameters(HostVector radii, HostVector angles) const +template +void PolarGrid::checkParameters(Vector radii, Vector angles) const { auto radii_start = Kokkos::Experimental::begin(radii); auto radii_end = Kokkos::Experimental::end(radii); From 4479f9d2be60b3146c584e2f1d2ca10c27492a27 Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 11:30:47 +0200 Subject: [PATCH 03/22] Specify template argument --- include/ConfigParser/config_parser.h | 4 +- .../DirectSolverGive/applySymmetryShift.inl | 6 +-- .../DirectSolverGive/buildSolverMatrix.inl | 4 +- .../DirectSolverGive/directSolverGive.h | 2 +- .../DirectSolverGive/directSolverGive.inl | 2 +- .../DirectSolverGive/matrixStencil.inl | 10 ++-- .../DirectSolverTake/applySymmetryShift.inl | 6 +-- .../DirectSolverTake/buildSolverMatrix.inl | 4 +- .../DirectSolverTake/directSolverTake.h | 2 +- .../DirectSolverTake/directSolverTake.inl | 2 +- .../DirectSolverTake/matrixStencil.inl | 10 ++-- include/DirectSolver/directSolver.h | 4 +- .../applyAscOrtho.inl | 16 +++--- .../buildInnerBoundaryAsc.inl | 6 +-- .../buildTridiagonalAsc.inl | 6 +-- .../extrapolatedSmootherGive.h | 2 +- .../extrapolatedSmootherGive.inl | 4 +- .../smootherStencil.inl | 6 +-- .../solveAscSystem.inl | 8 +-- .../applyAscOrtho.inl | 12 ++--- .../buildInnerBoundaryAsc.inl | 4 +- .../buildTridiagonalAsc.inl | 6 +-- .../extrapolatedSmootherTake.h | 2 +- .../extrapolatedSmootherTake.inl | 2 +- .../smootherStencil.inl | 6 +-- .../solveAscSystem.inl | 8 +-- .../extrapolatedSmoother.h | 4 +- include/GMGPolar/gmgpolar.h | 12 ++--- include/GMGPolar/igmgpolar.h | 4 +- include/GMGPolar/setup.h | 22 ++++---- include/GMGPolar/solver.h | 6 +-- include/GMGPolar/utils.h | 6 +-- .../cartesianR2_Poisson_CircularGeometry.h | 4 +- .../cartesianR2_Poisson_CzarnyGeometry.h | 4 +- .../cartesianR2_Poisson_ShafranovGeometry.h | 4 +- ...ianR2_SonnendruckerGyro_CircularGeometry.h | 4 +- ...esianR2_SonnendruckerGyro_CzarnyGeometry.h | 4 +- ...anR2_SonnendruckerGyro_ShafranovGeometry.h | 4 +- ...rtesianR2_Sonnendrucker_CircularGeometry.h | 4 +- ...cartesianR2_Sonnendrucker_CzarnyGeometry.h | 4 +- ...tesianR2_Sonnendrucker_ShafranovGeometry.h | 4 +- .../cartesianR2_ZoniGyro_CircularGeometry.h | 4 +- .../cartesianR2_ZoniGyro_CzarnyGeometry.h | 4 +- .../cartesianR2_ZoniGyro_ShafranovGeometry.h | 4 +- ...esianR2_ZoniShiftedGyro_CircularGeometry.h | 4 +- ...rtesianR2_ZoniShiftedGyro_CzarnyGeometry.h | 4 +- ...sianR2_ZoniShiftedGyro_ShafranovGeometry.h | 4 +- ...cartesianR2_ZoniShifted_CircularGeometry.h | 4 +- .../cartesianR2_ZoniShifted_CzarnyGeometry.h | 4 +- ...artesianR2_ZoniShifted_ShafranovGeometry.h | 4 +- .../cartesianR2_Zoni_CircularGeometry.h | 4 +- .../cartesianR2_Zoni_CzarnyGeometry.h | 4 +- .../cartesianR2_Zoni_ShafranovGeometry.h | 4 +- .../cartesianR6_Poisson_CircularGeometry.h | 4 +- .../cartesianR6_Poisson_CzarnyGeometry.h | 4 +- .../cartesianR6_Poisson_ShafranovGeometry.h | 4 +- ...ianR6_SonnendruckerGyro_CircularGeometry.h | 4 +- ...esianR6_SonnendruckerGyro_CzarnyGeometry.h | 4 +- ...anR6_SonnendruckerGyro_ShafranovGeometry.h | 4 +- ...rtesianR6_Sonnendrucker_CircularGeometry.h | 4 +- ...cartesianR6_Sonnendrucker_CzarnyGeometry.h | 4 +- ...tesianR6_Sonnendrucker_ShafranovGeometry.h | 4 +- .../cartesianR6_ZoniGyro_CircularGeometry.h | 4 +- .../cartesianR6_ZoniGyro_CzarnyGeometry.h | 4 +- .../cartesianR6_ZoniGyro_ShafranovGeometry.h | 4 +- ...esianR6_ZoniShiftedGyro_CircularGeometry.h | 4 +- ...rtesianR6_ZoniShiftedGyro_CzarnyGeometry.h | 4 +- ...sianR6_ZoniShiftedGyro_ShafranovGeometry.h | 4 +- ...cartesianR6_ZoniShifted_CircularGeometry.h | 4 +- .../cartesianR6_ZoniShifted_CzarnyGeometry.h | 4 +- ...artesianR6_ZoniShifted_ShafranovGeometry.h | 4 +- .../cartesianR6_Zoni_CircularGeometry.h | 4 +- .../cartesianR6_Zoni_CzarnyGeometry.h | 4 +- .../cartesianR6_Zoni_ShafranovGeometry.h | 4 +- .../polarR6_Poisson_CircularGeometry.h | 4 +- .../polarR6_Poisson_CzarnyGeometry.h | 4 +- .../polarR6_Poisson_ShafranovGeometry.h | 4 +- ...larR6_SonnendruckerGyro_CircularGeometry.h | 4 +- ...polarR6_SonnendruckerGyro_CzarnyGeometry.h | 4 +- ...arR6_SonnendruckerGyro_ShafranovGeometry.h | 4 +- .../polarR6_Sonnendrucker_CircularGeometry.h | 4 +- .../polarR6_Sonnendrucker_CzarnyGeometry.h | 4 +- .../polarR6_Sonnendrucker_ShafranovGeometry.h | 4 +- .../polarR6_ZoniGyro_CircularGeometry.h | 4 +- .../polarR6_ZoniGyro_CzarnyGeometry.h | 4 +- .../polarR6_ZoniGyro_ShafranovGeometry.h | 4 +- ...polarR6_ZoniShiftedGyro_CircularGeometry.h | 4 +- .../polarR6_ZoniShiftedGyro_CulhamGeometry.h | 4 +- .../polarR6_ZoniShiftedGyro_CzarnyGeometry.h | 4 +- ...olarR6_ZoniShiftedGyro_ShafranovGeometry.h | 4 +- .../polarR6_ZoniShifted_CircularGeometry.h | 4 +- .../polarR6_ZoniShifted_CzarnyGeometry.h | 4 +- .../polarR6_ZoniShifted_ShafranovGeometry.h | 4 +- .../polarR6_Zoni_CircularGeometry.h | 4 +- .../SourceTerms/polarR6_Zoni_CzarnyGeometry.h | 4 +- .../polarR6_Zoni_ShafranovGeometry.h | 4 +- ...refined_ZoniShiftedGyro_CircularGeometry.h | 4 +- .../refined_ZoniShiftedGyro_CulhamGeometry.h | 4 +- .../refined_ZoniShiftedGyro_CzarnyGeometry.h | 4 +- ...efined_ZoniShiftedGyro_ShafranovGeometry.h | 4 +- include/Interpolation/interpolation.h | 12 ++--- include/Level/level.h | 8 +-- include/Level/level.inl | 4 +- include/Level/levelCache.inl | 2 +- include/Residual/ResidualGive/applyAGive.inl | 4 +- include/Residual/ResidualGive/residualGive.h | 2 +- .../Residual/ResidualGive/residualGive.inl | 2 +- include/Residual/ResidualTake/applyATake.inl | 4 +- include/Residual/ResidualTake/residualTake.h | 2 +- .../Residual/ResidualTake/residualTake.inl | 2 +- include/Residual/residual.h | 4 +- .../Smoother/SmootherGive/applyAscOrtho.inl | 16 +++--- .../SmootherGive/buildInnerBoundaryAsc.inl | 6 +-- .../SmootherGive/buildTridiagonalAsc.inl | 6 +-- .../Smoother/SmootherGive/matrixStencil.inl | 2 +- include/Smoother/SmootherGive/smootherGive.h | 2 +- .../Smoother/SmootherGive/smootherGive.inl | 2 +- .../Smoother/SmootherGive/solveAscSystem.inl | 8 +-- .../Smoother/SmootherTake/applyAscOrtho.inl | 12 ++--- .../SmootherTake/buildInnerBoundaryAsc.inl | 4 +- .../SmootherTake/buildTridiagonalAsc.inl | 4 +- .../Smoother/SmootherTake/matrixStencil.inl | 2 +- include/Smoother/SmootherTake/smootherTake.h | 2 +- .../Smoother/SmootherTake/smootherTake.inl | 2 +- .../Smoother/SmootherTake/solveAscSystem.inl | 8 +-- include/Smoother/smoother.h | 4 +- src/ConfigParser/config_parser.cpp | 8 +-- src/ConfigParser/select_test_case.cpp | 2 +- src/GMGPolar/gmgpolar.cpp | 2 +- .../cartesianR2_Poisson_CircularGeometry.cpp | 2 +- .../cartesianR2_Poisson_CzarnyGeometry.cpp | 2 +- .../cartesianR2_Poisson_ShafranovGeometry.cpp | 2 +- ...nR2_SonnendruckerGyro_CircularGeometry.cpp | 2 +- ...ianR2_SonnendruckerGyro_CzarnyGeometry.cpp | 2 +- ...R2_SonnendruckerGyro_ShafranovGeometry.cpp | 2 +- ...esianR2_Sonnendrucker_CircularGeometry.cpp | 2 +- ...rtesianR2_Sonnendrucker_CzarnyGeometry.cpp | 2 +- ...sianR2_Sonnendrucker_ShafranovGeometry.cpp | 2 +- .../cartesianR2_ZoniGyro_CircularGeometry.cpp | 2 +- .../cartesianR2_ZoniGyro_CzarnyGeometry.cpp | 2 +- ...cartesianR2_ZoniGyro_ShafranovGeometry.cpp | 2 +- ...ianR2_ZoniShiftedGyro_CircularGeometry.cpp | 2 +- ...esianR2_ZoniShiftedGyro_CzarnyGeometry.cpp | 2 +- ...anR2_ZoniShiftedGyro_ShafranovGeometry.cpp | 2 +- ...rtesianR2_ZoniShifted_CircularGeometry.cpp | 2 +- ...cartesianR2_ZoniShifted_CzarnyGeometry.cpp | 2 +- ...tesianR2_ZoniShifted_ShafranovGeometry.cpp | 2 +- .../cartesianR2_Zoni_CircularGeometry.cpp | 2 +- .../cartesianR2_Zoni_CzarnyGeometry.cpp | 2 +- .../cartesianR2_Zoni_ShafranovGeometry.cpp | 2 +- .../cartesianR6_Poisson_CircularGeometry.cpp | 2 +- .../cartesianR6_Poisson_CzarnyGeometry.cpp | 2 +- .../cartesianR6_Poisson_ShafranovGeometry.cpp | 2 +- ...nR6_SonnendruckerGyro_CircularGeometry.cpp | 2 +- ...ianR6_SonnendruckerGyro_CzarnyGeometry.cpp | 2 +- ...R6_SonnendruckerGyro_ShafranovGeometry.cpp | 2 +- ...esianR6_Sonnendrucker_CircularGeometry.cpp | 2 +- ...rtesianR6_Sonnendrucker_CzarnyGeometry.cpp | 2 +- ...sianR6_Sonnendrucker_ShafranovGeometry.cpp | 2 +- .../cartesianR6_ZoniGyro_CircularGeometry.cpp | 2 +- .../cartesianR6_ZoniGyro_CzarnyGeometry.cpp | 2 +- ...cartesianR6_ZoniGyro_ShafranovGeometry.cpp | 2 +- ...ianR6_ZoniShiftedGyro_CircularGeometry.cpp | 2 +- ...esianR6_ZoniShiftedGyro_CzarnyGeometry.cpp | 2 +- ...anR6_ZoniShiftedGyro_ShafranovGeometry.cpp | 2 +- ...rtesianR6_ZoniShifted_CircularGeometry.cpp | 2 +- ...cartesianR6_ZoniShifted_CzarnyGeometry.cpp | 2 +- ...tesianR6_ZoniShifted_ShafranovGeometry.cpp | 2 +- .../cartesianR6_Zoni_CircularGeometry.cpp | 2 +- .../cartesianR6_Zoni_CzarnyGeometry.cpp | 2 +- .../cartesianR6_Zoni_ShafranovGeometry.cpp | 2 +- .../polarR6_Poisson_CircularGeometry.cpp | 2 +- .../polarR6_Poisson_CzarnyGeometry.cpp | 2 +- .../polarR6_Poisson_ShafranovGeometry.cpp | 2 +- ...rR6_SonnendruckerGyro_CircularGeometry.cpp | 2 +- ...larR6_SonnendruckerGyro_CzarnyGeometry.cpp | 2 +- ...R6_SonnendruckerGyro_ShafranovGeometry.cpp | 2 +- ...polarR6_Sonnendrucker_CircularGeometry.cpp | 2 +- .../polarR6_Sonnendrucker_CzarnyGeometry.cpp | 2 +- ...olarR6_Sonnendrucker_ShafranovGeometry.cpp | 2 +- .../polarR6_ZoniGyro_CircularGeometry.cpp | 2 +- .../polarR6_ZoniGyro_CzarnyGeometry.cpp | 2 +- .../polarR6_ZoniGyro_ShafranovGeometry.cpp | 2 +- ...larR6_ZoniShiftedGyro_CircularGeometry.cpp | 2 +- ...polarR6_ZoniShiftedGyro_CulhamGeometry.cpp | 2 +- ...polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp | 2 +- ...arR6_ZoniShiftedGyro_ShafranovGeometry.cpp | 2 +- .../polarR6_ZoniShifted_CircularGeometry.cpp | 2 +- .../polarR6_ZoniShifted_CzarnyGeometry.cpp | 2 +- .../polarR6_ZoniShifted_ShafranovGeometry.cpp | 2 +- .../polarR6_Zoni_CircularGeometry.cpp | 2 +- .../polarR6_Zoni_CzarnyGeometry.cpp | 2 +- .../polarR6_Zoni_ShafranovGeometry.cpp | 2 +- ...fined_ZoniShiftedGyro_CircularGeometry.cpp | 2 +- ...refined_ZoniShiftedGyro_CulhamGeometry.cpp | 2 +- ...refined_ZoniShiftedGyro_CzarnyGeometry.cpp | 2 +- ...ined_ZoniShiftedGyro_ShafranovGeometry.cpp | 2 +- .../extrapolated_prolongation.cpp | 6 +-- .../extrapolated_restriction.cpp | 6 +-- src/Interpolation/fmg_interpolation.cpp | 4 +- src/Interpolation/injection.cpp | 4 +- src/Interpolation/prolongation.cpp | 6 +-- src/Interpolation/restriction.cpp | 4 +- src/convergence_order.cpp | 2 +- src/main.cpp | 2 +- src/strong_scaling.cpp | 2 +- src/weak_scaling.cpp | 2 +- tests/ConfigParser/config_parser.cpp | 2 +- tests/DirectSolver/directSolver.cpp | 54 +++++++++---------- .../extrapolated_smoother.cpp | 36 ++++++------- tests/GMGPolar/convergence_order.cpp | 6 +-- tests/GMGPolar/pcg_tests.cpp | 4 +- tests/GMGPolar/solve_tests.cpp | 4 +- .../extrapolated_prolongation.cpp | 6 +-- .../extrapolated_restriction.cpp | 6 +-- tests/Interpolation/prolongation.cpp | 6 +-- tests/Interpolation/restriction.cpp | 6 +-- tests/PolarGrid/polargrid.cpp | 18 +++---- tests/Residual/residual.cpp | 4 +- tests/Smoother/smoother.cpp | 36 ++++++------- tests/test_tools.h | 2 +- 221 files changed, 486 insertions(+), 486 deletions(-) diff --git a/include/ConfigParser/config_parser.h b/include/ConfigParser/config_parser.h index 6bb96166..70af5740 100644 --- a/include/ConfigParser/config_parser.h +++ b/include/ConfigParser/config_parser.h @@ -45,7 +45,7 @@ class ConfigParser bool cacheDensityProfileCoefficients() const; bool cacheDomainGeometry() const; - const PolarGrid& grid() const; + const PolarGrid& grid() const; // Full Multigrid Method bool FMG() const; @@ -97,7 +97,7 @@ class ConfigParser bool cache_density_profile_coefficients_; bool cache_domain_geometry_; // Grid configuration - PolarGrid grid_; + PolarGrid grid_; // Multigrid settings ExtrapolationType extrapolation_; int max_levels_; diff --git a/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl b/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl index bd2da746..4fb93894 100644 --- a/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl +++ b/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl @@ -7,7 +7,7 @@ template void DirectSolverGive::applySymmetryShiftInnerBoundary(HostVector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(DirectSolver::DirBC_Interior_); @@ -72,7 +72,7 @@ void DirectSolverGive::applySymmetryShiftInnerBoundary(HostVecto template void DirectSolverGive::applySymmetryShiftOuterBoundary(HostVector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; Kokkos::parallel_for( @@ -135,7 +135,7 @@ void DirectSolverGive::applySymmetryShiftOuterBoundary(HostVecto template void DirectSolverGive::applySymmetryShift(HostVector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const bool DirBC_Interior = DirectSolver::DirBC_Interior_; assert(std::ssize(x) == grid.numberOfNodes()); diff --git a/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl index 796f83ec..0ec7a731 100644 --- a/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl @@ -28,7 +28,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR static KOKKOS_INLINE_FUNCTION void -nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const SystemMatrix& solver_matrix) { /* ---------------------------------------- */ @@ -811,7 +811,7 @@ typename DirectSolverGive::SystemMatrix DirectSolverGive::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; const bool DirBC_Interior = DirectSolver::DirBC_Interior_; diff --git a/include/DirectSolver/DirectSolverGive/directSolverGive.h b/include/DirectSolver/DirectSolverGive/directSolverGive.h index edd51ff4..3484e362 100644 --- a/include/DirectSolver/DirectSolverGive/directSolverGive.h +++ b/include/DirectSolver/DirectSolverGive/directSolverGive.h @@ -9,7 +9,7 @@ template class DirectSolverGive : public DirectSolver { public: - explicit DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Note: The rhs (right-hand side) vector gets overwritten during the solution process. diff --git a/include/DirectSolver/DirectSolverGive/directSolverGive.inl b/include/DirectSolver/DirectSolverGive/directSolverGive.inl index 024c80c0..c47bd658 100644 --- a/include/DirectSolver/DirectSolverGive/directSolverGive.inl +++ b/include/DirectSolver/DirectSolverGive/directSolverGive.inl @@ -1,7 +1,7 @@ #pragma once template -DirectSolverGive::DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, +DirectSolverGive::DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : DirectSolver(grid, level_cache, DirBC_Interior, num_omp_threads) #ifdef GMGPOLAR_USE_MUMPS diff --git a/include/DirectSolver/DirectSolverGive/matrixStencil.inl b/include/DirectSolver/DirectSolverGive/matrixStencil.inl index 05483e0f..e966088a 100644 --- a/include/DirectSolver/DirectSolverGive/matrixStencil.inl +++ b/include/DirectSolver/DirectSolverGive/matrixStencil.inl @@ -3,7 +3,7 @@ namespace direct_solver_give { -static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) { int i_r, i_theta; grid.multiIndex(global_index, i_r, i_theta); @@ -33,7 +33,7 @@ static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGr Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { assert(0 <= i_r && i_r < grid.nr()); assert(grid.nr() >= 4); @@ -85,7 +85,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const Pol Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9; @@ -102,7 +102,7 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& g /* ----------------------------------------------------------------- */ /* If the indexing is not smoother-based, please adjust the indexing */ -static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; @@ -182,7 +182,7 @@ static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) { // 1. Check each node: getSolverMatrixIndex == cumulative sum of prior stencil sizes for (int global_index = 0; global_index < grid.numberOfNodes(); ++global_index) { diff --git a/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl b/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl index 1d5a0845..85d5eb9f 100644 --- a/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl +++ b/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl @@ -7,7 +7,7 @@ template void DirectSolverTake::applySymmetryShiftInnerBoundary(HostVector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(DirectSolver::DirBC_Interior_); @@ -52,7 +52,7 @@ void DirectSolverTake::applySymmetryShiftInnerBoundary(HostVecto template void DirectSolverTake::applySymmetryShiftOuterBoundary(HostVector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(level_cache.cacheDensityProfileCoefficients()); @@ -95,7 +95,7 @@ void DirectSolverTake::applySymmetryShiftOuterBoundary(HostVecto template void DirectSolverTake::applySymmetryShift(HostVector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const bool DirBC_Interior = DirectSolver::DirBC_Interior_; assert(std::ssize(x) == grid.numberOfNodes()); diff --git a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl index b1289786..e81f07af 100644 --- a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl @@ -28,7 +28,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR static KOKKOS_INLINE_FUNCTION void -nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, +nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, const SystemMatrix& solver_matrix, HostConstVector& arr, HostConstVector& att, HostConstVector& art, HostConstVector& detDF, HostConstVector& coeff_beta) @@ -483,7 +483,7 @@ typename DirectSolverTake::SystemMatrix DirectSolverTake::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; const bool DirBC_Interior = DirectSolver::DirBC_Interior_; diff --git a/include/DirectSolver/DirectSolverTake/directSolverTake.h b/include/DirectSolver/DirectSolverTake/directSolverTake.h index bd57c966..3ba0b835 100644 --- a/include/DirectSolver/DirectSolverTake/directSolverTake.h +++ b/include/DirectSolver/DirectSolverTake/directSolverTake.h @@ -9,7 +9,7 @@ template class DirectSolverTake : public DirectSolver { public: - explicit DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Note: The rhs (right-hand side) vector gets overwritten during the solution process. diff --git a/include/DirectSolver/DirectSolverTake/directSolverTake.inl b/include/DirectSolver/DirectSolverTake/directSolverTake.inl index 779c4301..58f29a84 100644 --- a/include/DirectSolver/DirectSolverTake/directSolverTake.inl +++ b/include/DirectSolver/DirectSolverTake/directSolverTake.inl @@ -1,7 +1,7 @@ #pragma once template -DirectSolverTake::DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, +DirectSolverTake::DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : DirectSolver(grid, level_cache, DirBC_Interior, num_omp_threads) #ifdef GMGPOLAR_USE_MUMPS diff --git a/include/DirectSolver/DirectSolverTake/matrixStencil.inl b/include/DirectSolver/DirectSolverTake/matrixStencil.inl index 6d223bb8..18b80f1d 100644 --- a/include/DirectSolver/DirectSolverTake/matrixStencil.inl +++ b/include/DirectSolver/DirectSolverTake/matrixStencil.inl @@ -3,7 +3,7 @@ namespace direct_solver_take { -static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) { int i_r, i_theta; grid.multiIndex(global_index, i_r, i_theta); @@ -31,7 +31,7 @@ static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGr } } -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { assert(0 <= i_r && i_r < grid.nr()); assert(grid.nr() >= 4); @@ -81,7 +81,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const Pol } } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9; @@ -98,7 +98,7 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& g /* ----------------------------------------------------------------- */ /* If the indexing is not smoother-based, please adjust the indexing */ -static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; @@ -177,7 +177,7 @@ static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int } } -static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) { // 1. Check each node: getSolverMatrixIndex == cumulative sum of prior stencil sizes for (int global_index = 0; global_index < grid.numberOfNodes(); ++global_index) { diff --git a/include/DirectSolver/directSolver.h b/include/DirectSolver/directSolver.h index 85d95579..958c9c5c 100644 --- a/include/DirectSolver/directSolver.h +++ b/include/DirectSolver/directSolver.h @@ -26,7 +26,7 @@ template class DirectSolver { public: - explicit DirectSolver(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit DirectSolver(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : grid_(grid) , level_cache_(level_cache) @@ -41,7 +41,7 @@ class DirectSolver virtual void solveInPlace(HostVector solution) = 0; protected: - const PolarGrid& grid_; + const PolarGrid& grid_; const LevelCacheType& level_cache_; const bool DirBC_Interior_; const int num_omp_threads_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl index 0ab19ccf..5e732978 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl @@ -5,7 +5,7 @@ namespace extrapolated_smoother_give template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, +nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result) { @@ -197,7 +197,7 @@ nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarG template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, +nodeApplyAscOrthoCircleGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result) { @@ -364,7 +364,7 @@ nodeApplyAscOrthoCircleGiveOutside(const int i_r, const int i_theta, const Polar template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, +nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result) { @@ -703,7 +703,7 @@ nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarG template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, +nodeApplyAscOrthoRadialGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result) { @@ -854,7 +854,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(H return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -938,7 +938,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(H return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -1023,7 +1023,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(H return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -1108,7 +1108,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(H return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl index c896eabd..e5c8969e 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl @@ -30,7 +30,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& m template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) { using extrapolated_smoother_give::update_CSR_COO_MatrixElement; @@ -195,7 +195,7 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) { using extrapolated_smoother_give::update_CSR_COO_MatrixElement; @@ -270,7 +270,7 @@ ExtrapolatedSmootherGive::buildInteriorBoundarySolverMatrix() using extrapolated_smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_0; using extrapolated_smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_1; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl index a2d32ebf..1baeed82 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl @@ -18,7 +18,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS template static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, +nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver) @@ -485,7 +485,7 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta template static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, +nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver) @@ -1090,7 +1090,7 @@ void ExtrapolatedSmootherGive::buildTridiagonalSolverMatrices() using extrapolated_smoother_give::nodeBuildTridiagonalSolverMatricesCircleSection; using extrapolated_smoother_give::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h index 16d5fdb4..a035e83c 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h @@ -60,7 +60,7 @@ class ExtrapolatedSmootherGive : public ExtrapolatedSmoother public: // Constructs the coupled circle-radial extrapolated smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Performs one full coupled extrapolated smoothing sweep: diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl index 89a959aa..d072e8a4 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl @@ -1,7 +1,7 @@ #pragma once template -ExtrapolatedSmootherGive::ExtrapolatedSmootherGive(const PolarGrid& grid, +ExtrapolatedSmootherGive::ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads) : ExtrapolatedSmoother(grid, level_cache, DirBC_Interior, num_omp_threads) @@ -48,7 +48,7 @@ void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector< assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; /* We split the loops into two regions to better respect the */ /* access patterns of the smoother and improve cache locality. */ diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl index 91876a72..c20fa2b9 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl @@ -17,7 +17,7 @@ namespace extrapolated_smoother_give // - Non-zero matrix indicesare obtained via `ptr + offset` // - A offset value of `-1` means the position is not included in the stencil pattern. // - Other values (0, 1, 2, ..., stencil_size - 1) correspond to valid stencil indices. -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // clang-format off @@ -59,7 +59,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int } } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. @@ -83,7 +83,7 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const } } -static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl index 149e7204..15bafc61 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl @@ -3,7 +3,7 @@ template void ExtrapolatedSmootherGive::solveBlackCircleSection(HostVector x, HostVector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = 0; int end = grid.numberCircularSmootherNodes(); @@ -46,7 +46,7 @@ void ExtrapolatedSmootherGive::solveBlackCircleSection(HostVecto template void ExtrapolatedSmootherGive::solveWhiteCircleSection(HostVector x, HostVector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = 0; int end = grid.numberCircularSmootherNodes(); @@ -89,7 +89,7 @@ void ExtrapolatedSmootherGive::solveWhiteCircleSection(HostVecto template void ExtrapolatedSmootherGive::solveBlackRadialSection(HostVector x, HostVector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); @@ -119,7 +119,7 @@ void ExtrapolatedSmootherGive::solveBlackRadialSection(HostVecto template void ExtrapolatedSmootherGive::solveWhiteRadialSection(HostVector x, HostVector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl index 03d0c1a1..c220e259 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl @@ -4,7 +4,7 @@ namespace extrapolated_smoother_take { static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, +nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result, HostConstVector& arr, HostConstVector& att, HostConstVector& art, HostConstVector& detDF, HostConstVector& coeff_beta) @@ -186,7 +186,7 @@ nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& g } static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialTake(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, +nodeApplyAscOrthoRadialTake(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result, HostConstVector& arr, const HostConstVector& att, HostConstVector& art, const HostConstVector& detDF, @@ -468,7 +468,7 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackCircleSection(H { using extrapolated_smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -508,7 +508,7 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteCircleSection(H { using extrapolated_smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const int num_omp_threads = ExtrapolatedSmoother::num_omp_threads_; @@ -549,7 +549,7 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackRadialSection(H { using extrapolated_smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const int num_omp_threads = ExtrapolatedSmoother::num_omp_threads_; @@ -590,7 +590,7 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteRadialSection(H { using extrapolated_smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const int num_omp_threads = ExtrapolatedSmoother::num_omp_threads_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl index 0a5dd32c..90b12f96 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl @@ -28,7 +28,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& m template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, +nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix, HostConstVector& arr, HostConstVector& att, HostConstVector& art, HostConstVector& detDF, HostConstVector& coeff_beta) @@ -168,7 +168,7 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() using extrapolated_smoother_take::getNonZeroCountCircleAsc; using extrapolated_smoother_take::nodeBuildInteriorBoundarySolverMatrix; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl index 814d88e5..e00770fd 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl @@ -15,7 +15,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS } static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesCircleSection( - const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, + const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver, HostConstVector& arr, HostConstVector& att, HostConstVector& art, HostConstVector& detDF, @@ -165,7 +165,7 @@ static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesCircleSecti } static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesRadialSection( - const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, + const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver, HostConstVector& arr, HostConstVector& att, HostConstVector& art, HostConstVector& detDF, @@ -535,7 +535,7 @@ void ExtrapolatedSmootherTake::buildTridiagonalSolverMatrices() using extrapolated_smoother_take::nodeBuildTridiagonalSolverMatricesCircleSection; using extrapolated_smoother_take::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h index 63aa63af..1e2b438c 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h @@ -60,7 +60,7 @@ class ExtrapolatedSmootherTake : public ExtrapolatedSmoother public: // Constructs the coupled circle-radial extrapolated smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Performs one full coupled extrapolated smoothing sweep: diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl index fcb8dfba..c1b755f9 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl @@ -1,7 +1,7 @@ #pragma once template -ExtrapolatedSmootherTake::ExtrapolatedSmootherTake(const PolarGrid& grid, +ExtrapolatedSmootherTake::ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads) : ExtrapolatedSmoother(grid, level_cache, DirBC_Interior, num_omp_threads) diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl index ced69b21..50621ba1 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl @@ -17,7 +17,7 @@ namespace extrapolated_smoother_take // - Non-zero matrix indicesare obtained via `ptr + offset` // - A offset value of `-1` means the position is not included in the stencil pattern. // - Other values (0, 1, 2, ..., stencil_size - 1) correspond to valid stencil indices. -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // clang-format off @@ -59,7 +59,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int } } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. @@ -83,7 +83,7 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const } } -static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl index f80e20da..426ced0a 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl @@ -3,7 +3,7 @@ template void ExtrapolatedSmootherTake::solveBlackCircleSection(HostVector x, HostVector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = 0; int end = grid.numberCircularSmootherNodes(); @@ -46,7 +46,7 @@ void ExtrapolatedSmootherTake::solveBlackCircleSection(HostVecto template void ExtrapolatedSmootherTake::solveWhiteCircleSection(HostVector x, HostVector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = 0; int end = grid.numberCircularSmootherNodes(); @@ -89,7 +89,7 @@ void ExtrapolatedSmootherTake::solveWhiteCircleSection(HostVecto template void ExtrapolatedSmootherTake::solveBlackRadialSection(HostVector x, HostVector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); @@ -119,7 +119,7 @@ void ExtrapolatedSmootherTake::solveBlackRadialSection(HostVecto template void ExtrapolatedSmootherTake::solveWhiteRadialSection(HostVector x, HostVector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); diff --git a/include/ExtrapolatedSmoother/extrapolatedSmoother.h b/include/ExtrapolatedSmoother/extrapolatedSmoother.h index 002714a4..8e2355a8 100644 --- a/include/ExtrapolatedSmoother/extrapolatedSmoother.h +++ b/include/ExtrapolatedSmoother/extrapolatedSmoother.h @@ -27,7 +27,7 @@ template class ExtrapolatedSmoother { public: - explicit ExtrapolatedSmoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit ExtrapolatedSmoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : grid_(grid) , level_cache_(level_cache) @@ -40,7 +40,7 @@ class ExtrapolatedSmoother virtual void extrapolatedSmoothing(HostVector x, HostConstVector rhs, HostVector temp) = 0; protected: - const PolarGrid& grid_; + const PolarGrid& grid_; const LevelCacheType& level_cache_; const bool DirBC_Interior_; const int num_omp_threads_; diff --git a/include/GMGPolar/gmgpolar.h b/include/GMGPolar/gmgpolar.h index 1f46bfe3..a4311d21 100644 --- a/include/GMGPolar/gmgpolar.h +++ b/include/GMGPolar/gmgpolar.h @@ -29,7 +29,7 @@ class GMGPolar : public IGMGPolar // - grid: Cartesian mesh discretizing the computational domain. // - domain_geometry: Mapping from the reference domain to the physical domain \Omega. // - density_profile_coefficients: Coefficients \alpha and \beta defining the PDE. - GMGPolar(const PolarGrid& grid, const DomainGeometry& domain_geometry, + GMGPolar(const PolarGrid& grid, const DomainGeometry& domain_geometry, const DensityProfileCoefficients& density_profile_coefficients) : IGMGPolar(grid) , domain_geometry_(domain_geometry) @@ -66,7 +66,7 @@ class GMGPolar : public IGMGPolar HostConstVector solution() const; // Return the underlying cartesian mesh used for discretization. - const PolarGrid& grid() const; + const PolarGrid& grid() const; /* ---------------------------------------------------------------------- */ /* Diagnostics & statistics */ @@ -138,7 +138,7 @@ class GMGPolar : public IGMGPolar /* --------------- */ /* Setup Functions */ - int chooseNumberOfLevels(const PolarGrid& finest_grid); + int chooseNumberOfLevels(const PolarGrid& finest_grid); // Public due to cuda restrictions public: template @@ -147,7 +147,7 @@ class GMGPolar : public IGMGPolar void discretize_rhs_f(const Level& level, HostVector rhs_f); private: - bool checkUniformRefinement(const PolarGrid& grid, double tolerance) const; + bool checkUniformRefinement(const PolarGrid& grid, double tolerance) const; /* --------------- */ /* Solve Functions */ @@ -173,7 +173,7 @@ class GMGPolar : public IGMGPolar /* ----------------- */ /* Print information */ - void printSettings(const PolarGrid& finest_grid, const PolarGrid& coarsest_grid) const; + void printSettings(const PolarGrid& finest_grid, const PolarGrid& coarsest_grid) const; void printIterationHeader(const ExactSolution* exact_solution); void printIterationInfo(int iteration, double current_residual_norm, double current_relative_residual_norm, const ExactSolution* exact_solution); @@ -204,7 +204,7 @@ class GMGPolar : public IGMGPolar /* ------------- */ /* Visualization */ - void writeToVTK(const std::filesystem::path& file_path, const PolarGrid& grid); + void writeToVTK(const std::filesystem::path& file_path, const PolarGrid& grid); void writeToVTK(const std::filesystem::path& file_path, const Level& level, HostConstVector grid_function); diff --git a/include/GMGPolar/igmgpolar.h b/include/GMGPolar/igmgpolar.h index 89c969fb..bba0dae2 100644 --- a/include/GMGPolar/igmgpolar.h +++ b/include/GMGPolar/igmgpolar.h @@ -32,7 +32,7 @@ class IGMGPolar // with Dirichlet boundary condition u = u_D on \partial \Omega. // Parameters: // - grid: Cartesian mesh discretizing the computational domain. - IGMGPolar(const PolarGrid& grid); + IGMGPolar(const PolarGrid& grid); /* ---------------------------------------------------------------------- */ /* General output & visualization */ @@ -161,7 +161,7 @@ class IGMGPolar /* ------------------------------------ */ /* Grid Configuration & Input Functions */ /* ------------------------------------ */ - const PolarGrid& grid_; + const PolarGrid& grid_; /* ------------------ */ /* Control Parameters */ diff --git a/include/GMGPolar/setup.h b/include/GMGPolar/setup.h index eae98303..b4ca11d1 100644 --- a/include/GMGPolar/setup.h +++ b/include/GMGPolar/setup.h @@ -20,7 +20,7 @@ void GMGPolar::setup() // -------------------------------- // // Create the finest mesh (level 0) // // -------------------------------- // - auto finest_grid = std::make_unique(grid_); + auto finest_grid = std::make_unique>(grid_); if (paraview_) writeToVTK("output_finest_grid", *finest_grid); @@ -28,12 +28,12 @@ void GMGPolar::setup() if (extrapolation_ != ExtrapolationType::NONE) { const double precision = 1e-12; if (!checkUniformRefinement(*finest_grid, precision)) { - std::cerr << "[Extrapolation Warning] Finest PolarGrid is not from a single uniform refinement.\n"; + std::cerr << "[Extrapolation Warning] Finest PolarGrid is not from a single uniform refinement.\n"; } } // ---------------------------------------------------------- // - // Building PolarGrid and LevelCache for all multigrid levels // + // Building PolarGrid and LevelCache for all multigrid levels // // ---------------------------------------------------------- // number_of_levels_ = chooseNumberOfLevels(*finest_grid); /* Implementation below */ levels_.clear(); @@ -45,7 +45,7 @@ void GMGPolar::setup() levels_.emplace_back(0, std::move(finest_grid), std::move(finest_levelCache), extrapolation_, FMG_, PCG_FMG_); for (int level_depth = 1; level_depth < number_of_levels_; level_depth++) { - auto current_grid = std::make_unique(coarseningGrid(levels_[level_depth - 1].grid())); + auto current_grid = std::make_unique>(coarseningGrid(levels_[level_depth - 1].grid())); auto current_levelCache = std::make_unique>( *current_grid, density_profile_coefficients_, domain_geometry_, cache_density_profile_coefficients_, cache_domain_geometry_); @@ -148,7 +148,7 @@ void GMGPolar::setup() } template -int GMGPolar::chooseNumberOfLevels(const PolarGrid& finestGrid) +int GMGPolar::chooseNumberOfLevels(const PolarGrid& finestGrid) { constexpr int minRadialNodes = 5; constexpr int minAngularDivisions = 4; @@ -191,7 +191,7 @@ template ::discretize_rhs_f( const Level& level, HostVector rhs_f) { - const PolarGrid& grid = level.grid(); + const PolarGrid& grid = level.grid(); assert(std::ssize(rhs_f) == grid.numberOfNodes()); const bool DirBC_Interior = DirBC_Interior_; @@ -333,7 +333,7 @@ void GMGPolar::build_rhs_f( const Level& level, HostVector rhs_f, const BoundaryConditions& boundary_conditions, const SourceTerm& source_term) { - const PolarGrid& grid = level.grid(); + const PolarGrid& grid = level.grid(); assert(std::ssize(rhs_f) == grid.numberOfNodes()); const bool DirBC_Interior = DirBC_Interior_; @@ -384,8 +384,8 @@ void GMGPolar::build_rhs_f( } template -void GMGPolar::printSettings(const PolarGrid& finest_grid, - const PolarGrid& coarsest_grid) const +void GMGPolar::printSettings(const PolarGrid& finest_grid, + const PolarGrid& coarsest_grid) const { std::cout << "------------------------------\n"; @@ -435,7 +435,7 @@ void GMGPolar::printSettings(const P << "\n"; std::cout << "------------------------------\n"; - std::cout << "---------- PolarGrid ---------\n"; + std::cout << "---------- PolarGrid ---------\n"; std::cout << "------------------------------\n"; std::cout << "r ∈ [" << finest_grid.radius(0) << ", " << finest_grid.radius(finest_grid.nr() - 1) @@ -583,7 +583,7 @@ void GMGPolar::printSettings(const P } template -bool GMGPolar::checkUniformRefinement(const PolarGrid& grid, +bool GMGPolar::checkUniformRefinement(const PolarGrid& grid, double tolerance) const { // Radial direction diff --git a/include/GMGPolar/solver.h b/include/GMGPolar/solver.h index 927327da..7584e546 100644 --- a/include/GMGPolar/solver.h +++ b/include/GMGPolar/solver.h @@ -505,8 +505,8 @@ void GMGPolar::applyExtrapolation(in HostVector fine_values, HostConstVector coarse_values) { - const PolarGrid& fineGrid = levels_[current_level].grid(); - const PolarGrid& coarseGrid = levels_[current_level + 1].grid(); + const PolarGrid& fineGrid = levels_[current_level].grid(); + const PolarGrid& coarseGrid = levels_[current_level + 1].grid(); assert(std::ssize(fine_values) == fineGrid.numberOfNodes()); assert(std::ssize(coarse_values) == coarseGrid.numberOfNodes()); @@ -586,7 +586,7 @@ std::pair GMGPolar:: Level& level, HostConstVector solution, HostVector error, const ExactSolution& exact_solution) { - const PolarGrid& grid = level.grid(); + const PolarGrid& grid = level.grid(); const LevelCache& levelCache = level.levelCache(); assert(solution.size() == error.size()); diff --git a/include/GMGPolar/utils.h b/include/GMGPolar/utils.h index ca637fa1..507265a3 100644 --- a/include/GMGPolar/utils.h +++ b/include/GMGPolar/utils.h @@ -92,7 +92,7 @@ HostConstVector GMGPolar::so } template -const PolarGrid& GMGPolar::grid() const +const PolarGrid& GMGPolar::grid() const { return grid_; } @@ -180,7 +180,7 @@ std::optional GMGPolar::exac /* ---------------------------------------------------------------------- */ template void GMGPolar::writeToVTK(const std::filesystem::path& file_path, - const PolarGrid& grid) + const PolarGrid& grid) { const auto filename = file_path.stem().string() + ".vtu"; @@ -243,7 +243,7 @@ void GMGPolar::writeToVTK( const std::filesystem::path& file_path, const Level& level, HostConstVector grid_function) { - const PolarGrid& grid = level.grid(); + const PolarGrid& grid = level.grid(); const LevelCache& level_cache = level.levelCache(); assert(std::ssize(grid_function) == grid.numberOfNodes()); diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.h index ab27496d..8615d395 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_Poisson_CircularGeometry { public: - explicit CartesianR2_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR2_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Poisson_CircularGeometry(const CartesianR2_Poisson_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h index 9fb5c9aa..8b96e0b2 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_Poisson_CzarnyGeometry { public: - explicit CartesianR2_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, + explicit CartesianR2_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Poisson_CzarnyGeometry(const CartesianR2_Poisson_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h index 7e57db12..f00d7c53 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_Poisson_ShafranovGeometry { public: - explicit CartesianR2_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR2_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Poisson_ShafranovGeometry(const CartesianR2_Poisson_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_Poisson_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.h index 5695e90b..ef18431b 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_SonnendruckerGyro_CircularGeometry { public: - explicit CartesianR2_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR2_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR2_SonnendruckerGyro_CircularGeometry(const CartesianR2_SonnendruckerGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.h index e406aaf3..5902b6e3 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_SonnendruckerGyro_CzarnyGeometry { public: - explicit CartesianR2_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR2_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_SonnendruckerGyro_CzarnyGeometry(const CartesianR2_SonnendruckerGyro_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_SonnendruckerGyro_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.h index ffed0049..5757857f 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_SonnendruckerGyro_ShafranovGeometry { public: - explicit CartesianR2_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR2_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_SonnendruckerGyro_ShafranovGeometry(const CartesianR2_SonnendruckerGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_SonnendruckerGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.h index 2c4c353b..4e6bea76 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_Sonnendrucker_CircularGeometry { public: - explicit CartesianR2_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR2_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Sonnendrucker_CircularGeometry(const CartesianR2_Sonnendrucker_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.h index 46df1080..6395fbfa 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_Sonnendrucker_CzarnyGeometry { public: - explicit CartesianR2_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR2_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Sonnendrucker_CzarnyGeometry(const CartesianR2_Sonnendrucker_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_Sonnendrucker_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h index db507abc..539b1393 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_Sonnendrucker_ShafranovGeometry { public: - explicit CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Sonnendrucker_ShafranovGeometry(const CartesianR2_Sonnendrucker_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_Sonnendrucker_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.h index 56189486..1dd1fb75 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_ZoniGyro_CircularGeometry { public: - explicit CartesianR2_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR2_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniGyro_CircularGeometry(const CartesianR2_ZoniGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.h index a6c68a34..75a2cbc5 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_ZoniGyro_CzarnyGeometry { public: - explicit CartesianR2_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR2_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniGyro_CzarnyGeometry(const CartesianR2_ZoniGyro_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h index ea53c4a5..6595a9a5 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_ZoniGyro_ShafranovGeometry { public: - explicit CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniGyro_ShafranovGeometry(const CartesianR2_ZoniGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_ZoniGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.h index d18d947c..f9833a04 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_ZoniShiftedGyro_CircularGeometry { public: - explicit CartesianR2_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR2_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniShiftedGyro_CircularGeometry(const CartesianR2_ZoniShiftedGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.h index d09cedec..ca42fc2a 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_ZoniShiftedGyro_CzarnyGeometry { public: - explicit CartesianR2_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR2_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniShiftedGyro_CzarnyGeometry(const CartesianR2_ZoniShiftedGyro_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_ZoniShiftedGyro_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h index 81e1816c..bca34efa 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_ZoniShiftedGyro_ShafranovGeometry { public: - explicit CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniShiftedGyro_ShafranovGeometry(const CartesianR2_ZoniShiftedGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_ZoniShiftedGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.h index baea07b4..15861016 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_ZoniShifted_CircularGeometry { public: - explicit CartesianR2_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR2_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniShifted_CircularGeometry(const CartesianR2_ZoniShifted_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.h index bcb64592..900b2906 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_ZoniShifted_CzarnyGeometry { public: - explicit CartesianR2_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR2_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniShifted_CzarnyGeometry(const CartesianR2_ZoniShifted_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_ZoniShifted_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h index ea30601f..6764e104 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR2_ZoniShifted_ShafranovGeometry { public: - explicit CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniShifted_ShafranovGeometry(const CartesianR2_ZoniShifted_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR2_ZoniShifted_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.h index 31141337..bb6b58a7 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.h @@ -12,13 +12,13 @@ namespace gmgpolar class CartesianR2_Zoni_CircularGeometry { public: - explicit CartesianR2_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR2_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Zoni_CircularGeometry(const CartesianR2_Zoni_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h index bfcc08ab..97011e77 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_Zoni_CzarnyGeometry { public: - explicit CartesianR2_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, + explicit CartesianR2_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Zoni_CzarnyGeometry(const CartesianR2_Zoni_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h index 15fcf405..3da7f2f1 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR2_Zoni_ShafranovGeometry { public: - explicit CartesianR2_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR2_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Zoni_ShafranovGeometry(const CartesianR2_Zoni_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.h index 89d07b62..e8aafa57 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_Poisson_CircularGeometry { public: - explicit CartesianR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Poisson_CircularGeometry(const CartesianR6_Poisson_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h index e2468619..c17a9c4a 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_Poisson_CzarnyGeometry { public: - explicit CartesianR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, + explicit CartesianR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Poisson_CzarnyGeometry(const CartesianR6_Poisson_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h index 19bd7070..74300b72 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_Poisson_ShafranovGeometry { public: - explicit CartesianR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Poisson_ShafranovGeometry(const CartesianR6_Poisson_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_Poisson_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.h index dd5f85a7..53275532 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_SonnendruckerGyro_CircularGeometry { public: - explicit CartesianR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR6_SonnendruckerGyro_CircularGeometry(const CartesianR6_SonnendruckerGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.h index 5483e3a6..b08fe9cd 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_SonnendruckerGyro_CzarnyGeometry { public: - explicit CartesianR6_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR6_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_SonnendruckerGyro_CzarnyGeometry(const CartesianR6_SonnendruckerGyro_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_SonnendruckerGyro_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.h index d4f45b3c..49f4248c 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_SonnendruckerGyro_ShafranovGeometry { public: - explicit CartesianR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_SonnendruckerGyro_ShafranovGeometry(const CartesianR6_SonnendruckerGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_SonnendruckerGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.h index acaeb1fd..1ae22336 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_Sonnendrucker_CircularGeometry { public: - explicit CartesianR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Sonnendrucker_CircularGeometry(const CartesianR6_Sonnendrucker_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.h index fd7ec12d..7e6f0e7a 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_Sonnendrucker_CzarnyGeometry { public: - explicit CartesianR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Sonnendrucker_CzarnyGeometry(const CartesianR6_Sonnendrucker_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_Sonnendrucker_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h index 2fdd969b..5b04a625 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_Sonnendrucker_ShafranovGeometry { public: - explicit CartesianR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Sonnendrucker_ShafranovGeometry(const CartesianR6_Sonnendrucker_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_Sonnendrucker_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.h index 41bdc0ba..c1280a6a 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_ZoniGyro_CircularGeometry { public: - explicit CartesianR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniGyro_CircularGeometry(const CartesianR6_ZoniGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.h index ffdb03de..996a2cba 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_ZoniGyro_CzarnyGeometry { public: - explicit CartesianR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniGyro_CzarnyGeometry(const CartesianR6_ZoniGyro_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h index 131387f8..a1cee42e 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_ZoniGyro_ShafranovGeometry { public: - explicit CartesianR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniGyro_ShafranovGeometry(const CartesianR6_ZoniGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_ZoniGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.h index 23bd2859..cdbaec71 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_ZoniShiftedGyro_CircularGeometry { public: - explicit CartesianR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniShiftedGyro_CircularGeometry(const CartesianR6_ZoniShiftedGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.h index 896ef647..d97e04ac 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_ZoniShiftedGyro_CzarnyGeometry { public: - explicit CartesianR6_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR6_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniShiftedGyro_CzarnyGeometry(const CartesianR6_ZoniShiftedGyro_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_ZoniShiftedGyro_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h index c9e92ef9..a476a815 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_ZoniShiftedGyro_ShafranovGeometry { public: - explicit CartesianR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniShiftedGyro_ShafranovGeometry(const CartesianR6_ZoniShiftedGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_ZoniShiftedGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.h index 2d581e30..401b244e 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_ZoniShifted_CircularGeometry { public: - explicit CartesianR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniShifted_CircularGeometry(const CartesianR6_ZoniShifted_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.h index 645cceee..25714d98 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_ZoniShifted_CzarnyGeometry { public: - explicit CartesianR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit CartesianR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniShifted_CzarnyGeometry(const CartesianR6_ZoniShifted_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_ZoniShifted_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h index b172906a..b07feb5c 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class CartesianR6_ZoniShifted_ShafranovGeometry { public: - explicit CartesianR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniShifted_ShafranovGeometry(const CartesianR6_ZoniShifted_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class CartesianR6_ZoniShifted_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.h index 0bc64ba2..410547cc 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.h @@ -12,13 +12,13 @@ namespace gmgpolar class CartesianR6_Zoni_CircularGeometry { public: - explicit CartesianR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit CartesianR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Zoni_CircularGeometry(const CartesianR6_Zoni_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h index 40821d06..6928f6d6 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_Zoni_CzarnyGeometry { public: - explicit CartesianR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, + explicit CartesianR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Zoni_CzarnyGeometry(const CartesianR6_Zoni_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h index 98deb83d..f65e9a93 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class CartesianR6_Zoni_ShafranovGeometry { public: - explicit CartesianR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit CartesianR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Zoni_ShafranovGeometry(const CartesianR6_Zoni_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.h index 364e5b92..fd705e8b 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.h @@ -12,13 +12,13 @@ namespace gmgpolar class PolarR6_Poisson_CircularGeometry { public: - explicit PolarR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit PolarR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION PolarR6_Poisson_CircularGeometry(const PolarR6_Poisson_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h index d7b206cc..cee0455b 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_Poisson_CzarnyGeometry { public: - explicit PolarR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, + explicit PolarR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_Poisson_CzarnyGeometry(const PolarR6_Poisson_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h index 717295ae..9df44c7d 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_Poisson_ShafranovGeometry { public: - explicit PolarR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit PolarR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_Poisson_ShafranovGeometry(const PolarR6_Poisson_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.h index f932bbc1..8be29b20 100644 --- a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_SonnendruckerGyro_CircularGeometry { public: - explicit PolarR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit PolarR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION PolarR6_SonnendruckerGyro_CircularGeometry(const PolarR6_SonnendruckerGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.h index 0d60af11..87966eec 100644 --- a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class PolarR6_SonnendruckerGyro_CzarnyGeometry { public: - explicit PolarR6_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit PolarR6_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_SonnendruckerGyro_CzarnyGeometry(const PolarR6_SonnendruckerGyro_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class PolarR6_SonnendruckerGyro_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h index b73c5120..c101c6b1 100644 --- a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class PolarR6_SonnendruckerGyro_ShafranovGeometry { public: - explicit PolarR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit PolarR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_SonnendruckerGyro_ShafranovGeometry(const PolarR6_SonnendruckerGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class PolarR6_SonnendruckerGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.h index 63577f68..72d130d8 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_Sonnendrucker_CircularGeometry { public: - explicit PolarR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit PolarR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION PolarR6_Sonnendrucker_CircularGeometry(const PolarR6_Sonnendrucker_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.h index a2a2a729..17f8e982 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class PolarR6_Sonnendrucker_CzarnyGeometry { public: - explicit PolarR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit PolarR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_Sonnendrucker_CzarnyGeometry(const PolarR6_Sonnendrucker_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class PolarR6_Sonnendrucker_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h index f5b67792..a6fedb65 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class PolarR6_Sonnendrucker_ShafranovGeometry { public: - explicit PolarR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit PolarR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_Sonnendrucker_ShafranovGeometry(const PolarR6_Sonnendrucker_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class PolarR6_Sonnendrucker_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.h index 29d00d8b..7c2f944b 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.h @@ -12,13 +12,13 @@ namespace gmgpolar class PolarR6_ZoniGyro_CircularGeometry { public: - explicit PolarR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit PolarR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniGyro_CircularGeometry(const PolarR6_ZoniGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h index 287aef95..cac0cc85 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_ZoniGyro_CzarnyGeometry { public: - explicit PolarR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, + explicit PolarR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniGyro_CzarnyGeometry(const PolarR6_ZoniGyro_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h index efd51746..449c482e 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_ZoniGyro_ShafranovGeometry { public: - explicit PolarR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit PolarR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniGyro_ShafranovGeometry(const PolarR6_ZoniGyro_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.h index 4de29c8f..74fc9204 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_ZoniShiftedGyro_CircularGeometry { public: - explicit PolarR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit PolarR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShiftedGyro_CircularGeometry(const PolarR6_ZoniShiftedGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.h index 7bee69d0..52c4b8af 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_ZoniShiftedGyro_CulhamGeometry { public: - explicit PolarR6_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax); + explicit PolarR6_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShiftedGyro_CulhamGeometry(const PolarR6_ZoniShiftedGyro_CulhamGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.h index cd514aca..f5e86b7f 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class PolarR6_ZoniShiftedGyro_CzarnyGeometry { public: - explicit PolarR6_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit PolarR6_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShiftedGyro_CzarnyGeometry(const PolarR6_ZoniShiftedGyro_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class PolarR6_ZoniShiftedGyro_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h index edc849cf..249e7bb8 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class PolarR6_ZoniShiftedGyro_ShafranovGeometry { public: - explicit PolarR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit PolarR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShiftedGyro_ShafranovGeometry(const PolarR6_ZoniShiftedGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class PolarR6_ZoniShiftedGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.h index c4ac3625..074c02a6 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_ZoniShifted_CircularGeometry { public: - explicit PolarR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit PolarR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShifted_CircularGeometry(const PolarR6_ZoniShifted_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h index a31cb844..32f3ae64 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_ZoniShifted_CzarnyGeometry { public: - explicit PolarR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, + explicit PolarR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShifted_CzarnyGeometry(const PolarR6_ZoniShifted_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h index b81d8894..3308bf22 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class PolarR6_ZoniShifted_ShafranovGeometry { public: - explicit PolarR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit PolarR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShifted_ShafranovGeometry(const PolarR6_ZoniShifted_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class PolarR6_ZoniShifted_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.h index 2313ea37..af358d9e 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.h @@ -12,13 +12,13 @@ namespace gmgpolar class PolarR6_Zoni_CircularGeometry { public: - explicit PolarR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit PolarR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION PolarR6_Zoni_CircularGeometry(const PolarR6_Zoni_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h index a3fce910..b9570f57 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_Zoni_CzarnyGeometry { public: - explicit PolarR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, + explicit PolarR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_Zoni_CzarnyGeometry(const PolarR6_Zoni_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h index 5fcfd58f..9618a140 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class PolarR6_Zoni_ShafranovGeometry { public: - explicit PolarR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit PolarR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_Zoni_ShafranovGeometry(const PolarR6_Zoni_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.h b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.h index cf0d80dd..d9b4e430 100644 --- a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.h +++ b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class Refined_ZoniShiftedGyro_CircularGeometry { public: - explicit Refined_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax); + explicit Refined_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION Refined_ZoniShiftedGyro_CircularGeometry(const Refined_ZoniShiftedGyro_CircularGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.h b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.h index db469311..0663636d 100644 --- a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.h +++ b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.h @@ -12,14 +12,14 @@ namespace gmgpolar class Refined_ZoniShiftedGyro_CulhamGeometry { public: - explicit Refined_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax); + explicit Refined_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax); KOKKOS_DEFAULTED_FUNCTION Refined_ZoniShiftedGyro_CulhamGeometry(const Refined_ZoniShiftedGyro_CulhamGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; }; } // namespace gmgpolar diff --git a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.h index 938fcb38..d19d705a 100644 --- a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class Refined_ZoniShiftedGyro_CzarnyGeometry { public: - explicit Refined_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + explicit Refined_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION Refined_ZoniShiftedGyro_CzarnyGeometry(const Refined_ZoniShiftedGyro_CzarnyGeometry&) = default; @@ -20,7 +20,7 @@ class Refined_ZoniShiftedGyro_CzarnyGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; diff --git a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h index 1435845b..4550e990 100644 --- a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,7 +12,7 @@ namespace gmgpolar class Refined_ZoniShiftedGyro_ShafranovGeometry { public: - explicit Refined_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, + explicit Refined_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION Refined_ZoniShiftedGyro_ShafranovGeometry(const Refined_ZoniShiftedGyro_ShafranovGeometry&) = default; @@ -20,7 +20,7 @@ class Refined_ZoniShiftedGyro_ShafranovGeometry KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; private: - PolarGrid grid_; + PolarGrid grid_; const double Rmax = 1.3; const double elongation_kappa = 0.3; const double shift_delta = 0.2; diff --git a/include/Interpolation/interpolation.h b/include/Interpolation/interpolation.h index 0036ceec..6de13676 100644 --- a/include/Interpolation/interpolation.h +++ b/include/Interpolation/interpolation.h @@ -19,25 +19,25 @@ class Interpolation explicit Interpolation(int max_omp_threads, bool DirBC_Interior); /* Remark: This injection is not scaled. */ - void applyInjection(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, + void applyInjection(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, HostConstVector fine_values) const; /* Bilinear interpolation operator */ - void applyProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, + void applyProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const; - void applyExtrapolatedProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, + void applyExtrapolatedProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const; /* Scaled full weighting (FW) restriction operator. */ - void applyRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, + void applyRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, HostConstVector fine_values) const; - void applyExtrapolatedRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, + void applyExtrapolatedRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, HostConstVector fine_values) const; /* Bicubic FMG interpolator 1/16 * [-1, 9, 9, -1] */ - void applyFMGInterpolation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, + void applyFMGInterpolation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const; private: diff --git a/include/Level/level.h b/include/Level/level.h index 3390704d..aa310c89 100644 --- a/include/Level/level.h +++ b/include/Level/level.h @@ -73,14 +73,14 @@ class Level public: // ----------- // // Constructor // - explicit Level(const int level_depth, std::unique_ptr grid, + explicit Level(const int level_depth, std::unique_ptr> grid, std::unique_ptr level_cache, const ExtrapolationType extrapolation, const bool FMG, const bool PCG_FMG = false); // ---------------- // // Getter Functions // int level_depth() const; - const PolarGrid& grid() const; + const PolarGrid& grid() const; const LevelCacheType& levelCache() const; HostVector rhs(); @@ -120,7 +120,7 @@ class Level private: const int level_depth_; - std::unique_ptr grid_; + std::unique_ptr> grid_; std::unique_ptr level_cache_; std::unique_ptr> op_directSolver_; @@ -138,7 +138,7 @@ template & grid, const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const bool cache_density_profile_coefficients, const bool cache_domain_geometry); diff --git a/include/Level/level.inl b/include/Level/level.inl index 5a6ae2b0..46aa91f4 100644 --- a/include/Level/level.inl +++ b/include/Level/level.inl @@ -4,7 +4,7 @@ // Constructor // template Level::Level( - const int level_depth, std::unique_ptr grid, + const int level_depth, std::unique_ptr> grid, std::unique_ptr> level_cache, const ExtrapolationType extrapolation, const bool FMG, const bool PCG_FMG) : level_depth_(level_depth) @@ -28,7 +28,7 @@ int Level::level_depth() const } template -const PolarGrid& Level::grid() const +const PolarGrid& Level::grid() const { return *grid_; } diff --git a/include/Level/levelCache.inl b/include/Level/levelCache.inl index 69c4bdac..b3b523d5 100644 --- a/include/Level/levelCache.inl +++ b/include/Level/levelCache.inl @@ -2,7 +2,7 @@ template LevelCache::LevelCache( - const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, + const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const bool cache_density_profile_coefficients, const bool cache_domain_geometry) : domain_geometry_(domain_geometry) diff --git a/include/Residual/ResidualGive/applyAGive.inl b/include/Residual/ResidualGive/applyAGive.inl index 190cfec0..cc809893 100644 --- a/include/Residual/ResidualGive/applyAGive.inl +++ b/include/Residual/ResidualGive/applyAGive.inl @@ -3,7 +3,7 @@ namespace residual_give { template -static KOKKOS_INLINE_FUNCTION void node_apply_a_give(int i_r, int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION void node_apply_a_give(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, HostVector& result, HostConstVector& x) { @@ -199,7 +199,7 @@ void ResidualGive::applySystemOperator(HostVector result { assert(result.size() == x.size()); - const PolarGrid& grid = Residual::grid_; + const PolarGrid& grid = Residual::grid_; const LevelCacheType& level_cache = Residual::level_cache_; const bool DirBC_Interior = Residual::DirBC_Interior_; diff --git a/include/Residual/ResidualGive/residualGive.h b/include/Residual/ResidualGive/residualGive.h index 927c60e7..547a29b0 100644 --- a/include/Residual/ResidualGive/residualGive.h +++ b/include/Residual/ResidualGive/residualGive.h @@ -9,7 +9,7 @@ template class ResidualGive : public Residual { public: - explicit ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, + explicit ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads); ~ResidualGive() override = default; diff --git a/include/Residual/ResidualGive/residualGive.inl b/include/Residual/ResidualGive/residualGive.inl index 2a217529..56b048c9 100644 --- a/include/Residual/ResidualGive/residualGive.inl +++ b/include/Residual/ResidualGive/residualGive.inl @@ -1,7 +1,7 @@ #pragma once template -ResidualGive::ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, +ResidualGive::ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : Residual(grid, level_cache, DirBC_Interior, num_omp_threads) { diff --git a/include/Residual/ResidualTake/applyATake.inl b/include/Residual/ResidualTake/applyATake.inl index 5ed9c217..428b333c 100644 --- a/include/Residual/ResidualTake/applyATake.inl +++ b/include/Residual/ResidualTake/applyATake.inl @@ -3,7 +3,7 @@ namespace residual_take { -static KOKKOS_INLINE_FUNCTION void node_apply_a_take(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION void node_apply_a_take(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, HostVector& result, HostConstVector& x, HostConstVector& arr, HostConstVector& att, HostConstVector& art, @@ -72,7 +72,7 @@ void ResidualTake::applySystemOperator(HostVector result using residual_take::node_apply_a_take; - const PolarGrid& grid = Residual::grid_; + const PolarGrid& grid = Residual::grid_; const bool DirBC_Interior = Residual::DirBC_Interior_; assert(Residual::level_cache_.cacheDensityProfileCoefficients()); diff --git a/include/Residual/ResidualTake/residualTake.h b/include/Residual/ResidualTake/residualTake.h index 6dd2507f..593b47cb 100644 --- a/include/Residual/ResidualTake/residualTake.h +++ b/include/Residual/ResidualTake/residualTake.h @@ -9,7 +9,7 @@ template class ResidualTake : public Residual { public: - explicit ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, + explicit ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads); KOKKOS_DEFAULTED_FUNCTION ResidualTake(const ResidualTake&) = default; KOKKOS_DEFAULTED_FUNCTION ~ResidualTake() override = default; diff --git a/include/Residual/ResidualTake/residualTake.inl b/include/Residual/ResidualTake/residualTake.inl index d57a6e54..b845295e 100644 --- a/include/Residual/ResidualTake/residualTake.inl +++ b/include/Residual/ResidualTake/residualTake.inl @@ -1,7 +1,7 @@ #pragma once template -ResidualTake::ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, +ResidualTake::ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : Residual(grid, level_cache, DirBC_Interior, num_omp_threads) { diff --git a/include/Residual/residual.h b/include/Residual/residual.h index 29f25528..5364b424 100644 --- a/include/Residual/residual.h +++ b/include/Residual/residual.h @@ -16,7 +16,7 @@ template class Residual { public: - explicit Residual(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, + explicit Residual(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads) : grid_(grid) , level_cache_(level_cache) @@ -33,7 +33,7 @@ class Residual protected: /* ------------------- */ /* Constructor members */ - const PolarGrid grid_; + const PolarGrid grid_; const LevelCacheType level_cache_; const bool DirBC_Interior_; const int num_omp_threads_; diff --git a/include/Smoother/SmootherGive/applyAscOrtho.inl b/include/Smoother/SmootherGive/applyAscOrtho.inl index 8af47fa8..46322976 100644 --- a/include/Smoother/SmootherGive/applyAscOrtho.inl +++ b/include/Smoother/SmootherGive/applyAscOrtho.inl @@ -5,7 +5,7 @@ namespace smoother_give template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result) { @@ -54,7 +54,7 @@ nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid& grid, c template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result) { @@ -101,7 +101,7 @@ nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid& grid, template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result) { @@ -179,7 +179,7 @@ nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid& grid, c template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeApplyAscOrthoRadialGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result) { @@ -239,7 +239,7 @@ void SmootherGive::applyAscOrthoBlackCircleSection(HostConstVect return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -322,7 +322,7 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(HostConstVect return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -406,7 +406,7 @@ void SmootherGive::applyAscOrthoBlackRadialSection(HostConstVect return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -490,7 +490,7 @@ void SmootherGive::applyAscOrthoWhiteRadialSection(HostConstVect return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; diff --git a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl index 8350bc17..bed749a2 100644 --- a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl @@ -28,7 +28,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& m template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) { using smoother_give::getCircleAscIndex; @@ -200,7 +200,7 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) { using smoother_give::getCircleAscIndex; @@ -261,7 +261,7 @@ SmootherGive::buildInteriorBoundarySolverMatrix() using smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_0; using smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_1; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; diff --git a/include/Smoother/SmootherGive/buildTridiagonalAsc.inl b/include/Smoother/SmootherGive/buildTridiagonalAsc.inl index 20270402..4dd1037c 100644 --- a/include/Smoother/SmootherGive/buildTridiagonalAsc.inl +++ b/include/Smoother/SmootherGive/buildTridiagonalAsc.inl @@ -16,7 +16,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS template static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, +nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver) @@ -192,7 +192,7 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta template static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, +nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver) @@ -520,7 +520,7 @@ void SmootherGive::buildTridiagonalSolverMatrices() using smoother_give::nodeBuildTridiagonalSolverMatricesCircleSection; using smoother_give::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; diff --git a/include/Smoother/SmootherGive/matrixStencil.inl b/include/Smoother/SmootherGive/matrixStencil.inl index 3f7a3d36..78988c52 100644 --- a/include/Smoother/SmootherGive/matrixStencil.inl +++ b/include/Smoother/SmootherGive/matrixStencil.inl @@ -41,7 +41,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const boo return DirBC_Interior ? stencil_DB : circle_stencil_across_origin; } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. diff --git a/include/Smoother/SmootherGive/smootherGive.h b/include/Smoother/SmootherGive/smootherGive.h index 64c89174..9d3a7aa5 100644 --- a/include/Smoother/SmootherGive/smootherGive.h +++ b/include/Smoother/SmootherGive/smootherGive.h @@ -53,7 +53,7 @@ class SmootherGive : public Smoother public: // Constructs the coupled circle-radial smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Performs one full coupled smoothing sweep: diff --git a/include/Smoother/SmootherGive/smootherGive.inl b/include/Smoother/SmootherGive/smootherGive.inl index 9bdb8bfc..17d479ef 100644 --- a/include/Smoother/SmootherGive/smootherGive.inl +++ b/include/Smoother/SmootherGive/smootherGive.inl @@ -1,7 +1,7 @@ #pragma once template -SmootherGive::SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, +SmootherGive::SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : Smoother(grid, level_cache, DirBC_Interior, num_omp_threads) , circle_tridiagonal_solver_(grid.ntheta(), grid.numberSmootherCircles(), true) diff --git a/include/Smoother/SmootherGive/solveAscSystem.inl b/include/Smoother/SmootherGive/solveAscSystem.inl index d0790bdb..176b4cc5 100644 --- a/include/Smoother/SmootherGive/solveAscSystem.inl +++ b/include/Smoother/SmootherGive/solveAscSystem.inl @@ -3,7 +3,7 @@ template void SmootherGive::solveBlackCircleSection(HostVector x, HostVector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; const int start = 0; @@ -44,7 +44,7 @@ void SmootherGive::solveBlackCircleSection(HostVector x, template void SmootherGive::solveWhiteCircleSection(HostVector x, HostVector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; const int start = 0; @@ -85,7 +85,7 @@ void SmootherGive::solveWhiteCircleSection(HostVector x, template void SmootherGive::solveBlackRadialSection(HostVector x, HostVector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; const int start = grid.numberCircularSmootherNodes(); @@ -119,7 +119,7 @@ void SmootherGive::solveBlackRadialSection(HostVector x, template void SmootherGive::solveWhiteRadialSection(HostVector x, HostVector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; const int start = grid.numberCircularSmootherNodes(); diff --git a/include/Smoother/SmootherTake/applyAscOrtho.inl b/include/Smoother/SmootherTake/applyAscOrtho.inl index d70542cd..e91ff5e8 100644 --- a/include/Smoother/SmootherTake/applyAscOrtho.inl +++ b/include/Smoother/SmootherTake/applyAscOrtho.inl @@ -4,7 +4,7 @@ namespace smoother_take { static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, +nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result, HostConstVector& arr, HostConstVector& att, HostConstVector& art, HostConstVector& detDF, HostConstVector& coeff_beta) @@ -56,7 +56,7 @@ nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& g } static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, +nodeApplyAscOrthoRadialTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, HostVector& result, HostConstVector& arr, const HostConstVector& att, HostConstVector& art, const HostConstVector& detDF, @@ -123,7 +123,7 @@ void SmootherTake::applyAscOrthoBlackCircleSection(HostConstVect { using smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -162,7 +162,7 @@ void SmootherTake::applyAscOrthoWhiteCircleSection(HostConstVect { using smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -201,7 +201,7 @@ void SmootherTake::applyAscOrthoBlackRadialSection(HostConstVect { using smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -240,7 +240,7 @@ void SmootherTake::applyAscOrthoWhiteRadialSection(HostConstVect { using smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; diff --git a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl index a7ed77d7..d86be0c7 100644 --- a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl @@ -28,7 +28,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& m template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, bool DirBC_Interior, +nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, bool DirBC_Interior, const InnerBoundaryMatrix& matrix, HostConstVector& arr, HostConstVector& att, HostConstVector& art, HostConstVector& detDF, HostConstVector& coeff_beta) @@ -146,7 +146,7 @@ SmootherTake::buildInteriorBoundarySolverMatrix() using smoother_take::getNonZeroCountCircleAsc; using smoother_take::nodeBuildInteriorBoundarySolverMatrix; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; const int num_omp_threads = Smoother::num_omp_threads_; diff --git a/include/Smoother/SmootherTake/buildTridiagonalAsc.inl b/include/Smoother/SmootherTake/buildTridiagonalAsc.inl index 02fe8020..a39f4e06 100644 --- a/include/Smoother/SmootherTake/buildTridiagonalAsc.inl +++ b/include/Smoother/SmootherTake/buildTridiagonalAsc.inl @@ -15,7 +15,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS } static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatrices(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, +nodeBuildTridiagonalSolverMatrices(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver, HostConstVector& arr, HostConstVector& att, @@ -190,7 +190,7 @@ void SmootherTake::buildTridiagonalSolverMatrices() { using smoother_take::nodeBuildTridiagonalSolverMatrices; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; diff --git a/include/Smoother/SmootherTake/matrixStencil.inl b/include/Smoother/SmootherTake/matrixStencil.inl index eba7692f..98400cde 100644 --- a/include/Smoother/SmootherTake/matrixStencil.inl +++ b/include/Smoother/SmootherTake/matrixStencil.inl @@ -41,7 +41,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const boo return DirBC_Interior ? stencil_DB : circle_stencil_across_origin; } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. diff --git a/include/Smoother/SmootherTake/smootherTake.h b/include/Smoother/SmootherTake/smootherTake.h index 2ae0c358..002d5d93 100644 --- a/include/Smoother/SmootherTake/smootherTake.h +++ b/include/Smoother/SmootherTake/smootherTake.h @@ -53,7 +53,7 @@ class SmootherTake : public Smoother public: // Constructs the coupled circle-radial smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); KOKKOS_DEFAULTED_FUNCTION SmootherTake(const SmootherTake&) = default; diff --git a/include/Smoother/SmootherTake/smootherTake.inl b/include/Smoother/SmootherTake/smootherTake.inl index a4625721..c237645e 100644 --- a/include/Smoother/SmootherTake/smootherTake.inl +++ b/include/Smoother/SmootherTake/smootherTake.inl @@ -1,7 +1,7 @@ #pragma once template -SmootherTake::SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, +SmootherTake::SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : Smoother(grid, level_cache, DirBC_Interior, num_omp_threads) , circle_tridiagonal_solver_(grid.ntheta(), grid.numberSmootherCircles(), true) diff --git a/include/Smoother/SmootherTake/solveAscSystem.inl b/include/Smoother/SmootherTake/solveAscSystem.inl index dda3566a..2117044a 100644 --- a/include/Smoother/SmootherTake/solveAscSystem.inl +++ b/include/Smoother/SmootherTake/solveAscSystem.inl @@ -3,7 +3,7 @@ template void SmootherTake::solveBlackCircleSection(HostVector x, HostVector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; int start = 0; @@ -44,7 +44,7 @@ void SmootherTake::solveBlackCircleSection(HostVector x, template void SmootherTake::solveWhiteCircleSection(HostVector x, HostVector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; int start = 0; @@ -85,7 +85,7 @@ void SmootherTake::solveWhiteCircleSection(HostVector x, template void SmootherTake::solveBlackRadialSection(HostVector x, HostVector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; int start = grid.numberCircularSmootherNodes(); @@ -119,7 +119,7 @@ void SmootherTake::solveBlackRadialSection(HostVector x, template void SmootherTake::solveWhiteRadialSection(HostVector x, HostVector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; int start = grid.numberCircularSmootherNodes(); diff --git a/include/Smoother/smoother.h b/include/Smoother/smoother.h index 1b581594..b1f0cfe0 100644 --- a/include/Smoother/smoother.h +++ b/include/Smoother/smoother.h @@ -27,7 +27,7 @@ template class Smoother { public: - explicit Smoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit Smoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : grid_(grid) , level_cache_(level_cache) @@ -41,7 +41,7 @@ class Smoother virtual void smoothing(HostVector x, HostConstVector rhs, HostVector temp) = 0; protected: - const PolarGrid grid_; + const PolarGrid grid_; const LevelCacheType level_cache_; const bool DirBC_Interior_; const int num_omp_threads_; diff --git a/src/ConfigParser/config_parser.cpp b/src/ConfigParser/config_parser.cpp index d9739af0..f9fdfba9 100644 --- a/src/ConfigParser/config_parser.cpp +++ b/src/ConfigParser/config_parser.cpp @@ -224,10 +224,10 @@ bool ConfigParser::parse(int argc, char* argv[]) throw std::runtime_error("Invalid beta coefficient."); } - // Construct PolarGrid + // Construct PolarGrid double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; - grid_ = PolarGrid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + grid_ = PolarGrid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); selectTestCase(geometry_type, problem_type, alpha_type, beta_type, Rmax, kappa_eps, delta_e, alpha_jump); @@ -306,7 +306,7 @@ bool ConfigParser::parse(int argc, char* argv[]) } std::cout << "------------------------------\n"; - std::cout << "---- PolarGrid Generation ----\n"; + std::cout << "---- PolarGrid Generation ----\n"; std::cout << "------------------------------\n"; std::cout << "nr_exp = " << nr_exp << ", nθ_exp = " << ntheta_exp << "\n"; std::cout << "divideBy2 = " << divideBy2 << ", anisotropy = " << anisotropic_factor << "\n"; @@ -348,7 +348,7 @@ bool ConfigParser::cacheDomainGeometry() const return cache_domain_geometry_; } -const PolarGrid& ConfigParser::grid() const +const PolarGrid& ConfigParser::grid() const { return grid_; } diff --git a/src/ConfigParser/select_test_case.cpp b/src/ConfigParser/select_test_case.cpp index cf12c897..5a5983c9 100644 --- a/src/ConfigParser/select_test_case.cpp +++ b/src/ConfigParser/select_test_case.cpp @@ -6,7 +6,7 @@ std::unique_ptr ConfigParser::solver() const { // Create local aliases so the class doesn't need to be captured by the lamda // These are references, not copies. - const PolarGrid& grid = grid_; + const PolarGrid& grid = grid_; // Create a solver specialized to the active domain geometry. return std::visit( diff --git a/src/GMGPolar/gmgpolar.cpp b/src/GMGPolar/gmgpolar.cpp index ebeaedb2..93990acb 100644 --- a/src/GMGPolar/gmgpolar.cpp +++ b/src/GMGPolar/gmgpolar.cpp @@ -4,7 +4,7 @@ using namespace gmgpolar; /* ---------------------------------------------------------------------- */ /* Constructor & Initialization */ /* ---------------------------------------------------------------------- */ -IGMGPolar::IGMGPolar(const PolarGrid& grid) +IGMGPolar::IGMGPolar(const PolarGrid& grid) : grid_(grid) // General solver output and visualization settings , verbose_(0) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp index 18ecf537..bdf54117 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_Poisson_CircularGeometry::CartesianR2_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR2_Poisson_CircularGeometry::CartesianR2_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp index 68056746..5c126e7a 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR2_Poisson_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_Poisson_CzarnyGeometry::CartesianR2_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_Poisson_CzarnyGeometry::CartesianR2_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.cpp index fb9ea5ed..d5074e51 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_Poisson_ShafranovGeometry::CartesianR2_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_Poisson_ShafranovGeometry::CartesianR2_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.cpp index 1e503549..c4341d4c 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_SonnendruckerGyro_CircularGeometry::CartesianR2_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, +CartesianR2_SonnendruckerGyro_CircularGeometry::CartesianR2_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.cpp index 2c944f3e..775a4b9e 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.cpp @@ -7,7 +7,7 @@ void CartesianR2_SonnendruckerGyro_CzarnyGeometry::initializeGeometry() } CartesianR2_SonnendruckerGyro_CzarnyGeometry::CartesianR2_SonnendruckerGyro_CzarnyGeometry( - PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) + PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.cpp index 5e07d900..d056302f 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_ShafranovGeometry.cpp @@ -2,7 +2,7 @@ using namespace gmgpolar; CartesianR2_SonnendruckerGyro_ShafranovGeometry::CartesianR2_SonnendruckerGyro_ShafranovGeometry( - PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.cpp index f62c0366..9df7c281 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_Sonnendrucker_CircularGeometry::CartesianR2_Sonnendrucker_CircularGeometry(PolarGrid const& grid, +CartesianR2_Sonnendrucker_CircularGeometry::CartesianR2_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.cpp index a163fc2f..f1b82bda 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR2_Sonnendrucker_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_Sonnendrucker_CzarnyGeometry::CartesianR2_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_Sonnendrucker_CzarnyGeometry::CartesianR2_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.cpp index 69f7f670..37874049 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_Sonnendrucker_ShafranovGeometry::CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, +CartesianR2_Sonnendrucker_ShafranovGeometry::CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.cpp index c642b64b..184e5211 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniGyro_CircularGeometry::CartesianR2_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR2_ZoniGyro_CircularGeometry::CartesianR2_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.cpp index 11816c86..6e5bcdb0 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR2_ZoniGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_ZoniGyro_CzarnyGeometry::CartesianR2_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_ZoniGyro_CzarnyGeometry::CartesianR2_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.cpp index e0853383..2a8b4d93 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniGyro_ShafranovGeometry::CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_ZoniGyro_ShafranovGeometry::CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp index d78f453a..1845e95c 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniShiftedGyro_CircularGeometry::CartesianR2_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, +CartesianR2_ZoniShiftedGyro_CircularGeometry::CartesianR2_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.cpp index 417e2c90..794a4003 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.cpp @@ -7,7 +7,7 @@ void CartesianR2_ZoniShiftedGyro_CzarnyGeometry::initializeGeometry() } CartesianR2_ZoniShiftedGyro_CzarnyGeometry::CartesianR2_ZoniShiftedGyro_CzarnyGeometry( - PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) + PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp index c38ba92c..442e7a49 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniShiftedGyro_ShafranovGeometry::CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, +CartesianR2_ZoniShiftedGyro_ShafranovGeometry::CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.cpp index 4c11bafb..1cf9c090 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniShifted_CircularGeometry::CartesianR2_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR2_ZoniShifted_CircularGeometry::CartesianR2_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.cpp index 7609921a..f1e5d6dd 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR2_ZoniShifted_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_ZoniShifted_CzarnyGeometry::CartesianR2_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_ZoniShifted_CzarnyGeometry::CartesianR2_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.cpp index 2a276afc..0780e44b 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniShifted_ShafranovGeometry::CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_ZoniShifted_ShafranovGeometry::CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.cpp index 7d2e0fc0..2ed7ea6b 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_Zoni_CircularGeometry::CartesianR2_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR2_Zoni_CircularGeometry::CartesianR2_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.cpp index c2695e82..8dd52b66 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR2_Zoni_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_Zoni_CzarnyGeometry::CartesianR2_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_Zoni_CzarnyGeometry::CartesianR2_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.cpp index c6963ac1..51f9a9d6 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_Zoni_ShafranovGeometry::CartesianR2_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_Zoni_ShafranovGeometry::CartesianR2_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.cpp index 6e1dc04c..a3931bee 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_Poisson_CircularGeometry::CartesianR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR6_Poisson_CircularGeometry::CartesianR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.cpp index 2880819b..8f5d1e0a 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR6_Poisson_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_Poisson_CzarnyGeometry::CartesianR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_Poisson_CzarnyGeometry::CartesianR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.cpp index 29122364..48ca2fef 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_Poisson_ShafranovGeometry::CartesianR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_Poisson_ShafranovGeometry::CartesianR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.cpp index 4fdea456..260dafd2 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_SonnendruckerGyro_CircularGeometry::CartesianR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, +CartesianR6_SonnendruckerGyro_CircularGeometry::CartesianR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.cpp index bf6dd431..1bfbf0f2 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.cpp @@ -7,7 +7,7 @@ void CartesianR6_SonnendruckerGyro_CzarnyGeometry::initializeGeometry() } CartesianR6_SonnendruckerGyro_CzarnyGeometry::CartesianR6_SonnendruckerGyro_CzarnyGeometry( - PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) + PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.cpp index 002eac6a..b1b3c23c 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_ShafranovGeometry.cpp @@ -2,7 +2,7 @@ using namespace gmgpolar; CartesianR6_SonnendruckerGyro_ShafranovGeometry::CartesianR6_SonnendruckerGyro_ShafranovGeometry( - PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.cpp index 9f5745cc..930facbf 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_Sonnendrucker_CircularGeometry::CartesianR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, +CartesianR6_Sonnendrucker_CircularGeometry::CartesianR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.cpp index f287bbfe..53835eea 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR6_Sonnendrucker_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_Sonnendrucker_CzarnyGeometry::CartesianR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_Sonnendrucker_CzarnyGeometry::CartesianR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.cpp index d88a2d92..deae4808 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_Sonnendrucker_ShafranovGeometry::CartesianR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, +CartesianR6_Sonnendrucker_ShafranovGeometry::CartesianR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.cpp index f1778de2..7b99678d 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniGyro_CircularGeometry::CartesianR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR6_ZoniGyro_CircularGeometry::CartesianR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.cpp index 99d944d8..49dd6fb0 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR6_ZoniGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_ZoniGyro_CzarnyGeometry::CartesianR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_ZoniGyro_CzarnyGeometry::CartesianR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.cpp index 15c54a25..0b63abdf 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniGyro_ShafranovGeometry::CartesianR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_ZoniGyro_ShafranovGeometry::CartesianR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp index 5968c441..145c5eb2 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniShiftedGyro_CircularGeometry::CartesianR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, +CartesianR6_ZoniShiftedGyro_CircularGeometry::CartesianR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.cpp index 11c4d5b1..229ee967 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.cpp @@ -7,7 +7,7 @@ void CartesianR6_ZoniShiftedGyro_CzarnyGeometry::initializeGeometry() } CartesianR6_ZoniShiftedGyro_CzarnyGeometry::CartesianR6_ZoniShiftedGyro_CzarnyGeometry( - PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) + PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp index 32a678dd..8f2f4c32 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniShiftedGyro_ShafranovGeometry::CartesianR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, +CartesianR6_ZoniShiftedGyro_ShafranovGeometry::CartesianR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.cpp index 13039c04..119bd452 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniShifted_CircularGeometry::CartesianR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR6_ZoniShifted_CircularGeometry::CartesianR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.cpp index 89a73c06..89d4a7b6 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR6_ZoniShifted_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_ZoniShifted_CzarnyGeometry::CartesianR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_ZoniShifted_CzarnyGeometry::CartesianR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.cpp index 9d6cd55b..ce61ae04 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniShifted_ShafranovGeometry::CartesianR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_ZoniShifted_ShafranovGeometry::CartesianR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.cpp index d726167d..9928706b 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_Zoni_CircularGeometry::CartesianR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR6_Zoni_CircularGeometry::CartesianR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.cpp index 20d398d6..5dea2418 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void CartesianR6_Zoni_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_Zoni_CzarnyGeometry::CartesianR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_Zoni_CzarnyGeometry::CartesianR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.cpp index bd532b0d..2931e8f9 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_Zoni_ShafranovGeometry::CartesianR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_Zoni_ShafranovGeometry::CartesianR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp index c85512e5..b54c8901 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.h" using namespace gmgpolar; -PolarR6_Poisson_CircularGeometry::PolarR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_Poisson_CircularGeometry::PolarR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.cpp index 2593536b..342cb5db 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void PolarR6_Poisson_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_Poisson_CzarnyGeometry::PolarR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_Poisson_CzarnyGeometry::PolarR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.cpp index 8efb94fe..b2bfc552 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_Poisson_ShafranovGeometry::PolarR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, +PolarR6_Poisson_ShafranovGeometry::PolarR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.cpp index 32fd76cc..cc85e161 100644 --- a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.h" using namespace gmgpolar; -PolarR6_SonnendruckerGyro_CircularGeometry::PolarR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, +PolarR6_SonnendruckerGyro_CircularGeometry::PolarR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.cpp index 3e269be5..2999023d 100644 --- a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void PolarR6_SonnendruckerGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_SonnendruckerGyro_CzarnyGeometry::PolarR6_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_SonnendruckerGyro_CzarnyGeometry::PolarR6_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.cpp index 91f4db77..4bcaa16b 100644 --- a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_SonnendruckerGyro_ShafranovGeometry::PolarR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, +PolarR6_SonnendruckerGyro_ShafranovGeometry::PolarR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) diff --git a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp index cfce97c3..f5176c97 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.h" using namespace gmgpolar; -PolarR6_Sonnendrucker_CircularGeometry::PolarR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_Sonnendrucker_CircularGeometry::PolarR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.cpp index a8bdd7fb..2f29c5b6 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void PolarR6_Sonnendrucker_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_Sonnendrucker_CzarnyGeometry::PolarR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_Sonnendrucker_CzarnyGeometry::PolarR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.cpp index 79447786..65aa9922 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_Sonnendrucker_ShafranovGeometry::PolarR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, +PolarR6_Sonnendrucker_ShafranovGeometry::PolarR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp index 7f6a521c..230eef20 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.h" using namespace gmgpolar; -PolarR6_ZoniGyro_CircularGeometry::PolarR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_ZoniGyro_CircularGeometry::PolarR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.cpp index 944a1e07..c7ec3ca3 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void PolarR6_ZoniGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_ZoniGyro_CzarnyGeometry::PolarR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_ZoniGyro_CzarnyGeometry::PolarR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.cpp index 184856ef..8e45d6b1 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_ZoniGyro_ShafranovGeometry::PolarR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, +PolarR6_ZoniGyro_ShafranovGeometry::PolarR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp index 03852ee4..e730fe04 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShiftedGyro_CircularGeometry::PolarR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_ZoniShiftedGyro_CircularGeometry::PolarR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp index 0b734bc8..086bbc66 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShiftedGyro_CulhamGeometry::PolarR6_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax) +PolarR6_ZoniShiftedGyro_CulhamGeometry::PolarR6_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp index c8234684..7d8d1e72 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void PolarR6_ZoniShiftedGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_ZoniShiftedGyro_CzarnyGeometry::PolarR6_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_ZoniShiftedGyro_CzarnyGeometry::PolarR6_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp index 1d17147c..aef66a7a 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShiftedGyro_ShafranovGeometry::PolarR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, +PolarR6_ZoniShiftedGyro_ShafranovGeometry::PolarR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp index 76732c68..75369664 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShifted_CircularGeometry::PolarR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_ZoniShifted_CircularGeometry::PolarR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.cpp index 2cf4e802..3925e3f6 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void PolarR6_ZoniShifted_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_ZoniShifted_CzarnyGeometry::PolarR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_ZoniShifted_CzarnyGeometry::PolarR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.cpp index 4f578832..e30094b0 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShifted_ShafranovGeometry::PolarR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, +PolarR6_ZoniShifted_ShafranovGeometry::PolarR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.cpp index 6ba73527..2729ebe7 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.h" using namespace gmgpolar; -PolarR6_Zoni_CircularGeometry::PolarR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_Zoni_CircularGeometry::PolarR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.cpp index 6a768a03..670a1060 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void PolarR6_Zoni_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_Zoni_CzarnyGeometry::PolarR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_Zoni_CzarnyGeometry::PolarR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.cpp index f886ec01..13fae9ca 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_Zoni_ShafranovGeometry::PolarR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, +PolarR6_Zoni_ShafranovGeometry::PolarR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.cpp index a5446f84..e718f6e5 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.h" using namespace gmgpolar; -Refined_ZoniShiftedGyro_CircularGeometry::Refined_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +Refined_ZoniShiftedGyro_CircularGeometry::Refined_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp index 41933510..f6e2df4c 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.h" using namespace gmgpolar; -Refined_ZoniShiftedGyro_CulhamGeometry::Refined_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax) +Refined_ZoniShiftedGyro_CulhamGeometry::Refined_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.cpp index 1b99baa9..7710e649 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.cpp @@ -6,7 +6,7 @@ void Refined_ZoniShiftedGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -Refined_ZoniShiftedGyro_CzarnyGeometry::Refined_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +Refined_ZoniShiftedGyro_CzarnyGeometry::Refined_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.cpp index a87fea3b..bd413f31 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.cpp @@ -1,7 +1,7 @@ #include "../include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h" using namespace gmgpolar; -Refined_ZoniShiftedGyro_ShafranovGeometry::Refined_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, +Refined_ZoniShiftedGyro_ShafranovGeometry::Refined_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) diff --git a/src/Interpolation/extrapolated_prolongation.cpp b/src/Interpolation/extrapolated_prolongation.cpp index 9bc5ac8b..e05c8c2e 100644 --- a/src/Interpolation/extrapolated_prolongation.cpp +++ b/src/Interpolation/extrapolated_prolongation.cpp @@ -48,8 +48,8 @@ using namespace gmgpolar; */ static KOKKOS_INLINE_FUNCTION void fineNodeExtrapolatedProlongation(const int i_r, const int i_theta, - const PolarGrid& coarse_grid, - const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector& fine_result, HostConstVector& coarse_values) { @@ -85,7 +85,7 @@ static KOKKOS_INLINE_FUNCTION void fineNodeExtrapolatedProlongation(const int i_ } } -void Interpolation::applyExtrapolatedProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, +void Interpolation::applyExtrapolatedProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const { diff --git a/src/Interpolation/extrapolated_restriction.cpp b/src/Interpolation/extrapolated_restriction.cpp index d0e444ba..7e9e506b 100644 --- a/src/Interpolation/extrapolated_restriction.cpp +++ b/src/Interpolation/extrapolated_restriction.cpp @@ -23,8 +23,8 @@ using namespace gmgpolar; */ static KOKKOS_INLINE_FUNCTION void coarseNodeExtrapolatedRestriction(const int i_r_coarse, const int i_theta_coarse, - const PolarGrid& fine_grid, - const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, HostVector& coarse_result, HostConstVector& fine_values) { @@ -50,7 +50,7 @@ static KOKKOS_INLINE_FUNCTION void coarseNodeExtrapolatedRestriction(const int i coarse_result[coarse_grid.index(i_r_coarse, i_theta_coarse)] = value; } -void Interpolation::applyExtrapolatedRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, +void Interpolation::applyExtrapolatedRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, HostConstVector fine_values) const { diff --git a/src/Interpolation/fmg_interpolation.cpp b/src/Interpolation/fmg_interpolation.cpp index 2a8ec980..e29b7cd8 100644 --- a/src/Interpolation/fmg_interpolation.cpp +++ b/src/Interpolation/fmg_interpolation.cpp @@ -58,7 +58,7 @@ using namespace gmgpolar; */ static KOKKOS_INLINE_FUNCTION void fineNodeFMGInterpolation(const int i_r, const int i_theta, - const PolarGrid& coarse_grid, const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector& fine_result, HostConstVector& coarse_values) { @@ -226,7 +226,7 @@ static KOKKOS_INLINE_FUNCTION void fineNodeFMGInterpolation(const int i_r, const } } -void Interpolation::applyFMGInterpolation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, +void Interpolation::applyFMGInterpolation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const { assert(std::ssize(coarse_values) == coarse_grid.numberOfNodes()); diff --git a/src/Interpolation/injection.cpp b/src/Interpolation/injection.cpp index 5c9cb48d..c0ffc728 100644 --- a/src/Interpolation/injection.cpp +++ b/src/Interpolation/injection.cpp @@ -4,7 +4,7 @@ using namespace gmgpolar; /* Remark: This injection is not scaled. */ static KOKKOS_INLINE_FUNCTION void coarseNodeInjection(const int i_r_coarse, const int i_theta_coarse, - const PolarGrid& fine_grid, const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector& coarse_result, HostConstVector& fine_values) { @@ -17,7 +17,7 @@ static KOKKOS_INLINE_FUNCTION void coarseNodeInjection(const int i_r_coarse, con coarse_result[coarse_index] = fine_values[fine_index]; } -void Interpolation::applyInjection(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, +void Interpolation::applyInjection(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, HostConstVector fine_values) const { assert(std::ssize(fine_values) == fine_grid.numberOfNodes()); diff --git a/src/Interpolation/prolongation.cpp b/src/Interpolation/prolongation.cpp index f19aa942..f59450bb 100644 --- a/src/Interpolation/prolongation.cpp +++ b/src/Interpolation/prolongation.cpp @@ -52,8 +52,8 @@ using namespace gmgpolar; * - k1, k2 in angular direction */ -static KOKKOS_INLINE_FUNCTION void fineNodeProlongation(const int i_r, const int i_theta, const PolarGrid& coarse_grid, - const PolarGrid& fine_grid, HostVector& fine_result, +static KOKKOS_INLINE_FUNCTION void fineNodeProlongation(const int i_r, const int i_theta, const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector& fine_result, HostConstVector& coarse_values) { const int i_r_coarse = i_r / 2; @@ -107,7 +107,7 @@ static KOKKOS_INLINE_FUNCTION void fineNodeProlongation(const int i_r, const int } } -void Interpolation::applyProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, +void Interpolation::applyProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const { assert(std::ssize(coarse_values) == coarse_grid.numberOfNodes()); diff --git a/src/Interpolation/restriction.cpp b/src/Interpolation/restriction.cpp index 7423a932..66a2c5ea 100644 --- a/src/Interpolation/restriction.cpp +++ b/src/Interpolation/restriction.cpp @@ -24,7 +24,7 @@ using namespace gmgpolar; */ static KOKKOS_INLINE_FUNCTION void coarseNodeRestriction(const int i_r_coarse, const int i_theta_coarse, - const PolarGrid& fine_grid, const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector& coarse_result, HostConstVector& fine_values) { @@ -68,7 +68,7 @@ static KOKKOS_INLINE_FUNCTION void coarseNodeRestriction(const int i_r_coarse, c coarse_result[coarse_grid.index(i_r_coarse, i_theta_coarse)] = value; } -void Interpolation::applyRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, +void Interpolation::applyRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, HostConstVector fine_values) const { assert(std::ssize(fine_values) == fine_grid.numberOfNodes()); diff --git a/src/convergence_order.cpp b/src/convergence_order.cpp index b1d18fa9..da0f04f9 100644 --- a/src/convergence_order.cpp +++ b/src/convergence_order.cpp @@ -88,7 +88,7 @@ int main(int argc, char* argv[]) for (divideBy2 = 0; divideBy2 < MAX_DIVIDE_BY_2; divideBy2++) { double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; - PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, + PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); GMGPolar solver(grid, domain_geometry, coefficients); diff --git a/src/main.cpp b/src/main.cpp index 86fa0d51..55c9999b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -76,7 +76,7 @@ int main(int argc, char* argv[]) // --- Retrieve solution and associated grid --- // HostVector solution = solver.solution(); - const PolarGrid& grid = solver.grid(); + const PolarGrid& grid = solver.grid(); // Print timing statistics for each solver phase solver.printTimings(); diff --git a/src/strong_scaling.cpp b/src/strong_scaling.cpp index 881dd5e0..c52b515a 100644 --- a/src/strong_scaling.cpp +++ b/src/strong_scaling.cpp @@ -87,7 +87,7 @@ void runTest(int maxOpenMPThreads, int divideBy2, std::ofstream& outfile) double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; - PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); GMGPolar solver(grid, domain_geometry, coefficients); // PolarR6_ZoniGyro_ShafranovGeometry source_term(grid, Rmax, elongation_kappa, shift_delta); diff --git a/src/weak_scaling.cpp b/src/weak_scaling.cpp index 3228c1a5..078880cc 100644 --- a/src/weak_scaling.cpp +++ b/src/weak_scaling.cpp @@ -86,7 +86,7 @@ void runTest(int maxOpenMPThreads, int divideBy2, std::ofstream& outfile) double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; - PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); GMGPolar solver(grid, domain_geometry, coefficients); // PolarR6_ZoniGyro_ShafranovGeometry source_term(grid, Rmax, elongation_kappa, shift_delta); diff --git a/tests/ConfigParser/config_parser.cpp b/tests/ConfigParser/config_parser.cpp index 70cd4ed6..5ec61d7c 100644 --- a/tests/ConfigParser/config_parser.cpp +++ b/tests/ConfigParser/config_parser.cpp @@ -173,7 +173,7 @@ TEST_P(ConfigParserTest, ParseAllGeometryAndProblemCombinations) EXPECT_EQ(parser.cacheDomainGeometry(), cacheDomainGeometry); // Grid - const PolarGrid& grid = parser.grid(); + const PolarGrid& grid = parser.grid(); EXPECT_NE(&grid, nullptr); EXPECT_DOUBLE_EQ(grid.radius(0), R0); EXPECT_DOUBLE_EQ(grid.radius(grid.nr() - 1), Rmax); diff --git a/tests/DirectSolver/directSolver.cpp b/tests/DirectSolver/directSolver.cpp index c002dd13..084ca0db 100644 --- a/tests/DirectSolver/directSolver.cpp +++ b/tests/DirectSolver/directSolver.cpp @@ -63,7 +63,7 @@ TEST(DirectSolverTest, directSolver_DirBC_Interior) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -113,7 +113,7 @@ TEST(DirectSolverTest, directSolver_AcrossOrigin) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -165,7 +165,7 @@ TEST(DirectSolverTest_CircularGeometry, SequentialDirectSolverDirBC_Interior_Cir bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -207,7 +207,7 @@ TEST(DirectSolverTest_CircularGeometry, ParallelDirectSolverDirBC_Interior_Circu bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -249,7 +249,7 @@ TEST(DirectSolverTest_CircularGeometry, SequentialDirectSolverAcrossOrigin_Circu bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -291,7 +291,7 @@ TEST(DirectSolverTest_CircularGeometry, ParallelDirectSolverAcrossOrigin_Circula bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -339,7 +339,7 @@ TEST(DirectSolverTest_ShafranovGeometry, DirectSolverDirBC_Interior_ShafranovGeo bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -383,7 +383,7 @@ TEST(DirectSolverTest_ShafranovGeometry, DirectSolverAcrossOrigin_ShafranovGeome bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -431,7 +431,7 @@ TEST(DirectSolverTest_CzarnyGeometry, DirectSolverDirBC_Interior_CzarnyGeometry) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -475,7 +475,7 @@ TEST(DirectSolverTest_CzarnyGeometry, DirectSolverAcrossOrigin_CzarnyGeometry) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -521,7 +521,7 @@ TEST(DirectSolverTest_CulhamGeometry, DirectSolverDirBC_Interior_CulhamGeometry) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -563,7 +563,7 @@ TEST(DirectSolverTest_CulhamGeometry, DirectSolverAcrossOrigin_CulhamGeometry) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -585,7 +585,7 @@ TEST(DirectSolverTest_CulhamGeometry, DirectSolverAcrossOrigin_CulhamGeometry) ASSERT_NEAR(infinity_norm(HostConstVector(residuum)), 0.0, 1e-8); } -/* We adjust the PolarGrid to increase the precision */ +/* We adjust the PolarGrid to increase the precision */ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecision_CircularGeometry) { @@ -617,7 +617,7 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecision_ bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -659,7 +659,7 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecision2 bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = false; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -702,7 +702,7 @@ TEST(DirectSolverTakeTest_CircularGeometry, SequentialDirectSolverDirBC_Interior bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -744,7 +744,7 @@ TEST(DirectSolverTakeTest_CircularGeometry, ParallelDirectSolverDirBC_Interior_C bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -786,7 +786,7 @@ TEST(DirectSolverTakeTest_CircularGeometry, SequentialDirectSolverAcrossOrigin_C bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -828,7 +828,7 @@ TEST(DirectSolverTakeTest_CircularGeometry, ParallelDirectSolverAcrossOrigin_Cir bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -876,7 +876,7 @@ TEST(DirectSolverTakeTest_ShafranovGeometry, DirectSolverDirBC_Interior_Shafrano bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -920,7 +920,7 @@ TEST(DirectSolverTakeTest_ShafranovGeometry, DirectSolverAcrossOrigin_ShafranovG bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -968,7 +968,7 @@ TEST(DirectSolverTakeTest_CzarnyGeometry, DirectSolverDirBC_Interior_CzarnyGeome bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -1012,7 +1012,7 @@ TEST(DirectSolverTakeTest_CzarnyGeometry, DirectSolverAcrossOrigin_CzarnyGeometr bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -1058,7 +1058,7 @@ TEST(DirectSolverTakeTest_CulhamGeometry, DirectSolverDirBC_Interior_CulhamGeome bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -1100,7 +1100,7 @@ TEST(DirectSolverTakeTest_CulhamGeometry, DirectSolverAcrossOrigin_CulhamGeometr bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -1152,7 +1152,7 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecis bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -1194,7 +1194,7 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOriginHigherPrecis bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), diff --git a/tests/ExtrapolatedSmoother/extrapolated_smoother.cpp b/tests/ExtrapolatedSmoother/extrapolated_smoother.cpp index 169f3089..bafa9eb3 100644 --- a/tests/ExtrapolatedSmoother/extrapolated_smoother.cpp +++ b/tests/ExtrapolatedSmoother/extrapolated_smoother.cpp @@ -41,7 +41,7 @@ TEST(ExtrapolatedSmootherTest, extrapolatedSmoother_DirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -99,7 +99,7 @@ TEST(ExtrapolatedSmootherTest, extrapolatedSmoother_AcossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -159,7 +159,7 @@ TEST(ExtrapolatedSmootherTest, SequentialExtrapolatedSmootherDirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -240,7 +240,7 @@ TEST(ExtrapolatedSmootherTest, ParallelExtrapolatedSmootherDirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -321,7 +321,7 @@ TEST(ExtrapolatedSmootherTest, SequentialExtrapolatedSmootherAcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -404,7 +404,7 @@ TEST(ExtrapolatedSmootherTest, ParallelExtrapolatedSmootherAcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -486,7 +486,7 @@ TEST(ExtrapolatedSmootherTest, SequentialExtrapolatedSmootherDirBC_Interior_Smal using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -568,7 +568,7 @@ TEST(ExtrapolatedSmootherTest, ParallelExtrapolatedSmootherDirBC_Interior_Smalle using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -650,7 +650,7 @@ TEST(ExtrapolatedSmootherTest, SequentialExtrapolatedSmootherAcrossOrigin_Smalle using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -730,7 +730,7 @@ TEST(ExtrapolatedSmootherTest, ParallelExtrapolatedSmootherAcrossOrigin_Smallest using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -813,7 +813,7 @@ TEST(ExtrapolatedSmootherTest, SequentialExtrapolatedSmootherTakeDirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -896,7 +896,7 @@ TEST(ExtrapolatedSmootherTest, ParallelExtrapolatedSmootherTakeDirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -977,7 +977,7 @@ TEST(ExtrapolatedSmootherTest, SequentialExtrapolatedSmootherTakeAcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1058,7 +1058,7 @@ TEST(ExtrapolatedSmootherTest, ParallelExtrapolatedSmootherTakeAcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1138,7 +1138,7 @@ TEST(ExtrapolatedSmootherTest, SequentialExtrapolatedSmootherTakeDirBC_Interior_ using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1218,7 +1218,7 @@ TEST(ExtrapolatedSmootherTest, ParallelExtrapolatedSmootherTakeDirBC_Interior_Sm using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1298,7 +1298,7 @@ TEST(ExtrapolatedSmootherTest, SequentialExtrapolatedSmootherTakeAcrossOrigin_Sm using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1378,7 +1378,7 @@ TEST(ExtrapolatedSmootherTest, ParallelExtrapolatedSmootherTakeAcrossOrigin_Smal using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; diff --git a/tests/GMGPolar/convergence_order.cpp b/tests/GMGPolar/convergence_order.cpp index aed50c1c..025915ba 100644 --- a/tests/GMGPolar/convergence_order.cpp +++ b/tests/GMGPolar/convergence_order.cpp @@ -160,7 +160,7 @@ std::vector refine(std::vector const& original_points) template std::tuple -get_gmgpolar_error(PolarGrid const& grid, CzarnyGeometry const& domain_geometry, +get_gmgpolar_error(PolarGrid const& grid, CzarnyGeometry const& domain_geometry, DensityProfileCoefficients const& coefficients, BoundaryConditions const& boundary_conditions, SourceTerm const& source_term, ExactSolution const& solution, ExtrapolationType extrapolation) { @@ -227,8 +227,8 @@ void test_convergence(double non_uniformity) std::vector radii_refined = refine(radii); std::vector angles_refined = refine(angles); - PolarGrid grid(radii, angles); - PolarGrid grid_refined(radii_refined, angles_refined); + PolarGrid grid(radii, angles); + PolarGrid grid_refined(radii_refined, angles_refined); const double alpha_jump = 0.0; // Unused value typename TestFixture::DensityProfileCoefficients coefficients(Rmax, alpha_jump); diff --git a/tests/GMGPolar/pcg_tests.cpp b/tests/GMGPolar/pcg_tests.cpp index 7fe96b1e..302f1860 100644 --- a/tests/GMGPolar/pcg_tests.cpp +++ b/tests/GMGPolar/pcg_tests.cpp @@ -645,7 +645,7 @@ TYPED_TEST_SUITE(PCGTestCase, gmgpolar_test_suite); template void run_gmgpolar() { - PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, + PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, TestFixture::refinementRadius, TestFixture::anisotropicFactor, TestFixture::divideBy2); const double inverse_aspect_ratio_epsilon = 0.3; @@ -706,7 +706,7 @@ void run_gmgpolar() // --- Retrieve solution and associated grid --- // HostVector solution = solver.solution(); - const PolarGrid& solution_grid = solver.grid(); + const PolarGrid& solution_grid = solver.grid(); if (TestFixture::verbose > 0) { solver.printTimings(); diff --git a/tests/GMGPolar/solve_tests.cpp b/tests/GMGPolar/solve_tests.cpp index 9eab9783..a205e31f 100644 --- a/tests/GMGPolar/solve_tests.cpp +++ b/tests/GMGPolar/solve_tests.cpp @@ -657,7 +657,7 @@ TYPED_TEST_SUITE(GMGPolarTestCase, gmgpolar_test_suite); template void run_gmgpolar() { - PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, + PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, TestFixture::refinementRadius, TestFixture::anisotropicFactor, TestFixture::divideBy2); const double inverse_aspect_ratio_epsilon = 0.3; @@ -712,7 +712,7 @@ void run_gmgpolar() // --- Retrieve solution and associated grid --- // HostVector solution = solver.solution(); - const PolarGrid& solution_grid = solver.grid(); + const PolarGrid& solution_grid = solver.grid(); if (TestFixture::verbose > 0) { solver.printTimings(); diff --git a/tests/Interpolation/extrapolated_prolongation.cpp b/tests/Interpolation/extrapolated_prolongation.cpp index 300153f3..e9327e94 100644 --- a/tests/Interpolation/extrapolated_prolongation.cpp +++ b/tests/Interpolation/extrapolated_prolongation.cpp @@ -9,7 +9,7 @@ using namespace gmgpolar; // Helper that computes the mathematically expected extrapolated prolongation value -static double expected_extrapolated_value(const PolarGrid& coarse, const PolarGrid& fine, +static double expected_extrapolated_value(const PolarGrid& coarse, const PolarGrid& fine, HostConstVector coarse_vals, int i_r, int i_theta) { int i_r_coarse = i_r / 2; @@ -46,8 +46,8 @@ TEST(ExtrapolatedProlongationTest, ExtrapolatedProlongationMatchesStencil) std::vector fine_angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, 2 * M_PI}; - PolarGrid fine_grid(fine_radii, fine_angles); - PolarGrid coarse_grid = coarseningGrid(fine_grid); + PolarGrid fine_grid(fine_radii, fine_angles); + PolarGrid coarse_grid = coarseningGrid(fine_grid); Interpolation I(/*threads*/ 16, /*DirBC*/ true); diff --git a/tests/Interpolation/extrapolated_restriction.cpp b/tests/Interpolation/extrapolated_restriction.cpp index dda7aa1d..173e7031 100644 --- a/tests/Interpolation/extrapolated_restriction.cpp +++ b/tests/Interpolation/extrapolated_restriction.cpp @@ -9,7 +9,7 @@ using namespace gmgpolar; // Helper that computes the mathematically expected extrapolated restriction value -static double expected_extrapolated_restriction_value(const PolarGrid& fine, const PolarGrid& coarse, +static double expected_extrapolated_restriction_value(const PolarGrid& fine, const PolarGrid& coarse, HostConstVector fine_vals, int i_r_coarse, int i_theta_coarse) { @@ -45,8 +45,8 @@ TEST(ExtrapolatedRestrictionTest, ExtrapolatedRestrictionMatchesStencil) std::vector fine_angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, 2 * M_PI}; - PolarGrid fine_grid(fine_radii, fine_angles); - PolarGrid coarse_grid = coarseningGrid(fine_grid); + PolarGrid fine_grid(fine_radii, fine_angles); + PolarGrid coarse_grid = coarseningGrid(fine_grid); Interpolation I(/*threads*/ 16, /*DirBC*/ true); diff --git a/tests/Interpolation/prolongation.cpp b/tests/Interpolation/prolongation.cpp index 15ba5ccd..b1a7f101 100644 --- a/tests/Interpolation/prolongation.cpp +++ b/tests/Interpolation/prolongation.cpp @@ -8,7 +8,7 @@ using namespace gmgpolar; // Helper that computes the mathematically expected prolongation value -static double expected_value(const PolarGrid& coarse, const PolarGrid& fine, HostConstVector coarse_vals, +static double expected_value(const PolarGrid& coarse, const PolarGrid& fine, HostConstVector coarse_vals, int i_r, int i_theta) { int i_r_coarse = i_r / 2; @@ -61,8 +61,8 @@ TEST(ProlongationTest, ProlongationMatchesStencil) std::vector fine_angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, 2 * M_PI}; - PolarGrid fine_grid(fine_radii, fine_angles); - PolarGrid coarse_grid = coarseningGrid(fine_grid); + PolarGrid fine_grid(fine_radii, fine_angles); + PolarGrid coarse_grid = coarseningGrid(fine_grid); Interpolation I(/*threads*/ 16, /*DirBC*/ true); diff --git a/tests/Interpolation/restriction.cpp b/tests/Interpolation/restriction.cpp index 3cf64153..8ed3cdb4 100644 --- a/tests/Interpolation/restriction.cpp +++ b/tests/Interpolation/restriction.cpp @@ -8,7 +8,7 @@ using namespace gmgpolar; // Helper that computes the mathematically expected restriction value -static double expected_restriction_value(const PolarGrid& fine, const PolarGrid& coarse, +static double expected_restriction_value(const PolarGrid& fine, const PolarGrid& coarse, HostConstVector fine_vals, int i_r_coarse, int i_theta_coarse) { int i_r = i_r_coarse * 2; @@ -56,8 +56,8 @@ TEST(RestrictionTest, RestrictionMatchesStencil) std::vector fine_angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, 2 * M_PI}; - PolarGrid fine_grid(fine_radii, fine_angles); - PolarGrid coarse_grid = coarseningGrid(fine_grid); + PolarGrid fine_grid(fine_radii, fine_angles); + PolarGrid coarse_grid = coarseningGrid(fine_grid); Interpolation I(/*threads*/ 16, /*DirBC*/ true); diff --git a/tests/PolarGrid/polargrid.cpp b/tests/PolarGrid/polargrid.cpp index 37819c0f..cdf5b901 100644 --- a/tests/PolarGrid/polargrid.cpp +++ b/tests/PolarGrid/polargrid.cpp @@ -4,21 +4,21 @@ using namespace gmgpolar; TEST(PolarGridTest, DefaultConstructor) { - PolarGrid grid; + PolarGrid grid; } TEST(PolarGridTest, VectorConstructor) { std::vector radii = {0.1, 0.2, 0.5, 0.9, 1.3}; std::vector angles = {0, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; - PolarGrid grid(radii, angles); + PolarGrid grid(radii, angles); } TEST(PolarGridTest, NumberOfNodes) { std::vector radii = {0.1, 0.2, 0.5, 0.9, 1.3}; std::vector angles = {0, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; - PolarGrid grid(radii, angles); + PolarGrid grid(radii, angles); ASSERT_EQ(grid.numberOfNodes(), radii.size() * (angles.size() - 1)); } @@ -26,7 +26,7 @@ TEST(PolarGridTest, AccessorsTest) { std::vector radii = {0.1, 0.2, 0.5, 0.9, 1.3}; std::vector angles = {0, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; - PolarGrid grid(radii, angles); + PolarGrid grid(radii, angles); ASSERT_DOUBLE_EQ(grid.radius(0), 0.1); ASSERT_DOUBLE_EQ(grid.radius(1), 0.2); ASSERT_DOUBLE_EQ(grid.radius(4), 1.3); @@ -40,7 +40,7 @@ TEST(PolarGridTest, GridJumpTest) std::vector radii = {0.1, 0.2, 0.5, 0.9, 1.3}; std::vector angles = {0, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; double splitting_radius = 0.4; - PolarGrid grid(radii, angles, splitting_radius); + PolarGrid grid(radii, angles, splitting_radius); ASSERT_DOUBLE_EQ(grid.radius(0), 0.1); ASSERT_DOUBLE_EQ(grid.radius(1), 0.2); ASSERT_DOUBLE_EQ(grid.radius(4), 1.3); @@ -55,7 +55,7 @@ TEST(PolarGridTest, IndexingTest) std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; double splitting_radius = 0.6; - PolarGrid grid(radii, angles, splitting_radius); + PolarGrid grid(radii, angles, splitting_radius); for (int i = 0; i < grid.nr(); i++) { for (int j = 0; j < grid.ntheta(); j++) { @@ -81,7 +81,7 @@ TEST(PolarGridTest, IndexingValuesTest) std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; double splitting_radius = 0.6; - PolarGrid grid(radii, angles, splitting_radius); + PolarGrid grid(radii, angles, splitting_radius); { int node_index = grid.index(2, 6); @@ -126,7 +126,7 @@ TEST(PolarGridTest, CoordinatesTest) std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; double splitting_radius = 0.6; - PolarGrid grid(radii, angles, splitting_radius); + PolarGrid grid(radii, angles, splitting_radius); ASSERT_DOUBLE_EQ(grid.radius(3), 0.5); ASSERT_DOUBLE_EQ(grid.theta(2), M_PI / 8); @@ -140,7 +140,7 @@ TEST(PolarGridTest, SpacingTest) std::vector radii = {0.1, 0.2, 0.25, 0.5, 0.8, 0.9, 1.3, 1.4, 2.0}; std::vector angles = { 0, M_PI / 16, M_PI / 8, M_PI / 2, M_PI, M_PI + M_PI / 16, M_PI + M_PI / 8, M_PI + M_PI / 2, M_PI + M_PI}; - PolarGrid grid(radii, angles); + PolarGrid grid(radii, angles); // Test radial spacings ASSERT_DOUBLE_EQ(grid.radialSpacing(0), 0.2 - 0.1); diff --git a/tests/Residual/residual.cpp b/tests/Residual/residual.cpp index c7b5399d..798e2dbb 100644 --- a/tests/Residual/residual.cpp +++ b/tests/Residual/residual.cpp @@ -47,7 +47,7 @@ TEST(OperatorATest, applyA_DirBC_Interior) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), @@ -100,7 +100,7 @@ TEST(OperatorATest, applyA_AcrossOrigin) bool cache_density_rpofile_coefficients = true; bool cache_domain_geometry = true; - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); auto levelCache = std::make_unique>( *grid, coefficients, domain_geometry, cache_density_rpofile_coefficients, cache_domain_geometry); Level level(0, std::move(grid), std::move(levelCache), diff --git a/tests/Smoother/smoother.cpp b/tests/Smoother/smoother.cpp index ad0d8b61..d5fce7c7 100644 --- a/tests/Smoother/smoother.cpp +++ b/tests/Smoother/smoother.cpp @@ -40,7 +40,7 @@ TEST(SmootherTest, smoother_DirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -97,7 +97,7 @@ TEST(SmootherTest, smoother_AcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -157,7 +157,7 @@ TEST(SmootherTest, SequentialSmootherDirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -232,7 +232,7 @@ TEST(SmootherTest, ParallelSmootherDirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -307,7 +307,7 @@ TEST(SmootherTest, SequentialSmootherAcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -382,7 +382,7 @@ TEST(SmootherTest, ParallelSmootherAcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -456,7 +456,7 @@ TEST(SmootherTest, SequentialSmootherDirBC_Interior_SmallestGrid) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -530,7 +530,7 @@ TEST(SmootherTest, ParallelSmootherDirBC_Interior_SmallestGrid) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -604,7 +604,7 @@ TEST(SmootherTest, SequentialSmootherAcrossOrigin_SmallestGrid) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -678,7 +678,7 @@ TEST(SmootherTest, ParallelSmootherAcrossOrigin_SmallestGrid) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -755,7 +755,7 @@ TEST(SmootherTest, SequentialSmootherTakeDirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -830,7 +830,7 @@ TEST(SmootherTest, ParallelSmootherTakeDirBC_Interior) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -905,7 +905,7 @@ TEST(SmootherTest, SequentialSmootherTakeAcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -980,7 +980,7 @@ TEST(SmootherTest, ParallelSmootherTakeAcrossOrigin) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1054,7 +1054,7 @@ TEST(SmootherTest, SequentialSmootherTakeDirBC_Interior_SmallestGrid) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1128,7 +1128,7 @@ TEST(SmootherTest, ParallelSmootherTakeDirBC_Interior_SmallestGrid) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1202,7 +1202,7 @@ TEST(SmootherTest, SequentialSmootherTakeAcrossOrigin_SmallestGrid) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; @@ -1276,7 +1276,7 @@ TEST(SmootherTest, ParallelSmootherTakeAcrossOrigin_SmallestGrid) using DomainGeometryType = CzarnyGeometry; DomainGeometryType domain_geometry(Rmax, kappa_eps, delta_e); - auto grid = std::make_unique(radii, angles); + auto grid = std::make_unique>(radii, angles); double alpha_jump = 0.678 * Rmax; using DensityProfileCoefficientsType = ZoniShiftedCoefficients; diff --git a/tests/test_tools.h b/tests/test_tools.h index 96375388..300ecbef 100644 --- a/tests/test_tools.h +++ b/tests/test_tools.h @@ -6,7 +6,7 @@ using namespace gmgpolar; -inline HostVector generate_random_sample_data(const PolarGrid& grid, unsigned int seed, double min_val = -100.0, +inline HostVector generate_random_sample_data(const PolarGrid& grid, unsigned int seed, double min_val = -100.0, double max_val = 100.0) { HostVector x("x", grid.numberOfNodes()); From 3edc50878cfb9889194e784e88c192170d07b6f0 Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 13:45:40 +0200 Subject: [PATCH 04/22] Add missing template arguments --- include/PolarGrid/polargrid.h | 4 ++-- src/PolarGrid/anisotropic_division.cpp | 2 +- src/PolarGrid/polargrid.cpp | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/PolarGrid/polargrid.h b/include/PolarGrid/polargrid.h index 346da1c1..d819f0a9 100644 --- a/include/PolarGrid/polargrid.h +++ b/include/PolarGrid/polargrid.h @@ -91,14 +91,14 @@ class PolarGrid // radial_spacings_ contains the distances between each consecutive radii division. // radial_spacings_ = [r_{1}-r_{0}, ..., r_{N}-r_{N-1}]. - AllocatableVector radial_spacings_; // size(radial_spacings_) = nr() - 1 + AllocatableVector radial_spacings_; // size(radial_spacings_) = nr() - 1 // angular_spacings_ contains the angles between each consecutive theta division. // Since we have a periodic boundary in theta direction, // we have to make sure the index wraps around correctly when accessing it. // Here theta_0 = 0.0 and theta_N = 2*pi refer to the same point. // angular_spacings_ = [theta_{1}-theta_{0}, ..., theta_{N}-theta_{N-1}]. - AllocatableVector angular_spacings_; // size(angular_spacings_) = ntheta() + AllocatableVector angular_spacings_; // size(angular_spacings_) = ntheta() // Circle/radial smoother division double smoother_splitting_radius_; // Radius at which the grid is split into circular and radial smoothing diff --git a/src/PolarGrid/anisotropic_division.cpp b/src/PolarGrid/anisotropic_division.cpp index d1ce08a2..57cba345 100644 --- a/src/PolarGrid/anisotropic_division.cpp +++ b/src/PolarGrid/anisotropic_division.cpp @@ -2,7 +2,7 @@ using namespace gmgpolar; template -Vector PolarGrid::RadialAnisotropicDivision(double R0, double R, const int nr_exp, double refinement_radius, +Vector PolarGrid::RadialAnisotropicDivision(double R0, double R, const int nr_exp, double refinement_radius, const int anisotropic_factor) const { // Calculate the percentage of refinement_radius. diff --git a/src/PolarGrid/polargrid.cpp b/src/PolarGrid/polargrid.cpp index a6a1a690..8baf8a51 100644 --- a/src/PolarGrid/polargrid.cpp +++ b/src/PolarGrid/polargrid.cpp @@ -252,13 +252,16 @@ PolarGrid coarseningGrid(const PolarGrid& fineGrid) const bool use_same_splitting_radius = false; if (use_same_splitting_radius) { - return PolarGrid(coarse_r, coarse_theta, fineGrid.smootherSplittingRadius()); + return PolarGrid(coarse_r, coarse_theta, fineGrid.smootherSplittingRadius()); } else { - return PolarGrid(coarse_r, coarse_theta); + return PolarGrid(coarse_r, coarse_theta); } } +template PolarGrid coarseningGrid(const PolarGrid& grid); +template PolarGrid coarseningGrid(const PolarGrid& grid); + } // namespace gmgpolar // ------------------------ // From ae6725fa4b37ff120a4e47489d25b6de605d10d2 Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 14:41:28 +0200 Subject: [PATCH 05/22] Add memory space cast --- include/PolarGrid/polargrid.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/PolarGrid/polargrid.h b/include/PolarGrid/polargrid.h index d819f0a9..422beb97 100644 --- a/include/PolarGrid/polargrid.h +++ b/include/PolarGrid/polargrid.h @@ -44,6 +44,22 @@ class PolarGrid KOKKOS_DEFAULTED_FUNCTION PolarGrid(const PolarGrid&) = default; + template + PolarGrid(const PolarGrid& other) + : nr_(other.nr_) + , ntheta_(other.ntheta_) + , is_ntheta_PowerOfTwo_(other.is_ntheta_PowerOfTwo_) + , radii_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.radii_)) + , angles_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.angles_)) + , radial_spacings_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.radial_spacings_)) + , angular_spacings_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.angular_spacings_)) + , smoother_splitting_radius_(other.smoother_splitting_radius_) + , number_smoother_circles_(other.number_smoother_circles_) + , length_smoother_radial_(other.length_smoother_radial_) + , number_circular_smoother_nodes_(other.number_circular_smoother_nodes_) + , number_radial_smoother_nodes_(other.number_radial_smoother_nodes_) + {} + // Optimized, inlined indexing. KOKKOS_INLINE_FUNCTION int wrapThetaIndex(const int unwrapped_theta_index) const; KOKKOS_INLINE_FUNCTION int index(const int r_index, const int unwrapped_theta_index) const; From c5952a9bfb4f9ba196743f19c0f73ca1e27e80fd Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 17:03:18 +0200 Subject: [PATCH 06/22] Use Kokkos loops in LevelCache --- include/Level/levelCache.inl | 57 ++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/include/Level/levelCache.inl b/include/Level/levelCache.inl index b3b523d5..a54d06be 100644 --- a/include/Level/levelCache.inl +++ b/include/Level/levelCache.inl @@ -2,7 +2,7 @@ template LevelCache::LevelCache( - const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, + const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const bool cache_density_profile_coefficients, const bool cache_domain_geometry) : domain_geometry_(domain_geometry) @@ -21,18 +21,22 @@ LevelCache::LevelCache( // Pre-compute and store alpha/beta coefficients at all grid nodes to avoid // repeated expensive evaluations during runtime computations if (cache_density_profile_coefficients_) { -#pragma omp parallel for - for (int i_r = 0; i_r < grid.nr(); i_r++) { + Kokkos::parallel_for( + "Cache density profile coefficients", +Kokkos::MDRangePolicy>( // Rank of the index space + {0, 0}, // Starting point of the index space + {grid.nr(), grid.ntheta()} // Ending point of the index space + ), + // Kokkos lambda function to execute for each point in the index space + KOKKOS_LAMBDA(const int i_r, const int i_theta) { const double r = grid.radius(i_r); - for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) { const double theta = grid.theta(i_theta); const int index = grid.index(i_r, i_theta); if (!cache_domain_geometry_) { coeff_alpha_(index) = density_profile_coefficients.alpha(r, theta); } coeff_beta_(index) = density_profile_coefficients.beta(r, theta); - } - } + }); } // Pre-compute and store Jacobian matrix elements (arr, att, art, detDF) at all grid nodes @@ -42,10 +46,15 @@ LevelCache::LevelCache( // access patterns of the smoother and improve cache locality // Circular Indexing Section -#pragma omp parallel for - for (int i_r = 0; i_r < grid.numberSmootherCircles(); i_r++) { + Kokkos::parallel_for( + "Cache domain geometry (circular indexing)", +Kokkos::MDRangePolicy>( // Rank of the index space + {0, 0}, // Starting point of the index space + {grid.numberSmootherCircles(), grid.ntheta()} // Ending point of the index space + ), + // Kokkos lambda function to execute for each point in the index space + KOKKOS_LAMBDA(const int i_r, const int i_theta) { const double r = grid.radius(i_r); - for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) { const double theta = grid.theta(i_theta); const int index = grid.index(i_r, i_theta); const double coeff_alpha = density_profile_coefficients.alpha(r, theta); @@ -56,13 +65,17 @@ LevelCache::LevelCache( arr_(index) = arr; att_(index) = att; art_(index) = art; - } - } + }); // Radial Indexing Section -#pragma omp parallel for - for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) { + Kokkos::parallel_for( + "Cache domain geometry (radial indexing)", +Kokkos::MDRangePolicy>( // Rank of the index space + {0, grid.numberSmootherCircles()}, // Starting point of the index space + {grid.ntheta(), grid.nr()} // Ending point of the index space + ), + // Kokkos lambda function to execute for each point in the index space + KOKKOS_LAMBDA(const int i_theta, const int i_r) { const double theta = grid.theta(i_theta); - for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { const double r = grid.radius(i_r); const int index = grid.index(i_r, i_theta); const double coeff_alpha = density_profile_coefficients.alpha(r, theta); @@ -73,9 +86,9 @@ LevelCache::LevelCache( arr_(index) = arr; att_(index) = att; art_(index) = art; - } - } + }); } + Kokkos::fence(); } template @@ -98,13 +111,13 @@ bool LevelCache::cacheDensityProfile } template -HostConstVector LevelCache::coeff_alpha() const +ConstVector LevelCache::coeff_alpha() const { return coeff_alpha_; } template -HostConstVector LevelCache::coeff_beta() const +ConstVector LevelCache::coeff_beta() const { return coeff_beta_; } @@ -116,25 +129,25 @@ bool LevelCache::cacheDomainGeometry } template -HostConstVector LevelCache::arr() const +ConstVector LevelCache::arr() const { return arr_; } template -HostConstVector LevelCache::att() const +ConstVector LevelCache::att() const { return att_; } template -HostConstVector LevelCache::art() const +ConstVector LevelCache::art() const { return art_; } template -HostConstVector LevelCache::detDF() const +ConstVector LevelCache::detDF() const { return detDF_; } From 2d6f2214788f925b33f9624b916d78e50c55033a Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 17:04:11 +0200 Subject: [PATCH 07/22] Put LevelCache on GPU --- include/Level/level.h | 26 +++++++++++++------------- include/Level/levelCache.inl | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/Level/level.h b/include/Level/level.h index aa310c89..7bd22a7f 100644 --- a/include/Level/level.h +++ b/include/Level/level.h @@ -138,7 +138,7 @@ template & grid, const DensityProfileCoefficients& density_profile_coefficients, + explicit LevelCache(const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const bool cache_density_profile_coefficients, const bool cache_domain_geometry); @@ -146,14 +146,14 @@ class LevelCache const DensityProfileCoefficients& densityProfileCoefficients() const; bool cacheDensityProfileCoefficients() const; - HostConstVector coeff_alpha() const; - HostConstVector coeff_beta() const; + ConstVector coeff_alpha() const; + ConstVector coeff_beta() const; bool cacheDomainGeometry() const; - HostConstVector arr() const; - HostConstVector att() const; - HostConstVector art() const; - HostConstVector detDF() const; + ConstVector arr() const; + ConstVector att() const; + ConstVector art() const; + ConstVector detDF() const; KOKKOS_INLINE_FUNCTION void obtainValues(const int i_r, const int i_theta, const int global_index, double r, double theta, double& coeff_beta, double& arr, double& att, double& art, @@ -181,14 +181,14 @@ class LevelCache const DensityProfileCoefficients& density_profile_coefficients_; bool cache_density_profile_coefficients_; // cache alpha(r, theta), beta(r, theta) - HostVector coeff_alpha_; - HostVector coeff_beta_; + Vector coeff_alpha_; + Vector coeff_beta_; bool cache_domain_geometry_; // cache arr, att, art, detDF - HostVector arr_; - HostVector att_; - HostVector art_; - HostVector detDF_; + Vector arr_; + Vector att_; + Vector art_; + Vector detDF_; }; #include "levelCache.inl" diff --git a/include/Level/levelCache.inl b/include/Level/levelCache.inl index a54d06be..b3938141 100644 --- a/include/Level/levelCache.inl +++ b/include/Level/levelCache.inl @@ -23,7 +23,7 @@ LevelCache::LevelCache( if (cache_density_profile_coefficients_) { Kokkos::parallel_for( "Cache density profile coefficients", -Kokkos::MDRangePolicy>( // Rank of the index space +Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {grid.nr(), grid.ntheta()} // Ending point of the index space ), @@ -48,7 +48,7 @@ Kokkos::MDRangePolicy>( // Ra // Circular Indexing Section Kokkos::parallel_for( "Cache domain geometry (circular indexing)", -Kokkos::MDRangePolicy>( // Rank of the index space +Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {grid.numberSmootherCircles(), grid.ntheta()} // Ending point of the index space ), @@ -69,7 +69,7 @@ Kokkos::MDRangePolicy>( // Ra // Radial Indexing Section Kokkos::parallel_for( "Cache domain geometry (radial indexing)", -Kokkos::MDRangePolicy>( // Rank of the index space +Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {grid.ntheta(), grid.nr()} // Ending point of the index space ), From 13efbcc9787e2f2818f2073e238035e2f5065065 Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 17:04:24 +0200 Subject: [PATCH 08/22] Add friend class --- include/PolarGrid/polargrid.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/PolarGrid/polargrid.h b/include/PolarGrid/polargrid.h index 422beb97..9b387a99 100644 --- a/include/PolarGrid/polargrid.h +++ b/include/PolarGrid/polargrid.h @@ -60,6 +60,9 @@ class PolarGrid , number_radial_smoother_nodes_(other.number_radial_smoother_nodes_) {} + template + friend class PolarGrid; + // Optimized, inlined indexing. KOKKOS_INLINE_FUNCTION int wrapThetaIndex(const int unwrapped_theta_index) const; KOKKOS_INLINE_FUNCTION int index(const int r_index, const int unwrapped_theta_index) const; From 9174530694a57f403b919c580c07a06646f1d156 Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 17:04:46 +0200 Subject: [PATCH 09/22] Put tridiagonal solver on GPU --- .../Solvers/tridiagonal_solver.h | 42 +-- .../Solvers/tridiagonal_solver.cpp | 255 +++++++++++------- 2 files changed, 174 insertions(+), 123 deletions(-) diff --git a/include/LinearAlgebra/Solvers/tridiagonal_solver.h b/include/LinearAlgebra/Solvers/tridiagonal_solver.h index 939be64d..72ee9e95 100644 --- a/include/LinearAlgebra/Solvers/tridiagonal_solver.h +++ b/include/LinearAlgebra/Solvers/tridiagonal_solver.h @@ -93,13 +93,13 @@ class BatchedTridiagonalSolver { // Create local copies for lambda capture int matrix_dimension = matrix_dimension_; - HostVector main_diagonal = main_diagonal_; - HostVector sub_diagonal = sub_diagonal_; - HostVector gamma = gamma_; + Vector main_diagonal = main_diagonal_; + Vector sub_diagonal = sub_diagonal_; + Vector gamma = gamma_; if (!is_cyclic_) { Kokkos::parallel_for( - "SetupNonCyclic", Kokkos::RangePolicy(0, batch_count_), + "SetupNonCyclic", Kokkos::RangePolicy(0, batch_count_), KOKKOS_LAMBDA(const int batch_idx) { // ----------------------------------- // // Obtain offset for the current batch // @@ -116,7 +116,7 @@ class BatchedTridiagonalSolver } else { Kokkos::parallel_for( - "SetupCyclic", Kokkos::RangePolicy(0, batch_count_), + "SetupCyclic", Kokkos::RangePolicy(0, batch_count_), KOKKOS_LAMBDA(const int batch_idx) { // ----------------------------------- // // Obtain offset for the current batch // @@ -152,7 +152,7 @@ class BatchedTridiagonalSolver // This step solves the system Ax = b using the factorized form of A. // For cyclic systems, it also performs the Shermann-Morrison reconstruction to obtain the final solution. - void solve(HostVector rhs, int batch_offset = 0, int batch_stride = 1) + void solve(Vector rhs, int batch_offset = 0, int batch_stride = 1) { if (!is_factorized_) { throw std::runtime_error("Error: Matrix must be factorized before solving."); @@ -163,14 +163,14 @@ class BatchedTridiagonalSolver // Create local copies for lambda capture int matrix_dimension = matrix_dimension_; - HostVector main_diagonal = main_diagonal_; - HostVector sub_diagonal = sub_diagonal_; - HostVector buffer = buffer_; - HostVector gamma = gamma_; + Vector main_diagonal = main_diagonal_; + Vector sub_diagonal = sub_diagonal_; + Vector buffer = buffer_; + Vector gamma = gamma_; if (!is_cyclic_) { Kokkos::parallel_for( - "SolveNonCyclic", Kokkos::RangePolicy(0, effective_batch_count), + "SolveNonCyclic", Kokkos::RangePolicy(0, effective_batch_count), KOKKOS_LAMBDA(const int k) { // ----------------------------------- // // Obtain offset for the current batch // @@ -198,7 +198,7 @@ class BatchedTridiagonalSolver } else { Kokkos::parallel_for( - "SolveCyclic", Kokkos::RangePolicy(0, effective_batch_count), + "SolveCyclic", Kokkos::RangePolicy(0, effective_batch_count), KOKKOS_LAMBDA(const int k) { // ----------------------------------- // // Obtain offset for the current batch // @@ -255,7 +255,7 @@ class BatchedTridiagonalSolver // It is useful when the matrix has a non-zero diagonal but zero off-diagonal entries. // Note that .setup() modifies main_diagonal(0) in the cyclic case. - void solve_diagonal(HostVector rhs, int batch_offset = 0, int batch_stride = 1) + void solve_diagonal(Vector rhs, int batch_offset = 0, int batch_stride = 1) { if (!is_factorized_) { throw std::runtime_error("Error: Matrix must be factorized before solving."); @@ -266,13 +266,13 @@ class BatchedTridiagonalSolver // Create local copies for lambda capture int matrix_dimension = matrix_dimension_; - HostVector main_diagonal = main_diagonal_; - HostVector gamma = gamma_; + Vector main_diagonal = main_diagonal_; + Vector gamma = gamma_; if (!is_cyclic_) { Kokkos::parallel_for( "SolveDiagonalNonCyclic", - Kokkos::RangePolicy(0, effective_batch_count), + Kokkos::RangePolicy(0, effective_batch_count), KOKKOS_LAMBDA(const int k) { // ----------------------------------- // // Obtain offset for the current batch // @@ -288,7 +288,7 @@ class BatchedTridiagonalSolver } else { Kokkos::parallel_for( - "SolveDiagonalCyclic", Kokkos::RangePolicy(0, effective_batch_count), + "SolveDiagonalCyclic", Kokkos::RangePolicy(0, effective_batch_count), KOKKOS_LAMBDA(const int k) { // ----------------------------------- // // Obtain offset for the current batch // @@ -310,10 +310,10 @@ class BatchedTridiagonalSolver int matrix_dimension_; int batch_count_; - HostVector main_diagonal_; - HostVector sub_diagonal_; - HostVector buffer_; - HostVector gamma_; + Vector main_diagonal_; + Vector sub_diagonal_; + Vector buffer_; + Vector gamma_; bool is_cyclic_; bool is_factorized_; diff --git a/tests/LinearAlgebra/Solvers/tridiagonal_solver.cpp b/tests/LinearAlgebra/Solvers/tridiagonal_solver.cpp index 9482632c..6ac5f2f1 100644 --- a/tests/LinearAlgebra/Solvers/tridiagonal_solver.cpp +++ b/tests/LinearAlgebra/Solvers/tridiagonal_solver.cpp @@ -8,7 +8,7 @@ using namespace gmgpolar; // clang-format off -TEST(BatchedTridiagonalSolvers, non_cyclic_tridiagonal_n_4) +void test_non_cyclic_tridiagonal_n_4() { int batch_count = 4; int matrix_dimension = 4; @@ -25,6 +25,10 @@ TEST(BatchedTridiagonalSolvers, non_cyclic_tridiagonal_n_4) // System 4: {{5,1,0,0},{1,7,2,0},{0,2,9,3},{0,0,3,11}} * {{a},{b},{c},{d}} = {{4},{5},{6},{7}} // a = 248/355, b = 36/71, c = 267/710, d = 379/710 + Kokkos::parallel_for( + "Test", + 1, + KOKKOS_LAMBDA(const int) { solver.set_main_diagonal(0,0, 2.0); solver.set_sub_diagonal(0,0, 1.0); solver.set_main_diagonal(0,1, 4.0); solver.set_sub_diagonal(0,1, 2.0); solver.set_main_diagonal(0,2, 6.0); solver.set_sub_diagonal(0,2, 3.0); @@ -44,17 +48,20 @@ TEST(BatchedTridiagonalSolvers, non_cyclic_tridiagonal_n_4) solver.set_main_diagonal(3,1, 7.0); solver.set_sub_diagonal(3,1, 2.0); solver.set_main_diagonal(3,2, 9.0); solver.set_sub_diagonal(3,2, 3.0); solver.set_main_diagonal(3,3, 11.0); + }); - HostVector rhs("rhs", matrix_dimension * batch_count); + HostVector h_rhs("h_rhs", matrix_dimension * batch_count); // Initialize RHS for each system - rhs(0) = 1.0; rhs(1) = 2.0; rhs(2) = 3.0; rhs(3) = 4.0; - rhs(4) = 2.0; rhs(5) = 3.0; rhs(6) = 4.0; rhs(7) = 5.0; - rhs(8) = 3.0; rhs(9) = 4.0; rhs(10) = 5.0; rhs(11) = 6.0; - rhs(12) = 4.0; rhs(13) = 5.0; rhs(14) = 6.0; rhs(15) = 7.0; + h_rhs(0) = 1.0; h_rhs(1) = 2.0; h_rhs(2) = 3.0; h_rhs(3) = 4.0; + h_rhs(4) = 2.0; h_rhs(5) = 3.0; h_rhs(6) = 4.0; h_rhs(7) = 5.0; + h_rhs(8) = 3.0; h_rhs(9) = 4.0; h_rhs(10) = 5.0; h_rhs(11) = 6.0; + h_rhs(12) = 4.0; h_rhs(13) = 5.0; h_rhs(14) = 6.0; h_rhs(15) = 7.0; solver.setup(); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + int offset, stride; // Solve each even system separately offset = 0; stride = 2; @@ -63,31 +70,38 @@ TEST(BatchedTridiagonalSolvers, non_cyclic_tridiagonal_n_4) offset = 1; stride = 2; solver.solve(rhs, offset, stride); + Kokkos::deep_copy(h_rhs, rhs); + // Verify solutions double tol = 1e-12; - EXPECT_NEAR(rhs(0), 70.0/209.0, tol); - EXPECT_NEAR(rhs(1), 69.0/209.0, tol); - EXPECT_NEAR(rhs(2), 36.0/209.0, tol); - EXPECT_NEAR(rhs(3), 91.0/209.0, tol); - - EXPECT_NEAR(rhs(4), 29.0/54.0, tol); - EXPECT_NEAR(rhs(5), 7.0/18.0, tol); - EXPECT_NEAR(rhs(6), 7.0/27.0, tol); - EXPECT_NEAR(rhs(7), 38.0/81.0, tol); - - EXPECT_NEAR(rhs(8), 938.0/1473.0, tol); - EXPECT_NEAR(rhs(9), 667.0/1473.0, tol); - EXPECT_NEAR(rhs(10), 476.0/1473.0, tol); - EXPECT_NEAR(rhs(11), 247.0/491.0, tol); - - EXPECT_NEAR(rhs(12), 248.0/355.0, tol); - EXPECT_NEAR(rhs(13), 36.0/71.0, tol); - EXPECT_NEAR(rhs(14), 267.0/710.0, tol); - EXPECT_NEAR(rhs(15), 379.0/710.0, tol); + EXPECT_NEAR(h_rhs(0), 70.0/209.0, tol); + EXPECT_NEAR(h_rhs(1), 69.0/209.0, tol); + EXPECT_NEAR(h_rhs(2), 36.0/209.0, tol); + EXPECT_NEAR(h_rhs(3), 91.0/209.0, tol); + + EXPECT_NEAR(h_rhs(4), 29.0/54.0, tol); + EXPECT_NEAR(h_rhs(5), 7.0/18.0, tol); + EXPECT_NEAR(h_rhs(6), 7.0/27.0, tol); + EXPECT_NEAR(h_rhs(7), 38.0/81.0, tol); + + EXPECT_NEAR(h_rhs(8), 938.0/1473.0, tol); + EXPECT_NEAR(h_rhs(9), 667.0/1473.0, tol); + EXPECT_NEAR(h_rhs(10), 476.0/1473.0, tol); + EXPECT_NEAR(h_rhs(11), 247.0/491.0, tol); + + EXPECT_NEAR(h_rhs(12), 248.0/355.0, tol); + EXPECT_NEAR(h_rhs(13), 36.0/71.0, tol); + EXPECT_NEAR(h_rhs(14), 267.0/710.0, tol); + EXPECT_NEAR(h_rhs(15), 379.0/710.0, tol); +} +TEST(BatchedTridiagonalSolvers, non_cyclic_tridiagonal_n_4) +{ + // Call a function named function due to cuda restriction + test_non_cyclic_tridiagonal_n_4(); } -TEST(BatchedTridiagonalSolvers, cyclic_tridiagonal_n_4) +void test_cyclic_tridiagonal_n_4() { int batch_count = 4; int matrix_dimension = 4; @@ -104,6 +118,10 @@ TEST(BatchedTridiagonalSolvers, cyclic_tridiagonal_n_4) // System 4: {{5,1,0,-4},{1,7,2,0},{0,2,9,3},{-4,0,3,11}} * {{a},{b},{c},{d}} = {{4},{5},{6},{7}} // a = 271/162, b = 23/54, c = 14/81, d = 97/81 + Kokkos::parallel_for( + "Test", + 1, + KOKKOS_LAMBDA(const int) { solver.set_main_diagonal(0,0, 2.0); solver.set_sub_diagonal(0,0, 1.0); solver.set_main_diagonal(0,1, 4.0); solver.set_sub_diagonal(0,1, 2.0); solver.set_main_diagonal(0,2, 6.0); solver.set_sub_diagonal(0,2, 3.0); @@ -123,14 +141,17 @@ TEST(BatchedTridiagonalSolvers, cyclic_tridiagonal_n_4) solver.set_main_diagonal(3,1, 7.0); solver.set_sub_diagonal(3,1, 2.0); solver.set_main_diagonal(3,2, 9.0); solver.set_sub_diagonal(3,2, 3.0); solver.set_main_diagonal(3,3, 11.0); solver.set_cyclic_corner(3, -4.0); + }); - HostVector rhs("rhs", matrix_dimension * batch_count); + HostVector h_rhs("h_rhs", matrix_dimension * batch_count); // Initialize RHS for each system - rhs(0) = 1.0; rhs(1) = 2.0; rhs(2) = 3.0; rhs(3) = 4.0; - rhs(4) = 2.0; rhs(5) = 3.0; rhs(6) = 4.0; rhs(7) = 5.0; - rhs(8) = 3.0; rhs(9) = 4.0; rhs(10) = 5.0; rhs(11) = 6.0; - rhs(12) = 4.0; rhs(13) = 5.0; rhs(14) = 6.0; rhs(15) = 7.0; + h_rhs(0) = 1.0; h_rhs(1) = 2.0; h_rhs(2) = 3.0; h_rhs(3) = 4.0; + h_rhs(4) = 2.0; h_rhs(5) = 3.0; h_rhs(6) = 4.0; h_rhs(7) = 5.0; + h_rhs(8) = 3.0; h_rhs(9) = 4.0; h_rhs(10) = 5.0; h_rhs(11) = 6.0; + h_rhs(12) = 4.0; h_rhs(13) = 5.0; h_rhs(14) = 6.0; h_rhs(15) = 7.0; + + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); solver.setup(); @@ -142,38 +163,47 @@ TEST(BatchedTridiagonalSolvers, cyclic_tridiagonal_n_4) offset = 1; stride = 2; solver.solve(rhs, offset, stride); + Kokkos::deep_copy(h_rhs, rhs); + // Verify solutions double tol = 1e-12; - EXPECT_NEAR(rhs(0), 42.0/67.0, tol); - EXPECT_NEAR(rhs(1), 18.0/67.0, tol); - EXPECT_NEAR(rhs(2), 10.0/67.0, tol); - EXPECT_NEAR(rhs(3), 35.0/67.0, tol); - - EXPECT_NEAR(rhs(4), 287.0/274.0, tol); - EXPECT_NEAR(rhs(5), 89.0/274.0, tol); - EXPECT_NEAR(rhs(6), 45.0/274.0, tol); - EXPECT_NEAR(rhs(7), 201.0/274.0, tol); - - EXPECT_NEAR(rhs(8), 1532.0/1113.0, tol); - EXPECT_NEAR(rhs(9), 8.0/21.0, tol); - EXPECT_NEAR(rhs(10), 188.0/1113.0, tol); - EXPECT_NEAR(rhs(11), 51.0/53.0, tol); - - EXPECT_NEAR(rhs(12), 271.0/162.0, tol); - EXPECT_NEAR(rhs(13), 23.0/54.0, tol); - EXPECT_NEAR(rhs(14), 14.0/81.0, tol); - EXPECT_NEAR(rhs(15), 97.0/81.0, tol); + EXPECT_NEAR(h_rhs(0), 42.0/67.0, tol); + EXPECT_NEAR(h_rhs(1), 18.0/67.0, tol); + EXPECT_NEAR(h_rhs(2), 10.0/67.0, tol); + EXPECT_NEAR(h_rhs(3), 35.0/67.0, tol); + + EXPECT_NEAR(h_rhs(4), 287.0/274.0, tol); + EXPECT_NEAR(h_rhs(5), 89.0/274.0, tol); + EXPECT_NEAR(h_rhs(6), 45.0/274.0, tol); + EXPECT_NEAR(h_rhs(7), 201.0/274.0, tol); + + EXPECT_NEAR(h_rhs(8), 1532.0/1113.0, tol); + EXPECT_NEAR(h_rhs(9), 8.0/21.0, tol); + EXPECT_NEAR(h_rhs(10), 188.0/1113.0, tol); + EXPECT_NEAR(h_rhs(11), 51.0/53.0, tol); + + EXPECT_NEAR(h_rhs(12), 271.0/162.0, tol); + EXPECT_NEAR(h_rhs(13), 23.0/54.0, tol); + EXPECT_NEAR(h_rhs(14), 14.0/81.0, tol); + EXPECT_NEAR(h_rhs(15), 97.0/81.0, tol); +} +TEST(BatchedTridiagonalSolvers, cyclic_tridiagonal_n_4) { + // Call a function named function due to cuda restriction + test_cyclic_tridiagonal_n_4(); } -TEST(BatchedTridiagonalSolvers, non_cyclic_diagonal_n_4) -{ +void test_non_cyclic_diagonal_n_4() { int batch_count = 4; int matrix_dimension = 4; bool is_cyclic = false; BatchedTridiagonalSolver solver(matrix_dimension, batch_count, is_cyclic); + Kokkos::parallel_for( + "Test", + 1, + KOKKOS_LAMBDA(const int) { solver.set_main_diagonal(0,0, 2.0); solver.set_main_diagonal(0,1, 4.0); solver.set_main_diagonal(0,2, 6.0); @@ -193,14 +223,17 @@ TEST(BatchedTridiagonalSolvers, non_cyclic_diagonal_n_4) solver.set_main_diagonal(3,1, 7.0); solver.set_main_diagonal(3,2, 9.0); solver.set_main_diagonal(3,3, 11.0); + }); - HostVector rhs("rhs", matrix_dimension * batch_count); + HostVector h_rhs("h_rhs", matrix_dimension * batch_count); // Initialize RHS for each system - rhs(0) = 1.0; rhs(1) = 2.0; rhs(2) = 3.0; rhs(3) = 4.0; - rhs(4) = 2.0; rhs(5) = 3.0; rhs(6) = 4.0; rhs(7) = 5.0; - rhs(8) = 3.0; rhs(9) = 4.0; rhs(10) = 5.0; rhs(11) = 6.0; - rhs(12) = 4.0; rhs(13) = 5.0; rhs(14) = 6.0; rhs(15) = 7.0; + h_rhs(0) = 1.0; h_rhs(1) = 2.0; h_rhs(2) = 3.0; h_rhs(3) = 4.0; + h_rhs(4) = 2.0; h_rhs(5) = 3.0; h_rhs(6) = 4.0; h_rhs(7) = 5.0; + h_rhs(8) = 3.0; h_rhs(9) = 4.0; h_rhs(10) = 5.0; h_rhs(11) = 6.0; + h_rhs(12) = 4.0; h_rhs(13) = 5.0; h_rhs(14) = 6.0; h_rhs(15) = 7.0; + + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); solver.setup(); @@ -212,38 +245,47 @@ TEST(BatchedTridiagonalSolvers, non_cyclic_diagonal_n_4) offset = 1; stride = 2; solver.solve_diagonal(rhs, offset, stride); + Kokkos::deep_copy(h_rhs, rhs); + // Verify solutions double tol = 1e-12; - EXPECT_NEAR(rhs(0), 1.0/2.0, tol); - EXPECT_NEAR(rhs(1), 2.0/4.0, tol); - EXPECT_NEAR(rhs(2), 3.0/6.0, tol); - EXPECT_NEAR(rhs(3), 4.0/8.0, tol); - - EXPECT_NEAR(rhs(4), 2.0/3.0, tol); - EXPECT_NEAR(rhs(5), 3.0/5.0, tol); - EXPECT_NEAR(rhs(6), 4.0/7.0, tol); - EXPECT_NEAR(rhs(7), 5.0/9.0, tol); - - EXPECT_NEAR(rhs(8), 3.0/4.0, tol); - EXPECT_NEAR(rhs(9), 4.0/6.0, tol); - EXPECT_NEAR(rhs(10), 5.0/8.0, tol); - EXPECT_NEAR(rhs(11), 6.0/10.0, tol); - - EXPECT_NEAR(rhs(12), 4.0/5.0, tol); - EXPECT_NEAR(rhs(13), 5.0/7.0, tol); - EXPECT_NEAR(rhs(14), 6.0/9.0, tol); - EXPECT_NEAR(rhs(15), 7.0/11.0, tol); + EXPECT_NEAR(h_rhs(0), 1.0/2.0, tol); + EXPECT_NEAR(h_rhs(1), 2.0/4.0, tol); + EXPECT_NEAR(h_rhs(2), 3.0/6.0, tol); + EXPECT_NEAR(h_rhs(3), 4.0/8.0, tol); + + EXPECT_NEAR(h_rhs(4), 2.0/3.0, tol); + EXPECT_NEAR(h_rhs(5), 3.0/5.0, tol); + EXPECT_NEAR(h_rhs(6), 4.0/7.0, tol); + EXPECT_NEAR(h_rhs(7), 5.0/9.0, tol); + + EXPECT_NEAR(h_rhs(8), 3.0/4.0, tol); + EXPECT_NEAR(h_rhs(9), 4.0/6.0, tol); + EXPECT_NEAR(h_rhs(10), 5.0/8.0, tol); + EXPECT_NEAR(h_rhs(11), 6.0/10.0, tol); + + EXPECT_NEAR(h_rhs(12), 4.0/5.0, tol); + EXPECT_NEAR(h_rhs(13), 5.0/7.0, tol); + EXPECT_NEAR(h_rhs(14), 6.0/9.0, tol); + EXPECT_NEAR(h_rhs(15), 7.0/11.0, tol); +} +TEST(BatchedTridiagonalSolvers, non_cyclic_diagonal_n_4) { + // Call a function named function due to cuda restriction + test_non_cyclic_diagonal_n_4(); } -TEST(BatchedTridiagonalSolvers, cyclic_diagonal_n_4) -{ +void test_cyclic_diagonal_n_4() { int batch_count = 4; int matrix_dimension = 4; bool is_cyclic = true; BatchedTridiagonalSolver solver(matrix_dimension, batch_count, is_cyclic); + Kokkos::parallel_for( + "Test", + 1, + KOKKOS_LAMBDA(const int) { solver.set_main_diagonal(0,0, 2.0); solver.set_main_diagonal(0,1, 4.0); solver.set_main_diagonal(0,2, 6.0); @@ -263,14 +305,17 @@ TEST(BatchedTridiagonalSolvers, cyclic_diagonal_n_4) solver.set_main_diagonal(3,1, 7.0); solver.set_main_diagonal(3,2, 9.0); solver.set_main_diagonal(3,3, 11.0); + }); - HostVector rhs("rhs", matrix_dimension * batch_count); + HostVector h_rhs("h_rhs", matrix_dimension * batch_count); // Initialize RHS for each system - rhs(0) = 1.0; rhs(1) = 2.0; rhs(2) = 3.0; rhs(3) = 4.0; - rhs(4) = 2.0; rhs(5) = 3.0; rhs(6) = 4.0; rhs(7) = 5.0; - rhs(8) = 3.0; rhs(9) = 4.0; rhs(10) = 5.0; rhs(11) = 6.0; - rhs(12) = 4.0; rhs(13) = 5.0; rhs(14) = 6.0; rhs(15) = 7.0; + h_rhs(0) = 1.0; h_rhs(1) = 2.0; h_rhs(2) = 3.0; h_rhs(3) = 4.0; + h_rhs(4) = 2.0; h_rhs(5) = 3.0; h_rhs(6) = 4.0; h_rhs(7) = 5.0; + h_rhs(8) = 3.0; h_rhs(9) = 4.0; h_rhs(10) = 5.0; h_rhs(11) = 6.0; + h_rhs(12) = 4.0; h_rhs(13) = 5.0; h_rhs(14) = 6.0; h_rhs(15) = 7.0; + + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); solver.setup(); @@ -282,26 +327,32 @@ TEST(BatchedTridiagonalSolvers, cyclic_diagonal_n_4) offset = 1; stride = 2; solver.solve_diagonal(rhs, offset, stride); + Kokkos::deep_copy(h_rhs, rhs); + // Verify solutions double tol = 1e-12; - EXPECT_NEAR(rhs(0), 1.0/2.0, tol); - EXPECT_NEAR(rhs(1), 2.0/4.0, tol); - EXPECT_NEAR(rhs(2), 3.0/6.0, tol); - EXPECT_NEAR(rhs(3), 4.0/8.0, tol); - - EXPECT_NEAR(rhs(4), 2.0/3.0, tol); - EXPECT_NEAR(rhs(5), 3.0/5.0, tol); - EXPECT_NEAR(rhs(6), 4.0/7.0, tol); - EXPECT_NEAR(rhs(7), 5.0/9.0, tol); - - EXPECT_NEAR(rhs(8), 3.0/4.0, tol); - EXPECT_NEAR(rhs(9), 4.0/6.0, tol); - EXPECT_NEAR(rhs(10), 5.0/8.0, tol); - EXPECT_NEAR(rhs(11), 6.0/10.0, tol); - - EXPECT_NEAR(rhs(12), 4.0/5.0, tol); - EXPECT_NEAR(rhs(13), 5.0/7.0, tol); - EXPECT_NEAR(rhs(14), 6.0/9.0, tol); - EXPECT_NEAR(rhs(15), 7.0/11.0, tol); + EXPECT_NEAR(h_rhs(0), 1.0/2.0, tol); + EXPECT_NEAR(h_rhs(1), 2.0/4.0, tol); + EXPECT_NEAR(h_rhs(2), 3.0/6.0, tol); + EXPECT_NEAR(h_rhs(3), 4.0/8.0, tol); + + EXPECT_NEAR(h_rhs(4), 2.0/3.0, tol); + EXPECT_NEAR(h_rhs(5), 3.0/5.0, tol); + EXPECT_NEAR(h_rhs(6), 4.0/7.0, tol); + EXPECT_NEAR(h_rhs(7), 5.0/9.0, tol); + + EXPECT_NEAR(h_rhs(8), 3.0/4.0, tol); + EXPECT_NEAR(h_rhs(9), 4.0/6.0, tol); + EXPECT_NEAR(h_rhs(10), 5.0/8.0, tol); + EXPECT_NEAR(h_rhs(11), 6.0/10.0, tol); + + EXPECT_NEAR(h_rhs(12), 4.0/5.0, tol); + EXPECT_NEAR(h_rhs(13), 5.0/7.0, tol); + EXPECT_NEAR(h_rhs(14), 6.0/9.0, tol); + EXPECT_NEAR(h_rhs(15), 7.0/11.0, tol); +} +TEST(BatchedTridiagonalSolvers, cyclic_diagonal_n_4) { + // Call a function named function due to cuda restriction + test_cyclic_diagonal_n_4(); } From 47b5ebb554ad272b04076b91a0d940efa8e5a45c Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 17:05:26 +0200 Subject: [PATCH 10/22] Put DirectSolver, Smoother, Residual, and ExtrapolatedSmoother on GPU --- .../DirectSolverGive/applySymmetryShift.inl | 16 +-- .../DirectSolverGive/buildSolverMatrix.inl | 18 ++-- .../DirectSolverGive/directSolverGive.h | 14 +-- .../DirectSolverGive/directSolverGive.inl | 7 +- .../DirectSolverGive/matrixStencil.inl | 10 +- .../DirectSolverTake/applySymmetryShift.inl | 30 +++--- .../DirectSolverTake/buildSolverMatrix.inl | 32 +++--- .../DirectSolverTake/directSolverTake.h | 14 +-- .../DirectSolverTake/directSolverTake.inl | 7 +- .../DirectSolverTake/matrixStencil.inl | 12 +-- include/DirectSolver/directSolver.h | 4 +- .../applyAscOrtho.inl | 72 +++++++------- .../buildInnerBoundaryAsc.inl | 18 ++-- .../buildTridiagonalAsc.inl | 12 +-- .../extrapolatedSmootherGive.h | 32 +++--- .../extrapolatedSmootherGive.inl | 19 ++-- .../smootherStencil.inl | 8 +- .../solveAscSystem.inl | 36 +++---- .../applyAscOrtho.inl | 98 +++++++++---------- .../buildInnerBoundaryAsc.inl | 30 +++--- .../buildTridiagonalAsc.inl | 32 +++--- .../extrapolatedSmootherTake.h | 32 +++--- .../extrapolatedSmootherTake.inl | 13 ++- .../smootherStencil.inl | 8 +- .../solveAscSystem.inl | 36 +++---- .../extrapolatedSmoother.h | 4 +- include/Residual/ResidualGive/applyAGive.inl | 19 ++-- include/Residual/ResidualGive/residualGive.h | 2 +- .../Residual/ResidualGive/residualGive.inl | 15 ++- include/Residual/ResidualTake/applyATake.inl | 39 ++++---- include/Residual/ResidualTake/residualTake.h | 2 +- .../Residual/ResidualTake/residualTake.inl | 15 ++- include/Residual/residual.h | 4 +- .../Smoother/SmootherGive/applyAscOrtho.inl | 72 +++++++------- .../SmootherGive/buildInnerBoundaryAsc.inl | 18 ++-- .../SmootherGive/buildTridiagonalAsc.inl | 12 +-- include/Smoother/SmootherGive/smootherGive.h | 32 +++--- .../Smoother/SmootherGive/smootherGive.inl | 11 ++- .../Smoother/SmootherGive/solveAscSystem.inl | 36 +++---- .../Smoother/SmootherTake/applyAscOrtho.inl | 90 ++++++++--------- .../SmootherTake/buildInnerBoundaryAsc.inl | 30 +++--- .../SmootherTake/buildTridiagonalAsc.inl | 24 ++--- include/Smoother/SmootherTake/smootherTake.h | 32 +++--- .../Smoother/SmootherTake/smootherTake.inl | 11 ++- .../Smoother/SmootherTake/solveAscSystem.inl | 36 +++---- include/Smoother/smoother.h | 4 +- 46 files changed, 586 insertions(+), 532 deletions(-) diff --git a/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl b/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl index 4fb93894..8704e035 100644 --- a/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl +++ b/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl @@ -5,16 +5,16 @@ /* ----------------------- */ template -void DirectSolverGive::applySymmetryShiftInnerBoundary(HostVector x) const +void DirectSolverGive::applySymmetryShiftInnerBoundary(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(DirectSolver::DirBC_Interior_); Kokkos::parallel_for( "DirectSolverGive: applySymmetryShiftInnerBoundary", - Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { + Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { int i_r; double r; int global_index; @@ -70,14 +70,14 @@ void DirectSolverGive::applySymmetryShiftInnerBoundary(HostVecto } template -void DirectSolverGive::applySymmetryShiftOuterBoundary(HostVector x) const +void DirectSolverGive::applySymmetryShiftOuterBoundary(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; Kokkos::parallel_for( "DirectSolverGive: applySymmetryShiftOuterBoundary", - Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { + Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { int i_r; double r; int global_index; @@ -133,9 +133,9 @@ void DirectSolverGive::applySymmetryShiftOuterBoundary(HostVecto } template -void DirectSolverGive::applySymmetryShift(HostVector x) const +void DirectSolverGive::applySymmetryShift(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const bool DirBC_Interior = DirectSolver::DirBC_Interior_; assert(std::ssize(x) == grid.numberOfNodes()); diff --git a/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl index 0ec7a731..b6a9f463 100644 --- a/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl @@ -7,7 +7,7 @@ namespace direct_solver_give #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. -static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, +static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, int ptr, const int offset, const int row, const int column, const double value) { @@ -17,7 +17,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, +static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR& matrix, int ptr, const int offset, const int row, const int column, const double value) { @@ -28,7 +28,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR static KOKKOS_INLINE_FUNCTION void -nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const SystemMatrix& solver_matrix) { /* ---------------------------------------- */ @@ -811,7 +811,7 @@ typename DirectSolverGive::SystemMatrix DirectSolverGive& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; const bool DirBC_Interior = DirectSolver::DirBC_Interior_; @@ -821,14 +821,14 @@ typename DirectSolverGive::SystemMatrix DirectSolverGive solver_matrix(n, n, nnz); + SparseMatrixCOO solver_matrix(n, n, nnz); solver_matrix.is_symmetric(true); #else std::function nnz_per_row = [&](int global_index) { return getStencilSize(global_index, grid, DirBC_Interior); }; - SparseMatrixCSR solver_matrix(n, n, nnz_per_row); + SparseMatrixCSR solver_matrix(n, n, nnz_per_row); #endif /* ---------------- */ @@ -842,7 +842,7 @@ typename DirectSolverGive::SystemMatrix DirectSolverGive(0, num_circular_tasks), + Kokkos::RangePolicy(0, num_circular_tasks), KOKKOS_LAMBDA(const int circle_task) { const int i_r = start_circle + circle_task * 3; for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) { @@ -865,7 +865,7 @@ typename DirectSolverGive::SystemMatrix DirectSolverGive(0, 1), KOKKOS_LAMBDA(const int) { + Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { nodeBuildSolverMatrixGive(i_r, i_theta, grid, level_cache, DirBC_Interior, solver_matrix); } @@ -877,7 +877,7 @@ typename DirectSolverGive::SystemMatrix DirectSolverGive(0, num_radial_batches), + Kokkos::RangePolicy(0, num_radial_batches), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = additional_radial_tasks + start_radial + radial_task * 3; for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { diff --git a/include/DirectSolver/DirectSolverGive/directSolverGive.h b/include/DirectSolver/DirectSolverGive/directSolverGive.h index 3484e362..14a9cf01 100644 --- a/include/DirectSolver/DirectSolverGive/directSolverGive.h +++ b/include/DirectSolver/DirectSolverGive/directSolverGive.h @@ -9,7 +9,7 @@ template class DirectSolverGive : public DirectSolver { public: - explicit DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Note: The rhs (right-hand side) vector gets overwritten during the solution process. @@ -17,11 +17,11 @@ class DirectSolverGive : public DirectSolver private: #ifdef GMGPOLAR_USE_MUMPS - using SystemMatrix = SparseMatrixCOO; + using SystemMatrix = SparseMatrixCOO; using SystemSolver = CooMumpsSolver; #else - using SystemMatrix = SparseMatrixCSR; - using SystemSolver = SparseLUSolver; + using SystemMatrix = SparseMatrixCSR; + using SystemSolver = SparseLUSolver; // Stored only for the in-house solver (CSR). SystemMatrix system_matrix_; #endif @@ -40,9 +40,9 @@ class DirectSolverGive : public DirectSolver // symmetric_DBc(A) * solution = rhs - applySymmetryShift(rhs). // The correction modifies the rhs to account for the influence of the Dirichlet boundary conditions, // ensuring that the solution at the boundary is correctly adjusted and maintains the required symmetry. - void applySymmetryShift(HostVector rhs) const; - void applySymmetryShiftInnerBoundary(HostVector x) const; - void applySymmetryShiftOuterBoundary(HostVector x) const; + void applySymmetryShift(Vector rhs) const; + void applySymmetryShiftInnerBoundary(Vector x) const; + void applySymmetryShiftOuterBoundary(Vector x) const; }; #include "applySymmetryShift.inl" diff --git a/include/DirectSolver/DirectSolverGive/directSolverGive.inl b/include/DirectSolver/DirectSolverGive/directSolverGive.inl index c47bd658..09f5ca1e 100644 --- a/include/DirectSolver/DirectSolverGive/directSolverGive.inl +++ b/include/DirectSolver/DirectSolverGive/directSolverGive.inl @@ -1,7 +1,7 @@ #pragma once template -DirectSolverGive::DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, +DirectSolverGive::DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : DirectSolver(grid, level_cache, DirBC_Interior, num_omp_threads) #ifdef GMGPOLAR_USE_MUMPS @@ -14,8 +14,9 @@ DirectSolverGive::DirectSolverGive(const PolarGrid -void DirectSolverGive::solveInPlace(HostVector solution) +void DirectSolverGive::solveInPlace(HostVector h_solution) { + auto solution = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_solution); // Adjusts the right-hand side vector to account for symmetry corrections. // This transforms the system matrixA * solution = rhs into the equivalent system: // symmetric_DBc(matrixA) * solution = rhs - applySymmetryShift(rhs). @@ -24,4 +25,6 @@ void DirectSolverGive::solveInPlace(HostVector solution) applySymmetryShift(solution); // Solves the adjusted system symmetric(matrixA) * solution = rhs using the MUMPS solver. system_solver_.solveInPlace(solution); + + Kokkos::deep_copy(h_solution, solution); } diff --git a/include/DirectSolver/DirectSolverGive/matrixStencil.inl b/include/DirectSolver/DirectSolverGive/matrixStencil.inl index e966088a..b4bf0efa 100644 --- a/include/DirectSolver/DirectSolverGive/matrixStencil.inl +++ b/include/DirectSolver/DirectSolverGive/matrixStencil.inl @@ -3,7 +3,7 @@ namespace direct_solver_give { -static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) { int i_r, i_theta; grid.multiIndex(global_index, i_r, i_theta); @@ -33,7 +33,7 @@ static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGr Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { assert(0 <= i_r && i_r < grid.nr()); assert(grid.nr() >= 4); @@ -85,7 +85,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const Pol Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9; @@ -102,7 +102,7 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; @@ -182,7 +182,7 @@ static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) { // 1. Check each node: getSolverMatrixIndex == cumulative sum of prior stencil sizes for (int global_index = 0; global_index < grid.numberOfNodes(); ++global_index) { diff --git a/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl b/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl index 85d5eb9f..8c7422c7 100644 --- a/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl +++ b/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl @@ -5,9 +5,9 @@ /* ----------------------- */ template -void DirectSolverTake::applySymmetryShiftInnerBoundary(HostVector x) const +void DirectSolverTake::applySymmetryShiftInnerBoundary(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(DirectSolver::DirBC_Interior_); @@ -15,16 +15,16 @@ void DirectSolverTake::applySymmetryShiftInnerBoundary(HostVecto assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); const int i_r = 1; const int ntheta = grid.ntheta(); Kokkos::parallel_for( "DirectSolverTake: applySymmetryShiftInnerBoundary", - Kokkos::RangePolicy(0, ntheta), KOKKOS_LAMBDA(const int i_theta) { + Kokkos::RangePolicy(0, ntheta), KOKKOS_LAMBDA(const int i_theta) { const double h1 = grid.radialSpacing(i_r - 1); const double k1 = grid.angularSpacing(i_theta - 1); const double k2 = grid.angularSpacing(i_theta); @@ -50,24 +50,24 @@ void DirectSolverTake::applySymmetryShiftInnerBoundary(HostVecto } template -void DirectSolverTake::applySymmetryShiftOuterBoundary(HostVector x) const +void DirectSolverTake::applySymmetryShiftOuterBoundary(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); const int i_r = grid.nr() - 2; const int ntheta = grid.ntheta(); Kokkos::parallel_for( "DirectSolverTake: applySymmetryShiftOuterBoundary", - Kokkos::RangePolicy(0, ntheta), KOKKOS_LAMBDA(const int i_theta) { + Kokkos::RangePolicy(0, ntheta), KOKKOS_LAMBDA(const int i_theta) { const double h2 = grid.radialSpacing(i_r); const double k1 = grid.angularSpacing(i_theta - 1); const double k2 = grid.angularSpacing(i_theta); @@ -93,9 +93,9 @@ void DirectSolverTake::applySymmetryShiftOuterBoundary(HostVecto } template -void DirectSolverTake::applySymmetryShift(HostVector x) const +void DirectSolverTake::applySymmetryShift(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const bool DirBC_Interior = DirectSolver::DirBC_Interior_; assert(std::ssize(x) == grid.numberOfNodes()); @@ -108,4 +108,4 @@ void DirectSolverTake::applySymmetryShift(HostVector x) applySymmetryShiftOuterBoundary(x); Kokkos::fence(); -} \ No newline at end of file +} diff --git a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl index e81f07af..745fbfb9 100644 --- a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl @@ -7,7 +7,7 @@ namespace direct_solver_take #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. -static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, +static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, const int row, const int column, const double value) { @@ -17,7 +17,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, +static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, const int row, const int column, const double value) { @@ -28,10 +28,10 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR static KOKKOS_INLINE_FUNCTION void -nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, - const SystemMatrix& solver_matrix, HostConstVector& arr, HostConstVector& att, - HostConstVector& art, HostConstVector& detDF, - HostConstVector& coeff_beta) +nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, + const SystemMatrix& solver_matrix, ConstVector& arr, ConstVector& att, + ConstVector& art, ConstVector& detDF, + ConstVector& coeff_beta) { int ptr, offset; int row, column; @@ -483,7 +483,7 @@ typename DirectSolverTake::SystemMatrix DirectSolverTake& grid = DirectSolver::grid_; + const PolarGrid& grid = DirectSolver::grid_; const LevelCacheType& level_cache = DirectSolver::level_cache_; const bool DirBC_Interior = DirectSolver::DirBC_Interior_; @@ -493,24 +493,24 @@ typename DirectSolverTake::SystemMatrix DirectSolverTake solver_matrix(n, n, nnz); + SparseMatrixCOO solver_matrix(n, n, nnz); solver_matrix.is_symmetric(true); #else std::function nnz_per_row = [&](int global_index) { return getStencilSize(global_index, grid, DirBC_Interior); }; - SparseMatrixCSR solver_matrix(n, n, nnz_per_row); + SparseMatrixCSR solver_matrix(n, n, nnz_per_row); #endif assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); /* We split the loops into two regions to better respect the */ /* access patterns of the smoother and improve cache locality. */ @@ -518,7 +518,7 @@ typename DirectSolverTake::SystemMatrix DirectSolverTake>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {grid.numberSmootherCircles(), grid.ntheta()} // Ending point of the index space ), @@ -531,7 +531,7 @@ typename DirectSolverTake::SystemMatrix DirectSolverTake>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {grid.ntheta(), grid.nr()} // Ending point of the index space ), diff --git a/include/DirectSolver/DirectSolverTake/directSolverTake.h b/include/DirectSolver/DirectSolverTake/directSolverTake.h index 3ba0b835..7c638e11 100644 --- a/include/DirectSolver/DirectSolverTake/directSolverTake.h +++ b/include/DirectSolver/DirectSolverTake/directSolverTake.h @@ -9,7 +9,7 @@ template class DirectSolverTake : public DirectSolver { public: - explicit DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Note: The rhs (right-hand side) vector gets overwritten during the solution process. @@ -17,11 +17,11 @@ class DirectSolverTake : public DirectSolver private: #ifdef GMGPOLAR_USE_MUMPS - using SystemMatrix = SparseMatrixCOO; + using SystemMatrix = SparseMatrixCOO; using SystemSolver = CooMumpsSolver; #else - using SystemMatrix = SparseMatrixCSR; - using SystemSolver = SparseLUSolver; + using SystemMatrix = SparseMatrixCSR; + using SystemSolver = SparseLUSolver; // Stored only for the in-house solver (CSR). SystemMatrix system_matrix_; #endif @@ -40,9 +40,9 @@ class DirectSolverTake : public DirectSolver // symmetric_DBc(A) * solution = rhs - applySymmetryShift(rhs). // The correction modifies the rhs to account for the influence of the Dirichlet boundary conditions, // ensuring that the solution at the boundary is correctly adjusted and maintains the required symmetry. - void applySymmetryShift(HostVector rhs) const; - void applySymmetryShiftInnerBoundary(HostVector rhs) const; - void applySymmetryShiftOuterBoundary(HostVector rhs) const; + void applySymmetryShift(Vector rhs) const; + void applySymmetryShiftInnerBoundary(Vector rhs) const; + void applySymmetryShiftOuterBoundary(Vector rhs) const; }; #include "applySymmetryShift.inl" diff --git a/include/DirectSolver/DirectSolverTake/directSolverTake.inl b/include/DirectSolver/DirectSolverTake/directSolverTake.inl index 58f29a84..5f7ab9ac 100644 --- a/include/DirectSolver/DirectSolverTake/directSolverTake.inl +++ b/include/DirectSolver/DirectSolverTake/directSolverTake.inl @@ -1,7 +1,7 @@ #pragma once template -DirectSolverTake::DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, +DirectSolverTake::DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : DirectSolver(grid, level_cache, DirBC_Interior, num_omp_threads) #ifdef GMGPOLAR_USE_MUMPS @@ -14,8 +14,9 @@ DirectSolverTake::DirectSolverTake(const PolarGrid -void DirectSolverTake::solveInPlace(HostVector solution) +void DirectSolverTake::solveInPlace(HostVector h_solution) { + auto solution = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_solution); // Adjusts the right-hand side vector to account for symmetry corrections. // This transforms the system matrixA * solution = rhs into the equivalent system: // symmetric_DBc(matrixA) * solution = rhs - applySymmetryShift(rhs). @@ -24,4 +25,6 @@ void DirectSolverTake::solveInPlace(HostVector solution) applySymmetryShift(solution); // Solves the adjusted system symmetric(matrixA) * solution = rhs using the MUMPS solver. system_solver_.solveInPlace(solution); + + Kokkos::deep_copy(h_solution, solution); } diff --git a/include/DirectSolver/DirectSolverTake/matrixStencil.inl b/include/DirectSolver/DirectSolverTake/matrixStencil.inl index 18b80f1d..2566b1d8 100644 --- a/include/DirectSolver/DirectSolverTake/matrixStencil.inl +++ b/include/DirectSolver/DirectSolverTake/matrixStencil.inl @@ -3,7 +3,7 @@ namespace direct_solver_take { -static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) { int i_r, i_theta; grid.multiIndex(global_index, i_r, i_theta); @@ -31,7 +31,7 @@ static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGr } } -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { assert(0 <= i_r && i_r < grid.nr()); assert(grid.nr() >= 4); @@ -81,7 +81,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const Pol } } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9; @@ -98,7 +98,7 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; @@ -177,7 +177,7 @@ static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int } } -static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) { // 1. Check each node: getSolverMatrixIndex == cumulative sum of prior stencil sizes for (int global_index = 0; global_index < grid.numberOfNodes(); ++global_index) { @@ -206,4 +206,4 @@ static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid< return true; } -} // namespace direct_solver_take \ No newline at end of file +} // namespace direct_solver_take diff --git a/include/DirectSolver/directSolver.h b/include/DirectSolver/directSolver.h index 958c9c5c..04d8b366 100644 --- a/include/DirectSolver/directSolver.h +++ b/include/DirectSolver/directSolver.h @@ -26,7 +26,7 @@ template class DirectSolver { public: - explicit DirectSolver(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit DirectSolver(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : grid_(grid) , level_cache_(level_cache) @@ -41,7 +41,7 @@ class DirectSolver virtual void solveInPlace(HostVector solution) = 0; protected: - const PolarGrid& grid_; + const PolarGrid& grid_; const LevelCacheType& level_cache_; const bool DirBC_Interior_; const int num_omp_threads_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl index 5e732978..cd0c6c82 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl @@ -5,9 +5,9 @@ namespace extrapolated_smoother_give template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, +nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result) + ConstVector& x, ConstVector& rhs, Vector& result) { KOKKOS_ASSERT(i_r >= 0 && i_r < grid.numberSmootherCircles()); @@ -197,9 +197,9 @@ nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarG template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, +nodeApplyAscOrthoCircleGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result) + ConstVector& x, ConstVector& rhs, Vector& result) { KOKKOS_ASSERT(i_r >= 0 && i_r <= grid.numberSmootherCircles()); @@ -364,9 +364,9 @@ nodeApplyAscOrthoCircleGiveOutside(const int i_r, const int i_theta, const Polar template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, +nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result) + ConstVector& x, ConstVector& rhs, Vector& result) { KOKKOS_ASSERT(i_r >= grid.numberSmootherCircles() - 1 && i_r < grid.nr()); @@ -703,9 +703,9 @@ nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarG template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, +nodeApplyAscOrthoRadialGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result) + ConstVector& x, ConstVector& rhs, Vector& result) { KOKKOS_ASSERT(i_r >= grid.numberSmootherCircles() && i_r < grid.nr()); @@ -840,9 +840,9 @@ nodeApplyAscOrthoRadialGiveOutside(const int i_r, const int i_theta, const Polar } // namespace extrapolated_smoother_give template -void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(HostConstVector x, - HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(ConstVector x, + ConstVector rhs, + Vector temp) { using extrapolated_smoother_give::nodeApplyAscOrthoCircleGiveInside; using extrapolated_smoother_give::nodeApplyAscOrthoCircleGiveOutside; @@ -854,7 +854,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(H return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -870,7 +870,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (Black Circle - Inside)", - Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), + Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), KOKKOS_LAMBDA(const int circle_task) { const int i_r = start + circle_task * offset; // Serial loop to avoid race conditions @@ -889,7 +889,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (Black Circle - Outside: Part 1)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {getBatchCount(start, end, offset), grid.ntheta()} // Ending point of the index space ), @@ -909,7 +909,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (Black Circle - Outside: Part 2)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {getBatchCount(start, end, offset), grid.ntheta()} // Ending point of the index space ), @@ -924,9 +924,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(H } template -void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(HostConstVector x, - HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(ConstVector x, + ConstVector rhs, + Vector temp) { using extrapolated_smoother_give::nodeApplyAscOrthoCircleGiveInside; using extrapolated_smoother_give::nodeApplyAscOrthoCircleGiveOutside; @@ -938,7 +938,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(H return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -955,7 +955,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (White Circle - Inside)", - Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), + Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), KOKKOS_LAMBDA(const int circle_task) { const int i_r = start + circle_task * offset; // Serial loop to avoid race conditions @@ -974,7 +974,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (White Circle - Outside: Part 1)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {getBatchCount(start, end, offset), grid.ntheta()} // Ending point of the index space ), @@ -994,7 +994,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (White Circle - Outside: Part 2)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {getBatchCount(start, end, offset), grid.ntheta()} // Ending point of the index space ), @@ -1009,9 +1009,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(H } template -void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(HostConstVector x, - HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(ConstVector x, + ConstVector rhs, + Vector temp) { using extrapolated_smoother_give::nodeApplyAscOrthoRadialGiveInside; using extrapolated_smoother_give::nodeApplyAscOrthoRadialGiveOutside; @@ -1023,7 +1023,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(H return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -1040,7 +1040,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (Black Radial - Inside)", - Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), + Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = start + radial_task * offset; // Serial loop to avoid race conditions @@ -1059,7 +1059,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (Black Radial - Outside: Part 1)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {getBatchCount(start, end, offset), grid.nr()} // Ending point of the index space ), @@ -1079,7 +1079,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (Black Radial - Outside: Part 2)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {getBatchCount(start, end, offset), grid.nr()} // Ending point of the index space ), @@ -1094,9 +1094,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(H } template -void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(HostConstVector x, - HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(ConstVector x, + ConstVector rhs, + Vector temp) { using extrapolated_smoother_give::nodeApplyAscOrthoRadialGiveInside; using extrapolated_smoother_give::nodeApplyAscOrthoRadialGiveOutside; @@ -1108,7 +1108,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(H return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -1125,7 +1125,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (White Radial - Inside)", - Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), + Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = start + radial_task * offset; // Serial loop to avoid race conditions @@ -1144,7 +1144,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (White Radial - Outside: Part 1)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {getBatchCount(start, end, offset), grid.nr()} // Ending point of the index space ), @@ -1164,7 +1164,7 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(H Kokkos::parallel_for( "ExtrapolatedSmootherGive: ApplyAscOrtho (White Radial - Outside: Part 2)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {getBatchCount(start, end, offset), grid.nr()} // Ending point of the index space ), diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl index e5c8969e..018def1b 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl @@ -10,7 +10,7 @@ namespace extrapolated_smoother_give #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, +update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, const int row, const int column, const double value) { matrix.set_row_index(ptr + offset, row); @@ -20,7 +20,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCOO& m #else // When using the in-house solver, the matrix is stored in CSR format. static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, +update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, const int row, const int column, const double value) { matrix.set_row_nz_index(row, offset, column); @@ -30,7 +30,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& m template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) { using extrapolated_smoother_give::update_CSR_COO_MatrixElement; @@ -195,7 +195,7 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) { using extrapolated_smoother_give::update_CSR_COO_MatrixElement; @@ -270,7 +270,7 @@ ExtrapolatedSmootherGive::buildInteriorBoundarySolverMatrix() using extrapolated_smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_0; using extrapolated_smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_1; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -284,7 +284,7 @@ ExtrapolatedSmootherGive::buildInteriorBoundarySolverMatrix() // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS const int nnz = getNonZeroCountCircleAsc(0, grid, DirBC_Interior); - SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); + SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); #else std::function nnz_per_row = [&](int i_theta) { @@ -293,13 +293,13 @@ ExtrapolatedSmootherGive::buildInteriorBoundarySolverMatrix() else return i_theta % 2 == 0 ? 1 : 2; }; - SparseMatrixCSR inner_boundary_solver_matrix(ntheta, ntheta, nnz_per_row); + SparseMatrixCSR inner_boundary_solver_matrix(ntheta, ntheta, nnz_per_row); #endif { Kokkos::parallel_for( "ExtrapolatedSmootherGive: BuildInnerBoundaryMatrix", - Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { + Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { for (int i_theta = 0; i_theta < ntheta; i_theta++) { nodeBuildInteriorBoundarySolverMatrix_i_r_0(i_theta, grid, level_cache, DirBC_Interior, inner_boundary_solver_matrix); @@ -310,7 +310,7 @@ ExtrapolatedSmootherGive::buildInteriorBoundarySolverMatrix() { Kokkos::parallel_for( "ExtrapolatedSmootherGive: BuildInnerBoundaryMatrix", - Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { + Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { for (int i_theta = 0; i_theta < ntheta; i_theta++) { nodeBuildInteriorBoundarySolverMatrix_i_r_1(i_theta, grid, level_cache, DirBC_Interior, inner_boundary_solver_matrix); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl index 1baeed82..e5f91ffe 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl @@ -18,7 +18,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS template static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, +nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver) @@ -485,7 +485,7 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta template static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, +nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver) @@ -1090,7 +1090,7 @@ void ExtrapolatedSmootherGive::buildTridiagonalSolverMatrices() using extrapolated_smoother_give::nodeBuildTridiagonalSolverMatricesCircleSection; using extrapolated_smoother_give::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -1108,7 +1108,7 @@ void ExtrapolatedSmootherGive::buildTridiagonalSolverMatrices() const int num_circular_tasks = (num_circle_tasks - start_circle + 2) / 3; Kokkos::parallel_for( "SmootherGive: buildTridiagonalSolverMatrices (Circular)", - Kokkos::RangePolicy(0, num_circular_tasks), + Kokkos::RangePolicy(0, num_circular_tasks), KOKKOS_LAMBDA(const int circle_task) { const int i_r = start_circle + circle_task * 3; for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) { @@ -1133,7 +1133,7 @@ void ExtrapolatedSmootherGive::buildTridiagonalSolverMatrices() for (int i_theta = 0; i_theta < additional_radial_tasks; i_theta++) { Kokkos::parallel_for( "SmootherGive: buildTridiagonalSolverMatrices (Radial, additional)", - Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { + Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { nodeBuildTridiagonalSolverMatricesRadialSection(i_r, i_theta, grid, level_cache, DirBC_Interior, circle_tridiagonal_solver, @@ -1147,7 +1147,7 @@ void ExtrapolatedSmootherGive::buildTridiagonalSolverMatrices() const int num_radial_batches = (num_radial_tasks - start_radial + 2) / 3; Kokkos::parallel_for( "SmootherGive: buildTridiagonalSolverMatrices (Radial)", - Kokkos::RangePolicy(0, num_radial_batches), + Kokkos::RangePolicy(0, num_radial_batches), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = additional_radial_tasks + start_radial + radial_task * 3; for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h index a035e83c..04e5fc54 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h @@ -60,7 +60,7 @@ class ExtrapolatedSmootherGive : public ExtrapolatedSmoother public: // Constructs the coupled circle-radial extrapolated smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Performs one full coupled extrapolated smoothing sweep: @@ -96,11 +96,11 @@ class ExtrapolatedSmootherGive : public ExtrapolatedSmoother // - In-house: matrix stored in CSR; solver does not own the matrix. #ifdef GMGPOLAR_USE_MUMPS - using InnerBoundaryMatrix = SparseMatrixCOO; + using InnerBoundaryMatrix = SparseMatrixCOO; using InnerBoundarySolver = CooMumpsSolver; #else - using InnerBoundaryMatrix = SparseMatrixCSR; - using InnerBoundarySolver = SparseLUSolver; + using InnerBoundaryMatrix = SparseMatrixCSR; + using InnerBoundarySolver = SparseLUSolver; // Stored only for the in-house solver (CSR). InnerBoundaryMatrix inner_boundary_circle_matrix_; @@ -124,14 +124,14 @@ class ExtrapolatedSmootherGive : public ExtrapolatedSmoother // Compute temp = f_sc − A_sc^ortho * u_sc^ortho (precomputed right-hand side) // where x = u_sc and rhs = f_sc - void applyAscOrthoBlackCircleSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoWhiteCircleSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoBlackRadialSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoWhiteRadialSection(HostConstVector x, HostConstVector rhs, - HostVector temp); + void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, + Vector temp); /* ----------------- */ /* Line-wise solvers */ @@ -145,10 +145,10 @@ class ExtrapolatedSmootherGive : public ExtrapolatedSmoother // where: // s in {Circle, Radial} denotes the smoother section type, // c in {Black, White} denotes the line coloring. - void solveBlackCircleSection(HostVector x, HostVector temp); - void solveWhiteCircleSection(HostVector x, HostVector temp); - void solveBlackRadialSection(HostVector x, HostVector temp); - void solveWhiteRadialSection(HostVector x, HostVector temp); + void solveBlackCircleSection(Vector x, Vector temp); + void solveWhiteCircleSection(Vector x, Vector temp); + void solveBlackRadialSection(Vector x, Vector temp); + void solveWhiteRadialSection(Vector x, Vector temp); }; #include "extrapolatedSmootherGive.inl" diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl index 4df10e41..5be0ff03 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl @@ -1,7 +1,7 @@ #pragma once template -ExtrapolatedSmootherGive::ExtrapolatedSmootherGive(const PolarGrid& grid, +ExtrapolatedSmootherGive::ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads) : ExtrapolatedSmoother(grid, level_cache, DirBC_Interior, num_omp_threads) @@ -42,13 +42,17 @@ ExtrapolatedSmootherGive::ExtrapolatedSmootherGive(const PolarGr // - The system is then solved in-place in temp, and the results // are copied back to x. template -void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector x, HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector h_x, HostConstVector h_rhs, + HostVector h_temp) { + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); + assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; /* We split the loops into two regions to better respect the */ /* access patterns of the smoother and improve cache locality. */ @@ -56,7 +60,7 @@ void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector< // The For loop matches circular access pattern Kokkos::parallel_for( "ExtrapolatedSmootherGive: Init Temp (Circular)", - Kokkos::MDRangePolicy>( + Kokkos::MDRangePolicy>( {0, 0}, {grid.numberSmootherCircles(), grid.ntheta()}), KOKKOS_LAMBDA(const int i_r, const int i_theta) { const int index = grid.index(i_r, i_theta); @@ -66,7 +70,7 @@ void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector< // The For loop matches radial access pattern Kokkos::parallel_for( "ExtrapolatedSmootherGive: Init Temp (Radial)", - Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, + Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, {grid.ntheta(), grid.nr()}), KOKKOS_LAMBDA(const int i_theta, const int i_r) { const int index = grid.index(i_r, i_theta); @@ -86,4 +90,7 @@ void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector< applyAscOrthoWhiteRadialSection(x, rhs, temp); solveWhiteRadialSection(x, temp); + + Kokkos::deep_copy(h_x, x); + Kokkos::deep_copy(h_temp, temp); } diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl index c20fa2b9..497d0914 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl @@ -17,7 +17,7 @@ namespace extrapolated_smoother_give // - Non-zero matrix indicesare obtained via `ptr + offset` // - A offset value of `-1` means the position is not included in the stencil pattern. // - Other values (0, 1, 2, ..., stencil_size - 1) correspond to valid stencil indices. -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // clang-format off @@ -59,7 +59,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int } } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. @@ -83,7 +83,7 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const } } -static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. @@ -113,4 +113,4 @@ static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_t } } -} // namespace extrapolated_smoother_give \ No newline at end of file +} // namespace extrapolated_smoother_give diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl index 15bafc61..aaaad8c0 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl @@ -1,13 +1,13 @@ #pragma once template -void ExtrapolatedSmootherGive::solveBlackCircleSection(HostVector x, HostVector temp) +void ExtrapolatedSmootherGive::solveBlackCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = 0; int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); bool is_inner_circle_black = grid.numberSmootherCircles() % 2 != 0; @@ -24,7 +24,7 @@ void ExtrapolatedSmootherGive::solveBlackCircleSection(HostVecto circle_tridiagonal_solver_.solve_diagonal(circle_section, batch_offset, batch_stride); // Inner Boundary Solve - HostVector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); + Vector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); inner_boundary_solver_.solveInPlace(inner_boundary); } @@ -33,7 +33,7 @@ void ExtrapolatedSmootherGive::solveBlackCircleSection(HostVecto const int num_black_circles = (grid.numberSmootherCircles() - start_black_circles + 1) / 2; Kokkos::parallel_for( "ExtrapolatedSmootherGive: moveUpdatedValues (Black Circular)", - Kokkos::MDRangePolicy>({0, 0}, + Kokkos::MDRangePolicy>({0, 0}, {num_black_circles, grid.ntheta()}), KOKKOS_LAMBDA(const int circle_task, const int i_theta) { const int i_r = start_black_circles + circle_task * 2; @@ -44,13 +44,13 @@ void ExtrapolatedSmootherGive::solveBlackCircleSection(HostVecto } template -void ExtrapolatedSmootherGive::solveWhiteCircleSection(HostVector x, HostVector temp) +void ExtrapolatedSmootherGive::solveWhiteCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = 0; int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); bool is_inner_circle_white = grid.numberSmootherCircles() % 2 == 0; @@ -67,7 +67,7 @@ void ExtrapolatedSmootherGive::solveWhiteCircleSection(HostVecto circle_tridiagonal_solver_.solve_diagonal(circle_section, batch_offset, batch_stride); // Inner Boundary Solve - HostVector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); + Vector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); inner_boundary_solver_.solveInPlace(inner_boundary); } @@ -76,7 +76,7 @@ void ExtrapolatedSmootherGive::solveWhiteCircleSection(HostVecto const int num_white_circles = (grid.numberSmootherCircles() - start_white_circles + 1) / 2; Kokkos::parallel_for( "ExtrapolatedSmootherGive: moveUpdatedValues (White Circular)", - Kokkos::MDRangePolicy>({0, 0}, + Kokkos::MDRangePolicy>({0, 0}, {num_white_circles, grid.ntheta()}), KOKKOS_LAMBDA(const int circle_task, const int i_theta) { const int i_r = start_white_circles + circle_task * 2; @@ -87,13 +87,13 @@ void ExtrapolatedSmootherGive::solveWhiteCircleSection(HostVecto } template -void ExtrapolatedSmootherGive::solveBlackRadialSection(HostVector x, HostVector temp) +void ExtrapolatedSmootherGive::solveBlackRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Diagonal Solve int batch_offset = 0; @@ -106,7 +106,7 @@ void ExtrapolatedSmootherGive::solveBlackRadialSection(HostVecto const int num_black_radial_lines = grid.ntheta() / 2; Kokkos::parallel_for( "ExtrapolatedSmootherGive: moveUpdatedValues (Black Radial)", - Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, + Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, {num_black_radial_lines, grid.nr()}), KOKKOS_LAMBDA(const int radial_task, const int i_r) { const int i_theta = start_black_radials + radial_task * 2; @@ -117,13 +117,13 @@ void ExtrapolatedSmootherGive::solveBlackRadialSection(HostVecto } template -void ExtrapolatedSmootherGive::solveWhiteRadialSection(HostVector x, HostVector temp) +void ExtrapolatedSmootherGive::solveWhiteRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve int batch_offset = 1; @@ -136,7 +136,7 @@ void ExtrapolatedSmootherGive::solveWhiteRadialSection(HostVecto const int num_white_radial_lines = grid.ntheta() / 2; Kokkos::parallel_for( "ExtrapolatedSmootherGive: moveUpdatedValues (White Radial)", - Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, + Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, {num_white_radial_lines, grid.nr()}), KOKKOS_LAMBDA(const int radial_task, const int i_r) { const int i_theta = start_white_radials + radial_task * 2; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl index c220e259..c219c164 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl @@ -4,10 +4,10 @@ namespace extrapolated_smoother_take { static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result, - HostConstVector& arr, HostConstVector& att, HostConstVector& art, - HostConstVector& detDF, HostConstVector& coeff_beta) +nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, + ConstVector& x, ConstVector& rhs, Vector& result, + ConstVector& arr, ConstVector& att, ConstVector& art, + ConstVector& detDF, ConstVector& coeff_beta) { KOKKOS_ASSERT(i_r >= 0 && i_r <= grid.numberSmootherCircles()); @@ -186,11 +186,11 @@ nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result, - HostConstVector& arr, const HostConstVector& att, - HostConstVector& art, const HostConstVector& detDF, - HostConstVector& coeff_beta) +nodeApplyAscOrthoRadialTake(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, + ConstVector& x, ConstVector& rhs, Vector& result, + ConstVector& arr, const ConstVector& att, + ConstVector& art, const ConstVector& detDF, + ConstVector& coeff_beta) { assert(i_r >= grid.numberSmootherCircles() - 1 && i_r < grid.nr()); @@ -462,24 +462,24 @@ nodeApplyAscOrthoRadialTake(int i_r, int i_theta, const PolarGrid -void ExtrapolatedSmootherTake::applyAscOrthoBlackCircleSection(HostConstVector x, - HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherTake::applyAscOrthoBlackCircleSection(ConstVector x, + ConstVector rhs, + Vector temp) { using extrapolated_smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); /* The outer most circle next to the radial section is defined to be black. */ const int start_black_circles = (grid.numberSmootherCircles() % 2 == 0) ? 1 : 0; @@ -487,7 +487,7 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackCircleSection(H Kokkos::parallel_for( "ExtrapolatedSmootherTake: ApplyAscOrtho (Black Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {num_black_circles, grid.ntheta()} // Ending point of the index space ), @@ -502,13 +502,13 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackCircleSection(H } template -void ExtrapolatedSmootherTake::applyAscOrthoWhiteCircleSection(HostConstVector x, - HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherTake::applyAscOrthoWhiteCircleSection(ConstVector x, + ConstVector rhs, + Vector temp) { using extrapolated_smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const int num_omp_threads = ExtrapolatedSmoother::num_omp_threads_; @@ -516,11 +516,11 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteCircleSection(H assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); /* The outer most circle next to the radial section is defined to be black. */ const int start_white_circles = (grid.numberSmootherCircles() % 2 == 0) ? 0 : 1; @@ -528,7 +528,7 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteCircleSection(H Kokkos::parallel_for( "ExtrapolatedSmootherTake: ApplyAscOrtho (White Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {num_white_circles, grid.ntheta()} // Ending point of the index space ), @@ -543,13 +543,13 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteCircleSection(H } template -void ExtrapolatedSmootherTake::applyAscOrthoBlackRadialSection(HostConstVector x, - HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherTake::applyAscOrthoBlackRadialSection(ConstVector x, + ConstVector rhs, + Vector temp) { using extrapolated_smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const int num_omp_threads = ExtrapolatedSmoother::num_omp_threads_; @@ -557,11 +557,11 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackRadialSection(H assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); assert(grid.ntheta() % 2 == 0); const int start_black_radials = 0; @@ -569,7 +569,7 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackRadialSection(H Kokkos::parallel_for( "ExtrapolatedSmootherTake: ApplyAscOrtho (Black Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {num_black_radial_lines, grid.nr()} // Ending point of the index space ), @@ -584,13 +584,13 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackRadialSection(H } template -void ExtrapolatedSmootherTake::applyAscOrthoWhiteRadialSection(HostConstVector x, - HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherTake::applyAscOrthoWhiteRadialSection(ConstVector x, + ConstVector rhs, + Vector temp) { using extrapolated_smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const int num_omp_threads = ExtrapolatedSmoother::num_omp_threads_; @@ -598,11 +598,11 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteRadialSection(H assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); assert(grid.ntheta() % 2 == 0); const int start_white_radials = 1; @@ -610,7 +610,7 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteRadialSection(H Kokkos::parallel_for( "ExtrapolatedSmootherTake: ApplyAscOrtho (White Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {num_white_radial_lines, grid.nr()} // Ending point of the index space ), diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl index 90b12f96..26e958d4 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl @@ -8,7 +8,7 @@ namespace extrapolated_smoother_take #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, +update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, const int row, const int column, const double value) { matrix.set_row_index(ptr + offset, row); @@ -18,7 +18,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCOO& m #else // When using the in-house solver, the matrix is stored in CSR format. static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, +update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, const int row, const int column, const double value) { matrix.set_row_nz_index(row, offset, column); @@ -28,10 +28,10 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& m template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, - const InnerBoundaryMatrix& matrix, HostConstVector& arr, - HostConstVector& att, HostConstVector& art, - HostConstVector& detDF, HostConstVector& coeff_beta) +nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, + const InnerBoundaryMatrix& matrix, ConstVector& arr, + ConstVector& att, ConstVector& art, + ConstVector& detDF, ConstVector& coeff_beta) { using extrapolated_smoother_take::getCircleAscIndex; using extrapolated_smoother_take::getStencil; @@ -168,7 +168,7 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() using extrapolated_smoother_take::getNonZeroCountCircleAsc; using extrapolated_smoother_take::nodeBuildInteriorBoundarySolverMatrix; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; @@ -183,7 +183,7 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); - SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); + SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); #else std::function nnz_per_row = [&](int i_theta) { @@ -192,21 +192,21 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() else return i_theta % 2 == 0 ? 1 : 2; }; - SparseMatrixCSR inner_boundary_solver_matrix(ntheta, ntheta, nnz_per_row); + SparseMatrixCSR inner_boundary_solver_matrix(ntheta, ntheta, nnz_per_row); #endif assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); Kokkos::parallel_for( "ExtrapolatedSmootherTake: BuildInnerBoundaryMatrix", - Kokkos::RangePolicy(0, ntheta), KOKKOS_LAMBDA(const int i_theta) { + Kokkos::RangePolicy(0, ntheta), KOKKOS_LAMBDA(const int i_theta) { nodeBuildInteriorBoundarySolverMatrix(i_theta, grid, DirBC_Interior, inner_boundary_solver_matrix, arr, att, art, detDF, coeff_beta); }); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl index e00770fd..bb018738 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl @@ -15,11 +15,11 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS } static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesCircleSection( - const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, + const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, - const BatchedTridiagonalSolver& radial_tridiagonal_solver, HostConstVector& arr, - HostConstVector& att, HostConstVector& art, HostConstVector& detDF, - HostConstVector& coeff_beta) + const BatchedTridiagonalSolver& radial_tridiagonal_solver, ConstVector& arr, + ConstVector& att, ConstVector& art, ConstVector& detDF, + ConstVector& coeff_beta) { using extrapolated_smoother_take::updateMatrixElement; @@ -165,11 +165,11 @@ static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesCircleSecti } static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesRadialSection( - const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, + const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, - const BatchedTridiagonalSolver& radial_tridiagonal_solver, HostConstVector& arr, - HostConstVector& att, HostConstVector& art, HostConstVector& detDF, - HostConstVector& coeff_beta) + const BatchedTridiagonalSolver& radial_tridiagonal_solver, ConstVector& arr, + ConstVector& att, ConstVector& art, ConstVector& detDF, + ConstVector& coeff_beta) { using extrapolated_smoother_take::updateMatrixElement; @@ -535,18 +535,18 @@ void ExtrapolatedSmootherTake::buildTridiagonalSolverMatrices() using extrapolated_smoother_take::nodeBuildTridiagonalSolverMatricesCircleSection; using extrapolated_smoother_take::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); const BatchedTridiagonalSolver& circle_tridiagonal_solver = circle_tridiagonal_solver_; const BatchedTridiagonalSolver& radial_tridiagonal_solver = radial_tridiagonal_solver_; @@ -557,7 +557,7 @@ void ExtrapolatedSmootherTake::buildTridiagonalSolverMatrices() // The For loop matches circular access pattern */ Kokkos::parallel_for( "Extrapolated Smoother Take: Build Tridiagonal Matrices (Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {grid.numberSmootherCircles(), grid.ntheta()} // Ending point of the index space ), @@ -571,7 +571,7 @@ void ExtrapolatedSmootherTake::buildTridiagonalSolverMatrices() /* For loop matches radial access pattern */ Kokkos::parallel_for( "Extrapolated Smoother Take: Build Tridiagonal Matrices (Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {grid.ntheta(), grid.nr()} // Ending point of the index space ), diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h index 1e2b438c..4abf8739 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h @@ -60,7 +60,7 @@ class ExtrapolatedSmootherTake : public ExtrapolatedSmoother public: // Constructs the coupled circle-radial extrapolated smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Performs one full coupled extrapolated smoothing sweep: @@ -94,11 +94,11 @@ class ExtrapolatedSmootherTake : public ExtrapolatedSmoother // - In-house: matrix stored in CSR; solver does not own the matrix. #ifdef GMGPOLAR_USE_MUMPS - using InnerBoundaryMatrix = SparseMatrixCOO; + using InnerBoundaryMatrix = SparseMatrixCOO; using InnerBoundarySolver = CooMumpsSolver; #else - using InnerBoundaryMatrix = SparseMatrixCSR; - using InnerBoundarySolver = SparseLUSolver; + using InnerBoundaryMatrix = SparseMatrixCSR; + using InnerBoundarySolver = SparseLUSolver; // Stored only for the in-house solver (CSR). InnerBoundaryMatrix inner_boundary_circle_matrix_; @@ -123,14 +123,14 @@ class ExtrapolatedSmootherTake : public ExtrapolatedSmoother // Compute temp = f_sc − A_sc^ortho * u_sc^ortho (precomputed right-hand side) // where x = u_sc and rhs = f_sc - void applyAscOrthoBlackCircleSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoWhiteCircleSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoBlackRadialSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoWhiteRadialSection(HostConstVector x, HostConstVector rhs, - HostVector temp); + void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, + Vector temp); /* ----------------- */ /* Line-wise solvers */ @@ -144,10 +144,10 @@ class ExtrapolatedSmootherTake : public ExtrapolatedSmoother // where: // s in {Circle, Radial} denotes the smoother section type, // c in {Black, White} denotes the line coloring. - void solveBlackCircleSection(HostVector x, HostVector temp); - void solveWhiteCircleSection(HostVector x, HostVector temp); - void solveBlackRadialSection(HostVector x, HostVector temp); - void solveWhiteRadialSection(HostVector x, HostVector temp); + void solveBlackCircleSection(Vector x, Vector temp); + void solveWhiteCircleSection(Vector x, Vector temp); + void solveBlackRadialSection(Vector x, Vector temp); + void solveWhiteRadialSection(Vector x, Vector temp); }; #include "extrapolatedSmootherTake.inl" diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl index c1b755f9..fceb1421 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl @@ -1,7 +1,7 @@ #pragma once template -ExtrapolatedSmootherTake::ExtrapolatedSmootherTake(const PolarGrid& grid, +ExtrapolatedSmootherTake::ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads) : ExtrapolatedSmoother(grid, level_cache, DirBC_Interior, num_omp_threads) @@ -43,9 +43,13 @@ ExtrapolatedSmootherTake::ExtrapolatedSmootherTake(const PolarGr // are copied back to x. template -void ExtrapolatedSmootherTake::extrapolatedSmoothing(HostVector x, HostConstVector rhs, - HostVector temp) +void ExtrapolatedSmootherTake::extrapolatedSmoothing(HostVector h_x, HostConstVector h_rhs, + HostVector h_temp) { + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); + assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); @@ -60,4 +64,7 @@ void ExtrapolatedSmootherTake::extrapolatedSmoothing(HostVector< applyAscOrthoWhiteRadialSection(x, rhs, temp); solveWhiteRadialSection(x, temp); + + Kokkos::deep_copy(h_x, x); + Kokkos::deep_copy(h_temp, temp); } diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl index 50621ba1..985eaa76 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl @@ -17,7 +17,7 @@ namespace extrapolated_smoother_take // - Non-zero matrix indicesare obtained via `ptr + offset` // - A offset value of `-1` means the position is not included in the stencil pattern. // - Other values (0, 1, 2, ..., stencil_size - 1) correspond to valid stencil indices. -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // clang-format off @@ -59,7 +59,7 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int } } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. @@ -83,7 +83,7 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const } } -static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. @@ -113,4 +113,4 @@ static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_t } } -} // namespace extrapolated_smoother_take \ No newline at end of file +} // namespace extrapolated_smoother_take diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl index 426ced0a..73ee308a 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl @@ -1,13 +1,13 @@ #pragma once template -void ExtrapolatedSmootherTake::solveBlackCircleSection(HostVector x, HostVector temp) +void ExtrapolatedSmootherTake::solveBlackCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = 0; int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); bool is_inner_circle_black = grid.numberSmootherCircles() % 2 != 0; @@ -24,7 +24,7 @@ void ExtrapolatedSmootherTake::solveBlackCircleSection(HostVecto circle_tridiagonal_solver_.solve_diagonal(circle_section, batch_offset, batch_stride); // Inner Boundary Solve - HostVector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); + Vector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); inner_boundary_solver_.solveInPlace(inner_boundary); } @@ -33,7 +33,7 @@ void ExtrapolatedSmootherTake::solveBlackCircleSection(HostVecto const int num_black_circles = (grid.numberSmootherCircles() - start_black_circles + 1) / 2; Kokkos::parallel_for( "ExtrapolatedSmootherTake: moveUpdatedValues (Black Circular)", - Kokkos::MDRangePolicy>({0, 0}, + Kokkos::MDRangePolicy>({0, 0}, {num_black_circles, grid.ntheta()}), KOKKOS_LAMBDA(const int circle_task, const int i_theta) { const int i_r = start_black_circles + circle_task * 2; @@ -44,13 +44,13 @@ void ExtrapolatedSmootherTake::solveBlackCircleSection(HostVecto } template -void ExtrapolatedSmootherTake::solveWhiteCircleSection(HostVector x, HostVector temp) +void ExtrapolatedSmootherTake::solveWhiteCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = 0; int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); bool is_inner_circle_white = grid.numberSmootherCircles() % 2 == 0; @@ -67,7 +67,7 @@ void ExtrapolatedSmootherTake::solveWhiteCircleSection(HostVecto circle_tridiagonal_solver_.solve_diagonal(circle_section, batch_offset, batch_stride); // Inner Boundary Solve - HostVector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); + Vector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); inner_boundary_solver_.solveInPlace(inner_boundary); } @@ -76,7 +76,7 @@ void ExtrapolatedSmootherTake::solveWhiteCircleSection(HostVecto const int num_white_circles = (grid.numberSmootherCircles() - start_white_circles + 1) / 2; Kokkos::parallel_for( "ExtrapolatedSmootherTake: moveUpdatedValues (White Circular)", - Kokkos::MDRangePolicy>({0, 0}, + Kokkos::MDRangePolicy>({0, 0}, {num_white_circles, grid.ntheta()}), KOKKOS_LAMBDA(const int circle_task, const int i_theta) { const int i_r = start_white_circles + circle_task * 2; @@ -87,13 +87,13 @@ void ExtrapolatedSmootherTake::solveWhiteCircleSection(HostVecto } template -void ExtrapolatedSmootherTake::solveBlackRadialSection(HostVector x, HostVector temp) +void ExtrapolatedSmootherTake::solveBlackRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Diagonal Solve int batch_offset = 0; @@ -106,7 +106,7 @@ void ExtrapolatedSmootherTake::solveBlackRadialSection(HostVecto const int num_black_radial_lines = grid.ntheta() / 2; Kokkos::parallel_for( "ExtrapolatedSmootherTake: moveUpdatedValues (Black Radial)", - Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, + Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, {num_black_radial_lines, grid.nr()}), KOKKOS_LAMBDA(const int radial_task, const int i_r) { const int i_theta = start_black_radials + radial_task * 2; @@ -117,13 +117,13 @@ void ExtrapolatedSmootherTake::solveBlackRadialSection(HostVecto } template -void ExtrapolatedSmootherTake::solveWhiteRadialSection(HostVector x, HostVector temp) +void ExtrapolatedSmootherTake::solveWhiteRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve int batch_offset = 1; @@ -136,7 +136,7 @@ void ExtrapolatedSmootherTake::solveWhiteRadialSection(HostVecto const int num_white_radial_lines = grid.ntheta() / 2; Kokkos::parallel_for( "ExtrapolatedSmootherTake: moveUpdatedValues (White Radial)", - Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, + Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, {num_white_radial_lines, grid.nr()}), KOKKOS_LAMBDA(const int radial_task, const int i_r) { const int i_theta = start_white_radials + radial_task * 2; diff --git a/include/ExtrapolatedSmoother/extrapolatedSmoother.h b/include/ExtrapolatedSmoother/extrapolatedSmoother.h index 8e2355a8..b317624a 100644 --- a/include/ExtrapolatedSmoother/extrapolatedSmoother.h +++ b/include/ExtrapolatedSmoother/extrapolatedSmoother.h @@ -27,7 +27,7 @@ template class ExtrapolatedSmoother { public: - explicit ExtrapolatedSmoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit ExtrapolatedSmoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : grid_(grid) , level_cache_(level_cache) @@ -40,7 +40,7 @@ class ExtrapolatedSmoother virtual void extrapolatedSmoothing(HostVector x, HostConstVector rhs, HostVector temp) = 0; protected: - const PolarGrid& grid_; + const PolarGrid& grid_; const LevelCacheType& level_cache_; const bool DirBC_Interior_; const int num_omp_threads_; diff --git a/include/Residual/ResidualGive/applyAGive.inl b/include/Residual/ResidualGive/applyAGive.inl index cc809893..678c6412 100644 --- a/include/Residual/ResidualGive/applyAGive.inl +++ b/include/Residual/ResidualGive/applyAGive.inl @@ -3,9 +3,9 @@ namespace residual_give { template -static KOKKOS_INLINE_FUNCTION void node_apply_a_give(int i_r, int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION void node_apply_a_give(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, - HostVector& result, HostConstVector& x) + Vector& result, ConstVector& x) { /* ---------------------------------------- */ /* Compute or retrieve stencil coefficients */ @@ -195,11 +195,14 @@ static KOKKOS_INLINE_FUNCTION void node_apply_a_give(int i_r, int i_theta, const } // namespace residual_give template -void ResidualGive::applySystemOperator(HostVector result, HostConstVector x) const +void ResidualGive::applySystemOperator(HostVector h_result, HostConstVector h_x) const { + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); + assert(result.size() == x.size()); - const PolarGrid& grid = Residual::grid_; + const PolarGrid& grid = Residual::grid_; const LevelCacheType& level_cache = Residual::level_cache_; const bool DirBC_Interior = Residual::DirBC_Interior_; @@ -218,7 +221,7 @@ void ResidualGive::applySystemOperator(HostVector result const int num_circular_tasks = (num_circle_tasks - start_circle + 2) / 3; Kokkos::parallel_for( "ResidualGive: ApplyA (Circular)", - Kokkos::RangePolicy(0, num_circular_tasks), + Kokkos::RangePolicy(0, num_circular_tasks), KOKKOS_LAMBDA(const int circle_task) { const int i_r = start_circle + circle_task * 3; for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) { @@ -240,7 +243,7 @@ void ResidualGive::applySystemOperator(HostVector result for (int i_theta = 0; i_theta < additional_radial_tasks; i_theta++) { Kokkos::parallel_for( - "ResidualGive: ApplyA (Radial, additional)", Kokkos::RangePolicy(0, 1), + "ResidualGive: ApplyA (Radial, additional)", Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { node_apply_a_give(i_r, i_theta, grid, level_cache, DirBC_Interior, result, x); @@ -253,7 +256,7 @@ void ResidualGive::applySystemOperator(HostVector result const int num_radial_batches = (num_radial_tasks - start_radial + 2) / 3; Kokkos::parallel_for( "ResidualGive: ApplyA (Radial)", - Kokkos::RangePolicy(0, num_radial_batches), + Kokkos::RangePolicy(0, num_radial_batches), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = additional_radial_tasks + start_radial + radial_task * 3; for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { @@ -262,4 +265,6 @@ void ResidualGive::applySystemOperator(HostVector result }); Kokkos::fence(); } + + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/ResidualGive/residualGive.h b/include/Residual/ResidualGive/residualGive.h index 547a29b0..3c1b85f5 100644 --- a/include/Residual/ResidualGive/residualGive.h +++ b/include/Residual/ResidualGive/residualGive.h @@ -9,7 +9,7 @@ template class ResidualGive : public Residual { public: - explicit ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, + explicit ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads); ~ResidualGive() override = default; diff --git a/include/Residual/ResidualGive/residualGive.inl b/include/Residual/ResidualGive/residualGive.inl index 56b048c9..9f9458ca 100644 --- a/include/Residual/ResidualGive/residualGive.inl +++ b/include/Residual/ResidualGive/residualGive.inl @@ -1,7 +1,7 @@ #pragma once template -ResidualGive::ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, +ResidualGive::ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : Residual(grid, level_cache, DirBC_Interior, num_omp_threads) { @@ -10,12 +10,15 @@ ResidualGive::ResidualGive(const PolarGrid& g /* ------------------ */ /* result = rhs - A*x */ template -void ResidualGive::computeResidual(HostVector result, HostConstVector rhs, - HostConstVector x) const +void ResidualGive::computeResidual(HostVector h_result, HostConstVector h_rhs, + HostConstVector h_x) const { - assert(result.size() == x.size()); + assert(h_result.size() == h_x.size()); - applySystemOperator(result, x); + applySystemOperator(h_result, h_x); + + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); // Subtract A*x from rhs to get the residual. const int n = result.size(); @@ -25,4 +28,6 @@ void ResidualGive::computeResidual(HostVector result, Ho KOKKOS_LAMBDA(const int i) { result[i] = rhs[i] - result[i]; }); Kokkos::fence(); + + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/ResidualTake/applyATake.inl b/include/Residual/ResidualTake/applyATake.inl index 428b333c..e2f9bb0c 100644 --- a/include/Residual/ResidualTake/applyATake.inl +++ b/include/Residual/ResidualTake/applyATake.inl @@ -3,12 +3,12 @@ namespace residual_take { -static KOKKOS_INLINE_FUNCTION void node_apply_a_take(const int i_r, const int i_theta, const PolarGrid& grid, - bool DirBC_Interior, HostVector& result, - HostConstVector& x, HostConstVector& arr, - HostConstVector& att, HostConstVector& art, - HostConstVector& detDF, - HostConstVector& coeff_beta) +static KOKKOS_INLINE_FUNCTION void node_apply_a_take(const int i_r, const int i_theta, const PolarGrid& grid, + bool DirBC_Interior, Vector& result, + ConstVector& x, ConstVector& arr, + ConstVector& att, ConstVector& art, + ConstVector& detDF, + ConstVector& coeff_beta) { const int center = grid.index(i_r, i_theta); @@ -66,23 +66,26 @@ static KOKKOS_INLINE_FUNCTION void node_apply_a_take(const int i_r, const int i_ } // namespace residual_take template -void ResidualTake::applySystemOperator(HostVector result, HostConstVector x) const +void ResidualTake::applySystemOperator(HostVector h_result, HostConstVector h_x) const { - assert(result.size() == x.size()); - using residual_take::node_apply_a_take; - const PolarGrid& grid = Residual::grid_; + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); + + assert(result.size() == x.size()); + + const PolarGrid& grid = Residual::grid_; const bool DirBC_Interior = Residual::DirBC_Interior_; assert(Residual::level_cache_.cacheDensityProfileCoefficients()); assert(Residual::level_cache_.cacheDomainGeometry()); - HostConstVector arr = Residual::level_cache_.arr(); - HostConstVector att = Residual::level_cache_.att(); - HostConstVector art = Residual::level_cache_.art(); - HostConstVector detDF = Residual::level_cache_.detDF(); - HostConstVector coeff_beta = Residual::level_cache_.coeff_beta(); + ConstVector arr = Residual::level_cache_.arr(); + ConstVector att = Residual::level_cache_.att(); + ConstVector art = Residual::level_cache_.art(); + ConstVector detDF = Residual::level_cache_.detDF(); + ConstVector coeff_beta = Residual::level_cache_.coeff_beta(); /* We split the loops into two regions to better respect the */ /* access patterns of the smoother and improve cache locality. */ @@ -90,7 +93,7 @@ void ResidualTake::applySystemOperator(HostVector result // The For loop matches circular access pattern */ Kokkos::parallel_for( "Residual Take: Apply System Operator (Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {grid.numberSmootherCircles(), grid.ntheta()} // Ending point of the index space ), @@ -102,7 +105,7 @@ void ResidualTake::applySystemOperator(HostVector result /* For loop matches radial access pattern */ Kokkos::parallel_for( "Residual Take: Apply System Operator (Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {grid.ntheta(), grid.nr()} // Ending point of the index space ), @@ -112,4 +115,6 @@ void ResidualTake::applySystemOperator(HostVector result }); Kokkos::fence(); + + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/ResidualTake/residualTake.h b/include/Residual/ResidualTake/residualTake.h index 593b47cb..90f81558 100644 --- a/include/Residual/ResidualTake/residualTake.h +++ b/include/Residual/ResidualTake/residualTake.h @@ -9,7 +9,7 @@ template class ResidualTake : public Residual { public: - explicit ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, + explicit ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads); KOKKOS_DEFAULTED_FUNCTION ResidualTake(const ResidualTake&) = default; KOKKOS_DEFAULTED_FUNCTION ~ResidualTake() override = default; diff --git a/include/Residual/ResidualTake/residualTake.inl b/include/Residual/ResidualTake/residualTake.inl index b845295e..f511a0d1 100644 --- a/include/Residual/ResidualTake/residualTake.inl +++ b/include/Residual/ResidualTake/residualTake.inl @@ -1,7 +1,7 @@ #pragma once template -ResidualTake::ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, +ResidualTake::ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : Residual(grid, level_cache, DirBC_Interior, num_omp_threads) { @@ -10,12 +10,15 @@ ResidualTake::ResidualTake(const PolarGrid& g /* ------------------ */ /* result = rhs - A*x */ template -void ResidualTake::computeResidual(HostVector result, HostConstVector rhs, - HostConstVector x) const +void ResidualTake::computeResidual(HostVector h_result, HostConstVector h_rhs, + HostConstVector h_x) const { - assert(result.size() == x.size()); + assert(h_result.size() == h_x.size()); - applySystemOperator(result, x); + applySystemOperator(h_result, h_x); + + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); // Subtract A*x from rhs to get the residual. const int n = result.size(); @@ -25,4 +28,6 @@ void ResidualTake::computeResidual(HostVector result, Ho KOKKOS_LAMBDA(const int i) { result[i] = rhs[i] - result[i]; }); Kokkos::fence(); + + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/residual.h b/include/Residual/residual.h index 5364b424..ea93413b 100644 --- a/include/Residual/residual.h +++ b/include/Residual/residual.h @@ -16,7 +16,7 @@ template class Residual { public: - explicit Residual(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, + explicit Residual(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const int num_omp_threads) : grid_(grid) , level_cache_(level_cache) @@ -33,7 +33,7 @@ class Residual protected: /* ------------------- */ /* Constructor members */ - const PolarGrid grid_; + const PolarGrid grid_; const LevelCacheType level_cache_; const bool DirBC_Interior_; const int num_omp_threads_; diff --git a/include/Smoother/SmootherGive/applyAscOrtho.inl b/include/Smoother/SmootherGive/applyAscOrtho.inl index 46322976..b5d10aea 100644 --- a/include/Smoother/SmootherGive/applyAscOrtho.inl +++ b/include/Smoother/SmootherGive/applyAscOrtho.inl @@ -5,9 +5,9 @@ namespace smoother_give template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, - HostVector& result) +nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior, ConstVector& x, ConstVector& rhs, + Vector& result) { assert(i_r >= 0 && i_r < grid.numberSmootherCircles()); @@ -54,9 +54,9 @@ nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, - HostVector& result) +nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior, ConstVector& x, ConstVector& rhs, + Vector& result) { assert(0 <= i_r && i_r <= grid.numberSmootherCircles()); @@ -101,9 +101,9 @@ nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, - HostVector& result) +nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior, ConstVector& x, ConstVector& rhs, + Vector& result) { assert(grid.numberSmootherCircles() - 1 <= i_r && i_r < grid.nr()); @@ -179,9 +179,9 @@ nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior, HostConstVector& x, HostConstVector& rhs, - HostVector& result) +nodeApplyAscOrthoRadialGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior, ConstVector& x, ConstVector& rhs, + Vector& result) { assert(grid.numberSmootherCircles() <= i_r && i_r < grid.nr()); @@ -226,8 +226,8 @@ nodeApplyAscOrthoRadialGiveOutside(int i_r, int i_theta, const PolarGrid -void SmootherGive::applyAscOrthoBlackCircleSection(HostConstVector x, - HostConstVector rhs, HostVector temp) +void SmootherGive::applyAscOrthoBlackCircleSection(ConstVector x, + ConstVector rhs, Vector temp) { using smoother_give::nodeApplyAscOrthoCircleGiveInside; using smoother_give::nodeApplyAscOrthoCircleGiveOutside; @@ -239,7 +239,7 @@ void SmootherGive::applyAscOrthoBlackCircleSection(HostConstVect return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -255,7 +255,7 @@ void SmootherGive::applyAscOrthoBlackCircleSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (Black Circle - Inside)", - Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), + Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), KOKKOS_LAMBDA(const int circle_task) { const int i_r = start + circle_task * offset; // Serial loop to avoid race conditions @@ -274,7 +274,7 @@ void SmootherGive::applyAscOrthoBlackCircleSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (Black Circle - Outside: Part 1)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {getBatchCount(start, end, offset), grid.ntheta()} // Ending point of the index space ), @@ -294,7 +294,7 @@ void SmootherGive::applyAscOrthoBlackCircleSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (Black Circle - Outside: Part 2)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {getBatchCount(start, end, offset), grid.ntheta()} // Ending point of the index space ), @@ -309,8 +309,8 @@ void SmootherGive::applyAscOrthoBlackCircleSection(HostConstVect } template -void SmootherGive::applyAscOrthoWhiteCircleSection(HostConstVector x, - HostConstVector rhs, HostVector temp) +void SmootherGive::applyAscOrthoWhiteCircleSection(ConstVector x, + ConstVector rhs, Vector temp) { using smoother_give::nodeApplyAscOrthoCircleGiveInside; using smoother_give::nodeApplyAscOrthoCircleGiveOutside; @@ -322,7 +322,7 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(HostConstVect return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -339,7 +339,7 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (White Circle - Inside)", - Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), + Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), KOKKOS_LAMBDA(const int circle_task) { const int i_r = start + circle_task * offset; // Serial loop to avoid race conditions @@ -358,7 +358,7 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (White Circle - Outside: Part 1)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {getBatchCount(start, end, offset), grid.ntheta()} // Ending point of the index space ), @@ -378,7 +378,7 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (White Circle - Outside: Part 2)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {getBatchCount(start, end, offset), grid.ntheta()} // Ending point of the index space ), @@ -393,8 +393,8 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(HostConstVect } template -void SmootherGive::applyAscOrthoBlackRadialSection(HostConstVector x, - HostConstVector rhs, HostVector temp) +void SmootherGive::applyAscOrthoBlackRadialSection(ConstVector x, + ConstVector rhs, Vector temp) { using smoother_give::nodeApplyAscOrthoRadialGiveInside; using smoother_give::nodeApplyAscOrthoRadialGiveOutside; @@ -406,7 +406,7 @@ void SmootherGive::applyAscOrthoBlackRadialSection(HostConstVect return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -423,7 +423,7 @@ void SmootherGive::applyAscOrthoBlackRadialSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (Black Radial - Inside)", - Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), + Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = start + radial_task * offset; // Serial loop to avoid race conditions @@ -442,7 +442,7 @@ void SmootherGive::applyAscOrthoBlackRadialSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (Black Radial - Outside: Part 1)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {getBatchCount(start, end, offset), grid.nr()} // Ending point of the index space ), @@ -462,7 +462,7 @@ void SmootherGive::applyAscOrthoBlackRadialSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (Black Radial - Outside: Part 2)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {getBatchCount(start, end, offset), grid.nr()} // Ending point of the index space ), @@ -477,8 +477,8 @@ void SmootherGive::applyAscOrthoBlackRadialSection(HostConstVect } template -void SmootherGive::applyAscOrthoWhiteRadialSection(HostConstVector x, - HostConstVector rhs, HostVector temp) +void SmootherGive::applyAscOrthoWhiteRadialSection(ConstVector x, + ConstVector rhs, Vector temp) { using smoother_give::nodeApplyAscOrthoRadialGiveInside; using smoother_give::nodeApplyAscOrthoRadialGiveOutside; @@ -490,7 +490,7 @@ void SmootherGive::applyAscOrthoWhiteRadialSection(HostConstVect return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -507,7 +507,7 @@ void SmootherGive::applyAscOrthoWhiteRadialSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (White Radial - Inside)", - Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), + Kokkos::RangePolicy(0, getBatchCount(start, end, offset)), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = start + radial_task * offset; // Serial loop to avoid race conditions @@ -526,7 +526,7 @@ void SmootherGive::applyAscOrthoWhiteRadialSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (White Radial - Outside: Part 1)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {getBatchCount(start, end, offset), grid.nr()} // Ending point of the index space ), @@ -546,7 +546,7 @@ void SmootherGive::applyAscOrthoWhiteRadialSection(HostConstVect Kokkos::parallel_for( "SmootherGive: ApplyAscOrtho (White Radial - Outside: Part 2)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {getBatchCount(start, end, offset), grid.nr()} // Ending point of the index space ), diff --git a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl index bed749a2..cf55089e 100644 --- a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl @@ -8,7 +8,7 @@ namespace smoother_give #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, +update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, const int row, const int column, const double value) { matrix.set_row_index(ptr + offset, row); @@ -18,7 +18,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCOO& m #else // When using the in-house solver, the matrix is stored in CSR format. static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, +update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, const int row, const int column, const double value) { matrix.set_row_nz_index(row, offset, column); @@ -28,7 +28,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& m template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) { using smoother_give::getCircleAscIndex; @@ -200,7 +200,7 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, +nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) { using smoother_give::getCircleAscIndex; @@ -261,7 +261,7 @@ SmootherGive::buildInteriorBoundarySolverMatrix() using smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_0; using smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_1; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -276,19 +276,19 @@ SmootherGive::buildInteriorBoundarySolverMatrix() // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); - SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); + SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); #else // The stencils size for the inner boundary matrix is either 1 (Dirichlet BC) or 4 (across-origin discretization). std::function nnz_per_row = [&](int i_theta) { return DirBC_Interior ? 1 : 4; }; - SparseMatrixCSR inner_boundary_solver_matrix(ntheta, ntheta, nnz_per_row); + SparseMatrixCSR inner_boundary_solver_matrix(ntheta, ntheta, nnz_per_row); #endif { Kokkos::parallel_for( - "SmootherGive: BuildInnerBoundaryMatrix", Kokkos::RangePolicy(0, 1), + "SmootherGive: BuildInnerBoundaryMatrix", Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { for (int i_theta = 0; i_theta < ntheta; i_theta++) { nodeBuildInteriorBoundarySolverMatrix_i_r_0(i_theta, grid, level_cache, DirBC_Interior, @@ -299,7 +299,7 @@ SmootherGive::buildInteriorBoundarySolverMatrix() } { Kokkos::parallel_for( - "SmootherGive: BuildInnerBoundaryMatrix", Kokkos::RangePolicy(0, 1), + "SmootherGive: BuildInnerBoundaryMatrix", Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { for (int i_theta = 0; i_theta < ntheta; i_theta++) { nodeBuildInteriorBoundarySolverMatrix_i_r_1(i_theta, grid, level_cache, DirBC_Interior, diff --git a/include/Smoother/SmootherGive/buildTridiagonalAsc.inl b/include/Smoother/SmootherGive/buildTridiagonalAsc.inl index 4dd1037c..b2617303 100644 --- a/include/Smoother/SmootherGive/buildTridiagonalAsc.inl +++ b/include/Smoother/SmootherGive/buildTridiagonalAsc.inl @@ -16,7 +16,7 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS template static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, +nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver) @@ -192,7 +192,7 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta template static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, +nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver) @@ -520,7 +520,7 @@ void SmootherGive::buildTridiagonalSolverMatrices() using smoother_give::nodeBuildTridiagonalSolverMatricesCircleSection; using smoother_give::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; @@ -538,7 +538,7 @@ void SmootherGive::buildTridiagonalSolverMatrices() const int num_circular_tasks = (num_circle_tasks - start_circle + 2) / 3; Kokkos::parallel_for( "SmootherGive: buildTridiagonalSolverMatrices (Circular)", - Kokkos::RangePolicy(0, num_circular_tasks), + Kokkos::RangePolicy(0, num_circular_tasks), KOKKOS_LAMBDA(const int circle_task) { const int i_r = start_circle + circle_task * 3; for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) { @@ -563,7 +563,7 @@ void SmootherGive::buildTridiagonalSolverMatrices() for (int i_theta = 0; i_theta < additional_radial_tasks; i_theta++) { Kokkos::parallel_for( "SmootherGive: buildTridiagonalSolverMatrices (Radial, additional)", - Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { + Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { nodeBuildTridiagonalSolverMatricesRadialSection(i_r, i_theta, grid, level_cache, DirBC_Interior, circle_tridiagonal_solver, @@ -577,7 +577,7 @@ void SmootherGive::buildTridiagonalSolverMatrices() const int num_radial_batches = (num_radial_tasks - start_radial + 2) / 3; Kokkos::parallel_for( "SmootherGive: buildTridiagonalSolverMatrices (Radial)", - Kokkos::RangePolicy(0, num_radial_batches), + Kokkos::RangePolicy(0, num_radial_batches), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = additional_radial_tasks + start_radial + radial_task * 3; for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { diff --git a/include/Smoother/SmootherGive/smootherGive.h b/include/Smoother/SmootherGive/smootherGive.h index 9d3a7aa5..88d2155a 100644 --- a/include/Smoother/SmootherGive/smootherGive.h +++ b/include/Smoother/SmootherGive/smootherGive.h @@ -53,7 +53,7 @@ class SmootherGive : public Smoother public: // Constructs the coupled circle-radial smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); // Performs one full coupled smoothing sweep: @@ -89,11 +89,11 @@ class SmootherGive : public Smoother // - In-house: matrix stored in CSR; solver does not own the matrix. #ifdef GMGPOLAR_USE_MUMPS - using InnerBoundaryMatrix = SparseMatrixCOO; + using InnerBoundaryMatrix = SparseMatrixCOO; using InnerBoundarySolver = CooMumpsSolver; #else - using InnerBoundaryMatrix = SparseMatrixCSR; - using InnerBoundarySolver = SparseLUSolver; + using InnerBoundaryMatrix = SparseMatrixCSR; + using InnerBoundarySolver = SparseLUSolver; // Stored only for the in-house solver (CSR). InnerBoundaryMatrix inner_boundary_circle_matrix_; @@ -117,14 +117,14 @@ class SmootherGive : public Smoother // Compute temp = f_sc − A_sc^ortho * u_sc^ortho (precomputed right-hand side) // where x = u_sc and rhs = f_sc - void applyAscOrthoBlackCircleSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoWhiteCircleSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoBlackRadialSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoWhiteRadialSection(HostConstVector x, HostConstVector rhs, - HostVector temp); + void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, + Vector temp); /* ----------------- */ /* Line-wise solvers */ @@ -138,10 +138,10 @@ class SmootherGive : public Smoother // where: // s in {Circle, Radial} denotes the smoother section type, // c in {Black, White} denotes the line coloring. - void solveBlackCircleSection(HostVector x, HostVector temp); - void solveWhiteCircleSection(HostVector x, HostVector temp); - void solveBlackRadialSection(HostVector x, HostVector temp); - void solveWhiteRadialSection(HostVector x, HostVector temp); + void solveBlackCircleSection(Vector x, Vector temp); + void solveWhiteCircleSection(Vector x, Vector temp); + void solveBlackRadialSection(Vector x, Vector temp); + void solveWhiteRadialSection(Vector x, Vector temp); }; #include "smootherGive.inl" diff --git a/include/Smoother/SmootherGive/smootherGive.inl b/include/Smoother/SmootherGive/smootherGive.inl index 17d479ef..82e48e12 100644 --- a/include/Smoother/SmootherGive/smootherGive.inl +++ b/include/Smoother/SmootherGive/smootherGive.inl @@ -1,7 +1,7 @@ #pragma once template -SmootherGive::SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, +SmootherGive::SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : Smoother(grid, level_cache, DirBC_Interior, num_omp_threads) , circle_tridiagonal_solver_(grid.ntheta(), grid.numberSmootherCircles(), true) @@ -41,8 +41,12 @@ SmootherGive::SmootherGive(const PolarGrid& g // - The system is then solved in-place in temp, and the results // are copied back to x. template -void SmootherGive::smoothing(HostVector x, HostConstVector rhs, HostVector temp) +void SmootherGive::smoothing(HostVector h_x, HostConstVector h_rhs, HostVector h_temp) { + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); + assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); @@ -59,4 +63,7 @@ void SmootherGive::smoothing(HostVector x, HostConstVect applyAscOrthoWhiteRadialSection(x, rhs, temp); solveWhiteRadialSection(x, temp); + + Kokkos::deep_copy(h_x, x); + Kokkos::deep_copy(h_temp, temp); } diff --git a/include/Smoother/SmootherGive/solveAscSystem.inl b/include/Smoother/SmootherGive/solveAscSystem.inl index 176b4cc5..ad69f2b2 100644 --- a/include/Smoother/SmootherGive/solveAscSystem.inl +++ b/include/Smoother/SmootherGive/solveAscSystem.inl @@ -1,14 +1,14 @@ #pragma once template -void SmootherGive::solveBlackCircleSection(HostVector x, HostVector temp) +void SmootherGive::solveBlackCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; const int start = 0; const int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); const bool is_inner_circle_black = grid.numberSmootherCircles() % 2 != 0; @@ -19,7 +19,7 @@ void SmootherGive::solveBlackCircleSection(HostVector x, // Inner Boundary Solve if (is_inner_circle_black) { - HostVector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); + Vector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); inner_boundary_solver_.solveInPlace(inner_boundary); } @@ -28,7 +28,7 @@ void SmootherGive::solveBlackCircleSection(HostVector x, const int num_black_circles = (grid.numberSmootherCircles() - start_black_circles + 1) / 2; Kokkos::parallel_for( "SmootherGive: moveUpdatedValues (Black Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {num_black_circles, grid.ntheta()} // Ending point of the index space ), @@ -42,14 +42,14 @@ void SmootherGive::solveBlackCircleSection(HostVector x, } template -void SmootherGive::solveWhiteCircleSection(HostVector x, HostVector temp) +void SmootherGive::solveWhiteCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; const int start = 0; const int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); const bool is_inner_circle_white = grid.numberSmootherCircles() % 2 == 0; @@ -60,7 +60,7 @@ void SmootherGive::solveWhiteCircleSection(HostVector x, // Inner Boundary Solve if (is_inner_circle_white) { - HostVector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); + Vector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); inner_boundary_solver_.solveInPlace(inner_boundary); } @@ -69,7 +69,7 @@ void SmootherGive::solveWhiteCircleSection(HostVector x, const int num_white_circles = (grid.numberSmootherCircles() - start_white_circles + 1) / 2; Kokkos::parallel_for( "SmootherGive: moveUpdatedValues (White Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {num_white_circles, grid.ntheta()} // Ending point of the index space ), @@ -83,14 +83,14 @@ void SmootherGive::solveWhiteCircleSection(HostVector x, } template -void SmootherGive::solveBlackRadialSection(HostVector x, HostVector temp) +void SmootherGive::solveBlackRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; const int start = grid.numberCircularSmootherNodes(); const int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve const int batch_offset = 0; @@ -103,7 +103,7 @@ void SmootherGive::solveBlackRadialSection(HostVector x, const int num_black_radial_lines = grid.ntheta() / 2; Kokkos::parallel_for( "SmootherGive: moveUpdatedValues (Black Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {num_black_radial_lines, grid.nr()} // Ending point of the index space ), @@ -117,14 +117,14 @@ void SmootherGive::solveBlackRadialSection(HostVector x, } template -void SmootherGive::solveWhiteRadialSection(HostVector x, HostVector temp) +void SmootherGive::solveWhiteRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; const int start = grid.numberCircularSmootherNodes(); const int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve const int batch_offset = 1; @@ -137,7 +137,7 @@ void SmootherGive::solveWhiteRadialSection(HostVector x, const int num_white_radial_lines = grid.ntheta() / 2; Kokkos::parallel_for( "SmootherGive: moveUpdatedValues (White Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {num_white_radial_lines, grid.nr()} // Ending point of the index space ), diff --git a/include/Smoother/SmootherTake/applyAscOrtho.inl b/include/Smoother/SmootherTake/applyAscOrtho.inl index e91ff5e8..9717c74e 100644 --- a/include/Smoother/SmootherTake/applyAscOrtho.inl +++ b/include/Smoother/SmootherTake/applyAscOrtho.inl @@ -4,10 +4,10 @@ namespace smoother_take { static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result, - HostConstVector& arr, HostConstVector& att, HostConstVector& art, - HostConstVector& detDF, HostConstVector& coeff_beta) +nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, + ConstVector& x, ConstVector& rhs, Vector& result, + ConstVector& arr, ConstVector& att, ConstVector& art, + ConstVector& detDF, ConstVector& coeff_beta) { KOKKOS_ASSERT(i_r >= 0 && i_r < grid.numberSmootherCircles()); @@ -56,11 +56,11 @@ nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result, - HostConstVector& arr, const HostConstVector& att, - HostConstVector& art, const HostConstVector& detDF, - HostConstVector& coeff_beta) +nodeApplyAscOrthoRadialTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, + ConstVector& x, ConstVector& rhs, Vector& result, + ConstVector& arr, const ConstVector& att, + ConstVector& art, const ConstVector& detDF, + ConstVector& coeff_beta) { KOKKOS_ASSERT(i_r >= grid.numberSmootherCircles() && i_r < grid.nr()); @@ -118,23 +118,23 @@ nodeApplyAscOrthoRadialTake(const int i_r, const int i_theta, const PolarGrid -void SmootherTake::applyAscOrthoBlackCircleSection(HostConstVector x, - HostConstVector rhs, HostVector temp) +void SmootherTake::applyAscOrthoBlackCircleSection(ConstVector x, + ConstVector rhs, Vector temp) { using smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); /* The outer most circle next to the radial section is defined to be black. */ const int start_black_circles = (grid.numberSmootherCircles() % 2 == 0) ? 1 : 0; @@ -142,7 +142,7 @@ void SmootherTake::applyAscOrthoBlackCircleSection(HostConstVect Kokkos::parallel_for( "Smoother Take: ApplyAscOrtho (Black Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {num_black_circles, grid.ntheta()} // Ending point of the index space ), @@ -157,23 +157,23 @@ void SmootherTake::applyAscOrthoBlackCircleSection(HostConstVect } template -void SmootherTake::applyAscOrthoWhiteCircleSection(HostConstVector x, - HostConstVector rhs, HostVector temp) +void SmootherTake::applyAscOrthoWhiteCircleSection(ConstVector x, + ConstVector rhs, Vector temp) { using smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); /* The outer most circle next to the radial section is defined to be black. */ const int start_white_circles = (grid.numberSmootherCircles() % 2 == 0) ? 0 : 1; @@ -181,7 +181,7 @@ void SmootherTake::applyAscOrthoWhiteCircleSection(HostConstVect Kokkos::parallel_for( "Smoother Take: ApplyAscOrtho (White Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {num_white_circles, grid.ntheta()} // Ending point of the index space ), @@ -196,23 +196,23 @@ void SmootherTake::applyAscOrthoWhiteCircleSection(HostConstVect } template -void SmootherTake::applyAscOrthoBlackRadialSection(HostConstVector x, - HostConstVector rhs, HostVector temp) +void SmootherTake::applyAscOrthoBlackRadialSection(ConstVector x, + ConstVector rhs, Vector temp) { using smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); assert(grid.ntheta() % 2 == 0); const int start_black_radials = 0; @@ -220,7 +220,7 @@ void SmootherTake::applyAscOrthoBlackRadialSection(HostConstVect Kokkos::parallel_for( "Smoother Take: ApplyAscOrtho (Black Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {num_black_radial_lines, grid.nr()} // Ending point of the index space ), @@ -235,23 +235,23 @@ void SmootherTake::applyAscOrthoBlackRadialSection(HostConstVect } template -void SmootherTake::applyAscOrthoWhiteRadialSection(HostConstVector x, - HostConstVector rhs, HostVector temp) +void SmootherTake::applyAscOrthoWhiteRadialSection(ConstVector x, + ConstVector rhs, Vector temp) { using smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); assert(grid.ntheta() % 2 == 0); const int start_white_radials = 1; @@ -259,7 +259,7 @@ void SmootherTake::applyAscOrthoWhiteRadialSection(HostConstVect Kokkos::parallel_for( "Smoother Take: ApplyAscOrtho (White Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {num_white_radial_lines, grid.nr()} // Ending point of the index space ), diff --git a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl index d86be0c7..1cbcda14 100644 --- a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl @@ -8,7 +8,7 @@ namespace smoother_take #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, int ptr, int offset, int row, +update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, int ptr, int offset, int row, int column, double value) { matrix.set_row_index(ptr + offset, row); @@ -18,7 +18,7 @@ update_CSR_COO_MatrixElement(const SparseMatrixCOO& m #else // When using the in-house solver, the matrix is stored in CSR format. static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, int ptr, int offset, int row, +update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, int ptr, int offset, int row, int column, double value) { matrix.set_row_nz_index(row, offset, column); @@ -28,10 +28,10 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& m template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, bool DirBC_Interior, - const InnerBoundaryMatrix& matrix, HostConstVector& arr, - HostConstVector& att, HostConstVector& art, - HostConstVector& detDF, HostConstVector& coeff_beta) +nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, bool DirBC_Interior, + const InnerBoundaryMatrix& matrix, ConstVector& arr, + ConstVector& att, ConstVector& art, + ConstVector& detDF, ConstVector& coeff_beta) { using smoother_take::getCircleAscIndex; using smoother_take::getStencil; @@ -146,7 +146,7 @@ SmootherTake::buildInteriorBoundarySolverMatrix() using smoother_take::getNonZeroCountCircleAsc; using smoother_take::nodeBuildInteriorBoundarySolverMatrix; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; const int num_omp_threads = Smoother::num_omp_threads_; @@ -162,27 +162,27 @@ SmootherTake::buildInteriorBoundarySolverMatrix() // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); - SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); + SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); #else // The stencils size for the inner boundary matrix is either 1 (Dirichlet BC) or 4 (across-origin discretization). std::function nnz_per_row = [&](int i_theta) { return DirBC_Interior ? 1 : 4; }; - SparseMatrixCSR inner_boundary_solver_matrix(ntheta, ntheta, nnz_per_row); + SparseMatrixCSR inner_boundary_solver_matrix(ntheta, ntheta, nnz_per_row); #endif assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); Kokkos::parallel_for( - "SmootherTake: BuildInnerBoundaryMatrix", Kokkos::RangePolicy(0, ntheta), + "SmootherTake: BuildInnerBoundaryMatrix", Kokkos::RangePolicy(0, ntheta), KOKKOS_LAMBDA(const int i_theta) { nodeBuildInteriorBoundarySolverMatrix(i_theta, grid, DirBC_Interior, inner_boundary_solver_matrix, arr, att, art, detDF, coeff_beta); diff --git a/include/Smoother/SmootherTake/buildTridiagonalAsc.inl b/include/Smoother/SmootherTake/buildTridiagonalAsc.inl index a39f4e06..72e08927 100644 --- a/include/Smoother/SmootherTake/buildTridiagonalAsc.inl +++ b/include/Smoother/SmootherTake/buildTridiagonalAsc.inl @@ -15,12 +15,12 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS } static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatrices(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, +nodeBuildTridiagonalSolverMatrices(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver, - HostConstVector& arr, HostConstVector& att, - HostConstVector& art, HostConstVector& detDF, - HostConstVector& coeff_beta) + ConstVector& arr, ConstVector& att, + ConstVector& art, ConstVector& detDF, + ConstVector& coeff_beta) { using smoother_take::updateMatrixElement; @@ -190,18 +190,18 @@ void SmootherTake::buildTridiagonalSolverMatrices() { using smoother_take::nodeBuildTridiagonalSolverMatrices; - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); - HostConstVector arr = level_cache.arr(); - HostConstVector att = level_cache.att(); - HostConstVector art = level_cache.art(); - HostConstVector detDF = level_cache.detDF(); - HostConstVector coeff_beta = level_cache.coeff_beta(); + ConstVector arr = level_cache.arr(); + ConstVector att = level_cache.att(); + ConstVector art = level_cache.art(); + ConstVector detDF = level_cache.detDF(); + ConstVector coeff_beta = level_cache.coeff_beta(); const BatchedTridiagonalSolver& circle_tridiagonal_solver = circle_tridiagonal_solver_; const BatchedTridiagonalSolver& radial_tridiagonal_solver = radial_tridiagonal_solver_; @@ -212,7 +212,7 @@ void SmootherTake::buildTridiagonalSolverMatrices() // The For loop matches circular access pattern */ Kokkos::parallel_for( "Extrapolated Smoother Take: Build Tridiagonal Matrices (Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {grid.numberSmootherCircles(), grid.ntheta()} // Ending point of the index space ), @@ -225,7 +225,7 @@ void SmootherTake::buildTridiagonalSolverMatrices() /* For loop matches radial access pattern */ Kokkos::parallel_for( "Extrapolated Smoother Take: Build Tridiagonal Matrices (Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {grid.ntheta(), grid.nr()} // Ending point of the index space ), diff --git a/include/Smoother/SmootherTake/smootherTake.h b/include/Smoother/SmootherTake/smootherTake.h index 002d5d93..a1c8801c 100644 --- a/include/Smoother/SmootherTake/smootherTake.h +++ b/include/Smoother/SmootherTake/smootherTake.h @@ -53,7 +53,7 @@ class SmootherTake : public Smoother public: // Constructs the coupled circle-radial smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads); KOKKOS_DEFAULTED_FUNCTION SmootherTake(const SmootherTake&) = default; @@ -89,11 +89,11 @@ class SmootherTake : public Smoother // - In-house: matrix stored in CSR; solver does not own the matrix. #ifdef GMGPOLAR_USE_MUMPS - using InnerBoundaryMatrix = SparseMatrixCOO; + using InnerBoundaryMatrix = SparseMatrixCOO; using InnerBoundarySolver = CooMumpsSolver; #else - using InnerBoundaryMatrix = SparseMatrixCSR; - using InnerBoundarySolver = SparseLUSolver; + using InnerBoundaryMatrix = SparseMatrixCSR; + using InnerBoundarySolver = SparseLUSolver; // Stored only for the in-house solver (CSR). InnerBoundaryMatrix inner_boundary_circle_matrix_; @@ -117,14 +117,14 @@ class SmootherTake : public Smoother // Compute temp = f_sc − A_sc^ortho * u_sc^ortho (precomputed right-hand side) // where x = u_sc and rhs = f_sc - void applyAscOrthoBlackCircleSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoWhiteCircleSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoBlackRadialSection(HostConstVector x, HostConstVector rhs, - HostVector temp); - void applyAscOrthoWhiteRadialSection(HostConstVector x, HostConstVector rhs, - HostVector temp); + void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, + Vector temp); + void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, + Vector temp); /* ----------------- */ /* Line-wise solvers */ @@ -138,10 +138,10 @@ class SmootherTake : public Smoother // where: // s in {Circle, Radial} denotes the smoother section type, // c in {Black, White} denotes the line coloring. - void solveBlackCircleSection(HostVector x, HostVector temp); - void solveWhiteCircleSection(HostVector x, HostVector temp); - void solveBlackRadialSection(HostVector x, HostVector temp); - void solveWhiteRadialSection(HostVector x, HostVector temp); + void solveBlackCircleSection(Vector x, Vector temp); + void solveWhiteCircleSection(Vector x, Vector temp); + void solveBlackRadialSection(Vector x, Vector temp); + void solveWhiteRadialSection(Vector x, Vector temp); }; #include "smootherTake.inl" diff --git a/include/Smoother/SmootherTake/smootherTake.inl b/include/Smoother/SmootherTake/smootherTake.inl index c237645e..934eccc0 100644 --- a/include/Smoother/SmootherTake/smootherTake.inl +++ b/include/Smoother/SmootherTake/smootherTake.inl @@ -1,7 +1,7 @@ #pragma once template -SmootherTake::SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, +SmootherTake::SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : Smoother(grid, level_cache, DirBC_Interior, num_omp_threads) , circle_tridiagonal_solver_(grid.ntheta(), grid.numberSmootherCircles(), true) @@ -41,8 +41,12 @@ SmootherTake::SmootherTake(const PolarGrid& g // - The system is then solved in-place in temp, and the results // are copied back to x. template -void SmootherTake::smoothing(HostVector x, HostConstVector rhs, HostVector temp) +void SmootherTake::smoothing(HostVector h_x, HostConstVector h_rhs, HostVector h_temp) { + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); + assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); @@ -57,4 +61,7 @@ void SmootherTake::smoothing(HostVector x, HostConstVect applyAscOrthoWhiteRadialSection(x, rhs, temp); solveWhiteRadialSection(x, temp); + + Kokkos::deep_copy(h_x, x); + Kokkos::deep_copy(h_temp, temp); } diff --git a/include/Smoother/SmootherTake/solveAscSystem.inl b/include/Smoother/SmootherTake/solveAscSystem.inl index 2117044a..4ba1fb87 100644 --- a/include/Smoother/SmootherTake/solveAscSystem.inl +++ b/include/Smoother/SmootherTake/solveAscSystem.inl @@ -1,14 +1,14 @@ #pragma once template -void SmootherTake::solveBlackCircleSection(HostVector x, HostVector temp) +void SmootherTake::solveBlackCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; int start = 0; int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); const bool is_inner_circle_black = grid.numberSmootherCircles() % 2 != 0; @@ -19,7 +19,7 @@ void SmootherTake::solveBlackCircleSection(HostVector x, // Inner Boundary Solve if (is_inner_circle_black) { - HostVector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); + Vector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); inner_boundary_solver_.solveInPlace(inner_boundary); } @@ -28,7 +28,7 @@ void SmootherTake::solveBlackCircleSection(HostVector x, const int num_black_circles = (grid.numberSmootherCircles() - start_black_circles + 1) / 2; Kokkos::parallel_for( "SmootherTake: moveUpdatedValues (Black Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {num_black_circles, grid.ntheta()} // Ending point of the index space ), @@ -42,14 +42,14 @@ void SmootherTake::solveBlackCircleSection(HostVector x, } template -void SmootherTake::solveWhiteCircleSection(HostVector x, HostVector temp) +void SmootherTake::solveWhiteCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; int start = 0; int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); const bool is_inner_circle_white = grid.numberSmootherCircles() % 2 == 0; @@ -60,7 +60,7 @@ void SmootherTake::solveWhiteCircleSection(HostVector x, // Inner Boundary Solve if (is_inner_circle_white) { - HostVector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); + Vector inner_boundary = Kokkos::subview(temp, Kokkos::make_pair(0, grid.ntheta())); inner_boundary_solver_.solveInPlace(inner_boundary); } @@ -69,7 +69,7 @@ void SmootherTake::solveWhiteCircleSection(HostVector x, const int num_white_circles = (grid.numberSmootherCircles() - start_white_circles + 1) / 2; Kokkos::parallel_for( "SmootherTake: moveUpdatedValues (White Circular)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, 0}, // Starting point of the index space {num_white_circles, grid.ntheta()} // Ending point of the index space ), @@ -83,14 +83,14 @@ void SmootherTake::solveWhiteCircleSection(HostVector x, } template -void SmootherTake::solveBlackRadialSection(HostVector x, HostVector temp) +void SmootherTake::solveBlackRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve const int batch_offset = 0; @@ -103,7 +103,7 @@ void SmootherTake::solveBlackRadialSection(HostVector x, const int num_black_radial_lines = grid.ntheta() / 2; Kokkos::parallel_for( "SmootherTake: moveUpdatedValues (Black Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {num_black_radial_lines, grid.nr()} // Ending point of the index space ), @@ -117,14 +117,14 @@ void SmootherTake::solveBlackRadialSection(HostVector x, } template -void SmootherTake::solveWhiteRadialSection(HostVector x, HostVector temp) +void SmootherTake::solveWhiteRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; const int num_omp_threads = Smoother::num_omp_threads_; int start = grid.numberCircularSmootherNodes(); int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve const int batch_offset = 1; @@ -137,7 +137,7 @@ void SmootherTake::solveWhiteRadialSection(HostVector x, const int num_white_radial_lines = grid.ntheta() / 2; Kokkos::parallel_for( "SmootherTake: moveUpdatedValues (White Radial)", - Kokkos::MDRangePolicy>( // Rank of the index space + Kokkos::MDRangePolicy>( // Rank of the index space {0, grid.numberSmootherCircles()}, // Starting point of the index space {num_white_radial_lines, grid.nr()} // Ending point of the index space ), diff --git a/include/Smoother/smoother.h b/include/Smoother/smoother.h index b1f0cfe0..9177c562 100644 --- a/include/Smoother/smoother.h +++ b/include/Smoother/smoother.h @@ -27,7 +27,7 @@ template class Smoother { public: - explicit Smoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, + explicit Smoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior, int num_omp_threads) : grid_(grid) , level_cache_(level_cache) @@ -41,7 +41,7 @@ class Smoother virtual void smoothing(HostVector x, HostConstVector rhs, HostVector temp) = 0; protected: - const PolarGrid grid_; + const PolarGrid grid_; const LevelCacheType level_cache_; const bool DirBC_Interior_; const int num_omp_threads_; From 1f6573df6142b2cc0315a3f87db54ad3df974764 Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Tue, 19 May 2026 17:12:47 +0200 Subject: [PATCH 11/22] The enclosing parent function (LevelCache) for an extended __host__ __device__ lambda must allow its address to be taken --- include/Level/levelCache.inl | 146 ++++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 61 deletions(-) diff --git a/include/Level/levelCache.inl b/include/Level/levelCache.inl index b3938141..26a63faf 100644 --- a/include/Level/levelCache.inl +++ b/include/Level/levelCache.inl @@ -1,5 +1,86 @@ #pragma once +namespace level_cache_helpers +{ +template +static KOKKOS_INLINE_FUNCTION void cache_density_profile_coefficients( + const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, + const Vector& coeff_alpha, const Vector& coeff_beta, const bool cache_domain_geometry) +{ + Kokkos::parallel_for( + "Cache density profile coefficients", + Kokkos::MDRangePolicy>( // Rank of the index space + {0, 0}, // Starting point of the index space + {grid.nr(), grid.ntheta()} // Ending point of the index space + ), + // Kokkos lambda function to execute for each point in the index space + KOKKOS_LAMBDA(const int i_r, const int i_theta) { + const double r = grid.radius(i_r); + const double theta = grid.theta(i_theta); + const int index = grid.index(i_r, i_theta); + if (!cache_domain_geometry) { + coeff_alpha(index) = density_profile_coefficients.alpha(r, theta); + } + coeff_beta(index) = density_profile_coefficients.beta(r, theta); + }); +} + +template +static KOKKOS_INLINE_FUNCTION void cache_domain_geometry(const PolarGrid& grid, + const DensityProfileCoefficients& density_profile_coefficients, + const DomainGeometry& domain_geometry, + const Vector& vec_arr, const Vector& vec_att, + const Vector& vec_art, const Vector& vec_detDF) +{ + // We split the loops into two regions to better respect the + // access patterns of the smoother and improve cache locality + + // Circular Indexing Section + Kokkos::parallel_for( + "Cache domain geometry (circular indexing)", + Kokkos::MDRangePolicy>( // Rank of the index space + {0, 0}, // Starting point of the index space + {grid.numberSmootherCircles(), grid.ntheta()} // Ending point of the index space + ), + // Kokkos lambda function to execute for each point in the index space + KOKKOS_LAMBDA(const int i_r, const int i_theta) { + const double r = grid.radius(i_r); + const double theta = grid.theta(i_theta); + const int index = grid.index(i_r, i_theta); + const double coeff_alpha = density_profile_coefficients.alpha(r, theta); + + double arr, att, art, detDF; + compute_jacobian_elements(domain_geometry, r, theta, coeff_alpha, arr, att, art, detDF); + vec_detDF(index) = detDF; + vec_arr(index) = arr; + vec_att(index) = att; + vec_art(index) = art; + }); + // Radial Indexing Section + Kokkos::parallel_for( + "Cache domain geometry (radial indexing)", + Kokkos::MDRangePolicy>( // Rank of the index space + {0, grid.numberSmootherCircles()}, // Starting point of the index space + {grid.ntheta(), grid.nr()} // Ending point of the index space + ), + // Kokkos lambda function to execute for each point in the index space + KOKKOS_LAMBDA(const int i_theta, const int i_r) { + const double theta = grid.theta(i_theta); + const double r = grid.radius(i_r); + const int index = grid.index(i_r, i_theta); + const double coeff_alpha = density_profile_coefficients.alpha(r, theta); + + double arr, att, art, detDF; + compute_jacobian_elements(domain_geometry, r, theta, coeff_alpha, arr, att, art, detDF); + vec_detDF(index) = detDF; + vec_arr(index) = arr; + vec_att(index) = att; + vec_art(index) = art; + }); +} + +} // namespace level_cache_helpers + template LevelCache::LevelCache( const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, @@ -21,72 +102,15 @@ LevelCache::LevelCache( // Pre-compute and store alpha/beta coefficients at all grid nodes to avoid // repeated expensive evaluations during runtime computations if (cache_density_profile_coefficients_) { - Kokkos::parallel_for( - "Cache density profile coefficients", -Kokkos::MDRangePolicy>( // Rank of the index space - {0, 0}, // Starting point of the index space - {grid.nr(), grid.ntheta()} // Ending point of the index space - ), - // Kokkos lambda function to execute for each point in the index space - KOKKOS_LAMBDA(const int i_r, const int i_theta) { - const double r = grid.radius(i_r); - const double theta = grid.theta(i_theta); - const int index = grid.index(i_r, i_theta); - if (!cache_domain_geometry_) { - coeff_alpha_(index) = density_profile_coefficients.alpha(r, theta); - } - coeff_beta_(index) = density_profile_coefficients.beta(r, theta); - }); + level_cache_helpers::cache_density_profile_coefficients(grid, density_profile_coefficients, coeff_alpha_, + coeff_beta_, cache_domain_geometry); } // Pre-compute and store Jacobian matrix elements (arr, att, art, detDF) at all grid nodes // to avoid repeated coordinate transformation calculations during domain operations if (cache_domain_geometry_) { - // We split the loops into two regions to better respect the - // access patterns of the smoother and improve cache locality - - // Circular Indexing Section - Kokkos::parallel_for( - "Cache domain geometry (circular indexing)", -Kokkos::MDRangePolicy>( // Rank of the index space - {0, 0}, // Starting point of the index space - {grid.numberSmootherCircles(), grid.ntheta()} // Ending point of the index space - ), - // Kokkos lambda function to execute for each point in the index space - KOKKOS_LAMBDA(const int i_r, const int i_theta) { - const double r = grid.radius(i_r); - const double theta = grid.theta(i_theta); - const int index = grid.index(i_r, i_theta); - const double coeff_alpha = density_profile_coefficients.alpha(r, theta); - - double arr, att, art, detDF; - compute_jacobian_elements(domain_geometry_, r, theta, coeff_alpha, arr, att, art, detDF); - detDF_(index) = detDF; - arr_(index) = arr; - att_(index) = att; - art_(index) = art; - }); - // Radial Indexing Section - Kokkos::parallel_for( - "Cache domain geometry (radial indexing)", -Kokkos::MDRangePolicy>( // Rank of the index space - {0, grid.numberSmootherCircles()}, // Starting point of the index space - {grid.ntheta(), grid.nr()} // Ending point of the index space - ), - // Kokkos lambda function to execute for each point in the index space - KOKKOS_LAMBDA(const int i_theta, const int i_r) { - const double theta = grid.theta(i_theta); - const double r = grid.radius(i_r); - const int index = grid.index(i_r, i_theta); - const double coeff_alpha = density_profile_coefficients.alpha(r, theta); - - double arr, att, art, detDF; - compute_jacobian_elements(domain_geometry_, r, theta, coeff_alpha, arr, att, art, detDF); - detDF_(index) = detDF; - arr_(index) = arr; - att_(index) = att; - art_(index) = art; - }); + level_cache_helpers::cache_domain_geometry(grid, density_profile_coefficients, domain_geometry, arr_, att_, + art_, detDF_); } Kokkos::fence(); } From 9f5862e5de29b743c891c008ff709cffb88eedc7 Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Tue, 19 May 2026 17:44:34 +0200 Subject: [PATCH 12/22] Test cuda compilation --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c8273bab..89428c6c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,8 @@ jobs: strategy: matrix: USE_MUMPS: [false, true] - backend: ['openmp', 'cuda'] + #backend: ['openmp', 'cuda'] + backend: ['cuda'] exclude: - backend: cuda USE_MUMPS: true From b239319b44cd3713fcfe62c165046e309e62dfca Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 10:06:27 +0200 Subject: [PATCH 13/22] Fix warnings about non-void function not returning --- .../DirectSolver/DirectSolverTake/matrixStencil.inl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/include/DirectSolver/DirectSolverTake/matrixStencil.inl b/include/DirectSolver/DirectSolverTake/matrixStencil.inl index 6d223bb8..71df1224 100644 --- a/include/DirectSolver/DirectSolverTake/matrixStencil.inl +++ b/include/DirectSolver/DirectSolverTake/matrixStencil.inl @@ -29,12 +29,14 @@ static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGr else if (i_r == grid.nr() - 2) { return size_stencil_next_outer_boundary; } + Kokkos::abort("Invalid stencil index"); + return -1; } static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) { - assert(0 <= i_r && i_r < grid.nr()); - assert(grid.nr() >= 4); + KOKKOS_ASSERT(0 <= i_r && i_r < grid.nr()); + KOKKOS_ASSERT(grid.nr() >= 4); // clang-format off static constexpr Stencil stencil_interior_ = { @@ -76,7 +78,8 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const Pol else if (i_r == 1 && DirBC_Interior) { return stencil_next_inner_DB_; } - else if (i_r == grid.nr() - 2) { + else { + //if (i_r == grid.nr() - 2) return stencil_next_outer_DB_; } } @@ -175,6 +178,8 @@ static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int size_stencil_next_outer_boundary * prior_next_outer_boundary_nodes + size_stencil_outer_boundary * prior_outer_boundary_nodes; } + Kokkos::abort("Invalid stencil index"); + return -1; } static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) @@ -206,4 +211,4 @@ static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& return true; } -} // namespace direct_solver_take \ No newline at end of file +} // namespace direct_solver_take From 608866d1b1f4c6920ab9faf43702dd962674f19b Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 10:27:41 +0200 Subject: [PATCH 14/22] Remove unused variables to improve clang error message readability --- .../DirectSolverGive/buildSolverMatrix.inl | 12 ------------ .../DirectSolverTake/buildSolverMatrix.inl | 4 ---- .../ExtrapolatedSmootherGive/applyAscOrtho.inl | 5 ++--- .../buildInnerBoundaryAsc.inl | 6 ------ .../buildTridiagonalAsc.inl | 9 +-------- .../ExtrapolatedSmootherTake/applyAscOrtho.inl | 5 ++--- .../buildInnerBoundaryAsc.inl | 13 +------------ .../buildTridiagonalAsc.inl | 10 ++++------ include/GMGPolar/solver.h | 3 +-- include/GMGPolar/utils.h | 1 - .../Smoother/SmootherGive/buildInnerBoundaryAsc.inl | 8 ++------ .../Smoother/SmootherGive/buildTridiagonalAsc.inl | 8 -------- .../Smoother/SmootherTake/buildInnerBoundaryAsc.inl | 2 +- .../cartesianR2_Poisson_CzarnyGeometry.cpp | 1 - .../polarR6_ZoniShiftedGyro_CulhamGeometry.cpp | 4 +--- .../refined_ZoniShiftedGyro_CulhamGeometry.cpp | 4 +--- src/main.cpp | 1 - 17 files changed, 16 insertions(+), 80 deletions(-) diff --git a/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl index 796f83ec..7c2804ce 100644 --- a/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl @@ -227,16 +227,11 @@ nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& gri const double k2 = grid.angularSpacing(i_theta); const double coeff2 = 0.5 * (k1 + k2) / h2; - const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); - const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); - const int center_nz_index = getSolverMatrixIndex(i_r, i_theta, grid, DirBC_Interior); const int right_nz_index = getSolverMatrixIndex(i_r + 1, i_theta, grid, DirBC_Interior); const int center_index = grid.index(i_r, i_theta); const int right_index = grid.index(i_r + 1, i_theta); - const int bottom_index = grid.index(i_r, i_theta_M1); - const int top_index = grid.index(i_r, i_theta_P1); /* Fill matrix row of (i,j) */ row = center_index; @@ -632,13 +627,11 @@ nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& gri const int center_nz_index = getSolverMatrixIndex(i_r, i_theta, grid, DirBC_Interior); const int left_nz_index = getSolverMatrixIndex(i_r - 1, i_theta, grid, DirBC_Interior); - const int right_nz_index = getSolverMatrixIndex(i_r + 1, i_theta, grid, DirBC_Interior); const int bottom_nz_index = getSolverMatrixIndex(i_r, i_theta_M1, grid, DirBC_Interior); const int top_nz_index = getSolverMatrixIndex(i_r, i_theta_P1, grid, DirBC_Interior); const int center_index = grid.index(i_r, i_theta); const int left_index = grid.index(i_r - 1, i_theta); - const int right_index = grid.index(i_r + 1, i_theta); const int bottom_index = grid.index(i_r, i_theta_M1); const int top_index = grid.index(i_r, i_theta_P1); @@ -760,16 +753,11 @@ nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& gri const double coeff1 = 0.5 * (k1 + k2) / h1; - const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); - const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); - const int center_nz_index = getSolverMatrixIndex(i_r, i_theta, grid, DirBC_Interior); const int left_nz_index = getSolverMatrixIndex(i_r - 1, i_theta, grid, DirBC_Interior); const int center_index = grid.index(i_r, i_theta); const int left_index = grid.index(i_r - 1, i_theta); - const int bottom_index = grid.index(i_r, i_theta_M1); - const int top_index = grid.index(i_r, i_theta_P1); /* Fill matrix row of (i,j) */ row = center_index; diff --git a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl index b1289786..f3dc01bf 100644 --- a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl @@ -388,9 +388,7 @@ nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& gri const int bottom_index = grid.index(i_r, i_theta_M1); const int top_index = grid.index(i_r, i_theta_P1); const int bottom_left_index = grid.index(i_r - 1, i_theta_M1); - const int bottom_right_index = grid.index(i_r + 1, i_theta_M1); const int top_left_index = grid.index(i_r - 1, i_theta_P1); - const int top_right_index = grid.index(i_r + 1, i_theta_P1); const double left_value = -coeff1 * (arr(center_index) + arr(left_index)); /* Left */ const double right_value = -coeff2 * (arr(center_index) + arr(right_index)); /* Right */ @@ -406,9 +404,7 @@ nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& gri ); const double bottom_left_value = -0.25 * (art(left_index) + art(bottom_index)); /* Bottom Left */ - const double bottom_right_value = +0.25 * (art(right_index) + art(bottom_index)); /* Bottom Right */ const double top_left_value = +0.25 * (art(left_index) + art(top_index)); /* Top Left */ - const double top_right_value = -0.25 * (art(right_index) + art(top_index)); /* Top Right */ /* Fill matrix row of (i,j) */ row = center_index; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl index 0ab19ccf..da443508 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl @@ -151,9 +151,9 @@ nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarG const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); - const int i_theta_Across = grid.wrapThetaIndex(i_theta + grid.ntheta() / 2); + //const int i_theta_Across = grid.wrapThetaIndex(i_theta + grid.ntheta() / 2); - const int left = grid.index(i_r, i_theta_Across); + //const int left = grid.index(i_r, i_theta_Across); const int bottom = grid.index(i_r, i_theta_M1); const int top = grid.index(i_r, i_theta_P1); const int right = grid.index(i_r + 1, i_theta); @@ -471,7 +471,6 @@ nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarG } } else if (i_r == grid.numberSmootherCircles() - 1) { - const double h1 = grid.radialSpacing(i_r - 1); const double h2 = grid.radialSpacing(i_r); const double k1 = grid.angularSpacing(i_theta - 1); const double k2 = grid.angularSpacing(i_theta); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl index c896eabd..5ab6ce4d 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl @@ -94,7 +94,6 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& const int center_index = i_theta; const int left_index = i_theta_AcrossOrigin; - const int right_index = i_theta; const int bottom_index = i_theta_M1; const int top_index = i_theta_P1; @@ -103,7 +102,6 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& const int top_nz_index = getCircleAscIndex(i_r, i_theta_P1, grid, DirBC_Interior); const int left_nz_index = getCircleAscIndex(i_r, i_theta_AcrossOrigin, grid, DirBC_Interior); - int nz_index; const Stencil& CenterStencil = getStencil(i_r, i_theta, grid, DirBC_Interior); if (i_theta & 1) { @@ -219,15 +217,11 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& level_cache.obtainValues(i_r, i_theta, center, radius, theta, coeff_beta, arr, att, art, detDF); const double h1 = grid.radialSpacing(i_r - 1); - const double h2 = grid.radialSpacing(i_r); const double k1 = grid.angularSpacing(i_theta - 1); const double k2 = grid.angularSpacing(i_theta); const double coeff1 = 0.5 * (k1 + k2) / h1; - const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); - const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); - const int left_index = i_theta; /* -------------------------- */ diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl index a2d32ebf..b044dc4a 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl @@ -44,7 +44,6 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta double coeff_beta, arr, att, art, detDF; level_cache.obtainValues(i_r, i_theta, center, radius, theta, coeff_beta, arr, att, art, detDF); - int ptr, offset; int row, column; double value; /* ------------------------------------------ */ @@ -241,13 +240,8 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta const double coeff2 = 0.5 * (k1 + k2) / h2; - const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); - const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); - const int center_index = i_theta; const int right_index = i_theta; - const int bottom_index = i_theta_M1; - const int top_index = i_theta_P1; /* Fill matrix row of (i,j) */ row = center_index; @@ -511,7 +505,6 @@ nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta double coeff_beta, arr, att, art, detDF; level_cache.obtainValues(i_r, i_theta, center, radius, theta, coeff_beta, arr, att, art, detDF); - int ptr, offset; int row, column; double value; @@ -918,7 +911,7 @@ nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta const int center_index = i_r - numberSmootherCircles; const int left_index = i_r - numberSmootherCircles - 1; - const int right_index = i_r - numberSmootherCircles + 1; + //const int right_index = i_r - numberSmootherCircles + 1; const int bottom_index = i_r - numberSmootherCircles; const int top_index = i_r - numberSmootherCircles; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl index 96042177..90e6ed93 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl @@ -135,16 +135,15 @@ nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& g const double k1 = grid.angularSpacing(i_theta - 1); const double k2 = grid.angularSpacing(i_theta); - const double coeff1 = 0.5 * (k1 + k2) / h1; const double coeff2 = 0.5 * (k1 + k2) / h2; const double coeff3 = 0.5 * (h1 + h2) / k1; const double coeff4 = 0.5 * (h1 + h2) / k2; const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); - const int i_theta_Across = grid.wrapThetaIndex(i_theta + grid.ntheta() / 2); + //const int i_theta_Across = grid.wrapThetaIndex(i_theta + grid.ntheta() / 2); - const int left = grid.index(i_r, i_theta_Across); + //const int left = grid.index(i_r, i_theta_Across); const int bottom = grid.index(i_r, i_theta_M1); const int center = grid.index(i_r, i_theta); const int top = grid.index(i_r, i_theta_P1); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl index 0a5dd32c..7e215afc 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl @@ -90,16 +90,9 @@ nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, const int center_index = i_theta; const int left_index = i_theta_AcrossOrigin; - const int right_index = i_theta; - const int bottom_index = i_theta_M1; - const int top_index = i_theta_P1; const int center_nz_index = getCircleAscIndex(i_r, i_theta, grid, DirBC_Interior); - const int bottom_nz_index = getCircleAscIndex(i_r, i_theta_M1, grid, DirBC_Interior); - const int top_nz_index = getCircleAscIndex(i_r, i_theta_P1, grid, DirBC_Interior); - const int left_nz_index = getCircleAscIndex(i_r, i_theta_AcrossOrigin, grid, DirBC_Interior); - int nz_index; const Stencil& CenterStencil = getStencil(i_r, i_theta, grid, DirBC_Interior); if (i_theta & 1) { @@ -125,8 +118,6 @@ nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, row = center_index; ptr = center_nz_index; - const Stencil& CenterStencil = getStencil(i_r, i_theta, grid, DirBC_Interior); - offset = CenterStencil[StencilPosition::Center]; column = center_index; value = center_value; @@ -149,8 +140,6 @@ nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, row = center_index; ptr = center_nz_index; - const Stencil& CenterStencil = getStencil(i_r, i_theta, grid, DirBC_Interior); - offset = CenterStencil[StencilPosition::Center]; column = center_index; value = 1.0; @@ -172,7 +161,6 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; - const int i_r = 0; const int ntheta = grid.ntheta(); // The interior boundary matrix is symmetric due to the periodicity in the theta direction @@ -182,6 +170,7 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() // the COO_Mumps_Solver optimizes the factorization by only using the upper triangular part of the matrix, // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS + const int i_r = 0; const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl index 814d88e5..38ae34a5 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl @@ -32,9 +32,8 @@ static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesCircleSecti KOKKOS_ASSERT(numberSmootherCircles >= 3); KOKKOS_ASSERT(lengthRadialSmoother >= 3); - int ptr, offset; - int row, column, col; - double value, val; + int row, column; + double value; /* ------------------------------------------ */ /* Node in the interior of the Circle Section */ @@ -182,9 +181,8 @@ static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesRadialSecti KOKKOS_ASSERT(numberSmootherCircles >= 3); KOKKOS_ASSERT(lengthRadialSmoother >= 3); - int ptr, offset; - int row, column, col; - double value, val; + int row, column; + double value; /* ------------------------------------------ */ /* Node in the interior of the Radial Section */ diff --git a/include/GMGPolar/solver.h b/include/GMGPolar/solver.h index 7a2477a4..6a38ee74 100644 --- a/include/GMGPolar/solver.h +++ b/include/GMGPolar/solver.h @@ -586,8 +586,7 @@ std::pair GMGPolar:: Level& level, HostConstVector solution, HostVector error, const ExactSolution& exact_solution) { - const PolarGrid& grid = level.grid(); - const LevelCache& levelCache = level.levelCache(); + const PolarGrid& grid = level.grid(); assert(solution.size() == error.size()); assert(std::ssize(solution) == grid.numberOfNodes()); diff --git a/include/GMGPolar/utils.h b/include/GMGPolar/utils.h index ca637fa1..0249c9b4 100644 --- a/include/GMGPolar/utils.h +++ b/include/GMGPolar/utils.h @@ -244,7 +244,6 @@ void GMGPolar::writeToVTK( HostConstVector grid_function) { const PolarGrid& grid = level.grid(); - const LevelCache& level_cache = level.levelCache(); assert(std::ssize(grid_function) == grid.numberOfNodes()); diff --git a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl index 8350bc17..32408838 100644 --- a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl @@ -108,7 +108,7 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& const int top_nz_index = getCircleAscIndex(i_r, i_theta_P1, DirBC_Interior); const int left_nz_index = getCircleAscIndex(i_r, i_theta_AcrossOrigin, DirBC_Interior); - int nz_index; /* Fill matrix row of (i,j) */ + /* Fill matrix row of (i,j) */ row = center_index; ptr = center_nz_index; @@ -226,15 +226,11 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& level_cache.obtainValues(i_r, i_theta, center, radius, theta, coeff_beta, arr, att, art, detDF); const double h1 = grid.radialSpacing(i_r - 1); - const double h2 = grid.radialSpacing(i_r); const double k1 = grid.angularSpacing(i_theta - 1); const double k2 = grid.angularSpacing(i_theta); const double coeff1 = 0.5 * (k1 + k2) / h1; - const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); - const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); - const int left_index = i_theta; /* Fill matrix row of (i-1,j) */ @@ -265,7 +261,6 @@ SmootherGive::buildInteriorBoundarySolverMatrix() const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; - const int i_r = 0; const int ntheta = grid.ntheta(); // The interior boundary matrix is symmetric due to the periodicity in the theta direction @@ -275,6 +270,7 @@ SmootherGive::buildInteriorBoundarySolverMatrix() // the COO_Mumps_Solver optimizes the factorization by only using the upper triangular part of the matrix, // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS + const int i_r = 0; const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); diff --git a/include/Smoother/SmootherGive/buildTridiagonalAsc.inl b/include/Smoother/SmootherGive/buildTridiagonalAsc.inl index 20270402..55071c6b 100644 --- a/include/Smoother/SmootherGive/buildTridiagonalAsc.inl +++ b/include/Smoother/SmootherGive/buildTridiagonalAsc.inl @@ -42,7 +42,6 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta double coeff_beta, arr, att, art, detDF; level_cache.obtainValues(i_r, i_theta, center, radius, theta, coeff_beta, arr, att, art, detDF); - int ptr, offset; int row, column; double value; @@ -163,9 +162,6 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta const double coeff2 = 0.5 * (k1 + k2) / h2; - const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); - const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); - const auto& center_solver = circle_tridiagonal_solver; const int center_batch = i_r; const auto& right_solver = circle_tridiagonal_solver; @@ -173,8 +169,6 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta const int center_index = i_theta; const int right_index = i_theta; - const int bottom_index = i_theta_M1; - const int top_index = i_theta_P1; /* Fill matrix row of (i,j) */ row = center_index; @@ -218,7 +212,6 @@ nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta double coeff_beta, arr, att, art, detDF; level_cache.obtainValues(i_r, i_theta, center, radius, theta, coeff_beta, arr, att, art, detDF); - int ptr, offset; int row, column; double value; @@ -432,7 +425,6 @@ nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta const int center_index = i_r - numberSmootherCircles; const int left_index = i_r - numberSmootherCircles - 1; - const int right_index = i_r - numberSmootherCircles + 1; const int bottom_index = i_r - numberSmootherCircles; const int top_index = i_r - numberSmootherCircles; diff --git a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl index 4ae3651b..90a281e5 100644 --- a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl @@ -150,7 +150,6 @@ SmootherTake::buildInteriorBoundarySolverMatrix() const LevelCacheType& level_cache = Smoother::level_cache_; const bool DirBC_Interior = Smoother::DirBC_Interior_; - const int i_r = 0; const int ntheta = grid.ntheta(); // The interior boundary matrix is symmetric due to the periodicity in the theta direction @@ -160,6 +159,7 @@ SmootherTake::buildInteriorBoundarySolverMatrix() // the COO_Mumps_Solver optimizes the factorization by only using the upper triangular part of the matrix, // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS + const int i_r = 0; const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp index 68056746..f13acfbf 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp @@ -26,7 +26,6 @@ KOKKOS_FUNCTION double CartesianR2_Poisson_CzarnyGeometry::operator()(std::size_ double temp = sqrt(inverse_aspect_ratio_epsilon * (inverse_aspect_ratio_epsilon + 2.0 * (r / Rmax) * cos_theta) + 1.0); double sin_theta_pow2 = pow(sin_theta, 2.0); - double cos_theta_pow2 = pow(cos_theta, 2.0); double temp1 = pow((2.0 - temp), 2.0); double temp2 = pow((2.0 - temp), 3.0); diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp index 0b734bc8..c5973f16 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp @@ -11,7 +11,5 @@ KOKKOS_FUNCTION double PolarR6_ZoniShiftedGyro_CulhamGeometry::operator()(std::s { double r = grid_.radius(i_r); double theta = grid_.theta(i_theta); - double sin_theta = std::sin(theta); - double cos_theta = std::cos(theta); return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); -} \ No newline at end of file +} diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp index 41933510..6fe4ded6 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp @@ -11,12 +11,10 @@ KOKKOS_FUNCTION double Refined_ZoniShiftedGyro_CulhamGeometry::operator()(std::s { double r = grid_.radius(i_r); double theta = grid_.theta(i_theta); - double sin_theta = std::sin(theta); - double cos_theta = std::cos(theta); return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * cos(21.0 * theta) + (0.00184273372222541 * ((r / Rmax) * (r / Rmax)) - 0.0018029383826828 * (r / Rmax) - 4.00652973929511e-05 + exp((-50.0) * pow(((r / Rmax) - 0.45), 2.0))) * cos(9.0 * theta); -} \ No newline at end of file +} diff --git a/src/main.cpp b/src/main.cpp index e02a35e6..e8e535f8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -72,7 +72,6 @@ int main(int argc, char* argv[]) // --- Retrieve solution and associated grid --- // HostVector solution = solver.solution(); - const PolarGrid& grid = solver.grid(); // Print timing statistics for each solver phase solver.printTimings(); From e628e0bc7a2e12b9b857d9eea6e4b5f5abde7d0c Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 10:28:37 +0200 Subject: [PATCH 15/22] Clang format --- .../DirectSolverTake/buildSolverMatrix.inl | 18 +++++++++--------- .../ExtrapolatedSmootherGive/applyAscOrtho.inl | 4 ++-- .../ExtrapolatedSmootherTake/applyAscOrtho.inl | 4 ++-- .../buildInnerBoundaryAsc.inl | 2 +- include/GMGPolar/utils.h | 2 +- .../SmootherGive/buildInnerBoundaryAsc.inl | 2 +- .../SmootherTake/buildInnerBoundaryAsc.inl | 2 +- .../polarR6_ZoniShiftedGyro_CulhamGeometry.cpp | 4 ++-- .../refined_ZoniShiftedGyro_CulhamGeometry.cpp | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl index f3dc01bf..f8ceedc1 100644 --- a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl @@ -382,13 +382,13 @@ nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& gri const int center_nz_index = getSolverMatrixIndex(i_r, i_theta, grid, DirBC_Interior); - const int center_index = grid.index(i_r, i_theta); - const int left_index = grid.index(i_r - 1, i_theta); - const int right_index = grid.index(i_r + 1, i_theta); - const int bottom_index = grid.index(i_r, i_theta_M1); - const int top_index = grid.index(i_r, i_theta_P1); - const int bottom_left_index = grid.index(i_r - 1, i_theta_M1); - const int top_left_index = grid.index(i_r - 1, i_theta_P1); + const int center_index = grid.index(i_r, i_theta); + const int left_index = grid.index(i_r - 1, i_theta); + const int right_index = grid.index(i_r + 1, i_theta); + const int bottom_index = grid.index(i_r, i_theta_M1); + const int top_index = grid.index(i_r, i_theta_P1); + const int bottom_left_index = grid.index(i_r - 1, i_theta_M1); + const int top_left_index = grid.index(i_r - 1, i_theta_P1); const double left_value = -coeff1 * (arr(center_index) + arr(left_index)); /* Left */ const double right_value = -coeff2 * (arr(center_index) + arr(right_index)); /* Right */ @@ -403,8 +403,8 @@ nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& gri - top_value /* Center: (Top) */ ); - const double bottom_left_value = -0.25 * (art(left_index) + art(bottom_index)); /* Bottom Left */ - const double top_left_value = +0.25 * (art(left_index) + art(top_index)); /* Top Left */ + const double bottom_left_value = -0.25 * (art(left_index) + art(bottom_index)); /* Bottom Left */ + const double top_left_value = +0.25 * (art(left_index) + art(top_index)); /* Top Left */ /* Fill matrix row of (i,j) */ row = center_index; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl index da443508..e1edf5cb 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl @@ -149,8 +149,8 @@ nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarG const double coeff3 = 0.5 * (h1 + h2) / k1; const double coeff4 = 0.5 * (h1 + h2) / k2; - const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); - const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); + const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); + const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); //const int i_theta_Across = grid.wrapThetaIndex(i_theta + grid.ntheta() / 2); //const int left = grid.index(i_r, i_theta_Across); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl index 90e6ed93..97be93b6 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl @@ -139,8 +139,8 @@ nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& g const double coeff3 = 0.5 * (h1 + h2) / k1; const double coeff4 = 0.5 * (h1 + h2) / k2; - const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); - const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); + const int i_theta_M1 = grid.wrapThetaIndex(i_theta - 1); + const int i_theta_P1 = grid.wrapThetaIndex(i_theta + 1); //const int i_theta_Across = grid.wrapThetaIndex(i_theta + grid.ntheta() / 2); //const int left = grid.index(i_r, i_theta_Across); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl index 7e215afc..55c71ba9 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl @@ -170,7 +170,7 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() // the COO_Mumps_Solver optimizes the factorization by only using the upper triangular part of the matrix, // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS - const int i_r = 0; + const int i_r = 0; const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); diff --git a/include/GMGPolar/utils.h b/include/GMGPolar/utils.h index 0249c9b4..84646486 100644 --- a/include/GMGPolar/utils.h +++ b/include/GMGPolar/utils.h @@ -243,7 +243,7 @@ void GMGPolar::writeToVTK( const std::filesystem::path& file_path, const Level& level, HostConstVector grid_function) { - const PolarGrid& grid = level.grid(); + const PolarGrid& grid = level.grid(); assert(std::ssize(grid_function) == grid.numberOfNodes()); diff --git a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl index 32408838..4e867f4d 100644 --- a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl @@ -270,7 +270,7 @@ SmootherGive::buildInteriorBoundarySolverMatrix() // the COO_Mumps_Solver optimizes the factorization by only using the upper triangular part of the matrix, // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS - const int i_r = 0; + const int i_r = 0; const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); diff --git a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl index 90a281e5..d0ef443d 100644 --- a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl @@ -159,7 +159,7 @@ SmootherTake::buildInteriorBoundarySolverMatrix() // the COO_Mumps_Solver optimizes the factorization by only using the upper triangular part of the matrix, // which is extracted by the COO_Mumps_Solver internally. #ifdef GMGPOLAR_USE_MUMPS - const int i_r = 0; + const int i_r = 0; const int nnz = getNonZeroCountCircleAsc(i_r, grid, DirBC_Interior); SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp index c5973f16..54ee03b7 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp @@ -9,7 +9,7 @@ PolarR6_ZoniShiftedGyro_CulhamGeometry::PolarR6_ZoniShiftedGyro_CulhamGeometry(P KOKKOS_FUNCTION double PolarR6_ZoniShiftedGyro_CulhamGeometry::operator()(std::size_t i_r, std::size_t i_theta) const { - double r = grid_.radius(i_r); - double theta = grid_.theta(i_theta); + double r = grid_.radius(i_r); + double theta = grid_.theta(i_theta); return 0.4096 * pow((r / Rmax), 6.0) * pow(((r / Rmax) - 1.0), 6.0) * cos(11.0 * theta); } diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp index 6fe4ded6..2d0b4ee1 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp @@ -9,8 +9,8 @@ Refined_ZoniShiftedGyro_CulhamGeometry::Refined_ZoniShiftedGyro_CulhamGeometry(P KOKKOS_FUNCTION double Refined_ZoniShiftedGyro_CulhamGeometry::operator()(std::size_t i_r, std::size_t i_theta) const { - double r = grid_.radius(i_r); - double theta = grid_.theta(i_theta); + double r = grid_.radius(i_r); + double theta = grid_.theta(i_theta); return ((-3.33823779536505e-15) * ((r / Rmax) * (r / Rmax)) - 0.0 * (r / Rmax) - 0.0 + exp((-3333.33333333333) * pow(((r / Rmax) - 0.9), 2.0))) * cos(21.0 * theta) + From 3ae86d1622f7ceb4eaf2d9abfbb8291a5edff690 Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 12:51:05 +0200 Subject: [PATCH 16/22] Functions containing loops should not be KOKKOS_FUNCTION --- include/Level/levelCache.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/Level/levelCache.inl b/include/Level/levelCache.inl index 26a63faf..00f772c8 100644 --- a/include/Level/levelCache.inl +++ b/include/Level/levelCache.inl @@ -3,7 +3,7 @@ namespace level_cache_helpers { template -static KOKKOS_INLINE_FUNCTION void cache_density_profile_coefficients( +static void cache_density_profile_coefficients( const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, const Vector& coeff_alpha, const Vector& coeff_beta, const bool cache_domain_geometry) { @@ -26,7 +26,7 @@ static KOKKOS_INLINE_FUNCTION void cache_density_profile_coefficients( } template -static KOKKOS_INLINE_FUNCTION void cache_domain_geometry(const PolarGrid& grid, +static void cache_domain_geometry(const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const Vector& vec_arr, const Vector& vec_att, From af5e062fd2797e38057ca52ce744b7e3dac85d9c Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 13:22:42 +0200 Subject: [PATCH 17/22] Revert test change --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 89428c6c..c8273bab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,8 +16,7 @@ jobs: strategy: matrix: USE_MUMPS: [false, true] - #backend: ['openmp', 'cuda'] - backend: ['cuda'] + backend: ['openmp', 'cuda'] exclude: - backend: cuda USE_MUMPS: true From ee70bbe0d3ee78a8fd9547f5740f2ca4e917fd7f Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 14:17:29 +0200 Subject: [PATCH 18/22] Add macro to avoid double declaration --- include/PolarGrid/polargrid.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/PolarGrid/polargrid.h b/include/PolarGrid/polargrid.h index 9b387a99..79923191 100644 --- a/include/PolarGrid/polargrid.h +++ b/include/PolarGrid/polargrid.h @@ -162,7 +162,10 @@ class PolarGrid }; template class PolarGrid; + +#if KOKKOS_ENABLE_CUDA template class PolarGrid; +#endif // ---------------------------------------------------- // // Generates a coarser PolarGrid from a finer PolarGrid // From b5fe843db62953616dd905ff98db86c32099689b Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 14:22:14 +0200 Subject: [PATCH 19/22] Add macro to avoid double declaration --- src/PolarGrid/polargrid.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PolarGrid/polargrid.cpp b/src/PolarGrid/polargrid.cpp index 8baf8a51..2671bb6b 100644 --- a/src/PolarGrid/polargrid.cpp +++ b/src/PolarGrid/polargrid.cpp @@ -260,7 +260,9 @@ PolarGrid coarseningGrid(const PolarGrid& fineGrid) } template PolarGrid coarseningGrid(const PolarGrid& grid); +#if KOKKOS_ENABLE_CUDA template PolarGrid coarseningGrid(const PolarGrid& grid); +#endif } // namespace gmgpolar From 5347c92e8963c8060caa9f0782f72ff1d47b2fc5 Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 14:22:51 +0200 Subject: [PATCH 20/22] Clang format --- .../DirectSolverGive/applySymmetryShift.inl | 20 +++--- .../DirectSolverGive/buildSolverMatrix.inl | 21 +++--- .../DirectSolverGive/directSolverGive.h | 3 +- .../DirectSolverGive/directSolverGive.inl | 8 +-- .../DirectSolverGive/matrixStencil.inl | 15 +++-- .../DirectSolverTake/applySymmetryShift.inl | 12 ++-- .../DirectSolverTake/buildSolverMatrix.inl | 20 +++--- .../DirectSolverTake/directSolverTake.h | 3 +- .../DirectSolverTake/directSolverTake.inl | 8 +-- .../DirectSolverTake/matrixStencil.inl | 15 +++-- include/DirectSolver/directSolver.h | 3 +- .../applyAscOrtho.inl | 40 ++++++------ .../buildInnerBoundaryAsc.inl | 28 ++++---- .../buildTridiagonalAsc.inl | 24 ++++--- .../extrapolatedSmootherGive.h | 15 ++--- .../extrapolatedSmootherGive.inl | 15 +++-- .../smootherStencil.inl | 7 +- .../solveAscSystem.inl | 24 +++---- .../applyAscOrtho.inl | 37 ++++++----- .../buildInnerBoundaryAsc.inl | 24 +++---- .../buildTridiagonalAsc.inl | 12 ++-- .../extrapolatedSmootherTake.h | 15 ++--- .../extrapolatedSmootherTake.inl | 13 ++-- .../smootherStencil.inl | 7 +- .../solveAscSystem.inl | 24 +++---- .../extrapolatedSmoother.h | 3 +- include/GMGPolar/gmgpolar.h | 3 +- include/GMGPolar/setup.h | 17 +++-- include/GMGPolar/solver.h | 2 +- include/GMGPolar/utils.h | 2 +- .../cartesianR2_Poisson_CzarnyGeometry.h | 4 +- .../cartesianR2_Poisson_ShafranovGeometry.h | 4 +- ...tesianR2_Sonnendrucker_ShafranovGeometry.h | 4 +- .../cartesianR2_ZoniGyro_ShafranovGeometry.h | 4 +- ...sianR2_ZoniShiftedGyro_ShafranovGeometry.h | 4 +- ...artesianR2_ZoniShifted_ShafranovGeometry.h | 4 +- .../cartesianR2_Zoni_CzarnyGeometry.h | 4 +- .../cartesianR2_Zoni_ShafranovGeometry.h | 4 +- .../cartesianR6_Poisson_CzarnyGeometry.h | 4 +- .../cartesianR6_Poisson_ShafranovGeometry.h | 4 +- ...tesianR6_Sonnendrucker_ShafranovGeometry.h | 4 +- .../cartesianR6_ZoniGyro_ShafranovGeometry.h | 4 +- ...sianR6_ZoniShiftedGyro_ShafranovGeometry.h | 4 +- ...artesianR6_ZoniShifted_ShafranovGeometry.h | 4 +- .../cartesianR6_Zoni_CzarnyGeometry.h | 4 +- .../cartesianR6_Zoni_ShafranovGeometry.h | 4 +- .../polarR6_Poisson_CzarnyGeometry.h | 4 +- .../polarR6_Poisson_ShafranovGeometry.h | 4 +- ...arR6_SonnendruckerGyro_ShafranovGeometry.h | 4 +- .../polarR6_Sonnendrucker_ShafranovGeometry.h | 4 +- .../polarR6_ZoniGyro_CzarnyGeometry.h | 4 +- .../polarR6_ZoniGyro_ShafranovGeometry.h | 4 +- ...olarR6_ZoniShiftedGyro_ShafranovGeometry.h | 4 +- .../polarR6_ZoniShifted_CzarnyGeometry.h | 4 +- .../polarR6_ZoniShifted_ShafranovGeometry.h | 4 +- .../SourceTerms/polarR6_Zoni_CzarnyGeometry.h | 4 +- .../polarR6_Zoni_ShafranovGeometry.h | 4 +- ...efined_ZoniShiftedGyro_ShafranovGeometry.h | 4 +- include/Interpolation/interpolation.h | 23 ++++--- include/Level/level.h | 3 +- include/Level/levelCache.inl | 15 +++-- .../Solvers/tridiagonal_solver.h | 9 ++- include/PolarGrid/polargrid.h | 47 +++++++------- include/PolarGrid/polargrid.inl | 40 ++++++------ include/Residual/ResidualGive/applyAGive.inl | 15 ++--- include/Residual/ResidualGive/residualGive.h | 3 +- .../Residual/ResidualGive/residualGive.inl | 6 +- include/Residual/ResidualTake/applyATake.inl | 20 +++--- include/Residual/ResidualTake/residualTake.h | 3 +- .../Residual/ResidualTake/residualTake.inl | 6 +- include/Residual/residual.h | 3 +- .../Smoother/SmootherGive/applyAscOrtho.inl | 64 +++++++++---------- .../SmootherGive/buildInnerBoundaryAsc.inl | 28 ++++---- .../SmootherGive/buildTridiagonalAsc.inl | 24 ++++--- include/Smoother/SmootherGive/smootherGive.h | 15 ++--- .../Smoother/SmootherGive/smootherGive.inl | 13 ++-- .../Smoother/SmootherGive/solveAscSystem.inl | 22 +++---- .../Smoother/SmootherTake/applyAscOrtho.inl | 57 ++++++++--------- .../SmootherTake/buildInnerBoundaryAsc.inl | 20 +++--- .../SmootherTake/buildTridiagonalAsc.inl | 11 ++-- include/Smoother/SmootherTake/smootherTake.h | 15 ++--- .../Smoother/SmootherTake/smootherTake.inl | 13 ++-- .../Smoother/SmootherTake/solveAscSystem.inl | 24 +++---- src/ConfigParser/config_parser.cpp | 3 +- .../cartesianR2_Poisson_CircularGeometry.cpp | 3 +- .../cartesianR2_Poisson_CzarnyGeometry.cpp | 4 +- .../cartesianR2_Poisson_ShafranovGeometry.cpp | 4 +- ...nR2_SonnendruckerGyro_CircularGeometry.cpp | 4 +- ...esianR2_Sonnendrucker_CircularGeometry.cpp | 4 +- ...rtesianR2_Sonnendrucker_CzarnyGeometry.cpp | 5 +- ...sianR2_Sonnendrucker_ShafranovGeometry.cpp | 6 +- .../cartesianR2_ZoniGyro_CircularGeometry.cpp | 3 +- .../cartesianR2_ZoniGyro_CzarnyGeometry.cpp | 3 +- ...cartesianR2_ZoniGyro_ShafranovGeometry.cpp | 4 +- ...ianR2_ZoniShiftedGyro_CircularGeometry.cpp | 4 +- ...anR2_ZoniShiftedGyro_ShafranovGeometry.cpp | 6 +- ...rtesianR2_ZoniShifted_CircularGeometry.cpp | 3 +- ...cartesianR2_ZoniShifted_CzarnyGeometry.cpp | 3 +- ...tesianR2_ZoniShifted_ShafranovGeometry.cpp | 5 +- .../cartesianR2_Zoni_CircularGeometry.cpp | 3 +- .../cartesianR2_Zoni_ShafranovGeometry.cpp | 5 +- .../cartesianR6_Poisson_CircularGeometry.cpp | 3 +- .../cartesianR6_Poisson_CzarnyGeometry.cpp | 4 +- .../cartesianR6_Poisson_ShafranovGeometry.cpp | 4 +- ...nR6_SonnendruckerGyro_CircularGeometry.cpp | 4 +- ...esianR6_Sonnendrucker_CircularGeometry.cpp | 4 +- ...rtesianR6_Sonnendrucker_CzarnyGeometry.cpp | 5 +- ...sianR6_Sonnendrucker_ShafranovGeometry.cpp | 6 +- .../cartesianR6_ZoniGyro_CircularGeometry.cpp | 3 +- .../cartesianR6_ZoniGyro_CzarnyGeometry.cpp | 3 +- ...cartesianR6_ZoniGyro_ShafranovGeometry.cpp | 4 +- ...ianR6_ZoniShiftedGyro_CircularGeometry.cpp | 4 +- ...anR6_ZoniShiftedGyro_ShafranovGeometry.cpp | 6 +- ...rtesianR6_ZoniShifted_CircularGeometry.cpp | 3 +- ...cartesianR6_ZoniShifted_CzarnyGeometry.cpp | 3 +- ...tesianR6_ZoniShifted_ShafranovGeometry.cpp | 5 +- .../cartesianR6_Zoni_CircularGeometry.cpp | 3 +- .../cartesianR6_Zoni_ShafranovGeometry.cpp | 5 +- .../polarR6_Poisson_CircularGeometry.cpp | 3 +- .../polarR6_Poisson_ShafranovGeometry.cpp | 5 +- ...rR6_SonnendruckerGyro_CircularGeometry.cpp | 4 +- ...larR6_SonnendruckerGyro_CzarnyGeometry.cpp | 5 +- ...R6_SonnendruckerGyro_ShafranovGeometry.cpp | 6 +- ...polarR6_Sonnendrucker_CircularGeometry.cpp | 3 +- .../polarR6_Sonnendrucker_CzarnyGeometry.cpp | 3 +- ...olarR6_Sonnendrucker_ShafranovGeometry.cpp | 5 +- .../polarR6_ZoniGyro_CircularGeometry.cpp | 3 +- .../polarR6_ZoniGyro_ShafranovGeometry.cpp | 5 +- ...larR6_ZoniShiftedGyro_CircularGeometry.cpp | 3 +- ...polarR6_ZoniShiftedGyro_CulhamGeometry.cpp | 3 +- ...polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp | 3 +- ...arR6_ZoniShiftedGyro_ShafranovGeometry.cpp | 5 +- .../polarR6_ZoniShifted_CircularGeometry.cpp | 3 +- .../polarR6_ZoniShifted_CzarnyGeometry.cpp | 4 +- .../polarR6_ZoniShifted_ShafranovGeometry.cpp | 4 +- ...fined_ZoniShiftedGyro_CircularGeometry.cpp | 3 +- ...refined_ZoniShiftedGyro_CulhamGeometry.cpp | 3 +- ...refined_ZoniShiftedGyro_CzarnyGeometry.cpp | 3 +- ...ined_ZoniShiftedGyro_ShafranovGeometry.cpp | 5 +- .../extrapolated_prolongation.cpp | 3 +- .../extrapolated_restriction.cpp | 3 +- src/Interpolation/fmg_interpolation.cpp | 8 ++- src/Interpolation/injection.cpp | 8 ++- src/Interpolation/prolongation.cpp | 11 ++-- src/Interpolation/restriction.cpp | 8 ++- src/PolarGrid/anisotropic_division.cpp | 7 +- src/PolarGrid/polargrid.cpp | 36 ++++++----- src/convergence_order.cpp | 4 +- src/strong_scaling.cpp | 3 +- src/weak_scaling.cpp | 3 +- tests/GMGPolar/pcg_tests.cpp | 5 +- tests/GMGPolar/solve_tests.cpp | 5 +- .../extrapolated_prolongation.cpp | 5 +- .../extrapolated_restriction.cpp | 3 +- tests/Interpolation/prolongation.cpp | 4 +- tests/Interpolation/restriction.cpp | 5 +- tests/test_tools.h | 4 +- 157 files changed, 722 insertions(+), 676 deletions(-) mode change 100755 => 100644 include/PolarGrid/polargrid.inl diff --git a/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl b/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl index 8704e035..3c80e331 100644 --- a/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl +++ b/include/DirectSolver/DirectSolverGive/applySymmetryShift.inl @@ -7,14 +7,14 @@ template void DirectSolverGive::applySymmetryShiftInnerBoundary(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; - const LevelCacheType& level_cache = DirectSolver::level_cache_; + const PolarGrid& grid = DirectSolver::grid_; + const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(DirectSolver::DirBC_Interior_); Kokkos::parallel_for( - "DirectSolverGive: applySymmetryShiftInnerBoundary", - Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { + "DirectSolverGive: applySymmetryShiftInnerBoundary", Kokkos::RangePolicy(0, 1), + KOKKOS_LAMBDA(const int) { int i_r; double r; int global_index; @@ -72,12 +72,12 @@ void DirectSolverGive::applySymmetryShiftInnerBoundary(Vector void DirectSolverGive::applySymmetryShiftOuterBoundary(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; - const LevelCacheType& level_cache = DirectSolver::level_cache_; + const PolarGrid& grid = DirectSolver::grid_; + const LevelCacheType& level_cache = DirectSolver::level_cache_; Kokkos::parallel_for( - "DirectSolverGive: applySymmetryShiftOuterBoundary", - Kokkos::RangePolicy(0, 1), KOKKOS_LAMBDA(const int) { + "DirectSolverGive: applySymmetryShiftOuterBoundary", Kokkos::RangePolicy(0, 1), + KOKKOS_LAMBDA(const int) { int i_r; double r; int global_index; @@ -135,8 +135,8 @@ void DirectSolverGive::applySymmetryShiftOuterBoundary(Vector void DirectSolverGive::applySymmetryShift(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; - const bool DirBC_Interior = DirectSolver::DirBC_Interior_; + const PolarGrid& grid = DirectSolver::grid_; + const bool DirBC_Interior = DirectSolver::DirBC_Interior_; assert(std::ssize(x) == grid.numberOfNodes()); assert(grid.nr() >= 4); diff --git a/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl index ca52ec52..005e0387 100644 --- a/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverGive/buildSolverMatrix.inl @@ -7,9 +7,8 @@ namespace direct_solver_give #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. -static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, - int ptr, const int offset, const int row, const int column, - const double value) +static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, int ptr, const int offset, + const int row, const int column, const double value) { matrix.set_row_index(ptr + offset, row); matrix.set_col_index(ptr + offset, column); @@ -17,9 +16,8 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, - int ptr, const int offset, const int row, const int column, - const double value) +static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR& matrix, int ptr, const int offset, + const int row, const int column, const double value) { matrix.set_row_nz_index(row, offset, column); matrix.increase_row_nz_entry(row, offset, value); @@ -28,8 +26,9 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR static KOKKOS_INLINE_FUNCTION void -nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - const bool DirBC_Interior, const SystemMatrix& solver_matrix) +nodeBuildSolverMatrixGive(const int i_r, const int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, const bool DirBC_Interior, + const SystemMatrix& solver_matrix) { /* ---------------------------------------- */ /* Compute or retrieve stencil coefficients */ @@ -799,9 +798,9 @@ typename DirectSolverGive::SystemMatrix DirectSolverGive& grid = DirectSolver::grid_; - const LevelCacheType& level_cache = DirectSolver::level_cache_; - const bool DirBC_Interior = DirectSolver::DirBC_Interior_; + const PolarGrid& grid = DirectSolver::grid_; + const LevelCacheType& level_cache = DirectSolver::level_cache_; + const bool DirBC_Interior = DirectSolver::DirBC_Interior_; assert(validateSolverMatrixIndexing(grid, DirBC_Interior) && "Solver matrix indexing is inconsistent"); diff --git a/include/DirectSolver/DirectSolverGive/directSolverGive.h b/include/DirectSolver/DirectSolverGive/directSolverGive.h index e5cc9e36..a21063ce 100644 --- a/include/DirectSolver/DirectSolverGive/directSolverGive.h +++ b/include/DirectSolver/DirectSolverGive/directSolverGive.h @@ -9,7 +9,8 @@ template class DirectSolverGive : public DirectSolver { public: - explicit DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior); + explicit DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior); // Note: The rhs (right-hand side) vector gets overwritten during the solution process. void solveInPlace(HostVector solution) override; diff --git a/include/DirectSolver/DirectSolverGive/directSolverGive.inl b/include/DirectSolver/DirectSolverGive/directSolverGive.inl index 956fa4bd..05f09d13 100644 --- a/include/DirectSolver/DirectSolverGive/directSolverGive.inl +++ b/include/DirectSolver/DirectSolverGive/directSolverGive.inl @@ -1,8 +1,8 @@ #pragma once template -DirectSolverGive::DirectSolverGive(const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior) +DirectSolverGive::DirectSolverGive(const PolarGrid& grid, + const LevelCacheType& level_cache, bool DirBC_Interior) : DirectSolver(grid, level_cache, DirBC_Interior) #ifdef GMGPOLAR_USE_MUMPS , system_solver_(buildSolverMatrix()) @@ -16,7 +16,7 @@ DirectSolverGive::DirectSolverGive(const PolarGrid void DirectSolverGive::solveInPlace(HostVector h_solution) { - auto solution = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_solution); + auto solution = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_solution); // Adjusts the right-hand side vector to account for symmetry corrections. // This transforms the system matrixA * solution = rhs into the equivalent system: // symmetric_DBc(matrixA) * solution = rhs - applySymmetryShift(rhs). @@ -26,5 +26,5 @@ void DirectSolverGive::solveInPlace(HostVector h_solutio // Solves the adjusted system symmetric(matrixA) * solution = rhs using the MUMPS solver. system_solver_.solveInPlace(solution); - Kokkos::deep_copy(h_solution, solution); + Kokkos::deep_copy(h_solution, solution); } diff --git a/include/DirectSolver/DirectSolverGive/matrixStencil.inl b/include/DirectSolver/DirectSolverGive/matrixStencil.inl index b4bf0efa..2b8ac264 100644 --- a/include/DirectSolver/DirectSolverGive/matrixStencil.inl +++ b/include/DirectSolver/DirectSolverGive/matrixStencil.inl @@ -3,7 +3,8 @@ namespace direct_solver_give { -static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, + const bool DirBC_Interior) { int i_r, i_theta; grid.multiIndex(global_index, i_r, i_theta); @@ -33,7 +34,8 @@ static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGr Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, + const bool DirBC_Interior) { assert(0 <= i_r && i_r < grid.nr()); assert(grid.nr() >= 4); @@ -85,7 +87,8 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const Pol Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, + const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9; @@ -102,7 +105,8 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int i_theta, + const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; @@ -182,7 +186,8 @@ static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int Kokkos::abort("Invalid index for stencil"); } -static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, + const bool DirBC_Interior) { // 1. Check each node: getSolverMatrixIndex == cumulative sum of prior stencil sizes for (int global_index = 0; global_index < grid.numberOfNodes(); ++global_index) { diff --git a/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl b/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl index 8c7422c7..25e3b0af 100644 --- a/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl +++ b/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl @@ -7,8 +7,8 @@ template void DirectSolverTake::applySymmetryShiftInnerBoundary(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; - const LevelCacheType& level_cache = DirectSolver::level_cache_; + const PolarGrid& grid = DirectSolver::grid_; + const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(DirectSolver::DirBC_Interior_); @@ -52,8 +52,8 @@ void DirectSolverTake::applySymmetryShiftInnerBoundary(Vector void DirectSolverTake::applySymmetryShiftOuterBoundary(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; - const LevelCacheType& level_cache = DirectSolver::level_cache_; + const PolarGrid& grid = DirectSolver::grid_; + const LevelCacheType& level_cache = DirectSolver::level_cache_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); @@ -95,8 +95,8 @@ void DirectSolverTake::applySymmetryShiftOuterBoundary(Vector void DirectSolverTake::applySymmetryShift(Vector x) const { - const PolarGrid& grid = DirectSolver::grid_; - const bool DirBC_Interior = DirectSolver::DirBC_Interior_; + const PolarGrid& grid = DirectSolver::grid_; + const bool DirBC_Interior = DirectSolver::DirBC_Interior_; assert(std::ssize(x) == grid.numberOfNodes()); assert(grid.nr() >= 4); diff --git a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl index 6dc4a969..30a3cd04 100644 --- a/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl +++ b/include/DirectSolver/DirectSolverTake/buildSolverMatrix.inl @@ -7,8 +7,8 @@ namespace direct_solver_take #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. -static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, - const int ptr, const int offset, const int row, const int column, +static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, const int ptr, + const int offset, const int row, const int column, const double value) { matrix.set_row_index(ptr + offset, row); @@ -17,8 +17,8 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCOO& matrix, - const int ptr, const int offset, const int row, const int column, +static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR& matrix, const int ptr, + const int offset, const int row, const int column, const double value) { matrix.set_row_nz_index(row, offset, column); @@ -28,9 +28,9 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const SparseMatrixCSR static KOKKOS_INLINE_FUNCTION void -nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, - const SystemMatrix& solver_matrix, ConstVector& arr, ConstVector& att, - ConstVector& art, ConstVector& detDF, +nodeBuildSolverMatrixTake(const int i_r, const int i_theta, const PolarGrid& grid, + const bool DirBC_Interior, const SystemMatrix& solver_matrix, ConstVector& arr, + ConstVector& att, ConstVector& art, ConstVector& detDF, ConstVector& coeff_beta) { int ptr, offset; @@ -479,9 +479,9 @@ typename DirectSolverTake::SystemMatrix DirectSolverTake& grid = DirectSolver::grid_; - const LevelCacheType& level_cache = DirectSolver::level_cache_; - const bool DirBC_Interior = DirectSolver::DirBC_Interior_; + const PolarGrid& grid = DirectSolver::grid_; + const LevelCacheType& level_cache = DirectSolver::level_cache_; + const bool DirBC_Interior = DirectSolver::DirBC_Interior_; assert(validateSolverMatrixIndexing(grid, DirBC_Interior) && "Solver matrix indexing is inconsistent"); diff --git a/include/DirectSolver/DirectSolverTake/directSolverTake.h b/include/DirectSolver/DirectSolverTake/directSolverTake.h index cf69f2ec..60042499 100644 --- a/include/DirectSolver/DirectSolverTake/directSolverTake.h +++ b/include/DirectSolver/DirectSolverTake/directSolverTake.h @@ -9,7 +9,8 @@ template class DirectSolverTake : public DirectSolver { public: - explicit DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior); + explicit DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior); // Note: The rhs (right-hand side) vector gets overwritten during the solution process. void solveInPlace(HostVector solution) override; diff --git a/include/DirectSolver/DirectSolverTake/directSolverTake.inl b/include/DirectSolver/DirectSolverTake/directSolverTake.inl index bfaae589..9bdea7e9 100644 --- a/include/DirectSolver/DirectSolverTake/directSolverTake.inl +++ b/include/DirectSolver/DirectSolverTake/directSolverTake.inl @@ -1,8 +1,8 @@ #pragma once template -DirectSolverTake::DirectSolverTake(const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior) +DirectSolverTake::DirectSolverTake(const PolarGrid& grid, + const LevelCacheType& level_cache, bool DirBC_Interior) : DirectSolver(grid, level_cache, DirBC_Interior) #ifdef GMGPOLAR_USE_MUMPS , system_solver_(buildSolverMatrix()) @@ -16,7 +16,7 @@ DirectSolverTake::DirectSolverTake(const PolarGrid void DirectSolverTake::solveInPlace(HostVector h_solution) { - auto solution = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_solution); + auto solution = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_solution); // Adjusts the right-hand side vector to account for symmetry corrections. // This transforms the system matrixA * solution = rhs into the equivalent system: // symmetric_DBc(matrixA) * solution = rhs - applySymmetryShift(rhs). @@ -26,5 +26,5 @@ void DirectSolverTake::solveInPlace(HostVector h_solutio // Solves the adjusted system symmetric(matrixA) * solution = rhs using the MUMPS solver. system_solver_.solveInPlace(solution); - Kokkos::deep_copy(h_solution, solution); + Kokkos::deep_copy(h_solution, solution); } diff --git a/include/DirectSolver/DirectSolverTake/matrixStencil.inl b/include/DirectSolver/DirectSolverTake/matrixStencil.inl index a2bffec6..f192c130 100644 --- a/include/DirectSolver/DirectSolverTake/matrixStencil.inl +++ b/include/DirectSolver/DirectSolverTake/matrixStencil.inl @@ -3,7 +3,8 @@ namespace direct_solver_take { -static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGrid& grid, + const bool DirBC_Interior) { int i_r, i_theta; grid.multiIndex(global_index, i_r, i_theta); @@ -33,7 +34,8 @@ static KOKKOS_INLINE_FUNCTION int getStencilSize(int global_index, const PolarGr return -1; } -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const PolarGrid& grid, + const bool DirBC_Interior) { KOKKOS_ASSERT(0 <= i_r && i_r < grid.nr()); KOKKOS_ASSERT(grid.nr() >= 4); @@ -84,7 +86,8 @@ static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const Pol } } -static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, + const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9; @@ -101,7 +104,8 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountSolverMatrix(const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int i_theta, + const PolarGrid& grid, const bool DirBC_Interior) { const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7; @@ -182,7 +186,8 @@ static KOKKOS_INLINE_FUNCTION int getSolverMatrixIndex(const int i_r, const int return -1; } -static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION bool validateSolverMatrixIndexing(const PolarGrid& grid, + const bool DirBC_Interior) { // 1. Check each node: getSolverMatrixIndex == cumulative sum of prior stencil sizes for (int global_index = 0; global_index < grid.numberOfNodes(); ++global_index) { diff --git a/include/DirectSolver/directSolver.h b/include/DirectSolver/directSolver.h index 41364349..881dd6bf 100644 --- a/include/DirectSolver/directSolver.h +++ b/include/DirectSolver/directSolver.h @@ -26,7 +26,8 @@ template class DirectSolver { public: - explicit DirectSolver(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior) + explicit DirectSolver(const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior) : grid_(grid) , level_cache_(level_cache) , DirBC_Interior_(DirBC_Interior) diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl index 3e3390e1..82c6afd7 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl @@ -6,8 +6,8 @@ namespace extrapolated_smoother_give template static KOKKOS_INLINE_FUNCTION void nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, - const LevelCacheType& level_cache, const bool DirBC_Interior, - ConstVector& x, ConstVector& rhs, Vector& result) + const LevelCacheType& level_cache, const bool DirBC_Interior, ConstVector& x, + ConstVector& rhs, Vector& result) { KOKKOS_ASSERT(i_r >= 0 && i_r < grid.numberSmootherCircles()); @@ -198,8 +198,8 @@ nodeApplyAscOrthoCircleGiveInside(const int i_r, const int i_theta, const PolarG template static KOKKOS_INLINE_FUNCTION void nodeApplyAscOrthoCircleGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, - const LevelCacheType& level_cache, const bool DirBC_Interior, - ConstVector& x, ConstVector& rhs, Vector& result) + const LevelCacheType& level_cache, const bool DirBC_Interior, ConstVector& x, + ConstVector& rhs, Vector& result) { KOKKOS_ASSERT(i_r >= 0 && i_r <= grid.numberSmootherCircles()); @@ -365,8 +365,8 @@ nodeApplyAscOrthoCircleGiveOutside(const int i_r, const int i_theta, const Polar template static KOKKOS_INLINE_FUNCTION void nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarGrid& grid, - const LevelCacheType& level_cache, const bool DirBC_Interior, - ConstVector& x, ConstVector& rhs, Vector& result) + const LevelCacheType& level_cache, const bool DirBC_Interior, ConstVector& x, + ConstVector& rhs, Vector& result) { KOKKOS_ASSERT(i_r >= grid.numberSmootherCircles() - 1 && i_r < grid.nr()); @@ -703,8 +703,8 @@ nodeApplyAscOrthoRadialGiveInside(const int i_r, const int i_theta, const PolarG template static KOKKOS_INLINE_FUNCTION void nodeApplyAscOrthoRadialGiveOutside(const int i_r, const int i_theta, const PolarGrid& grid, - const LevelCacheType& level_cache, const bool DirBC_Interior, - ConstVector& x, ConstVector& rhs, Vector& result) + const LevelCacheType& level_cache, const bool DirBC_Interior, ConstVector& x, + ConstVector& rhs, Vector& result) { KOKKOS_ASSERT(i_r >= grid.numberSmootherCircles() && i_r < grid.nr()); @@ -853,9 +853,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(C return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; /* ----------------------------------------------- */ /* 1. Black-Circle update (u_bc): */ @@ -937,9 +937,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(C return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; /* ----------------------------------------------- */ /* 2. White-Circle update (u_wc): */ @@ -1022,9 +1022,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(C return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; /* ----------------------------------------------- */ /* 3. Black-Radial update (u_br): */ @@ -1107,9 +1107,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(C return (end - start + offset - 1) / offset; }; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; /* ----------------------------------------------- */ /* 4. White-Radial update (u_wr): */ diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl index 87f69d17..df2dcec7 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildInnerBoundaryAsc.inl @@ -9,9 +9,9 @@ namespace extrapolated_smoother_give #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. -static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, - const int row, const int column, const double value) +static KOKKOS_INLINE_FUNCTION void update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, + const int offset, const int row, const int column, + const double value) { matrix.set_row_index(ptr + offset, row); matrix.set_col_index(ptr + offset, column); @@ -19,9 +19,9 @@ update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int pt } #else // When using the in-house solver, the matrix is stored in CSR format. -static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, - const int row, const int column, const double value) +static KOKKOS_INLINE_FUNCTION void update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, + const int offset, const int row, const int column, + const double value) { matrix.set_row_nz_index(row, offset, column); matrix.increase_row_nz_entry(row, offset, value); @@ -30,8 +30,9 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int pt template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) +nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, const bool DirBC_Interior, + const InnerBoundaryMatrix& matrix) { using extrapolated_smoother_give::update_CSR_COO_MatrixElement; @@ -193,8 +194,9 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) +nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, const bool DirBC_Interior, + const InnerBoundaryMatrix& matrix) { using extrapolated_smoother_give::update_CSR_COO_MatrixElement; @@ -264,9 +266,9 @@ ExtrapolatedSmootherGive::buildInteriorBoundarySolverMatrix() using extrapolated_smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_0; using extrapolated_smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_1; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const int ntheta = grid.ntheta(); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl index 6ba95bee..8bcb5600 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/buildTridiagonalAsc.inl @@ -17,11 +17,10 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS } template -static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, - const LevelCacheType& level_cache, const bool DirBC_Interior, - const BatchedTridiagonalSolver& circle_tridiagonal_solver, - const BatchedTridiagonalSolver& radial_tridiagonal_solver) +static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesCircleSection( + const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, + const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, + const BatchedTridiagonalSolver& radial_tridiagonal_solver) { using extrapolated_smoother_give::updateMatrixElement; @@ -478,11 +477,10 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta } template -static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, - const LevelCacheType& level_cache, const bool DirBC_Interior, - const BatchedTridiagonalSolver& circle_tridiagonal_solver, - const BatchedTridiagonalSolver& radial_tridiagonal_solver) +static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesRadialSection( + const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, + const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, + const BatchedTridiagonalSolver& radial_tridiagonal_solver) { using extrapolated_smoother_give::updateMatrixElement; @@ -1083,9 +1081,9 @@ void ExtrapolatedSmootherGive::buildTridiagonalSolverMatrices() using extrapolated_smoother_give::nodeBuildTridiagonalSolverMatricesCircleSection; using extrapolated_smoother_give::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const BatchedTridiagonalSolver& circle_tridiagonal_solver = circle_tridiagonal_solver_; const BatchedTridiagonalSolver& radial_tridiagonal_solver = radial_tridiagonal_solver_; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h index 15f25dd4..c5c216cc 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.h @@ -60,7 +60,8 @@ class ExtrapolatedSmootherGive : public ExtrapolatedSmoother public: // Constructs the coupled circle-radial extrapolated smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior); + explicit ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior); // Performs one full coupled extrapolated smoothing sweep: // BC -> WC -> BR -> WR @@ -123,14 +124,10 @@ class ExtrapolatedSmootherGive : public ExtrapolatedSmoother // Compute temp = f_sc − A_sc^ortho * u_sc^ortho (precomputed right-hand side) // where x = u_sc and rhs = f_sc - void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, - Vector temp); + void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, Vector temp); /* ----------------- */ /* Line-wise solvers */ diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl index 963441da..a670b3e8 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/extrapolatedSmootherGive.inl @@ -42,12 +42,13 @@ ExtrapolatedSmootherGive::ExtrapolatedSmootherGive(const PolarGr // - The system is then solved in-place in temp, and the results // are copied back to x. template -void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector h_x, HostConstVector h_rhs, +void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector h_x, + HostConstVector h_rhs, HostVector h_temp) { - auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); - auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); - auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); @@ -71,7 +72,7 @@ void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector< Kokkos::parallel_for( "ExtrapolatedSmootherGive: Init Temp (Radial)", Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, - {grid.ntheta(), grid.nr()}), + {grid.ntheta(), grid.nr()}), KOKKOS_LAMBDA(const int i_theta, const int i_r) { const int index = grid.index(i_r, i_theta); temp[index] = (i_r & 1 || i_theta & 1) ? rhs[index] : x[index]; @@ -91,6 +92,6 @@ void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector< applyAscOrthoWhiteRadialSection(x, rhs, temp); solveWhiteRadialSection(x, temp); - Kokkos::deep_copy(h_x, x); - Kokkos::deep_copy(h_temp, temp); + Kokkos::deep_copy(h_x, x); + Kokkos::deep_copy(h_temp, temp); } diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl index 497d0914..5ae9fbb1 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/smootherStencil.inl @@ -17,8 +17,8 @@ namespace extrapolated_smoother_give // - Non-zero matrix indicesare obtained via `ptr + offset` // - A offset value of `-1` means the position is not included in the stencil pattern. // - Other values (0, 1, 2, ..., stencil_size - 1) correspond to valid stencil indices. -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, - const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION const Stencil& +getStencil(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // clang-format off static constexpr Stencil stencil_center = { @@ -83,7 +83,8 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const } } -static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, + const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl index aaaad8c0..32993496 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/solveAscSystem.inl @@ -5,8 +5,8 @@ void ExtrapolatedSmootherGive::solveBlackCircleSection(Vector& grid = ExtrapolatedSmoother::grid_; - int start = 0; - int end = grid.numberCircularSmootherNodes(); + int start = 0; + int end = grid.numberCircularSmootherNodes(); Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); bool is_inner_circle_black = grid.numberSmootherCircles() % 2 != 0; @@ -34,7 +34,7 @@ void ExtrapolatedSmootherGive::solveBlackCircleSection(Vector>({0, 0}, - {num_black_circles, grid.ntheta()}), + {num_black_circles, grid.ntheta()}), KOKKOS_LAMBDA(const int circle_task, const int i_theta) { const int i_r = start_black_circles + circle_task * 2; const int index = grid.index(i_r, i_theta); @@ -48,8 +48,8 @@ void ExtrapolatedSmootherGive::solveWhiteCircleSection(Vector& grid = ExtrapolatedSmoother::grid_; - int start = 0; - int end = grid.numberCircularSmootherNodes(); + int start = 0; + int end = grid.numberCircularSmootherNodes(); Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); bool is_inner_circle_white = grid.numberSmootherCircles() % 2 == 0; @@ -77,7 +77,7 @@ void ExtrapolatedSmootherGive::solveWhiteCircleSection(Vector>({0, 0}, - {num_white_circles, grid.ntheta()}), + {num_white_circles, grid.ntheta()}), KOKKOS_LAMBDA(const int circle_task, const int i_theta) { const int i_r = start_white_circles + circle_task * 2; const int index = grid.index(i_r, i_theta); @@ -91,8 +91,8 @@ void ExtrapolatedSmootherGive::solveBlackRadialSection(Vector& grid = ExtrapolatedSmoother::grid_; - int start = grid.numberCircularSmootherNodes(); - int end = grid.numberOfNodes(); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Diagonal Solve @@ -107,7 +107,7 @@ void ExtrapolatedSmootherGive::solveBlackRadialSection(Vector>({0, grid.numberSmootherCircles()}, - {num_black_radial_lines, grid.nr()}), + {num_black_radial_lines, grid.nr()}), KOKKOS_LAMBDA(const int radial_task, const int i_r) { const int i_theta = start_black_radials + radial_task * 2; const int index = grid.index(i_r, i_theta); @@ -121,8 +121,8 @@ void ExtrapolatedSmootherGive::solveWhiteRadialSection(Vector& grid = ExtrapolatedSmoother::grid_; - int start = grid.numberCircularSmootherNodes(); - int end = grid.numberOfNodes(); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve @@ -137,7 +137,7 @@ void ExtrapolatedSmootherGive::solveWhiteRadialSection(Vector>({0, grid.numberSmootherCircles()}, - {num_white_radial_lines, grid.nr()}), + {num_white_radial_lines, grid.nr()}), KOKKOS_LAMBDA(const int radial_task, const int i_r) { const int i_theta = start_white_radials + radial_task * 2; const int index = grid.index(i_r, i_theta); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl index 5dbdf8ea..47a9a881 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl @@ -4,10 +4,10 @@ namespace extrapolated_smoother_take { static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, - ConstVector& x, ConstVector& rhs, Vector& result, - ConstVector& arr, ConstVector& att, ConstVector& art, - ConstVector& detDF, ConstVector& coeff_beta) +nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, + const bool DirBC_Interior, ConstVector& x, ConstVector& rhs, + Vector& result, ConstVector& arr, ConstVector& att, + ConstVector& art, ConstVector& detDF, ConstVector& coeff_beta) { KOKKOS_ASSERT(i_r >= 0 && i_r <= grid.numberSmootherCircles()); @@ -187,9 +187,8 @@ nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, ConstVector& x, ConstVector& rhs, Vector& result, - ConstVector& arr, const ConstVector& att, - ConstVector& art, const ConstVector& detDF, - ConstVector& coeff_beta) + ConstVector& arr, const ConstVector& att, ConstVector& art, + const ConstVector& detDF, ConstVector& coeff_beta) { assert(i_r >= grid.numberSmootherCircles() - 1 && i_r < grid.nr()); @@ -467,9 +466,9 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackCircleSection(C { using extrapolated_smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); @@ -507,9 +506,9 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteCircleSection(C { using extrapolated_smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); @@ -547,9 +546,9 @@ void ExtrapolatedSmootherTake::applyAscOrthoBlackRadialSection(C { using extrapolated_smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); @@ -587,9 +586,9 @@ void ExtrapolatedSmootherTake::applyAscOrthoWhiteRadialSection(C { using extrapolated_smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl index 28ec915c..c22918c6 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildInnerBoundaryAsc.inl @@ -7,9 +7,9 @@ namespace extrapolated_smoother_take #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. -static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, - const int row, const int column, const double value) +static KOKKOS_INLINE_FUNCTION void update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, + const int offset, const int row, const int column, + const double value) { matrix.set_row_index(ptr + offset, row); matrix.set_col_index(ptr + offset, column); @@ -17,9 +17,9 @@ update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int pt } #else // When using the in-house solver, the matrix is stored in CSR format. -static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, - const int row, const int column, const double value) +static KOKKOS_INLINE_FUNCTION void update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, + const int offset, const int row, const int column, + const double value) { matrix.set_row_nz_index(row, offset, column); matrix.set_row_nz_entry(row, offset, value); @@ -28,9 +28,9 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int pt template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, - const InnerBoundaryMatrix& matrix, ConstVector& arr, - ConstVector& att, ConstVector& art, +nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, + const bool DirBC_Interior, const InnerBoundaryMatrix& matrix, + ConstVector& arr, ConstVector& att, ConstVector& art, ConstVector& detDF, ConstVector& coeff_beta) { using extrapolated_smoother_take::getCircleAscIndex; @@ -157,9 +157,9 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() using extrapolated_smoother_take::getNonZeroCountCircleAsc; using extrapolated_smoother_take::nodeBuildInteriorBoundarySolverMatrix; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; const int ntheta = grid.ntheta(); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl index aff288fd..385c2faa 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl @@ -18,8 +18,7 @@ static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesCircleSecti const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver, ConstVector& arr, - ConstVector& att, ConstVector& art, ConstVector& detDF, - ConstVector& coeff_beta) + ConstVector& att, ConstVector& art, ConstVector& detDF, ConstVector& coeff_beta) { using extrapolated_smoother_take::updateMatrixElement; @@ -167,8 +166,7 @@ static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesRadialSecti const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver, ConstVector& arr, - ConstVector& att, ConstVector& art, ConstVector& detDF, - ConstVector& coeff_beta) + ConstVector& att, ConstVector& art, ConstVector& detDF, ConstVector& coeff_beta) { using extrapolated_smoother_take::updateMatrixElement; @@ -533,9 +531,9 @@ void ExtrapolatedSmootherTake::buildTridiagonalSolverMatrices() using extrapolated_smoother_take::nodeBuildTridiagonalSolverMatricesCircleSection; using extrapolated_smoother_take::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = ExtrapolatedSmoother::grid_; - const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; - const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; + const PolarGrid& grid = ExtrapolatedSmoother::grid_; + const bool DirBC_Interior = ExtrapolatedSmoother::DirBC_Interior_; + const LevelCacheType& level_cache = ExtrapolatedSmoother::level_cache_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h index eac2ccd9..d8552bbe 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.h @@ -60,7 +60,8 @@ class ExtrapolatedSmootherTake : public ExtrapolatedSmoother public: // Constructs the coupled circle-radial extrapolated smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior); + explicit ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior); // Performs one full coupled extrapolated smoothing sweep: // BC -> WC -> BR -> WR @@ -122,14 +123,10 @@ class ExtrapolatedSmootherTake : public ExtrapolatedSmoother // Compute temp = f_sc − A_sc^ortho * u_sc^ortho (precomputed right-hand side) // where x = u_sc and rhs = f_sc - void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, - Vector temp); + void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, Vector temp); /* ----------------- */ /* Line-wise solvers */ diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl index f3a6d85f..bc3e9687 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/extrapolatedSmootherTake.inl @@ -43,12 +43,13 @@ ExtrapolatedSmootherTake::ExtrapolatedSmootherTake(const PolarGr // are copied back to x. template -void ExtrapolatedSmootherTake::extrapolatedSmoothing(HostVector h_x, HostConstVector h_rhs, +void ExtrapolatedSmootherTake::extrapolatedSmoothing(HostVector h_x, + HostConstVector h_rhs, HostVector h_temp) { - auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); - auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); - auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); @@ -65,6 +66,6 @@ void ExtrapolatedSmootherTake::extrapolatedSmoothing(HostVector< applyAscOrthoWhiteRadialSection(x, rhs, temp); solveWhiteRadialSection(x, temp); - Kokkos::deep_copy(h_x, x); - Kokkos::deep_copy(h_temp, temp); + Kokkos::deep_copy(h_x, x); + Kokkos::deep_copy(h_temp, temp); } diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl index 985eaa76..d8368d1c 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/smootherStencil.inl @@ -17,8 +17,8 @@ namespace extrapolated_smoother_take // - Non-zero matrix indicesare obtained via `ptr + offset` // - A offset value of `-1` means the position is not included in the stencil pattern. // - Other values (0, 1, 2, ..., stencil_size - 1) correspond to valid stencil indices. -static KOKKOS_INLINE_FUNCTION const Stencil& getStencil(const int i_r, const int i_theta, const PolarGrid& grid, - const bool DirBC_Interior) +static KOKKOS_INLINE_FUNCTION const Stencil& +getStencil(const int i_r, const int i_theta, const PolarGrid& grid, const bool DirBC_Interior) { // clang-format off static constexpr Stencil stencil_center = { @@ -83,7 +83,8 @@ static KOKKOS_INLINE_FUNCTION int getNonZeroCountCircleAsc(const int i_r, const } } -static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, const PolarGrid& grid, +static KOKKOS_INLINE_FUNCTION int getCircleAscIndex(const int i_r, const int i_theta, + const PolarGrid& grid, const bool DirBC_Interior) { // Only i_r = 0 is implemented. diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl index 73ee308a..82d3002f 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/solveAscSystem.inl @@ -5,8 +5,8 @@ void ExtrapolatedSmootherTake::solveBlackCircleSection(Vector& grid = ExtrapolatedSmoother::grid_; - int start = 0; - int end = grid.numberCircularSmootherNodes(); + int start = 0; + int end = grid.numberCircularSmootherNodes(); Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); bool is_inner_circle_black = grid.numberSmootherCircles() % 2 != 0; @@ -34,7 +34,7 @@ void ExtrapolatedSmootherTake::solveBlackCircleSection(Vector>({0, 0}, - {num_black_circles, grid.ntheta()}), + {num_black_circles, grid.ntheta()}), KOKKOS_LAMBDA(const int circle_task, const int i_theta) { const int i_r = start_black_circles + circle_task * 2; const int index = grid.index(i_r, i_theta); @@ -48,8 +48,8 @@ void ExtrapolatedSmootherTake::solveWhiteCircleSection(Vector& grid = ExtrapolatedSmoother::grid_; - int start = 0; - int end = grid.numberCircularSmootherNodes(); + int start = 0; + int end = grid.numberCircularSmootherNodes(); Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); bool is_inner_circle_white = grid.numberSmootherCircles() % 2 == 0; @@ -77,7 +77,7 @@ void ExtrapolatedSmootherTake::solveWhiteCircleSection(Vector>({0, 0}, - {num_white_circles, grid.ntheta()}), + {num_white_circles, grid.ntheta()}), KOKKOS_LAMBDA(const int circle_task, const int i_theta) { const int i_r = start_white_circles + circle_task * 2; const int index = grid.index(i_r, i_theta); @@ -91,8 +91,8 @@ void ExtrapolatedSmootherTake::solveBlackRadialSection(Vector& grid = ExtrapolatedSmoother::grid_; - int start = grid.numberCircularSmootherNodes(); - int end = grid.numberOfNodes(); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Diagonal Solve @@ -107,7 +107,7 @@ void ExtrapolatedSmootherTake::solveBlackRadialSection(Vector>({0, grid.numberSmootherCircles()}, - {num_black_radial_lines, grid.nr()}), + {num_black_radial_lines, grid.nr()}), KOKKOS_LAMBDA(const int radial_task, const int i_r) { const int i_theta = start_black_radials + radial_task * 2; const int index = grid.index(i_r, i_theta); @@ -121,8 +121,8 @@ void ExtrapolatedSmootherTake::solveWhiteRadialSection(Vector& grid = ExtrapolatedSmoother::grid_; - int start = grid.numberCircularSmootherNodes(); - int end = grid.numberOfNodes(); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve @@ -137,7 +137,7 @@ void ExtrapolatedSmootherTake::solveWhiteRadialSection(Vector>({0, grid.numberSmootherCircles()}, - {num_white_radial_lines, grid.nr()}), + {num_white_radial_lines, grid.nr()}), KOKKOS_LAMBDA(const int radial_task, const int i_r) { const int i_theta = start_white_radials + radial_task * 2; const int index = grid.index(i_r, i_theta); diff --git a/include/ExtrapolatedSmoother/extrapolatedSmoother.h b/include/ExtrapolatedSmoother/extrapolatedSmoother.h index 0cc1f867..38ca430f 100644 --- a/include/ExtrapolatedSmoother/extrapolatedSmoother.h +++ b/include/ExtrapolatedSmoother/extrapolatedSmoother.h @@ -27,7 +27,8 @@ template class ExtrapolatedSmoother { public: - explicit ExtrapolatedSmoother(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior) + explicit ExtrapolatedSmoother(const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior) : grid_(grid) , level_cache_(level_cache) , DirBC_Interior_(DirBC_Interior) diff --git a/include/GMGPolar/gmgpolar.h b/include/GMGPolar/gmgpolar.h index a4311d21..280a5fa2 100644 --- a/include/GMGPolar/gmgpolar.h +++ b/include/GMGPolar/gmgpolar.h @@ -173,7 +173,8 @@ class GMGPolar : public IGMGPolar /* ----------------- */ /* Print information */ - void printSettings(const PolarGrid& finest_grid, const PolarGrid& coarsest_grid) const; + void printSettings(const PolarGrid& finest_grid, + const PolarGrid& coarsest_grid) const; void printIterationHeader(const ExactSolution* exact_solution); void printIterationInfo(int iteration, double current_residual_norm, double current_relative_residual_norm, const ExactSolution* exact_solution); diff --git a/include/GMGPolar/setup.h b/include/GMGPolar/setup.h index 618cf380..1c6a24d2 100644 --- a/include/GMGPolar/setup.h +++ b/include/GMGPolar/setup.h @@ -28,7 +28,8 @@ void GMGPolar::setup() if (extrapolation_ != ExtrapolationType::NONE) { const double precision = 1e-12; if (!checkUniformRefinement(*finest_grid, precision)) { - std::cerr << "[Extrapolation Warning] Finest PolarGrid is not from a single uniform refinement.\n"; + std::cerr << "[Extrapolation Warning] Finest PolarGrid is not from a single uniform " + "refinement.\n"; } } @@ -45,7 +46,8 @@ void GMGPolar::setup() levels_.emplace_back(0, std::move(finest_grid), std::move(finest_levelCache), extrapolation_, FMG_, PCG_FMG_); for (int level_depth = 1; level_depth < number_of_levels_; level_depth++) { - auto current_grid = std::make_unique>(coarseningGrid(levels_[level_depth - 1].grid())); + auto current_grid = + std::make_unique>(coarseningGrid(levels_[level_depth - 1].grid())); auto current_levelCache = std::make_unique>( *current_grid, density_profile_coefficients_, domain_geometry_, cache_density_profile_coefficients_, cache_domain_geometry_); @@ -147,7 +149,8 @@ void GMGPolar::setup() } template -int GMGPolar::chooseNumberOfLevels(const PolarGrid& finestGrid) +int GMGPolar::chooseNumberOfLevels( + const PolarGrid& finestGrid) { constexpr int minRadialNodes = 5; constexpr int minAngularDivisions = 4; @@ -383,8 +386,8 @@ void GMGPolar::build_rhs_f( } template -void GMGPolar::printSettings(const PolarGrid& finest_grid, - const PolarGrid& coarsest_grid) const +void GMGPolar::printSettings( + const PolarGrid& finest_grid, const PolarGrid& coarsest_grid) const { std::cout << "------------------------------\n"; @@ -582,8 +585,8 @@ void GMGPolar::printSettings(const P } template -bool GMGPolar::checkUniformRefinement(const PolarGrid& grid, - double tolerance) const +bool GMGPolar::checkUniformRefinement( + const PolarGrid& grid, double tolerance) const { // Radial direction for (int i_r = 1; i_r < grid.nr() - 1; i_r += 2) { diff --git a/include/GMGPolar/solver.h b/include/GMGPolar/solver.h index b74d5f8a..932d5bd8 100644 --- a/include/GMGPolar/solver.h +++ b/include/GMGPolar/solver.h @@ -586,7 +586,7 @@ std::pair GMGPolar:: Level& level, HostConstVector solution, HostVector error, const ExactSolution& exact_solution) { - const PolarGrid& grid = level.grid(); + const PolarGrid& grid = level.grid(); assert(solution.size() == error.size()); assert(std::ssize(solution) == grid.numberOfNodes()); diff --git a/include/GMGPolar/utils.h b/include/GMGPolar/utils.h index 7945dfff..125080d3 100644 --- a/include/GMGPolar/utils.h +++ b/include/GMGPolar/utils.h @@ -243,7 +243,7 @@ void GMGPolar::writeToVTK( const std::filesystem::path& file_path, const Level& level, HostConstVector grid_function) { - const PolarGrid& grid = level.grid(); + const PolarGrid& grid = level.grid(); assert(std::ssize(grid_function) == grid.numberOfNodes()); diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h index 8b96e0b2..659d5ef2 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR2_Poisson_CzarnyGeometry { public: - explicit CartesianR2_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, - double ellipticity_e); + explicit CartesianR2_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, + double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Poisson_CzarnyGeometry(const CartesianR2_Poisson_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h index f00d7c53..70d5c8bc 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR2_Poisson_ShafranovGeometry { public: - explicit CartesianR2_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR2_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Poisson_ShafranovGeometry(const CartesianR2_Poisson_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h index 539b1393..91dddb1a 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR2_Sonnendrucker_ShafranovGeometry { public: - explicit CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Sonnendrucker_ShafranovGeometry(const CartesianR2_Sonnendrucker_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h index 6595a9a5..80797ef6 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR2_ZoniGyro_ShafranovGeometry { public: - explicit CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniGyro_ShafranovGeometry(const CartesianR2_ZoniGyro_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h index bca34efa..8ae48280 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR2_ZoniShiftedGyro_ShafranovGeometry { public: - explicit CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniShiftedGyro_ShafranovGeometry(const CartesianR2_ZoniShiftedGyro_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h index 6764e104..4a8436c3 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR2_ZoniShifted_ShafranovGeometry { public: - explicit CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_ZoniShifted_ShafranovGeometry(const CartesianR2_ZoniShifted_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h index 97011e77..d28a8735 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR2_Zoni_CzarnyGeometry { public: - explicit CartesianR2_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, - double ellipticity_e); + explicit CartesianR2_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, + double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Zoni_CzarnyGeometry(const CartesianR2_Zoni_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h index 3da7f2f1..cc89ad11 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR2_Zoni_ShafranovGeometry { public: - explicit CartesianR2_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR2_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR2_Zoni_ShafranovGeometry(const CartesianR2_Zoni_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h index c17a9c4a..4d953037 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR6_Poisson_CzarnyGeometry { public: - explicit CartesianR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, - double ellipticity_e); + explicit CartesianR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, + double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Poisson_CzarnyGeometry(const CartesianR6_Poisson_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h index 74300b72..1f24ef61 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR6_Poisson_ShafranovGeometry { public: - explicit CartesianR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Poisson_ShafranovGeometry(const CartesianR6_Poisson_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h index 5b04a625..261dcc72 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR6_Sonnendrucker_ShafranovGeometry { public: - explicit CartesianR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Sonnendrucker_ShafranovGeometry(const CartesianR6_Sonnendrucker_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h index a1cee42e..ce4a2412 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR6_ZoniGyro_ShafranovGeometry { public: - explicit CartesianR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniGyro_ShafranovGeometry(const CartesianR6_ZoniGyro_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h index a476a815..d598b031 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR6_ZoniShiftedGyro_ShafranovGeometry { public: - explicit CartesianR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniShiftedGyro_ShafranovGeometry(const CartesianR6_ZoniShiftedGyro_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h index b07feb5c..61b22e46 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR6_ZoniShifted_ShafranovGeometry { public: - explicit CartesianR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_ZoniShifted_ShafranovGeometry(const CartesianR6_ZoniShifted_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h index 6928f6d6..bfcd8c31 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR6_Zoni_CzarnyGeometry { public: - explicit CartesianR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, - double ellipticity_e); + explicit CartesianR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, + double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Zoni_CzarnyGeometry(const CartesianR6_Zoni_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h index f65e9a93..bd2aec72 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class CartesianR6_Zoni_ShafranovGeometry { public: - explicit CartesianR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit CartesianR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION CartesianR6_Zoni_ShafranovGeometry(const CartesianR6_Zoni_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h index cee0455b..7200d410 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_Poisson_CzarnyGeometry { public: - explicit PolarR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, - double ellipticity_e); + explicit PolarR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, + double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_Poisson_CzarnyGeometry(const PolarR6_Poisson_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h index 9df44c7d..b92ce580 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_Poisson_ShafranovGeometry { public: - explicit PolarR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit PolarR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_Poisson_ShafranovGeometry(const PolarR6_Poisson_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h index c101c6b1..27d6888c 100644 --- a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_SonnendruckerGyro_ShafranovGeometry { public: - explicit PolarR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit PolarR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_SonnendruckerGyro_ShafranovGeometry(const PolarR6_SonnendruckerGyro_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h index a6fedb65..36f78293 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_Sonnendrucker_ShafranovGeometry { public: - explicit PolarR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit PolarR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_Sonnendrucker_ShafranovGeometry(const PolarR6_Sonnendrucker_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h index cac0cc85..b42ba165 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_ZoniGyro_CzarnyGeometry { public: - explicit PolarR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, - double ellipticity_e); + explicit PolarR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, + double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniGyro_CzarnyGeometry(const PolarR6_ZoniGyro_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h index 449c482e..97826d73 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_ZoniGyro_ShafranovGeometry { public: - explicit PolarR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit PolarR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniGyro_ShafranovGeometry(const PolarR6_ZoniGyro_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h index 249e7bb8..0f5d2323 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_ZoniShiftedGyro_ShafranovGeometry { public: - explicit PolarR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit PolarR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShiftedGyro_ShafranovGeometry(const PolarR6_ZoniShiftedGyro_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h index 32f3ae64..d948d80a 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_ZoniShifted_CzarnyGeometry { public: - explicit PolarR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, - double ellipticity_e); + explicit PolarR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, + double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShifted_CzarnyGeometry(const PolarR6_ZoniShifted_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h index 3308bf22..bc49f926 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_ZoniShifted_ShafranovGeometry { public: - explicit PolarR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit PolarR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_ZoniShifted_ShafranovGeometry(const PolarR6_ZoniShifted_ShafranovGeometry&) = default; diff --git a/include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h index b9570f57..2e30ca33 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Zoni_CzarnyGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_Zoni_CzarnyGeometry { public: - explicit PolarR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, - double ellipticity_e); + explicit PolarR6_Zoni_CzarnyGeometry(PolarGrid const& grid, double Rmax, + double inverse_aspect_ratio_epsilon, double ellipticity_e); KOKKOS_DEFAULTED_FUNCTION PolarR6_Zoni_CzarnyGeometry(const PolarR6_Zoni_CzarnyGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h index 9618a140..8844048d 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Zoni_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class PolarR6_Zoni_ShafranovGeometry { public: - explicit PolarR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit PolarR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION PolarR6_Zoni_ShafranovGeometry(const PolarR6_Zoni_ShafranovGeometry&) = default; KOKKOS_FUNCTION double operator()(std::size_t i_r, std::size_t i_theta) const; diff --git a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h index 4550e990..c70ae3b7 100644 --- a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,8 +12,8 @@ namespace gmgpolar class Refined_ZoniShiftedGyro_ShafranovGeometry { public: - explicit Refined_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, double elongation_kappa, - double shift_delta); + explicit Refined_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, + double elongation_kappa, double shift_delta); KOKKOS_DEFAULTED_FUNCTION Refined_ZoniShiftedGyro_ShafranovGeometry(const Refined_ZoniShiftedGyro_ShafranovGeometry&) = default; diff --git a/include/Interpolation/interpolation.h b/include/Interpolation/interpolation.h index 3163a465..00810375 100644 --- a/include/Interpolation/interpolation.h +++ b/include/Interpolation/interpolation.h @@ -19,25 +19,30 @@ class Interpolation explicit Interpolation(bool DirBC_Interior); /* Remark: This injection is not scaled. */ - void applyInjection(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, - HostConstVector fine_values) const; + void applyInjection(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, + HostVector coarse_result, HostConstVector fine_values) const; /* Bilinear interpolation operator */ - void applyProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, + void applyProlongation(const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const; - void applyExtrapolatedProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, - HostVector fine_result, HostConstVector coarse_values) const; + void applyExtrapolatedProlongation(const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector fine_result, + HostConstVector coarse_values) const; /* Scaled full weighting (FW) restriction operator. */ - void applyRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, HostVector coarse_result, + void applyRestriction(const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, HostVector coarse_result, HostConstVector fine_values) const; - void applyExtrapolatedRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, - HostVector coarse_result, HostConstVector fine_values) const; + void applyExtrapolatedRestriction(const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, HostVector coarse_result, + HostConstVector fine_values) const; /* Bicubic FMG interpolator 1/16 * [-1, 9, 9, -1] */ - void applyFMGInterpolation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, HostVector fine_result, + void applyFMGInterpolation(const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const; private: diff --git a/include/Level/level.h b/include/Level/level.h index 044f290e..1bfcd9e1 100644 --- a/include/Level/level.h +++ b/include/Level/level.h @@ -135,7 +135,8 @@ template & grid, const DensityProfileCoefficients& density_profile_coefficients, + explicit LevelCache(const PolarGrid& grid, + const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const bool cache_density_profile_coefficients, const bool cache_domain_geometry); diff --git a/include/Level/levelCache.inl b/include/Level/levelCache.inl index 00f772c8..8c5ccee1 100644 --- a/include/Level/levelCache.inl +++ b/include/Level/levelCache.inl @@ -3,9 +3,10 @@ namespace level_cache_helpers { template -static void cache_density_profile_coefficients( - const PolarGrid& grid, const DensityProfileCoefficients& density_profile_coefficients, - const Vector& coeff_alpha, const Vector& coeff_beta, const bool cache_domain_geometry) +static void cache_density_profile_coefficients(const PolarGrid& grid, + const DensityProfileCoefficients& density_profile_coefficients, + const Vector& coeff_alpha, const Vector& coeff_beta, + const bool cache_domain_geometry) { Kokkos::parallel_for( "Cache density profile coefficients", @@ -27,10 +28,10 @@ static void cache_density_profile_coefficients( template static void cache_domain_geometry(const PolarGrid& grid, - const DensityProfileCoefficients& density_profile_coefficients, - const DomainGeometry& domain_geometry, - const Vector& vec_arr, const Vector& vec_att, - const Vector& vec_art, const Vector& vec_detDF) + const DensityProfileCoefficients& density_profile_coefficients, + const DomainGeometry& domain_geometry, const Vector& vec_arr, + const Vector& vec_att, const Vector& vec_art, + const Vector& vec_detDF) { // We split the loops into two regions to better respect the // access patterns of the smoother and improve cache locality diff --git a/include/LinearAlgebra/Solvers/tridiagonal_solver.h b/include/LinearAlgebra/Solvers/tridiagonal_solver.h index 72ee9e95..5dd47039 100644 --- a/include/LinearAlgebra/Solvers/tridiagonal_solver.h +++ b/include/LinearAlgebra/Solvers/tridiagonal_solver.h @@ -92,7 +92,7 @@ class BatchedTridiagonalSolver void setup() { // Create local copies for lambda capture - int matrix_dimension = matrix_dimension_; + int matrix_dimension = matrix_dimension_; Vector main_diagonal = main_diagonal_; Vector sub_diagonal = sub_diagonal_; Vector gamma = gamma_; @@ -162,7 +162,7 @@ class BatchedTridiagonalSolver int effective_batch_count = (batch_count_ - batch_offset + batch_stride - 1) / batch_stride; // Create local copies for lambda capture - int matrix_dimension = matrix_dimension_; + int matrix_dimension = matrix_dimension_; Vector main_diagonal = main_diagonal_; Vector sub_diagonal = sub_diagonal_; Vector buffer = buffer_; @@ -265,14 +265,13 @@ class BatchedTridiagonalSolver int effective_batch_count = (batch_count_ - batch_offset + batch_stride - 1) / batch_stride; // Create local copies for lambda capture - int matrix_dimension = matrix_dimension_; + int matrix_dimension = matrix_dimension_; Vector main_diagonal = main_diagonal_; Vector gamma = gamma_; if (!is_cyclic_) { Kokkos::parallel_for( - "SolveDiagonalNonCyclic", - Kokkos::RangePolicy(0, effective_batch_count), + "SolveDiagonalNonCyclic", Kokkos::RangePolicy(0, effective_batch_count), KOKKOS_LAMBDA(const int k) { // ----------------------------------- // // Obtain offset for the current batch // diff --git a/include/PolarGrid/polargrid.h b/include/PolarGrid/polargrid.h index 79923191..816381b3 100644 --- a/include/PolarGrid/polargrid.h +++ b/include/PolarGrid/polargrid.h @@ -22,7 +22,7 @@ namespace gmgpolar { -template +template class PolarGrid { public: @@ -30,7 +30,7 @@ class PolarGrid explicit PolarGrid() = default; // Constructor to initialize grid using kokkos views of radii and angles. - template + template PolarGrid(Vector radii, Vector angles, std::optional splitting_radius = std::nullopt); // Constructor to initialize grid using std::vectors of radii and angles. @@ -44,24 +44,25 @@ class PolarGrid KOKKOS_DEFAULTED_FUNCTION PolarGrid(const PolarGrid&) = default; - template - PolarGrid(const PolarGrid& other) - : nr_(other.nr_) - , ntheta_(other.ntheta_) - , is_ntheta_PowerOfTwo_(other.is_ntheta_PowerOfTwo_) - , radii_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.radii_)) - , angles_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.angles_)) - , radial_spacings_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.radial_spacings_)) - , angular_spacings_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.angular_spacings_)) - , smoother_splitting_radius_(other.smoother_splitting_radius_) - , number_smoother_circles_(other.number_smoother_circles_) - , length_smoother_radial_(other.length_smoother_radial_) - , number_circular_smoother_nodes_(other.number_circular_smoother_nodes_) - , number_radial_smoother_nodes_(other.number_radial_smoother_nodes_) - {} - - template - friend class PolarGrid; + template + PolarGrid(const PolarGrid& other) + : nr_(other.nr_) + , ntheta_(other.ntheta_) + , is_ntheta_PowerOfTwo_(other.is_ntheta_PowerOfTwo_) + , radii_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.radii_)) + , angles_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.angles_)) + , radial_spacings_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.radial_spacings_)) + , angular_spacings_(Kokkos::create_mirror_view_and_copy(MemorySpace(), other.angular_spacings_)) + , smoother_splitting_radius_(other.smoother_splitting_radius_) + , number_smoother_circles_(other.number_smoother_circles_) + , length_smoother_radial_(other.length_smoother_radial_) + , number_circular_smoother_nodes_(other.number_circular_smoother_nodes_) + , number_radial_smoother_nodes_(other.number_radial_smoother_nodes_) + { + } + + template + friend class PolarGrid; // Optimized, inlined indexing. KOKKOS_INLINE_FUNCTION int wrapThetaIndex(const int unwrapped_theta_index) const; @@ -157,8 +158,8 @@ class PolarGrid // Help constrcut radii_ when an anisotropic radial division is requested // Implementation in src/PolarGrid/anisotropic_division.cpp - Vector RadialAnisotropicDivision(double R0, double R, const int nr_exp, double refinement_radius, - const int anisotropic_factor) const; + Vector RadialAnisotropicDivision(double R0, double R, const int nr_exp, + double refinement_radius, const int anisotropic_factor) const; }; template class PolarGrid; @@ -170,7 +171,7 @@ template class PolarGrid; // ---------------------------------------------------- // // Generates a coarser PolarGrid from a finer PolarGrid // // ---------------------------------------------------- // -template +template PolarGrid coarseningGrid(const PolarGrid& grid); #include "polargrid.inl" // Include the inline function definitions diff --git a/include/PolarGrid/polargrid.inl b/include/PolarGrid/polargrid.inl old mode 100755 new mode 100644 index fc9158f1..d19bf588 --- a/include/PolarGrid/polargrid.inl +++ b/include/PolarGrid/polargrid.inl @@ -5,9 +5,10 @@ #include "polargrid.h" // Constructor to initialize grid using vectors of radii and angles. -template -template -PolarGrid::PolarGrid(Vector radii, Vector angles, std::optional splitting_radius) +template +template +PolarGrid::PolarGrid(Vector radii, Vector angles, + std::optional splitting_radius) : nr_(radii.size()) , ntheta_(angles.size() - 1) , is_ntheta_PowerOfTwo_((ntheta_ & (ntheta_ - 1)) == 0) @@ -23,77 +24,77 @@ PolarGrid::PolarGrid(Vector radii, Vector +template KOKKOS_INLINE_FUNCTION int PolarGrid::nr() const { return nr_; } -template +template KOKKOS_INLINE_FUNCTION int PolarGrid::ntheta() const { return ntheta_; } -template +template KOKKOS_INLINE_FUNCTION int PolarGrid::numberOfNodes() const { return nr() * ntheta(); } -template +template KOKKOS_INLINE_FUNCTION double PolarGrid::radius(const int r_index) const { assert(r_index >= 0 && r_index < std::ssize(radii_)); return radii_[r_index]; } -template +template KOKKOS_INLINE_FUNCTION double PolarGrid::theta(const int theta_index) const { assert(theta_index >= 0 && theta_index < std::ssize(angles_)); return angles_[theta_index]; } -template +template KOKKOS_INLINE_FUNCTION double PolarGrid::smootherSplittingRadius() const { return smoother_splitting_radius_; } // Get the number of circles in the circular smoother. -template +template KOKKOS_INLINE_FUNCTION int PolarGrid::numberSmootherCircles() const { return number_smoother_circles_; } // Get the length of the radial smoother lines. -template +template KOKKOS_INLINE_FUNCTION int PolarGrid::lengthRadialSmoother() const { return length_smoother_radial_; } // Get the number of nodes in circular smoother. -template +template KOKKOS_INLINE_FUNCTION int PolarGrid::numberCircularSmootherNodes() const { return number_circular_smoother_nodes_; } // Get the number of nodes in radial smoother. -template +template KOKKOS_INLINE_FUNCTION int PolarGrid::numberRadialSmootherNodes() const { return number_radial_smoother_nodes_; } -template +template KOKKOS_INLINE_FUNCTION double PolarGrid::radialSpacing(const int r_index) const { assert(r_index >= 0 && r_index < std::ssize(radial_spacings_)); return radial_spacings_[r_index]; } -template +template KOKKOS_INLINE_FUNCTION double PolarGrid::angularSpacing(const int unwrapped_theta_index) const { // unwrapped_theta_index may be negative or larger than ntheta() to allow for periodicity. @@ -101,7 +102,7 @@ KOKKOS_INLINE_FUNCTION double PolarGrid::angularSpacing(const int u return angular_spacings_[theta_index]; } -template +template KOKKOS_INLINE_FUNCTION int PolarGrid::wrapThetaIndex(const int unwrapped_theta_index) const { // The unwrapped_theta_index may be negative or exceed the number of theta steps (ntheta()), @@ -120,7 +121,7 @@ KOKKOS_INLINE_FUNCTION int PolarGrid::wrapThetaIndex(const int unwr return theta_index; } -template +template KOKKOS_INLINE_FUNCTION int PolarGrid::index(const int r_index, const int unwrapped_theta_index) const { // unwrapped_theta_index may be negative or larger than ntheta() to allow for periodicity. @@ -134,8 +135,9 @@ KOKKOS_INLINE_FUNCTION int PolarGrid::index(const int r_index, cons return global_index; } -template -KOKKOS_INLINE_FUNCTION void PolarGrid::multiIndex(const int node_index, int& r_index, int& theta_index) const +template +KOKKOS_INLINE_FUNCTION void PolarGrid::multiIndex(const int node_index, int& r_index, + int& theta_index) const { assert(0 <= node_index && node_index < numberOfNodes()); if (node_index < numberCircularSmootherNodes()) { diff --git a/include/Residual/ResidualGive/applyAGive.inl b/include/Residual/ResidualGive/applyAGive.inl index 678c6412..0e2a4526 100644 --- a/include/Residual/ResidualGive/applyAGive.inl +++ b/include/Residual/ResidualGive/applyAGive.inl @@ -197,14 +197,14 @@ static KOKKOS_INLINE_FUNCTION void node_apply_a_give(int i_r, int i_theta, const template void ResidualGive::applySystemOperator(HostVector h_result, HostConstVector h_x) const { - auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); - auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); assert(result.size() == x.size()); - const PolarGrid& grid = Residual::grid_; - const LevelCacheType& level_cache = Residual::level_cache_; - const bool DirBC_Interior = Residual::DirBC_Interior_; + const PolarGrid& grid = Residual::grid_; + const LevelCacheType& level_cache = Residual::level_cache_; + const bool DirBC_Interior = Residual::DirBC_Interior_; using residual_give::node_apply_a_give; @@ -255,8 +255,7 @@ void ResidualGive::applySystemOperator(HostVector h_resu for (int start_radial = 0; start_radial < 3; ++start_radial) { const int num_radial_batches = (num_radial_tasks - start_radial + 2) / 3; Kokkos::parallel_for( - "ResidualGive: ApplyA (Radial)", - Kokkos::RangePolicy(0, num_radial_batches), + "ResidualGive: ApplyA (Radial)", Kokkos::RangePolicy(0, num_radial_batches), KOKKOS_LAMBDA(const int radial_task) { const int i_theta = additional_radial_tasks + start_radial + radial_task * 3; for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) { @@ -266,5 +265,5 @@ void ResidualGive::applySystemOperator(HostVector h_resu Kokkos::fence(); } - Kokkos::deep_copy(h_result, result); + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/ResidualGive/residualGive.h b/include/Residual/ResidualGive/residualGive.h index e8f02c93..cdbaa0f5 100644 --- a/include/Residual/ResidualGive/residualGive.h +++ b/include/Residual/ResidualGive/residualGive.h @@ -9,7 +9,8 @@ template class ResidualGive : public Residual { public: - explicit ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior); + explicit ResidualGive(const PolarGrid& grid, const LevelCacheType& level_cache, + const bool DirBC_Interior); ~ResidualGive() override = default; void applySystemOperator(HostVector result, HostConstVector x) const final; diff --git a/include/Residual/ResidualGive/residualGive.inl b/include/Residual/ResidualGive/residualGive.inl index b607920b..5bc83d29 100644 --- a/include/Residual/ResidualGive/residualGive.inl +++ b/include/Residual/ResidualGive/residualGive.inl @@ -17,8 +17,8 @@ void ResidualGive::computeResidual(HostVector h_result, applySystemOperator(h_result, h_x); - auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); - auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); // Subtract A*x from rhs to get the residual. const int n = result.size(); @@ -29,5 +29,5 @@ void ResidualGive::computeResidual(HostVector h_result, Kokkos::fence(); - Kokkos::deep_copy(h_result, result); + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/ResidualTake/applyATake.inl b/include/Residual/ResidualTake/applyATake.inl index e2f9bb0c..5e4d9665 100644 --- a/include/Residual/ResidualTake/applyATake.inl +++ b/include/Residual/ResidualTake/applyATake.inl @@ -3,12 +3,10 @@ namespace residual_take { -static KOKKOS_INLINE_FUNCTION void node_apply_a_take(const int i_r, const int i_theta, const PolarGrid& grid, - bool DirBC_Interior, Vector& result, - ConstVector& x, ConstVector& arr, - ConstVector& att, ConstVector& art, - ConstVector& detDF, - ConstVector& coeff_beta) +static KOKKOS_INLINE_FUNCTION void +node_apply_a_take(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, + Vector& result, ConstVector& x, ConstVector& arr, ConstVector& att, + ConstVector& art, ConstVector& detDF, ConstVector& coeff_beta) { const int center = grid.index(i_r, i_theta); @@ -70,13 +68,13 @@ void ResidualTake::applySystemOperator(HostVector h_resu { using residual_take::node_apply_a_take; - auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); - auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); assert(result.size() == x.size()); - const PolarGrid& grid = Residual::grid_; - const bool DirBC_Interior = Residual::DirBC_Interior_; + const PolarGrid& grid = Residual::grid_; + const bool DirBC_Interior = Residual::DirBC_Interior_; assert(Residual::level_cache_.cacheDensityProfileCoefficients()); assert(Residual::level_cache_.cacheDomainGeometry()); @@ -116,5 +114,5 @@ void ResidualTake::applySystemOperator(HostVector h_resu Kokkos::fence(); - Kokkos::deep_copy(h_result, result); + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/ResidualTake/residualTake.h b/include/Residual/ResidualTake/residualTake.h index c67e967b..8af3bd9f 100644 --- a/include/Residual/ResidualTake/residualTake.h +++ b/include/Residual/ResidualTake/residualTake.h @@ -9,7 +9,8 @@ template class ResidualTake : public Residual { public: - explicit ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior); + explicit ResidualTake(const PolarGrid& grid, const LevelCacheType& level_cache, + const bool DirBC_Interior); KOKKOS_DEFAULTED_FUNCTION ResidualTake(const ResidualTake&) = default; KOKKOS_DEFAULTED_FUNCTION ~ResidualTake() override = default; diff --git a/include/Residual/ResidualTake/residualTake.inl b/include/Residual/ResidualTake/residualTake.inl index 23a6d0c3..e322917e 100644 --- a/include/Residual/ResidualTake/residualTake.inl +++ b/include/Residual/ResidualTake/residualTake.inl @@ -17,8 +17,8 @@ void ResidualTake::computeResidual(HostVector h_result, applySystemOperator(h_result, h_x); - auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); - auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto result = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_result); // Subtract A*x from rhs to get the residual. const int n = result.size(); @@ -29,5 +29,5 @@ void ResidualTake::computeResidual(HostVector h_result, Kokkos::fence(); - Kokkos::deep_copy(h_result, result); + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/residual.h b/include/Residual/residual.h index c2432869..fcb04d00 100644 --- a/include/Residual/residual.h +++ b/include/Residual/residual.h @@ -16,7 +16,8 @@ template class Residual { public: - explicit Residual(const PolarGrid& grid, const LevelCacheType& level_cache, const bool DirBC_Interior) + explicit Residual(const PolarGrid& grid, const LevelCacheType& level_cache, + const bool DirBC_Interior) : grid_(grid) , level_cache_(level_cache) , DirBC_Interior_(DirBC_Interior) diff --git a/include/Smoother/SmootherGive/applyAscOrtho.inl b/include/Smoother/SmootherGive/applyAscOrtho.inl index b5d10aea..095cf60a 100644 --- a/include/Smoother/SmootherGive/applyAscOrtho.inl +++ b/include/Smoother/SmootherGive/applyAscOrtho.inl @@ -5,9 +5,9 @@ namespace smoother_give template static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior, ConstVector& x, ConstVector& rhs, - Vector& result) +nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, bool DirBC_Interior, ConstVector& x, + ConstVector& rhs, Vector& result) { assert(i_r >= 0 && i_r < grid.numberSmootherCircles()); @@ -54,9 +54,9 @@ nodeApplyAscOrthoCircleGiveInside(int i_r, int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior, ConstVector& x, ConstVector& rhs, - Vector& result) +nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, bool DirBC_Interior, ConstVector& x, + ConstVector& rhs, Vector& result) { assert(0 <= i_r && i_r <= grid.numberSmootherCircles()); @@ -101,9 +101,9 @@ nodeApplyAscOrthoCircleGiveOutside(int i_r, int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior, ConstVector& x, ConstVector& rhs, - Vector& result) +nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, bool DirBC_Interior, ConstVector& x, + ConstVector& rhs, Vector& result) { assert(grid.numberSmootherCircles() - 1 <= i_r && i_r < grid.nr()); @@ -179,9 +179,9 @@ nodeApplyAscOrthoRadialGiveInside(int i_r, int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoRadialGiveOutside(int i_r, int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - bool DirBC_Interior, ConstVector& x, ConstVector& rhs, - Vector& result) +nodeApplyAscOrthoRadialGiveOutside(int i_r, int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, bool DirBC_Interior, ConstVector& x, + ConstVector& rhs, Vector& result) { assert(grid.numberSmootherCircles() <= i_r && i_r < grid.nr()); @@ -226,8 +226,8 @@ nodeApplyAscOrthoRadialGiveOutside(int i_r, int i_theta, const PolarGrid -void SmootherGive::applyAscOrthoBlackCircleSection(ConstVector x, - ConstVector rhs, Vector temp) +void SmootherGive::applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, + Vector temp) { using smoother_give::nodeApplyAscOrthoCircleGiveInside; using smoother_give::nodeApplyAscOrthoCircleGiveOutside; @@ -239,9 +239,9 @@ void SmootherGive::applyAscOrthoBlackCircleSection(ConstVector& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; /* ----------------------------------------------- */ /* 1. Black-Circle update (u_bc): */ @@ -309,8 +309,8 @@ void SmootherGive::applyAscOrthoBlackCircleSection(ConstVector -void SmootherGive::applyAscOrthoWhiteCircleSection(ConstVector x, - ConstVector rhs, Vector temp) +void SmootherGive::applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, + Vector temp) { using smoother_give::nodeApplyAscOrthoCircleGiveInside; using smoother_give::nodeApplyAscOrthoCircleGiveOutside; @@ -322,9 +322,9 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(ConstVector& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; /* ----------------------------------------------- */ /* 2. White-Circle update (u_wc): */ @@ -393,8 +393,8 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(ConstVector -void SmootherGive::applyAscOrthoBlackRadialSection(ConstVector x, - ConstVector rhs, Vector temp) +void SmootherGive::applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, + Vector temp) { using smoother_give::nodeApplyAscOrthoRadialGiveInside; using smoother_give::nodeApplyAscOrthoRadialGiveOutside; @@ -406,9 +406,9 @@ void SmootherGive::applyAscOrthoBlackRadialSection(ConstVector& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; /* ----------------------------------------------- */ /* 3. Black-Radial update (u_br): */ @@ -477,8 +477,8 @@ void SmootherGive::applyAscOrthoBlackRadialSection(ConstVector -void SmootherGive::applyAscOrthoWhiteRadialSection(ConstVector x, - ConstVector rhs, Vector temp) +void SmootherGive::applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, + Vector temp) { using smoother_give::nodeApplyAscOrthoRadialGiveInside; using smoother_give::nodeApplyAscOrthoRadialGiveOutside; @@ -490,9 +490,9 @@ void SmootherGive::applyAscOrthoWhiteRadialSection(ConstVector& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; /* ----------------------------------------------- */ /* 4. White-Radial update (u_wr): */ diff --git a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl index 38eabe40..2e4e0acb 100644 --- a/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherGive/buildInnerBoundaryAsc.inl @@ -7,9 +7,9 @@ namespace smoother_give #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. -static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, const int offset, - const int row, const int column, const double value) +static KOKKOS_INLINE_FUNCTION void update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int ptr, + const int offset, const int row, const int column, + const double value) { matrix.set_row_index(ptr + offset, row); matrix.set_col_index(ptr + offset, column); @@ -17,9 +17,9 @@ update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, const int pt } #else // When using the in-house solver, the matrix is stored in CSR format. -static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, const int offset, - const int row, const int column, const double value) +static KOKKOS_INLINE_FUNCTION void update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int ptr, + const int offset, const int row, const int column, + const double value) { matrix.set_row_nz_index(row, offset, column); matrix.increase_row_nz_entry(row, offset, value); @@ -28,8 +28,9 @@ update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, const int pt template static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) +nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, const bool DirBC_Interior, + const InnerBoundaryMatrix& matrix) { using smoother_give::getCircleAscIndex; using smoother_give::getStencil; @@ -200,8 +201,9 @@ nodeBuildInteriorBoundarySolverMatrix_i_r_0(const int i_theta, const PolarGrid static KOKKOS_INLINE_FUNCTION void -nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, - const bool DirBC_Interior, const InnerBoundaryMatrix& matrix) +nodeBuildInteriorBoundarySolverMatrix_i_r_1(const int i_theta, const PolarGrid& grid, + const LevelCacheType& level_cache, const bool DirBC_Interior, + const InnerBoundaryMatrix& matrix) { using smoother_give::getCircleAscIndex; using smoother_give::getStencil; @@ -257,9 +259,9 @@ SmootherGive::buildInteriorBoundarySolverMatrix() using smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_0; using smoother_give::nodeBuildInteriorBoundarySolverMatrix_i_r_1; - const PolarGrid& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; const int ntheta = grid.ntheta(); diff --git a/include/Smoother/SmootherGive/buildTridiagonalAsc.inl b/include/Smoother/SmootherGive/buildTridiagonalAsc.inl index 2742f412..2d0fbdc1 100644 --- a/include/Smoother/SmootherGive/buildTridiagonalAsc.inl +++ b/include/Smoother/SmootherGive/buildTridiagonalAsc.inl @@ -15,11 +15,10 @@ static KOKKOS_INLINE_FUNCTION void updateMatrixElement(const BatchedTridiagonalS } template -static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta, const PolarGrid& grid, - const LevelCacheType& level_cache, const bool DirBC_Interior, - const BatchedTridiagonalSolver& circle_tridiagonal_solver, - const BatchedTridiagonalSolver& radial_tridiagonal_solver) +static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesCircleSection( + const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, + const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, + const BatchedTridiagonalSolver& radial_tridiagonal_solver) { using smoother_give::updateMatrixElement; @@ -185,11 +184,10 @@ nodeBuildTridiagonalSolverMatricesCircleSection(const int i_r, const int i_theta } template -static KOKKOS_INLINE_FUNCTION void -nodeBuildTridiagonalSolverMatricesRadialSection(const int i_r, const int i_theta, const PolarGrid& grid, - const LevelCacheType& level_cache, const bool DirBC_Interior, - const BatchedTridiagonalSolver& circle_tridiagonal_solver, - const BatchedTridiagonalSolver& radial_tridiagonal_solver) +static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatricesRadialSection( + const int i_r, const int i_theta, const PolarGrid& grid, const LevelCacheType& level_cache, + const bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, + const BatchedTridiagonalSolver& radial_tridiagonal_solver) { using smoother_give::updateMatrixElement; @@ -512,9 +510,9 @@ void SmootherGive::buildTridiagonalSolverMatrices() using smoother_give::nodeBuildTridiagonalSolverMatricesCircleSection; using smoother_give::nodeBuildTridiagonalSolverMatricesRadialSection; - const PolarGrid& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; const BatchedTridiagonalSolver& circle_tridiagonal_solver = circle_tridiagonal_solver_; const BatchedTridiagonalSolver& radial_tridiagonal_solver = radial_tridiagonal_solver_; diff --git a/include/Smoother/SmootherGive/smootherGive.h b/include/Smoother/SmootherGive/smootherGive.h index 27572edc..6237a14c 100644 --- a/include/Smoother/SmootherGive/smootherGive.h +++ b/include/Smoother/SmootherGive/smootherGive.h @@ -53,7 +53,8 @@ class SmootherGive : public Smoother public: // Constructs the coupled circle-radial smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior); + explicit SmootherGive(const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior); // Performs one full coupled smoothing sweep: // BC -> WC -> BR -> WR @@ -116,14 +117,10 @@ class SmootherGive : public Smoother // Compute temp = f_sc − A_sc^ortho * u_sc^ortho (precomputed right-hand side) // where x = u_sc and rhs = f_sc - void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, - Vector temp); + void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, Vector temp); /* ----------------- */ /* Line-wise solvers */ diff --git a/include/Smoother/SmootherGive/smootherGive.inl b/include/Smoother/SmootherGive/smootherGive.inl index f0bf72b2..6747cc95 100644 --- a/include/Smoother/SmootherGive/smootherGive.inl +++ b/include/Smoother/SmootherGive/smootherGive.inl @@ -41,11 +41,12 @@ SmootherGive::SmootherGive(const PolarGrid& // - The system is then solved in-place in temp, and the results // are copied back to x. template -void SmootherGive::smoothing(HostVector h_x, HostConstVector h_rhs, HostVector h_temp) +void SmootherGive::smoothing(HostVector h_x, HostConstVector h_rhs, + HostVector h_temp) { - auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); - auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); - auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); @@ -64,6 +65,6 @@ void SmootherGive::smoothing(HostVector h_x, HostConstVe applyAscOrthoWhiteRadialSection(x, rhs, temp); solveWhiteRadialSection(x, temp); - Kokkos::deep_copy(h_x, x); - Kokkos::deep_copy(h_temp, temp); + Kokkos::deep_copy(h_x, x); + Kokkos::deep_copy(h_temp, temp); } diff --git a/include/Smoother/SmootherGive/solveAscSystem.inl b/include/Smoother/SmootherGive/solveAscSystem.inl index 86e17efc..038c39c3 100644 --- a/include/Smoother/SmootherGive/solveAscSystem.inl +++ b/include/Smoother/SmootherGive/solveAscSystem.inl @@ -5,8 +5,8 @@ void SmootherGive::solveBlackCircleSection(Vector x, Vec { const PolarGrid& grid = Smoother::grid_; - const int start = 0; - const int end = grid.numberCircularSmootherNodes(); + const int start = 0; + const int end = grid.numberCircularSmootherNodes(); Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); const bool is_inner_circle_black = grid.numberSmootherCircles() % 2 != 0; @@ -43,10 +43,10 @@ void SmootherGive::solveBlackCircleSection(Vector x, Vec template void SmootherGive::solveWhiteCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; - const int start = 0; - const int end = grid.numberCircularSmootherNodes(); + const int start = 0; + const int end = grid.numberCircularSmootherNodes(); Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); const bool is_inner_circle_white = grid.numberSmootherCircles() % 2 == 0; @@ -83,10 +83,10 @@ void SmootherGive::solveWhiteCircleSection(Vector x, Vec template void SmootherGive::solveBlackRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; - const int start = grid.numberCircularSmootherNodes(); - const int end = grid.numberOfNodes(); + const int start = grid.numberCircularSmootherNodes(); + const int end = grid.numberOfNodes(); Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve @@ -116,10 +116,10 @@ void SmootherGive::solveBlackRadialSection(Vector x, Vec template void SmootherGive::solveWhiteRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; - const int start = grid.numberCircularSmootherNodes(); - const int end = grid.numberOfNodes(); + const int start = grid.numberCircularSmootherNodes(); + const int end = grid.numberOfNodes(); Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve diff --git a/include/Smoother/SmootherTake/applyAscOrtho.inl b/include/Smoother/SmootherTake/applyAscOrtho.inl index 9717c74e..3843e95e 100644 --- a/include/Smoother/SmootherTake/applyAscOrtho.inl +++ b/include/Smoother/SmootherTake/applyAscOrtho.inl @@ -4,10 +4,10 @@ namespace smoother_take { static KOKKOS_INLINE_FUNCTION void -nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, - ConstVector& x, ConstVector& rhs, Vector& result, - ConstVector& arr, ConstVector& att, ConstVector& art, - ConstVector& detDF, ConstVector& coeff_beta) +nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, + bool DirBC_Interior, ConstVector& x, ConstVector& rhs, + Vector& result, ConstVector& arr, ConstVector& att, + ConstVector& art, ConstVector& detDF, ConstVector& coeff_beta) { KOKKOS_ASSERT(i_r >= 0 && i_r < grid.numberSmootherCircles()); @@ -56,11 +56,10 @@ nodeApplyAscOrthoCircleTake(const int i_r, const int i_theta, const PolarGrid& grid, bool DirBC_Interior, - ConstVector& x, ConstVector& rhs, Vector& result, - ConstVector& arr, const ConstVector& att, - ConstVector& art, const ConstVector& detDF, - ConstVector& coeff_beta) +nodeApplyAscOrthoRadialTake(const int i_r, const int i_theta, const PolarGrid& grid, + bool DirBC_Interior, ConstVector& x, ConstVector& rhs, + Vector& result, ConstVector& arr, const ConstVector& att, + ConstVector& art, const ConstVector& detDF, ConstVector& coeff_beta) { KOKKOS_ASSERT(i_r >= grid.numberSmootherCircles() && i_r < grid.nr()); @@ -118,14 +117,14 @@ nodeApplyAscOrthoRadialTake(const int i_r, const int i_theta, const PolarGrid -void SmootherTake::applyAscOrthoBlackCircleSection(ConstVector x, - ConstVector rhs, Vector temp) +void SmootherTake::applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, + Vector temp) { using smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); @@ -157,14 +156,14 @@ void SmootherTake::applyAscOrthoBlackCircleSection(ConstVector -void SmootherTake::applyAscOrthoWhiteCircleSection(ConstVector x, - ConstVector rhs, Vector temp) +void SmootherTake::applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, + Vector temp) { using smoother_take::nodeApplyAscOrthoCircleTake; - const PolarGrid& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); @@ -196,14 +195,14 @@ void SmootherTake::applyAscOrthoWhiteCircleSection(ConstVector -void SmootherTake::applyAscOrthoBlackRadialSection(ConstVector x, - ConstVector rhs, Vector temp) +void SmootherTake::applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, + Vector temp) { using smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); @@ -235,14 +234,14 @@ void SmootherTake::applyAscOrthoBlackRadialSection(ConstVector -void SmootherTake::applyAscOrthoWhiteRadialSection(ConstVector x, - ConstVector rhs, Vector temp) +void SmootherTake::applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, + Vector temp) { using smoother_take::nodeApplyAscOrthoRadialTake; - const PolarGrid& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); diff --git a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl index bd25af86..02423151 100644 --- a/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl +++ b/include/Smoother/SmootherTake/buildInnerBoundaryAsc.inl @@ -7,9 +7,8 @@ namespace smoother_take #ifdef GMGPOLAR_USE_MUMPS // When using the MUMPS solver, the matrix is assembled in COO format. -static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, int ptr, int offset, int row, - int column, double value) +static KOKKOS_INLINE_FUNCTION void update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, int ptr, + int offset, int row, int column, double value) { matrix.set_row_index(ptr + offset, row); matrix.set_col_index(ptr + offset, column); @@ -17,9 +16,8 @@ update_CSR_COO_MatrixElement(const SparseMatrixCOO& matrix, int ptr, int } #else // When using the in-house solver, the matrix is stored in CSR format. -static KOKKOS_INLINE_FUNCTION void -update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, int ptr, int offset, int row, - int column, double value) +static KOKKOS_INLINE_FUNCTION void update_CSR_COO_MatrixElement(const SparseMatrixCSR& matrix, int ptr, + int offset, int row, int column, double value) { matrix.set_row_nz_index(row, offset, column); matrix.set_row_nz_entry(row, offset, value); @@ -30,8 +28,8 @@ template static KOKKOS_INLINE_FUNCTION void nodeBuildInteriorBoundarySolverMatrix(const int i_theta, const PolarGrid& grid, bool DirBC_Interior, const InnerBoundaryMatrix& matrix, ConstVector& arr, - ConstVector& att, ConstVector& art, - ConstVector& detDF, ConstVector& coeff_beta) + ConstVector& att, ConstVector& art, ConstVector& detDF, + ConstVector& coeff_beta) { using smoother_take::getCircleAscIndex; using smoother_take::getStencil; @@ -146,9 +144,9 @@ SmootherTake::buildInteriorBoundarySolverMatrix() using smoother_take::getNonZeroCountCircleAsc; using smoother_take::nodeBuildInteriorBoundarySolverMatrix; - const PolarGrid& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; const int ntheta = grid.ntheta(); diff --git a/include/Smoother/SmootherTake/buildTridiagonalAsc.inl b/include/Smoother/SmootherTake/buildTridiagonalAsc.inl index 72e08927..b9a794c0 100644 --- a/include/Smoother/SmootherTake/buildTridiagonalAsc.inl +++ b/include/Smoother/SmootherTake/buildTridiagonalAsc.inl @@ -18,9 +18,8 @@ static KOKKOS_INLINE_FUNCTION void nodeBuildTridiagonalSolverMatrices(int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, const BatchedTridiagonalSolver& circle_tridiagonal_solver, const BatchedTridiagonalSolver& radial_tridiagonal_solver, - ConstVector& arr, ConstVector& att, - ConstVector& art, ConstVector& detDF, - ConstVector& coeff_beta) + ConstVector& arr, ConstVector& att, ConstVector& art, + ConstVector& detDF, ConstVector& coeff_beta) { using smoother_take::updateMatrixElement; @@ -190,9 +189,9 @@ void SmootherTake::buildTridiagonalSolverMatrices() { using smoother_take::nodeBuildTridiagonalSolverMatrices; - const PolarGrid& grid = Smoother::grid_; - const LevelCacheType& level_cache = Smoother::level_cache_; - const bool DirBC_Interior = Smoother::DirBC_Interior_; + const PolarGrid& grid = Smoother::grid_; + const LevelCacheType& level_cache = Smoother::level_cache_; + const bool DirBC_Interior = Smoother::DirBC_Interior_; assert(level_cache.cacheDensityProfileCoefficients()); assert(level_cache.cacheDomainGeometry()); diff --git a/include/Smoother/SmootherTake/smootherTake.h b/include/Smoother/SmootherTake/smootherTake.h index fdeee780..47ae4c1b 100644 --- a/include/Smoother/SmootherTake/smootherTake.h +++ b/include/Smoother/SmootherTake/smootherTake.h @@ -53,7 +53,8 @@ class SmootherTake : public Smoother public: // Constructs the coupled circle-radial smoother. // Builds the A_sc smoother matrices and prepares the solvers. - explicit SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior); + explicit SmootherTake(const PolarGrid& grid, const LevelCacheType& level_cache, + bool DirBC_Interior); KOKKOS_DEFAULTED_FUNCTION SmootherTake(const SmootherTake&) = default; @@ -116,14 +117,10 @@ class SmootherTake : public Smoother // Compute temp = f_sc − A_sc^ortho * u_sc^ortho (precomputed right-hand side) // where x = u_sc and rhs = f_sc - void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, - Vector temp); - void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, - Vector temp); + void applyAscOrthoBlackCircleSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoWhiteCircleSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoBlackRadialSection(ConstVector x, ConstVector rhs, Vector temp); + void applyAscOrthoWhiteRadialSection(ConstVector x, ConstVector rhs, Vector temp); /* ----------------- */ /* Line-wise solvers */ diff --git a/include/Smoother/SmootherTake/smootherTake.inl b/include/Smoother/SmootherTake/smootherTake.inl index 0d7bc2fd..349a2bf1 100644 --- a/include/Smoother/SmootherTake/smootherTake.inl +++ b/include/Smoother/SmootherTake/smootherTake.inl @@ -41,11 +41,12 @@ SmootherTake::SmootherTake(const PolarGrid& // - The system is then solved in-place in temp, and the results // are copied back to x. template -void SmootherTake::smoothing(HostVector h_x, HostConstVector h_rhs, HostVector h_temp) +void SmootherTake::smoothing(HostVector h_x, HostConstVector h_rhs, + HostVector h_temp) { - auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); - auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); - auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); + auto x = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_x); + auto rhs = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_rhs); + auto temp = Kokkos::create_mirror_view_and_copy(DefaultMemorySpace(), h_temp); assert(x.size() == rhs.size()); assert(temp.size() == rhs.size()); @@ -62,6 +63,6 @@ void SmootherTake::smoothing(HostVector h_x, HostConstVe applyAscOrthoWhiteRadialSection(x, rhs, temp); solveWhiteRadialSection(x, temp); - Kokkos::deep_copy(h_x, x); - Kokkos::deep_copy(h_temp, temp); + Kokkos::deep_copy(h_x, x); + Kokkos::deep_copy(h_temp, temp); } diff --git a/include/Smoother/SmootherTake/solveAscSystem.inl b/include/Smoother/SmootherTake/solveAscSystem.inl index d2444ff3..9740f9d0 100644 --- a/include/Smoother/SmootherTake/solveAscSystem.inl +++ b/include/Smoother/SmootherTake/solveAscSystem.inl @@ -3,10 +3,10 @@ template void SmootherTake::solveBlackCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; - int start = 0; - int end = grid.numberCircularSmootherNodes(); + int start = 0; + int end = grid.numberCircularSmootherNodes(); Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); const bool is_inner_circle_black = grid.numberSmootherCircles() % 2 != 0; @@ -43,10 +43,10 @@ void SmootherTake::solveBlackCircleSection(Vector x, Vec template void SmootherTake::solveWhiteCircleSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; - int start = 0; - int end = grid.numberCircularSmootherNodes(); + int start = 0; + int end = grid.numberCircularSmootherNodes(); Vector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); const bool is_inner_circle_white = grid.numberSmootherCircles() % 2 == 0; @@ -83,10 +83,10 @@ void SmootherTake::solveWhiteCircleSection(Vector x, Vec template void SmootherTake::solveBlackRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; - int start = grid.numberCircularSmootherNodes(); - int end = grid.numberOfNodes(); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve @@ -116,10 +116,10 @@ void SmootherTake::solveBlackRadialSection(Vector x, Vec template void SmootherTake::solveWhiteRadialSection(Vector x, Vector temp) { - const PolarGrid& grid = Smoother::grid_; + const PolarGrid& grid = Smoother::grid_; - int start = grid.numberCircularSmootherNodes(); - int end = grid.numberOfNodes(); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve diff --git a/src/ConfigParser/config_parser.cpp b/src/ConfigParser/config_parser.cpp index 566e06ed..5dc991b2 100644 --- a/src/ConfigParser/config_parser.cpp +++ b/src/ConfigParser/config_parser.cpp @@ -236,7 +236,8 @@ bool ConfigParser::parse(int argc, char* argv[]) // Construct PolarGrid double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; - grid_ = PolarGrid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + grid_ = PolarGrid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, + splitting_radius); selectTestCase(geometry_type, problem_type, alpha_type, beta_type, Rmax, kappa_eps, delta_e, alpha_jump); diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp index bdf54117..8b464102 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Poisson_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_Poisson_CircularGeometry::CartesianR2_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR2_Poisson_CircularGeometry::CartesianR2_Poisson_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp index 9d740e3d..e10225a1 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_CzarnyGeometry.cpp @@ -6,8 +6,8 @@ void CartesianR2_Poisson_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_Poisson_CzarnyGeometry::CartesianR2_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, - double inverse_aspect_ratio_epsilon, +CartesianR2_Poisson_CzarnyGeometry::CartesianR2_Poisson_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.cpp index d5074e51..5e769e39 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_Poisson_ShafranovGeometry::CartesianR2_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, +CartesianR2_Poisson_ShafranovGeometry::CartesianR2_Poisson_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.cpp index c4341d4c..c611cfad 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_SonnendruckerGyro_CircularGeometry::CartesianR2_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, - double Rmax) +CartesianR2_SonnendruckerGyro_CircularGeometry::CartesianR2_SonnendruckerGyro_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.cpp index 9df7c281..4fc1c6f3 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_Sonnendrucker_CircularGeometry::CartesianR2_Sonnendrucker_CircularGeometry(PolarGrid const& grid, - double Rmax) +CartesianR2_Sonnendrucker_CircularGeometry::CartesianR2_Sonnendrucker_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.cpp index f1b82bda..f8dd98ee 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_CzarnyGeometry.cpp @@ -6,9 +6,8 @@ void CartesianR2_Sonnendrucker_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_Sonnendrucker_CzarnyGeometry::CartesianR2_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, - double inverse_aspect_ratio_epsilon, - double ellipticity_e) +CartesianR2_Sonnendrucker_CzarnyGeometry::CartesianR2_Sonnendrucker_CzarnyGeometry( + PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.cpp index 37874049..7063001f 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.cpp @@ -1,10 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_Sonnendrucker_ShafranovGeometry::CartesianR2_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, - double Rmax, - double elongation_kappa, - double shift_delta) +CartesianR2_Sonnendrucker_ShafranovGeometry::CartesianR2_Sonnendrucker_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.cpp index 184e5211..0633e669 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniGyro_CircularGeometry::CartesianR2_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR2_ZoniGyro_CircularGeometry::CartesianR2_ZoniGyro_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.cpp index 6e5bcdb0..a8e2ecfd 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_CzarnyGeometry.cpp @@ -6,7 +6,8 @@ void CartesianR2_ZoniGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_ZoniGyro_CzarnyGeometry::CartesianR2_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_ZoniGyro_CzarnyGeometry::CartesianR2_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.cpp index 2a8b4d93..37f7c2bb 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniGyro_ShafranovGeometry::CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, +CartesianR2_ZoniGyro_ShafranovGeometry::CartesianR2_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp index 1845e95c..ccbbb839 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniShiftedGyro_CircularGeometry::CartesianR2_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, - double Rmax) +CartesianR2_ZoniShiftedGyro_CircularGeometry::CartesianR2_ZoniShiftedGyro_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp index 442e7a49..1056e53e 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.cpp @@ -1,10 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniShiftedGyro_ShafranovGeometry::CartesianR2_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, - double Rmax, - double elongation_kappa, - double shift_delta) +CartesianR2_ZoniShiftedGyro_ShafranovGeometry::CartesianR2_ZoniShiftedGyro_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.cpp index 1cf9c090..a11fdbfa 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniShifted_CircularGeometry::CartesianR2_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR2_ZoniShifted_CircularGeometry::CartesianR2_ZoniShifted_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.cpp index f1e5d6dd..7e054a59 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_CzarnyGeometry.cpp @@ -6,7 +6,8 @@ void CartesianR2_ZoniShifted_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR2_ZoniShifted_CzarnyGeometry::CartesianR2_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR2_ZoniShifted_CzarnyGeometry::CartesianR2_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.cpp index 0780e44b..c3c9bb76 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.cpp @@ -1,9 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_ZoniShifted_ShafranovGeometry::CartesianR2_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, - double shift_delta) +CartesianR2_ZoniShifted_ShafranovGeometry::CartesianR2_ZoniShifted_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.cpp index 2ed7ea6b..aaa7d4e8 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Zoni_CircularGeometry.h" using namespace gmgpolar; -CartesianR2_Zoni_CircularGeometry::CartesianR2_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR2_Zoni_CircularGeometry::CartesianR2_Zoni_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.cpp index 51f9a9d6..fc7f2aa2 100644 --- a/src/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.cpp @@ -1,8 +1,9 @@ #include "../include/InputFunctions/SourceTerms/cartesianR2_Zoni_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR2_Zoni_ShafranovGeometry::CartesianR2_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, double shift_delta) +CartesianR2_Zoni_ShafranovGeometry::CartesianR2_Zoni_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, + double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.cpp index a3931bee..692b7da3 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Poisson_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_Poisson_CircularGeometry::CartesianR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR6_Poisson_CircularGeometry::CartesianR6_Poisson_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.cpp index 8f5d1e0a..ee65fe53 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_CzarnyGeometry.cpp @@ -6,8 +6,8 @@ void CartesianR6_Poisson_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_Poisson_CzarnyGeometry::CartesianR6_Poisson_CzarnyGeometry(PolarGrid const& grid, double Rmax, - double inverse_aspect_ratio_epsilon, +CartesianR6_Poisson_CzarnyGeometry::CartesianR6_Poisson_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.cpp index 48ca2fef..d466d42f 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_Poisson_ShafranovGeometry::CartesianR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, +CartesianR6_Poisson_ShafranovGeometry::CartesianR6_Poisson_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.cpp index 260dafd2..0b9322b1 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_SonnendruckerGyro_CircularGeometry::CartesianR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, - double Rmax) +CartesianR6_SonnendruckerGyro_CircularGeometry::CartesianR6_SonnendruckerGyro_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.cpp index 930facbf..29e1b806 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_Sonnendrucker_CircularGeometry::CartesianR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, - double Rmax) +CartesianR6_Sonnendrucker_CircularGeometry::CartesianR6_Sonnendrucker_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.cpp index 53835eea..75232b68 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_CzarnyGeometry.cpp @@ -6,9 +6,8 @@ void CartesianR6_Sonnendrucker_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_Sonnendrucker_CzarnyGeometry::CartesianR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, - double inverse_aspect_ratio_epsilon, - double ellipticity_e) +CartesianR6_Sonnendrucker_CzarnyGeometry::CartesianR6_Sonnendrucker_CzarnyGeometry( + PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.cpp index deae4808..98d0a94d 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.cpp @@ -1,10 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_Sonnendrucker_ShafranovGeometry::CartesianR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, - double Rmax, - double elongation_kappa, - double shift_delta) +CartesianR6_Sonnendrucker_ShafranovGeometry::CartesianR6_Sonnendrucker_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.cpp index 7b99678d..3ec6a94e 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniGyro_CircularGeometry::CartesianR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR6_ZoniGyro_CircularGeometry::CartesianR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.cpp index 49dd6fb0..78df10bf 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_CzarnyGeometry.cpp @@ -6,7 +6,8 @@ void CartesianR6_ZoniGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_ZoniGyro_CzarnyGeometry::CartesianR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_ZoniGyro_CzarnyGeometry::CartesianR6_ZoniGyro_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.cpp index 0b63abdf..7b752a15 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniGyro_ShafranovGeometry::CartesianR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, +CartesianR6_ZoniGyro_ShafranovGeometry::CartesianR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp index 145c5eb2..45d6178c 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniShiftedGyro_CircularGeometry::CartesianR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, - double Rmax) +CartesianR6_ZoniShiftedGyro_CircularGeometry::CartesianR6_ZoniShiftedGyro_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp index 8f2f4c32..a32ec7c7 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.cpp @@ -1,10 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniShiftedGyro_ShafranovGeometry::CartesianR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, - double Rmax, - double elongation_kappa, - double shift_delta) +CartesianR6_ZoniShiftedGyro_ShafranovGeometry::CartesianR6_ZoniShiftedGyro_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.cpp index 119bd452..32068308 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniShifted_CircularGeometry::CartesianR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR6_ZoniShifted_CircularGeometry::CartesianR6_ZoniShifted_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.cpp index 89d4a7b6..4f1d57fa 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_CzarnyGeometry.cpp @@ -6,7 +6,8 @@ void CartesianR6_ZoniShifted_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -CartesianR6_ZoniShifted_CzarnyGeometry::CartesianR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, +CartesianR6_ZoniShifted_CzarnyGeometry::CartesianR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.cpp index ce61ae04..8a221a4e 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.cpp @@ -1,9 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_ZoniShifted_ShafranovGeometry::CartesianR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, - double shift_delta) +CartesianR6_ZoniShifted_ShafranovGeometry::CartesianR6_ZoniShifted_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.cpp index 9928706b..dd3fd3cd 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Zoni_CircularGeometry.h" using namespace gmgpolar; -CartesianR6_Zoni_CircularGeometry::CartesianR6_Zoni_CircularGeometry(PolarGrid const& grid, double Rmax) +CartesianR6_Zoni_CircularGeometry::CartesianR6_Zoni_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.cpp index 2931e8f9..0d5ca758 100644 --- a/src/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.cpp @@ -1,8 +1,9 @@ #include "../include/InputFunctions/SourceTerms/cartesianR6_Zoni_ShafranovGeometry.h" using namespace gmgpolar; -CartesianR6_Zoni_ShafranovGeometry::CartesianR6_Zoni_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, double shift_delta) +CartesianR6_Zoni_ShafranovGeometry::CartesianR6_Zoni_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, + double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp index b54c8901..d23e94e9 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Poisson_CircularGeometry.h" using namespace gmgpolar; -PolarR6_Poisson_CircularGeometry::PolarR6_Poisson_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_Poisson_CircularGeometry::PolarR6_Poisson_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.cpp index b2bfc552..4cf30756 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.cpp @@ -1,8 +1,9 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Poisson_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_Poisson_ShafranovGeometry::PolarR6_Poisson_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, double shift_delta) +PolarR6_Poisson_ShafranovGeometry::PolarR6_Poisson_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, + double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.cpp index cc85e161..7f480aa1 100644 --- a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CircularGeometry.h" using namespace gmgpolar; -PolarR6_SonnendruckerGyro_CircularGeometry::PolarR6_SonnendruckerGyro_CircularGeometry(PolarGrid const& grid, - double Rmax) +PolarR6_SonnendruckerGyro_CircularGeometry::PolarR6_SonnendruckerGyro_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.cpp index 2999023d..ac41f080 100644 --- a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_CzarnyGeometry.cpp @@ -6,9 +6,8 @@ void PolarR6_SonnendruckerGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_SonnendruckerGyro_CzarnyGeometry::PolarR6_SonnendruckerGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, - double inverse_aspect_ratio_epsilon, - double ellipticity_e) +PolarR6_SonnendruckerGyro_CzarnyGeometry::PolarR6_SonnendruckerGyro_CzarnyGeometry( + PolarGrid const& grid, double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) , inverse_aspect_ratio_epsilon(inverse_aspect_ratio_epsilon) diff --git a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.cpp index 4bcaa16b..e9acecd3 100644 --- a/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.cpp @@ -1,10 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_SonnendruckerGyro_ShafranovGeometry::PolarR6_SonnendruckerGyro_ShafranovGeometry(PolarGrid const& grid, - double Rmax, - double elongation_kappa, - double shift_delta) +PolarR6_SonnendruckerGyro_ShafranovGeometry::PolarR6_SonnendruckerGyro_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp index f5176c97..383a5228 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CircularGeometry.h" using namespace gmgpolar; -PolarR6_Sonnendrucker_CircularGeometry::PolarR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_Sonnendrucker_CircularGeometry::PolarR6_Sonnendrucker_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.cpp index 2f29c5b6..61087b7b 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_CzarnyGeometry.cpp @@ -6,7 +6,8 @@ void PolarR6_Sonnendrucker_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_Sonnendrucker_CzarnyGeometry::PolarR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_Sonnendrucker_CzarnyGeometry::PolarR6_Sonnendrucker_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.cpp index 65aa9922..5d76a168 100644 --- a/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.cpp @@ -1,9 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_Sonnendrucker_ShafranovGeometry::PolarR6_Sonnendrucker_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, - double shift_delta) +PolarR6_Sonnendrucker_ShafranovGeometry::PolarR6_Sonnendrucker_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp index 230eef20..e0a5c7ab 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniGyro_CircularGeometry.h" using namespace gmgpolar; -PolarR6_ZoniGyro_CircularGeometry::PolarR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_ZoniGyro_CircularGeometry::PolarR6_ZoniGyro_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.cpp index 8e45d6b1..4ebb9ea0 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.cpp @@ -1,8 +1,9 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniGyro_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_ZoniGyro_ShafranovGeometry::PolarR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, double shift_delta) +PolarR6_ZoniGyro_ShafranovGeometry::PolarR6_ZoniGyro_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, + double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp index e730fe04..1972fff3 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CircularGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShiftedGyro_CircularGeometry::PolarR6_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_ZoniShiftedGyro_CircularGeometry::PolarR6_ZoniShiftedGyro_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp index 333b2f93..00a78b55 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CulhamGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShiftedGyro_CulhamGeometry::PolarR6_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax) +PolarR6_ZoniShiftedGyro_CulhamGeometry::PolarR6_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp index 7d8d1e72..d123f468 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_CzarnyGeometry.cpp @@ -6,7 +6,8 @@ void PolarR6_ZoniShiftedGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_ZoniShiftedGyro_CzarnyGeometry::PolarR6_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +PolarR6_ZoniShiftedGyro_CzarnyGeometry::PolarR6_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp index aef66a7a..15f20191 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.cpp @@ -1,9 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShiftedGyro_ShafranovGeometry::PolarR6_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, - double shift_delta) +PolarR6_ZoniShiftedGyro_ShafranovGeometry::PolarR6_ZoniShiftedGyro_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp index 75369664..a84b4db7 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShifted_CircularGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShifted_CircularGeometry::PolarR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, double Rmax) +PolarR6_ZoniShifted_CircularGeometry::PolarR6_ZoniShifted_CircularGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.cpp index 3925e3f6..6afadd19 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_CzarnyGeometry.cpp @@ -6,8 +6,8 @@ void PolarR6_ZoniShifted_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -PolarR6_ZoniShifted_CzarnyGeometry::PolarR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, double Rmax, - double inverse_aspect_ratio_epsilon, +PolarR6_ZoniShifted_CzarnyGeometry::PolarR6_ZoniShifted_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.cpp index e30094b0..c40b9019 100644 --- a/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.cpp @@ -1,8 +1,8 @@ #include "../include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h" using namespace gmgpolar; -PolarR6_ZoniShifted_ShafranovGeometry::PolarR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, +PolarR6_ZoniShifted_ShafranovGeometry::PolarR6_ZoniShifted_ShafranovGeometry(PolarGrid const& grid, + double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.cpp index e718f6e5..32650546 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CircularGeometry.h" using namespace gmgpolar; -Refined_ZoniShiftedGyro_CircularGeometry::Refined_ZoniShiftedGyro_CircularGeometry(PolarGrid const& grid, double Rmax) +Refined_ZoniShiftedGyro_CircularGeometry::Refined_ZoniShiftedGyro_CircularGeometry( + PolarGrid const& grid, double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp index a2002d32..12fecae9 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.cpp @@ -1,7 +1,8 @@ #include "../include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CulhamGeometry.h" using namespace gmgpolar; -Refined_ZoniShiftedGyro_CulhamGeometry::Refined_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, double Rmax) +Refined_ZoniShiftedGyro_CulhamGeometry::Refined_ZoniShiftedGyro_CulhamGeometry(PolarGrid const& grid, + double Rmax) : grid_(grid) , Rmax(Rmax) { diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.cpp index 7710e649..e3c9188f 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_CzarnyGeometry.cpp @@ -6,7 +6,8 @@ void Refined_ZoniShiftedGyro_CzarnyGeometry::initializeGeometry() factor_xi = 1.0 / sqrt(1.0 - inverse_aspect_ratio_epsilon * inverse_aspect_ratio_epsilon / 4.0); } -Refined_ZoniShiftedGyro_CzarnyGeometry::Refined_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, double Rmax, +Refined_ZoniShiftedGyro_CzarnyGeometry::Refined_ZoniShiftedGyro_CzarnyGeometry(PolarGrid const& grid, + double Rmax, double inverse_aspect_ratio_epsilon, double ellipticity_e) : grid_(grid) diff --git a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.cpp b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.cpp index bd413f31..0f58ee1c 100644 --- a/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.cpp +++ b/src/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.cpp @@ -1,9 +1,8 @@ #include "../include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h" using namespace gmgpolar; -Refined_ZoniShiftedGyro_ShafranovGeometry::Refined_ZoniShiftedGyro_ShafranovGeometry(PolarGrid const& grid, double Rmax, - double elongation_kappa, - double shift_delta) +Refined_ZoniShiftedGyro_ShafranovGeometry::Refined_ZoniShiftedGyro_ShafranovGeometry( + PolarGrid const& grid, double Rmax, double elongation_kappa, double shift_delta) : grid_(grid) , Rmax(Rmax) , elongation_kappa(elongation_kappa) diff --git a/src/Interpolation/extrapolated_prolongation.cpp b/src/Interpolation/extrapolated_prolongation.cpp index e05c8c2e..9b001dee 100644 --- a/src/Interpolation/extrapolated_prolongation.cpp +++ b/src/Interpolation/extrapolated_prolongation.cpp @@ -85,7 +85,8 @@ static KOKKOS_INLINE_FUNCTION void fineNodeExtrapolatedProlongation(const int i_ } } -void Interpolation::applyExtrapolatedProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, +void Interpolation::applyExtrapolatedProlongation(const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector fine_result, HostConstVector coarse_values) const { diff --git a/src/Interpolation/extrapolated_restriction.cpp b/src/Interpolation/extrapolated_restriction.cpp index 7e9e506b..47e59b4f 100644 --- a/src/Interpolation/extrapolated_restriction.cpp +++ b/src/Interpolation/extrapolated_restriction.cpp @@ -50,7 +50,8 @@ static KOKKOS_INLINE_FUNCTION void coarseNodeExtrapolatedRestriction(const int i coarse_result[coarse_grid.index(i_r_coarse, i_theta_coarse)] = value; } -void Interpolation::applyExtrapolatedRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, +void Interpolation::applyExtrapolatedRestriction(const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, HostVector coarse_result, HostConstVector fine_values) const { diff --git a/src/Interpolation/fmg_interpolation.cpp b/src/Interpolation/fmg_interpolation.cpp index e29b7cd8..408150ab 100644 --- a/src/Interpolation/fmg_interpolation.cpp +++ b/src/Interpolation/fmg_interpolation.cpp @@ -58,7 +58,8 @@ using namespace gmgpolar; */ static KOKKOS_INLINE_FUNCTION void fineNodeFMGInterpolation(const int i_r, const int i_theta, - const PolarGrid& coarse_grid, const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector& fine_result, HostConstVector& coarse_values) { @@ -226,8 +227,9 @@ static KOKKOS_INLINE_FUNCTION void fineNodeFMGInterpolation(const int i_r, const } } -void Interpolation::applyFMGInterpolation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, - HostVector fine_result, HostConstVector coarse_values) const +void Interpolation::applyFMGInterpolation(const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector fine_result, + HostConstVector coarse_values) const { assert(std::ssize(coarse_values) == coarse_grid.numberOfNodes()); assert(std::ssize(fine_result) == fine_grid.numberOfNodes()); diff --git a/src/Interpolation/injection.cpp b/src/Interpolation/injection.cpp index c0ffc728..1895ee94 100644 --- a/src/Interpolation/injection.cpp +++ b/src/Interpolation/injection.cpp @@ -4,7 +4,8 @@ using namespace gmgpolar; /* Remark: This injection is not scaled. */ static KOKKOS_INLINE_FUNCTION void coarseNodeInjection(const int i_r_coarse, const int i_theta_coarse, - const PolarGrid& fine_grid, const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, HostVector& coarse_result, HostConstVector& fine_values) { @@ -17,8 +18,9 @@ static KOKKOS_INLINE_FUNCTION void coarseNodeInjection(const int i_r_coarse, con coarse_result[coarse_index] = fine_values[fine_index]; } -void Interpolation::applyInjection(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, - HostVector coarse_result, HostConstVector fine_values) const +void Interpolation::applyInjection(const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, HostVector coarse_result, + HostConstVector fine_values) const { assert(std::ssize(fine_values) == fine_grid.numberOfNodes()); assert(std::ssize(coarse_result) == coarse_grid.numberOfNodes()); diff --git a/src/Interpolation/prolongation.cpp b/src/Interpolation/prolongation.cpp index f59450bb..b630a60c 100644 --- a/src/Interpolation/prolongation.cpp +++ b/src/Interpolation/prolongation.cpp @@ -52,8 +52,10 @@ using namespace gmgpolar; * - k1, k2 in angular direction */ -static KOKKOS_INLINE_FUNCTION void fineNodeProlongation(const int i_r, const int i_theta, const PolarGrid& coarse_grid, - const PolarGrid& fine_grid, HostVector& fine_result, +static KOKKOS_INLINE_FUNCTION void fineNodeProlongation(const int i_r, const int i_theta, + const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, + HostVector& fine_result, HostConstVector& coarse_values) { const int i_r_coarse = i_r / 2; @@ -107,8 +109,9 @@ static KOKKOS_INLINE_FUNCTION void fineNodeProlongation(const int i_r, const int } } -void Interpolation::applyProlongation(const PolarGrid& coarse_grid, const PolarGrid& fine_grid, - HostVector fine_result, HostConstVector coarse_values) const +void Interpolation::applyProlongation(const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, HostVector fine_result, + HostConstVector coarse_values) const { assert(std::ssize(coarse_values) == coarse_grid.numberOfNodes()); assert(std::ssize(fine_result) == fine_grid.numberOfNodes()); diff --git a/src/Interpolation/restriction.cpp b/src/Interpolation/restriction.cpp index 66a2c5ea..98d1d739 100644 --- a/src/Interpolation/restriction.cpp +++ b/src/Interpolation/restriction.cpp @@ -24,7 +24,8 @@ using namespace gmgpolar; */ static KOKKOS_INLINE_FUNCTION void coarseNodeRestriction(const int i_r_coarse, const int i_theta_coarse, - const PolarGrid& fine_grid, const PolarGrid& coarse_grid, + const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, HostVector& coarse_result, HostConstVector& fine_values) { @@ -68,8 +69,9 @@ static KOKKOS_INLINE_FUNCTION void coarseNodeRestriction(const int i_r_coarse, c coarse_result[coarse_grid.index(i_r_coarse, i_theta_coarse)] = value; } -void Interpolation::applyRestriction(const PolarGrid& fine_grid, const PolarGrid& coarse_grid, - HostVector coarse_result, HostConstVector fine_values) const +void Interpolation::applyRestriction(const PolarGrid& fine_grid, + const PolarGrid& coarse_grid, HostVector coarse_result, + HostConstVector fine_values) const { assert(std::ssize(fine_values) == fine_grid.numberOfNodes()); assert(std::ssize(coarse_result) == coarse_grid.numberOfNodes()); diff --git a/src/PolarGrid/anisotropic_division.cpp b/src/PolarGrid/anisotropic_division.cpp index 57cba345..855c0c89 100644 --- a/src/PolarGrid/anisotropic_division.cpp +++ b/src/PolarGrid/anisotropic_division.cpp @@ -1,9 +1,10 @@ #include "../../include/PolarGrid/polargrid.h" using namespace gmgpolar; -template -Vector PolarGrid::RadialAnisotropicDivision(double R0, double R, const int nr_exp, double refinement_radius, - const int anisotropic_factor) const +template +Vector PolarGrid::RadialAnisotropicDivision(double R0, double R, const int nr_exp, + double refinement_radius, + const int anisotropic_factor) const { // Calculate the percentage of refinement_radius. const double percentage = (refinement_radius - R0) / (R - R0); diff --git a/src/PolarGrid/polargrid.cpp b/src/PolarGrid/polargrid.cpp index 2671bb6b..bee36a4c 100644 --- a/src/PolarGrid/polargrid.cpp +++ b/src/PolarGrid/polargrid.cpp @@ -6,8 +6,9 @@ using namespace gmgpolar; // ------------ // // Constructor to initialize grid using vectors of radii and angles. -template -PolarGrid::PolarGrid(std::vector radii, std::vector angles, std::optional splitting_radius) +template +PolarGrid::PolarGrid(std::vector radii, std::vector angles, + std::optional splitting_radius) : nr_(radii.size()) , ntheta_(angles.size() - 1) , is_ntheta_PowerOfTwo_((ntheta_ & (ntheta_ - 1)) == 0) @@ -33,9 +34,10 @@ PolarGrid::PolarGrid(std::vector radii, std::vector } // Constructor to initialize grid using parameters from GMGPolar. -template -PolarGrid::PolarGrid(double R0, double Rmax, const int nr_exp, const int ntheta_exp, double refinement_radius, - const int anisotropic_factor, const int divideBy2, std::optional splitting_radius) +template +PolarGrid::PolarGrid(double R0, double Rmax, const int nr_exp, const int ntheta_exp, + double refinement_radius, const int anisotropic_factor, const int divideBy2, + std::optional splitting_radius) { assert(R0 > 0.0 && Rmax > R0 && !equals(R0, Rmax)); // Construct radii_ and angles_ @@ -56,9 +58,9 @@ PolarGrid::PolarGrid(double R0, double Rmax, const int nr_exp, cons // ------------------- // // Construct radial divisions for grid generation. -template +template void PolarGrid::constructRadialDivisions(double R0, double R, const int nr_exp, double refinement_radius, - const int anisotropic_factor) + const int anisotropic_factor) { // r_temp contains the values before we refine one last time for extrapolation. // Therefore we first consider 2^(nr_exp-1) points. @@ -91,7 +93,7 @@ void PolarGrid::constructRadialDivisions(double R0, double R, const // Construct angular divisions for grid generation. // Currently we dont allow anisotropic refinement in angular direction -template +template void PolarGrid::constructAngularDivisions(const int ntheta_exp, const int nr) { if (ntheta_exp < 0) { @@ -115,7 +117,7 @@ void PolarGrid::constructAngularDivisions(const int ntheta_exp, con } // divideBy2: Number of times to divide both radial and angular divisions by 2. -template +template void PolarGrid::refineGrid(const int divideBy2) { radii_ = divideVector(radii_, divideBy2); @@ -125,8 +127,9 @@ void PolarGrid::refineGrid(const int divideBy2) is_ntheta_PowerOfTwo_ = (ntheta_ & (ntheta_ - 1)) == 0; } -template -Vector PolarGrid::divideVector(Vector vec, const int divideBy2) const +template +Vector PolarGrid::divideVector(Vector vec, + const int divideBy2) const { const int powerOfTwo = 1 << divideBy2; size_t vecSize = vec.size(); @@ -145,7 +148,7 @@ Vector PolarGrid::divideVector(Vector +template void PolarGrid::initializeDistances() { // radial_spacings contains the distances between each consecutive radii division. @@ -170,7 +173,7 @@ void PolarGrid::initializeDistances() // If std::nullopt, automatic line-splitting is enabled. // If the splitting radius is less than R0, only Radial indexing is used. // If the splitting radius is greater than or equal to R, only Circular indexing is used. -template +template void PolarGrid::initializeLineSplitting(std::optional splitting_radius) { if (splitting_radius.has_value()) { @@ -232,7 +235,7 @@ void PolarGrid::initializeLineSplitting(std::optional split namespace gmgpolar { -template +template PolarGrid coarseningGrid(const PolarGrid& fineGrid) { assert((fineGrid.nr() - 1) % 2 == 0 && (fineGrid.ntheta()) % 2 == 0); @@ -270,8 +273,9 @@ template PolarGrid coarseningGrid(const // Check parameter validity // // ------------------------ // -template -void PolarGrid::checkParameters(Vector radii, Vector angles) const +template +void PolarGrid::checkParameters(Vector radii, + Vector angles) const { auto radii_start = Kokkos::Experimental::begin(radii); auto radii_end = Kokkos::Experimental::end(radii); diff --git a/src/convergence_order.cpp b/src/convergence_order.cpp index dce8eaa9..6540636b 100644 --- a/src/convergence_order.cpp +++ b/src/convergence_order.cpp @@ -85,8 +85,8 @@ int main(int argc, char* argv[]) for (divideBy2 = 0; divideBy2 < MAX_DIVIDE_BY_2; divideBy2++) { double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; - PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, - splitting_radius); + PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, + divideBy2, splitting_radius); GMGPolar solver(grid, domain_geometry, coefficients); PolarR6_ZoniGyro_ShafranovGeometry source_term(grid, Rmax, elongation_kappa, shift_delta); diff --git a/src/strong_scaling.cpp b/src/strong_scaling.cpp index 10dd31b1..ae354e5d 100644 --- a/src/strong_scaling.cpp +++ b/src/strong_scaling.cpp @@ -83,7 +83,8 @@ void runTest(int divideBy2, std::ostream& outfile) double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; - PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, + splitting_radius); GMGPolar solver(grid, domain_geometry, coefficients); // PolarR6_ZoniGyro_ShafranovGeometry source_term(grid, Rmax, elongation_kappa, shift_delta); diff --git a/src/weak_scaling.cpp b/src/weak_scaling.cpp index feeb20ca..62512c63 100644 --- a/src/weak_scaling.cpp +++ b/src/weak_scaling.cpp @@ -83,7 +83,8 @@ void runTest(int divideBy2, std::ostream& outfile) double refinement_radius = alpha_jump; std::optional splitting_radius = std::nullopt; - PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, splitting_radius); + PolarGrid grid(R0, Rmax, nr_exp, ntheta_exp, refinement_radius, anisotropic_factor, divideBy2, + splitting_radius); GMGPolar solver(grid, domain_geometry, coefficients); // PolarR6_ZoniGyro_ShafranovGeometry source_term(grid, Rmax, elongation_kappa, shift_delta); diff --git a/tests/GMGPolar/pcg_tests.cpp b/tests/GMGPolar/pcg_tests.cpp index 9be5b10a..cf58fa2f 100644 --- a/tests/GMGPolar/pcg_tests.cpp +++ b/tests/GMGPolar/pcg_tests.cpp @@ -631,7 +631,8 @@ template void run_gmgpolar() { PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, - TestFixture::refinementRadius, TestFixture::anisotropicFactor, TestFixture::divideBy2); + TestFixture::refinementRadius, TestFixture::anisotropicFactor, + TestFixture::divideBy2); const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; @@ -687,7 +688,7 @@ void run_gmgpolar() solver.solve(boundary_conditions, source_term); // --- Retrieve solution and associated grid --- // - HostVector solution = solver.solution(); + HostVector solution = solver.solution(); const PolarGrid& solution_grid = solver.grid(); if (TestFixture::verbose > 0) { diff --git a/tests/GMGPolar/solve_tests.cpp b/tests/GMGPolar/solve_tests.cpp index c209bd61..632b2263 100644 --- a/tests/GMGPolar/solve_tests.cpp +++ b/tests/GMGPolar/solve_tests.cpp @@ -640,7 +640,8 @@ template void run_gmgpolar() { PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, - TestFixture::refinementRadius, TestFixture::anisotropicFactor, TestFixture::divideBy2); + TestFixture::refinementRadius, TestFixture::anisotropicFactor, + TestFixture::divideBy2); const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; @@ -690,7 +691,7 @@ void run_gmgpolar() solver.solve(boundary_conditions, source_term); // --- Retrieve solution and associated grid --- // - HostVector solution = solver.solution(); + HostVector solution = solver.solution(); const PolarGrid& solution_grid = solver.grid(); if (TestFixture::verbose > 0) { diff --git a/tests/Interpolation/extrapolated_prolongation.cpp b/tests/Interpolation/extrapolated_prolongation.cpp index 6fb689da..47195d9a 100644 --- a/tests/Interpolation/extrapolated_prolongation.cpp +++ b/tests/Interpolation/extrapolated_prolongation.cpp @@ -9,8 +9,9 @@ using namespace gmgpolar; // Helper that computes the mathematically expected extrapolated prolongation value -static double expected_extrapolated_value(const PolarGrid& coarse, const PolarGrid& fine, - HostConstVector coarse_vals, int i_r, int i_theta) +static double expected_extrapolated_value(const PolarGrid& coarse, + const PolarGrid& fine, HostConstVector coarse_vals, + int i_r, int i_theta) { int i_r_coarse = i_r / 2; int i_theta_coarse = i_theta / 2; diff --git a/tests/Interpolation/extrapolated_restriction.cpp b/tests/Interpolation/extrapolated_restriction.cpp index c36e5a86..403b4b3b 100644 --- a/tests/Interpolation/extrapolated_restriction.cpp +++ b/tests/Interpolation/extrapolated_restriction.cpp @@ -9,7 +9,8 @@ using namespace gmgpolar; // Helper that computes the mathematically expected extrapolated restriction value -static double expected_extrapolated_restriction_value(const PolarGrid& fine, const PolarGrid& coarse, +static double expected_extrapolated_restriction_value(const PolarGrid& fine, + const PolarGrid& coarse, HostConstVector fine_vals, int i_r_coarse, int i_theta_coarse) { diff --git a/tests/Interpolation/prolongation.cpp b/tests/Interpolation/prolongation.cpp index ba37f279..a9018f1b 100644 --- a/tests/Interpolation/prolongation.cpp +++ b/tests/Interpolation/prolongation.cpp @@ -8,8 +8,8 @@ using namespace gmgpolar; // Helper that computes the mathematically expected prolongation value -static double expected_value(const PolarGrid& coarse, const PolarGrid& fine, HostConstVector coarse_vals, - int i_r, int i_theta) +static double expected_value(const PolarGrid& coarse, const PolarGrid& fine, + HostConstVector coarse_vals, int i_r, int i_theta) { int i_r_coarse = i_r / 2; int i_theta_coarse = i_theta / 2; diff --git a/tests/Interpolation/restriction.cpp b/tests/Interpolation/restriction.cpp index 5fee7e78..29821ff1 100644 --- a/tests/Interpolation/restriction.cpp +++ b/tests/Interpolation/restriction.cpp @@ -8,8 +8,9 @@ using namespace gmgpolar; // Helper that computes the mathematically expected restriction value -static double expected_restriction_value(const PolarGrid& fine, const PolarGrid& coarse, - HostConstVector fine_vals, int i_r_coarse, int i_theta_coarse) +static double expected_restriction_value(const PolarGrid& fine, + const PolarGrid& coarse, HostConstVector fine_vals, + int i_r_coarse, int i_theta_coarse) { int i_r = i_r_coarse * 2; int i_theta = i_theta_coarse * 2; diff --git a/tests/test_tools.h b/tests/test_tools.h index 300ecbef..b4371332 100644 --- a/tests/test_tools.h +++ b/tests/test_tools.h @@ -6,8 +6,8 @@ using namespace gmgpolar; -inline HostVector generate_random_sample_data(const PolarGrid& grid, unsigned int seed, double min_val = -100.0, - double max_val = 100.0) +inline HostVector generate_random_sample_data(const PolarGrid& grid, unsigned int seed, + double min_val = -100.0, double max_val = 100.0) { HostVector x("x", grid.numberOfNodes()); std::mt19937 gen(seed); From 9c83c51fd9fc85505a7ad0f6dff8745e916d397c Mon Sep 17 00:00:00 2001 From: Emily Bourne Date: Wed, 20 May 2026 14:27:03 +0200 Subject: [PATCH 21/22] Should be ifdef --- include/PolarGrid/polargrid.h | 2 +- src/PolarGrid/polargrid.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/PolarGrid/polargrid.h b/include/PolarGrid/polargrid.h index 816381b3..17278ba3 100644 --- a/include/PolarGrid/polargrid.h +++ b/include/PolarGrid/polargrid.h @@ -164,7 +164,7 @@ class PolarGrid template class PolarGrid; -#if KOKKOS_ENABLE_CUDA +#ifdef KOKKOS_ENABLE_CUDA template class PolarGrid; #endif diff --git a/src/PolarGrid/polargrid.cpp b/src/PolarGrid/polargrid.cpp index bee36a4c..956e07a8 100644 --- a/src/PolarGrid/polargrid.cpp +++ b/src/PolarGrid/polargrid.cpp @@ -263,7 +263,7 @@ PolarGrid coarseningGrid(const PolarGrid& fineGrid) } template PolarGrid coarseningGrid(const PolarGrid& grid); -#if KOKKOS_ENABLE_CUDA +#ifdef KOKKOS_ENABLE_CUDA template PolarGrid coarseningGrid(const PolarGrid& grid); #endif From e84667af13ba016a648f078ab911c9605ffa5b2d Mon Sep 17 00:00:00 2001 From: BOURNE Emily EPFL Date: Wed, 20 May 2026 15:52:36 +0200 Subject: [PATCH 22/22] Should be DefaultExecutionSpace --- include/Residual/ResidualGive/residualGive.inl | 2 +- include/Residual/ResidualTake/residualTake.inl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/Residual/ResidualGive/residualGive.inl b/include/Residual/ResidualGive/residualGive.inl index 5bc83d29..f6680d4e 100644 --- a/include/Residual/ResidualGive/residualGive.inl +++ b/include/Residual/ResidualGive/residualGive.inl @@ -24,7 +24,7 @@ void ResidualGive::computeResidual(HostVector h_result, const int n = result.size(); Kokkos::parallel_for( - "Residual Give: Subtract A*x from rhs", Kokkos::RangePolicy(0, n), + "Residual Give: Subtract A*x from rhs", Kokkos::RangePolicy(0, n), KOKKOS_LAMBDA(const int i) { result[i] = rhs[i] - result[i]; }); Kokkos::fence(); diff --git a/include/Residual/ResidualTake/residualTake.inl b/include/Residual/ResidualTake/residualTake.inl index e322917e..8f598d67 100644 --- a/include/Residual/ResidualTake/residualTake.inl +++ b/include/Residual/ResidualTake/residualTake.inl @@ -24,7 +24,7 @@ void ResidualTake::computeResidual(HostVector h_result, const int n = result.size(); Kokkos::parallel_for( - "Residual Take: Subtract A*x from rhs", Kokkos::RangePolicy(0, n), + "Residual Take: Subtract A*x from rhs", Kokkos::RangePolicy(0, n), KOKKOS_LAMBDA(const int i) { result[i] = rhs[i] - result[i]; }); Kokkos::fence();