13#ifndef HIERARCHICSPACE_HH
14#define HIERARCHICSPACE_HH
20#include "boost/multi_array.hpp"
22#include "dune/grid/common/capabilities.hh"
49 template <
class Scalar_,
class GV,
bool restricted>
56 typedef typename GridView::Grid
Grid;
58 typedef typename Grid::template Codim<0>::Entity
Cell;
61 static constexpr int dim = Grid::dimension;
95 typename IndexSet::IndexType
subIndex(
Cell const& cell,
int subentity,
int codim)
const
97 return indexSet().subIndex(cell,subentity,codim);
103 return hierarchicShapeFunctionSet<typename Grid::ctype,dim,Scalar>(Dune::GeometryType(Dune::GeometryType::simplex,Grid::dimension),-1);
111 size_t size(Dune::GeometryType gt)
const
151 template <
class Matrix>
154 for (
int j=0; j<A.M(); ++j)
156 for (
int i=0; i<A.N(); ++i)
161 template <
int n,
int m>
164 for (
int i=0; i<v.size(); ++i)
167 v[i].value = -v[i].value;
168 v[i].derivative = -v[i].derivative;
176 template <
class Matrix>
179 for (
int i=0; i<A.N(); ++i)
181 for (
int j=0; j<A.M(); ++j)
187 operator Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,1,1>>()
const
191 for (
int i=0; i<n; ++i)
192 K.incrementrowsize(i);
194 for (
int i=0; i<n; ++i)
197 for (
int i=0; i<n; ++i)
198 *K[i].begin() = sign(i);
204 int sign(
int i)
const {
return s[i].second().second(); }
223 template <
class Scalar,
class GV,
bool restricted=false>
235 return hierarchicShapeFunctionSet<typename GV::Grid::ctype,GV::Grid::dimension,Scalar>(cell.type(),ord);
240 return hierarchicShapeFunctionSet<typename GV::Grid::ctype,GV::Grid::dimension,Scalar>(cell.type(),ord-1);
249 template <
class ScalarType,
class GV>
265 if (gt.dim() == GV::Grid::dimension) {
267 for (
int p=0; p<=this->
order(); ++p)
268 n += HierarchicDetail::size(GV::Grid::dimension,p);
274 template <
class Cell,
class ShapeFunction,
class Data>
276 Dune::GeometryType& gt,
int& subentity,
int& codim,
int& indexInSubentity, Data& data)
const
281 indexInSubentity = n;
295 template <
class Scalar,
class GV>
297 public UniformScalarMapper<DiscontinuousHierarchicMapperImplementation<Scalar,GV>,boost::compressed_pair<bool,int> >
324 template <
class Scalar,
class GV,
class ShapeFunctionFilter=ScalarSpaceDetail::AllShapeFunctions>
329 static constexpr int dim = GV::dimension;
340 using namespace HierarchicDetail;
342 int codim = GV::Grid::dimension-gt.dim();
345 for (
int p=0; p<=this->
order(); ++p)
346 n += cdimSize(GV::Grid::dimension,p,codim) / nSubentities(GV::Grid::dimension,codim);
351 template <
class Cell,
class ShapeFunction,
class Data>
353 Dune::GeometryType& gt,
int& subentity,
int& codim,
int& indexInSubentity, Data& data)
const
355 using namespace HierarchicDetail;
361 for (
int j=0; j<=dim; ++j)
362 vIds[j] = this->
indexSet().subIndex(cell,j,dim);
365 std::tie(p,codim,subentity,k) = sf.
location();
366 gt = is.types(codim)[0];
369 std::tie(k,data.second()) = sfPermutation(dim,p,codim,subentity,k,vIds);
373 indexInSubentity = 0;
374 for (
int o=0; o<p; ++o)
375 indexInSubentity += cdimSize(dim,o,codim)/nSubentities(dim,codim);
376 indexInSubentity += k;
391 template <
class Scalar,
class GV>
393 public UniformScalarMapper<ContinuousHierarchicMapperImplementation<Scalar,GV>,boost::compressed_pair<bool,int> >
423 template <
class Scalar,
class GV,
bool restricted=false>
435 return hierarchicExtensionShapeFunctionSet<typename GV::Grid::ctype,GV::Grid::dimension,Scalar>(cell.type(),this->order());
440 return hierarchicExtensionShapeFunctionSet<typename GV::Grid::ctype,GV::Grid::dimension,Scalar>(cell.type(),-1);
445 template <
class Scalar,
class GV>
462 return gt.dim()==GV::Grid::dimension? HierarchicDetail::size(GV::Grid::dimension,this->
order()): 0;
465 template <
class Cell,
class ShapeFunction,
class Data>
467 Dune::GeometryType& gt,
int& subentity,
int& codim,
int& indexInSubentity, Data& data)
const
472 indexInSubentity = n;
486 template <
class Scalar,
class GV>
488 public UniformScalarMapper<DiscontinuousHierarchicExtensionMapperImplementation<Scalar,GV>,boost::compressed_pair<bool,int> >
514 template <
class Scalar,
class GV,
class ShapeFunctionFilter = ScalarSpaceDetail::AllShapeFunctions>
531 using namespace HierarchicDetail;
533 int codim = GV::Grid::dimension-gt.dim();
534 return cdimSize(GV::Grid::dimension,this->
order(),codim) / nSubentities(GV::Grid::dimension,codim);
537 template <
class Cell,
class ShapeFunction,
class Data>
539 Dune::GeometryType& gt,
int& subentity,
int& codim,
int& indexInSubentity, Data& data)
const
541 using namespace HierarchicDetail;
544 int const d = Cell::dimension;
547 for (
int j=0; j<=d; ++j)
548 vIds[j] = this->
indexSet().subIndex(cell,j,d);
551 std::tie(nominalOrder,codim,subentity,k) = sf.
location();
552 gt = this->
indexSet().types(codim)[0];
555 std::tie(indexInSubentity,data.second()) = sfPermutation(d,nominalOrder,codim,subentity,k,vIds);
570 template <
class Scalar,
class GV>
572 public UniformScalarMapper<ContinuousHierarchicExtensionMapperImplementation<Scalar,GV>,boost::compressed_pair<bool,int>>
A degrees of freedom manager for globally continuous FEFunctionSpace s of piecewise polynomials.
ContinuousHierarchicExtensionMapper(GridView const &gridView, int order)
HierarchicSimplexShapeFunctionSet< typename GridView::Grid::ctype, GridView::Grid::dimension, Scalar > ShapeFunctionSetImplementation
static int const continuity
int dofOnEntity(Dune::GeometryType gt) const
void entityIndex(Cell const &cell, ShapeFunction const &sf, int n, Dune::GeometryType >, int &subentity, int &codim, int &indexInSubentity, Data &data) const
ContinuousHierarchicExtensionMapperImplementation(GV const &gridView, int order, ShapeFunctionFilter shapeFunctionFilter=ShapeFunctionFilter())
A degrees of freedom manager for globally continuous FEFunctionSpace s of piecewise polynomials.
ContinuousHierarchicMapper(GridView const &gridView, int order)
static int const continuity
ContinuousHierarchicMapperImplementation(GV const &gridView, int order, ShapeFunctionFilter shapeFunctionFilter=ShapeFunctionFilter())
int dofOnEntity(Dune::GeometryType gt) const
void entityIndex(Cell const &cell, ShapeFunction const &sf, int n, Dune::GeometryType >, int &subentity, int &codim, int &indexInSubentity, Data &data) const
A degrees of freedom manager for FEFunctionSpace s of piecewise polynomials of given order.
static int const continuity
HierarchicSimplexShapeFunctionSet< typename GridView::Grid::ctype, GridView::Grid::dimension, Scalar > ShapeFunctionSetImplementation
DiscontinuousHierarchicExtensionMapper(GV const &gridView, int order)
int dofOnEntity(Dune::GeometryType gt) const
DiscontinuousHierarchicExtensionMapperImplementation(GV const &gridView, int order)
void entityIndex(Cell const &cell, ShapeFunction const &, int n, Dune::GeometryType >, int &subentity, int &codim, int &indexInSubentity, Data &data) const
A degrees of freedom manager for FEFunctionSpace s of piecewise polynomials of order Order.
DiscontinuousHierarchicMapper(GridView const &gridView, int order)
static int const continuity
DiscontinuousHierarchicMapperImplementation(GV const &gridView, int order)
void entityIndex(Cell const &cell, ShapeFunction const &, int n, Dune::GeometryType >, int &subentity, int &codim, int &indexInSubentity, Data &data) const
int dofOnEntity(Dune::GeometryType gt) const
A class for representing finite element functions.
Base::ShapeFunctionSet const & lowerShapeFunctions(typename Base::Cell const &cell) const
Base::ShapeFunctionSet const & shapeFunctions(typename Base::Cell const &cell, int ordr=0) const
HierarchicExtensionMapperImplementation(GV const &gridView, int order)
void rightTransform(std::vector< VariationalArg< Scalar, n, m > > &v) const
In-place computation of row vectors .
void leftPseudoInverse(Matrix &A) const
In-place computation of .
void rightTransform(Matrix &A) const
In-place computation of .
Combiner(GlobalIndices globalIndices, ShapeFunctionSet const &)
A local to global mapper implementation for scalar hierarchic bases.
HierarchicMapperImplementationBase(GridView const &gridView_, int order)
int order() const
Returns the nominal order of the shape function set.
ShapeFunctionSet const & emptyShapeFunctionSet() const
GridView const & gridView() const
bool inSupport(Cell const &cell) const
Tells whether the given cell is contained in the support.
ScalarConverter< Cell, Scalar > Converter
GridView::IndexSet IndexSet
size_t size(Dune::GeometryType gt) const
IndexSet::IndexType subIndex(Cell const &cell, int subentity, int codim) const
Returns the index of the specified subentity.
Grid::template Codim< 0 >::Entity Cell
void update()
This is called on grid modifications and can be overwritten if internal data needs to be recomputed o...
HierarchicShapeFunctionSetContainer< typenameGrid::ctype, dim, Scalar, restricted >::value_type ShapeFunctionSet
IndexSet const & indexSet() const
HierarchicMapperImplementation(GV const &gridView, int order)
Base::ShapeFunctionSet const & shapeFunctions(typename Base::Cell const &cell, int ordr=0) const
Base::ShapeFunctionSet const & lowerShapeFunctions(typename Base::Cell const &cell) const
A container of hierarchic shape functions (see HierarchicSimplexShapeFunction) up to a given nominal ...
DEPRECATED. Use boost::iterator_range instead.
A Converter for scalar shape functions that do not change their value under transformation from refer...
virtual std::tuple< int, int, int, int > location() const =0
Returns a tuple (nominalOrder,codim,entity,index) giving detailed information about the location of t...
This file contains various utility functions that augment the basic functionality of Dune.
FEFunctionSpace and FunctionSpaceElement and the like.
define hierarchic shape functions for simplicial elements of arbitrary dimension and order
void vertexids(int d, int c, int k, int *idx)
Computes the d-c+1 local vertex indices of the vertices incident to the k-th subentity of codimension...
FunctionSpaceElement< FEFunctionSpace< Self >, m > type
FunctionSpaceElement< FEFunctionSpace< Self >, m > type
FunctionSpaceElement< FEFunctionSpace< Self >, m > type
FunctionSpaceElement< FEFunctionSpace< Self >, m > type
void treatBoundary(Data &, GridView const &, Cell const &, int, int) const
A class that stores values, gradients, and Hessians of evaluated shape functions.