Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
533ba9d
Remove 'const' from function parameter types
julianlitz Jan 27, 2026
d0ec50d
Rename function to extrapolated_multigrid_F_Cycle
julianlitz Jan 27, 2026
5417cac
Rename function to extrapolated_multigrid_V_Cycle
julianlitz Jan 27, 2026
5524576
Rename function to extrapolated_multigrid_W_Cycle
julianlitz Jan 27, 2026
7e21035
Fix function signature for multigrid_F_Cycle
julianlitz Jan 27, 2026
a44d83c
Fix function signature for multigrid_V_Cycle
julianlitz Jan 27, 2026
e9d1463
Fix function signature for multigrid_W_Cycle
julianlitz Jan 27, 2026
8b758c8
Remove 'const' from function parameters in level_interpolation
julianlitz Jan 27, 2026
13cbae1
Fix function signature for extrapolatedResidual
julianlitz Jan 27, 2026
90a0d60
Refactor extrapolatedResidual function signature
julianlitz Jan 27, 2026
5f16112
Fix function signature formatting in multigrid_F_Cycle
julianlitz Jan 27, 2026
dde1299
Fix function declaration formatting in multigrid_V_Cycle
julianlitz Jan 27, 2026
4712b62
Fix formatting in multigrid_W_Cycle function
julianlitz Jan 27, 2026
b696979
Fix function declaration syntax in F_Cycle
julianlitz Jan 27, 2026
b9b9d08
Fix function signature for extrapolated_multigrid_V_Cycle
julianlitz Jan 27, 2026
b4fb95b
Fix formatting in extrapolated_multigrid_W_Cycle function
julianlitz Jan 27, 2026
4b1a90a
Rename file
julianlitz Jan 30, 2026
0d65865
Merge branch 'main' into litz_smaller_name
julianlitz Jan 30, 2026
436351a
Replace implicitlyExtrapolated functions with extrapolated
julianlitz Jan 30, 2026
b66c893
Fix method signature for extrapolated_multigrid_F_Cycle
julianlitz Jan 30, 2026
2be3b94
Fix formatting issues in extrapolated_multigrid_F_Cycle.cpp
julianlitz Jan 30, 2026
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
33 changes: 16 additions & 17 deletions include/GMGPolar/igmgpolar.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ class IGMGPolar

/* ------------------------------------------------------------------------- */
/* Compute the extrapolated residual: res_ex = 4/3 res_fine - 1/3 res_coarse */
void extrapolatedResidual(const int current_level, Vector<double> residual,
ConstVector<double> residual_next_level);
void extrapolatedResidual(int current_level, Vector<double> residual, ConstVector<double> residual_next_level);

/* --------------- */
/* Setup Functions */
Expand All @@ -278,24 +277,24 @@ class IGMGPolar

/* ------------------- */
/* Multigrid Functions */
void multigrid_V_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual);
void multigrid_W_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual);
void multigrid_F_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual);
void implicitlyExtrapolatedMultigrid_V_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual);
void implicitlyExtrapolatedMultigrid_W_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual);
void implicitlyExtrapolatedMultigrid_F_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual);
void multigrid_V_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual);
void multigrid_W_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual);
void multigrid_F_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual);
void extrapolated_multigrid_V_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual);
void extrapolated_multigrid_W_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual);
void extrapolated_multigrid_F_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual);

/* ----------------------- */
/* Interpolation functions */
void prolongation(const int current_level, Vector<double> result, ConstVector<double> x) const;
void restriction(const int current_level, Vector<double> result, ConstVector<double> x) const;
void injection(const int current_level, Vector<double> result, ConstVector<double> x) const;
void extrapolatedProlongation(const int current_level, Vector<double> result, ConstVector<double> x) const;
void extrapolatedRestriction(const int current_level, Vector<double> result, ConstVector<double> x) const;
void FMGInterpolation(const int current_level, Vector<double> result, ConstVector<double> x) const;
void prolongation(int current_level, Vector<double> result, ConstVector<double> x) const;
void restriction(int current_level, Vector<double> result, ConstVector<double> x) const;
void injection(int current_level, Vector<double> result, ConstVector<double> x) const;
void extrapolatedProlongation(int current_level, Vector<double> result, ConstVector<double> x) const;
void extrapolatedRestriction(int current_level, Vector<double> result, ConstVector<double> x) const;
void FMGInterpolation(int current_level, Vector<double> result, ConstVector<double> x) const;

