Logo  0.95.0-final
Finite Element Embedded Library and Language in C++
Feel++ Feel++ on Github Feel++ community
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
functionals.hpp
Go to the documentation of this file.
1 /* -*- mode: c++; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; show-trailing-whitespace: t -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2 
3  This file is part of the Feel library
4 
5  Author(s): Christophe Prud'homme <christophe.prudhomme@feelpp.org>
6  Date: 2006-01-22
7 
8  Copyright (C) 2006 EPFL
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 3.0 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free Software
22  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
29 #ifndef __FEELPP_FUNCTIONALS_HPP
30 #define __FEELPP_FUNCTIONALS_HPP 1
31 
33 
34 namespace Feel
35 {
36 
37 namespace functional
38 {
50 template<typename Space>
52  :
53 public Functional<Space>
54 {
55  typedef Functional<Space> super;
56 public:
57 
59  typedef typename super::space_type space_type;
60  typedef typename space_type::value_type value_type;
61  typedef typename node<value_type>::type node_type;
62 
64  :
65  super()
66  {}
67  PointEvaluation( space_type const& b, node_type const& __pt )
68  : super( b, ublas::trans( b.basis()( __pt ) ) )
69  {
70  //std::cout << "[PointEvaluation] eval = " << b.evaluate( __pt ) << "\n";
71  }
72 };
73 
85 template<typename Space>
87  :
88 public Functional<Space>
89 {
90  typedef Functional<Space> super;
91 public:
92 
94  typedef typename super::space_type space_type;
95  typedef typename space_type::value_type value_type;
96  typedef typename node<value_type>::type node_type;
97 
99  :
100  super()
101  {}
102  ComponentPointEvaluation( space_type const& b, uint16_type __c, node_type const& __pt )
103  :
104  super( b )
105  {
106  ublas::matrix<value_type> m( ublas::zero_matrix<value_type>( space_type::nComponents, b.polynomialDimensionPerComponent() ) );
107 
108 #if 0
109  std::cout << "[ComponentPointEvaluation] c = " << __c << "\n"
110  << "[ComponentPointEvaluation] d = " << b.polynomialDimensionPerComponent() << "\n"
111  << "[ComponentPointEvaluation] eval = " << b.evaluate( __pt ) << "\n"
112  << "[ComponentPointEvaluation] eval = " << b.basis()( __pt ) << "\n"
113  << "[ComponentPointEvaluation] bvals=" << ublas::project( b.evaluate( __pt ),
114  ublas::slice( __c, space_type::nComponents, b.polynomialDimensionPerComponent() ),
115  ublas::slice( 0, 0, 1 ) ) << "\n"
116  << "[ComponentPointEvaluation] m = " << ublas::project( m,
117  ublas::slice( __c, 0, 1 ),
118  ublas::slice( 0, 1, b.polynomialDimensionPerComponent() ) )
119  << "\n";
120 #endif
121  ublas::row( m, __c ) = ublas::column( b.basis()( __pt ), 0 );
122 
123  this->setCoefficient( m );
124  //std::cout << "[ComponentPointEvaluation] m = " << m << "\n";
125 
126  }
127 };
128 
140 template<typename Space>
142  :
143 public Functional<Space>
144 {
145  typedef Functional<Space> super;
146 public:
147 
149  typedef typename super::space_type space_type;
150  typedef typename space_type::value_type value_type;
151  typedef typename node<value_type>::type node_type;
152 
154  :
155  super()
156  {}
157  PointDerivative( space_type const& b, int i, node_type const& __pt )
158  : super( b, ublas::trans( b.derivate( i ).evaluate( __pt ) ) )
159  {
160 
161  }
162 };
163 
180 template<typename Space>
182  :
183  public std::vector<Functional<Space> >
184 {
185  typedef std::vector<Functional<Space> > super;
186 public:
187 
189  typedef Space space_type;
190  typedef typename space_type::points_type points_type;
191 
192 
194  :
195  super()
196  {}
197  PointsEvaluation( space_type const& b, points_type const& __pts )
198  : super()
199  {
200  for ( uint16_type c = 0; c < __pts.size2(); ++c )
201  {
202  //std::cout << "[PointsEvaluation] eval at point " << ublas::column( __pts, c) << "\n";
203  this->push_back( PointEvaluation<Space>( b, ublas::column( __pts, c ) ) );
204  }
205 
206  }
207 }; // PointsEvaluation
208 
209 
226 template<typename Space>
228  :
229  public std::vector<Functional<Space> >
230 {
231  typedef std::vector<Functional<Space> > super;
232 public:
233 
235  typedef Space space_type;
236  typedef typename space_type::points_type points_type;
237 
238 
240  :
241  super()
242  {}
243  PointsDerivative( space_type const& b, int i, points_type const& __pts )
244  : super()
245  {
246  for ( uint16_type c = 0; c < __pts.size2(); ++c )
247  {
248  //std::cout << "[PointsDerivative] eval at point " << ublas::column( __pts, c) << "\n";
249  this->push_back( PointDerivative<Space>( b, i, ublas::column( __pts, c ) ) );
250  }
251 
252  }
253 }; // PointsDerivative
254 
271 template<typename Space>
273  :
274  public std::vector<Functional<Space> >
275 {
276  typedef std::vector<Functional<Space> > super;
277 public:
278 
280  typedef Space space_type;
281  typedef typename space_type::points_type points_type;
282 
283 
285  :
286  super()
287  {}
288  PointsGradient( space_type const& b, points_type const& __pts )
289  : super()
290  {
291  for ( uint16_type c = 0; c < __pts.size2(); ++c )
292  {
293  for ( int j = 0; j < __pts.size1(); ++j )
294  this->push_back( PointDerivative<Space>( b, j, ublas::column( __pts, c ) ) );
295  }
296 
297  }
298 }; // PointsGradient
299 
316 template<typename Space>
318  :
319  public std::vector<Functional<Space> >
320 {
321  typedef std::vector<Functional<Space> > super;
322 public:
323 
325  typedef Space space_type;
326  typedef typename space_type::points_type points_type;
327 
328 
329  BOOST_STATIC_ASSERT( space_type::is_vectorial ||
330  space_type::is_tensor2 );
331 
333  :
334  super()
335  {}
336  ComponentsPointsEvaluation( space_type const& b, points_type const& __pts )
337  : super()
338  {
339 
340  for ( uint16_type c = 0; c < space_type::nComponents; ++c )
341  {
342  for ( uint16_type pt = 0; pt < __pts.size2(); ++pt )
343  {
344  //std::cout << "[ComponentsPointsEvaluation] eval at point " << ublas::column( __pts, c) << "\n";
345  this->push_back( ComponentPointEvaluation<Space>( b, c, ublas::column( __pts, pt ) ) );
346  }
347  }
348 
349  }
350 }; // ComponentsPointsEvaluation
351 
352 
360 template<typename Space>
362  :
363  public Functional<Space>
364 {
365  typedef Functional<Space> super;
366 public:
367 
369  typedef Space space_type;
370  typedef typename space_type::points_type points_type;
371 
372  typedef typename super::value_type value_type;
373  typedef typename node<value_type>::type node_type;
374 
375 
376  BOOST_STATIC_ASSERT( space_type::is_vectorial ||
377  space_type::is_tensor2 );
378 
379  DirectionalComponentPointEvaluation( space_type const& b,
380  node_type const& d,
381  node_type const& __pt )
382  : super( b )
383  {
384  ublas::matrix<value_type> m( d.size(), b.basis().size() );
385  ublas::matrix<value_type> pts( __pt.size(), 1 );
386  ublas::column( pts, 0 ) = __pt;
387 
388  for ( int i = 0; i < d.size(); ++i )
389  {
390  ublas::row( m, i ) = d( i ) * ublas::column( b.basis().evaluate( pts ), 0 );
391  }
392 
393  this->setCoefficient( m );
394  }
395 }; // DirectionalComponentPointEvaluation
396 
404 template<typename Space>
406  :
407  public std::vector<Functional<Space> >
408 {
409  typedef std::vector<Functional<Space> > super;
410 public:
411 
414  typedef Space space_type;
415  typedef typename space_type::points_type points_type;
416 
417  typedef typename space_type::value_type value_type;
418  typedef typename node<value_type>::type node_type;
419 
420 
421  BOOST_STATIC_ASSERT( space_type::is_vectorial ||
422  space_type::is_tensor2 );
423 
425  :
426  super()
427  {}
428  DirectionalComponentPointsEvaluation( space_type const& b,
429  node_type const& d,
430  points_type const& __pts )
431  : super()
432  {
433  for ( int j = 0; j < __pts.size2(); ++j )
434  {
435  ublas::matrix<value_type> m( ublas::zero_matrix<value_type>( d.size(), b.basis().size() ) );
436 
437  for ( int i = 0; i < d.size(); ++i )
438  {
439  ublas::row( m, i ) = d( i ) * ublas::column( b.basis()( ublas::column( __pts, j ) ), 0 );
440  }
441 
442  //std::cout << "[DirectionalComponentPointsEvaluation] m " << j << " = " << m << "\n";
443  this->push_back( functional_type( b, m ) );
444  }
445  }
446 }; // DirectionalComponentPointsEvaluation
447 
448 } // functional
449 
450 } // Feel
451 
452 #endif // __FEELPP_FUNCTIONALS_HPP
453 
functional associate with directional component point evaluation
Definition: functionals.hpp:405
Polynomial< Pset, Scalar > project(Pset const &pset, Func const &f, IM const &im)
Definition: operations.hpp:436
generate the functionals associated with point set
Definition: functionals.hpp:272
functional associate with directional component point evaluation
Definition: functionals.hpp:361
Definition: glas.hpp:125
generate the functionals associated with point set
Definition: functionals.hpp:317
generate the functionals associated with point set
Definition: functionals.hpp:227
generate the functionals associated with point set
Definition: functionals.hpp:181
represents a linear functional
Definition: constrainedpolynomialset.hpp:36
generate the functional associated with a point evaluation
Definition: functionals.hpp:51
generate the functional associated with a point derivative
Definition: functionals.hpp:141
generate the functional associated with a point evaluation associated with a component ...
Definition: functionals.hpp:86

Generated on Sun Dec 22 2013 13:11:01 for Feel++ by doxygen 1.8.5