3 #ifndef DUNE_EQUIDISTANTPOINTS_HH
4 #define DUNE_EQUIDISTANTPOINTS_HH
8 #include <dune/common/fvector.hh>
9 #include <dune/common/forloop.hh>
10 #include <dune/geometry/topologyfactory.hh>
11 #include <dune/geometry/genericgeometry/topologytypes.hh>
12 #include <dune/geometry/genericgeometry/subtopologies.hh>
23 template<
class F,
unsigned int dim >
24 class EquidistantPointSet;
29 template<
class Topology,
class F >
30 class EquidistantPointSetImpl;
33 class EquidistantPointSetImpl< GenericGeometry::Point, F >
37 typedef GenericGeometry::Point Topology;
40 friend class EquidistantPointSetImpl< GenericGeometry::Prism< Topology >, F >;
41 friend class EquidistantPointSetImpl< GenericGeometry::Pyramid< Topology >, F >;
46 static const unsigned int dimension = Topology::dimension;
48 static unsigned int size ( const unsigned int order )
54 template<
unsigned int codim,
unsigned int dim >
55 static unsigned int setup (
const unsigned int order,
61 points->
point_ = Field( 0 );
66 template<
class BaseTopology,
class F >
67 class EquidistantPointSetImpl< GenericGeometry::Prism< BaseTopology >, F >
69 typedef EquidistantPointSetImpl< GenericGeometry::Prism< BaseTopology >, F >
This;
71 typedef GenericGeometry::Prism< BaseTopology > Topology;
74 friend class EquidistantPointSetImpl< GenericGeometry::Prism< Topology >, F >;
75 friend class EquidistantPointSetImpl< GenericGeometry::Pyramid< Topology >, F >;
77 typedef EquidistantPointSetImpl< BaseTopology, F > BaseImpl;
82 static const unsigned int dimension = Topology::dimension;
84 static unsigned int size ( const unsigned int order )
86 return BaseImpl::size( order ) * (order+1);
90 template<
unsigned int codim,
unsigned int dim >
91 static unsigned int setup (
const unsigned int order,
95 unsigned int size = 0;
96 unsigned int numBaseN = 0;
98 if( codim < dimension )
100 const unsigned int vcodim = (codim < dimension ? codim : dimension-1);
102 for(
unsigned int i = 1; i < order; ++i )
104 const unsigned int n = BaseImpl::template setup< vcodim, dim >( order, count, points );
105 for(
unsigned int j = 0; j < n; ++j )
118 const unsigned int vcodim = (codim > 0 ? codim : 1);
119 const unsigned int numBaseM = GenericGeometry::Size< BaseTopology, vcodim-1 >
::value;
120 const unsigned int n = BaseImpl::template setup< vcodim-1, dim >( order, count+numBaseN, points );
121 for(
unsigned int j = 0; j < n; ++j )
126 points[ j + n ].
point_[ dimension-1 ] =
Field( 1 );
136 template<
class BaseTopology,
class F >
137 class EquidistantPointSetImpl< GenericGeometry::Pyramid< BaseTopology >, F >
139 typedef EquidistantPointSetImpl< GenericGeometry::Pyramid< BaseTopology >, F >
This;
141 typedef GenericGeometry::Pyramid< BaseTopology > Topology;
144 friend class EquidistantPointSetImpl< GenericGeometry::Prism< Topology >, F >;
145 friend class EquidistantPointSetImpl< GenericGeometry::Pyramid< Topology >, F >;
147 typedef EquidistantPointSetImpl< BaseTopology, F > BaseImpl;
152 static const unsigned int dimension = Topology::dimension;
154 static unsigned int size ( const unsigned int order )
156 unsigned int size = BaseImpl::size( order );
157 for(
unsigned int i = 1; i <= order; ++i )
158 size += BaseImpl::size( order - i );
163 template<
unsigned int codim,
unsigned int dim >
164 static unsigned int setup (
const unsigned int order,
168 unsigned int size = 0;
169 unsigned int numBaseM = 0;
173 const unsigned int vcodim = (codim > 0 ? codim : 1);
174 numBaseM = GenericGeometry::Size< BaseTopology, vcodim-1 >
::value;
175 size = BaseImpl::template setup< vcodim-1, dim >( order, count, points );
177 for( ; points != end; ++points )
184 if( codim < dimension )
186 const unsigned int vcodim = (codim < dimension ? codim : dimension-1);
187 for(
unsigned int i = order-1; i > 0; --i )
189 const unsigned int n = BaseImpl::template setup< vcodim, dim >( i, count+numBaseM, points );
191 for( ; points != end; ++points )
195 for(
unsigned int j = 0; j < dimension-1; ++j )
206 points->
point_[ dimension-1 ] = 1;
219 template<
class F,
unsigned int dim >
244 template<
class F,
unsigned int dim >
248 typedef EquidistantPointSetImpl< T, F >
Impl;
257 unsigned int count[
size ];
258 for(
unsigned int i = 0; i <
size; ++i )
265 template<
class F,
unsigned int dim >
269 unsigned int order = Base::order();
272 points_.resize( Impl::size( order ) );
273 LagrangePoint *p = &(points_[ 0 ]);
274 ForLoop< Topology< T >::template Init, 0, dimension >::apply( order, p );