Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* Boundary Symmetry Shift */
/* ----------------------- */

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Give<DomainGeometry>::applySymmetryShiftInnerBoundary(Vector<double> x) const
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Give<LevelCacheType>::applySymmetryShiftInnerBoundary(Vector<double> x) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const LevelCache<DomainGeometry>& level_cache = DirectSolver<DomainGeometry>::level_cache_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const LevelCacheType& level_cache = DirectSolver<LevelCacheType>::level_cache_;

assert(DirectSolver<DomainGeometry>::DirBC_Interior_);
assert(DirectSolver<LevelCacheType>::DirBC_Interior_);

int i_r;
double r;
Expand Down Expand Up @@ -67,11 +67,11 @@ void DirectSolver_COO_MUMPS_Give<DomainGeometry>::applySymmetryShiftInnerBoundar
}
}

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Give<DomainGeometry>::applySymmetryShiftOuterBoundary(Vector<double> x) const
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Give<LevelCacheType>::applySymmetryShiftOuterBoundary(Vector<double> x) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const LevelCache<DomainGeometry>& level_cache = DirectSolver<DomainGeometry>::level_cache_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const LevelCacheType& level_cache = DirectSolver<LevelCacheType>::level_cache_;

int i_r;
double r;
Expand Down Expand Up @@ -126,11 +126,11 @@ void DirectSolver_COO_MUMPS_Give<DomainGeometry>::applySymmetryShiftOuterBoundar
}
}

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Give<DomainGeometry>::applySymmetryShift(Vector<double> x) const
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Give<LevelCacheType>::applySymmetryShift(Vector<double> x) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

