Commit f688bc11 authored by Praetorius, Simon's avatar Praetorius, Simon

Cleanup of directory structure and removed obsolete files and functions

parent 0ef5f46a
......@@ -23,5 +23,10 @@ add_subdirectory("externals")
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_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 \
@top_srcdir@/src/amdis/common \
@top_srcdir@/src/amdis/gridfunctions \
@top_srcdir@/src/amdis/io \
@top_srcdir@/src/amdis/linear_algebra \
@top_srcdir@/src/amdis/linear_algebra/mtl \
@top_srcdir@/src/amdis/linearalgebra \
@top_srcdir@/src/amdis/linearalgebra/mtl \
@top_srcdir@/src/amdis/operations \
@top_srcdir@/src/amdis/utility \
@top_srcdir@/doc
......@@ -45,8 +45,8 @@ INPUT += @top_srcdir@/src/amdis \
# 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.
EXCLUDE += @top_srcdir@/src/amdis/linear_algebra/eigen \
@top_srcdir@/src/amdis/linear_algebra/istl
EXCLUDE += @top_srcdir@/src/amdis/linearalgebra/eigen \
@top_srcdir@/src/amdis/linearalgebra/istl
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
......
......@@ -10,7 +10,7 @@
#include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/common/Literals.hpp>
using namespace AMDiS;
......
......@@ -5,7 +5,7 @@
#include <amdis/AMDiS.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/assembler/ConvectionDiffusionOperator.hpp>
#include <amdis/localoperators/ConvectionDiffusionOperator.hpp>
#include <amdis/common/Literals.hpp>
using namespace AMDiS;
......
......@@ -5,8 +5,8 @@
#include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/common/Literals.hpp>
using namespace AMDiS;
......
......@@ -5,9 +5,9 @@
#include <amdis/AMDiS.hpp>
#include <amdis/AdaptInstationary.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemInstat.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/GridFunctions.hpp>
#include <amdis/common/Literals.hpp>
......
......@@ -9,10 +9,10 @@
#include <amdis/AMDiS.hpp>
#include <amdis/common/FieldMatVec.hpp>
#include <amdis/AdaptInstationary.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/ProblemInstat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/assembler/StokesOperator.hpp>
#include <amdis/localoperators/StokesOperator.hpp>
using namespace AMDiS;
......
......@@ -14,7 +14,7 @@
#include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/common/Literals.hpp>
using namespace AMDiS;
......
......@@ -10,7 +10,7 @@
#include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/common/Literals.hpp>
using namespace AMDiS;
......
......@@ -7,8 +7,8 @@
#include <cmath>
#include <amdis/AMDiS.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#ifdef DOW
#undef DOW
......
......@@ -7,8 +7,8 @@
#include <cmath>
#include <amdis/AMDiS.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#ifdef DOW
#undef DOW
......
......@@ -7,9 +7,9 @@
#include <cmath>
#include <amdis/AMDiS.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/assembler/StokesOperator.hpp>
#include <amdis/localoperators/StokesOperator.hpp>
using namespace AMDiS;
......
......@@ -5,8 +5,8 @@
#include <iostream>
#include <amdis/AMDiS.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
using namespace AMDiS;
......
......@@ -11,8 +11,7 @@
// AMDiS includes
#include <amdis/Output.hpp>
#include <amdis/common/ConceptsBase.hpp>
#include <amdis/common/Math.hpp>
#include <amdis/utility/TreePath.hpp>
#include <amdis/typetree/TreePath.hpp>
namespace AMDiS
{
......
#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
{
template <class ElementAssembler, class IntersectionAssembler, class BoundaryAssembler>
struct AssemblerTriple
/// Implementation of interface \ref AssemblerBase
template <class LocalContext, class Operator, class... Nodes>
class Assembler
: public AssemblerInterface<LocalContext, Nodes...>
{
ElementAssembler elementAssembler;
IntersectionAssembler intersectionAssembler;
BoundaryAssembler boundaryAssembler;
};
using Super = AssemblerInterface<LocalContext, Nodes...>;
template <class EA, class IA, class BA>
AssemblerTriple<EA, IA, BA> makeAssemblerTriple(EA const& ea, IA const& ia, BA const& ba)
{
return {ea, ia, ba};
}
private:
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>
void assembleOperators(
GridView const& gridView,
Element const& element,
Operators& operators,
AssemblerTriple<EA,IA,BA> const& assemblerTriple)
{
// assemble element operators
assemblerTriple.elementAssembler(element, operators.onElement());
public:
/// Constructor. Stores a copy of operator `op`.
explicit Assembler(Operator const& op)
: op_(Dune::wrap_or_move(op))
{}
/// Constructor. Stores a copy of operator `op`.
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
if (!operators.onIntersection().empty()
|| (!operators.onBoundary().empty() && element.hasBoundaryIntersections()))
/// \brief Implementation of \ref AssemblerInterface::bind.
/**
* 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)) {
if (intersection.boundary())
assemblerTriple.boundaryAssembler(intersection, operators.onBoundary());
else
assemblerTriple.intersectionAssembler(intersection, operators.onIntersection());
}
element_ = &element;
geometry_ = &geometry;
op_->bind(element, geometry);
}
}
/// \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>
auto makeVectorAssembler(Node const& node, ElementVector& elementVector)
{
return makeAssemblerTriple(
[&](auto const& element, auto& operators) {
for (auto op : operators)
op->assemble(element, node, elementVector);
},
[&](auto const& is, auto& operators) {
for (auto op : operators)
op->assemble(is, node, elementVector);
},
[&](auto const& bis, auto& operators) {
for (auto data : operators) {
if (data.bc.onBoundary(bis))
data.op->assemble(bis, node, elementVector);
}
});
}
/// Implementation of \ref AssemblerBase::assemble
/**
* Stores geometry and localGeometry and calls
* \ref calculateElementVector or \ref calculateElementMatrix on the
* vector or matrix operator, respectively.
**/
void assemble(LocalContext const& localContext,
Nodes const&... nodes,
ElementMatrixVector& elementMatrixVector) final
{
ContextGeometry<LocalContext> context{localContext, element(), geometry()};
assembleImpl(context, nodes..., elementMatrixVector);
}
#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>
auto makeMatrixAssembler(RowNode const& rowNode, ColNode const& colNode, ElementMatrix& elementMatrix)
/// Generate a \ref Assembler on a given `LocalContext` (element or intersection)
template <class LocalContext, class Operator, class... Nodes>
auto makeAssembler(Operator&& op, Nodes const&...)
{
return makeAssemblerTriple(
[&](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);
}
});
return Assembler<LocalContext, Underlying_t<Operator>, Nodes...>{std::forward<Operator>(op)};
}
} // end namespace AMDiS
......@@ -9,13 +9,15 @@
namespace AMDiS
{
/// Abstract base-class of a \ref LocalAssembler
/// Abstract base-class of a \ref Assembler
template <class LocalContext, class... Nodes>
class LocalAssemblerBase
class AssemblerInterface
{
using ContextType = Impl::ContextTypes<LocalContext>;
public:
/// The codim=0 grid entity
using Element = typename Impl::ContextTypes<LocalContext>::Entity;
using Element = typename ContextType::Entity;
/// The geometry of the \ref Element
using Geometry = typename Element::Geometry;
......@@ -33,7 +35,7 @@ namespace AMDiS
public:
/// Virtual destructor
virtual ~LocalAssemblerBase() = default;
virtual ~AssemblerInterface() = default;
/// Bind the local-assembler to the grid-element with its corresponding geometry
virtual void bind(Element const& element, Geometry const& geometry) = 0;
......
......@@ -20,13 +20,18 @@ install(FILES
AdaptStationary.hpp
AMDiS.hpp
Assembler.hpp
AssemblerInterface.hpp
Boundary.hpp
BoundaryCondition.hpp
BoundaryManager.hpp
ContextGeometry.hpp
CreatorInterface.hpp
CreatorMap.hpp
DataTransfer.hpp
DataTransfer.inc.hpp
DirichletBC.hpp
FileWriter.hpp
FileWriterInterface.hpp
Flag.hpp
GridFunctionOperator.hpp
GridFunctions.hpp
......@@ -34,18 +39,18 @@ install(FILES
GridTransferManager.hpp
Initfile.hpp
InitfileParser.hpp
Integrate.hpp
LinearAlgebra.hpp
LinearSolvers.hpp
LocalAssembler.hpp
LocalAssemblerBase.hpp
LocalAssemblerList.hpp
LocalOperator.hpp
LocalOperators.hpp
Marker.hpp
Marker.inc.hpp
Mesh.hpp
Operations.hpp
Operators.hpp
OperatorList.hpp
Output.hpp
PeriodicBC.hpp
PeriodicBC.inc.hpp
ProblemInstat.hpp
ProblemInstat.inc.hpp
ProblemInstatBase.hpp
......@@ -55,14 +60,13 @@ install(FILES
ProblemStatBase.hpp
ProblemStatTraits.hpp
ProblemTimeInterface.hpp
QuadratureFactory.hpp
StandardProblemIteration.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amdis)
add_subdirectory("assembler")
add_subdirectory("common")
add_subdirectory("gridfunctions")
add_subdirectory("io")
add_subdirectory("linear_algebra")
add_subdirectory("linearalgebra")
add_subdirectory("localoperators")
add_subdirectory("operations")
add_subdirectory("typetree")
add_subdirectory("utility")
......@@ -37,15 +37,16 @@ namespace AMDiS
* geometry (and localGeometry) of the entity it belongs to, these objects
* are provided as well.
**/
template <class LocalContextType>
template <class LC>
struct ContextGeometry
{
public:
using ContextType = Impl::ContextTypes<LC>;
using LocalContext = LocalContextType;
using Element = typename Impl::ContextTypes<LocalContext>::Entity;
public:
using LocalContext = LC;
using Element = typename ContextType::Entity;
using Geometry = typename Element::Geometry;
using LocalGeometry = typename Impl::ContextTypes<LocalContext>::LocalGeometry;
using LocalGeometry = typename ContextType::LocalGeometry;
using IsEntity = std::is_same<Element, LocalContext>;
......@@ -80,7 +81,7 @@ namespace AMDiS
LocalGeometry const& localGeometry() const
{
return localGeometryImpl(IsEntity{});
return localGeometry_impl(IsEntity{});
}
......@@ -90,7 +91,7 @@ namespace AMDiS
template <class Coordinate>
decltype(auto) local(Coordinate const& p) const
{
return localImpl(p, IsEntity{});
return local_impl(p, IsEntity{});
}
/// Transformation of coordinate `p` given in `localGeometry` to world space coordinates.
......@@ -118,26 +119,26 @@ namespace AMDiS
// position for elements
template <class Coordinate>
Coordinate const& localImpl(Coordinate const& p, std::true_type) const
Coordinate const& local_impl(Coordinate const& p, std::true_type) const
{
return p;
}
// position for intersection
template <class Coordinate>
auto localImpl(Coordinate const& p, std::false_type) const
auto local_impl(Coordinate const& p, std::false_type) const
{
return localGeometry().global(p);
}
// local-geometry is the same as geometry
Geometry const& localGeometryImpl(std::true_type) const
Geometry const& localGeometry_impl(std::true_type) const
{
return *geometry_;
}
// local-geometry of intersection in inside element
LocalGeometry const& localGeometryImpl(std::false_type) const
LocalGeometry const& localGeometry_impl(std::false_type) const
{
if (!localGeometry_)
localGeometry_.emplace(localContext_->geometryInInside());
......
......@@ -3,7 +3,6 @@
#include <memory>
#include <string>
#include <amdis/common/Utility.hpp>
#include <amdis/Output.hpp>
namespace AMDiS
......@@ -56,7 +55,7 @@ namespace AMDiS
* Creates a new instance of the sub class of BaseClass by passing a
* string to the constructor.
*/
virtual std::unique_ptr<BaseClass> create(std::string) = 0;
virtual std::unique_ptr<BaseClass> createWithString(std::string) = 0;
};
......
......@@ -21,14 +21,14 @@
#include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <amdis/Output.hpp>
#include <amdis/utility/ConcurrentCache.hpp>
#include <amdis/utility/TreeContainer.hpp>
#include <amdis/utility/Visitor.hpp>
#include <amdis/common/ConcurrentCache.hpp>
#include <amdis/typetree/TreeContainer.hpp>
#include <amdis/typetree/Visitor.hpp>
namespace AMDiS
{
template <class Node, class Container, class Basis>
class NodeDataTransfer {};
class NodeDataTransfer;
/** Data Transfer implementation for a single grid
......@@ -292,14 +292,13 @@ namespace AMDiS
/** Element-local data transfer on a single leaf node of the basis tree
* Handles computations related to the finite element basis node
*/
template <class GV, int k, class TP, class Container, class Basis>
class NodeDataTransfer<Dune::Functions::LagrangeNode<GV,k,TP>, Container, Basis>
template <class Node, class Container, class Basis>
class NodeDataTransfer
{
using T = typename Container::value_type;
using LocalView = typename Basis::LocalView;
using Element = typename GV::template Codim<0>::Entity;
using Element = typename Node::Element;
using Node = typename Dune::Functions::LagrangeNode<GV,k,TP>;
using LocalBasis = typename Node::FiniteElement::Traits::LocalBasisType;
using LBRangeType = typename LocalBasis::Traits::RangeType;
using LocalInterpolation = typename Node::FiniteElement::Traits::LocalBasisType;
......@@ -373,9 +372,9 @@ namespace AMDiS
NodeElementData fatherDOFsTemp_;
};
template <class GV, int k, class TP, class Container, class Basis>
template <class Node, class Container, class Basis>
template <class Trafo>
bool NodeDataTransfer<Dune::Functions::LagrangeNode<GV,k,TP>, Container, Basis>::
bool NodeDataTransfer<Node, Container, Basis>::
restrictLocal(Element const& father, NodeElementData& fatherDOFs, Trafo const& trafo,
NodeElementData const& childDOFs, bool init)
{
......@@ -429,9 +428,9 @@ namespace AMDiS