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

Merge branch 'feature/remove_unused_functions' into 'develop'

Cleanup of directory structure and removed obsolete files and functions

See merge request spraetor/dune-amdis!51
parents 0ef5f46a f688bc11
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
#include <dune/functions/functionspacebases/lagrangebasis.hh> #include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <amdis/Output.hpp> #include <amdis/Output.hpp>
#include <amdis/utility/ConcurrentCache.hpp> #include <amdis/common/ConcurrentCache.hpp>
#include <amdis/utility/TreeContainer.hpp> #include <amdis/typetree/TreeContainer.hpp>
#include <amdis/utility/Visitor.hpp> #include <amdis/typetree/Visitor.hpp>
namespace AMDiS namespace AMDiS
{ {
template <class Node, class Container, class Basis> template <class Node, class Container, class Basis>
class NodeDataTransfer {}; class NodeDataTransfer;
/** Data Transfer implementation for a single grid /** Data Transfer implementation for a single grid
...@@ -292,14 +292,13 @@ namespace AMDiS ...@@ -292,14 +292,13 @@ namespace AMDiS
/** Element-local data transfer on a single leaf node of the basis tree /** Element-local data transfer on a single leaf node of the basis tree
* Handles computations related to the finite element basis node * Handles computations related to the finite element basis node
*/ */
template <class GV, int k, class TP, class Container, class Basis> template <class Node, class Container, class Basis>
class NodeDataTransfer<Dune::Functions::LagrangeNode<GV,k,TP>, Container, Basis> class NodeDataTransfer
{ {
using T = typename Container::value_type; using T = typename Container::value_type;
using LocalView = typename Basis::LocalView; 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 LocalBasis = typename Node::FiniteElement::Traits::LocalBasisType;
using LBRangeType = typename LocalBasis::Traits::RangeType; using LBRangeType = typename LocalBasis::Traits::RangeType;
using LocalInterpolation = typename Node::FiniteElement::Traits::LocalBasisType; using LocalInterpolation = typename Node::FiniteElement::Traits::LocalBasisType;
...@@ -373,9 +372,9 @@ namespace AMDiS ...@@ -373,9 +372,9 @@ namespace AMDiS
NodeElementData fatherDOFsTemp_; NodeElementData fatherDOFsTemp_;
}; };
template <class GV, int k, class TP, class Container, class Basis> template <class Node, class Container, class Basis>
template <class Trafo> 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, restrictLocal(Element const& father, NodeElementData& fatherDOFs, Trafo const& trafo,
NodeElementData const& childDOFs, bool init) NodeElementData const& childDOFs, bool init)
{ {
...@@ -429,9 +428,9 @@ namespace AMDiS ...@@ -429,9 +428,9 @@ namespace AMDiS
std::logical_and<bool>()); 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> 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, prolongLocal(Element const& father, NodeElementData const& fatherDOFs,
Trafo const& trafo, bool init) Trafo const& trafo, bool init)
{ {
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
#include <amdis/Boundary.hpp> #include <amdis/Boundary.hpp>
#include <amdis/BoundaryCondition.hpp> #include <amdis/BoundaryCondition.hpp>
#include <amdis/common/Concepts.hpp> #include <amdis/common/Concepts.hpp>
#include <amdis/utility/RangeType.hpp> #include <amdis/typetree/RangeType.hpp>
#include <amdis/utility/TreeData.hpp> #include <amdis/typetree/TreeData.hpp>
#include <amdis/utility/Visitor.hpp> #include <amdis/typetree/Visitor.hpp>
namespace AMDiS namespace AMDiS
{ {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <dune/functions/functionspacebases/subspacebasis.hh> #include <dune/functions/functionspacebases/subspacebasis.hh>
#include <amdis/Output.hpp> #include <amdis/Output.hpp>
#include <amdis/linear_algebra/Constraints.hpp> #include <amdis/linearalgebra/Constraints.hpp>
namespace AMDiS { namespace AMDiS {
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
//#include <dune/geometry/referenceelements.hh> //#include <dune/geometry/referenceelements.hh>
#include <dune/typetree/childextraction.hh> #include <dune/typetree/childextraction.hh>
#include <amdis/FileWriterInterface.hpp>
#include <amdis/Initfile.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/common/ValueCategory.hpp>
#include <amdis/gridfunctions/DiscreteFunction.hpp> #include <amdis/gridfunctions/DiscreteFunction.hpp>
#include <amdis/io/FileWriterInterface.hpp>
#include <amdis/utility/Filesystem.hpp>
namespace AMDiS namespace AMDiS
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <amdis/Initfile.hpp> #include <amdis/Initfile.hpp>
#include <amdis/Output.hpp> #include <amdis/Output.hpp>
#include <amdis/utility/Filesystem.hpp> #include <amdis/common/Filesystem.hpp>
namespace AMDiS namespace AMDiS
{ {
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
#include <amdis/GridFunctions.hpp> #include <amdis/GridFunctions.hpp>
#include <amdis/LocalOperator.hpp> #include <amdis/LocalOperator.hpp>
#include <amdis/QuadratureFactory.hpp>
#include <amdis/common/Transposed.hpp> #include <amdis/common/Transposed.hpp>
#include <amdis/common/Utility.hpp> #include <amdis/common/TypeTraits.hpp>
#include <amdis/utility/FiniteElementType.hpp> #include <amdis/typetree/FiniteElementType.hpp>
#include <amdis/utility/QuadratureFactory.hpp>
namespace AMDiS namespace AMDiS
{ {
...@@ -18,7 +18,7 @@ namespace AMDiS ...@@ -18,7 +18,7 @@ namespace AMDiS
**/ **/
/// \brief The main implementation of an CRTP-base class for operators using a grid-function /// \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. * An Operator that takes a GridFunction as coefficient.
* Provides quadrature rules and handles the evaluation of the GridFunction at * Provides quadrature rules and handles the evaluation of the GridFunction at
...@@ -39,11 +39,19 @@ namespace AMDiS ...@@ -39,11 +39,19 @@ namespace AMDiS
class GridFunctionOperatorBase class GridFunctionOperatorBase
: public LocalOperator<Derived, LocalContext> : 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 /// The type of the localFunction associated with the GridFunction
using LocalFunction = decltype(localFunction(std::declval<GridFunction>())); using LocalFunction = decltype(localFunction(std::declval<GridFunction>()));
/// The Codim=0 entity of the grid, the localFunction can be bound to /// 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 /// The geometry-type of the grid element
using Geometry = typename Element::Geometry; using Geometry = typename Element::Geometry;
...@@ -66,30 +74,6 @@ namespace AMDiS ...@@ -66,30 +74,6 @@ namespace AMDiS
, termOrder_(termOrder) , 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 /// Create a quadrature factory from a PreQuadratureFactory, e.g. class derived from \ref QuadratureFactory
template <class PreQuadFactory> template <class PreQuadFactory>
void setQuadFactory(PreQuadFactory&& pre) void setQuadFactory(PreQuadFactory&& pre)
...@@ -117,6 +101,31 @@ namespace AMDiS ...@@ -117,6 +101,31 @@ namespace AMDiS
return quadFactory_->rule(type, quadDegree); 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: private:
/// The gridFunction to be used within the operator /// The gridFunction to be used within the operator
GridFunction gridFct_; GridFunction gridFct_;
...@@ -138,6 +147,9 @@ namespace AMDiS ...@@ -138,6 +147,9 @@ namespace AMDiS
class GridFunctionOperatorTransposed class GridFunctionOperatorTransposed
: public LocalOperator<Derived, typename Transposed::LocalContext> : public LocalOperator<Derived, typename Transposed::LocalContext>
{ {
template <class D, class LC>
friend class LocalOperator;
template <class T, class... Args> template <class T, class... Args>
using Constructable = decltype( new T(std::declval<Args>()...) ); using Constructable = decltype( new T(std::declval<Args>()...) );
...@@ -148,24 +160,25 @@ namespace AMDiS ...@@ -148,24 +160,25 @@ namespace AMDiS
: transposedOp_(std::forward<Args>(args)...) : 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 /// Redirects the bind call top the transposed operator
template <class Element, class Geometry> template <class Element, class Geometry>
void bind_impl(Element const& element, Geometry const& 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 /// Redirects the unbind call top the transposed operator
void unbind_impl() void unbind_impl()
{ {
transposedOp_.unbind_impl(); transposedOp_.unbind();
}
/// Redirects the setQuadFactory call top the transposed operator
template <class PreQuadFactory>
void setQuadFactory(PreQuadFactory&& pre)
{
transposedOp_.setQuadFactory(std::forward<PreQuadFactory>(pre));
} }
/// Apply the assembling to the transposed elementMatrix with interchanged row-/colNode /// Apply the assembling to the transposed elementMatrix with interchanged row-/colNode
......
...@@ -2,9 +2,8 @@ ...@@ -2,9 +2,8 @@
#include <list> #include <list>
#include <amdis/linear_algebra/DOFVectorInterface.hpp>
#include <amdis/Output.hpp> #include <amdis/Output.hpp>
#include <amdis/linearalgebra/DOFVectorInterface.hpp>
namespace AMDiS namespace AMDiS
{ {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <memory> #include <memory>
#include <amdis/GridTransfer.hpp> #include <amdis/GridTransfer.hpp>
#include <amdis/utility/ConcurrentCache.hpp> #include <amdis/common/ConcurrentCache.hpp>
namespace AMDiS namespace AMDiS
{ {
......
#include <amdis/InitfileParser.hpp> #include <amdis/InitfileParser.hpp>
#include <amdis/Output.hpp> #include <amdis/Output.hpp>
#include <amdis/utility/Filesystem.hpp> #include <amdis/common/Filesystem.hpp>
#include <amdis/utility/String.hpp> #include <amdis/common/String.hpp>
namespace AMDiS { namespace AMDiS {
...@@ -66,6 +66,7 @@ void InitfileParser::readInitfile(std::istream& in, Dune::ParameterTree& pt, boo ...@@ -66,6 +66,7 @@ void InitfileParser::readInitfile(std::istream& in, Dune::ParameterTree& pt, boo
switch (char c = swap[pos++]) { switch (char c = swap[pos++]) {
case '<': case '<':
c= '>'; c= '>';
// [[fallthrough]];
case '\"': case '\"':
delimiter += c; delimiter += c;
epos = sw.find_first_of(delimiter, pos); epos = sw.find_first_of(delimiter, pos);
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include <type_traits> #include <type_traits>
#include <dune/geometry/quadraturerules.hh> #include <dune/geometry/quadraturerules.hh>
#include <amdis/GridFunctions.hpp> #include <amdis/GridFunctions.hpp>
#include <amdis/common/Mpl.hpp>
namespace AMDiS namespace AMDiS
{ {
...@@ -68,7 +67,7 @@ namespace AMDiS ...@@ -68,7 +67,7 @@ namespace AMDiS
auto makeQuad = [](auto&& t, auto&& lf) { return Rules::rule(t, order(lf)); }; auto makeQuad = [](auto&& t, auto&& lf) { return Rules::rule(t, order(lf)); };
return Impl::integrateImpl(std::forward<decltype(gridFct)>(gridFct), gridView, makeQuad, return Impl::integrateImpl(std::forward<decltype(gridFct)>(gridFct), gridView, makeQuad,
bool_<expr_has_order>); std::integral_constant<bool,expr_has_order>{});
} }
......
#pragma once #pragma once
#include <amdis/linearalgebra/LinearSolver.hpp>
#include <amdis/linearalgebra/SolverInfo.hpp>
#if HAVE_MTL #if HAVE_MTL
#include <amdis/linear_algebra/mtl/Constraints.hpp> #include <amdis/linearalgebra/mtl/Constraints.hpp>
#include <amdis/linear_algebra/mtl/DOFMatrix.hpp> #include <amdis/linearalgebra/mtl/DOFMatrix.hpp>
#include <amdis/linear_algebra/mtl/DOFVector.hpp> #include <amdis/linearalgebra/mtl/DOFVector.hpp>
#include <amdis/linearalgebra/mtl/ITL_Solver.hpp>
#include <amdis/linearalgebra/mtl/ITL_Preconditioner.hpp>
#elif HAVE_EIGEN #elif HAVE_EIGEN
#include <amdis/linear_algebra/eigen/Constraints.hpp> #include <amdis/linearalgebra/eigen/Constraints.hpp>
#include <amdis/linear_algebra/eigen/DOFMatrix.hpp> #include <amdis/linearalgebra/eigen/DOFMatrix.hpp>
#include <amdis/linear_algebra/eigen/DOFVector.hpp> #include <amdis/linearalgebra/eigen/DOFVector.hpp>
#include <amdis/linearalgebra/eigen/SolverCreator.hpp>
#else // ISTL #else // ISTL
#include <amdis/linear_algebra/istl/Constraints.hpp> #include <amdis/linearalgebra/istl/Constraints.hpp>
#include <amdis/linear_algebra/istl/DOFMatrix.hpp> #include <amdis/linearalgebra/istl/DOFMatrix.hpp>
#include <amdis/linear_algebra/istl/DOFVector.hpp> #include <amdis/linearalgebra/istl/DOFVector.hpp>
#include <amdis/linearalgebra/istl/ISTL_Solver.hpp>
#include <amdis/linearalgebra/istl/ISTL_Preconditioner.hpp>
#endif #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_ );