/* ------------- */
/* Visualization */
Expand Down
10 changes: 3 additions & 7 deletions include/GMGPolar/solver.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// =============================================================================
// Main Solver Routine
// =============================================================================
Expand Down Expand Up @@ -107,26 +106,23 @@ void IGMGPolar::solve(const BoundaryConditions& boundary_conditions, const Sourc
multigrid_V_Cycle(level.level_depth(), level.solution(), level.rhs(), level.residual());
}
else {
implicitlyExtrapolatedMultigrid_V_Cycle(level.level_depth(), level.solution(), level.rhs(),
level.residual());
extrapolated_multigrid_V_Cycle(level.level_depth(), level.solution(), level.rhs(), level.residual());
}
break;
case MultigridCycleType::W_CYCLE:
if (extrapolation_ == ExtrapolationType::NONE) {
multigrid_W_Cycle(level.level_depth(), level.solution(), level.rhs(), level.residual());
}
else {
implicitlyExtrapolatedMultigrid_W_Cycle(level.level_depth(), level.solution(), level.rhs(),
level.residual());
extrapolated_multigrid_W_Cycle(level.level_depth(), level.solution(), level.rhs(), level.residual());
}
break;
case MultigridCycleType::F_CYCLE:
if (extrapolation_ == ExtrapolationType::NONE) {
multigrid_F_Cycle(level.level_depth(), level.solution(), level.rhs(), level.residual());
}
else {
implicitlyExtrapolatedMultigrid_F_Cycle(level.level_depth(), level.solution(), level.rhs(),
level.residual());
extrapolated_multigrid_F_Cycle(level.level_depth(), level.solution(), level.rhs(), level.residual());
}
break;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ set(GMG_POLAR_SOURCES

# file(GLOB_RECURSE MULTIGRID_METHODS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/*.cpp)
set(MULTIGRID_METHODS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/implicitly_extrapolated_multigrid_F_Cycle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/implicitly_extrapolated_multigrid_V_Cycle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/implicitly_extrapolated_multigrid_W_Cycle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/extrapolated_multigrid_F_Cycle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/extrapolated_multigrid_V_Cycle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/extrapolated_multigrid_W_Cycle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/multigrid_F_Cycle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/multigrid_V_Cycle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GMGPolar/MultigridMethods/multigrid_W_Cycle.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../../../include/GMGPolar/gmgpolar.h"

void IGMGPolar::implicitlyExtrapolatedMultigrid_F_Cycle(const int level_depth, Vector<double> solution,
Vector<double> rhs, Vector<double> residual)
void IGMGPolar::extrapolated_multigrid_F_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual)
{
assert(0 <= level_depth && level_depth < number_of_levels_ - 1);

Expand Down Expand Up @@ -123,4 +123,4 @@ void IGMGPolar::implicitlyExtrapolatedMultigrid_F_Cycle(const int level_depth, V
auto end_MGC = std::chrono::high_resolution_clock::now();
t_avg_MGC_total_ += std::chrono::duration<double>(end_MGC - start_MGC).count();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../../../include/GMGPolar/gmgpolar.h"

void IGMGPolar::implicitlyExtrapolatedMultigrid_V_Cycle(const int level_depth, Vector<double> solution,
Vector<double> rhs, Vector<double> residual)
void IGMGPolar::extrapolated_multigrid_V_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual)
{
assert(0 <= level_depth && level_depth < number_of_levels_ - 1);

Expand Down Expand Up @@ -122,4 +122,4 @@ void IGMGPolar::implicitlyExtrapolatedMultigrid_V_Cycle(const int level_depth, V
auto end_MGC = std::chrono::high_resolution_clock::now();
t_avg_MGC_total_ += std::chrono::duration<double>(end_MGC - start_MGC).count();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../../../include/GMGPolar/gmgpolar.h"

void IGMGPolar::implicitlyExtrapolatedMultigrid_W_Cycle(const int level_depth, Vector<double> solution,
Vector<double> rhs, Vector<double> residual)
void IGMGPolar::extrapolated_multigrid_W_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual)
{
assert(0 <= level_depth && level_depth < number_of_levels_ - 1);

Expand Down Expand Up @@ -123,4 +123,4 @@ void IGMGPolar::implicitlyExtrapolatedMultigrid_W_Cycle(const int level_depth, V
auto end_MGC = std::chrono::high_resolution_clock::now();
t_avg_MGC_total_ += std::chrono::duration<double>(end_MGC - start_MGC).count();
}
}
}
5 changes: 2 additions & 3 deletions src/GMGPolar/MultigridMethods/multigrid_F_Cycle.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "../../../include/GMGPolar/gmgpolar.h"

void IGMGPolar::multigrid_F_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual)
void IGMGPolar::multigrid_F_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual)
{
assert(0 <= level_depth && level_depth < number_of_levels_ - 1);

Expand Down Expand Up @@ -91,4 +90,4 @@ void IGMGPolar::multigrid_F_Cycle(const int level_depth, Vector<double> solution
auto end_MGC = std::chrono::high_resolution_clock::now();
t_avg_MGC_total_ += std::chrono::duration<double>(end_MGC - start_MGC).count();
}
}
}
5 changes: 2 additions & 3 deletions src/GMGPolar/MultigridMethods/multigrid_V_Cycle.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "../../../include/GMGPolar/gmgpolar.h"

