30 #ifndef __GeometricData_H
31 #define __GeometricData_H 1
33 # include <boost/preprocessor/comparison/less.hpp>
34 # include <boost/preprocessor/logical/and.hpp>
35 # include <boost/preprocessor/control/if.hpp>
36 # include <boost/preprocessor/list/at.hpp>
37 # include <boost/preprocessor/list/cat.hpp>
38 # include <boost/preprocessor/list/for_each_product.hpp>
39 # include <boost/preprocessor/logical/or.hpp>
40 # include <boost/preprocessor/tuple/to_list.hpp>
41 # include <boost/preprocessor/tuple/eat.hpp>
42 # include <boost/preprocessor/facilities/empty.hpp>
43 # include <boost/preprocessor/punctuation/comma.hpp>
44 # include <boost/preprocessor/facilities/identity.hpp>
54 # define VF_GD_SYMBOL(O) BOOST_PP_TUPLE_ELEM(7, 0, O)
55 # define VF_GD_NAME(O) BOOST_PP_TUPLE_ELEM(7, 1, O)
56 # define VF_GD_DIM(O) BOOST_PP_TUPLE_ELEM(7, 2, O)
57 # define VF_GD_CONTEXT(O) BOOST_PP_TUPLE_ELEM(7, 3, O)
58 # define VF_GD_RETURN(O) BOOST_PP_TUPLE_ELEM(7, 4, O)
59 # define VF_GD_VALUE(O) BOOST_PP_TUPLE_ELEM(7, 5, O)
60 # define VF_GD_IMORDER(O) BOOST_PP_TUPLE_ELEM(7, 6, O)
64 const size_type jn = vm::JACOBIAN|vm::NORMAL;
65 const size_type jkbn = vm::JACOBIAN|vm::KB|vm::NORMAL;
66 const size_type jt = vm::JACOBIAN|vm::NORMAL|vm::TANGENT;
67 const size_type jp = vm::JACOBIAN|vm::POINT;
68 const size_type jkp = vm::KB|vm::JACOBIAN|vm::POINT;
73 BOOST_PP_TUPLE_TO_LIST( \
76 ( N , GDN , 0, jkbn, Vectorial, M_gmc->unitNormal( q )[ c1 ] , 0), \
77 ( Nx , GDNx , 0, jkbn, Scalar , M_gmc->unitNormal( q )[ 0 ] , 0), \
78 ( Ny , GDNy , 1, jkbn, Scalar , M_gmc->unitNormal( q )[ 1 ] , 0), \
79 ( Nz , GDNz , 2, jkbn, Scalar , M_gmc->unitNormal( q )[ 2 ] , 0), \
80 ( Nref , GDNref , 0, 0, Vectorial, M_gmc->refNormal( q )[ c1 ] , 0), \
81 ( normalNorm, GDnormalNorm, 0, 0, Scalar, M_gmc->normalNorm( q ) , 0), \
82 ( T , GDT , 0, jt, Vectorial, M_gmc->tangent( q )[ c1 ], 0), \
83 ( Tx , GDTx , 0, jt, Scalar , M_gmc->tangent( q )[ 0 ] , 0), \
84 ( Ty , GDTy , 1, jt, Scalar , M_gmc->tangent( q )[ 1 ] , 0), \
85 ( Tz , GDTz , 2, jt, Scalar , M_gmc->tangent( q )[ 2 ] , 0), \
86 ( detJ , GDDetJ , 0, jp, Scalar , M_gmc->J( q ) , 0), \
87 ( J , GDJ , 0, jkp,Tensor2 , M_gmc->K( c1, c2, q ) , 0), \
88 ( JinvT , GDJinv , 0, jkp,Tensor2 , M_gmc->B( c1, c2, q ) , 0), \
89 ( P , GDP , 0, jp, Vectorial, M_gmc->xReal( q )[ c1 ] , 1), \
90 ( Px , GDPx , 0, jp, Scalar , M_gmc->xReal( q )[ 0 ] , 1), \
91 ( Py , GDPy , 1, jp, Scalar , M_gmc->xReal( q )[ 1 ] , 1), \
92 ( Pz , GDPz , 2, jp, Scalar , M_gmc->xReal( q )[ 2 ] , 1), \
93 ( C , GDC , 0, jp, Vectorial, M_gmc->barycenterReal()[c1] , 0), \
94 ( Cx , GDCx , 0, jp, Scalar , M_gmc->barycenterReal()[0] , 0), \
95 ( Cy , GDCy , 1, jp, Scalar , M_gmc->barycenterReal()[1] , 0), \
96 ( Cz , GDCz , 2, jp, Scalar , M_gmc->barycenterReal()[2] , 0) \
101 BOOST_PP_TUPLE_TO_LIST( \
104 ( h , GDH , 0, 0 , Scalar , M_gmc->h() , 0), \
105 ( hFace , GDHFace , 0, 0 , Scalar , M_gmc->hFace() , 0), \
106 ( meas , GDMeas , 0, 0 , Scalar , M_gmc->meas() , 0), \
107 ( measPEN , GDMeasPEN , 0, 0 , Scalar , M_gmc->measurePointElementNeighbors(), 0), \
108 ( nPEN , GDNPEN , 0, 0 , Scalar , M_gmc->element().numberOfPointElementNeighbors(), 0), \
109 ( measFace, GDHMeasFace,0, 0 , Scalar , M_gmc->measFace() , 0), \
110 ( eid , GDEid , 0, 0 , Scalar , M_gmc->id() , 0), \
111 ( emarker , GDEmarker , 0, 0 , Scalar , M_gmc->marker().value() , 0), \
112 ( emarker2, GDEmarker2, 0, 0 , Scalar , M_gmc->marker2().value() , 0) \
118 BOOST_PP_TUPLE_TO_LIST( \
121 ( N , GDN , 0, jn, Vectorial, M_gmc->unitNormal( q )[ c1 ] , 0), \
122 ( Nx , GDNx , 0, jn, Scalar , M_gmc->unitNormal( q )[ 0 ] , 0), \
123 ( Ny , GDNy , 1, jn, Scalar , M_gmc->unitNormal( q )[ 1 ] , 0), \
124 ( Nz , GDNz , 2, jn, Scalar , M_gmc->unitNormal( q )[ 2 ] , 0), \
125 ( T , GDT , 0, jn, Vectorial, M_gmc->unitTangent( q )[ c1 ], 0), \
126 ( Tx , GDTx , 0, jn, Scalar , M_gmc->unitTangent( q )[ 0 ] , 0), \
127 ( Ty , GDTy , 1, jn, Scalar , M_gmc->unitTangent( q )[ 1 ] , 0), \
128 ( Tz , GDTz , 2, jn, Scalar , M_gmc->unitTangent( q )[ 2 ] , 0), \
129 ( P , GDP , 0, jp, Vectorial, M_gmc->xReal( q )[ c1 ] , 1), \
130 ( Px , GDPx , 0, jp, Scalar , M_gmc->xReal( q )[ 0 ] , 1), \
131 ( Py , GDPy , 1, jp, Scalar , M_gmc->xReal( q )[ 1 ] , 1), \
132 ( Pz , GDPz , 2, jp, Scalar , M_gmc->xReal( q )[ 2 ] , 1), \
133 ( C , GDC , 0, jp, Vectorial, M_gmc->barycenterReal()[c1] , 0), \
134 ( Cx , GDCx , 0, jp, Scalar , M_gmc->barycenterReal()[0] , 0), \
135 ( Cy , GDCy , 1, jp, Scalar , M_gmc->barycenterReal()[1] , 0), \
136 ( Cz , GDCz , 2, jp, Scalar , M_gmc->barycenterReal()[2] , 0), \
137 ( h , GDH , 0, 0 , Scalar , M_gmc->h() , 0), \
138 ( hFace , GDHFace , 0, 0 , Scalar , M_gmc->hFace() , 0), \
139 ( eid , GDEid , 0, 0 , Scalar , M_gmc->id() , 0), \
140 ( emarker , GDEmarker , 0, 0 , Scalar , M_gmc->marker().value() , 0) \
149 # define VF_ARRAY_GD(_, O) \
153 #define VF_ARRAY_GD_CODE(O) \
154 class VF_GD_NAME( O ) \
158 static const size_type context = VF_GD_CONTEXT( O ); \
159 static const bool is_terminal = false; \
161 static const uint16_type imorder = VF_GD_IMORDER(O); \
162 static const bool imIsPoly = true; \
164 template<typename Func> \
165 struct HasTestFunction \
167 static const bool result = false; \
170 template<typename Func> \
171 struct HasTrialFunction \
173 static const bool result = false; \
175 typedef VF_GD_NAME(O) this_type; \
176 typedef double value_type; \
181 VF_GD_NAME(O) ( VF_GD_NAME(O) const& ) \
184 template<typename TheExpr> \
187 typedef this_type type; \
189 template<typename TheExpr> \
190 typename Lambda<TheExpr>::type \
191 operator()( TheExpr const& e ) { return this_type(); } \
194 template<typename Geo_t, typename Basis_i_t, typename Basis_j_t = Basis_i_t> \
197 typedef this_type expression_type; \
198 typedef typename mpl::if_<fusion::result_of::has_key<Geo_t,vf::detail::gmc<0> >, \
199 mpl::identity<vf::detail::gmc<0> >, \
200 mpl::identity<vf::detail::gmc<1> > >::type::type key_type; \
201 typedef typename fusion::result_of::value_at_key<Geo_t,key_type>::type::element_type* gmc_ptrtype; \
202 typedef typename fusion::result_of::value_at_key<Geo_t,key_type>::type::element_type gmc_type; \
203 typedef typename gmc_type::value_type value_type; \
204 typedef VF_GD_RETURN(O)<gmc_type::NDim> return_value_type; \
205 typedef Shape<gmc_type::NDim, VF_GD_RETURN(O), false> shape; \
207 struct is_zero { static const bool value = false; }; \
209 tensor( this_type const& , \
211 Basis_i_t const& , Basis_j_t const& ) \
213 M_gmc( fusion::at_key<key_type>( geom ).get() ) \
215 tensor( this_type const& , \
219 M_gmc( fusion::at_key<key_type>( geom ).get() ) \
221 tensor( this_type const& , \
222 Geo_t const& geom ) \
224 M_gmc( fusion::at_key<key_type>( geom ).get() ) \
226 template<typename IM> \
227 void init( IM const& im ) \
230 void update( Geo_t const& geom, Basis_i_t const& , Basis_j_t const& ) \
234 void update( Geo_t const& geom, Basis_i_t const& ) \
238 void update( Geo_t const& geom ) \
240 M_gmc = fusion::at_key<key_type>( geom ).get(); \
242 void update( Geo_t const& geom, uint16_type face ) \
249 evalijq( uint16_type , uint16_type , uint16_type c1, uint16_type c2, uint16_type q ) const \
251 return evalq_( c1, c2, q, mpl::bool_<(VF_GD_DIM(O) < gmc_type::NDim)>(), mpl::int_<100>() ); \
253 template<int PatternContext> \
255 evalijq( uint16_type , uint16_type , uint16_type c1, uint16_type c2, uint16_type q, mpl::int_<PatternContext> ) const \
257 return evalq_( c1, c2, q, mpl::bool_<(VF_GD_DIM(O) < gmc_type::NDim)>(), mpl::int_<100>() ); \
261 evaliq( uint16_type , uint16_type c1, uint16_type c2, uint16_type q ) const \
263 return evalq_( c1, c2, q, mpl::bool_<(VF_GD_DIM(O) < gmc_type::NDim)>(), mpl::int_<100>() ); \
266 evalq( uint16_type c1, uint16_type c2, uint16_type q ) const \
268 return evalq_( c1, c2, q, mpl::bool_<(VF_GD_DIM(O) < gmc_type::NDim)>(), mpl::int_<100>() ); \
272 evalq_( uint16_type, uint16_type, uint16_type , mpl::bool_<false>, mpl::int_<100> ) const \
277 evalq_( uint16_type c1, uint16_type c2, uint16_type q, mpl::bool_<true>, mpl::int_<100> ) const \
279 Feel::detail::ignore_unused_variable_warning(q); \
280 Feel::detail::ignore_unused_variable_warning(c1); \
281 Feel::detail::ignore_unused_variable_warning(c2); \
282 return VF_GD_VALUE( O ); \
288 Expr< VF_GD_NAME( O )> \
291 typedef VF_GD_NAME( O ) expr_t; \
292 return Expr< expr_t >( expr_t() ); \
299 BOOST_PP_LIST_FOR_EACH_PRODUCT( VF_ARRAY_GD, 1, ( VF_GD ) )
300 BOOST_PP_LIST_FOR_EACH_PRODUCT( VF_ARRAY_GD, 1, ( VF_GD2 ) )
size_t size_type
Indices (starting from 0)
Definition: feelcore/feel.hpp:319