Commit 6eb2e6bc authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

use exactly one of virtual, override, or final.

parent 2b37f6a6
Pipeline #1755 passed with stage
in 35 minutes and 3 seconds
...@@ -44,7 +44,7 @@ namespace AMDiS ...@@ -44,7 +44,7 @@ namespace AMDiS
} }
/// Implementation of AdaptBase::adapt() /// Implementation of AdaptBase::adapt()
virtual int adapt() override; int adapt() override;
protected: protected:
/** \brief /** \brief
......
...@@ -35,7 +35,7 @@ namespace AMDiS ...@@ -35,7 +35,7 @@ namespace AMDiS
AdaptInfo& adaptInfo); AdaptInfo& adaptInfo);
/// Implementation of AdaptBase::adapt() /// Implementation of AdaptBase::adapt()
virtual int adapt() override; int adapt() override;
}; };
} // end namespace AMDiS } // end namespace AMDiS
...@@ -44,7 +44,7 @@ namespace AMDiS ...@@ -44,7 +44,7 @@ namespace AMDiS
{ {
public: public:
virtual std::unique_ptr<BaseClass> create() final std::unique_ptr<BaseClass> create() final
{ {
error_exit("Should not be called. Call create(string) instead!"); error_exit("Should not be called. Call create(string) instead!");
return {}; return {};
......
...@@ -94,7 +94,7 @@ namespace AMDiS ...@@ -94,7 +94,7 @@ namespace AMDiS
void init(std::string const&, tag::unknown) {} void init(std::string const&, tag::unknown) {}
/// Implements \ref FileWriterInterface::writeFiles /// Implements \ref FileWriterInterface::writeFiles
virtual void writeFiles(AdaptInfo& adaptInfo, bool force) override void writeFiles(AdaptInfo& adaptInfo, bool force) override
{ {
test_exit(filesystem::exists(dir_), "Output directory '{}' does not exist!",dir_); test_exit(filesystem::exists(dir_), "Output directory '{}' does not exist!",dir_);
......
...@@ -39,12 +39,12 @@ namespace AMDiS ...@@ -39,12 +39,12 @@ namespace AMDiS
} }
/// Attach a data container to the grid transfer, that gets interpolated during grid change /// Attach a data container to the grid transfer, that gets interpolated during grid change
virtual void attach(DOFVectorInterface* vec) override void attach(DOFVectorInterface* vec) override
{ {
data_.push_back(vec); data_.push_back(vec);
} }
virtual void detach(DOFVectorInterface* vec) override void detach(DOFVectorInterface* vec) override
{ {
auto it = std::find(data_.begin(), data_.end(), vec); auto it = std::find(data_.begin(), data_.end(), vec);
if (it != data_.end()) if (it != data_.end())
...@@ -54,7 +54,7 @@ namespace AMDiS ...@@ -54,7 +54,7 @@ namespace AMDiS
} }
/// Prepare the grid and the data for the adaption /// Prepare the grid and the data for the adaption
virtual bool preAdapt() override bool preAdapt() override
{ {
assert(grid_ != nullptr); assert(grid_ != nullptr);
mightCoarsen_ = grid_->preAdapt(); // any element might be coarsened in adapt() mightCoarsen_ = grid_->preAdapt(); // any element might be coarsened in adapt()
...@@ -64,7 +64,7 @@ namespace AMDiS ...@@ -64,7 +64,7 @@ namespace AMDiS
} }
/// do the grid adaption /// do the grid adaption
virtual bool adapt() override bool adapt() override
{ {
assert(grid_ != nullptr); assert(grid_ != nullptr);
refined_ = grid_->adapt(); // returns true if a least one entity was refined refined_ = grid_->adapt(); // returns true if a least one entity was refined
...@@ -72,7 +72,7 @@ namespace AMDiS ...@@ -72,7 +72,7 @@ namespace AMDiS
} }
// Perform data adaption to the new grid // Perform data adaption to the new grid
virtual void postAdapt() override void postAdapt() override
{ {
assert(grid_ != nullptr); assert(grid_ != nullptr);
if (mightCoarsen_ || refined_) { if (mightCoarsen_ || refined_) {
......
...@@ -164,10 +164,10 @@ namespace AMDiS ...@@ -164,10 +164,10 @@ namespace AMDiS
} }
/// Can be used by sub classes. Called before traversal. /// Can be used by sub classes. Called before traversal.
virtual void initMarking(AdaptInfo& adaptInfo) override; void initMarking(AdaptInfo& adaptInfo) override;
/// Marks one element. /// Marks one element.
virtual void markElement(AdaptInfo& adaptInfo, Element const& elem) override; void markElement(AdaptInfo& adaptInfo, Element const& elem) override;
/// Creates a scalar marker depending on the strategy set in parameters. /// Creates a scalar marker depending on the strategy set in parameters.
static std::unique_ptr<EstimatorMarker<Grid> > createMarker(std::string const& name, static std::unique_ptr<EstimatorMarker<Grid> > createMarker(std::string const& name,
...@@ -220,7 +220,7 @@ namespace AMDiS ...@@ -220,7 +220,7 @@ namespace AMDiS
: Super{name, component, est, grid} : Super{name, component, est, grid}
{} {}
virtual void markElement(AdaptInfo& adaptInfo, Element const& elem) override void markElement(AdaptInfo& adaptInfo, Element const& elem) override
{ {
if (this->refineAllowed_) if (this->refineAllowed_)
this->mark(elem, 1); this->mark(elem, 1);
...@@ -252,7 +252,7 @@ namespace AMDiS ...@@ -252,7 +252,7 @@ namespace AMDiS
Parameters::get(name + "->MSGammaC", msGammaC_); Parameters::get(name + "->MSGammaC", msGammaC_);
} }
virtual void initMarking(AdaptInfo& adaptInfo) override; void initMarking(AdaptInfo& adaptInfo) override;
protected: protected:
/// Marking parameter. /// Marking parameter.
...@@ -287,7 +287,7 @@ namespace AMDiS ...@@ -287,7 +287,7 @@ namespace AMDiS
Parameters::get(name + "->ESThetaC", esThetaC_); Parameters::get(name + "->ESThetaC", esThetaC_);
} }
virtual void initMarking(AdaptInfo& adaptInfo) override; void initMarking(AdaptInfo& adaptInfo) override;
protected: protected:
/// Marking parameter. /// Marking parameter.
...@@ -324,7 +324,7 @@ namespace AMDiS ...@@ -324,7 +324,7 @@ namespace AMDiS
Parameters::get(name + "->GERSThetaC", gersThetaC_); Parameters::get(name + "->GERSThetaC", gersThetaC_);
} }
virtual Flag markGrid(AdaptInfo& adaptInfo) override; Flag markGrid(AdaptInfo& adaptInfo) override;
protected: protected:
/// Refinement marking function. /// Refinement marking function.
...@@ -387,12 +387,12 @@ namespace AMDiS ...@@ -387,12 +387,12 @@ namespace AMDiS
/// \brief Implementation of \ref Marker::markElement. Does nothing since marking is /// \brief Implementation of \ref Marker::markElement. Does nothing since marking is
/// done in \ref markGrid(). /// done in \ref markGrid().
virtual void markElement(AdaptInfo& adaptInfo, Element const& elem) final {} void markElement(AdaptInfo& adaptInfo, Element const& elem) final {}
/// Mark element for refinement, if grid-function \ref gridFct_ evaluates to /// Mark element for refinement, if grid-function \ref gridFct_ evaluates to
/// a value larger than the current level and is marked for coarsening of /// a value larger than the current level and is marked for coarsening of
/// the result is less than the current value. /// the result is less than the current value.
virtual Flag markGrid(AdaptInfo& adaptInfo) override; Flag markGrid(AdaptInfo& adaptInfo) override;
private: private:
/// Indicator function for adaptation /// Indicator function for adaptation
......
...@@ -41,13 +41,13 @@ namespace AMDiS ...@@ -41,13 +41,13 @@ namespace AMDiS
{} {}
/// Initialisation of the problem. /// Initialisation of the problem.
virtual void initialize(Flag initFlag = INIT_NOTHING); void initialize(Flag initFlag = INIT_NOTHING);
/// Implementation of \ref ProblemTimeInterface::initTimestep(). /// Implementation of \ref ProblemTimeInterface::initTimestep().
virtual void initTimestep(AdaptInfo& adaptInfo) override; void initTimestep(AdaptInfo& adaptInfo) override;
/// Implementation of \ref ProblemTimeInterface::closeTimestep(). /// Implementation of \ref ProblemTimeInterface::closeTimestep().
virtual void closeTimestep(AdaptInfo& adaptInfo) override; void closeTimestep(AdaptInfo& adaptInfo) override;
/// Returns \ref problemStat. /// Returns \ref problemStat.
ProblemType& problemStat() { return *problemStat_; } ProblemType& problemStat() { return *problemStat_; }
...@@ -78,7 +78,7 @@ namespace AMDiS ...@@ -78,7 +78,7 @@ namespace AMDiS
} }
/// Implementation of \ref ProblemTimeInterface::transferInitialSolution(). /// Implementation of \ref ProblemTimeInterface::transferInitialSolution().
virtual void transferInitialSolution(AdaptInfo& adaptInfo) override; void transferInitialSolution(AdaptInfo& adaptInfo) override;
protected: protected:
/// Used in \ref initialize() to create the \ref oldSolution_. /// Used in \ref initialize() to create the \ref oldSolution_.
......
...@@ -33,13 +33,13 @@ namespace AMDiS ...@@ -33,13 +33,13 @@ namespace AMDiS
{} {}
/// Destructor. /// Destructor.
virtual ~ProblemInstatBase() = default; ~ProblemInstatBase() override = default;
/// Implementation of \ref ProblemTimeInterface::setTime(). /// Implementation of \ref ProblemTimeInterface::setTime().
virtual void setTime(AdaptInfo& adaptInfo) override; void setTime(AdaptInfo& adaptInfo) override;
/// Implementation of \ref ProblemTimeInterface::solveInitialProblem(). /// Implementation of \ref ProblemTimeInterface::solveInitialProblem().
virtual void solveInitialProblem(AdaptInfo& adaptInfo) override; void solveInitialProblem(AdaptInfo& adaptInfo) override;
/// Return the name of the instationary problem \ref name_ /// Return the name of the instationary problem \ref name_
virtual std::string const& name() const virtual std::string const& name() const
......
...@@ -254,15 +254,15 @@ namespace AMDiS ...@@ -254,15 +254,15 @@ namespace AMDiS
public: public:
/// Implementation of \ref ProblemStatBase::solve /// Implementation of \ref ProblemStatBase::solve
virtual void solve(AdaptInfo& adaptInfo, void solve(AdaptInfo& adaptInfo,
bool createMatrixData = true, bool createMatrixData = true,
bool storeMatrixData = false) override; bool storeMatrixData = false) override;
/// Implementation of \ref ProblemStatBase::buildAfterCoarse /// Implementation of \ref ProblemStatBase::buildAfterCoarse
virtual void buildAfterAdapt(AdaptInfo& adaptInfo, void buildAfterAdapt(AdaptInfo& adaptInfo,
Flag flag, Flag flag,
bool asmMatrix = true, bool asmMatrix = true,
bool asmVector = true) override; bool asmVector = true) override;
/// \brief Assemble the linear system by calling \ref buildAfterAdapt with /// \brief Assemble the linear system by calling \ref buildAfterAdapt with
/// `asmMatrix` and `asmVector` set to true. /// `asmMatrix` and `asmVector` set to true.
...@@ -278,7 +278,7 @@ namespace AMDiS ...@@ -278,7 +278,7 @@ namespace AMDiS
public: // get-methods public: // get-methods
/// Implementation of \ref ProblemStatBase::name /// Implementation of \ref ProblemStatBase::name
virtual std::string const& name() const override { return name_; } std::string const& name() const override { return name_; }
/// Return a reference to the grid, \ref grid /// Return a reference to the grid, \ref grid
...@@ -416,25 +416,25 @@ namespace AMDiS ...@@ -416,25 +416,25 @@ namespace AMDiS
public: // implementation of iteration interface methods public: // implementation of iteration interface methods
/// Implementation of \ref StandardProblemIteration::oneIteration. /// Implementation of \ref StandardProblemIteration::oneIteration.
virtual Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo = FULL_ITERATION) override Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo = FULL_ITERATION) override
{ {
return StandardProblemIteration::oneIteration(adaptInfo, toDo); return StandardProblemIteration::oneIteration(adaptInfo, toDo);
} }
/// Implementation of \ref ProblemStatBase::estimate. /// Implementation of \ref ProblemStatBase::estimate.
virtual void estimate(AdaptInfo& adaptInfo) override { /* do nothing. */ } void estimate(AdaptInfo& adaptInfo) override { /* do nothing. */ }
/// Implementation of \ref ProblemStatBase::refineMesh. /// Implementation of \ref ProblemStatBase::refineMesh.
virtual Flag adaptGrid(AdaptInfo& adaptInfo) override; Flag adaptGrid(AdaptInfo& adaptInfo) override;
/// Implementation of \ref ProblemStatBase::markElements. /// Implementation of \ref ProblemStatBase::markElements.
virtual Flag markElements(AdaptInfo& adaptInfo) override; Flag markElements(AdaptInfo& adaptInfo) override;
/// Uniform global grid coarsening by up to n level /// Uniform global grid coarsening by up to n level
virtual Flag globalCoarsen(int n) override; Flag globalCoarsen(int n) override;
/// Uniform global refinement by n level /// Uniform global refinement by n level
virtual Flag globalRefine(int n) override; Flag globalRefine(int n) override;
private: private:
/// Name of this problem. /// Name of this problem.
......
...@@ -22,27 +22,27 @@ namespace AMDiS ...@@ -22,27 +22,27 @@ namespace AMDiS
{} {}
/// Implementation of \ref ProblemIterationIterface::beginIteration() /// Implementation of \ref ProblemIterationIterface::beginIteration()
virtual void beginIteration(AdaptInfo& adaptInfo) override; void beginIteration(AdaptInfo& adaptInfo) override;
/// Implementation of \ref ProblemIterationInterface::oneIteration() /// Implementation of \ref ProblemIterationInterface::oneIteration()
virtual Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo) override; Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo) override;
/// Implementation of \ref ProblemIterationInterface::endIteration() /// Implementation of \ref ProblemIterationInterface::endIteration()
virtual void endIteration(AdaptInfo& adaptInfo) override; void endIteration(AdaptInfo& adaptInfo) override;
/// Returns the name of the problem. /// Returns the name of the problem.
virtual std::string const& name() const override; std::string const& name() const override;
virtual int numProblems() const override int numProblems() const override
{ {
return 1; return 1;
} }
/// Return the managed ProblemStat \ref problem, by number /// Return the managed ProblemStat \ref problem, by number
virtual ProblemStatBase& problem(int number = 0) override; ProblemStatBase& problem(int number = 0) override;
/// Return the managed ProblemStat \ref problem, by name /// Return the managed ProblemStat \ref problem, by name
virtual ProblemStatBase& problem(std::string const& name) override; ProblemStatBase& problem(std::string const& name) override;
protected: protected:
/// Nested assemblage and mesh adaption. /// Nested assemblage and mesh adaption.
......
...@@ -81,7 +81,7 @@ namespace AMDiS ...@@ -81,7 +81,7 @@ namespace AMDiS
} }
/// Destructor /// Destructor
virtual ~DOFVectorBase() override ~DOFVectorBase() override
{ {
GridTransferManager::detach(*this); GridTransferManager::detach(*this);
} }
...@@ -140,7 +140,7 @@ namespace AMDiS ...@@ -140,7 +140,7 @@ namespace AMDiS
} }
/// Resize the \ref vector to the size of the \ref basis and set to zero /// Resize the \ref vector to the size of the \ref basis and set to zero
virtual void compress() override void compress() override
{ {
if (size_type(backend_.size()) != size()) { if (size_type(backend_.size()) != size()) {
backend_.resize(size()); backend_.resize(size());
...@@ -206,13 +206,13 @@ namespace AMDiS ...@@ -206,13 +206,13 @@ namespace AMDiS
} }
/// Implementation of \ref DOFVectorInterface::preAdapt /// Implementation of \ref DOFVectorInterface::preAdapt
virtual void preAdapt(bool mightCoarsen) override void preAdapt(bool mightCoarsen) override
{ {
dataTransfer_->preAdapt(*this, mightCoarsen); dataTransfer_->preAdapt(*this, mightCoarsen);
} }
/// Implementation of \ref DOFVectorInterface::postAdapt /// Implementation of \ref DOFVectorInterface::postAdapt
virtual void postAdapt(bool refined) override void postAdapt(bool refined) override
{ {
dataTransfer_->postAdapt(*this, refined); dataTransfer_->postAdapt(*this, refined);
} }
......
...@@ -32,7 +32,7 @@ namespace AMDiS ...@@ -32,7 +32,7 @@ namespace AMDiS
/// A creator to be used instead of the constructor. /// A creator to be used instead of the constructor.
struct Creator : CreatorInterfaceName<Super> struct Creator : CreatorInterfaceName<Super>
{ {
virtual std::unique_ptr<Super> createWithString(std::string prefix) override std::unique_ptr<Super> createWithString(std::string prefix) override
{ {
return std::make_unique<Self>(prefix); return std::make_unique<Self>(prefix);
} }
...@@ -52,8 +52,8 @@ namespace AMDiS ...@@ -52,8 +52,8 @@ namespace AMDiS
private: private:
/// Implements \ref LinearSolverInterface::solveSystemImpl() /// Implements \ref LinearSolverInterface::solveSystemImpl()
virtual void solveImpl(Matrix const& A, VectorX& x, VectorB const& b, void solveImpl(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override SolverInfo& solverInfo) override
{ {
Dune::Timer t; Dune::Timer t;
if (solverInfo.doCreateMatrixData()) { if (solverInfo.doCreateMatrixData()) {
......
...@@ -31,7 +31,7 @@ namespace AMDiS ...@@ -31,7 +31,7 @@ namespace AMDiS
} }
/// Implementes \ref RunnerInterface::init() /// Implementes \ref RunnerInterface::init()
virtual void init(Matrix const& A) override void init(Matrix const& A) override
{ {
if (!reusePattern_ || !initialized_) { if (!reusePattern_ || !initialized_) {
solver_.analyzePattern(A); solver_.analyzePattern(A);
...@@ -45,11 +45,11 @@ namespace AMDiS ...@@ -45,11 +45,11 @@ namespace AMDiS
/// Implementes \ref RunnerInterface::exit() /// Implementes \ref RunnerInterface::exit()
virtual void exit() override {} void exit() override {}
/// Implementes \ref RunnerInterface::solve() /// Implementes \ref RunnerInterface::solve()
virtual int solve(Matrix const& A, VectorX& x, VectorB const& b, int solve(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override SolverInfo& solverInfo) override
{ {
x = solver_.solve(b); x = solver_.solve(b);
......
...@@ -27,7 +27,7 @@ namespace AMDiS ...@@ -27,7 +27,7 @@ namespace AMDiS
/// Implementes \ref RunnerInterface::init() /// Implementes \ref RunnerInterface::init()
virtual void init(Matrix const& A) override void init(Matrix const& A) override
{ {
if (!reusePattern_ || !initialized_) { if (!reusePattern_ || !initialized_) {
solver_.analyzePattern(A); solver_.analyzePattern(A);
...@@ -40,11 +40,11 @@ namespace AMDiS ...@@ -40,11 +40,11 @@ namespace AMDiS
} }
/// Implementes \ref RunnerInterface::exit() /// Implementes \ref RunnerInterface::exit()
virtual void exit() override {} void exit() override {}
/// Implementes \ref RunnerInterface::solve() /// Implementes \ref RunnerInterface::solve()
virtual int solve(Matrix const& A, VectorX& x, VectorB const& b, int solve(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override SolverInfo& solverInfo) override
{ {
solver_.setTolerance(solverInfo.relTolerance()); solver_.setTolerance(solverInfo.relTolerance());
x = solver_.solveWithGuess(b, x); x = solver_.solveWithGuess(b, x);
......
...@@ -30,7 +30,7 @@ namespace AMDiS ...@@ -30,7 +30,7 @@ namespace AMDiS
using SolverBase = LinearSolverInterface<Matrix, VectorX, VectorB>; using SolverBase = LinearSolverInterface<Matrix, VectorX, VectorB>;
using Scalar = typename Matrix::Scalar; using Scalar = typename Matrix::Scalar;
virtual std::unique_ptr<SolverBase> createWithString(std::string const& prefix) override std::unique_ptr<SolverBase> createWithString(std::string const& prefix) override
{ {
// get creator string for preconditioner // get creator string for preconditioner
std::string precon = "no"; std::string precon = "no";
......
...@@ -29,19 +29,19 @@ namespace AMDiS ...@@ -29,19 +29,19 @@ namespace AMDiS
{} {}
/// Implementes \ref RunnerInterface::init() /// Implementes \ref RunnerInterface::init()
virtual void init(Matrix const& A) override void init(Matrix const& A) override
{ {
solver_ = solverCreator_.create(A); solver_ = solverCreator_.create(A);
} }
/// Implementes \ref RunnerInterface::exit() /// Implementes \ref RunnerInterface::exit()
virtual void exit() override void exit() override
{ {