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

Cleanup of directory structure and removed obsolete files and functions

parent 0ef5f46a
......@@ -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
std::logical_and<bool>());
}
template <class GV, int k, class TP, class Container, class Basis>
template <class Node, class Container, class Basis>
template <class Trafo>
void NodeDataTransfer<Dune::Functions::LagrangeNode<GV,k,TP>, Container, Basis>::
void NodeDataTransfer<Node, Container, Basis>::
prolongLocal(Element const& father, NodeElementData const& fatherDOFs,
Trafo const& trafo, bool init)
{
......
......@@ -10,9 +10,9 @@
#include <amdis/Boundary.hpp>
#include <amdis/BoundaryCondition.hpp>
#include <amdis/common/Concepts.hpp>
#include <amdis/utility/RangeType.hpp>
#include <amdis/utility/TreeData.hpp>
#include <amdis/utility/Visitor.hpp>
#include <amdis/typetree/RangeType.hpp>
#include <amdis/typetree/TreeData.hpp>
#include <amdis/typetree/Visitor.hpp>
namespace AMDiS
{
......
......@@ -8,7 +8,7 @@
#include <dune/functions/functionspacebases/subspacebasis.hh>
#include <amdis/Output.hpp>
#include <amdis/linear_algebra/Constraints.hpp>
#include <amdis/linearalgebra/Constraints.hpp>
namespace AMDiS {
......
......@@ -9,12 +9,12 @@
//#include <dune/geometry/referenceelements.hh>
#include <dune/typetree/childextraction.hh>
#include <amdis/FileWriterInterface.hpp>
#include <amdis/Initfile.hpp>
#include <amdis/common/Size.hpp>
#include <amdis/common/Filesystem.hpp>
#include <amdis/common/StaticSize.hpp>
#include <amdis/common/ValueCategory.hpp>
#include <amdis/gridfunctions/DiscreteFunction.hpp>
#include <amdis/io/FileWriterInterface.hpp>
#include <amdis/utility/Filesystem.hpp>
namespace AMDiS
{
......
......@@ -4,7 +4,7 @@
#include <amdis/Initfile.hpp>
#include <amdis/Output.hpp>
#include <amdis/utility/Filesystem.hpp>
#include <amdis/common/Filesystem.hpp>
namespace AMDiS
{
......
......@@ -5,10 +5,10 @@
#include <amdis/GridFunctions.hpp>
#include <amdis/LocalOperator.hpp>
#include <amdis/QuadratureFactory.hpp>
#include <amdis/common/Transposed.hpp>
#include <amdis/common/Utility.hpp>
#include <amdis/utility/FiniteElementType.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <amdis/typetree/FiniteElementType.hpp>
#include <amdis/utility/QuadratureFactory.hpp>
namespace AMDiS
{
......@@ -18,7 +18,7 @@ namespace AMDiS
**/
/// \brief The main implementation of an CRTP-base class for operators using a grid-function
/// coefficient to be used in a \ref LocalAssembler.
/// coefficient to be used in an \ref Assembler.
/**
* An Operator that takes a GridFunction as coefficient.
* Provides quadrature rules and handles the evaluation of the GridFunction at
......@@ -39,11 +39,19 @@ namespace AMDiS
class GridFunctionOperatorBase
: public LocalOperator<Derived, LocalContext>
{
template <class D, class LC>
friend class LocalOperator;
using ContextType = Impl::ContextTypes<LocalContext>;
using Super = LocalOperator<Derived, LocalContext>;
private:
/// The type of the localFunction associated with the GridFunction
using LocalFunction = decltype(localFunction(std::declval<GridFunction>()));
/// The Codim=0 entity of the grid, the localFunction can be bound to
using Element = typename Impl::ContextTypes<LocalContext>::Entity;
using Element = typename ContextType::Entity;
/// The geometry-type of the grid element
using Geometry = typename Element::Geometry;
......@@ -66,30 +74,6 @@ namespace AMDiS
, termOrder_(termOrder)
{}
/// \brief Binds operator to `element` and `geometry`.
/**
* Binding an operator to the currently visited element in grid traversal.
* Since all operators need geometry information, the `Element::Geometry`
* object `geometry` is created once, during grid traversal, and passed in.
*
* By default, it binds the \ref localFct_ to the `element` and the Quadrature
* factory to the localFunction.
**/
void bind_impl(Element const& element, Geometry const& geometry)
{
assert( bool(quadFactory_) );
localFct_.emplace(localFunction(gridFct_));
localFct_->bind(element);
quadFactory_->bind(localFct_.value());
}
/// Unbinds operator from element.
void unbind_impl()
{
localFct_->unbind();
localFct_.reset();
}
/// Create a quadrature factory from a PreQuadratureFactory, e.g. class derived from \ref QuadratureFactory
template <class PreQuadFactory>
void setQuadFactory(PreQuadFactory&& pre)
......@@ -117,6 +101,31 @@ namespace AMDiS
return quadFactory_->rule(type, quadDegree);
}
private:
/// \brief Binds operator to `element` and `geometry`.
/**
* Binding an operator to the currently visited element in grid traversal.
* Since all operators need geometry information, the `Element::Geometry`
* object `geometry` is created once, during grid traversal, and passed in.
*
* By default, it binds the \ref localFct_ to the `element` and the Quadrature
* factory to the localFunction.
**/
void bind_impl(Element const& element, Geometry const& geometry)
{
assert( bool(quadFactory_) );
localFct_.emplace(localFunction(gridFct_));
localFct_->bind(element);
quadFactory_->bind(localFct_.value());
}
/// Unbinds operator from element.
void unbind_impl()
{
localFct_->unbind();
localFct_.reset();
}
private:
/// The gridFunction to be used within the operator
GridFunction gridFct_;
......@@ -138,6 +147,9 @@ namespace AMDiS
class GridFunctionOperatorTransposed
: public LocalOperator<Derived, typename Transposed::LocalContext>
{
template <class D, class LC>
friend class LocalOperator;
template <class T, class... Args>
using Constructable = decltype( new T(std::declval<Args>()...) );
......@@ -148,24 +160,25 @@ namespace AMDiS
: transposedOp_(std::forward<Args>(args)...)
{}
/// Redirects the setQuadFactory call top the transposed operator
template <class PreQuadFactory>
void setQuadFactory(PreQuadFactory&& pre)
{
transposedOp_.setQuadFactory(std::forward<PreQuadFactory>(pre));
}
private:
/// Redirects the bind call top the transposed operator
template <class Element, class Geometry>
void bind_impl(Element const& element, Geometry const& geometry)
{
transposedOp_.bind_impl(element, geometry);
transposedOp_.bind(element, geometry);
}
/// Redirects the unbind call top the transposed operator
void unbind_impl()
{
transposedOp_.unbind_impl();
}
/// Redirects the setQuadFactory call top the transposed operator
template <class PreQuadFactory>
void setQuadFactory(PreQuadFactory&& pre)
{
transposedOp_.setQuadFactory(std::forward<PreQuadFactory>(pre));
transposedOp_.unbind();
}
/// Apply the assembling to the transposed elementMatrix with interchanged row-/colNode
......
......@@ -2,9 +2,8 @@
#include <list>
#include <amdis/linear_algebra/DOFVectorInterface.hpp>
#include <amdis/Output.hpp>
#include <amdis/linearalgebra/DOFVectorInterface.hpp>
namespace AMDiS
{
......
......@@ -5,7 +5,7 @@
#include <memory>
#include <amdis/GridTransfer.hpp>
#include <amdis/utility/ConcurrentCache.hpp>
#include <amdis/common/ConcurrentCache.hpp>
namespace AMDiS
{
......
#include <amdis/InitfileParser.hpp>
#include <amdis/Output.hpp>
#include <amdis/utility/Filesystem.hpp>
#include <amdis/utility/String.hpp>
#include <amdis/common/Filesystem.hpp>
#include <amdis/common/String.hpp>
namespace AMDiS {
......@@ -66,6 +66,7 @@ void InitfileParser::readInitfile(std::istream& in, Dune::ParameterTree& pt, boo
switch (char c = swap[pos++]) {
case '<':
c= '>';
// [[fallthrough]];
case '\"':
delimiter += c;
epos = sw.find_first_of(delimiter, pos);
......
......@@ -3,7 +3,6 @@
#include <type_traits>
#include <dune/geometry/quadraturerules.hh>
#include <amdis/GridFunctions.hpp>
#include <amdis/common/Mpl.hpp>
namespace AMDiS
{
......@@ -68,7 +67,7 @@ namespace AMDiS
auto makeQuad = [](auto&& t, auto&& lf) { return Rules::rule(t, order(lf)); };
return Impl::integrateImpl(std::forward<decltype(gridFct)>(gridFct), gridView, makeQuad,
bool_<expr_has_order>);
std::integral_constant<bool,expr_has_order>{});
}
......
#pragma once
#include <amdis/linearalgebra/LinearSolver.hpp>
#include <amdis/linearalgebra/SolverInfo.hpp>
#if HAVE_MTL
#include <amdis/linear_algebra/mtl/Constraints.hpp>
#include <amdis/linear_algebra/mtl/DOFMatrix.hpp>
#include <amdis/linear_algebra/mtl/DOFVector.hpp>
#include <amdis/linearalgebra/mtl/Constraints.hpp>
#include <amdis/linearalgebra/mtl/DOFMatrix.hpp>
#include <amdis/linearalgebra/mtl/DOFVector.hpp>
#include <amdis/linearalgebra/mtl/ITL_Solver.hpp>
#include <amdis/linearalgebra/mtl/ITL_Preconditioner.hpp>
#elif HAVE_EIGEN
#include <amdis/linear_algebra/eigen/Constraints.hpp>
#include <amdis/linear_algebra/eigen/DOFMatrix.hpp>
#include <amdis/linear_algebra/eigen/DOFVector.hpp>
#include <amdis/linearalgebra/eigen/Constraints.hpp>
#include <amdis/linearalgebra/eigen/DOFMatrix.hpp>
#include <amdis/linearalgebra/eigen/DOFVector.hpp>
#include <amdis/linearalgebra/eigen/SolverCreator.hpp>
#else // ISTL
#include <amdis/linear_algebra/istl/Constraints.hpp>
#include <amdis/linear_algebra/istl/DOFMatrix.hpp>
#include <amdis/linear_algebra/istl/DOFVector.hpp>
#include <amdis/linearalgebra/istl/Constraints.hpp>
#include <amdis/linearalgebra/istl/DOFMatrix.hpp>
#include <amdis/linearalgebra/istl/DOFVector.hpp>
#include <amdis/linearalgebra/istl/ISTL_Solver.hpp>
#include <amdis/linearalgebra/istl/ISTL_Preconditioner.hpp>
#endif
\ No newline at end of file
#pragma once
#include <amdis/linear_algebra/LinearSolver.hpp>
#include <amdis/linear_algebra/SolverInfo.hpp>
#if HAVE_MTL
#include <amdis/linear_algebra/mtl/ITL_Solver.hpp>
#include <amdis/linear_algebra/mtl/ITL_Preconditioner.hpp>
#elif HAVE_EIGEN
#include <amdis/linear_algebra/eigen/SolverCreator.hpp>
#else // ISTL
#include <amdis/linear_algebra/istl/ISTL_Solver.hpp>
#include <amdis/linear_algebra/istl/ISTL_Preconditioner.hpp>
#endif
\ No newline at end of file
#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/LocalAssemblerBase.hpp>
#include <amdis/common/Concepts.hpp>
#include <amdis/utility/FiniteElementType.hpp>
namespace AMDiS
{
/// Implementation of interface \ref LocalAssemblerBase
template <class LocalContext, class Operator, class... Nodes>
class LocalAssembler
: public LocalAssemblerBase<LocalContext, Nodes...>
{
using Super = LocalAssemblerBase<LocalContext, Nodes...>;
private:
using Element = typename Super::Element;
using Geometry = typename Super::Geometry;
using ElementMatrixVector = typename Super::ElementMatrixVector;
public:
/// Constructor. Stores a copy of operator `op`.
explicit LocalAssembler(Operator const& op)
: op_(Dune::wrap_or_move(op))
{}
/// Constructor. Stores a copy of operator `op`.
explicit LocalAssembler(Operator&& op)
: op_(Dune::wrap_or_move(std::move(op)))
{}
/// Constructor. Stores the reference to the operator.
explicit LocalAssembler(std::reference_wrapper<Operator> op)
: op_(Dune::wrap_or_move(op.get()))
{}
/// \brief Implementation of \ref LocalAssemblerBase::bind.
/**
* Binds the operator `op_` to the `element` and `geometry` and
* stores point to the `element` and `geometry`.
**/
virtual void bind(Element const& element, Geometry const& geometry) final
{
element_ = &element;
geometry_ = &geometry;
op_->bind(element, geometry);
}
/// \brief Implementation of \ref LocalAssemblerBase::unbind
/**
* Unbinds the operator `op_` and sets \ref element_ and \ref geometry_
* to nullptr.
**/
virtual void unbind() final
{
op_->unbind();
geometry_ = nullptr;
element_ = nullptr;
}
/// Implementation of \ref LocalAssemblerBase::assemble
/**
* Stores geometry and localGeometry and calls
* \ref calculateElementVector or \ref calculateElementMatrix on the
* vector or matrix operator, respectively.
**/
virtual 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;
};
/// Generate a \ref LocalAssembler on a given `LocalContext` (element or intersection)
template <class LocalContext, class Operator, class... Nodes>
auto makeLocalAssembler(Operator&& op, Nodes const&...)
{
return LocalAssembler<LocalContext, Underlying_t<Operator>, Nodes...>{std::forward<Operator>(op)};
}
} // end namespace AMDiS
......@@ -3,10 +3,11 @@
#include <cassert>
#include <type_traits>
#include <amdis/GridFunctions.hpp>
// #include <amdis/GridFunctions.hpp>
#include <amdis/ContextGeometry.hpp>
#include <amdis/Output.hpp>
#include <amdis/common/Utility.hpp>
#include <amdis/utility/FiniteElementType.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <amdis/typetree/FiniteElementType.hpp>
namespace AMDiS
{
......@@ -15,21 +16,25 @@ namespace AMDiS
* @{
**/
/// \brief The main implementation of an operator to be used in a \ref LocalAssembler.
/// \brief The main implementation of an operator to be used in a \ref Assembler.
/**
* The CRTP Base class for local operators.
*
* \tparam Derived The class that derives from this base class
* \tparam LocalContextType The type of the element or intersection the operator is evaluated on
* \tparam Derived The class that derives from this base class
* \tparam LC The type of the element or intersection the operator is evaluated on
**/
template <class Derived, class LocalContextType>
template <class Derived, class LC>
class LocalOperator
{
using ContextType = Impl::ContextTypes<LC>;
public:
/// The element or intersection the operator is assembled on
using LocalContext = LocalContextType;
using LocalContext = LC;
/// 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;
......@@ -79,6 +84,7 @@ namespace AMDiS
ColNode const& colNode,
ElementMatrix& elementMatrix)
{
assert( bound_ );
derived().getElementMatrix(context, rowNode, colNode, elementMatrix);
}
......@@ -93,6 +99,7 @@ namespace AMDiS
Node const& node,
ElementVector& elementVector)
{
assert( bound_ );
derived().getElementVector(context, node, elementVector);
}
......
#pragma once
#include <amdis/LocalAssembler.hpp>
#include <amdis/Assembler.hpp>
#include <amdis/GridFunctionOperator.hpp>
/*
......@@ -38,29 +38,29 @@
**/
// zero-order operators
#include <amdis/assembler/ZeroOrderTest.hpp> // <psi * c>
#include <amdis/assembler/ZeroOrderTestTrial.hpp> // <psi, c * phi>
#include <amdis/assembler/ZeroOrderTestTrialvec.hpp> // <psi, b * Phi>
#include <amdis/assembler/ZeroOrderTestvec.hpp> // <Psi * b>
#include <amdis/assembler/ZeroOrderTestvecTrial.hpp> // <Psi, b * phi>
#include <amdis/assembler/ZeroOrderTestvecTrialvec.hpp> // <Psi, A * Phi>, <Psi, c * Phi>
#include <amdis/localoperators/ZeroOrderTest.hpp> // <psi * c>
#include <amdis/localoperators/ZeroOrderTestTrial.hpp> // <psi, c * phi>
#include <amdis/localoperators/ZeroOrderTestTrialvec.hpp> // <psi, b * Phi>
#include <amdis/localoperators/ZeroOrderTestvec.hpp> // <Psi * b>
#include <amdis/localoperators/ZeroOrderTestvecTrial.hpp> // <Psi, b * phi>
#include <amdis/localoperators/ZeroOrderTestvecTrialvec.hpp> // <Psi, A * Phi>, <Psi, c * Phi>
// first-order operators
#include <amdis/assembler/FirstOrderPartialTest.hpp> // <d_i(psi), c>
#include <amdis/assembler/FirstOrderGradTest.hpp> // <grad(psi), b>
#include <amdis/assembler/FirstOrderDivTestvec.hpp> // <div(Psi), c>
#include <amdis/localoperators/FirstOrderPartialTest.hpp> // <d_i(psi), c>
#include <amdis/localoperators/FirstOrderGradTest.hpp> // <grad(psi), b>
#include <amdis/localoperators/FirstOrderDivTestvec.hpp> // <div(Psi), c>
#include <amdis/assembler/FirstOrderDivTestvecTrial.hpp> // <div(Psi), c * phi>
#include <amdis/assembler/FirstOrderGradTestTrial.hpp> // <grad(psi), b * phi>
#include <amdis/assembler/FirstOrderGradTestTrialvec.hpp> // <grad(psi), c * Phi>
#include <amdis/assembler/FirstOrderPartialTestTrial.hpp> // <d_i(psi), c * psi>
#include <amdis/assembler/FirstOrderTestDivTrialvec.hpp> // <psi, c * div(Phi)>
#include <amdis/assembler/FirstOrderTestGradTrial.hpp> // <psi, b * grad(phi)>
#include <amdis/assembler/FirstOrderTestPartialTrial.hpp> // <psi, c * d_i(phi)>
#include <amdis/assembler/FirstOrderTestvecGradTrial.hpp> // <Psi, c * grad(phi)>
#include <amdis/localoperators/FirstOrderDivTestvecTrial.hpp> // <div(Psi), c * phi>