Go to the documentation of this file.
21 #ifndef THUNDEREGG_GMG_LEVEL_H
22 #define THUNDEREGG_GMG_LEVEL_H
44 std::shared_ptr<const Operator<D>> op;
48 std::shared_ptr<const Restrictor<D>> restrictor;
52 std::shared_ptr<const Interpolator<D>> interpolator;
56 std::shared_ptr<const Smoother<D>> smoother;
60 std::shared_ptr<const Level> coarser;
74 this->restrictor.reset(restrictor.
clone());
83 if (restrictor ==
nullptr) {
84 throw RuntimeError(
"This level does not have a restrictor");
95 this->interpolator.reset(interpolator.
clone());
104 if (interpolator ==
nullptr) {
105 throw RuntimeError(
"This level does not have an interpolator");
107 return *interpolator;
123 throw RuntimeError(
"This level does not have an Operator");
140 if (smoother ==
nullptr) {
141 throw RuntimeError(
"This level does not have a smoother");
150 void setCoarser(std::shared_ptr<const Level> coarser) { this->coarser = coarser; }
158 if (coarser ==
nullptr) {
159 throw RuntimeError(
"This level does not have a coarser level.");
168 bool finest()
const {
return interpolator ==
nullptr; }
174 bool coarsest()
const {
return coarser ==
nullptr; }
176 extern template class Level<2>;
177 extern template class Level<3>;
virtual Interpolator< D > * clone() const =0
Clone this interpolator.
virtual Restrictor< D > * clone() const =0
Clone this interpolator.
const Smoother< D > & getSmoother() const
Get smoother operator for this level.
Definition: Level.h:138
void setSmoother(const Smoother< D > &smoother)
Set the smoother for this level.
Definition: Level.h:132
virtual Operator< D > * clone() const =0
Clone this operator.
void setRestrictor(const Restrictor< D > &restrictor)
Set the restriction operator for restricting from this level to the coarser level.
Definition: Level.h:72
void setOperator(const Operator< D > &op)
Set the operator (matrix) for this level.
Definition: Level.h:114
const Interpolator< D > & getInterpolator() const
Get the interpolation operator for this level.
Definition: Level.h:102
Abstract class for restriction operators.
Definition: Restrictor.h:36
const Operator< D > & getOperator() const
Get the operator for this level.
Definition: Level.h:120
virtual Smoother< D > * clone() const =0
Clone this smoother.
const Restrictor< D > & getRestrictor() const
Get the restriction operator for this level.
Definition: Level.h:81
const Level & getCoarser() const
get reference to the coarser level.
Definition: Level.h:156
Abstract class for interpolation operators.
Definition: Interpolator.h:35
bool finest() const
Check if this level is the finest level.
Definition: Level.h:168
Base class for operators.
Definition: Operator.h:37
void setCoarser(std::shared_ptr< const Level > coarser)
Set pointer to the coarser level.
Definition: Level.h:150
Represents a level in geometric multi-grid.
Definition: Level.h:38
Level()
Create a Level object.
Definition: Level.h:66
Abstract class for smoothing operators.
Definition: Smoother.h:34
Geometric-Multigrid classes.
Definition: Cycle.h:33
bool coarsest() const
Check if this level is the coarsest level.
Definition: Level.h:174
void setInterpolator(const Interpolator< D > &interpolator)
Set the interpolation operator for interpolating from this level to the finer level.
Definition: Level.h:93
ThunderEgg runtime exception.
Definition: RuntimeError.h:36