30 #ifndef __FEELPP_FUNCTIONALS2_HPP
31 #define __FEELPP_FUNCTIONALS2_HPP 1
35 #include <feel/feelpoly/quadpoint.hpp>
53 template<
typename Space,
typename Poly = Space>
62 typedef typename super::space_type space_type;
63 typedef typename Poly::polynomial_type polynomial_type;
64 typedef typename space_type::value_type value_type;
79 std::cout <<
"p.coeff = " << p.
coeff() <<
"\n";
80 std::cout <<
"p.basis.coeff = " << p.basis().coeff() <<
"\n";
81 std::cout <<
"q.coeff = " << q.coeff() <<
"\n";
84 typename space_type::Pkp1_v_type l;
85 ublas::matrix<value_type> m ( ublas::prod( q.coeff(), ublas::trans( l.coeff() ) ) );
89 this->setCoefficient( m );
111 template<
typename P1,
typename P2>
115 prod ( P1
const& p1, P2
const& p2 )
123 return M_p1.evaluate( n )( 0,0 ) * M_p2.evaluate( n )( 0,0 );
126 typename node<value_type>::type operator() (
typename node<value_type>::type
const& n )
128 return ublas::column( ublas::element_prod( M_p1.evaluate( n ), M_p2.evaluate( n ) ), 0 );
141 template<
typename Space>
150 typedef typename super::space_type space_type;
151 typedef typename super::polynomial_type polynomial_type;
152 typedef typename space_type::value_type value_type;
155 const static uint16_type nComponents = space_type::nComponents;
170 ublas::matrix<value_type> __rep( nComponents, p.polynomialDimensionPerComponent() );
171 typedef detail::prod<typename space_type::polynomial_type, polynomial_type> prod_fun;
173 for ( uint16_type i = 0; i < p.polynomialDimensionPerComponent(); ++i )
179 ublas::column( __rep, i ) = M_q.integrate( face, prod_fun( p.polynomial( i ), p.polynomial( k ) ) );
182 this->setCoefficient( __rep );
193 IntegralMomentOnFace( space_type
const& p, uint16_type k, uint16_type c, IntegrationFaceEnum face = ALL_FACES )
199 ublas::matrix<value_type> __rep( ublas::zero_matrix<value_type>( nComponents, p.polynomialDimensionPerComponent() ) );
200 typedef detail::prod<
typename space_type::polynomial_type::component_type,
201 typename polynomial_type::component_type> prod_fun;
203 int nc = p.polynomialDimensionPerComponent()*c;
206 for ( uint16_type i = 0; i < p.polynomialDimensionPerComponent(); ++i )
210 __rep( c, i ) = M_q.integrate( face, prod_fun( p.polynomial( ind_p1 )[c],
211 p.polynomial( ind_p2 )[c] ) )( 0 );
214 this->setCoefficient( __rep );
228 IM<Space::nDim,2*Space::nOrder+1, value_type> M_q;
239 template<
typename Space,
typename BasisType>
242 public std::vector<Functional<Space> >
244 typedef std::vector<Functional<Space> > super;
249 typedef BasisType basis_type;
250 typedef Space space_type;
251 typedef typename space_type::reference_convex_type reference_convex_type;
252 typedef typename super::polynomial_type polynomial_type;
253 typedef typename space_type::value_type value_type;
256 const static uint16_type nComponents = space_type::nComponents;
267 IntegrationFaceEnum face = ALL_FACES )
271 reference_convex_type ref_convex;
272 typedef typename reference_convex_type::topological_face_type element_type;
273 element_type ref_convex_face = ref_convex.topologicalFace( face );
276 typedef typename gm_type::face_gm_type::precompute_type face_pc_type;
277 typedef typename gm_type::face_gm_type::precompute_ptrtype face_pc_ptrtype;
279 IM<reference_convex_type::nDim-1,2*space_type::nOrder-1> __qr_face;
280 face_pc_ptrtype __geopc(
new face_pc_type( __gm->boundaryMap(),__qr_face.points() ) );
282 DVLOG(2) <<
"[nc] ref_convex_face " << face <<
"=" << ref_convex_face.points() <<
"\n";
289 __c.update( ref_convex_face, __geopc );
290 DVLOG(2) <<
"[nc] ref_convex_face " << face <<
" xref" << __c.xRefs() <<
"\n";
291 DVLOG(2) <<
"[nc] ref_convex_face " << face <<
" xreal" << __c.xReal() <<
"\n";
293 for ( uint16_type k = 0; k < l.polynomialDimensionPerComponent(); ++k )
295 ublas::matrix<value_type> __rep( nComponents, p.polynomialDimensionPerComponent() );
297 for ( uint16_type i = 0; i < p.polynomialDimensionPerComponent(); ++i )
338 template<
typename Space>
347 typedef typename super::space_type space_type;
348 typedef typename space_type::value_type value_type;
368 template<
typename Space,
typename Poly = Space>
376 BOOST_STATIC_ASSERT( Space::is_vectorial );
379 typedef typename Poly::polynomial_type polynomial_type;
380 typedef typename super::space_type space_type;
381 typedef typename space_type::value_type value_type;
393 ublas::matrix<value_type> __rep( space_type::nComponents, p.polynomialDimensionPerComponent() );
396 for (
int i = 0; i < space_type::nComponents; ++i )
399 std::cout <<
"p.d("<< i <<
") = " << p.basis().d( i ) <<
"\n"
400 <<
"prod = " << ublas::prod( q.coeff(), p.basis().d( i ) ) <<
"\n";
402 ublas::row( __rep,i ) = ublas::row( ublas::prod( q.coeff(), p.basis().d( i ) ), 0 ) ;
406 this->setCoefficient( __rep );
414 #endif // __FEELPP_FUNCTIONALS2_HPP
IntegralMomentOnFace(space_type const &p, uint16_type k, IntegrationFaceEnum face=ALL_FACES)
Definition: functionals2.hpp:164
functional that returns
Definition: functionals2.hpp:339
IntegralMomentsOnFace(space_type const &p, basis_type const &l, IntegrationFaceEnum face=ALL_FACES)
Definition: functionals2.hpp:265
IF< Id==FUNCTIONAL, typename array_fixed< numerical_type, _E_f >::type, typename IF< Id==EQUALITIES, typename array_fixed< numerical_type, _E_h >::type, typename array_fixed< numerical_type, _E_ng >::type >::Result >::Result value_type
value type for the functional
Definition: problem.hpp:99
Structure for the geometrical mapping.
Definition: geomap.hpp:100
functional that returns where
Definition: functionals2.hpp:142
functional that returns where
Definition: functionals2.hpp:240
functional that returns
Definition: functionals2.hpp:369
represents a linear functional
Definition: constrainedpolynomialset.hpp:36
functional that returns
Definition: functionals2.hpp:54
Elements & operator=(Elements const &e)
Definition: elements.hpp:335
rep_type const & coeff() const
Definition: functional.hpp:189
Context class.
Definition: feelcore/context.hpp:63
IntegralMomentOnFace(space_type const &p, uint16_type k, uint16_type c, IntegrationFaceEnum face=ALL_FACES)
Definition: functionals2.hpp:193