3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_TRANSFORMEDINDEXBASIS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_TRANSFORMEDINDEXBASIS_HH
9#include <dune/common/std/apply.hh>
10#include <dune/common/hybridutilities.hh>
11#include <dune/common/reservedvector.hh>
12#include <dune/common/typeutilities.hh>
13#include <dune/common/hybridutilities.hh>
15#include <dune/typetree/compositenode.hh>
16#include <dune/typetree/utility.hh>
29namespace Experimental {
51template<
class MI,
class RPB,
class T>
54 using Transformation = T;
63 using GridView =
typename RawPreBasis::GridView;
69 using Node =
typename RawPreBasis::Node;
72 using IndexSet = Impl::DefaultNodeIndexSet<TransformedIndexPreBasis>;
85 template<
class RPB_R,
class T_R>
131 [[deprecated(
"Warning: The IndexSet typedef and the makeIndexSet method are deprecated. "\
132 "As a replacement use the indices() method of the PreBasis directly.")]]
177 template<
typename It>
181 for(std::size_t i=0; i<node.size(); ++i)
199namespace BasisFactory {
200namespace Experimental {
204template<
class RawPreBasisFactory,
class Transformation>
205class TransformedIndexPreBasisFactory
209 static const std::size_t requiredMultiIndexSize = Transformation::maxIndexSize;
211 template<
class RPBF_R,
class T_R>
212 TransformedIndexPreBasisFactory(RPBF_R&& rawPreBasisFactory, T_R&& transformation) :
213 rawPreBasisFactory_(std::forward<RPBF_R>(rawPreBasisFactory)),
214 transformation_(std::forward<T_R>(transformation))
217 template<
class MultiIndex,
class Gr
idView>
218 auto makePreBasis(
const GridView& gridView)
const
220 auto rawPreBasis = rawPreBasisFactory_.template makePreBasis<MultiIndex>(gridView);
221 using RawPreBasis = std::decay_t<
decltype(rawPreBasis)>;
226 RawPreBasisFactory rawPreBasisFactory_;
227 Transformation transformation_;
245template<
class RawPreBasisFactory,
class Transformation>
247 RawPreBasisFactory&& preBasisFactory,
248 Transformation&& transformation)
250 return Imp::TransformedIndexPreBasisFactory<std::decay_t<RawPreBasisFactory>, std::decay_t<Transformation>>(
251 std::forward<RawPreBasisFactory>(preBasisFactory),
252 std::forward<Transformation>(transformation));
275template<
class IndexTransformation,
class SizeImplementation, std::
size_t minIS, std::
size_t maxIS>
283 template<
class IT_R,
class SI_R>
286 sizeImplementation_(std::forward<SI_R>(sizeImplementation))
289 template<
class MultiIndex,
class PreBasis>
292 indexTransformation_(multiIndex, preBasis);
295 template<
class Prefix,
class PreBasis>
296 auto size(
const Prefix& prefix,
const PreBasis& preBasis)
const
298 return sizeImplementation_(prefix, preBasis);
301 template<
class PreBasis>
304 return preBasis.dimension();
308 IndexTransformation indexTransformation_;
309 SizeImplementation sizeImplementation_;
332template<
class IndexTransformation,
class SizeImplementation, std::
size_t minIndexSize, std::
size_t maxIndexSize>
336 std::decay_t<IndexTransformation>,
337 std::decay_t<SizeImplementation>,
338 minIndexSize, maxIndexSize>(
340 std::forward<SizeImplementation>(sizeImplementation));
Definition: polynomial.hh:10
auto transformIndices(RawPreBasisFactory &&preBasisFactory, Transformation &&transformation)
Create a TransformedIndexPreBasisFactory.
Definition: transformedindexbasis.hh:246
auto indexTransformation(IndexTransformation &&indexTransformation, SizeImplementation &&sizeImplementation, Dune::index_constant< minIndexSize >, Dune::index_constant< maxIndexSize >)
A generic implementation of a transformation.
Definition: transformedindexbasis.hh:333
A pre-basis transforming multi-indices.
Definition: transformedindexbasis.hh:53
Transformation transformation_
Definition: transformedindexbasis.hh:191
size_type maxNodeSize() const
Get the maximal number of DOFs associated to node for any element.
Definition: transformedindexbasis.hh:157
size_type size(const SizePrefix &prefix) const
Return number of possible values for next position in multi index.
Definition: transformedindexbasis.hh:145
RawPreBasis rawPreBasis_
Definition: transformedindexbasis.hh:190
const GridView & gridView() const
Obtain the grid view that the basis is defined on.
Definition: transformedindexbasis.hh:98
Dune::ReservedVector< size_type, MultiIndex::max_size()+1 > SizePrefix
Type used for prefixes handed to the size() method.
Definition: transformedindexbasis.hh:78
typename RawPreBasis::Node Node
Template mapping root tree path to type of created tree node.
Definition: transformedindexbasis.hh:69
Impl::DefaultNodeIndexSet< TransformedIndexPreBasis > IndexSet
Type of created tree node index set.
Definition: transformedindexbasis.hh:72
IndexSet makeIndexSet() const
Create tree node index set.
Definition: transformedindexbasis.hh:133
void transformIndex(MultiIndex &multiIndex) const
Definition: transformedindexbasis.hh:172
void initializeIndices()
Initialize the global indices.
Definition: transformedindexbasis.hh:92
size_type dimension() const
Get the total dimension of the space spanned by this basis.
Definition: transformedindexbasis.hh:151
size_type size() const
Same as size(prefix) with empty prefix.
Definition: transformedindexbasis.hh:139
Node makeNode() const
Create tree node with given root tree path.
Definition: transformedindexbasis.hh:119
RawPreBasis & rawPreBasis()
Definition: transformedindexbasis.hh:167
TransformedIndexPreBasis(RPB_R &&rawPreBasis, T_R &&transformation)
Constructor for given child pre-basis objects.
Definition: transformedindexbasis.hh:86
MI MultiIndex
Type used for global numbering of the basis vectors.
Definition: transformedindexbasis.hh:75
It indices(const Node &node, It it) const
Definition: transformedindexbasis.hh:178
const RawPreBasis & rawPreBasis() const
Definition: transformedindexbasis.hh:162
std::size_t size_type
Type used for indices and size information.
Definition: transformedindexbasis.hh:66
typename RawPreBasis::GridView GridView
The grid view that the FE basis is defined on.
Definition: transformedindexbasis.hh:63
void update(const GridView &gv)
Update the stored grid view, to be called if the grid has changed.
Definition: transformedindexbasis.hh:104
RPB RawPreBasis
Definition: transformedindexbasis.hh:60
A generic implementation of a transformation.
Definition: transformedindexbasis.hh:277
auto dimension(const PreBasis &preBasis) const
Definition: transformedindexbasis.hh:302
GenericIndexingTransformation(IT_R &&indexTransformation, SI_R &&sizeImplementation)
Definition: transformedindexbasis.hh:284
void transformIndex(MultiIndex &multiIndex, const PreBasis &preBasis) const
Definition: transformedindexbasis.hh:290
static constexpr std::size_t maxIndexSize
Definition: transformedindexbasis.hh:281
static constexpr std::size_t minIndexSize
Definition: transformedindexbasis.hh:280
auto size(const Prefix &prefix, const PreBasis &preBasis) const
Definition: transformedindexbasis.hh:296