Commit 4bf4338f authored by Praetorius, Simon's avatar Praetorius, Simon

Merge branch 'issue/virtual_override_final' into 'develop'

use exactly one of virtual, override, or final.

See merge request spraetor/dune-amdis!86
parents c908be0b 6eb2e6bc
Pipeline #1760 canceled with stage
......@@ -44,7 +44,7 @@ namespace AMDiS
}
/// Implementation of AdaptBase::adapt()
virtual int adapt() override;
int adapt() override;
protected:
/** \brief
......
......@@ -35,7 +35,7 @@ namespace AMDiS
AdaptInfo& adaptInfo);
/// Implementation of AdaptBase::adapt()
virtual int adapt() override;
int adapt() override;
};
} // end namespace AMDiS
......@@ -44,7 +44,7 @@ namespace AMDiS
{
public:
virtual std::unique_ptr<BaseClass> create() final
std::unique_ptr<BaseClass> create() final
{
error_exit("Should not be called. Call create(string) instead!");
return {};
......
......@@ -94,7 +94,7 @@ namespace AMDiS
void init(std::string const&, tag::unknown) {}
/// 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_);
......
......@@ -39,12 +39,12 @@ namespace AMDiS
}
/// 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);
}
virtual void detach(DOFVectorInterface* vec) override
void detach(DOFVectorInterface* vec) override
{
auto it = std::find(data_.begin(), data_.end(), vec);
if (it != data_.end())
......@@ -54,7 +54,7 @@ namespace AMDiS
}
/// Prepare the grid and the data for the adaption
virtual bool preAdapt() override
bool preAdapt() override
{
assert(grid_ != nullptr);
mightCoarsen_ = grid_->preAdapt(); // any element might be coarsened in adapt()
......@@ -64,7 +64,7 @@ namespace AMDiS
}
/// do the grid adaption
virtual bool adapt() override
bool adapt() override
{
assert(grid_ != nullptr);
refined_ = grid_->adapt(); // returns true if a least one entity was refined
......@@ -72,7 +72,7 @@ namespace AMDiS
}
// Perform data adaption to the new grid
virtual void postAdapt() override
void postAdapt() override
{
assert(grid_ != nullptr);
if (mightCoarsen_ || refined_) {
......
......@@ -164,10 +164,10 @@ namespace AMDiS
}
/// Can be used by sub classes. Called before traversal.
virtual void initMarking(AdaptInfo& adaptInfo) override;
void initMarking(AdaptInfo& adaptInfo) override;
/// 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.
static std::unique_ptr<EstimatorMarker<Grid> > createMarker(std::string const& name,
......@@ -220,7 +220,7 @@ namespace AMDiS
: 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_)
this->mark(elem, 1);
......@@ -252,7 +252,7 @@ namespace AMDiS
Parameters::get(name + "->MSGammaC", msGammaC_);
}
virtual void initMarking(AdaptInfo& adaptInfo) override;
void initMarking(AdaptInfo& adaptInfo) override;
protected:
/// Marking parameter.
......@@ -287,7 +287,7 @@ namespace AMDiS
Parameters::get(name + "->ESThetaC", esThetaC_);
}
virtual void initMarking(AdaptInfo& adaptInfo) override;
void initMarking(AdaptInfo& adaptInfo) override;
protected:
/// Marking parameter.
......@@ -324,7 +324,7 @@ namespace AMDiS
Parameters::get(name + "->GERSThetaC", gersThetaC_);
}
virtual Flag markGrid(AdaptInfo& adaptInfo) override;
Flag markGrid(AdaptInfo& adaptInfo) override;
protected:
/// Refinement marking function.
......@@ -387,12 +387,12 @@ namespace AMDiS
/// \brief Implementation of \ref Marker::markElement. Does nothing since marking is
/// 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
/// a value larger than the current level and is marked for coarsening of
/// the result is less than the current value.
virtual Flag markGrid(AdaptInfo& adaptInfo) override;
Flag markGrid(AdaptInfo& adaptInfo) override;
private:
/// Indicator function for adaptation
......
......@@ -41,13 +41,13 @@ namespace AMDiS
{}
/// Initialisation of the problem.
virtual void initialize(Flag initFlag = INIT_NOTHING);
void initialize(Flag initFlag = INIT_NOTHING);
/// Implementation of \ref ProblemTimeInterface::initTimestep().
virtual void initTimestep(AdaptInfo& adaptInfo) override;
void initTimestep(AdaptInfo& adaptInfo) override;
/// Implementation of \ref ProblemTimeInterface::closeTimestep().
virtual void closeTimestep(AdaptInfo& adaptInfo) override;
void closeTimestep(AdaptInfo& adaptInfo) override;
/// Returns \ref problemStat.
ProblemType& problemStat() { return *problemStat_; }
......@@ -78,7 +78,7 @@ namespace AMDiS
}
/// Implementation of \ref ProblemTimeInterface::transferInitialSolution().
virtual void transferInitialSolution(AdaptInfo& adaptInfo) override;
void transferInitialSolution(AdaptInfo& adaptInfo) override;
protected:
/// Used in \ref initialize() to create the \ref oldSolution_.
......
......@@ -33,13 +33,13 @@ namespace AMDiS
{}
/// Destructor.
virtual ~ProblemInstatBase() = default;
~ProblemInstatBase() override = default;
/// Implementation of \ref ProblemTimeInterface::setTime().
virtual void setTime(AdaptInfo& adaptInfo) override;
void setTime(AdaptInfo& adaptInfo) override;
/// 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_
virtual std::string const& name() const
......
......@@ -254,15 +254,15 @@ namespace AMDiS
public:
/// Implementation of \ref ProblemStatBase::solve
virtual void solve(AdaptInfo& adaptInfo,
bool createMatrixData = true,
bool storeMatrixData = false) override;
void solve(AdaptInfo& adaptInfo,
bool createMatrixData = true,
bool storeMatrixData = false) override;
/// Implementation of \ref ProblemStatBase::buildAfterCoarse
virtual void buildAfterAdapt(AdaptInfo& adaptInfo,
Flag flag,
bool asmMatrix = true,
bool asmVector = true) override;
void buildAfterAdapt(AdaptInfo& adaptInfo,
Flag flag,
bool asmMatrix = true,
bool asmVector = true) override;
/// \brief Assemble the linear system by calling \ref buildAfterAdapt with
/// `asmMatrix` and `asmVector` set to true.
......@@ -278,7 +278,7 @@ namespace AMDiS
public: // get-methods
/// 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
......@@ -416,25 +416,25 @@ namespace AMDiS
public: // implementation of iteration interface methods
/// 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);
}
/// 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.
virtual Flag adaptGrid(AdaptInfo& adaptInfo) override;
Flag adaptGrid(AdaptInfo& adaptInfo) override;
/// 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
virtual Flag globalCoarsen(int n) override;
Flag globalCoarsen(int n) override;
/// Uniform global refinement by n level
virtual Flag globalRefine(int n) override;
Flag globalRefine(int n) override;
private:
/// Name of this problem.
......
......@@ -22,27 +22,27 @@ namespace AMDiS
{}
/// Implementation of \ref ProblemIterationIterface::beginIteration()
virtual void beginIteration(AdaptInfo& adaptInfo) override;
void beginIteration(AdaptInfo& adaptInfo) override;
/// 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()
virtual void endIteration(AdaptInfo& adaptInfo) override;
void endIteration(AdaptInfo& adaptInfo) override;
/// 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 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
virtual ProblemStatBase& problem(std::string const& name) override;
ProblemStatBase& problem(std::string const& name) override;
protected:
/// Nested assemblage and mesh adaption.
......
......@@ -81,7 +81,7 @@ namespace AMDiS
}
/// Destructor
virtual ~DOFVectorBase() override
~DOFVectorBase() override
{
GridTransferManager::detach(*this);
}
......@@ -140,7 +140,7 @@ namespace AMDiS
}
/// 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()) {
backend_.resize(size());
......@@ -206,13 +206,13 @@ namespace AMDiS
}
/// Implementation of \ref DOFVectorInterface::preAdapt
virtual void preAdapt(bool mightCoarsen) override
void preAdapt(bool mightCoarsen) override
{
dataTransfer_->preAdapt(*this, mightCoarsen);
}
/// Implementation of \ref DOFVectorInterface::postAdapt
virtual void postAdapt(bool refined) override
void postAdapt(bool refined) override
{
dataTransfer_->postAdapt(*this, refined);
}
......
......@@ -32,7 +32,7 @@ namespace AMDiS
/// A creator to be used instead of the constructor.
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);
}
......@@ -52,8 +52,8 @@ namespace AMDiS
private:
/// Implements \ref LinearSolverInterface::solveSystemImpl()
virtual void solveImpl(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override
void solveImpl(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override
{
Dune::Timer t;
if (solverInfo.doCreateMatrixData()) {
......
......@@ -31,7 +31,7 @@ namespace AMDiS
}
/// Implementes \ref RunnerInterface::init()
virtual void init(Matrix const& A) override
void init(Matrix const& A) override
{
if (!reusePattern_ || !initialized_) {
solver_.analyzePattern(A);
......@@ -45,11 +45,11 @@ namespace AMDiS
/// Implementes \ref RunnerInterface::exit()
virtual void exit() override {}
void exit() override {}
/// Implementes \ref RunnerInterface::solve()
virtual int solve(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override
int solve(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override
{
x = solver_.solve(b);
......
......@@ -27,7 +27,7 @@ namespace AMDiS
/// Implementes \ref RunnerInterface::init()
virtual void init(Matrix const& A) override
void init(Matrix const& A) override
{
if (!reusePattern_ || !initialized_) {
solver_.analyzePattern(A);
......@@ -40,11 +40,11 @@ namespace AMDiS
}
/// Implementes \ref RunnerInterface::exit()
virtual void exit() override {}
void exit() override {}
/// Implementes \ref RunnerInterface::solve()
virtual int solve(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override
int solve(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override
{
solver_.setTolerance(solverInfo.relTolerance());
x = solver_.solveWithGuess(b, x);
......
......@@ -30,7 +30,7 @@ namespace AMDiS
using SolverBase = LinearSolverInterface<Matrix, VectorX, VectorB>;
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
std::string precon = "no";
......
......@@ -29,19 +29,19 @@ namespace AMDiS
{}
/// Implementes \ref RunnerInterface::init()
virtual void init(Matrix const& A) override
void init(Matrix const& A) override
{
solver_ = solverCreator_.create(A);
}
/// Implementes \ref RunnerInterface::exit()
virtual void exit() override
void exit() override
{
solver_.reset();
}
/// 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
{
// storing some statistics
......
......@@ -27,7 +27,7 @@ namespace AMDiS
/// Implementes \ref RunnerInterface::init()
virtual void init(Matrix const& A) override
void init(Matrix const& A) override
{
precon_ = preconCreator_->create(A);
linOperator_ = std::make_shared<LinOperator>(A);
......@@ -35,7 +35,7 @@ namespace AMDiS
}
/// Implementes \ref RunnerInterface::exit()
virtual void exit() override
void exit() override
{
solver_.reset();
linOperator_.reset();
......@@ -43,8 +43,8 @@ namespace AMDiS
}
/// Implementes \ref RunnerInterface::solve()
virtual int solve(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override
int solve(Matrix const& A, VectorX& x, VectorB const& b,
SolverInfo& solverInfo) override
{
// storing some statistics
Dune::InverseOperatorResult statistics;
......
......@@ -30,7 +30,7 @@ namespace AMDiS
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);
}
......@@ -43,7 +43,7 @@ namespace AMDiS
}
using PreconBase = Dune::Preconditioner<VectorX, VectorB>;
virtual std::unique_ptr<PreconBase> create(Matrix const& A) const override
std::unique_ptr<PreconBase> create(Matrix const& A) const override
{
return createImpl(A, Type<Precon>{});
}
......
......@@ -40,13 +40,13 @@ namespace AMDiS
}
/// Implements \ref RunnerInterface::lLeftPrecon(), Returns \ref L_
virtual std::shared_ptr<PreconBase> leftPrecon() override
std::shared_ptr<PreconBase> leftPrecon() override
{
return L_;
}
/// Implements \ref RunnerInterface::rightPrecon(), Returns \ref R_
virtual std::shared_ptr<PreconBase> rightPrecon() override
std::shared_ptr<PreconBase> rightPrecon() override
{
return R_;
}
......@@ -64,22 +64,22 @@ namespace AMDiS
}
/// Implementation of \ref RunnerInterface::init()
virtual void init(Matrix const& A) override
void init(Matrix const& A) override
{
L_->init(A);
R_->init(A);
}
/// Implementation of \ref RunnerInterface::exit()
virtual void exit() override
void exit() override
{
L_->exit();
R_->exit();
}
/// Implementation of \ref RunnerInterface::solve()
virtual int solve(Matrix const& A, Vector& x, Vector const& b,
SolverInfo& solverInfo) override
int solve(Matrix const& A, Vector& x, Vector const& b,
SolverInfo& solverInfo) override
{
test_exit(bool(L_), "There is no left preconditioner");
test_exit(bool(R_), "There is no right preconditioner");
......
......@@ -20,7 +20,7 @@ namespace AMDiS
/// A creator to be used instead of the constructor.
struct Creator : CreatorInterface<Super>
{
virtual std::unique_ptr<Super> create() override
std::unique_ptr<Super> create() override
{
return std::make_unique<Self>();
}
......@@ -28,26 +28,26 @@ namespace AMDiS
public:
/// Implementation of \ref PreconditionerBase::init()
virtual void init(Matrix const& fullMatrix) override
void init(Matrix const& fullMatrix) override
{
precon_.reset(new PreconRunner(fullMatrix));
}
/// Implementation of \ref PreconditionerInterface::exit()
virtual void exit() override
void exit() override
{
precon_.reset();
}
/// Implementation of \ref PreconditionerBase::solve()
virtual void solve(Vector const& vin, Vector& vout) const override
void solve(Vector const& vin, Vector& vout) const override
{
test_exit_dbg(bool(precon_), "No preconditioner initialized!");
precon_->solve(vin, vout);
}
/// Implementation of \ref PreconditionerBase::adjoint_solve()
virtual void adjoint_solve(Vector const& vin, Vector& vout) const override
void adjoint_solve(Vector const& vin, Vector& vout) const override
{
test_exit_dbg(bool(precon_), "No preconditioner initialized!");
precon_->adjoint_solve(vin, vout);
......
......@@ -47,8 +47,8 @@ namespace AMDiS
}
/// Implementation of \ref RunnerBase::solve()
virtual int solve(Matrix const& A, Vector& x, Vector const& b,
SolverInfo& solverInfo) override
int solve(Matrix const& A, Vector& x, Vector const& b,
SolverInfo& solverInfo) override
{
AMDIS_FUNCNAME("Umfpack_Runner::solve()");
test_exit(bool(solver_), "The umfpack solver was not initialized\n");
......@@ -71,7 +71,7 @@ namespace AMDiS
}
/// Implementation of \ref RunnerInterface::exit()
virtual void exit() override {}
void exit() override {}
protected:
std::shared_ptr<SolverType> solver_;
......@@ -98,7 +98,7 @@ namespace AMDiS
{}
/// Implementation of \ref RunnerInterface::init()
virtual void init(FullMatrix const& fullMatrix) override
void init(FullMatrix const& fullMatrix) override
{
try {
Super::solver_.reset(new SolverType(fullMatrix, Super::symmetricStrategy_, Super::allocInit_));
......
......@@ -54,14 +54,14 @@ namespace AMDiS
"Polynomial order of GridFunction can not be extracted. Provide an explicit order parameter instead.");
public:
virtual void bind(LocalFunction const& localFct) final
void bind(LocalFunction const& localFct) final
{
order_ = Dune::Hybrid::ifElse(Concept{},
[&](auto id) { return AMDiS::order(id(localFct)); },
[] (auto) { return -1; });
}
virtual int order() const final { return order_; }
int order() const final { return order_; }
private:
int order_ = -1;
......@@ -106,9 +106,9 @@ namespace AMDiS
, qt_(qt)
{}
virtual int order() const final { return order_; }
int order() const final { return order_; }
virtual QuadratureRule const& rule(Dune::GeometryType const& type, int degree) const final
QuadratureRule const& rule(Dune::GeometryType const& type, int degree) const final
{
using QuadratureRules = Dune::QuadratureRules<ctype, dimension>;
return QuadratureRules::rule(type, degree, qt_);
......@@ -159,7 +159,7 @@ namespace AMDiS
: rule_(rule)
{}
virtual QuadratureRule const& rule(Dune::GeometryType const& /*type*/, int /*degree*/) const final
QuadratureRule const& rule(Dune::GeometryType const& /*type*/, int /*degree*/) const final
{
return rule_;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment