Commit 2b37f6a6 authored by Praetorius, Simon's avatar Praetorius, Simon

Merge branch 'feature/remove_unused_functions' into 'develop'

Cleanup of directory structure and removed obsolete files and functions

See merge request !51
parents 0ef5f46a f688bc11
Pipeline #1751 passed with stage
in 29 minutes and 44 seconds
...@@ -23,5 +23,10 @@ add_subdirectory("externals") ...@@ -23,5 +23,10 @@ add_subdirectory("externals")
target_link_libraries(amdis fmt) target_link_libraries(amdis fmt)
option(ENABLE_ALL_WARNINGS "enable all meaningful warnings" OFF)
if (ENABLE_ALL_WARNINGS)
target_compile_options(amdis PUBLIC "-Wall" "-Wextra" "-pedantic" "-Wnon-virtual-dtor" "-Wold-style-cast" "-Wcast-align" "-Woverloaded-virtual" "-Wpedantic" "-Wconversion")
endif (ENABLE_ALL_WARNINGS)
# finalize the dune project, e.g. generating config.h etc. # finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE) finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
#pragma once
#include <string>
#include "Flag.hpp"
namespace AMDiS
{
class AdaptInfo;
class ProblemStatBase;
const Flag BUILD = 1; // Assemble vectors and matrices
const Flag BUILD_RHS = 2; // Assemble rhs vectors only
const Flag ADAPT = 4; // Run adaption procedure
const Flag SOLVE = 8; // Solve system
const Flag SOLVE_RHS = 16; // Solve system, where only rhs vectors have changed
const Flag ESTIMATE = 32; // Estimate error
const Flag MARK = 64; // Mark elements
const Flag FULL_ITERATION = BUILD | ADAPT | SOLVE | ESTIMATE | MARK;
const Flag NO_ADAPTION = BUILD | SOLVE | ESTIMATE;
/** \brief
* Interface for master problems needed by the adaption loop. A master problem
* can handle one single or multiple coupled problems. In the latter case,
* the master problem can determine the execution order of the build, solve,
* estimate, and adapt steps of the single problems in \ref oneIteration().
*/
class ProblemIterationInterface
{
public:
virtual ~ProblemIterationInterface() = default;
/// Called before each adaption loop iteration.
virtual void beginIteration(AdaptInfo&) { /* by default, do nothing */ }
/** \brief
* Determines the execution order of the single adaption steps. If adapt is
* true, mesh adaption will be performed. This allows to avoid mesh adaption,
* e.g. in timestep adaption loops of timestep adaptive strategies.
*/
virtual Flag oneIteration(AdaptInfo& adaptInfo, Flag toDo = FULL_ITERATION) = 0;
/// Called after each adaption loop iteration.
virtual void endIteration(AdaptInfo&) { /* by default, do nothing */ }
/// Returns number of managed problems
virtual int numProblems() const = 0;
/** \brief
* Returns the problem with the given number. If only one problem
* is managed by this master problem, the number hasn't to be given.
*/
virtual ProblemStatBase& problem(int number = 0) = 0;
/// Returns the problem with the given name.
virtual ProblemStatBase& problem(std::string const& name) = 0;
/// Returns the name of the problem.
virtual std::string const& name() const = 0;
};
} // end namespace AMDiS
...@@ -32,8 +32,8 @@ INPUT += @top_srcdir@/src/amdis \ ...@@ -32,8 +32,8 @@ INPUT += @top_srcdir@/src/amdis \
@top_srcdir@/src/amdis/common \ @top_srcdir@/src/amdis/common \
@top_srcdir@/src/amdis/gridfunctions \ @top_srcdir@/src/amdis/gridfunctions \
@top_srcdir@/src/amdis/io \ @top_srcdir@/src/amdis/io \
@top_srcdir@/src/amdis/linear_algebra \ @top_srcdir@/src/amdis/linearalgebra \
@top_srcdir@/src/amdis/linear_algebra/mtl \ @top_srcdir@/src/amdis/linearalgebra/mtl \
@top_srcdir@/src/amdis/operations \ @top_srcdir@/src/amdis/operations \
@top_srcdir@/src/amdis/utility \ @top_srcdir@/src/amdis/utility \
@top_srcdir@/doc @top_srcdir@/doc
...@@ -45,8 +45,8 @@ INPUT += @top_srcdir@/src/amdis \ ...@@ -45,8 +45,8 @@ INPUT += @top_srcdir@/src/amdis \
# excluded from the INPUT source files. This way you can easily exclude a # excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag. # subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE += @top_srcdir@/src/amdis/linear_algebra/eigen \ EXCLUDE += @top_srcdir@/src/amdis/linearalgebra/eigen \
@top_srcdir@/src/amdis/linear_algebra/istl @top_srcdir@/src/amdis/linearalgebra/istl
# The EXAMPLE_PATH tag can be used to specify one or more files or # The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see # directories that contain example code fragments that are included (see
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp> #include <amdis/Integrate.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp> #include <amdis/LocalOperators.hpp>
#include <amdis/common/Literals.hpp> #include <amdis/common/Literals.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/assembler/ConvectionDiffusionOperator.hpp> #include <amdis/localoperators/ConvectionDiffusionOperator.hpp>
#include <amdis/common/Literals.hpp> #include <amdis/common/Literals.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp> #include <amdis/Integrate.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/common/Literals.hpp> #include <amdis/common/Literals.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/AdaptInstationary.hpp> #include <amdis/AdaptInstationary.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemInstat.hpp> #include <amdis/ProblemInstat.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/GridFunctions.hpp> #include <amdis/GridFunctions.hpp>
#include <amdis/common/Literals.hpp> #include <amdis/common/Literals.hpp>
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/common/FieldMatVec.hpp> #include <amdis/common/FieldMatVec.hpp>
#include <amdis/AdaptInstationary.hpp> #include <amdis/AdaptInstationary.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/ProblemInstat.hpp> #include <amdis/ProblemInstat.hpp>
#include <amdis/Operators.hpp> #include <amdis/localoperators/StokesOperator.hpp>
#include <amdis/assembler/StokesOperator.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp> #include <amdis/Integrate.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp> #include <amdis/LocalOperators.hpp>
#include <amdis/common/Literals.hpp> #include <amdis/common/Literals.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp> #include <amdis/Integrate.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp> #include <amdis/LocalOperators.hpp>
#include <amdis/common/Literals.hpp> #include <amdis/common/Literals.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include <cmath> #include <cmath>
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#ifdef DOW #ifdef DOW
#undef DOW #undef DOW
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include <cmath> #include <cmath>
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#ifdef DOW #ifdef DOW
#undef DOW #undef DOW
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#include <cmath> #include <cmath>
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp> #include <amdis/localoperators/StokesOperator.hpp>
#include <amdis/assembler/StokesOperator.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include <iostream> #include <iostream>
#include <amdis/AMDiS.hpp> #include <amdis/AMDiS.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp> #include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
using namespace AMDiS; using namespace AMDiS;
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
// AMDiS includes // AMDiS includes
#include <amdis/Output.hpp> #include <amdis/Output.hpp>
#include <amdis/common/ConceptsBase.hpp> #include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/Math.hpp> #include <amdis/typetree/TreePath.hpp>
#include <amdis/utility/TreePath.hpp>
namespace AMDiS namespace AMDiS
{ {
......
#pragma once #pragma once
#include <functional>
#include <memory>
#include <type_traits>
#include <dune/common/shared_ptr.hh>
#include <dune/geometry/quadraturerules.hh>
#include <amdis/ContextGeometry.hpp>
#include <amdis/AssemblerInterface.hpp>
#include <amdis/common/Concepts.hpp>
#include <amdis/typetree/FiniteElementType.hpp>
namespace AMDiS namespace AMDiS
{ {
template <class ElementAssembler, class IntersectionAssembler, class BoundaryAssembler> /// Implementation of interface \ref AssemblerBase
struct AssemblerTriple template <class LocalContext, class Operator, class... Nodes>
class Assembler
: public AssemblerInterface<LocalContext, Nodes...>
{ {
ElementAssembler elementAssembler; using Super = AssemblerInterface<LocalContext, Nodes...>;
IntersectionAssembler intersectionAssembler;
BoundaryAssembler boundaryAssembler;
};
template <class EA, class IA, class BA> private:
AssemblerTriple<EA, IA, BA> makeAssemblerTriple(EA const& ea, IA const& ia, BA const& ba)
{
return {ea, ia, ba};
}
using Element = typename Super::Element;
using Geometry = typename Super::Geometry;
using ElementMatrixVector = typename Super::ElementMatrixVector;
template <class GridView, class Element, class Operators, class EA, class IA, class BA> public:
void assembleOperators(
GridView const& gridView, /// Constructor. Stores a copy of operator `op`.
Element const& element, explicit Assembler(Operator const& op)
Operators& operators, : op_(Dune::wrap_or_move(op))
AssemblerTriple<EA,IA,BA> const& assemblerTriple) {}
{
// assemble element operators /// Constructor. Stores a copy of operator `op`.
assemblerTriple.elementAssembler(element, operators.onElement()); explicit Assembler(Operator&& op)
: op_(Dune::wrap_or_move(std::move(op)))
{}
/// Constructor. Stores the reference to the operator.
explicit Assembler(std::reference_wrapper<Operator> op)
: op_(Dune::wrap_or_move(op.get()))
{}
// assemble intersection operators /// \brief Implementation of \ref AssemblerInterface::bind.
if (!operators.onIntersection().empty() /**
|| (!operators.onBoundary().empty() && element.hasBoundaryIntersections())) * Binds the operator `op_` to the `element` and `geometry` and
* stores point to the `element` and `geometry`.
**/
void bind(Element const& element, Geometry const& geometry) final
{ {
for (auto const& intersection : intersections(gridView, element)) { element_ = &element;
if (intersection.boundary()) geometry_ = &geometry;
assemblerTriple.boundaryAssembler(intersection, operators.onBoundary()); op_->bind(element, geometry);
else
assemblerTriple.intersectionAssembler(intersection, operators.onIntersection());
}
} }
}
/// \brief Implementation of \ref AssemblerBase::unbind
/**
* Unbinds the operator `op_` and sets \ref element_ and \ref geometry_
* to nullptr.
**/
void unbind() final
{
op_->unbind();
geometry_ = nullptr;
element_ = nullptr;
}
template <class Node, class ElementVector> /// Implementation of \ref AssemblerBase::assemble
auto makeVectorAssembler(Node const& node, ElementVector& elementVector) /**
{ * Stores geometry and localGeometry and calls
return makeAssemblerTriple( * \ref calculateElementVector or \ref calculateElementMatrix on the
[&](auto const& element, auto& operators) { * vector or matrix operator, respectively.
for (auto op : operators) **/
op->assemble(element, node, elementVector); void assemble(LocalContext const& localContext,
}, Nodes const&... nodes,
[&](auto const& is, auto& operators) { ElementMatrixVector& elementMatrixVector) final
for (auto op : operators) {
op->assemble(is, node, elementVector); ContextGeometry<LocalContext> context{localContext, element(), geometry()};
}, assembleImpl(context, nodes..., elementMatrixVector);
[&](auto const& bis, auto& operators) { }
for (auto data : operators) {
if (data.bc.onBoundary(bis))
data.op->assemble(bis, node, elementVector); #ifndef DOXYGEN
}
}); protected: // implementation detail
}
// matrix assembling
template <class Context, class RowNode, class ColNode, class ElementMatrix>
void assembleImpl(Context const& context,
RowNode const& rowNode, ColNode const& colNode,
ElementMatrix& elementMatrix)
{
op_->calculateElementMatrix(context, rowNode, colNode, elementMatrix);
}
// vector assembling
template <class Context, class Node, class ElementVector>
void assembleImpl(Context const& context,
Node const& node,
ElementVector& elementVector)
{
op_->calculateElementVector(context, node, elementVector);
}
#endif // DOXYGEN
public:
/// return the bound entity (of codim 0)
Element const& element() const
{
assert( element_ );
return *element_;
}
/// return the geometry of the bound element
Geometry const& geometry() const
{
assert( geometry_ );
return *geometry_;
}
private:
/// the stored operator, implementing \ref GridFunctionOperatorBase
std::shared_ptr<Operator> op_;
Element const* element_ = nullptr;
Geometry const* geometry_ = nullptr;
};
template <class RowNode, class ColNode, class ElementMatrix> /// Generate a \ref Assembler on a given `LocalContext` (element or intersection)
auto makeMatrixAssembler(RowNode const& rowNode, ColNode const& colNode, ElementMatrix& elementMatrix) template <class LocalContext, class Operator, class... Nodes>
auto makeAssembler(Operator&& op, Nodes const&...)
{ {
return makeAssemblerTriple( return Assembler<LocalContext, Underlying_t<Operator>, Nodes...>{std::forward<Operator>(op)};
[&](auto const& element, auto& operators) {
for (auto op : operators)
op->assemble(element, rowNode, colNode, elementMatrix);
},
[&](auto const& is, auto& operators) {
for (auto op : operators)
op->assemble(is, rowNode, colNode, elementMatrix);
},
[&](auto const& bis, auto& operators) {
for (auto data : operators) {
if (data.bc.onBoundary(bis))
data.op->assemble(bis, rowNode, colNode, elementMatrix);
}
});
} }
} // end namespace AMDiS } // end namespace AMDiS
...@@ -9,13 +9,15 @@ ...@@ -9,13 +9,15 @@
namespace AMDiS namespace AMDiS
{ {
/// Abstract base-class of a \ref LocalAssembler /// Abstract base-class of a \ref Assembler
template <class LocalContext, class... Nodes> template <class LocalContext, class... Nodes>
class LocalAssemblerBase class AssemblerInterface
{ {
using ContextType = Impl::ContextTypes<LocalContext>;
public: public:
/// The codim=0 grid entity /// The codim=0 grid entity
using Element = typename Impl::ContextTypes<LocalContext>::Entity; using Element = typename ContextType::Entity;
/// The geometry of the \ref Element /// The geometry of the \ref Element
using Geometry = typename Element::Geometry; using Geometry = typename Element::Geometry;
...@@ -33,7 +35,7 @@ namespace AMDiS ...@@ -33,7 +35,7 @@ namespace AMDiS
public: public:
/// Virtual destructor /// Virtual destructor
virtual ~LocalAssemblerBase() = default; virtual ~AssemblerInterface() = default;
/// Bind the local-assembler to the grid-element with its corresponding geometry /// Bind the local-assembler to the grid-element with its corresponding geometry
virtual void bind(Element const& element, Geometry const& geometry) = 0; virtual void bind(Element const& element, Geometry const& geometry) = 0;
......
...@@ -20,13 +20,18 @@ install(FILES ...@@ -20,13 +20,18 @@ install(FILES
AdaptStationary.hpp AdaptStationary.hpp
AMDiS.hpp AMDiS.hpp
Assembler.hpp Assembler.hpp
AssemblerInterface.hpp
Boundary.hpp Boundary.hpp
BoundaryCondition.hpp
BoundaryManager.hpp
ContextGeometry.hpp ContextGeometry.hpp
CreatorInterface.hpp CreatorInterface.hpp
CreatorMap.hpp CreatorMap.hpp
DataTransfer.hpp DataTransfer.hpp
DataTransfer.inc.hpp