DUNE-FEM (unstable)

cornerpointset.hh
1#ifndef DUNE_FEM_CORNERPOINTSET_HH
2#define DUNE_FEM_CORNERPOINTSET_HH
3
4#include <dune/geometry/referenceelements.hh>
5
6#include <dune/fem/quadrature/cachingquadrature.hh>
7
8namespace Dune
9{
10
11 namespace Fem
12 {
13
14 // Internal Forward Declarations
15 // -----------------------------
16
17 template< class GridPart >
18 class CornerPointSet;
19
20 template< class ct, Dune::GeometryType::Id geometryId >
21 class CornerPointList;
22
23
24
25 // CornerPointSetTraits
26 // --------------------
27
28 template< class GridPart >
29 class CornerPointSetTraits
30 {
31 template< class ct, int dim >
32 class PointListTraits;
33
34 public:
35 typedef IntegrationPointList< typename GridPart::ctype, GridPart::dimension, PointListTraits >
36 IntegrationPointListType;
37 typedef typename IntegrationPointListType::CoordinateType CoordinateType;
38 };
39
40
41
42 // CornerPointSetTraits::PointListTraits
43 // -------------------------------------
44
45 template< class GridPart >
46 template< class ct, int dim >
47 class CornerPointSetTraits< GridPart >::PointListTraits
48 {
49 static const int pdim = (dim > 0 ? dim : 1);
50
51 public:
52 typedef IntegrationPointListImp< ct, dim > IntegrationPointListType;
53
54 static constexpr Dune::GeometryType::Id simplexId = Dune::GeometryTypes::simplex(dim);
55 static constexpr Dune::GeometryType::Id cubeId = Dune::GeometryTypes::cube(dim);
56 static constexpr Dune::GeometryType::Id prismId = Dune::GeometryTypes::prism ;
57 static constexpr Dune::GeometryType::Id pyramidId = Dune::GeometryTypes::pyramid;
58
59 typedef CornerPointList< ct, simplexId > SimplexQuadratureType;
60 typedef CornerPointList< ct, cubeId > CubeQuadratureType;
61 typedef CornerPointList< ct, prismId > PrismQuadratureType;
62 typedef CornerPointList< ct, pyramidId > PyramidQuadratureType;
63
64 typedef SimplexQuadratureType PointQuadratureType;
65 typedef SimplexQuadratureType LineQuadratureType;
66
67 typedef int QuadratureKeyType ;
68 };
69
70
71
72 // CornerPointSet
73 // --------------
74
75 template< class GridPart >
76 class CornerPointSet
77 : public CachingPointList< GridPart, 0, CornerPointSetTraits< GridPart > >
78 {
79 typedef CachingPointList< GridPart, 0, CornerPointSetTraits< GridPart > > BaseType;
80
81 public:
82 CornerPointSet ( const GeometryType &type )
83 : BaseType( type, 1 )
84 {
85 // assert( ! type.isNone() );
86 }
87
88 CornerPointSet ( const typename GridPart::template Codim< 0 >::EntityType &entity )
89 : CornerPointSet( entity.type() )
90 {
91 }
92 };
93
94
95
96 // CornerPointList
97 // ---------------
98
99 template< class ct, Dune::GeometryType::Id geometryId >
100 class CornerPointList
101 : public IntegrationPointListImp< ct, Dune::GeometryType(geometryId).dim() >
102 {
103 typedef IntegrationPointListImp< ct, Dune::GeometryType(geometryId).dim() > BaseType;
104
105 public:
106 typedef typename BaseType::CoordinateType CoordinateType;
107
108 explicit CornerPointList ( const size_t id );
109 CornerPointList ( const GeometryType &type, const int order, const size_t id );
110
111 int order () const { return 1; }
112
113 static unsigned int maxOrder () { return 1; }
114
115 GeometryType geometryType () const { return GeometryType( geometryId ); }
116
117 protected:
119
120 private:
121 void initialize ();
122 };
123
124
125
126 // Implementation of CornerPointList
127 // ---------------------------------
128
129 template< class ct, Dune::GeometryType::Id geometryId >
130 inline CornerPointList< ct, geometryId >::CornerPointList ( const size_t id )
131 : BaseType( id )
132 {
133 initialize();
134 }
135
136
137 template< class ct, Dune::GeometryType::Id geometryId >
138 inline CornerPointList< ct, geometryId >
139 ::CornerPointList ( const GeometryType &type, const int order, const size_t id )
140 : BaseType( id )
141 {
142 initialize();
143 }
144
145
146 template< class ct, Dune::GeometryType::Id geometryId >
147 inline void CornerPointList< ct, geometryId >::initialize ()
148 {
149 static constexpr GeometryType gt( geometryId );
150 const auto &refElement = Dune::ReferenceElements< ct, gt.dim() >::general( gt );
151 const unsigned int size = refElement.size( gt.dim() );
152 for( unsigned int i = 0; i < size; ++i )
153 addIntegrationPoint( refElement.position( i, gt.dim() ) );
154 }
155
156 } //namespace Fem
157
158} //namespace Dune
159
160#endif // #ifndef DUNE_FEM_CORNERPOINTSET_HH
void addIntegrationPoint(const CoordinateType &point)
Adds an integration point to the list.
Definition: quadratureimp.hh:169
IntegrationPointListImp(size_t id)
Constructor.
Definition: quadratureimp.hh:76
FieldVector< FieldType, dim > CoordinateType
type of local coordinates
Definition: quadratureimp.hh:46
IntegrationPointListType::CoordinateType CoordinateType
type of coordinate
Definition: quadrature.hh:180
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
constexpr unsigned int dim() const
Return dimension of the type.
Definition: type.hh:360
GeometryType geometryType(const Dune::GeometryType &t)
mapping from GeometryType to VTKGeometryType
Definition: common.hh:151
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:158
constexpr GeometryType cube(unsigned int dim)
Returns a GeometryType representing a hypercube of dimension dim.
Definition: type.hh:462
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:528
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition: type.hh:522
constexpr GeometryType simplex(unsigned int dim)
Returns a GeometryType representing a simplex of dimension dim.
Definition: type.hh:453
Dune namespace.
Definition: alignedallocator.hh:13
Class providing access to the singletons of the reference elements.
Definition: referenceelements.hh:128
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)