assert(std::ssize(x) == grid.numberOfNodes());
assert(grid.nr() >= 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ static inline void updateMatrixElement(SparseMatrixCOO<double>& matrix, int ptr,

} // namespace direct_solver_coo_mumps_give

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Give<DomainGeometry>::nodeBuildSolverMatrixGive(int i_r, int i_theta, const PolarGrid& grid,
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Give<LevelCacheType>::nodeBuildSolverMatrixGive(int i_r, int i_theta, const PolarGrid& grid,
bool DirBC_Interior,
SparseMatrixCOO<double>& solver_matrix,
double arr, double att, double art,
Expand Down Expand Up @@ -779,13 +779,13 @@ void DirectSolver_COO_MUMPS_Give<DomainGeometry>::nodeBuildSolverMatrixGive(int
}
}

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Give<DomainGeometry>::buildSolverMatrixCircleSection(const int i_r,
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Give<LevelCacheType>::buildSolverMatrixCircleSection(const int i_r,
SparseMatrixCOO<double>& solver_matrix)
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const LevelCache<DomainGeometry>& level_cache = DirectSolver<DomainGeometry>::level_cache_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const LevelCacheType& level_cache = DirectSolver<LevelCacheType>::level_cache_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

const double r = grid.radius(i_r);
for (int i_theta = 0; i_theta < grid.ntheta(); i_theta++) {
Expand All @@ -800,13 +800,13 @@ void DirectSolver_COO_MUMPS_Give<DomainGeometry>::buildSolverMatrixCircleSection
}
}

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Give<DomainGeometry>::buildSolverMatrixRadialSection(const int i_theta,
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Give<LevelCacheType>::buildSolverMatrixRadialSection(const int i_theta,
SparseMatrixCOO<double>& solver_matrix)
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const LevelCache<DomainGeometry>& level_cache = DirectSolver<DomainGeometry>::level_cache_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const LevelCacheType& level_cache = DirectSolver<LevelCacheType>::level_cache_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

const double theta = grid.theta(i_theta);
for (int i_r = grid.numberSmootherCircles(); i_r < grid.nr(); i_r++) {
Expand All @@ -821,11 +821,11 @@ void DirectSolver_COO_MUMPS_Give<DomainGeometry>::buildSolverMatrixRadialSection
}
}

template <concepts::DomainGeometry DomainGeometry>
SparseMatrixCOO<double> DirectSolver_COO_MUMPS_Give<DomainGeometry>::buildSolverMatrix()
template <class LevelCacheType>
SparseMatrixCOO<double> DirectSolver_COO_MUMPS_Give<LevelCacheType>::buildSolverMatrix()
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const int num_omp_threads = DirectSolver<DomainGeometry>::num_omp_threads_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const int num_omp_threads = DirectSolver<LevelCacheType>::num_omp_threads_;

const int n = grid.numberOfNodes();
const int nnz = getNonZeroCountSolverMatrix();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#ifdef GMGPOLAR_USE_MUMPS

template <concepts::DomainGeometry DomainGeometry>
class DirectSolver_COO_MUMPS_Give : public DirectSolver<DomainGeometry>
template <class LevelCacheType>
class DirectSolver_COO_MUMPS_Give : public DirectSolver<LevelCacheType>
{
public:
explicit DirectSolver_COO_MUMPS_Give(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
bool DirBC_Interior, int num_omp_threads);
explicit DirectSolver_COO_MUMPS_Give(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior,
int num_omp_threads);

// Note: The rhs (right-hand side) vector gets overwritten during the solution process.
void solveInPlace(Vector<double> solution) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

#ifdef GMGPOLAR_USE_MUMPS

template <concepts::DomainGeometry DomainGeometry>
DirectSolver_COO_MUMPS_Give<DomainGeometry>::DirectSolver_COO_MUMPS_Give(const PolarGrid& grid,
const LevelCache<DomainGeometry>& level_cache,
template <class LevelCacheType>
DirectSolver_COO_MUMPS_Give<LevelCacheType>::DirectSolver_COO_MUMPS_Give(const PolarGrid& grid,
const LevelCacheType& level_cache,
bool DirBC_Interior, int num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, DirBC_Interior, num_omp_threads)
: DirectSolver<LevelCacheType>(grid, level_cache, DirBC_Interior, num_omp_threads)
, mumps_solver_(buildSolverMatrix())
{
}

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Give<DomainGeometry>::solveInPlace(Vector<double> solution)
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Give<LevelCacheType>::solveInPlace(Vector<double> solution)
{
// Adjusts the right-hand side vector to account for symmetry corrections.
// This transforms the system matrixA * solution = rhs into the equivalent system:
Expand Down
24 changes: 12 additions & 12 deletions include/DirectSolver/DirectSolver-COO-MUMPS-Give/matrixStencil.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#ifdef GMGPOLAR_USE_MUMPS

template <concepts::DomainGeometry DomainGeometry>
const Stencil& DirectSolver_COO_MUMPS_Give<DomainGeometry>::getStencil(int i_r) const
template <class LevelCacheType>
const Stencil& DirectSolver_COO_MUMPS_Give<LevelCacheType>::getStencil(int i_r) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

assert(0 <= i_r && i_r < grid.nr());
assert(grid.nr() >= 4);
Expand All @@ -29,11 +29,11 @@ const Stencil& DirectSolver_COO_MUMPS_Give<DomainGeometry>::getStencil(int i_r)
throw std::out_of_range("Invalid index for stencil");
}

template <concepts::DomainGeometry DomainGeometry>
int DirectSolver_COO_MUMPS_Give<DomainGeometry>::getNonZeroCountSolverMatrix() const
template <class LevelCacheType>
int DirectSolver_COO_MUMPS_Give<LevelCacheType>::getNonZeroCountSolverMatrix() const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7;
const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9;
Expand All @@ -50,11 +50,11 @@ int DirectSolver_COO_MUMPS_Give<DomainGeometry>::getNonZeroCountSolverMatrix() c

/* ----------------------------------------------------------------- */
/* If the indexing is not smoother-based, please adjust the indexing */
template <concepts::DomainGeometry DomainGeometry>
int DirectSolver_COO_MUMPS_Give<DomainGeometry>::getSolverMatrixIndex(const int i_r, const int i_theta) const
template <class LevelCacheType>
int DirectSolver_COO_MUMPS_Give<LevelCacheType>::getSolverMatrixIndex(const int i_r, const int i_theta) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7;
const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
/* Boundary Symmetry Shift */
/* ----------------------- */

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Take<DomainGeometry>::applySymmetryShiftInnerBoundary(Vector<double> x) const
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Take<LevelCacheType>::applySymmetryShiftInnerBoundary(Vector<double> x) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const LevelCache<DomainGeometry>& level_cache = DirectSolver<DomainGeometry>::level_cache_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const LevelCacheType& level_cache = DirectSolver<LevelCacheType>::level_cache_;

assert(DirectSolver<DomainGeometry>::DirBC_Interior_);
assert(DirectSolver<LevelCacheType>::DirBC_Interior_);

assert(level_cache.cacheDensityProfileCoefficients());
assert(level_cache.cacheDomainGeometry());
Expand Down Expand Up @@ -47,11 +47,11 @@ void DirectSolver_COO_MUMPS_Take<DomainGeometry>::applySymmetryShiftInnerBoundar
}
}

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Take<DomainGeometry>::applySymmetryShiftOuterBoundary(Vector<double> x) const
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Take<LevelCacheType>::applySymmetryShiftOuterBoundary(Vector<double> x) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const LevelCache<DomainGeometry>& level_cache = DirectSolver<DomainGeometry>::level_cache_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const LevelCacheType& level_cache = DirectSolver<LevelCacheType>::level_cache_;

assert(level_cache.cacheDensityProfileCoefficients());
assert(level_cache.cacheDomainGeometry());
Expand Down Expand Up @@ -86,11 +86,11 @@ void DirectSolver_COO_MUMPS_Take<DomainGeometry>::applySymmetryShiftOuterBoundar
}
}

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Take<DomainGeometry>::applySymmetryShift(Vector<double> x) const
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Take<LevelCacheType>::applySymmetryShift(Vector<double> x) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

