1#ifndef DUNE_FEM_SPACE_LAGRANGE_RESTRICTPROLONG_HH
2#define DUNE_FEM_SPACE_LAGRANGE_RESTRICTPROLONG_HH
5#pragma GCC diagnostic push
6#pragma GCC diagnostic ignored "-Wdangling-reference"
13#include <dune/geometry/referenceelements.hh>
17#include <dune/fem/gridpart/leafgridpart.hh>
20#include "lagrangepoints.hh"
29 template<
class G,
int ord >
30 struct LagrangeLocalRestrictProlong
34 typedef typename GridType::ctype ctype;
35 static const int dimension = GridType::dimension;
37 typedef FieldVector< ctype, dimension > DomainVector;
39 typedef LagrangePointSet< LeafGridPart< GridType >, ord > LagrangePointSetType;
42 typedef typename LagrangePointSetType::template Codim< 0 >::SubEntityIteratorType
45 typedef std::map< const GeometryType, const LagrangePointSetType * > LagrangePointSetMapType;
48 ~LagrangeLocalRestrictProlong ()
50 typedef typename LagrangePointSetMapType::iterator Iterator;
51 const Iterator end = lagrangePointSet_.end();
52 for( Iterator it = lagrangePointSet_.begin(); it != end; ++it )
56 template<
class DomainField >
57 void setFatherChildWeight (
const DomainField &weight ) {}
59 template<
class LFFather,
class LFSon,
class LocalGeometry >
60 void restrictLocal ( LFFather &lfFather,
62 const LocalGeometry &geometryInFather,
63 const bool initialize )
const
65 static const int dimRange = LFSon::dimRange;
69 const LagrangePointSetType &pointSet = lagrangePointSet( lfFather.entity(), lfFather.order() );
71 const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
72 for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
74 const unsigned int dof = *sit;
75 const DomainVector &pointInFather = pointSet.point( dof );
76 const DomainVector pointInSon = geometryInFather.local( pointInFather );
77 if( refSon.checkInside( pointInSon ) )
79 typename LFSon::RangeType phi;
80 lfSon.evaluate( pointInSon, phi );
81 for(
int coordinate = 0; coordinate < dimRange; ++coordinate )
82 lfFather[ dimRange * dof + coordinate ] = phi[ coordinate ];
86 template<
class LFFather >
87 void restrictFinalize ( LFFather &lfFather )
const
90 template<
class LFFather,
class LFSon,
class LocalGeometry >
91 void prolongLocal (
const LFFather &lfFather, LFSon &lfSon,
92 const LocalGeometry &geometryInFather,
93 bool initialize )
const
95 static const int dimRange = LFFather::dimRange;
97 const LagrangePointSetType &pointSet = lagrangePointSet( lfSon.entity(), lfSon.order() );
99 const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
100 for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
102 const unsigned int dof = *sit;
103 const DomainVector &pointInSon = pointSet.point( dof );
104 const DomainVector pointInFather = geometryInFather.global( pointInSon );
106 typename LFFather::RangeType phi;
107 lfFather.evaluate( pointInFather, phi );
108 for(
int coordinate = 0; coordinate < dimRange; ++coordinate )
109 lfSon[ dimRange * dof + coordinate ] = phi[ coordinate ];
113 bool needCommunication ()
const {
return true; }
116 template<
class Entity >
117 const LagrangePointSetType &lagrangePointSet (
const Entity &entity,
const int order )
const
119 return lagrangePointSet( entity.type(), order );
122 const LagrangePointSetType &lagrangePointSet (
const GeometryType &type,
const int order )
const
124 typedef typename LagrangePointSetMapType::iterator Iterator;
125 Iterator it = lagrangePointSet_.find( type );
126 if( it == lagrangePointSet_.end() )
127 it = lagrangePointSet_.insert( it, std::make_pair( type,
new LagrangePointSetType( type, order ) ) );
128 assert( it->second != 0 );
129 return *(it->second);
133 mutable LagrangePointSetMapType lagrangePointSet_;
141#pragma GCC diagnostic pop
Dune namespace.
Definition: alignedallocator.hh:13
static const ReferenceElement & general(const GeometryType &type)
get general reference elements
Definition: referenceelements.hh:156
A unique label for each type of element that can occur in a grid.