33 #include <boost/multi_array.hpp>
56 template<
int M,
int N>
67 static const uint16_type imorder = 0;
68 static const bool imIsPoly =
true;
69 static const bool is_terminal =
true;
71 template<
typename Func>
72 struct HasTestFunction
74 static const bool result =
false;
77 template<
typename Func>
78 struct HasTrialFunction
80 static const bool result =
false;
83 typedef Ones<M,N> this_type;
84 typedef double value_type;
91 template<
typename EigenMatrix>
92 Ones( EigenMatrix
const& m )
99 Ones( Ones
const & eig )
101 M_values( eig.M_values )
134 Eigen::Matrix<double,M,N>
const& ones()
const
140 template<
typename Geo_t,
typename Basis_i_t,
typename Basis_j_t>
143 typedef this_type expression_type;
144 typedef typename expression_type::value_type value_type;
145 typedef value_type return_value_type;
146 typedef typename mpl::if_<fusion::result_of::has_key<Geo_t,vf::detail::gmc<0> >,
147 mpl::identity<vf::detail::gmc<0> >,
148 mpl::identity<vf::detail::gmc<1> > >::type::type key_type;
149 typedef typename fusion::result_of::value_at_key<Geo_t,key_type>::type::element_type* gmc_ptrtype;
150 typedef typename fusion::result_of::value_at_key<Geo_t,key_type>::type::element_type gmc_type;
152 struct INVALID_SHAPE {};
153 static const bool eq11 = ( M==1 )&&( N==1 );
154 static const bool eqD1 = ( M==gmc_type::nDim )&&( N==1 );
155 static const bool eq1D = ( M==1 )&&( N==gmc_type::nDim );
156 static const bool eqDD = ( M==gmc_type::nDim )&&( N==gmc_type::nDim );
157 typedef typename mpl::if_< mpl::bool_<eq11>,
158 mpl::identity<Shape<gmc_type::nDim, Scalar, false, false> >,
159 typename mpl::if_< mpl::bool_<eqD1>,
160 mpl::identity<Shape<gmc_type::nDim, Vectorial, false, false> >,
161 typename mpl::if_< mpl::bool_<eq1D>,
162 mpl::identity<Shape<gmc_type::nDim, Vectorial, true, false> >,
163 typename mpl::if_< mpl::bool_<eqDD>,
164 mpl::identity<Shape<gmc_type::nDim, Tensor2, false, false> >,
165 mpl::identity<INVALID_SHAPE> >::type>::type>::type>::type::type shape;
168 template <
class Args>
struct sig
170 typedef value_type type;
175 static const bool value =
false;
178 tensor( this_type
const& expr,Geo_t
const&, Basis_i_t
const&, Basis_j_t
const& )
181 M_values( expr.ones() )
186 tensor( this_type
const& expr,Geo_t
const&, Basis_i_t
const& )
189 M_values( expr.ones() )
193 tensor( this_type
const& expr, Geo_t
const& )
196 M_values( expr.ones() )
199 template<
typename IM>
200 void init( IM
const& )
204 void update( Geo_t
const&, Basis_i_t
const&, Basis_j_t
const& )
207 void update( Geo_t
const&, Basis_i_t
const& )
210 void update( Geo_t
const& )
216 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q )
const
218 Feel::detail::ignore_unused_variable_warning( i );
219 Feel::detail::ignore_unused_variable_warning( j );
220 Feel::detail::ignore_unused_variable_warning( q );
221 return eval( c1, c2, mpl::int_<shape::rank>() );
224 template<
int PatternContext>
226 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q,
227 mpl::int_<PatternContext> )
const
229 Feel::detail::ignore_unused_variable_warning( i );
230 Feel::detail::ignore_unused_variable_warning( j );
231 Feel::detail::ignore_unused_variable_warning( q );
232 return eval( c1, c2, mpl::int_<shape::rank>() );
236 evaliq( uint16_type i, uint16_type c1, uint16_type c2, uint16_type q )
const
238 Feel::detail::ignore_unused_variable_warning( i );
239 Feel::detail::ignore_unused_variable_warning( q );
240 return eval( c1, c2, mpl::int_<shape::rank>() );
243 evalq( uint16_type c1, uint16_type c2, uint16_type q )
const
245 Feel::detail::ignore_unused_variable_warning( q );
246 return eval( c1, c2, mpl::int_<shape::rank>() );
250 eval(
int c1,
int c2, mpl::int_<0> )
const
252 Feel::detail::ignore_unused_variable_warning( c1 );
253 Feel::detail::ignore_unused_variable_warning( c2 );
254 return M_values(0,0);
257 eval(
int c1,
int c2, mpl::int_<1> )
const
259 if ( shape::is_transposed )
260 return M_values(0,c2);
262 return M_values(c1,0);
265 eval(
int c1,
int c2, mpl::int_<2> )
const
267 return M_values(c1,c2);
270 Eigen::Matrix<double,M,N> M_values;
273 Eigen::Matrix<double,M,N> M_values;
292 template<
int M,
int N=M>
294 Expr<vf::detail::Ones<M,N> >
297 return Expr<vf::detail::Ones<M,N> >( vf::detail::Ones<M, N>(Eigen::Matrix<double,M,N>::Ones()) );
300 template<
int M,
int N=M>
302 Expr<vf::detail::Ones<M,N> >
305 return Expr<vf::detail::Ones<M,N> >( vf::detail::Ones<M, N>(Eigen::Matrix<double,M,N>::Zero()) );
308 template<
int M,
int N=M>
310 Expr<vf::detail::Ones<M,N> >
313 return Expr<vf::detail::Ones<M,N> >( vf::detail::Ones<M, N>(Eigen::Matrix<double,M,N>::Identity()) );
316 template<
int M,
int N=M>
318 Expr<vf::detail::Ones<M,N> >
321 return Expr<vf::detail::Ones<M,N> >( vf::detail::Ones<M, N>(Eigen::Matrix<double,M,N>::Identity()) );
324 template<
int M,
int N=M>
326 Expr<vf::detail::Ones<M,N> >
327 constant(
double value )
329 return Expr<vf::detail::Ones<M,N> >( vf::detail::Ones<M, N>(Eigen::Matrix<double,M,N>::Constant( value )) );