assert(std::ssize(x) == grid.numberOfNodes());
assert(grid.nr() >= 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ static inline void updateMatrixElement(SparseMatrixCOO<double>& matrix, int ptr,

} // namespace direct_solver_coo_mumps_take

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Take<DomainGeometry>::nodeBuildSolverMatrixTake(
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Take<LevelCacheType>::nodeBuildSolverMatrixTake(
int i_r, int i_theta, const PolarGrid& grid, bool DirBC_Interior, SparseMatrixCOO<double>& solver_matrix,
ConstVector<double>& arr, ConstVector<double>& att, ConstVector<double>& art, ConstVector<double>& detDF,
ConstVector<double>& coeff_beta)
Expand Down Expand Up @@ -458,13 +458,13 @@ void DirectSolver_COO_MUMPS_Take<DomainGeometry>::nodeBuildSolverMatrixTake(
}
}

template <concepts::DomainGeometry DomainGeometry>
SparseMatrixCOO<double> DirectSolver_COO_MUMPS_Take<DomainGeometry>::buildSolverMatrix()
template <class LevelCacheType>
SparseMatrixCOO<double> DirectSolver_COO_MUMPS_Take<LevelCacheType>::buildSolverMatrix()
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const LevelCache<DomainGeometry>& level_cache = DirectSolver<DomainGeometry>::level_cache_;
const int num_omp_threads = DirectSolver<DomainGeometry>::num_omp_threads_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const LevelCacheType& level_cache = DirectSolver<LevelCacheType>::level_cache_;
const int num_omp_threads = DirectSolver<LevelCacheType>::num_omp_threads_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

const int n = grid.numberOfNodes();
const int nnz = getNonZeroCountSolverMatrix();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#ifdef GMGPOLAR_USE_MUMPS

template <concepts::DomainGeometry DomainGeometry>
class DirectSolver_COO_MUMPS_Take : public DirectSolver<DomainGeometry>
template <class LevelCacheType>
class DirectSolver_COO_MUMPS_Take : public DirectSolver<LevelCacheType>
{
public:
explicit DirectSolver_COO_MUMPS_Take(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
bool DirBC_Interior, int num_omp_threads);
explicit DirectSolver_COO_MUMPS_Take(const PolarGrid& grid, const LevelCacheType& level_cache, bool DirBC_Interior,
int num_omp_threads);

// Note: The rhs (right-hand side) vector gets overwritten during the solution process.
void solveInPlace(Vector<double> solution) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

#ifdef GMGPOLAR_USE_MUMPS

template <concepts::DomainGeometry DomainGeometry>
DirectSolver_COO_MUMPS_Take<DomainGeometry>::DirectSolver_COO_MUMPS_Take(const PolarGrid& grid,
const LevelCache<DomainGeometry>& level_cache,
template <class LevelCacheType>
DirectSolver_COO_MUMPS_Take<LevelCacheType>::DirectSolver_COO_MUMPS_Take(const PolarGrid& grid,
const LevelCacheType& level_cache,
bool DirBC_Interior, int num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, DirBC_Interior, num_omp_threads)
: DirectSolver<LevelCacheType>(grid, level_cache, DirBC_Interior, num_omp_threads)
, mumps_solver_(buildSolverMatrix())
{
}

template <concepts::DomainGeometry DomainGeometry>
void DirectSolver_COO_MUMPS_Take<DomainGeometry>::solveInPlace(Vector<double> solution)
template <class LevelCacheType>
void DirectSolver_COO_MUMPS_Take<LevelCacheType>::solveInPlace(Vector<double> solution)
{
// Adjusts the right-hand side vector to account for symmetry corrections.
// This transforms the system matrixA * solution = rhs into the equivalent system:
Expand Down
24 changes: 12 additions & 12 deletions include/DirectSolver/DirectSolver-COO-MUMPS-Take/matrixStencil.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#ifdef GMGPOLAR_USE_MUMPS

template <concepts::DomainGeometry DomainGeometry>
const Stencil& DirectSolver_COO_MUMPS_Take<DomainGeometry>::getStencil(int i_r) const
template <class LevelCacheType>
const Stencil& DirectSolver_COO_MUMPS_Take<LevelCacheType>::getStencil(int i_r) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

assert(0 <= i_r && i_r < grid.nr());
assert(grid.nr() >= 4);
Expand All @@ -29,11 +29,11 @@ const Stencil& DirectSolver_COO_MUMPS_Take<DomainGeometry>::getStencil(int i_r)
throw std::out_of_range("Invalid index for stencil");
}

template <concepts::DomainGeometry DomainGeometry>
int DirectSolver_COO_MUMPS_Take<DomainGeometry>::getNonZeroCountSolverMatrix() const
template <class LevelCacheType>
int DirectSolver_COO_MUMPS_Take<LevelCacheType>::getNonZeroCountSolverMatrix() const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7;
const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9;
Expand All @@ -50,11 +50,11 @@ int DirectSolver_COO_MUMPS_Take<DomainGeometry>::getNonZeroCountSolverMatrix() c

/* ----------------------------------------------------------------- */
/* If the indexing is not smoother-based, please adjust the indexing */
template <concepts::DomainGeometry DomainGeometry>
int DirectSolver_COO_MUMPS_Take<DomainGeometry>::getSolverMatrixIndex(const int i_r, const int i_theta) const
template <class LevelCacheType>
int DirectSolver_COO_MUMPS_Take<LevelCacheType>::getSolverMatrixIndex(const int i_r, const int i_theta) const
{
const PolarGrid& grid = DirectSolver<DomainGeometry>::grid_;
const bool DirBC_Interior = DirectSolver<DomainGeometry>::DirBC_Interior_;
const PolarGrid& grid = DirectSolver<LevelCacheType>::grid_;
const bool DirBC_Interior = DirectSolver<LevelCacheType>::DirBC_Interior_;

const int size_stencil_inner_boundary = DirBC_Interior ? 1 : 7;
const int size_stencil_next_inner_boundary = DirBC_Interior ? 6 : 9;
Expand Down
Loading
Loading