diff --git a/include/ConfigParser/config_parser.h b/include/ConfigParser/config_parser.h index f12b74b6e..e8ac97d56 100644 --- a/include/ConfigParser/config_parser.h +++ b/include/ConfigParser/config_parser.h @@ -46,7 +46,7 @@ class ConfigParser bool cacheDensityProfileCoefficients() const; bool cacheDomainGeometry() const; - const PolarGrid& grid() const; + const PolarGrid& grid() const; // Full Multigrid Method bool FMG() const; @@ -96,7 +96,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 bd2da7468..3c80e3310 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 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; @@ -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 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; @@ -133,10 +133,10 @@ void DirectSolverGive::applySymmetryShiftOuterBoundary(HostVecto } template -void DirectSolverGive::applySymmetryShift(HostVector x) const +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 7c2804ce8..005e0387f 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_; - 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"); @@ -809,14 +808,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 /* ---------------- */ @@ -830,7 +829,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++) { @@ -853,7 +852,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); } @@ -865,7 +864,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 4c61ae593..a21063ce7 100644 --- a/include/DirectSolver/DirectSolverGive/directSolverGive.h +++ b/include/DirectSolver/DirectSolverGive/directSolverGive.h @@ -9,18 +9,19 @@ 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; 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 @@ -39,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 bb6e59b59..05f09d13f 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()) @@ -14,8 +14,9 @@ DirectSolverGive::DirectSolverGive(const PolarGrid& grid, const } template -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 05483e0fc..2b8ac2649 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& 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 +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 1d5a0845e..25e3b0afb 100644 --- a/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl +++ b/include/DirectSolver/DirectSolverTake/applySymmetryShift.inl @@ -5,26 +5,26 @@ /* ----------------------- */ template -void DirectSolverTake::applySymmetryShiftInnerBoundary(HostVector x) const +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_); 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 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()); - 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,10 +93,10 @@ void DirectSolverTake::applySymmetryShiftOuterBoundary(HostVecto } template -void DirectSolverTake::applySymmetryShift(HostVector x) const +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); @@ -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 f8ceedc14..30a3cd04a 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,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; @@ -479,9 +479,9 @@ typename DirectSolverTake::SystemMatrix DirectSolverTake::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"); @@ -489,24 +489,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. */ @@ -514,7 +514,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 ), @@ -527,7 +527,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 c5ac6d79a..600424995 100644 --- a/include/DirectSolver/DirectSolverTake/directSolverTake.h +++ b/include/DirectSolver/DirectSolverTake/directSolverTake.h @@ -9,18 +9,19 @@ 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; 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 @@ -39,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 c700f7ea0..9bdea7e9a 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()) @@ -14,8 +14,9 @@ DirectSolverTake::DirectSolverTake(const PolarGrid& grid, const } template -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 71df12245..f192c1303 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& 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 +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 a62988e28..881dd6bf3 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) @@ -39,7 +40,7 @@ class DirectSolver virtual void solveInPlace(HostVector solution) = 0; protected: - const PolarGrid& grid_; + const PolarGrid& grid_; const LevelCacheType& level_cache_; const bool DirBC_Interior_; }; diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherGive/applyAscOrtho.inl index e1edf5cb4..82c6afd78 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, - const LevelCacheType& level_cache, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result) +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) { 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, - const LevelCacheType& level_cache, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result) +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) { 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, - const LevelCacheType& level_cache, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result) +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) { KOKKOS_ASSERT(i_r >= grid.numberSmootherCircles() - 1 && i_r < grid.nr()); @@ -702,9 +702,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, - const LevelCacheType& level_cache, const bool DirBC_Interior, - HostConstVector& x, HostConstVector& rhs, HostVector& result) +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) { KOKKOS_ASSERT(i_r >= grid.numberSmootherCircles() && i_r < grid.nr()); @@ -839,9 +839,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; @@ -853,9 +853,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackCircleSection(H 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): */ @@ -869,7 +869,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 @@ -888,7 +888,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 ), @@ -908,7 +908,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 ), @@ -923,9 +923,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; @@ -937,9 +937,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteCircleSection(H 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): */ @@ -954,7 +954,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 @@ -973,7 +973,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 ), @@ -993,7 +993,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 ), @@ -1008,9 +1008,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; @@ -1022,9 +1022,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoBlackRadialSection(H 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): */ @@ -1039,7 +1039,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 @@ -1058,7 +1058,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 ), @@ -1078,7 +1078,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 ), @@ -1093,9 +1093,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; @@ -1107,9 +1107,9 @@ void ExtrapolatedSmootherGive::applyAscOrthoWhiteRadialSection(H 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): */ @@ -1124,7 +1124,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 @@ -1143,7 +1143,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 ), @@ -1163,7 +1163,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 5ab6ce4d3..df2dcec73 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& 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, - 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& m 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& template 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(); @@ -278,7 +280,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) { @@ -287,13 +289,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); @@ -304,7 +306,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 b044dc4ab..8bcb56000 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_; @@ -1101,7 +1099,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++) { @@ -1126,7 +1124,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, @@ -1140,7 +1138,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 65ee56e27..c5c216cc2 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 @@ -95,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_; @@ -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(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 +141,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 fd120cae3..a670b3e8b 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) : ExtrapolatedSmoother(grid, level_cache, DirBC_Interior) @@ -42,13 +42,18 @@ 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 +61,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,8 +71,8 @@ void ExtrapolatedSmootherGive::extrapolatedSmoothing(HostVector< // The For loop matches radial access pattern Kokkos::parallel_for( "ExtrapolatedSmootherGive: Init Temp (Radial)", - Kokkos::MDRangePolicy>({0, grid.numberSmootherCircles()}, - {grid.ntheta(), grid.nr()}), + 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); temp[index] = (i_r & 1 || i_theta & 1) ? rhs[index] : x[index]; @@ -86,4 +91,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 91876a727..5ae9fbb15 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 = { @@ -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,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. @@ -113,4 +114,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 149e72041..32993496a 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)); + 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; @@ -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,8 +33,8 @@ 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}, - {num_black_circles, grid.ntheta()}), + 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; const int index = grid.index(i_r, i_theta); @@ -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)); + 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; @@ -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,8 +76,8 @@ 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}, - {num_white_circles, grid.ntheta()}), + 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; const int index = grid.index(i_r, i_theta); @@ -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)); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Diagonal Solve int batch_offset = 0; @@ -106,8 +106,8 @@ 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()}, - {num_black_radial_lines, grid.nr()}), + 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; const int index = grid.index(i_r, i_theta); @@ -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)); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve int batch_offset = 1; @@ -136,8 +136,8 @@ 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()}, - {num_white_radial_lines, grid.nr()}), + 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; const int index = grid.index(i_r, i_theta); diff --git a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/applyAscOrtho.inl index 97be93b61..47a9a8815 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()); @@ -185,11 +185,10 @@ 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, - 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()); @@ -461,24 +460,24 @@ nodeApplyAscOrthoRadialTake(int i_r, int i_theta, const PolarGrid& grid, bool Di } // namespace extrapolated_smoother_take template -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 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()); - 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; @@ -486,7 +485,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 ), @@ -501,24 +500,24 @@ 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 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()); - 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; @@ -526,7 +525,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 ), @@ -541,24 +540,24 @@ 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 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()); - 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; @@ -566,7 +565,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 ), @@ -581,24 +580,24 @@ 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 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()); - 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; @@ -606,7 +605,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 55c71ba98..c22918c60 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& 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, - 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,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; @@ -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(); @@ -172,7 +172,7 @@ ExtrapolatedSmootherTake::buildInteriorBoundarySolverMatrix() #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); + SparseMatrixCOO inner_boundary_solver_matrix(ntheta, ntheta, nnz); inner_boundary_solver_matrix.is_symmetric(true); #else std::function nnz_per_row = [&](int i_theta) { @@ -181,21 +181,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 38ae34a5f..385c2faa2 100644 --- a/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl +++ b/include/ExtrapolatedSmoother/ExtrapolatedSmootherTake/buildTridiagonalAsc.inl @@ -15,11 +15,10 @@ 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; @@ -164,11 +163,10 @@ 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; @@ -533,18 +531,18 @@ 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()); - 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_; @@ -555,7 +553,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 ), @@ -569,7 +567,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 04e87e365..d8552bbe2 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 @@ -93,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_; @@ -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(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 */ @@ -143,10 +140,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 5989376af..bc3e96879 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) : ExtrapolatedSmoother(grid, level_cache, DirBC_Interior) @@ -43,9 +43,14 @@ 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 +65,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 ced69b21f..d8368d1c3 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 = { @@ -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,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. @@ -113,4 +114,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 f80e20dac..82d3002f0 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)); + 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; @@ -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,8 +33,8 @@ 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}, - {num_black_circles, grid.ntheta()}), + 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; const int index = grid.index(i_r, i_theta); @@ -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)); + 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; @@ -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,8 +76,8 @@ 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}, - {num_white_circles, grid.ntheta()}), + 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; const int index = grid.index(i_r, i_theta); @@ -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)); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Diagonal Solve int batch_offset = 0; @@ -106,8 +106,8 @@ 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()}, - {num_black_radial_lines, grid.nr()}), + 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; const int index = grid.index(i_r, i_theta); @@ -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)); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve int batch_offset = 1; @@ -136,8 +136,8 @@ 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()}, - {num_white_radial_lines, grid.nr()}), + 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; const int index = grid.index(i_r, i_theta); diff --git a/include/ExtrapolatedSmoother/extrapolatedSmoother.h b/include/ExtrapolatedSmoother/extrapolatedSmoother.h index f9b294466..38ca430f6 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) @@ -38,7 +39,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_; }; diff --git a/include/GMGPolar/gmgpolar.h b/include/GMGPolar/gmgpolar.h index 1f46bfe39..280a5fa2c 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,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); @@ -204,7 +205,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 92f4c6309..6911f9a84 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 */ @@ -154,7 +154,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 c92575ecd..1c6a24d26 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,13 @@ 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 +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; @@ -190,7 +193,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_; @@ -332,7 +335,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_; @@ -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"; @@ -434,7 +437,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) @@ -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 6a38ee74b..932d5bd81 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(); assert(solution.size() == error.size()); assert(std::ssize(solution) == grid.numberOfNodes()); diff --git a/include/GMGPolar/utils.h b/include/GMGPolar/utils.h index 84646486e..125080d3c 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(); 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 ab27496d1..8615d3957 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 9fb5c9aac..659d5ef29 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, - 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; 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 7e57db124..70d5c8bc0 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Poisson_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 5695e90b9..ef18431b5 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 e406aaf39..5902b6e39 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 ffed0049b..5757857fb 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 2c4c353ba..4e6bea764 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 46df1080b..6395fbfab 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 db507abcf..91dddb1a4 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_Sonnendrucker_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 56189486d..1dd1fb75d 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 a6c68a347..75a2cbc5f 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 ea53c4a51..80797ef6e 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniGyro_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 d18d947cc..f9833a04e 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 d09cedec2..ca42fc2aa 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 81e1816cc..8ae482802 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 baea07b45..158610160 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 bcb64592e..900b29060 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 ea30601f9..4a8436c3c 100644 --- a/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR2_ZoniShifted_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 31141337f..bb6b58a79 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 bfcc08ab5..d28a87356 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, - 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; 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 15fcf405c..cc89ad115 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, - 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; 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 89d07b62d..e8aafa570 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 e2468619f..4d9530376 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, - 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; 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 19bd70705..1f24ef61c 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Poisson_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 dd5f85a7b..532755323 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 5483e3a6d..b08fe9cd1 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 d4f45b3c5..49f4248c4 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 acaeb1fd6..1ae22336d 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 fd7ec12de..7e6f0e7ab 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 2fdd969bb..261dcc72a 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_Sonnendrucker_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 41bdc0ba9..c1280a6ac 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 ffdb03ded..996a2cba8 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 131387f8a..ce4a2412d 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniGyro_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 23bd28596..cdbaec71e 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 896ef647b..d97e04ac6 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 c9e92ef98..d598b0318 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 2d581e307..401b244e7 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 645cceee1..25714d98c 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 b172906aa..61b22e465 100644 --- a/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/cartesianR6_ZoniShifted_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 0bc64ba2e..410547cc7 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 40821d06d..bfcd8c31e 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, - 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; 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 98deb83d5..bd2aec722 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, - 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; 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 364e5b922..fd705e8bd 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 d7b206cc3..7200d410b 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, - 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; 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 717295aeb..b92ce5800 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, - 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; 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 f932bbc1a..8be29b20f 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 0d60af11b..87966eece 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 b73c51202..27d6888c5 100644 --- a/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_SonnendruckerGyro_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 63577f68b..72d130d8a 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 a2a2a7293..17f8e9821 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 f5b67792e..36f782936 100644 --- a/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_Sonnendrucker_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 29d00d8b2..7c2f944bd 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 287aef959..b42ba1658 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, - 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; 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 efd517465..97826d73f 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, - 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; 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 4de29c8fe..74fc9204f 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 7bee69d0a..52c4b8afb 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 cd514aca2..f5e86b7f7 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 edc849cf6..0f5d23236 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 c4ac36254..074c02a6b 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 a31cb8449..d948d80ac 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, - 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; 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 b81d88945..bc49f9261 100644 --- a/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/polarR6_ZoniShifted_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 2313ea370..af358d9e7 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 a3fce910c..2e30ca332 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, - 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; 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 5fcfd58f8..8844048df 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, - 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; 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 cf0d80dd8..d9b4e4306 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 db4693117..0663636d7 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 938fcb38a..d19d705aa 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 1435845bb..c70ae3b7c 100644 --- a/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h +++ b/include/InputFunctions/SourceTerms/refined_ZoniShiftedGyro_ShafranovGeometry.h @@ -12,15 +12,15 @@ 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; 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 50e897ce3..008103759 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 a1c79aff8..1bfcd9e1d 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(); @@ -117,7 +117,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_; @@ -135,7 +135,8 @@ template & grid, + const DensityProfileCoefficients& density_profile_coefficients, const DomainGeometry& domain_geometry, const bool cache_density_profile_coefficients, const bool cache_domain_geometry); @@ -143,14 +144,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, @@ -178,14 +179,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/level.inl b/include/Level/level.inl index 2c37bab7b..c076f2e03 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 69c4bdac7..8c5ccee1a 100644 --- a/include/Level/levelCache.inl +++ b/include/Level/levelCache.inl @@ -1,8 +1,90 @@ #pragma once +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) +{ + 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 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, + 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,61 +103,17 @@ 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++) { - 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); - } - } + 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 -#pragma omp parallel for - for (int i_r = 0; i_r < grid.numberSmootherCircles(); i_r++) { - 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); - - 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 -#pragma omp parallel for - for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) { - 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); - - 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(); } template @@ -98,13 +136,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 +154,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_; } diff --git a/include/LinearAlgebra/Matrix/coo_matrix.h b/include/LinearAlgebra/Matrix/coo_matrix.h index d7ebd4624..b6e220891 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 5f7afdae9..e9db49930 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 211863124..c5d32838e 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/Solvers/tridiagonal_solver.h b/include/LinearAlgebra/Solvers/tridiagonal_solver.h index 939be64dc..5dd470399 100644 --- a/include/LinearAlgebra/Solvers/tridiagonal_solver.h +++ b/include/LinearAlgebra/Solvers/tridiagonal_solver.h @@ -92,14 +92,14 @@ class BatchedTridiagonalSolver void setup() { // Create local copies for lambda capture - int matrix_dimension = matrix_dimension_; - HostVector main_diagonal = main_diagonal_; - HostVector sub_diagonal = sub_diagonal_; - HostVector gamma = gamma_; + int matrix_dimension = matrix_dimension_; + 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."); @@ -162,15 +162,15 @@ 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_; - HostVector main_diagonal = main_diagonal_; - HostVector sub_diagonal = sub_diagonal_; - HostVector buffer = buffer_; - HostVector gamma = gamma_; + int matrix_dimension = matrix_dimension_; + 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."); @@ -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_; - HostVector main_diagonal = main_diagonal_; - HostVector gamma = gamma_; + 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 // @@ -288,7 +287,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 +309,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/include/LinearAlgebra/Vector/vector.h b/include/LinearAlgebra/Vector/vector.h index da651bf6a..78c822307 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/include/PolarGrid/polargrid.h b/include/PolarGrid/polargrid.h index 4ef775f05..17278ba32 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, @@ -42,6 +44,26 @@ 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; + // 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; @@ -84,19 +106,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 +135,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 +154,25 @@ 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, - 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; + +#ifdef KOKKOS_ENABLE_CUDA +template class PolarGrid; +#endif + // ---------------------------------------------------- // // 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 old mode 100755 new mode 100644 index 67b618425..d19bf5880 --- a/include/PolarGrid/polargrid.inl +++ b/include/PolarGrid/polargrid.inl @@ -4,73 +4,106 @@ #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 +121,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 +135,9 @@ 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/include/Residual/ResidualGive/applyAGive.inl b/include/Residual/ResidualGive/applyAGive.inl index 190cfec0a..0e2a4526d 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,13 +195,16 @@ 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 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; @@ -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); @@ -252,8 +255,7 @@ void ResidualGive::applySystemOperator(HostVector result 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++) { @@ -262,4 +264,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 d03bae229..cdbaa0f5e 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 90d7aa05d..f6680d4ee 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) : Residual(grid, level_cache, DirBC_Interior) { @@ -10,19 +10,24 @@ ResidualGive::ResidualGive(const PolarGrid& grid, const LevelCac /* ------------------ */ /* 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(); 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(); + + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/ResidualTake/applyATake.inl b/include/Residual/ResidualTake/applyATake.inl index 5ed9c217e..5e4d96655 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, 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 +64,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_; - const bool DirBC_Interior = Residual::DirBC_Interior_; + 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 +91,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 +103,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 +113,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 172da0581..8af3bd9f4 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 fe31ff60c..8f598d677 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) : Residual(grid, level_cache, DirBC_Interior) { @@ -10,19 +10,24 @@ ResidualTake::ResidualTake(const PolarGrid& grid, const LevelCac /* ------------------ */ /* 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(); 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(); + + Kokkos::deep_copy(h_result, result); } diff --git a/include/Residual/residual.h b/include/Residual/residual.h index 329c999dc..fcb04d009 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) @@ -31,7 +32,7 @@ class Residual protected: /* ------------------- */ /* Constructor members */ - const PolarGrid grid_; + const PolarGrid grid_; const LevelCacheType level_cache_; const bool DirBC_Interior_; }; diff --git a/include/Smoother/SmootherGive/applyAscOrtho.inl b/include/Smoother/SmootherGive/applyAscOrtho.inl index 8af47fa8d..095cf60af 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& grid, c template 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& grid, template 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& grid, c template 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& grid, } // namespace smoother_give template -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,9 +239,9 @@ void SmootherGive::applyAscOrthoBlackCircleSection(HostConstVect return (end - start + offset - 1) / offset; }; - 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_; /* ----------------------------------------------- */ /* 1. Black-Circle update (u_bc): */ @@ -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,9 +322,9 @@ void SmootherGive::applyAscOrthoWhiteCircleSection(HostConstVect return (end - start + offset - 1) / offset; }; - 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_; /* ----------------------------------------------- */ /* 2. White-Circle update (u_wc): */ @@ -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,9 +406,9 @@ void SmootherGive::applyAscOrthoBlackRadialSection(HostConstVect return (end - start + offset - 1) / offset; }; - 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_; /* ----------------------------------------------- */ /* 3. Black-Radial update (u_br): */ @@ -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,9 +490,9 @@ void SmootherGive::applyAscOrthoWhiteRadialSection(HostConstVect return (end - start + offset - 1) / offset; }; - 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_; /* ----------------------------------------------- */ /* 4. White-Radial update (u_wr): */ @@ -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 4e867f4de..2e4e0acb6 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& 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, - 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& m 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& template 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(); @@ -272,19 +274,19 @@ SmootherGive::buildInteriorBoundarySolverMatrix() #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); + 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, @@ -295,7 +297,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 55071c6b1..2d0fbdc1b 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_; @@ -530,7 +528,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++) { @@ -555,7 +553,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, @@ -569,7 +567,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/matrixStencil.inl b/include/Smoother/SmootherGive/matrixStencil.inl index 3f7a3d364..78988c521 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 94b485612..6237a14c5 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 @@ -88,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_; @@ -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(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 */ @@ -137,10 +134,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 848833553..6747cc953 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) : Smoother(grid, level_cache, DirBC_Interior) , circle_tridiagonal_solver_(grid.ntheta(), grid.numberSmootherCircles(), true) @@ -41,8 +41,13 @@ SmootherGive::SmootherGive(const PolarGrid& grid, const LevelCac // - 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 +64,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 6485fd0db..038c39c36 100644 --- a/include/Smoother/SmootherGive/solveAscSystem.inl +++ b/include/Smoother/SmootherGive/solveAscSystem.inl @@ -1,13 +1,13 @@ #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 start = 0; - const int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + 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; @@ -18,7 +18,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); } @@ -27,7 +27,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 ), @@ -41,13 +41,13 @@ 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 start = 0; - const int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + 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; @@ -58,7 +58,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); } @@ -67,7 +67,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 ), @@ -81,13 +81,13 @@ 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 start = grid.numberCircularSmootherNodes(); - const int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + const int start = grid.numberCircularSmootherNodes(); + const int end = grid.numberOfNodes(); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve const int batch_offset = 0; @@ -100,7 +100,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 ), @@ -114,13 +114,13 @@ 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 start = grid.numberCircularSmootherNodes(); - const int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + const int start = grid.numberCircularSmootherNodes(); + const int end = grid.numberOfNodes(); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve const int batch_offset = 1; @@ -133,7 +133,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 d70542cd5..3843e95ef 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,10 @@ 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, - 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 +117,23 @@ nodeApplyAscOrthoRadialTake(const int i_r, const int i_theta, const PolarGrid& g } // namespace smoother_take template -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 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()); - 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 +141,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 +156,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 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()); - 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 +180,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 +195,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 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()); - 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 +219,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 +234,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 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()); - 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 +258,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 d0ef443d6..024231513 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& 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, - 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); @@ -28,10 +26,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,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(); @@ -161,27 +159,27 @@ SmootherTake::buildInteriorBoundarySolverMatrix() #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); + 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 02fe8020d..b9a794c0f 100644 --- a/include/Smoother/SmootherTake/buildTridiagonalAsc.inl +++ b/include/Smoother/SmootherTake/buildTridiagonalAsc.inl @@ -15,12 +15,11 @@ 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 +189,18 @@ 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()); - 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 +211,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 +224,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/matrixStencil.inl b/include/Smoother/SmootherTake/matrixStencil.inl index eba7692f1..98400cde4 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 00f87450b..47ae4c1b5 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; @@ -88,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_; @@ -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(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 */ @@ -137,10 +134,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 2f6cbd483..349a2bf1e 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) : Smoother(grid, level_cache, DirBC_Interior) , circle_tridiagonal_solver_(grid.ntheta(), grid.numberSmootherCircles(), true) @@ -41,8 +41,13 @@ SmootherTake::SmootherTake(const PolarGrid& grid, const LevelCac // - 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 +62,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 1516dfe7c..9740f9d03 100644 --- a/include/Smoother/SmootherTake/solveAscSystem.inl +++ b/include/Smoother/SmootherTake/solveAscSystem.inl @@ -1,13 +1,13 @@ #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_; - int start = 0; - int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + 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; @@ -18,7 +18,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); } @@ -27,7 +27,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 ), @@ -41,13 +41,13 @@ 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_; - int start = 0; - int end = grid.numberCircularSmootherNodes(); - HostVector circle_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + 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; @@ -58,7 +58,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); } @@ -67,7 +67,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 ), @@ -81,13 +81,13 @@ 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_; - int start = grid.numberCircularSmootherNodes(); - int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve const int batch_offset = 0; @@ -100,7 +100,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 ), @@ -114,13 +114,13 @@ 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_; - int start = grid.numberCircularSmootherNodes(); - int end = grid.numberOfNodes(); - HostVector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); + int start = grid.numberCircularSmootherNodes(); + int end = grid.numberOfNodes(); + Vector radial_section = Kokkos::subview(temp, Kokkos::make_pair(start, end)); // Tridiagonal Solve const int batch_offset = 1; @@ -133,7 +133,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 44e91e055..41e2e0171 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) : grid_(grid) , level_cache_(level_cache) , DirBC_Interior_(DirBC_Interior) @@ -39,7 +39,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_; }; diff --git a/src/ConfigParser/config_parser.cpp b/src/ConfigParser/config_parser.cpp index 61f0e91e5..5dc991b2f 100644 --- a/src/ConfigParser/config_parser.cpp +++ b/src/ConfigParser/config_parser.cpp @@ -233,10 +233,11 @@ 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); @@ -315,7 +316,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"; @@ -352,7 +353,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 a594fee31..3df4396e1 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 078be2276..378c0ca0f 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 18ecf5375..8b4641020 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 f13acfbf6..e10225a1b 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 fb9ea5ed0..5e769e391 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 1e5035494..c611cfadb 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_SonnendruckerGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_SonnendruckerGyro_CzarnyGeometry.cpp index 2c944f3e2..775a4b9e8 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 5e07d9003..d056302f8 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 f62c03669..4fc1c6f30 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 a163fc2fc..f8dd98ee2 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 69f7f6707..7063001fe 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 c642b64b6..0633e669c 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 11816c865..a8e2ecfd3 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 e0853383f..37f7c2bb4 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 d78f453a3..ccbbb8393 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_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_ZoniShiftedGyro_CzarnyGeometry.cpp index 417e2c904..794a4003c 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 c38ba92c3..1056e53ef 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 4c11bafbf..a11fdbfac 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 7609921ae..7e054a594 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 2a276afce..c3c9bb76f 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 7d2e0fc00..aaa7d4e81 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_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR2_Zoni_CzarnyGeometry.cpp index c2695e82e..8dd52b66d 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 c6963ac14..fc7f2aa20 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 6e1dc04c3..692b7da33 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 2880819bb..ee65fe53e 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 29122364b..d466d42f6 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 4fdea4565..0b9322b13 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_SonnendruckerGyro_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_SonnendruckerGyro_CzarnyGeometry.cpp index bf6dd4313..1bfbf0f2c 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 002eac6ab..b1b3c23ce 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 9f5745cc9..29e1b8066 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 f287bbfee..75232b68d 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 d88a2d92d..98d0a94de 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 f1778de2c..3ec6a94e5 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 99d944d8b..78df10bff 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 15c54a25f..7b752a156 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 5968c4412..45d6178cc 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_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_ZoniShiftedGyro_CzarnyGeometry.cpp index 11c4d5b18..229ee9671 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 32a678dde..a32ec7c7a 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 13039c048..32068308b 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 89a73c06f..4f1d57fa1 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 9d6cd55b8..8a221a4e1 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 d726167dc..dd3fd3cda 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_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/cartesianR6_Zoni_CzarnyGeometry.cpp index 20d398d69..5dea24187 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 bd532b0d1..0d5ca758b 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 c85512e5f..d23e94e9c 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_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Poisson_CzarnyGeometry.cpp index 2593536b8..342cb5dbc 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 8efb94fea..4cf307566 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 32fd76cc6..7f480aa19 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 3e269be5a..ac41f0807 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 91f4db77e..e9acecd3b 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 cfce97c3e..383a52281 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 a8bdd7fb4..61087b7ba 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 79447786e..5d76a1682 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 7f6a521c8..e0a5c7ab5 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_CzarnyGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_ZoniGyro_CzarnyGeometry.cpp index 944a1e078..c7ec3ca34 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 184856ef6..4ebb9ea0d 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 03852ee4e..1972fff3d 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 54ee03b78..00a78b55a 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 c8234684f..d123f4686 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 1d17147ce..15f201913 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 76732c687..a84b4db7e 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 2cf4e8026..6afadd19a 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 4f578832d..c40b90195 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/polarR6_Zoni_CircularGeometry.cpp b/src/InputFunctions/SourceTerms/polarR6_Zoni_CircularGeometry.cpp index 6ba73527d..2729ebe73 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 6a768a03f..670a1060f 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 f886ec010..13fae9caa 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 a5446f842..326505463 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 2d0b4ee17..12fecae96 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 1b99baa98..e3c9188ff 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 a87fea3b1..0f58ee1c9 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 9bc5ac8be..9b001dee1 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,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 d0e444bab..47e59b4fc 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,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 2a8ec980f..408150ab4 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 5c9cb48dd..1895ee949 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 f19aa9424..b630a60c8 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 7423a9326..98d1d7396 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 cbb96d70e..855c0c89c 100644 --- a/src/PolarGrid/anisotropic_division.cpp +++ b/src/PolarGrid/anisotropic_division.cpp @@ -1,8 +1,10 @@ #include "../../include/PolarGrid/polargrid.h" using namespace gmgpolar; -HostVector 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); @@ -26,7 +28,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 +92,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 b55b48524..956e07a83 100644 --- a/src/PolarGrid/polargrid.cpp +++ b/src/PolarGrid/polargrid.cpp @@ -6,24 +6,9 @@ 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,8 +34,10 @@ 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, - 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_ @@ -71,18 +58,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, - const int anisotropic_factor) +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 +82,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 +93,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 +117,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 +127,14 @@ 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 +148,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 +173,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 +235,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); @@ -260,20 +255,27 @@ 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); +#ifdef KOKKOS_ENABLE_CUDA +template PolarGrid coarseningGrid(const PolarGrid& grid); +#endif + } // namespace gmgpolar // ------------------------ // // 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); diff --git a/src/convergence_order.cpp b/src/convergence_order.cpp index 3a85b3d2a..6540636bd 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 d61e411f1..ae354e5df 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 99dde6b08..62512c63c 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/ConfigParser/config_parser.cpp b/tests/ConfigParser/config_parser.cpp index 133213df2..31b1f7a1c 100644 --- a/tests/ConfigParser/config_parser.cpp +++ b/tests/ConfigParser/config_parser.cpp @@ -169,7 +169,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 3d9f85da4..d2fa0b5ab 100644 --- a/tests/DirectSolver/directSolver.cpp +++ b/tests/DirectSolver/directSolver.cpp @@ -62,7 +62,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), @@ -111,7 +111,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), @@ -162,7 +162,7 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverDirBC_Interior_CircularGeome 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), @@ -203,7 +203,7 @@ TEST(DirectSolverTest_CircularGeometry, DirectSolverAcrossOrigin_CircularGeometr 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), @@ -250,7 +250,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), @@ -293,7 +293,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), @@ -340,7 +340,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), @@ -383,7 +383,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), @@ -428,7 +428,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), @@ -469,7 +469,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), @@ -491,7 +491,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) { @@ -522,7 +522,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), @@ -563,7 +563,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), @@ -605,7 +605,7 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverDirBC_Interior_CircularG 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), @@ -646,7 +646,7 @@ TEST(DirectSolverTakeTest_CircularGeometry, DirectSolverAcrossOrigin_CircularGeo 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), @@ -693,7 +693,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), @@ -736,7 +736,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), @@ -783,7 +783,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), @@ -826,7 +826,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), @@ -871,7 +871,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), @@ -912,7 +912,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), @@ -963,7 +963,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), @@ -1004,7 +1004,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 65fbb22f5..300630869 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; @@ -98,7 +98,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; @@ -157,7 +157,7 @@ TEST(ExtrapolatedSmootherTest, ExtrapolatedSmootherDirBC_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; @@ -238,7 +238,7 @@ TEST(ExtrapolatedSmootherTest, ExtrapolatedSmootherAcrossOrigin) 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; @@ -320,7 +320,7 @@ TEST(ExtrapolatedSmootherTest, ExtrapolatedSmootherDirBC_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; @@ -402,7 +402,7 @@ TEST(ExtrapolatedSmootherTest, ExtrapolatedSmootherAcrossOrigin_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; @@ -485,7 +485,7 @@ TEST(ExtrapolatedSmootherTest, ExtrapolatedSmootherTakeDirBC_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; @@ -566,7 +566,7 @@ TEST(ExtrapolatedSmootherTest, ExtrapolatedSmootherTakeAcrossOrigin) 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; @@ -646,7 +646,7 @@ TEST(ExtrapolatedSmootherTest, ExtrapolatedSmootherTakeDirBC_Interior_SmallestGr 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; @@ -726,7 +726,7 @@ TEST(ExtrapolatedSmootherTest, ExtrapolatedSmootherTakeAcrossOrigin_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/GMGPolar/convergence_order.cpp b/tests/GMGPolar/convergence_order.cpp index ec60381f5..1d6a06fda 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) { @@ -224,8 +224,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 7c4a3d601..cf58fa2f3 100644 --- a/tests/GMGPolar/pcg_tests.cpp +++ b/tests/GMGPolar/pcg_tests.cpp @@ -630,8 +630,9 @@ TYPED_TEST_SUITE(PCGTestCase, gmgpolar_test_suite); template void run_gmgpolar() { - PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, - TestFixture::refinementRadius, TestFixture::anisotropicFactor, TestFixture::divideBy2); + PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, + TestFixture::refinementRadius, TestFixture::anisotropicFactor, + TestFixture::divideBy2); const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; @@ -687,8 +688,8 @@ void run_gmgpolar() solver.solve(boundary_conditions, source_term); // --- Retrieve solution and associated grid --- // - HostVector solution = solver.solution(); - const PolarGrid& solution_grid = solver.grid(); + HostVector solution = solver.solution(); + 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 0451938f9..632b22638 100644 --- a/tests/GMGPolar/solve_tests.cpp +++ b/tests/GMGPolar/solve_tests.cpp @@ -639,8 +639,9 @@ TYPED_TEST_SUITE(GMGPolarTestCase, gmgpolar_test_suite); template void run_gmgpolar() { - PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, - TestFixture::refinementRadius, TestFixture::anisotropicFactor, TestFixture::divideBy2); + PolarGrid grid(TestFixture::R0, TestFixture::Rmax, TestFixture::nrExp, TestFixture::nthetaExp, + TestFixture::refinementRadius, TestFixture::anisotropicFactor, + TestFixture::divideBy2); const double inverse_aspect_ratio_epsilon = 0.3; const double ellipticity_e = 1.4; @@ -690,8 +691,8 @@ void run_gmgpolar() solver.solve(boundary_conditions, source_term); // --- Retrieve solution and associated grid --- // - HostVector solution = solver.solution(); - const PolarGrid& solution_grid = solver.grid(); + HostVector solution = solver.solution(); + 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 edcc6aaa1..47195d9a9 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; @@ -46,8 +47,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(/*DirBC*/ true); diff --git a/tests/Interpolation/extrapolated_restriction.cpp b/tests/Interpolation/extrapolated_restriction.cpp index b73d168d0..403b4b3b4 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) { @@ -45,8 +46,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(/*DirBC*/ true); diff --git a/tests/Interpolation/prolongation.cpp b/tests/Interpolation/prolongation.cpp index 419942c11..a9018f1b2 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; @@ -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(/*DirBC*/ true); diff --git a/tests/Interpolation/restriction.cpp b/tests/Interpolation/restriction.cpp index 27bebfcc6..29821ff18 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; @@ -56,8 +57,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(/*DirBC*/ true); diff --git a/tests/LinearAlgebra/Solvers/csr_lu_solver.cpp b/tests/LinearAlgebra/Solvers/csr_lu_solver.cpp index 355c2b9ea..1ed0b88ca 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); diff --git a/tests/LinearAlgebra/Solvers/tridiagonal_solver.cpp b/tests/LinearAlgebra/Solvers/tridiagonal_solver.cpp index 9482632cc..6ac5f2f19 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(); } diff --git a/tests/PolarGrid/polargrid.cpp b/tests/PolarGrid/polargrid.cpp index 37819c0f5..cdf5b9014 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 b3c65d8c5..42ca46680 100644 --- a/tests/Residual/residual.cpp +++ b/tests/Residual/residual.cpp @@ -46,7 +46,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), @@ -98,7 +98,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 d911dcd87..452107925 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, SmootherDirBC_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, SmootherAcrossOrigin) 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; @@ -306,7 +306,7 @@ TEST(SmootherTest, SmootherDirBC_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; @@ -380,7 +380,7 @@ TEST(SmootherTest, SmootherAcrossOrigin_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; @@ -457,7 +457,7 @@ TEST(SmootherTest, SmootherTakeDirBC_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; @@ -532,7 +532,7 @@ TEST(SmootherTest, SmootherTakeAcrossOrigin) 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; @@ -606,7 +606,7 @@ TEST(SmootherTest, SmootherTakeDirBC_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; @@ -680,7 +680,7 @@ TEST(SmootherTest, SmootherTakeAcrossOrigin_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 963753888..b43713327 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);