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 >
29 template<
class Topology,
class F >
37 typedef GenericGeometry::Point Topology;
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 >
71 typedef GenericGeometry::Prism< BaseTopology > Topology;
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 >
141 typedef GenericGeometry::Pyramid< BaseTopology > Topology;
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 >
220 class EquidistantPointSet :
public EmptyPointSet<F,dim>
224 typedef EmptyPointSet<F,dim> Base;
244 template<
class F,
unsigned int dim >
246 struct EquidistantPointSet< F, dim >::Topology
248 typedef EquidistantPointSetImpl< T, F > Impl;
254 static void apply (
const unsigned int order, LagrangePoint *&p )
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 );
Vector point_
Definition: emptypoints.hh:39
Definition: equidistantpoints.hh:137
std::vector< LagrangePoint > points_
Definition: emptypoints.hh:99
bool build()
Definition: equidistantpoints.hh:267
static const unsigned int dimension
Definition: equidistantpoints.hh:226
EquidistantPointSet(unsigned int order)
Definition: equidistantpoints.hh:228
Definition: equidistantpoints.hh:24
Definition: emptypoints.hh:15
Definition: equidistantpoints.hh:67
F Field
Definition: equidistantpoints.hh:150
unsigned int subEntity() const
Return number of associated subentity.
Definition: localkey.hh:55
Definition: equidistantpoints.hh:252
Dune::LagrangePoint< Field, dimension > LagrangePoint
Definition: emptypoints.hh:56
unsigned int order() const
Definition: emptypoints.hh:87
static unsigned int setup(const unsigned int order, unsigned int *count, LagrangePoint< Field, dim > *points)
Definition: equidistantpoints.hh:164
Definition: tensor.hh:165
LocalKey localKey_
Definition: emptypoints.hh:40
Definition: brezzidouglasmarini1cube2dlocalbasis.hh:14
Definition: equidistantpoints.hh:33
unsigned int size() const
Definition: emptypoints.hh:92
F Field
Definition: equidistantpoints.hh:80
static bool supports(unsigned int order)
Definition: equidistantpoints.hh:236
static unsigned int setup(const unsigned int order, unsigned int *count, LagrangePoint< Field, dim > *points)
Definition: equidistantpoints.hh:91
Definition: equidistantpoints.hh:30
F Field
Definition: equidistantpoints.hh:44
Describe position of one degree of freedom.
Definition: localkey.hh:21
unsigned int index() const
Return offset within subentity.
Definition: localkey.hh:67
static void apply(const unsigned int order, LagrangePoint *&p)
Definition: equidistantpoints.hh:254