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 @@ -9,8 +9,7 @@ class DirectSolver_COO_MUMPS_Give : public DirectSolver<DomainGeometry>
{
public:
explicit DirectSolver_COO_MUMPS_Give(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry, bool DirBC_Interior,
int num_omp_threads);
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 @@ -5,9 +5,8 @@
template <concepts::DomainGeometry DomainGeometry>
DirectSolver_COO_MUMPS_Give<DomainGeometry>::DirectSolver_COO_MUMPS_Give(const PolarGrid& grid,
const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry,
bool DirBC_Interior, int num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, domain_geometry, DirBC_Interior, num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, DirBC_Interior, num_omp_threads)
, mumps_solver_(buildSolverMatrix())
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class DirectSolver_COO_MUMPS_Take : public DirectSolver<DomainGeometry>
{
public:
explicit DirectSolver_COO_MUMPS_Take(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry, bool DirBC_Interior,
int num_omp_threads);
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 @@ -5,9 +5,8 @@
template <concepts::DomainGeometry DomainGeometry>
DirectSolver_COO_MUMPS_Take<DomainGeometry>::DirectSolver_COO_MUMPS_Take(const PolarGrid& grid,
const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry,
bool DirBC_Interior, int num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, domain_geometry, DirBC_Interior, num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, DirBC_Interior, num_omp_threads)
, mumps_solver_(buildSolverMatrix())
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
template <concepts::DomainGeometry DomainGeometry>
DirectSolver_CSR_LU_Give<DomainGeometry>::DirectSolver_CSR_LU_Give(const PolarGrid& grid,
const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry,
bool DirBC_Interior, int num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, domain_geometry, DirBC_Interior, num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, DirBC_Interior, num_omp_threads)
{
solver_matrix_ = buildSolverMatrix();
lu_solver_ = SparseLUSolver<double>(solver_matrix_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class DirectSolver_CSR_LU_Give : public DirectSolver<DomainGeometry>
{
public:
explicit DirectSolver_CSR_LU_Give(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry, bool DirBC_Interior, int num_omp_threads);
bool DirBC_Interior, int num_omp_threads);

// Note: The rhs (right-hand side) vector gets overwritten with the solution.
void solveInPlace(Vector<double> solution) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
template <concepts::DomainGeometry DomainGeometry>
DirectSolver_CSR_LU_Take<DomainGeometry>::DirectSolver_CSR_LU_Take(const PolarGrid& grid,
const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry,
bool DirBC_Interior, int num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, domain_geometry, DirBC_Interior, num_omp_threads)
: DirectSolver<DomainGeometry>(grid, level_cache, DirBC_Interior, num_omp_threads)
{
solver_matrix_ = buildSolverMatrix();
lu_solver_ = SparseLUSolver<double>(solver_matrix_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class DirectSolver_CSR_LU_Take : public DirectSolver<DomainGeometry>
{
public:
explicit DirectSolver_CSR_LU_Take(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry, bool DirBC_Interior, int num_omp_threads);
bool DirBC_Interior, int num_omp_threads);

// Note: The rhs (right-hand side) vector gets overwritten with the solution.
void solveInPlace(Vector<double> solution) override;
Expand Down
6 changes: 2 additions & 4 deletions include/DirectSolver/directSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ template <concepts::DomainGeometry DomainGeometry>
class DirectSolver
{
public:
explicit DirectSolver(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry, bool DirBC_Interior, int num_omp_threads)
explicit DirectSolver(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache, bool DirBC_Interior,
int num_omp_threads)
: grid_(grid)
, level_cache_(level_cache)
, domain_geometry_(domain_geometry)
, DirBC_Interior_(DirBC_Interior)
, num_omp_threads_(num_omp_threads)
{
Expand All @@ -49,7 +48,6 @@ class DirectSolver
protected:
const PolarGrid& grid_;
const LevelCache<DomainGeometry>& level_cache_;
const DomainGeometry& domain_geometry_;
const bool DirBC_Interior_;
const int num_omp_threads_;
};
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ExtrapolatedSmootherGive : public ExtrapolatedSmoother<DomainGeometry>
// Constructs the coupled circle-radial extrapolated smoother.
// Builds the A_sc smoother matrices and prepares the solvers.
explicit ExtrapolatedSmootherGive(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry, bool DirBC_Interior, int num_omp_threads);
bool DirBC_Interior, int num_omp_threads);

// If MUMPS is enabled, this cleans up the inner boundary solver.
~ExtrapolatedSmootherGive() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
template <concepts::DomainGeometry DomainGeometry>
ExtrapolatedSmootherGive<DomainGeometry>::ExtrapolatedSmootherGive(const PolarGrid& grid,
const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry,
const bool DirBC_Interior, const int num_omp_threads)
: ExtrapolatedSmoother<DomainGeometry>(grid, level_cache, domain_geometry, DirBC_Interior, num_omp_threads)
: ExtrapolatedSmoother<DomainGeometry>(grid, level_cache, DirBC_Interior, num_omp_threads)
, circle_tridiagonal_solver_(grid.ntheta(), grid.numberSmootherCircles(), true)
, radial_tridiagonal_solver_(grid.lengthSmootherRadial(), grid.ntheta(), false)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ExtrapolatedSmootherTake : public ExtrapolatedSmoother<DomainGeometry>
// Constructs the coupled circle-radial extrapolated smoother.
// Builds the A_sc smoother matrices and prepares the solvers.
explicit ExtrapolatedSmootherTake(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry, bool DirBC_Interior, int num_omp_threads);
bool DirBC_Interior, int num_omp_threads);

// Performs one full coupled extrapolated smoothing sweep:
// BC -> WC -> BR -> WR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
template <concepts::DomainGeometry DomainGeometry>
ExtrapolatedSmootherTake<DomainGeometry>::ExtrapolatedSmootherTake(const PolarGrid& grid,
const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry,
const bool DirBC_Interior, const int num_omp_threads)
: ExtrapolatedSmoother<DomainGeometry>(grid, level_cache, domain_geometry, DirBC_Interior, num_omp_threads)
: ExtrapolatedSmoother<DomainGeometry>(grid, level_cache, DirBC_Interior, num_omp_threads)
, circle_tridiagonal_solver_(grid.ntheta(), grid.numberSmootherCircles(), true)
, radial_tridiagonal_solver_(grid.lengthSmootherRadial(), grid.ntheta(), false)
#ifdef GMGPOLAR_USE_MUMPS
Expand Down
4 changes: 1 addition & 3 deletions include/ExtrapolatedSmoother/extrapolatedSmoother.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ class ExtrapolatedSmoother
{
public:
explicit ExtrapolatedSmoother(const PolarGrid& grid, const LevelCache<DomainGeometry>& level_cache,
const DomainGeometry& domain_geometry, bool DirBC_Interior, int num_omp_threads)
bool DirBC_Interior, int num_omp_threads)
: grid_(grid)
, level_cache_(level_cache)
, domain_geometry_(domain_geometry)
, DirBC_Interior_(DirBC_Interior)
, num_omp_threads_(num_omp_threads)
{
Expand All @@ -50,7 +49,6 @@ class ExtrapolatedSmoother
protected:
const PolarGrid& grid_;
const LevelCache<DomainGeometry>& level_cache_;
const DomainGeometry& domain_geometry_;
const bool DirBC_Interior_;
const int num_omp_threads_;
};
14 changes: 5 additions & 9 deletions include/GMGPolar/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,14 @@ void GMGPolar<DomainGeometry, DensityProfileCoefficients>::setup()
// Define residual operator on all multigrid levels //
// ------------------------------------------------ //
for (int level_depth = 0; level_depth < number_of_levels_; level_depth++) {
levels_[level_depth].initializeResidual(domain_geometry_, DirBC_Interior_, max_omp_threads_,
stencil_distribution_method_);
levels_[level_depth].initializeResidual(DirBC_Interior_, max_omp_threads_, stencil_distribution_method_);
}

// ----------------------------------------- //
// Build direct solver on the coarsest level //
// ----------------------------------------- //
auto start_setup_directSolver = std::chrono::high_resolution_clock::now();
levels_[number_of_levels_ - 1].initializeDirectSolver(domain_geometry_, DirBC_Interior_, max_omp_threads_,
levels_[number_of_levels_ - 1].initializeDirectSolver(DirBC_Interior_, max_omp_threads_,
stencil_distribution_method_);
auto end_setup_directSolver = std::chrono::high_resolution_clock::now();
t_setup_directSolver_ += std::chrono::duration<double>(end_setup_directSolver - start_setup_directSolver).count();
Expand Down Expand Up @@ -145,17 +144,14 @@ void GMGPolar<DomainGeometry, DensityProfileCoefficients>::setup()
if (number_of_levels_ > 1) {
// PCG uses non-extrapolated smoothing on level 0, so we need to initialize it if PCG is enabled.
if (do_full_grid_smoothing || (PCG_ && PCG_MG_iterations_ > 0)) {
levels_[0].initializeSmoothing(domain_geometry_, DirBC_Interior_, max_omp_threads_,
stencil_distribution_method_);
levels_[0].initializeSmoothing(DirBC_Interior_, max_omp_threads_, stencil_distribution_method_);
}
// PCG doesn't use extrapolated smoothing, so we only initialize it if PCG is disabled.
if (do_extrapolated_smoothing && !PCG_) {
levels_[0].initializeExtrapolatedSmoothing(domain_geometry_, DirBC_Interior_, max_omp_threads_,
stencil_distribution_method_);
levels_[0].initializeExtrapolatedSmoothing(DirBC_Interior_, max_omp_threads_, stencil_distribution_method_);
}
for (int level_depth = 1; level_depth < number_of_levels_ - 1; level_depth++) {
levels_[level_depth].initializeSmoothing(domain_geometry_, DirBC_Interior_, max_omp_threads_,
stencil_distribution_method_);
levels_[level_depth].initializeSmoothing(DirBC_Interior_, max_omp_threads_, stencil_distribution_method_);
}
}
auto end_setup_smoother = std::chrono::high_resolution_clock::now();
Expand Down
13 changes: 6 additions & 7 deletions include/Level/level.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,27 @@ class Level

// -------------- //
// Apply Residual //
void initializeResidual(const DomainGeometry& domain_geometry, const bool DirBC_Interior, const int num_omp_threads,
void initializeResidual(const bool DirBC_Interior, const int num_omp_threads,
const StencilDistributionMethod stencil_distribution_method);
void computeResidual(Vector<double> result, ConstVector<double> rhs, ConstVector<double> x) const;
void applySystemOperator(Vector<double> result, ConstVector<double> x) const;

// ------------------- //
// Solve coarse System //
void initializeDirectSolver(const DomainGeometry& domain_geometry, const bool DirBC_Interior,
const int num_omp_threads, const StencilDistributionMethod stencil_distribution_method);
void initializeDirectSolver(const bool DirBC_Interior, const int num_omp_threads,
const StencilDistributionMethod stencil_distribution_method);
// Note: The rhs (right-hand side) vector gets overwritten by the solution.
void directSolveInPlace(Vector<double> x) const;

// --------------- //
// Apply Smoothing //
void initializeSmoothing(const DomainGeometry& domain_geometry, const bool DirBC_Interior,
const int num_omp_threads, const StencilDistributionMethod stencil_distribution_method);
void initializeSmoothing(const bool DirBC_Interior, const int num_omp_threads,
const StencilDistributionMethod stencil_distribution_method);
void smoothing(Vector<double> x, ConstVector<double> rhs, Vector<double> temp) const;

// ---------------------------- //
// Apply Extrapolated Smoothing //
void initializeExtrapolatedSmoothing(const DomainGeometry& domain_geometry, const bool DirBC_Interior,
const int num_omp_threads,
void initializeExtrapolatedSmoothing(const bool DirBC_Interior, const int num_omp_threads,
const StencilDistributionMethod stencil_distribution_method);
void extrapolatedSmoothing(Vector<double> x, ConstVector<double> rhs, Vector<double> temp) const;

Expand Down
Loading
Loading