1 #ifndef DUNE_EQUIDISTANTPOINTS_HH
2 #define DUNE_EQUIDISTANTPOINTS_HH
6 #include <dune/common/fvector.hh>
7 #include <dune/common/forloop.hh>
8 #include <dune/geometry/topologyfactory.hh>
9 #include <dune/geometry/genericgeometry/topologytypes.hh>
10 #include <dune/geometry/genericgeometry/subtopologies.hh>
21 template<
class F,
unsigned int dim >
27 template<
class Topology,
class F >
35 typedef GenericGeometry::Point Topology;
44 static const unsigned int dimension = Topology::dimension;
46 static unsigned int size ( const unsigned int order )
52 template<
unsigned int codim,
unsigned int dim >
53 static unsigned int setup (
const unsigned int order,
59 points->
point_ = Field( 0 );
64 template<
class BaseTopology,
class F >
69 typedef GenericGeometry::Prism< BaseTopology > Topology;
80 static const unsigned int dimension = Topology::dimension;
82 static unsigned int size ( const unsigned int order )
84 return BaseImpl::size( order ) * (order+1);
88 template<
unsigned int codim,
unsigned int dim >
89 static unsigned int setup (
const unsigned int order,
93 unsigned int size = 0;
94 unsigned int numBaseN = 0;
96 if( codim < dimension )
98 const unsigned int vcodim = (codim < dimension ? codim : dimension-1);
100 for(
unsigned int i = 1; i < order; ++i )
102 const unsigned int n = BaseImpl::template setup< vcodim, dim >( order, count, points );
103 for(
unsigned int j = 0; j < n; ++j )
116 const unsigned int vcodim = (codim > 0 ? codim : 1);
117 const unsigned int numBaseM = GenericGeometry::Size< BaseTopology, vcodim-1 >
::value;
118 const unsigned int n = BaseImpl::template setup< vcodim-1, dim >( order, count+numBaseN, points );
119 for(
unsigned int j = 0; j < n; ++j )
124 points[ j + n ].
point_[ dimension-1 ] =
Field( 1 );
134 template<
class BaseTopology,
class F >
139 typedef GenericGeometry::Pyramid< BaseTopology > Topology;
150 static const unsigned int dimension = Topology::dimension;
152 static unsigned int size ( const unsigned int order )
154 unsigned int size = BaseImpl::size( order );
155 for(
unsigned int i = 1; i <= order; ++i )
156 size += BaseImpl::size( order - i );
161 template<
unsigned int codim,
unsigned int dim >
162 static unsigned int setup (
const unsigned int order,
166 unsigned int size = 0;
167 unsigned int numBaseM = 0;
171 const unsigned int vcodim = (codim > 0 ? codim : 1);
172 numBaseM = GenericGeometry::Size< BaseTopology, vcodim-1 >
::value;
173 size = BaseImpl::template setup< vcodim-1, dim >( order, count, points );
175 for( ; points != end; ++points )
182 if( codim < dimension )
184 const unsigned int vcodim = (codim < dimension ? codim : dimension-1);
185 for(
unsigned int i = order-1; i > 0; --i )
187 const unsigned int n = BaseImpl::template setup< vcodim, dim >( i, count+numBaseM, points );
189 for( ; points != end; ++points )
193 for(
unsigned int j = 0; j < dimension-1; ++j )
204 points->
point_[ dimension-1 ] = 1;
217 template<
class F,
unsigned int dim >
218 class EquidistantPointSet :
public EmptyPointSet<F,dim>
222 typedef EmptyPointSet<F,dim> Base;
243 template<
class F,
unsigned int dim >
245 struct EquidistantPointSet< F, dim >::Topology
247 typedef EquidistantPointSetImpl< T, F > Impl;
256 unsigned int count[
size ];
257 for(
unsigned int i = 0; i <
size; ++i )
264 template<
class F,
unsigned int dim >
268 unsigned int order = Base::order();
271 points_.resize( Impl::size( order ) );
272 LagrangePoint *p = &(points_[ 0 ]);
273 ForLoop< Topology< T >::template Init, 0, dimension >::apply( order, p );