1#ifndef DUNE_FEM_SPACE_LAGRANGE_RESTRICTPROLONG_HH
2#define DUNE_FEM_SPACE_LAGRANGE_RESTRICTPROLONG_HH
8#include <dune/geometry/referenceelements.hh>
12#include <dune/fem/gridpart/leafgridpart.hh>
15#include "lagrangepoints.hh"
24 template<
class G,
int ord >
25 struct LagrangeLocalRestrictProlong
29 typedef typename GridType::ctype ctype;
30 static const int dimension = GridType::dimension;
32 typedef FieldVector< ctype, dimension > DomainVector;
34 typedef LagrangePointSet< LeafGridPart< GridType >, ord > LagrangePointSetType;
37 typedef typename LagrangePointSetType::template Codim< 0 >::SubEntityIteratorType
40 typedef std::map< const GeometryType, const LagrangePointSetType * > LagrangePointSetMapType;
43 ~LagrangeLocalRestrictProlong ()
45 typedef typename LagrangePointSetMapType::iterator Iterator;
46 const Iterator end = lagrangePointSet_.end();
47 for( Iterator it = lagrangePointSet_.begin(); it != end; ++it )
51 template<
class DomainField >
52 void setFatherChildWeight (
const DomainField &weight ) {}
54 template<
class LFFather,
class LFSon,
class LocalGeometry >
55 void restrictLocal ( LFFather &lfFather,
57 const LocalGeometry &geometryInFather,
58 const bool initialize )
const
60 static const int dimRange = LFSon::dimRange;
64 const LagrangePointSetType &pointSet = lagrangePointSet( lfFather.entity(), lfFather.order() );
66 const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
67 for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
69 const unsigned int dof = *sit;
70 const DomainVector &pointInFather = pointSet.point( dof );
71 const DomainVector pointInSon = geometryInFather.local( pointInFather );
72 if( refSon.checkInside( pointInSon ) )
74 typename LFSon::RangeType phi;
75 lfSon.evaluate( pointInSon, phi );
76 for(
int coordinate = 0; coordinate < dimRange; ++coordinate )
77 lfFather[ dimRange * dof + coordinate ] = phi[ coordinate ];
81 template<
class LFFather >
82 void restrictFinalize ( LFFather &lfFather )
const
85 template<
class LFFather,
class LFSon,
class LocalGeometry >
86 void prolongLocal (
const LFFather &lfFather, LFSon &lfSon,
87 const LocalGeometry &geometryInFather,
88 bool initialize )
const
90 static const int dimRange = LFFather::dimRange;
92 const LagrangePointSetType &pointSet = lagrangePointSet( lfSon.entity(), lfSon.order() );
94 const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
95 for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
97 const unsigned int dof = *sit;
98 const DomainVector &pointInSon = pointSet.point( dof );
99 const DomainVector pointInFather = geometryInFather.global( pointInSon );
101 typename LFFather::RangeType phi;
102 lfFather.evaluate( pointInFather, phi );
103 for(
int coordinate = 0; coordinate < dimRange; ++coordinate )
104 lfSon[ dimRange * dof + coordinate ] = phi[ coordinate ];
108 bool needCommunication ()
const {
return true; }
111 template<
class Entity >
112 const LagrangePointSetType &lagrangePointSet (
const Entity &entity,
const int order )
const
114 return lagrangePointSet( entity.type(), order );
117 const LagrangePointSetType &lagrangePointSet (
const GeometryType &type,
const int order )
const
119 typedef typename LagrangePointSetMapType::iterator Iterator;
120 Iterator it = lagrangePointSet_.find( type );
121 if( it == lagrangePointSet_.end() )
122 it = lagrangePointSet_.insert( it, std::make_pair( type,
new LagrangePointSetType( type, order ) ) );
123 assert( it->second != 0 );
124 return *(it->second);
128 mutable LagrangePointSetMapType lagrangePointSet_;
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.