void IGMGPolar::multigrid_V_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual)
void IGMGPolar::multigrid_V_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual)
{
assert(0 <= level_depth && level_depth < number_of_levels_ - 1);

Expand Down Expand Up @@ -90,4 +89,4 @@ void IGMGPolar::multigrid_V_Cycle(const int level_depth, Vector<double> solution
auto end_MGC = std::chrono::high_resolution_clock::now();
t_avg_MGC_total_ += std::chrono::duration<double>(end_MGC - start_MGC).count();
}
}
}
5 changes: 2 additions & 3 deletions src/GMGPolar/MultigridMethods/multigrid_W_Cycle.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "../../../include/GMGPolar/gmgpolar.h"

void IGMGPolar::multigrid_W_Cycle(const int level_depth, Vector<double> solution, Vector<double> rhs,
Vector<double> residual)
void IGMGPolar::multigrid_W_Cycle(int level_depth, Vector<double> solution, Vector<double> rhs, Vector<double> residual)
{
assert(0 <= level_depth && level_depth < number_of_levels_ - 1);

Expand Down Expand Up @@ -91,4 +90,4 @@ void IGMGPolar::multigrid_W_Cycle(const int level_depth, Vector<double> solution
auto end_MGC = std::chrono::high_resolution_clock::now();
t_avg_MGC_total_ += std::chrono::duration<double>(end_MGC - start_MGC).count();
}
}
}
12 changes: 6 additions & 6 deletions src/GMGPolar/level_interpolation.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "../../include/GMGPolar/gmgpolar.h"

