dune-fem 2.12-git
Loading...
Searching...
No Matches
lagrange/restrictprolong.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_SPACE_LAGRANGE_RESTRICTPROLONG_HH
2#define DUNE_FEM_SPACE_LAGRANGE_RESTRICTPROLONG_HH
3
4#if __GNUC__ >= 13
5#pragma GCC diagnostic push
6#pragma GCC diagnostic ignored "-Wdangling-reference"
7#endif
8
9// C++ includes
10#include <map>
11
12// dune-geometry includes
14#include <dune/geometry/type.hh>
15
16// dune-fem includes
18
19// local includes
20#include "lagrangepoints.hh"
21
22
23namespace Dune
24{
25
26 namespace Fem
27 {
28
29 template< class G, int ord >
31 {
32 typedef G GridType;
33
34 typedef typename GridType::ctype ctype;
35 static const int dimension = GridType::dimension;
36
38
40
41 private:
42 typedef typename LagrangePointSetType::template Codim< 0 >::SubEntityIteratorType
43 EntityDofIterator;
44
46
47 public:
49 {
50 typedef typename LagrangePointSetMapType::iterator Iterator;
51 const Iterator end = lagrangePointSet_.end();
52 for( Iterator it = lagrangePointSet_.begin(); it != end; ++it )
53 delete it->second;
54 }
55
56 template< class DomainField >
57 void setFatherChildWeight ( const DomainField &weight ) {}
58
59 template< class LFFather, class LFSon, class LocalGeometry >
60 void restrictLocal ( LFFather &lfFather,
61 const LFSon &lfSon,
62 const LocalGeometry &geometryInFather,
63 const bool initialize ) const
64 {
65 static const int dimRange = LFSon::dimRange;
66
67 const auto &refSon = Dune::ReferenceElements< ctype, dimension >::general( lfSon.entity().type() );
68
69 const LagrangePointSetType &pointSet = lagrangePointSet( lfFather.entity(), lfFather.order() );
70
71 const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
72 for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
73 {
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 ) )
78 {
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 ];
83 }
84 }
85 }
86 template< class LFFather >
87 void restrictFinalize ( LFFather &lfFather ) const
88 {}
89
90 template< class LFFather, class LFSon, class LocalGeometry >
91 void prolongLocal ( const LFFather &lfFather, LFSon &lfSon,
92 const LocalGeometry &geometryInFather,
93 bool initialize ) const
94 {
95 static const int dimRange = LFFather::dimRange;
96
97 const LagrangePointSetType &pointSet = lagrangePointSet( lfSon.entity(), lfSon.order() );
98
99 const EntityDofIterator send = pointSet.template endSubEntity< 0 >( 0 );
100 for( EntityDofIterator sit = pointSet.template beginSubEntity< 0 >( 0 ); sit != send; ++sit )
101 {
102 const unsigned int dof = *sit;
103 const DomainVector &pointInSon = pointSet.point( dof );
104 const DomainVector pointInFather = geometryInFather.global( pointInSon );
105
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 ];
110 }
111 }
112
113 bool needCommunication () const { return true; }
114
115 protected:
116 template< class Entity >
117 const LagrangePointSetType &lagrangePointSet ( const Entity &entity, const int order ) const
118 {
119 return lagrangePointSet( entity.type(), order );
120 }
121
122 const LagrangePointSetType &lagrangePointSet ( const GeometryType &type, const int order ) const
123 {
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);
130 }
131
132 private:
133 mutable LagrangePointSetMapType lagrangePointSet_;
134 };
135
136 } // namespace Fem
137
138} // namespace Dune
139
140#if __GNUC__ >= 13
141#pragma GCC diagnostic pop
142#endif
143
144#endif // #ifndef DUNE_FEM_SPACE_LAGRANGE_RESTRICTPROLONG_HH
iterator end()
static const Point & coordinate(const Point &x)
Definition coordinate.hh:14
GeometryType type() const
Definition lagrangepoints.hh:688
Definition lagrange/restrictprolong.hh:31
bool needCommunication() const
Definition lagrange/restrictprolong.hh:113
void restrictFinalize(LFFather &lfFather) const
Definition lagrange/restrictprolong.hh:87
~LagrangeLocalRestrictProlong()
Definition lagrange/restrictprolong.hh:48
static const int dimension
Definition lagrange/restrictprolong.hh:35
const LagrangePointSetType & lagrangePointSet(const GeometryType &type, const int order) const
Definition lagrange/restrictprolong.hh:122
GridType::ctype ctype
Definition lagrange/restrictprolong.hh:34
void restrictLocal(LFFather &lfFather, const LFSon &lfSon, const LocalGeometry &geometryInFather, const bool initialize) const
Definition lagrange/restrictprolong.hh:60
G GridType
Definition lagrange/restrictprolong.hh:32
LagrangePointSet< LeafGridPart< GridType >, ord > LagrangePointSetType
Definition lagrange/restrictprolong.hh:39
FieldVector< ctype, dimension > DomainVector
Definition lagrange/restrictprolong.hh:37
void setFatherChildWeight(const DomainField &weight)
Definition lagrange/restrictprolong.hh:57
void prolongLocal(const LFFather &lfFather, LFSon &lfSon, const LocalGeometry &geometryInFather, bool initialize) const
Definition lagrange/restrictprolong.hh:91
const LagrangePointSetType & lagrangePointSet(const Entity &entity, const int order) const
Definition lagrange/restrictprolong.hh:117
T begin(T... args)
T end(T... args)
T find(T... args)
T insert(T... args)
T make_pair(T... args)