25#include "dune/common/fmatrix.hh"
26#include <dune/geometry/referenceelements.hh>
52 typedef typename Grid::GlobalIdSet::IdType Id;
53 typedef typename Grid::template Codim<0>::Entity Cell;
62 typename Grid::GlobalIdSet
const& idSet;
64 bool geometricallyNested, transformViaGlobal;
74 typedef typename Grid::template Codim<0>::Entity
Entity;
81 typedef typename Grid::ctype ctype;
82 static int const dim = Grid::dimension;
83 static int const dimw = Grid::dimensionworld;
112 Cell
const& ancestor_,
114 bool geometricallyNested_= (dim==dimw),
118 idSet(grid.globalIdSet()),
119 geometricallyNested(geometricallyNested_),
121 tol(tol_<=-100? 100*std::numeric_limits<ctype>::epsilon(): tol_)
125 while (idSet.id(ci) != idSet.id(
ancestor))
130 transformViaGlobal = geometricallyNested && (spanwidth >= 3);
139 std::vector<int> &componentsInside)
const
142 if(transformViaGlobal) childToFatherViaGlobal(x);
143 else childToFather(x);
146 if(transformViaGlobal) fatherToChildViaGlobal(x,componentsInside);
147 else fatherToChild(x,componentsInside);
170 std::vector<int>& componentsInside)
const
173 if(transformViaGlobal) fatherToChildViaGlobal(x,componentsInside);
174 else fatherToChild(x,componentsInside);
177 if(transformViaGlobal) childToFatherViaGlobal(x);
178 else childToFather(x);
190 if (transformViaGlobal)
193 return ancestor.geometry().jacobianTransposed(xGlobal) *
child.geometry().jacobianInverseTransposed(xLocal);
198 return Jct *
ancestor.geometry().jacobianInverseTransposed(xLocal);
205 while(idSet.id(ci) != idSet.id(
ancestor)) {
206 invt.leftmultiply(ci.geometryInFather().jacobianInverseTransposed(x));
207 x = ci.geometryInFather().global(x);
210 std::stack<Cell> stack;
211 while(idSet.id(ci) != idSet.id(
ancestor)) {
215 while (!stack.empty()) {
216 x = stack.top()->geometryInFather().local(x);
218 invt.rightmultiply(stack.top()->geometryInFather().jacobianInverseTransposed(x));
235 while(idSet.id(ci) != idSet.id(
ancestor))
237 auto const& geo = ci.geometryInFather();
246 auto const& geoChild =
child.geometry();
247 auto const& geoAnces =
ancestor.geometry();
249 xi = geoAnces.local(geoChild.global(xi));
260 std::vector<int>& componentsInside)
const
262 assert(x.size()==componentsInside.size());
268 std::stack<Cell> ciStack;
269 while(idSet.id(ci) != idSet.id(
ancestor))
278 while(!ciStack.empty())
282 auto compi = componentsInside.begin();
285 *vi = ci.geometryInFather().local(*vi);
294 compi = componentsInside.erase(compi);
302 std::vector<int>& componentsInside)
const
308 auto compi = componentsInside.begin();
309 while (vi!=x.end()) {
315 compi = componentsInside.erase(compi);
330 typedef typename Grid::template Codim<0>::Entity Cell;
331 typedef typename Grid::ctype ctype;
332 static int const dim = Grid::dimension;
337 bool geometricallyNested=
false) :
345 std::vector<Dune::FieldVector<ctype,dim> > xi(1,x);
346 std::vector<int> isi(1,0);
355 static Cell coarseGridAncestor(
Cell const&
child)
Dune::FieldVector< ctype, dim > global(Dune::FieldVector< ctype, dim >const &x) const
Transformation from local to global.
Cell const & getFather() const
LocalGeometryInCoarseGridAncestor(Grid const &grid, Cell const &child, bool geometricallyNested=false)
Transformation of coordinates between ancestor and child.
void local(std::vector< Dune::FieldVector< ctype, dim > > &x, std::vector< int > &componentsInside) const
Transformation from global to local.
Grid::template Codim< 0 >::Entity Entity
The entity type between which this geometry object maps.
MultiLevelLocalGeometry(Grid const &grid, Cell const &child_, Cell const &ancestor_, MultiLevelLocalGeometry< Grid >::Direction direction_, bool geometricallyNested_=(dim==dimw), ctype tol_=-100)
Constructor.
void global(std::vector< Dune::FieldVector< ctype, dim > > &x, std::vector< int > &componentsInside) const
Transformation from local to global.
Entity const & localEntity() const
A reference to the local entity.
Dune::FieldMatrix< ctype, dim, dim > jacobianInverseTransposed(Dune::FieldVector< ctype, dim > const &xLocal) const
inverse of transposed Jacobian.
This file contains various utility functions that augment the basic functionality of Dune.
typename GridView::template Codim< 0 >::Entity Cell
The type of cells (entities of codimension 0) in the grid view.
LocalCoordinate::field_type checkInside(Dune::GeometryType const >, LocalCoordinate const &x)
Checks whether a point is inside or outside the reference element, and how much.