30 #define __Hypercube_H 1
32 #include <boost/detail/identifier.hpp>
33 #include <feel/feelcore/traits.hpp>
34 #include <feel/feelmesh/entities.hpp>
42 template<u
int16_type Dim, u
int16_type Order=1, u
int16_type RDim = Dim>
43 class Hypercube :
public Convex<Dim,Order,RDim>
45 typedef mpl::vector_c<size_type, SHAPE_POINT, SHAPE_LINE, SHAPE_QUAD, SHAPE_HEXA, SHAPE_SP4, SHAPE_SP5> shapes_t;
46 typedef mpl::vector_c<size_type, GEOMETRY_POINT, GEOMETRY_LINE, GEOMETRY_SURFACE, GEOMETRY_VOLUME, GEOMETRY_4, GEOMETRY_5> geometries_t;
48 typedef mpl::vector_c<size_type, 1, 2, 4, 8, 16, 32> vertices_t;
49 typedef mpl::vector_c<size_type, 0, 1, 4, 12, 32> edges_t;
50 typedef mpl::vector_c<size_type, 0, 2, 4, 6, 24> faces_index_t;
51 typedef mpl::vector_c<uint16_type, 0, 0, 1, 6, 24> geo_faces_index_t;
52 typedef mpl::vector_c<uint16_type, 0, 2, 4, 6, 24> normals_t;
53 typedef mpl::vector_c<uint16_type, 0, 0, 0, 1, 8> volumes_t;
55 typedef mpl::vector_c<size_type, 1, Order+1, ( Order+1 )*( Order+1 ), ( Order+1 )*( Order+1 )*( Order+1 ) , ( Order+1 )*( Order+1 )*( Order+1 )*( Order+1 )> points_t;
56 typedef mpl::vector_c<
size_type, 0, Order+1-2, ( Order+1-2 )*( Order+1-2 ), ( Order+1-2 )*( Order+1-2 )*( Order+1-2 ) , ( Order+1-2 )*( Order+1-2 )*( Order+1-2 )*( Order+1-2 )> points_interior_t;
57 typedef mpl::vector_c<
size_type, 0, Order+1-2, Order+1-2, ( Order+1-2 ), ( Order+1-2 )> points_edge_t;
58 typedef mpl::vector_c<
size_type, 0, 0, ( Order+1-2 )*( Order+1-2 ), ( Order+1-2 )*( Order+1-2 ), ( Order+1-2 )*( Order+1-2 ) > points_face_t;
59 typedef mpl::vector_c<
size_type, 0, 0, 0, ( Order+1-2 )*( Order+1-2 )*( Order+1-2 ), ( Order+1-2 )*( Order+1-2 )*( Order+1-2 ) > points_volume_t;
61 template<u
int16_type rdim>
64 typedef mpl::vector<boost::none_t,
65 Hypercube<0, Order, rdim>,
66 Hypercube<1, Order, rdim>,
67 Hypercube<2, Order, rdim> > type;
69 typedef mpl::vector<Hypercube<1, Order>, Hypercube<2, Order>, Hypercube<3, Order>, Hypercube<4, Order>, boost::none_t > elements_t;
71 typedef mpl::vector_c<uint16_type, 0, 1, 2, 8> permutations_t;
75 static const bool is_simplex =
false;
76 static const bool is_hypercube =
true;
78 static const size_type Shape = mpl::at<shapes_t, mpl::int_<Dim> >::type::value;
79 static const size_type Geometry = mpl::at<geometries_t, mpl::int_<Dim> >::type::value;
81 static const uint16_type nDim = Dim;
82 static const uint16_type nOrder = Order;
83 static const uint16_type nRealDim = RDim;
85 static const uint16_type topological_dimension = nDim;
86 static const uint16_type real_dimension = RDim;
88 typedef typename mpl::at<elements_t, mpl::int_<nDim> >::type element_type;
89 typedef typename mpl::at<typename faces_t<real_dimension>::type, mpl::int_<nDim> >::type topological_face_type;
91 static const uint16_type numVertices = mpl::at<vertices_t, mpl::int_<Dim> >::type::value;
92 static const uint16_type numEdges = mpl::at<edges_t, mpl::int_<Dim> >::type::value;
93 static const uint16_type numFaces = mpl::at<geo_faces_index_t, mpl::int_<Dim> >::type::value;
94 static const uint16_type numGeometricFaces = mpl::at<geo_faces_index_t, mpl::int_<nDim> >::type::value;
95 static const uint16_type numTopologicalFaces = mpl::at<faces_index_t, mpl::int_<nDim> >::type::value;
96 static const uint16_type numNormals = mpl::at<normals_t, mpl::int_<nDim> >::type::value;
97 static const uint16_type numVolumes = mpl::at<volumes_t, mpl::int_<nDim> >::type::value;
99 static const uint16_type nbPtsPerVertex = ( nOrder==0 )?0:1;
100 static const uint16_type nbPtsPerEdge = ( nOrder==0 )?( ( nDim==1 )?1:0 ):mpl::at<points_edge_t, mpl::int_<nDim> >::type::value;
101 static const uint16_type nbPtsPerFace = ( nOrder==0 )?( ( nDim==2 )?1:0 ):mpl::at<points_face_t, mpl::int_<nDim> >::type::value;
102 static const uint16_type nbPtsPerVolume = ( nOrder==0 )?( ( nDim==3 )?1:0 ):mpl::at<points_volume_t, mpl::int_<nDim> >::type::value;
103 static const uint16_type numPoints = ( numVertices * nbPtsPerVertex +
104 numEdges * nbPtsPerEdge +
105 numFaces * nbPtsPerFace +
106 numVolumes * nbPtsPerVolume );
108 static const uint16_type orderSquare = boost::mpl::if_<boost::mpl::greater< boost::mpl::int_<Order>,
109 boost::mpl::int_<5> >,
111 typename boost::mpl::if_<boost::mpl::less< boost::mpl::int_<Order>,
112 boost::mpl::int_<1> >,
114 boost::mpl::int_<Order>
119 typedef mpl::vector<boost::none_t, details::line<orderSquare>, details::quad<orderSquare>, details::hexa<orderSquare> > map_entity_to_point_t;
120 typedef typename mpl::at<map_entity_to_point_t, mpl::int_<nDim> >::type edge_to_point_t;
121 typedef typename mpl::at<map_entity_to_point_t, mpl::int_<nDim> >::type face_to_point_t;
122 typedef typename mpl::at<map_entity_to_point_t, mpl::int_<nDim> >::type face_to_edge_t;
125 typedef no_permutation vertex_permutation_type;
127 typedef typename mpl::if_<mpl::greater_equal<mpl::int_<nDim>, mpl::int_<2> >,
128 mpl::identity<line_permutations>,
129 mpl::identity<no_permutation> >::type::type edge_permutation_type;
132 typedef typename mpl::if_<mpl::equal_to<mpl::int_<nDim>, mpl::int_<3> >,
133 mpl::identity<quadrangular_faces>,
134 mpl::identity<no_permutation> >::type::type face_permutation_type;
136 typedef typename mpl::if_<mpl::equal_to<mpl::int_<nDim>, mpl::int_<2> >,
137 mpl::identity<edge_permutation_type>,
138 typename mpl::if_<mpl::equal_to<mpl::int_<nDim>, mpl::int_<3> >,
139 mpl::identity<face_permutation_type>,
140 mpl::identity<no_permutation> >::type>::type::type permutation_type;
142 template<u
int16_type shape_dim, u
int16_type O = Order, u
int16_type R=nDim>
145 typedef Hypercube<shape_dim, O, R> type;
152 uint16_type topologicalDimension()
const
154 return topological_dimension;
160 uint16_type dimension()
const
162 return real_dimension;
168 static uint16_type nPointsOnVertex()
170 return nbPtsPerVertex;
176 static uint16_type nPointsOnEdge()
184 static uint16_type nPointsOnFace()
192 static uint16_type nPointsOnVolume()
194 return nbPtsPerVolume;
207 static const uint32_type value = mpl::if_<mpl::equal_to<mpl::int_<nDim>,mpl::int_<3> >,
208 mpl::identity<mpl::int_<( N+1 )*( N+1 )*( N+1 )> >,
209 typename mpl::if_<mpl::equal_to<mpl::int_<nDim>,mpl::int_<2> >,
210 mpl::identity<mpl::int_<( N+1 )*( N+1 )> >,
211 mpl::identity<mpl::int_<( N+1 )> > >::type>::type::value;
213 static uint32_type polyDims(
int n )
215 return uint32_type( math::pow(
double( n+1 ),
double( nDim ) ) );
223 static int e2p(
int e,
int p )
225 return edge_to_point_t::e2p( e, p );
233 static int f2e(
int f,
int e )
235 return face_to_edge_t::f2e( f, e );
243 static int f2p(
int f,
int p )
245 return face_to_point_t::f2p( f, p );
251 static std::string name()
253 std::ostringstream ostr;
263 static std::string type()