13#ifndef FUNCTIONSPACE_HH
14#define FUNCTIONSPACE_HH
34#include <boost/mpl/int.hpp>
35#include <boost/mpl/range_c.hpp>
36#include <boost/multi_array.hpp>
37#include <boost/signals2.hpp>
38#include <boost/type_traits/remove_pointer.hpp>
39#include <boost/type_traits/remove_reference.hpp>
41#include <boost/fusion/algorithm.hpp>
42#include <boost/fusion/sequence.hpp>
44#include "dune/common/config.h"
46#include "dune/common/fmatrixev.hh"
47#include "dune/geometry/quadraturerules.hh"
48#include "dune/istl/bvector.hh"
62 template <
template <
class,
class>
class,
class,
class>
class BoundaryMapper;
67 template <
class Mapper>
68 struct IsBoundaryMapperStruct : std::false_type {};
69 template<
template <
class,
class>
class DomainMapper,
class Scalar,
class GridView>
70 struct IsBoundaryMapperStruct<BoundaryMapper<DomainMapper,Scalar,GridView>> : std::true_type {};
72 template <
class Mapper>
73 constexpr bool isBoundaryMapper() {
74 return IsBoundaryMapperStruct<Mapper>::value;
77 template <
class Mapper>
78 struct ChooseDomainMapperStruct {
81 template<
template <
class,
class>
class DomainMapper,
class Scalar,
class GridView>
82 struct ChooseDomainMapperStruct<BoundaryMapper<DomainMapper,Scalar,GridView>> {
83 using type = DomainMapper<Scalar,GridView>;
86 template<
class Mapper>
87 using ChooseDomainMapper =
typename ChooseDomainMapperStruct<Mapper>::type;
91 bool gridViewsAreSame(
typename Grid::LeafGridView gv1,
typename Grid::LeafGridView gv2) {
92 return &(gv1.grid()) == &(gv2.grid());
96 bool gridViewsAreSame(
typename Grid::LevelGridView gv1,
typename Grid::LevelGridView gv2) {
97 return (gv1.template begin<0>()->level() == gv2.template begin<0>()->level()) && (&(gv1.grid()) == &(gv2.grid()));
102 enum CoefficientTransfer { START, FINISH };
130 template <
class Spaces,
int Idx>
133 using type = std::remove_pointer_t<typename boost::fusion::result_of::value_at_c<Spaces,Idx>::type>;
157 template <
class Cell,
class ctype>
158 std::pair<Cell,Dune::FieldVector<ctype,Cell::dimension>>
161 ctype
const tol = 100*std::numeric_limits<ctype>::epsilon();
165 using namespace Dune;
167 if (level <= cell.level())
169 while (level < cell.level())
171 xi = cell.geometryInFather().global(xi);
172 cell = cell.father();
178 while (cell.level()<level && !cell.isLeaf())
180 for (
Cell const& c: descendantElements(cell,cell.level()+1))
182 auto xiC = c.geometryInFather().local(xi);
193 return std::make_pair(cell,xi);
212 template <
class Gr
idView>
215 const double tol = 1e-12 ;
217 using namespace Dune;
220 auto coarseIterator = std::find_if(gv.grid().levelGridView(0).template begin<0>(), gv.grid().levelGridView(0).template end<0>(),
223 return checkInside(cell.type(),cell.geometry().local(global)) < tol;
226 if (coarseIterator == gv.grid().levelGridView(0).template end<0>())
228 std::ostringstream msg;
229 msg <<
"findCell(): global point << " << global <<
" is not contained in any level 0 cell in the grid!";
239 for(
int level = 0; level <= gv.grid().maxLevel(); level++ )
244 for (
auto hi = ci.hbegin(level+1); hi != ci.hend(level+1) ; ++hi)
245 if(
checkInside(hi->type(),hi->geometry().local(global)) < tol )
247 ci =
typename GridView::Grid::template Codim<0>::Entity(*hi);
256 std::cerr <<
"findCell() at " << __FILE__ <<
':' << __LINE__ <<
'\n'
257 <<
"Global point << " << global
258 <<
" is not contained in any cell in the grid!\n"
259 <<
" last found on " << lastFound <<
" of " << gv.grid().maxLevel() <<
"\n";
313 template <
class FunctionSpace,
int m>
324 using ctype =
typename GridView::ctype;
327 typedef FunctionSpaceElement <Space, m>
Self;
392 data(fs.degreesOfFreedom()),
sp(&fs), transferMe(*this)
395 transferConnection =
sp->requestToRefine.connect(transferMe);
402 transferConnection =
sp->requestToRefine.connect(transferMe);
411 transferConnection =
sp->requestToRefine.connect(transferMe);
416 transferConnection.disconnect();
460 data = std::move(fse.data);
461 fse.transferConnection.disconnect();
477 template <
class OtherSpace>
494 template <
template <
class,
class>
class DomainMapper>
497 bool hasEquivalentUnderlyingMapper = !FunctionSpace_Detail::isBoundaryMapper<typename Space::Mapper>();
498 hasEquivalentUnderlyingMapper = (hasEquivalentUnderlyingMapper && std::is_same<DomainMapper<Scalar,typename Space::GridView>,
typename Space::Mapper>
::value);
499 hasEquivalentUnderlyingMapper = (hasEquivalentUnderlyingMapper &&
space().mapper().maxOrder()==bf.space().mapper().maxOrder());
500 hasEquivalentUnderlyingMapper = (hasEquivalentUnderlyingMapper && FunctionSpace_Detail::gridViewsAreSame<typename Space::GridView::Grid>(
space().gridView(),bf.space().gridView()));
501 if (hasEquivalentUnderlyingMapper)
505 for(
typename StorageType::size_type vi=0;vi<
size();++vi)
508 if (restrictedIndex.first)
509 data[vi] = bf[restrictedIndex.second];
532 template <
class Mapper>
533 std::enable_if_t<std::is_same<Mapper,FunctionSpace_Detail::ChooseDomainMapper<typename Space::Mapper>>
::value,
Self&>
536 bool hasEquivalentUnderlyingMapper = FunctionSpace_Detail::isBoundaryMapper<typename Space::Mapper>();
537 hasEquivalentUnderlyingMapper = (hasEquivalentUnderlyingMapper &&
space().mapper().maxOrder()==f.space().mapper().maxOrder());
538 hasEquivalentUnderlyingMapper = (hasEquivalentUnderlyingMapper && FunctionSpace_Detail::gridViewsAreSame<typename Space::GridView::Grid>(
space().gridView(),f.space().gridView()));
539 if (hasEquivalentUnderlyingMapper)
542 for(
typename StorageType::size_type vi=0;vi<f.size();++vi)
544 std::pair<bool,typename StorageType::size_type> restrictedIndex = boundaryMapper.unrestrictedToRestrictedIndex(vi);
545 if (restrictedIndex.first)
546 data[restrictedIndex.second] = f[vi];
569 template <
class Functor>
589 template <
class Space,
class Functor>
603 assert(
data.size()==v.size());
617 for (
int i=0; i<
data.N(); ++i)
630 for(
size_t i=0; i<
data.N(); ++i)
653 Self tmp(
space()); tmp = f; *
this += tmp;
664 template <
class OtherSpace>
667 Self tmp(
space()); tmp = f; *
this += tmp;
676 assert(
data.size()==v.size());
689 for (
int i=0; i<
data.N(); ++i)
705 Self tmp(
space()); tmp = f; *
this -= tmp;
716 template <
class OtherSpace>
719 Self tmp(
space()); tmp = f; *
this -= tmp;
728 assert(
data.size()==v.size());
741 for (
int i=0; i<
data.N(); ++i)
767 template <
class OtherSpace>
779 assert(
data.size()==v.size());
813 size_t esize = evaluator.
size();
815 for (
size_t i=0; i<esize; ++i)
818 auto const& sfVal = evaluator.
evalData[i].value;
819 for (
int n=0; n<m; ++n)
852 auto xi = cell.geometry().local(x);
854 return value(cell,xi);
869 size_t esize = evaluator.size();
870 for (
size_t i=0; i<esize; ++i)
872 auto const& coeff =
data[evaluator.globalIndices()[i]];
873 auto const& sfGrad = evaluator.evalData[i].derivative;
874 for (
int n=0; n<m; ++n)
909 return derivative(ci,ci.geometry().local(global));
924 assert(evaluator.derivatives() >= 2);
926 size_t esize = evaluator.size();
927 for (
size_t i=0; i<esize; ++i) {
929 auto const& sfHess = evaluator.evalData[i].hessian;
930 for (
int n=0; n<m; ++n)
932 auto hess = sfHess[l];
966 return hessian(ci,ci.geometry().local(global));
1028 return space().order(cell);
1034 [[deprecated]]
int order(SFS
const& sfs)
const
1046 std::unique_ptr<Dune::BlockVector<StorageValueType>> newCoeff = transferMatrix.
apply(
data);
1058 TransferMe(
Self& fe) : myFSE(fe) {}
1060 TransferMe(TransferMe
const& other)
1061 : myFSE(other.myFSE)
1064 void operator()(
typename TransferData<Space>::TransferMatrix
const*
transfer)
1070 future = std::async(std::launch::async,[
transfer,f=&myFSE]() { f->transfer(*
transfer); });
1074 assert(future.valid());
1081 std::future<void> future;
1091 TransferMe transferMe;
1092 boost::signals2::connection transferConnection;
1100 template <
class Space,
int m,
class OutIter>
1106 template <
class Space,
int m,
class InIter>
1116 template <
class FEFunction>
1121 FEFunction
const&
get()
const {
1126 FEFunction
const& f;
1129 template <
template <
class,
class>
class DomainMapper,
typename Scalar,
typename GridView,
int m>
1139 ,f_.space().mapper().
maxOrder()), f(space)
1144 DomainFEFunction
const&
get()
const {
1149 DomainFESpace space;
1180 template <
class LocalToGlobalMapper>
1187 using GridView =
typename LocalToGlobalMapper::GridView;
1189 typedef typename GridView::Grid
Grid;
1194 typedef typename LocalToGlobalMapper::Scalar
Scalar;
1209 static int const dim = Grid::dimension;
1301 space(space_), sf(nullptr), cache(cache_), sfValues(nullptr), combiner_(nullptr),
1302 globIdx(space.
mapper().initGlobalIndexRange()), sortedIdx(space.
mapper().initSortedIndexRange()),
1303 deriv(deriv_), currentCell(nullptr)
1311 space(eval.space), sf(eval.sf), sfSize(eval.sfSize), cache(eval.cache), sfValues(eval.sfValues), lastQr(eval.lastQr), lastSubId(eval.lastSubId), combiner_(nullptr),
1312 globIdx(eval.globIdx), sortedIdx(eval.sortedIdx), deriv(eval.deriv), currentXloc(eval.currentXloc), currentCell(nullptr)
1315 combiner_ = std::make_unique<typename Mapper::Combiner>(*eval.combiner_);
1316 if (eval.currentCell)
1317 currentCell = std::make_unique<Cell>(*eval.currentCell);
1325 assert(&space==&eval.space);
1327 sfSize = eval.sfSize;
1329 sfValues = eval.sfValues;
1332 converter = eval.converter;
1333 if (eval.combiner_) {
1334 combiner_ = std::make_unique<typename Mapper::Combiner>(*eval.combiner_);
1338 globIdx = eval.globIdx;
1339 sortedIdx = eval.sortedIdx;
1342 currentXloc = eval.currentXloc;
1343 if (eval.currentCell) {
1344 currentCell = std::make_unique<Cell>(*eval.currentCell);
1346 currentCell.reset();
1366 sf = &space.mapper().shapefunctions(index);
1367 sfSize = sf->size();
1370 currentCell = std::make_unique<Cell>(
cell);
1372 converter.moveTo(*currentCell);
1374 combiner_ = std::make_unique<typename Mapper::Combiner>(space.mapper().combiner(*currentCell,index));
1376 globIdx = space.mapper().globalIndices(index);
1377 sortedIdx = space.mapper().sortedIndices(index);
1401 template <
int subDim>
1408 if(FunctionSpace_Detail::isBoundaryMapper<Mapper>())
1411 if (sfValues && lastQr==&
qr && lastSubId==subId)
1416 sfValues = &cache->evaluate(*sf,
qr,subId);
1430 converter.setLocalPosition(xi);
1433 for (
int i=0; i<sfSize; ++i)
1437 typename Mapper::ShapeFunctionSet::value_type
const& sfun = (*sf)[i];
1439 converter.global(SfArg(sfun.evaluateFunction(xi),sfun.evaluateDerivative(xi)),1) :
1440 converter.global(SfArg(sfun.evaluateFunction(xi),sfun.evaluateDerivative(xi),sfun.evaluate2ndDerivative(xi)),2) );
1442 combiner_->rightTransform(
evalData);
1453 template <
int subDim>
1455 Dune::QuadratureRule<typename Grid::ctype,subDim>
const&
qr,
int ip,
int subId)
1461 converter.setLocalPosition(x);
1464 for (
int i=0; i<sfSize; ++i)
1468 auto const& localData = cache->evaluate(*sf,
qr,ip,subId);
1470 for (
int i=0; i<sfSize; ++i)
1474 combiner_->rightTransform(
evalData);
1508 typename Mapper::Combiner
const&
combiner()
const {
return *combiner_; }
1522 return space.gridView();
1527 return space.mapper();
1535 assert(currentCell);
1536 return *currentCell;
1551 typename Mapper::ShapeFunctionSet
const* sf;
1557 typename Mapper::Converter converter;
1558 std::unique_ptr<typename Mapper::Combiner> combiner_;
1563 std::unique_ptr<Cell> currentCell;
1591 template <
typename... Args>
1596 , m_gridView(gridView_)
1597 , mapper_(m_gridView,args...)
1598 , rtf(*this,gridman)
1618 , rtf(*this,gridman)
1627 gridman(fs.gridman),
1628 m_gridView(fs.m_gridView),
1637 refConnection.disconnect();
1656 return mapper().shapefunctions(cell).order();
1664 return mapper().maxOrder();
1705 LocalToGlobalMapper
const &
mapper()
const {
return mapper_; }
1710 LocalToGlobalMapper &
mapper() {
return mapper_; }
1751 bool cleaned =
false)
const
1753 std::vector<std::pair<size_t,SfValueType>> ic;
1758 for (
size_t j=0; j<esize; ++j)
1760 size_t i =
evaluator.globalIndices()[j];
1761 auto const& c =
evaluator.evalData[j].value;
1762 ic.push_back(std::make_pair(i,c));
1766 ic.erase(std::remove_if(ic.begin(),ic.end(),[](
auto const& pair)
1767 { return std::abs(pair.second) < 1e-12; }),
1784 std::vector<std::pair<size_t,SfValueType>>
1786 bool cleaned=
false)
const
1788 Evaluator eval(*
this);
1790 eval.evaluateAt(xi);
1807 std::vector<std::pair<size_t,SfValueType>>
1811 auto xi = cell.geometry().local(x);
1824 struct ReactToRefinement
1827 : mySpace(space), gm(gm_) {};
1829 ReactToRefinement(ReactToRefinement
const& rtr)
1830 : mySpace(rtr.mySpace)
1839 assert(!future.valid());
1840 if (!mySpace.requestToRefine.empty())
1841 future = std::async(std::launch::async,
1842 [&]() { transferData.reset(
new TransferData<Self>(mySpace)); });
1851 mySpace.mapper().update();
1852 if(!mySpace.requestToRefine.empty())
1854 assert(transferData!=0);
1855 assert(!future.valid());
1856 future = std::async(std::launch::async,
1858 transferMatrix = transferData->transferMatrix();
1859 transferData.reset();
1860 mySpace.requestToRefine(transferMatrix.get());
1868 mySpace.requestToRefine(
nullptr);
1869 transferMatrix.reset();
1875 GridManagerBase<Grid>& gm;
1876 std::unique_ptr<TransferData<Self>> transferData;
1877 std::unique_ptr<typename TransferData<Self>::TransferMatrix> transferMatrix;
1878 std::future<void> future;
1881 GridManagerBase<Grid>& gridman;
1883 LocalToGlobalMapper mapper_;
1884 ReactToRefinement rtf;
1885 boost::signals2::connection refConnection;
1915 template <
class Cache>
1919 GetEvaluators(Cache* cache_, std::map<void const*,int>
const& deriv_ = std::map<void const*,int>()):
1920 cache(cache_), deriv(deriv_)
1923 template <
class Space>
1926 auto it = deriv.find(space);
1927 int derivatives = it==deriv.end()? 1: it->second;
1928 return typename Space::Evaluator(*space,cache,derivatives);
1933 std::map<void const*,int>
const& deriv;
1945 template <
class Space>
1960 template <
class Spaces,
class ShapeFunctionCache>
1962 std::map<void const*,int>
const& deriv = std::map<void const*,int>())
1965 return boost::fusion::as_vector(boost::fusion::transform(spaces,[&](
auto const* space)
1967 auto it = deriv.find(space);
1968 int derivatives = it==deriv.end()? 1: it->second;
1969 return space->evaluator(cache,derivatives);
1978 template <
class Spaces>
1980 typename boost::fusion::result_of::transform<Spaces,GetEvaluatorTypes>::type
1991 template<
class Evaluators>
2000 static int const sidx = VD::spaceIndex;
2001 typedef typename boost::fusion::result_of::value_at_c<Evaluators, sidx>::type::VarArg
type;
2010 template <
class Evaluators,
class Cell>
2013 boost::fusion::for_each(evals,[&cell](
auto& eval) { eval.moveTo(cell); });
2022 template <
class Evaluators,
class Cell,
class Index>
2025 boost::fusion::for_each(evals,[&cell,idx](
auto& eval) { eval.moveTo(cell,idx); });
2034 template <
class Evaluator,
class QuadratureRule>
2037 boost::fusion::for_each(evals,[&
qr,subId](
auto& eval) { eval.useQuadratureRule(
qr,subId); });
2051 template <
class Evaluators,
class CoordType,
int dim,
int subDim>
2053 Dune::QuadratureRule<CoordType,subDim>
const&
qr,
int ip,
int subId)
2055 boost::fusion::for_each(evals,[&x,&
qr,ip,subId](
auto& eval) { eval.evaluateAt(x,
qr,ip,subId); });
2064 template <
class Evaluators,
class CoordType,
int dim>
2067 boost::fusion::for_each(evals,[&x](
auto& eval) { eval.evaluateAt(x); });
2076 template <
class Evaluators>
2079 auto getOrder = [](
auto const& eval) ->
int {
return eval.order(); };
2080 auto max = [](
auto a,
auto b) ->
int {
return std::max(a,b); };
2081 return boost::fusion::fold(boost::fusion::transform(evals,getOrder),0,
max);
A local to global mapper implementation for boundary spaces, with functions defined on the domain bou...
static int const continuity
A representation of a finite element function space defined over a domain covered by a grid.
FEFunctionSpace(GridManagerBase< Grid > &gridman_, Mapper &&m)
Constructs a finite element space from a directly given mapper.
FunctionSpaceElement< Self, m > Element_t
static int const continuity
GridManagerBase< Grid > & gridManager() const
Access to the GridManager.
GridView::IndexSet IndexSet
LocalToGlobalMapper::Scalar Scalar
typename Evaluator::VarArg::ValueType SfValueType
type of shape function values
LocalToGlobalMapper Mapper
corresponding mapper
Element_t< m > element() const
Creates a new function in this function space.
typename LocalToGlobalMapper::GridView GridView
Type of grid view.
size_t degreesOfFreedom() const
Returns the dimension of the function space, i.e. the number of degrees of freedom of a one-component...
int order(Cell< GridView > const &cell) const
Provides the polynomial order of shape functions on the given cell.
Evaluator evaluator(ShapeFunctionCache< Grid, Scalar > *cache=nullptr, int deriv=1) const
Creates a new evaluator for this space.
std::vector< std::pair< size_t, SfValueType > > linearCombination(Evaluator const &evaluator, bool cleaned=false) const
Returns the coefficients of the linear combination of global DoFs that define the value at the positi...
Grid const & grid() const
Provides access to the grid on which this finite element space is defined.
FEFunctionSpace(GridManagerBase< Grid > &gridMan, GridView const &gridView_, Args... args)
Constructs a finite element space from a GridManager, a grid view, and possibly extra arguments passe...
GridView const & gridView() const
Scalar field_type
The scalar field type on which the linear (function) space is based. This is provided for consistency...
boost::signals2::signal< void(typename TransferData< Self >::TransferMatrix const *) > requestToRefine
static int const sfComponents
The number of components of shape functions.
FEFunctionSpace(FEFunctionSpace< LocalToGlobalMapper > const &fs)
Copy constructor.
std::vector< std::pair< size_t, SfValueType > > linearCombination(Cell< GridView > const &cell, LocalPosition< GridView > const &xi, bool cleaned=false) const
Returns the coefficients of the linear combination of global DoFs that define the value at the given ...
std::vector< std::pair< size_t, SfValueType > > linearCombination(GlobalPosition< GridView > const &x) const
Returns the coefficients of the linear combination of global DoFs that define the value at the given ...
int maxOrder() const
Returns the maximum polynomial order of the shape functions on any cell in the grid.
static int const dimworld
IndexSet const & indexSet() const
Provides access to the index set defining the part of the grid on which the space is defined.
LocalToGlobalMapper & mapper()
Provides read-write access to the node manager.
DiscontinuousLagrangeMapper< double, Grid > const & mapper() const
ToDomainRepresentation(BoundaryFEFunction const &f_)
DomainFEFunction const & get() const
FEFunction const & get() const
ToDomainRepresentation(FEFunction const &f_)
A class for representing finite element functions.
int order(SFS const &sfs) const
Self & axpy(Scalar a, StorageType const &v)
Computes for coefficient vectors.
Self & operator-=(Scalar const &val)
Subtraction of a constant value from the coefficient vector.
FunctionSpaceElement(Self &&fse)
Move constructor.
Self & operator+=(Self const &f)
Addition of a function from the same (type of) space. Note that despite the same type the function sp...
Dune::BlockVector< StorageValueType > data
Self & operator=(Scalar val)
Sets all coefficients to the given value.
FunctionSpaceElement(Space const &fs)
Constructor.
Self & operator+=(StorageType const &v)
Addition of coefficient vectors.
Self & operator=(FunctionSpaceElement< FEFunctionSpace< BoundaryMapper< DomainMapper, Scalar, typename Space::GridView > >, m > const &bf)
Assignment from an FE function which is restricted to the boundary to a suitable FE function.
DerivativeType derivative(Cell< GridView > const &cell, LocalPosition< GridView > const &local) const
Evaluates the derivative of the FE function at the given local position inside the given cell.
Self & operator+=(Scalar val)
Addition of a constant value to the coefficient vector.
ValueType value(Cell< GridView > const &cell, LocalPosition< GridView > const &local) const
Evaluates the FE function at the specified local position in the given cell.
Self & operator=(FunctionSpaceElement< OtherSpace, m > const &f)
Assignment from functions belonging to other function spaces.
int order(Cell< GridView > const &cell) const
The polynomial order of the function on the provided cell.
HessianType hessian(GlobalPosition< GridView > const &global) const
Evaluates the FE function's Hessian at the specified global position.
typename Space::field_type field_type
Self & operator=(FunctionViewAdaptor< Space, Functor > const &f)
Assignment from a function view adaptor.
StorageValueType const & operator[](size_t i) const
EXPERIMENTAL Provides read-only access to the coefficients of the finite element basis functions.
FunctionSpaceElement(Self const &fse)
Copy constructor.
Self & operator=(Self &&fse)
Move assignment.
HessianType hessian(Cell< GridView > const &cell, LocalPosition< GridView > const &local) const
Evaluates the Hessian of the FE function at the given local position inside the given cell.
std::enable_if_t< std::is_same< Mapper, FunctionSpace_Detail::ChooseDomainMapper< typename Space::Mapper > >::value, Self & > operator=(FunctionSpaceElement< FEFunctionSpace< Mapper >, m > const &f)
Assignment from a suitable FE function to an FE function which is restricted to the boundary.
StorageType const & coefficients() const
Provides read-only access to the coefficients of the finite element basis functions.
Dune::FieldMatrix< Scalar, components, Space::dimworld > DerivativeType
Self & operator-=(StorageType const &v)
Subtraction of coefficient vectors.
Dune::FieldVector< Scalar, m > StorageValueType
Self & operator+=(FunctionSpaceElement< OtherSpace, m > const &f)
Addition of a function from a different function space, but with the same number of components.
static int const components
Self & operator=(StorageType const &v)
Assignment from vector of coefficients.
ValueType value(GlobalPosition< GridView > const &x) const
Evaluates the FE function at the specified global position.
DerivativeType derivative(GlobalPosition< GridView > const &global) const
Evaluates the FE function's gradient at the specified global position.
Self & operator=(Self const &fse)
Copy assignment.
DerivativeType derivative(typename FunctionSpace::Evaluator const &evaluator) const
Evaluates the derivative of the FE function wrt global coordinates at the position used to construct ...
FunctionSpaceElement< Space, m > Self
Self & axpy(Scalar a, FunctionSpaceElement< OtherSpace, m > const &f)
Computes for a function x from a different function space, but with the same number of components.
Tensor< Scalar, components, Space::dimworld, Space::dimworld > HessianType
typename GridView::ctype ctype
Self & operator=(WeakFunctionViewAdaptor< Functor > const &f)
Assignment from a weak function view adaptor.
Self & operator-=(FunctionSpaceElement< OtherSpace, m > const &f)
Subtraction of a function from a different function space, but with the same number of components.
HessianType hessian(typename FunctionSpace::Evaluator const &evaluator) const
Evaluates the Hessian of the FE function at the position used to construct the evaluator.
Self & operator=(StorageValueType const &a)
Sets all coefficients to the given value. As StorageValueType is a vector, one value for each compone...
void transfer(typename TransferData< Space >::TransferMatrix const &transferMatrix)
typename Space::GridView GridView
StorageValueType & operator[](size_t i)
EXPERIMENTAL Provides access to the coefficients of the finite element basis functions.
Space const & space() const
Provides access to the FEFunctionSpace to which this function belongs.
ValueType value(typename Space::Evaluator const &evaluator) const
Dune::FieldVector< Scalar, components > ValueType
typename Space::SfValueType SfValueType
Dune::BlockVector< StorageValueType > StorageType
int size() const
Number of coefficient blocks.
FEFunctionSpace< BoundaryMapper > Space
Self & axpy(Scalar a, Self const &f)
Computes for a function x from the same (type of) space. Note that despite the same type the functio...
int dim() const
Number of scalar degrees of freedom.
Self & operator-=(Self const &f)
Subtraction of a function from the same (type of) space.
Self & operator*=(Scalar a)
Scaling.
StorageType & coefficients()
Provides access to the coefficients of the finite element basis functions.
StorageValueType block_type
An adaptor that allows to turn lambda functions into function views.
A boost::fusion functor for extracting the evaluator type from a pointer to a FE space....
Space::Evaluator operator()(Space const *)
Space::Evaluator operator()(Space const *space) const
GetEvaluators(Cache *cache_, std::map< void const *, int > const &deriv_=std::map< void const *, int >())
A boost::fusion functor for creating a variational arg from the space, using a shape function cache t...
Basic functionality for managing grids and their refinement.
An exception that can be thrown whenever a key lookup fails.
This class caches values and derivatives of shape functions at quadrature points.
A class for representing tensors of arbitrary static rank and extents.
Matrix that transforms a data vector v_1 corresponding to the old grid to a data vector v_2 correspon...
std::unique_ptr< Dune::BlockVector< StorageValue > > apply(Dune::BlockVector< StorageValue > const &oldCoeff) const
Transforms oldCoeff, which lives on the old grid to an equivalent vector that lives on the new grid.
An adaptor that turns callables (e.g., lambdas) into weak function views.
std::tuple< std::vector< typename EntryTraits< Entry >::field_type >, DynamicMatrix< typename EntryTraits< Entry >::field_type >, std::vector< int > > qr(DynamicMatrix< Entry > const &A)
Computes a rank-revealing QR decomposition of using column pivoting.
void useQuadratureRuleInEvaluators(Evaluator &evals, QuadratureRule const &qr, int subId)
Tells all evaluators to use the given quadrature rule on the given subentity.
void moveEvaluatorsToIntegrationPoint(Evaluators &evals, Dune::FieldVector< CoordType, dim > const &x, Dune::QuadratureRule< CoordType, subDim > const &qr, int ip, int subId)
Moves all provided evaluators to the given integration point, evaluating the shape functions there.
int maxOrder(Evaluators const &evals)
Computes the maximum ansatz order used in a collection of evaluators.
typename boost::fusion::result_of::as_vector< typename boost::fusion::result_of::transform< Spaces, GetEvaluatorTypes >::type >::type Evaluators
the heterogeneous sequence type of Evaluators for the given spaces
auto getEvaluators(Spaces const &spaces, ShapeFunctionCache *cache, std::map< void const *, int > const &deriv=std::map< void const *, int >())
returns a heterogeneous sequence of evaluators for the given spaces
OutIter vectorToSequence(FunctionSpaceElement< Space, m > const &v, OutIter iter)
Writes the coefficients into a flat sequence. <Space,m>
void interpolateGlobally(FSElement &fse, Function const &fu)
Interpolates FunctionSpaceElement to FunctionSpaceElement.
void interpolateGloballyWeak(Target &target, Source const &fu)
Interpolates WeakFunctionViews to FunctionSpaceElement.
ProblemType
A type for describing the nature of a PDE problem.
typename GridView::template Codim< 0 >::Entity Cell
The type of cells (entities of codimension 0) in the grid view.
Status
The argument type of the signal that is emitted before and after grid adaptation.
std::pair< Cell, Dune::FieldVector< ctype, Cell::dimension > > findCellOnLevel(Cell cell, Dune::FieldVector< ctype, Cell::dimension > xi, int level=std::numeric_limits< int >::max())
Returns a descendant or ancestor cell of the given cell containing the specified local coordinate.
Cell< GridView > findCell(GridView const &gv, GlobalPosition< GridView > global)
Returns a cell of the given grid containing the specified global coordinate.
Dune::FieldVector< typename GridView::ctype, GridView::dimensionworld > GlobalPosition
The type of global positions within the grid view.
Dune::FieldVector< typename GridView::ctype, GridView::dimension > LocalPosition
The type of local positions within cells of the grid view.
@ BeforeRefinementComplete
Dune::FieldVector< T, n > max(Dune::FieldVector< T, n > x, Dune::FieldVector< T, n > const &y)
Componentwise maximum.
LocalCoordinate::field_type checkInside(Dune::GeometryType const >, LocalCoordinate const &x)
Checks whether a point is inside or outside the reference element, and how much.
OutIter vectorToSequence(double x, OutIter iter)
void moveEvaluatorsToCell(Evaluators &evals, Cell const &cell)
Moves all provided evaluators to the given cell.
InIter vectorFromSequence(FunctionSpaceElement< Space, m > &v, InIter in)
DEPRECATED use Element_t<m> instead.
FunctionSpaceElement< Self, m > type
A helper class that stores all informations necessary to evaluate FE functions at a certain point.
void evaluateAt(Dune::FieldVector< ctype, dim > const &xi)
Evaluates the shape functions at the given local coordinate.
void useQuadratureRule(Dune::QuadratureRule< typename Grid::ctype, subDim > const &qr, int subId)
Tells the evaluator that subsequent calls to evaluateAt(x,qr,ip,subId) refer to the given quadrature ...
Self Space
The type of function space we belong to.
SortedIndexRange sortedIndices() const
Provides access to (global,local) index pairs sorted ascendingly by global index.
VariationalArg< Scalar, dimworld, sfComponents > VarArg
The type of variational test/ansatz arguments storing value and derivatives/hessians of restricted an...
int derivatives() const
The number of derivatives that can be evaluated.
int order() const
Returns the polynomial order of the shape functions.
static int const sfComponents
The number of components of the shape functions.
Evaluator(Self const &space_, ShapeFunctionCache< Grid, Scalar > *cache_=nullptr, int deriv_=1)
Construct a shape function evaluator for a given space, possibly using the given shape function cache...
Mapper::Combiner const & combiner() const
Returns the algebraic combiner associated to the cell.
Mapper::SortedIndexRange SortedIndexRange
A range of sorted (global index, local index) pairs.
Dune::FieldVector< ctype, dim > const & xloc() const
Returns the local coordinates of the current evaluation point.
IndexSet::IndexType IndexType
GridView const & gridView() const
The grid view on which the space is defined.
Mapper::ShapeFunctionSet const & shapeFunctions() const
Returns the shape function set.
void moveTo(Cell const &cell)
A convenience overload, looking up the cell index itself.
Cell const & cell() const
Returns the cell containing the current evaluation point.
Mapper::GlobalIndexRange GlobalIndexRange
The type of ranges of global indices.
Kaskade::Cell< GridView > Cell
The type of cells in the grid.
LocalToGlobalMapper const & mapper() const
GlobalIndexRange globalIndices() const
Provides access to the global indices.
std::vector< VarArg > evalData
The container holding values and gradients of the global ansatz functions at the evaluation point.
Evaluator & operator=(Evaluator const &eval)
Assignment.
void evaluateAt(Dune::FieldVector< ctype, dim > const &x, Dune::QuadratureRule< typename Grid::ctype, subDim > const &qr, int ip, int subId)
Evaluates the shape functions at the given integration point of the given quadrature rule....
Evaluator(Evaluator const &eval)
Copy constructor.
void moveTo(Cell const &cell, IndexType const index)
Tells the evaluator that subsequent calls refer to the given cell.
boost::fusion::result_of::value_at_c< Evaluators, sidx >::type::VarArg type
Extracts the type of FE space with given index from set of spaces.
std::remove_pointer_t< typename boost::fusion::result_of::value_at_c< Spaces, Idx >::type > type
A class that stores values, gradients, and Hessians of evaluated shape functions.
Dune::FieldVector< Scalar, components > ValueType