Commit 74d0ba92 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'issue/rename_parallel_global_basis' into 'master'

Rename parallel global basis

See merge request amdis/amdis-core!231
parents 21d3a627 77894488
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include <dune/common/concept.hh> #include <dune/common/concept.hh>
#include <dune/common/shared_ptr.hh> #include <dune/common/shared_ptr.hh>
#include <dune/functions/functionspacebases/concepts.hh> #include <dune/functions/functionspacebases/concepts.hh>
#include <amdis/DataTransfer.hpp> #include <amdis/DataTransfer.hpp>
...@@ -13,16 +12,11 @@ ...@@ -13,16 +12,11 @@
#include <amdis/Observer.hpp> #include <amdis/Observer.hpp>
#include <amdis/common/Concepts.hpp> #include <amdis/common/Concepts.hpp>
#include <amdis/common/TypeTraits.hpp> #include <amdis/common/TypeTraits.hpp>
#include <amdis/functions/ParallelGlobalBasis.hpp> #include <amdis/functions/GlobalBasis.hpp>
#include <amdis/typetree/TreePath.hpp> #include <amdis/typetree/TreePath.hpp>
namespace AMDiS namespace AMDiS
{ {
// Forward declarations
template <class PB>
class ParallelGlobalBasis;
/// \brief The basic container that stores a base vector and a corresponding basis /// \brief The basic container that stores a base vector and a corresponding basis
/** /**
* \tparam GB Basis of the vector * \tparam GB Basis of the vector
...@@ -58,7 +52,8 @@ namespace AMDiS ...@@ -58,7 +52,8 @@ namespace AMDiS
using Traits = TraitsType; using Traits = TraitsType;
public: public:
/// (1) Constructor. Stores the shared_ptr of the basis and creates a new DataTransfer. /// (1) Constructor. Stores the shared_ptr of the basis and creates a new
/// DataTransfer.
DOFVector(std::shared_ptr<GB> const& basis, DOFVector(std::shared_ptr<GB> const& basis,
DataTransferOperation op = DataTransferOperation::INTERPOLATE) DataTransferOperation op = DataTransferOperation::INTERPOLATE)
: Coefficients(*basis) : Coefficients(*basis)
...@@ -77,10 +72,12 @@ namespace AMDiS ...@@ -77,10 +72,12 @@ namespace AMDiS
: DOFVector(Dune::wrap_or_move(FWD(basis)), op) : DOFVector(Dune::wrap_or_move(FWD(basis)), op)
{} {}
/// (3) Constructor. Forwards to (1) by creating a new basis from a dune-functions pre-basis factory. /// (3) Constructor. Forwards to (1) by creating a new basis from a dune-functions
/// pre-basis factory.
template <class GV, class PBF, template <class GV, class PBF,
REQUIRES(Concepts::PreBasisFactory<PBF, GV, MultiIndex_t<PBF>>)> REQUIRES(Concepts::PreBasisFactory<PBF, GV, MultiIndex_t<PBF>>)>
DOFVector(GV const& gridView, PBF const& preBasisFactory, DataTransferOperation op = DataTransferOperation::INTERPOLATE) DOFVector(GV const& gridView, PBF const& preBasisFactory,
DataTransferOperation op = DataTransferOperation::INTERPOLATE)
: DOFVector(std::make_shared<GB>(gridView, preBasisFactory), op) : DOFVector(std::make_shared<GB>(gridView, preBasisFactory), op)
{} {}
...@@ -151,15 +148,15 @@ namespace AMDiS ...@@ -151,15 +148,15 @@ namespace AMDiS
protected: protected:
/// Override of Observer update(event::preAdapt) method. Redirects to preAdapt method of the /// Override of Observer update(event::preAdapt) method. Redirects to preAdapt
/// \ref DataTransfer object. /// method of the \ref DataTransfer object.
void updateImpl(event::preAdapt e) override void updateImpl(event::preAdapt e) override
{ {
dataTransfer_.preAdapt(*this, e.value); dataTransfer_.preAdapt(*this, e.value);
} }
/// Override of Observer update(event::adapt) method. Redirects to adapt method of the /// Override of Observer update(event::adapt) method. Redirects to adapt method
/// \ref DataTransfer object. /// of the \ref DataTransfer object.
void updateImpl(event::adapt e) override void updateImpl(event::adapt e) override
{ {
assert(e.value); assert(e.value);
...@@ -167,8 +164,8 @@ namespace AMDiS ...@@ -167,8 +164,8 @@ namespace AMDiS
dataTransfer_.adapt(*this); dataTransfer_.adapt(*this);
} }
/// Override of Observer update(event::postAdapt) method. Redirects to postAdapt method of the /// Override of Observer update(event::postAdapt) method. Redirects to postAdapt
/// \ref DataTransfer object. /// method of the \ref DataTransfer object.
void updateImpl(event::postAdapt) override void updateImpl(event::postAdapt) override
{ {
dataTransfer_.postAdapt(*this); dataTransfer_.postAdapt(*this);
...@@ -189,8 +186,9 @@ namespace AMDiS ...@@ -189,8 +186,9 @@ namespace AMDiS
-> DOFVector<Underlying_t<GB>>; -> DOFVector<Underlying_t<GB>>;
template <class GV, class PBF> template <class GV, class PBF>
DOFVector(GV const& gridView, PBF const& pbf, DataTransferOperation op = DataTransferOperation::INTERPOLATE) DOFVector(GV const& gridView, PBF const& pbf,
-> DOFVector<decltype(ParallelGlobalBasis{gridView,pbf})>; DataTransferOperation op = DataTransferOperation::INTERPOLATE)
-> DOFVector<decltype(GlobalBasis{gridView,pbf})>;
/// \brief Create a DOFVector from a basis. /// \brief Create a DOFVector from a basis.
......
...@@ -120,7 +120,7 @@ namespace AMDiS ...@@ -120,7 +120,7 @@ namespace AMDiS
ProblemStat(std::string const& name, Grid_&& grid, PBF_ const& preBasisFactory) ProblemStat(std::string const& name, Grid_&& grid, PBF_ const& preBasisFactory)
: ProblemStat(name, FWD(grid)) : ProblemStat(name, FWD(grid))
{ {
adoptGlobalBasis(makeSharedPtr(ParallelGlobalBasis{grid_->leafGridView(), preBasisFactory})); adoptGlobalBasis(makeSharedPtr(GlobalBasis{grid_->leafGridView(), preBasisFactory}));
} }
/// \brief Initialisation of the problem. /// \brief Initialisation of the problem.
...@@ -529,9 +529,9 @@ namespace AMDiS ...@@ -529,9 +529,9 @@ namespace AMDiS
struct DeducedProblemTraits; struct DeducedProblemTraits;
template <class Grid, class PB> template <class Grid, class PB>
struct DeducedProblemTraits<Grid,ParallelGlobalBasis<PB>,void> struct DeducedProblemTraits<Grid,GlobalBasis<PB>,void>
{ {
using type = DefaultProblemTraits<ParallelGlobalBasis<PB>>; using type = DefaultProblemTraits<GlobalBasis<PB>>;
}; };
template <class G, class PBF> template <class G, class PBF>
...@@ -540,7 +540,7 @@ namespace AMDiS ...@@ -540,7 +540,7 @@ namespace AMDiS
{ {
using Grid = AdaptiveGrid_t<G>; using Grid = AdaptiveGrid_t<G>;
using GridView = typename Grid::LeafGridView; using GridView = typename Grid::LeafGridView;
using Basis = decltype(ParallelGlobalBasis{std::declval<GridView>(),std::declval<PBF>()}); using Basis = decltype(GlobalBasis{std::declval<GridView>(),std::declval<PBF>()});
using type = DefaultProblemTraits<Basis>; using type = DefaultProblemTraits<Basis>;
}; };
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <amdis/AdaptiveGrid.hpp> #include <amdis/AdaptiveGrid.hpp>
#include <amdis/common/Logical.hpp> #include <amdis/common/Logical.hpp>
#include <amdis/common/TypeTraits.hpp> #include <amdis/common/TypeTraits.hpp>
#include <amdis/functions/ParallelGlobalBasis.hpp> #include <amdis/functions/GlobalBasis.hpp>
namespace AMDiS namespace AMDiS
{ {
...@@ -91,12 +91,12 @@ namespace AMDiS ...@@ -91,12 +91,12 @@ namespace AMDiS
static auto create(std::string const& name, GridView const& gridView) static auto create(std::string const& name, GridView const& gridView)
{ {
return ParallelGlobalBasis(name, gridView, PreBasisCreator::create()); return AMDiS::GlobalBasis{name, gridView, PreBasisCreator::create()};
} }
static auto create(GridView const& gridView) static auto create(GridView const& gridView)
{ {
return ParallelGlobalBasis(gridView, PreBasisCreator::create()); return AMDiS::GlobalBasis{gridView, PreBasisCreator::create()};
} }
using GlobalBasis = decltype(create(std::declval<GridView>())); using GlobalBasis = decltype(create(std::declval<GridView>()));
......
install(FILES install(FILES
FlatPreBasis.hpp FlatPreBasis.hpp
FunctionFromCallable.hpp FunctionFromCallable.hpp
GlobalBasis.hpp
GlobalIdSet.hpp GlobalIdSet.hpp
HierarchicNodeToRangeMap.hpp HierarchicNodeToRangeMap.hpp
Interpolate.hpp Interpolate.hpp
...@@ -9,5 +10,4 @@ install(FILES ...@@ -9,5 +10,4 @@ install(FILES
NodeIndices.hpp NodeIndices.hpp
Nodes.hpp Nodes.hpp
Order.hpp Order.hpp
ParallelGlobalBasis.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amdis/functions) DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amdis/functions)
#pragma once #pragma once
#include <algorithm> #include <algorithm>
#include <list> #include <list>
#include <memory> #include <memory>
...@@ -12,14 +11,11 @@ ...@@ -12,14 +11,11 @@
#include <dune/common/shared_ptr.hh> #include <dune/common/shared_ptr.hh>
#include <dune/common/typeutilities.hh> #include <dune/common/typeutilities.hh>
#include <dune/common/version.hh> #include <dune/common/version.hh>
#include <dune/functions/common/type_traits.hh> #include <dune/functions/common/type_traits.hh>
#include <dune/functions/functionspacebases/concepts.hh> #include <dune/functions/functionspacebases/concepts.hh>
#include <dune/functions/functionspacebases/defaultglobalbasis.hh> #include <dune/functions/functionspacebases/defaultglobalbasis.hh>
#include <dune/functions/functionspacebases/flatmultiindex.hh> #include <dune/functions/functionspacebases/flatmultiindex.hh>
#include <dune/grid/common/adaptcallback.hh> #include <dune/grid/common/adaptcallback.hh>
#include <dune/typetree/treepath.hh> #include <dune/typetree/treepath.hh>
#include <amdis/AdaptiveGrid.hpp> #include <amdis/AdaptiveGrid.hpp>
...@@ -38,28 +34,28 @@ ...@@ -38,28 +34,28 @@
namespace AMDiS namespace AMDiS
{ {
template <class PreBasisFactory> template <class PreBasisFactory, class PBF = remove_cvref_t<PreBasisFactory>>
using MultiIndex_t = std::conditional_t< using MultiIndex_t = std::conditional_t<(PBF::requiredMultiIndexSize == 1),
(remove_cvref_t<PreBasisFactory>::requiredMultiIndexSize == 1),
Dune::Functions::FlatMultiIndex<std::size_t>, Dune::Functions::FlatMultiIndex<std::size_t>,
Dune::ReservedVector<std::size_t, remove_cvref_t<PreBasisFactory>::requiredMultiIndexSize>>; Dune::ReservedVector<std::size_t, PBF::requiredMultiIndexSize>>;
/** /**
* \brief Parallel global basis defined on a (sequential) pre-basis * \brief Global basis defined on a pre-basis
* *
* This class is an expansion to Dune::Functions::DefaultGlobalBasis<PB>. It adds a communicator * This class is an expansion to Dune::Functions::DefaultGlobalBasis<PB>.
* to use the basis in parallel as well as automatic update functionality. * It adds a communicator to use the basis in parallel as well as automatic
* update functionality.
* *
* \tparam PB Pre-basis providing the implementation details * \tparam PB Pre-basis providing the implementation details
*/ */
template <class PB> template <class PB>
class ParallelGlobalBasis class GlobalBasis
: public Dune::Functions::DefaultGlobalBasis<PB> : public Dune::Functions::DefaultGlobalBasis<PB>
, public Notifier<event::adapt> , public Notifier<event::adapt>
, private Observer<event::adapt> , private Observer<event::adapt>
{ {
using Self = ParallelGlobalBasis<PB>; using Self = GlobalBasis<PB>;
using Super = Dune::Functions::DefaultGlobalBasis<PB>; using Super = Dune::Functions::DefaultGlobalBasis<PB>;
public: public:
...@@ -81,9 +77,7 @@ namespace AMDiS ...@@ -81,9 +77,7 @@ namespace AMDiS
struct DummyImpl {}; struct DummyImpl {};
using ADH = Dune::AdaptDataHandle<Grid, DummyImpl>; using ADH = Dune::AdaptDataHandle<Grid, DummyImpl>;
public: public:
/// Construct this global basis with given name and grid, and constructing a preBasis. /// Construct this global basis with given name and grid, and constructing a preBasis.
/** /**
* \param name Name associated with this basis for initfile parameter attachment. * \param name Name associated with this basis for initfile parameter attachment.
...@@ -94,7 +88,7 @@ namespace AMDiS ...@@ -94,7 +88,7 @@ namespace AMDiS
*/ */
template <class... Args, template <class... Args,
Dune::Functions::enableIfConstructible<PreBasis, Args...> = 0> Dune::Functions::enableIfConstructible<PreBasis, Args...> = 0>
ParallelGlobalBasis(std::string const& name, Grid const& grid, Args&&... args) GlobalBasis(std::string const& name, Grid const& grid, Args&&... args)
: Super(FWD(args)...) : Super(FWD(args)...)
, Observer<event::adapt>(grid) , Observer<event::adapt>(grid)
, comm_(CommunicationCreator<Comm>::create(static_cast<Super const&>(*this), name + "->solver")) , comm_(CommunicationCreator<Comm>::create(static_cast<Super const&>(*this), name + "->solver"))
...@@ -102,30 +96,30 @@ namespace AMDiS ...@@ -102,30 +96,30 @@ namespace AMDiS
/// Construct this global basis with a preBasisFactory /// Construct this global basis with a preBasisFactory
template <class PBF> template <class PBF>
ParallelGlobalBasis(std::string const& name, GridView const& gridView, PBF const& preBasisFactory) GlobalBasis(std::string const& name, GridView const& gridView,
: ParallelGlobalBasis(name, gridView.grid(), PBF const& preBasisFactory)
: GlobalBasis(name, gridView.grid(),
flatPreBasis(preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView))) flatPreBasis(preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView)))
{} {}
/// Construct this global basis with empty name /// Construct this global basis with empty name
template <class Arg, class... Args, template <class Arg, class... Args,
REQUIRES(!std::is_same_v<std::string, remove_cvref_t<Arg>>)> REQUIRES(!std::is_same_v<std::string, remove_cvref_t<Arg>>)>
ParallelGlobalBasis(Arg&& arg, Args&&... args) GlobalBasis(Arg&& arg, Args&&... args)
: ParallelGlobalBasis(std::string(""), FWD(arg), FWD(args)...) : GlobalBasis(std::string(""), FWD(arg), FWD(args)...)
{} {}
/// Copy constructor /// Copy constructor
ParallelGlobalBasis(ParallelGlobalBasis const&) = delete; GlobalBasis(GlobalBasis const&) = delete;
/// Move constructor /// Move constructor
ParallelGlobalBasis(ParallelGlobalBasis&&) = default; GlobalBasis(GlobalBasis&&) = default;
public: public:
/// \brief Update the stored grid view /// \brief Update the stored grid view
/** /**
* This will update the indexing information of the global basis as well as the communicator. * This will update the indexing information of the global basis as well as
* It is called automatically if the grid has changed. * the communicator. It is called automatically if the grid has changed.
*/ */
void update(GridView const& gv) void update(GridView const& gv)
{ {
...@@ -141,7 +135,7 @@ namespace AMDiS ...@@ -141,7 +135,7 @@ namespace AMDiS
} }
/// Return *this because we are not embedded in a larger basis /// Return *this because we are not embedded in a larger basis
ParallelGlobalBasis const& rootBasis() const GlobalBasis const& rootBasis() const
{ {
return *this; return *this;
} }
...@@ -157,7 +151,7 @@ namespace AMDiS ...@@ -157,7 +151,7 @@ namespace AMDiS
ADH globalRefineCallback() const ADH globalRefineCallback() const
{ {
// TODO(FM): Implement // TODO(FM): Implement
error_exit("Not implemented: ParallelGlobalBasis::globalRefineCallback()"); error_exit("Not implemented: GlobalBasis::globalRefineCallback()");
return ADH{}; return ADH{};
} }
...@@ -180,13 +174,13 @@ namespace AMDiS ...@@ -180,13 +174,13 @@ namespace AMDiS
// Deduction guides // Deduction guides
template <class GV, class PBF> template <class GV, class PBF>
ParallelGlobalBasis(std::string const& name, GV const& gridView, PBF const& preBasisFactory) GlobalBasis(std::string const& name, GV const& gridView, PBF const& preBasisFactory)
-> ParallelGlobalBasis<decltype(flatPreBasis( -> GlobalBasis<decltype(flatPreBasis(
preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView)))>; preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView)))>;
template <class GV, class PBF> template <class GV, class PBF>
ParallelGlobalBasis(GV const& gridView, PBF const& preBasisFactory) GlobalBasis(GV const& gridView, PBF const& preBasisFactory)
-> ParallelGlobalBasis<decltype(flatPreBasis( -> GlobalBasis<decltype(flatPreBasis(
preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView)))>; preBasisFactory.template makePreBasis<MultiIndex_t<PBF>>(gridView)))>;
} // end namespace AMDiS } // end namespace AMDiS
...@@ -104,12 +104,12 @@ using Grid = Dune::YaspGrid<2>; ...@@ -104,12 +104,12 @@ using Grid = Dune::YaspGrid<2>;
Grid grid({1.0, 1.0}, {2, 2}); Grid grid({1.0, 1.0}, {2, 2});
using namespace Dune::Functions::BasisFactory; using namespace Dune::Functions::BasisFactory;
ParallelGlobalBasis basis1(grid.leafGridView(), lagrange<2>()); GlobalBasis basis1(grid.leafGridView(), lagrange<2>());
DOFVector<decltype(basis1)> vec0(basis1); DOFVector<decltype(basis1)> vec0(basis1);
DOFVector vec1(basis1); // C++17 only DOFVector vec1(basis1); // C++17 only
auto basis2 = makeUniquePtr(ParallelGlobalBasis(grid.leafGridView(), lagrange<2>())); auto basis2 = makeUniquePtr(GlobalBasis{grid.leafGridView(), lagrange<2>()});
DOFVector<Underlying_t<decltype(basis2)>> vec2(std::move(basis2)); DOFVector<Underlying_t<decltype(basis2)>> vec2(std::move(basis2));
``` ```
...@@ -162,7 +162,7 @@ DOFVector. The default is interpolation of the data to the new grid. ...@@ -162,7 +162,7 @@ DOFVector. The default is interpolation of the data to the new grid.
#### Arguments #### Arguments
`Basis basis` `Basis basis`
: Reference, temporary, or `shared_ptr` to dune global basis or `ParallelGlobalBasis` : Reference, temporary, or `shared_ptr` to dune global basis or `GlobalBasis`
`DataTransferOperation op` `DataTransferOperation op`
: The operation performed during data-transfer, either `DataTransferOperation::INTERPOLATE` or `DataTransferOperation::NO_OPERATION` : The operation performed during data-transfer, either `DataTransferOperation::INTERPOLATE` or `DataTransferOperation::NO_OPERATION`
...@@ -172,7 +172,7 @@ DOFVector. The default is interpolation of the data to the new grid. ...@@ -172,7 +172,7 @@ DOFVector. The default is interpolation of the data to the new grid.
: The type of the coefficients to store in the DOFVector : The type of the coefficients to store in the DOFVector
#### Return value #### Return value
Returns a `DOFVector<GlobalBasis, T>` with `GlobalBasis = ParallelGlobalBasis<typename Underlying_t<Basis>::PreBasis>`. The Returns a `DOFVector<GB, T>` with `GB = GlobalBasis<typename Underlying_t<Basis>::PreBasis>`. The
underlying type is either the `remove_cvref_t` for references, or the pointed-to type for smart pointers. underlying type is either the `remove_cvref_t` for references, or the pointed-to type for smart pointers.
#### Example #### Example
...@@ -180,7 +180,7 @@ underlying type is either the `remove_cvref_t` for references, or the pointed-to ...@@ -180,7 +180,7 @@ underlying type is either the `remove_cvref_t` for references, or the pointed-to
using namespace Dune::Functions::BasisFactory; using namespace Dune::Functions::BasisFactory;
// pass a reference to the basis // pass a reference to the basis
ParallelGlobalBasis basis1(gridView, lagrange<2>()); GlobalBasis basis1(gridView, lagrange<2>());
auto vec1 = makeDOFVector<double>(basis1); auto vec1 = makeDOFVector<double>(basis1);
// pass a smart pointer // pass a smart pointer
...@@ -320,7 +320,7 @@ Returns the const (1) or mutable (2) sub-range view of the stored DOFVector. ...@@ -320,7 +320,7 @@ Returns the const (1) or mutable (2) sub-range view of the stored DOFVector.
#### Example #### Example
```c++ ```c++
ParallelGlobalBasis basis(gridView, power<3>(lagrange<1>())); GlobalBasis basis{gridView, power<3>(lagrange<1>())};
auto vec = makeDOFVector(basis); auto vec = makeDOFVector(basis);
auto df = valueOf(vec); auto df = valueOf(vec);
...@@ -383,7 +383,7 @@ Note, the range type of the expression must be compatible with the `Range` type ...@@ -383,7 +383,7 @@ Note, the range type of the expression must be compatible with the `Range` type
#### Example #### Example
```c++ ```c++
ParallelGlobalBasis basis(gridView, power<3>(lagrange<1>())); GlobalBasis basis{gridView, power<3>(lagrange<1>())};
auto vec = makeDOFVector(basis); auto vec = makeDOFVector(basis);
// Range type is FieldVector<double,3> // Range type is FieldVector<double,3>
......
# Global Basis {: #group-globalbasis } # Global Basis {: #group-globalbasis }
## Summary ## Summary
In the context of the finite-element method we use a finite-element space $`V`$ with the set of basis functions $`\{\phi_i\}`$. Within AMDiS this concept is realized by the class `ParallelGlobalBasis`, contained in the header file `amdis/functions/ParallelGlobalBasis.hpp`. This extends the interface of the underlying `Dune::Functions::DefaultGlobalBasis<Impl>` with an automatic update mechanism used in several places within AMDiS. We strongly advice to always use an `AMDiS::ParallelGlobalBasis` or a user-defined derived class instead of the DUNE data structure for the update mechanism to work properly. In the context of the finite-element method we use a finite-element space $`V`$ with the set of basis functions $`\{\phi_i\}`$. Within AMDiS this concept is realized by the class `GlobalBasis`, contained in the header file `amdis/functions/GlobalBasis.hpp`. This extends the interface of the underlying `Dune::Functions::DefaultGlobalBasis<Impl>` with an automatic update mechanism used in several places within AMDiS. We strongly advice to always use an `AMDiS::GlobalBasis` or a user-defined derived class instead of the DUNE data structure for the update mechanism to work properly.
For more information on the class interface visit the API documentation. For more information on the class interface visit the API documentation.
## PreBasis classes and basis trees ## PreBasis classes and basis trees
Many finite-element spaces in applications can be constructed as a product of simple spaces $`V = V_1 \times V_2 \times \dots \times V_k`$. For example the Taylor-Hood-Element can be constructed as $`V_{TH} = V_{v} \times V_{p}`$ with the space of velocity functions $`V_v`$ and pressure functions $`V_p`$. The velocity space can again be decomposed into the vector components $`V_v = V_{v_1} \times \dots \times V_{v_n}`$. If we use second-degree lagrange basis functions for the velocity space and first-order lagrange basis functions for the pressure we get a decomposition $`V_{TH} = V_{v_1} \times V_{v_n} \times V_p = L_2^n \times L_1`$. Many finite-element spaces in applications can be constructed as a product of simple spaces $`V = V_1 \times V_2 \times \dots \times V_k`$. For example the Taylor-Hood-Element can be constructed as $`V_{TH} = V_{v} \times V_{p}`$ with the space of velocity functions $`V_v`$ and pressure functions $`V_p`$. The velocity space can again be decomposed into the vector components $`V_v = V_{v_1} \times \dots \times V_{v_n}`$. If we use second-degree lagrange basis functions for the velocity space and first-order lagrange basis functions for the pressure we get a decomposition $`V_{TH} = V_{v_1} \times V_{v_n} \times V_p = L_2^n \times L_1`$.
The underlying numerics environment of AMDiS, DUNE, attempts to model the situation above. Hence a `ParallelGlobalBasis` in AMDiS can be defined by a tree structure using the Dune-PreBasis class, which itself is composed of nodes in a tree. The leaf nodes in this tree contain the implementation details of the simple basis, while inner nodes indicate composition of either identical children (called power nodes) or arbitrary children (called composite nodes). The underlying numerics environment of AMDiS, DUNE, attempts to model the situation above. Hence a `GlobalBasis` in AMDiS can be defined by a tree structure using the Dune-PreBasis class, which itself is composed of nodes in a tree. The leaf nodes in this tree contain the implementation details of the simple basis, while inner nodes indicate composition of either identical children (called power nodes) or arbitrary children (called composite nodes).
### Making a PreBasis ### Making a PreBasis
When we want to build a `PreBasis` we must first identify the structure of the basis we want to construct with a tree. We can then build that structure in AMDiS by nesting the functions `Dune::Functions::BasisFactory::composite(Nodes...[, MergingStrategy])` for composite nodes, `Dune::Functions::BasisFactory::power(Node[, MergingStrategy])` for power nodes and implementations (e.g. `Dune::Functions::BasisFactory::lagrange<k>())`). The second optional argument `MergingStrategy` provides merging strategies to the inner nodes, specifying how the indices of the simple leaf basis should be merged to obtain the indexing of the global basis. Currently only flat indexing is supported by AMDiS. When we want to build a `PreBasis` we must first identify the structure of the basis we want to construct with a tree. We can then build that structure in AMDiS by nesting the functions `Dune::Functions::BasisFactory::composite(Nodes...[, MergingStrategy])` for composite nodes, `Dune::Functions::BasisFactory::power(Node[, MergingStrategy])` for power nodes and implementations (e.g. `Dune::Functions::BasisFactory::lagrange<k>())`). The second optional argument `MergingStrategy` provides merging strategies to the inner nodes, specifying how the indices of the simple leaf basis should be merged to obtain the indexing of the global basis. Currently only flat indexing is supported by AMDiS.
...@@ -37,24 +37,24 @@ auto taylorHoodPreBasisFactoryWithMergingStrategy = ...@@ -37,24 +37,24 @@ auto taylorHoodPreBasisFactoryWithMergingStrategy =
``` ```
## Making a global basis ## Making a global basis
Using a PreBasisFactory we can easily make a global basis by defining the set of grid elements on which the basis functions of the FE-space should live. This can be done by providing a GridView and using the `ParallelGlobalBasis` constructors. An optional name can be provided that can be used to pass initfile parameters to the parallel communication class. Using a PreBasisFactory we can easily make a global basis by defining the set of grid elements on which the basis functions of the FE-space should live. This can be done by providing a GridView and using the `GlobalBasis` constructors. An optional name can be provided that can be used to pass initfile parameters to the parallel communication class.
```c++ ```c++
// Name, Grid and Dune::DefaultGlobalBasis arguments // Name, Grid and Dune::DefaultGlobalBasis arguments
template <class... Args> template <class... Args>
ParallelGlobalBasis(std::string const& name, Grid const& grid, Args&&... args); GlobalBasis(std::string const& name, Grid const& grid, Args&&... args);
// As above with name defaulting to "" // As above with name defaulting to ""
template <class... Args> template <class... Args>
ParallelGlobalBasis(Grid const& grid, Args&&... args); GlobalBasis(Grid const& grid, Args&&... args);
// Name, GridView and PreBasisFactory // Name, GridView and PreBasisFactory
template <class PBF> template <class PBF>
ParallelGlobalBasis(std::string const& name, GridView const& gridView, PBF const& preBasisFactory); GlobalBasis(std::string const& name, GridView const& gridView, PBF const& preBasisFactory);
// As above with name defaulting to "" // As above with name defaulting to ""
template <class PBF> template <class PBF>
ParallelGlobalBasis(GridView const& gridView, PBF const& preBasisFactory); GlobalBasis(GridView const& gridView, PBF const& preBasisFactory);
``` ```
If we use a ProblemStat object most of the work will be done automatically for us. The PreBasis is specified via a Traits template parameter with the most frequently used cases already included in `amdis/ProblemStatTraits.hpp`. Those include If we use a ProblemStat object most of the work will be done automatically for us. The PreBasis is specified via a Traits template parameter with the most frequently used cases already included in `amdis/ProblemStatTraits.hpp`. Those include
...@@ -83,7 +83,7 @@ auto& basis = *prob.globalBasis(); ...@@ -83,7 +83,7 @@ auto& basis = *prob.globalBasis();
``` ```
## Using the global basis