void IGMGPolar::prolongation(const int current_level, Vector<double> result, ConstVector<double> x) const
void IGMGPolar::prolongation(int current_level, Vector<double> result, ConstVector<double> x) const
{
assert(current_level < number_of_levels_ && 1 <= current_level);
if (!interpolation_)
Expand All @@ -9,7 +9,7 @@ void IGMGPolar::prolongation(const int current_level, Vector<double> result, Con
interpolation_->applyProlongation(levels_[current_level].grid(), levels_[current_level - 1].grid(), result, x);
}

void IGMGPolar::restriction(const int current_level, Vector<double> result, ConstVector<double> x) const
void IGMGPolar::restriction(int current_level, Vector<double> result, ConstVector<double> x) const
{
assert(current_level < number_of_levels_ - 1 && 0 <= current_level);
if (!interpolation_)
Expand All @@ -18,7 +18,7 @@ void IGMGPolar::restriction(const int current_level, Vector<double> result, Cons
interpolation_->applyRestriction(levels_[current_level].grid(), levels_[current_level + 1].grid(), result, x);
}

void IGMGPolar::injection(const int current_level, Vector<double> result, ConstVector<double> x) const
void IGMGPolar::injection(int current_level, Vector<double> result, ConstVector<double> x) const
{
assert(current_level < number_of_levels_ - 1 && 0 <= current_level);
if (!interpolation_)
Expand All @@ -27,7 +27,7 @@ void IGMGPolar::injection(const int current_level, Vector<double> result, ConstV
interpolation_->applyInjection(levels_[current_level].grid(), levels_[current_level + 1].grid(), result, x);
}

void IGMGPolar::extrapolatedProlongation(const int current_level, Vector<double> result, ConstVector<double> x) const
void IGMGPolar::extrapolatedProlongation(int current_level, Vector<double> result, ConstVector<double> x) const
{
assert(current_level < number_of_levels_ && 1 <= current_level);
if (!interpolation_)
Expand All @@ -37,7 +37,7 @@ void IGMGPolar::extrapolatedProlongation(const int current_level, Vector<double>
result, x);
}

void IGMGPolar::extrapolatedRestriction(const int current_level, Vector<double> result, ConstVector<double> x) const
void IGMGPolar::extrapolatedRestriction(int current_level, Vector<double> result, ConstVector<double> x) const
{
assert(current_level < number_of_levels_ - 1 && 0 <= current_level);
if (!interpolation_)
Expand All @@ -47,7 +47,7 @@ void IGMGPolar::extrapolatedRestriction(const int current_level, Vector<double>
result, x);
}

void IGMGPolar::FMGInterpolation(const int current_level, Vector<double> result, ConstVector<double> x) const
void IGMGPolar::FMGInterpolation(int current_level, Vector<double> result, ConstVector<double> x) const
{
assert(current_level < number_of_levels_ && 1 <= current_level);
if (!interpolation_)
Expand Down
14 changes: 7 additions & 7 deletions src/GMGPolar/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ void IGMGPolar::initializeSolution()
if (fine_level.level_depth() == 0 && (extrapolation_ != ExtrapolationType::NONE)) {
switch (FMG_cycle_) {
case MultigridCycleType::V_CYCLE:
implicitlyExtrapolatedMultigrid_V_Cycle(fine_level.level_depth(), fine_level.solution(),
fine_level.rhs(), fine_level.residual());
extrapolated_multigrid_V_Cycle(fine_level.level_depth(), fine_level.solution(),
fine_level.rhs(), fine_level.residual());
break;

case MultigridCycleType::W_CYCLE:
implicitlyExtrapolatedMultigrid_W_Cycle(fine_level.level_depth(), fine_level.solution(),
fine_level.rhs(), fine_level.residual());
extrapolated_multigrid_W_Cycle(fine_level.level_depth(), fine_level.solution(),
fine_level.rhs(), fine_level.residual());
break;

case MultigridCycleType::F_CYCLE:
implicitlyExtrapolatedMultigrid_F_Cycle(fine_level.level_depth(), fine_level.solution(),
fine_level.rhs(), fine_level.residual());
extrapolated_multigrid_F_Cycle(fine_level.level_depth(), fine_level.solution(),
fine_level.rhs(), fine_level.residual());
break;

default:
Expand Down Expand Up @@ -135,7 +135,7 @@ void IGMGPolar::updateResidualNorms(Level& level, int iteration, double& initial
}
}

void IGMGPolar::extrapolatedResidual(const int current_level, Vector<double> residual,
void IGMGPolar::extrapolatedResidual(int current_level, Vector<double> residual,
ConstVector<double> residual_next_level)
{
const PolarGrid& fineGrid = levels_[current_level].grid();
Expand Down