rheolef  6.3
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rheolef::field_basic< T, M > Class Template Reference

field - piecewise polynomial finite element field More...

#include <field.h>

Collaboration diagram for rheolef::field_basic< T, M >:
Collaboration graph
[legend]

Classes

class  const_iterator
class  iterator

Public Types

typedef std::size_t size_type
typedef M memory_type
typedef T scalar_type
typedef float_traits< T >::type float_type
typedef T value_type
typedef space_constant::valued_type valued_type
typedef geo_basic< float_type, M > geo_type
typedef space_basic
< float_type, M > 
space_type

Public Member Functions

 field_basic ()
 field_basic (const space_type &V, const T &init_value=std::numeric_limits< T >::max())
void resize (const space_type &V, const T &init_value=std::numeric_limits< T >::max())
 field_basic (const field_indirect< T, M > &)
field_basic< T, M > & operator= (const field_indirect< T, M > &)
 field_basic (const field_indirect_const< T, M > &)
field_basic< T, M > & operator= (const field_indirect_const< T, M > &)
 field_basic (const field_component< T, M > &)
field_basic< T, M > & operator= (const field_component< T, M > &)
 field_basic (const field_component_const< T, M > &)
field_basic< T, M > & operator= (const field_component_const< T, M > &)
template<class Expr >
 field_basic (const field_expr< Expr > &)
template<class Expr >
field_basic< T, M > & operator= (const field_expr< Expr > &)
field_basic< T, M > & operator= (const T &)
 field_basic (const std::initializer_list< field_concat_value< T, M > > &init_list)
field_basic< T, M > & operator= (const std::initializer_list< field_concat_value< T, M > > &init_list)
const space_typeget_space () const
const geo_typeget_geo () const
std::string stamp () const
std::string get_approx () const
valued_type valued_tag () const
const std::string & valued () const
const vec< T, M > & u () const
const vec< T, M > & b () const
vec< T, M > & set_u ()
vec< T, M > & set_b ()
min () const
max () const
max_abs () const
min_abs () const
field_indirect< T, M > operator[] (const geo_basic< T, M > &dom)
field_indirect_const< T, M > operator[] (const geo_basic< T, M > &dom) const
field_indirect< T, M > operator[] (std::string dom_name)
field_indirect_const< T, M > operator[] (std::string dom_name) const
size_type size () const
field_component< T, M > operator[] (size_type i_comp)
field_component_const< T, M > operator[] (size_type i_comp) const
field_component< T, M > operator() (size_type i_comp, size_type j_comp)
field_component_const< T, M > operator() (size_type i_comp, size_type j_comp) const
const distributorownership () const
const communicator & comm () const
size_type ndof () const
size_type dis_ndof () const
T & dof (size_type idof)
const T & dof (size_type idof) const
const T & dis_dof (size_type dis_idof) const
iterator begin_dof ()
iterator end_dof ()
const_iterator begin_dof () const
const_iterator end_dof () const
idiststream & get (idiststream &ips)
odiststreamput (odiststream &ops) const
odiststreamput_field (odiststream &ops) const
dis_evaluate (const point_basic< T > &x, size_type i_comp=0) const
operator() (const point_basic< T > &x) const
point vector_evaluate (const point_basic< T > &x) const
evaluate (const geo_element &K, const point_basic< T > &hat_xq, size_type i_comp=0) const
void dis_dof_update () const

Protected Member Functions

void dis_dof_update_internal () const
void dis_dof_update_needed () const

Protected Attributes

space_type _V
vec< T, M > _u
vec< T, M > _b
bool _dis_dof_update_needed

Detailed Description

template<class T, class M = rheo_default_memory_model>
class rheolef::field_basic< T, M >

field - piecewise polynomial finite element field

Store degrees of freedom associated to a mesh and a piecewise polynomial approximation, with respect to the numbering defined by the underlying space.

This class contains two vectors, namely unknown and blocked degrees of freedoms, and the associated finite element space. Blocked and unknown degrees of freedom can be set by using domain name indexation:

geo omega ("circle");
space Xh (omega, "P1");
Xh.block ("boundary");
field uh (Xh);
uh ["boundary"] = 0;

INTERPOLATION

Interpolation of a function u in a field uh with respect to the interpolation writes:

Float u (const point& x) { return x[0]*x[1]; }
...
field uh = interpolate (Xh, u);

LINEAR ALGEBRA

Linear algebra, such as uh+vh, uh-vh and lambda*uh + mu*vh, where lambda and mu are of type Float, are supported. The duality product between two fields lh and vh writes simply dual(lh,vh): for discrete fields, it corresponds to a simple Euclidian dot product in IR^n. The application of a bilinear form (see form) writes m(uh,vh) and is equivalent to dual(m*uh,vh).

NON-LINEAR ALGEBRA

Non-linear operations, such as sqrt(uh) or 1/uh are also available. Notice that non-linear operations do not returns in general picewise polynomials: the value returned by sqrt(uh) may be filtered by interpolate,

field vh = interpolate (Xh, sqrt(uh));

the Lagrange interpolant, to becomes a piecewise polynomial: All standard unary and binary math functions abs, cos, sin... are available on fields. Also sqr(uh), the square of a field, and min(uh,vh), max(uh,vh) are provided. Binary functions can be used also with a scalar, as in

field vh = interpolate (Xh, max (abs(uh), 0));
field wh = interpolate (Xh, pow (abs(uh), 1./3));

For applying a user-provided function to a field, use the compose function:

field vh = interpolate(Xh, compose(f, uh));
field wh = interpolate(Xh, compose(f, uh, vh));

The composition supports also general unary and binary class-functions. Also, the multiplication uh*vh and the division uh/vh returns a result that is not in the same discrete finite element space: its result may be filtered by the interpolate operator:

field wh = interpolate(Xh, uh*vh);

Any function or class function can be used in nonlinear expressions: the function is interpolated in the specified finite element space.

ACCESS BY DOMAIN

The restriction of a field to a geometric domain, says "boundary" writes uh["boundary"]: it represents the trace of the field on the boundary:

space Xh (omega, "P1");
uh["boundary"] = 0;

Extraction of the trace as a field is also possible:

field wh = uh["boundary"];

The space associated to the trace writes wh.get_space() and is equivalent to space(omega["boundary"], "P1"). See see space.

VECTOR VALUED FIELD

A vector-valued field contains several components, as:

space Xh (omega, "P2", "vector");
field uh (Xh);
field vh = uh[0] - uh[1];
field nh = norm (uh);

The norm function returns the euclidian norm of the vector-valuated field at each degree of freedom: its result is a scalar field.

TENSOR VALUED FIELD

A tensor-valued field can be constructed and used as:

space Th (omega, "P1d", "tensor");
field sigma_h (Xh);
field trace_h = sigma(0,0) + sigma_h(1,1);
field nh = norm (sigma_h);

The norm function returns the euclidian norm of the tensor-valuated field at each degree of freedom: its result is a scalar field. Notice that, as tensor-valued fields are symmetric, extra-diagonals are counted twice.

GENERAL MULTI-COMPONENT INTERFACE

A general multi-component field writes:

space Th (omega, "P1d", "tensor");
space Vh (omega, "P2", "vector");
space Qh (omega, "P1");
space Xh = Th*Vh*Qh;
field xh (Xh);
field tau_h = xh[0]; // tensor-valued
field uh = xh[1]; // vector-valued
field qh = xh[2]; // scalar

Remark the hierarchical multi-component field structure: the first-component is tensor-valued and the second-one is vector-valued. There is no limitation upon the hierarchical number of levels in use.

For any field xh, the string xh.valued() returns "scalar" for a scalar field and "vector" for a vector-valued one. Other possible valued are "tensor" and "other". The xh.size() returns the number of field components. When the field is scalar, it returns zero by convention, and xh[0] is undefined. A vector-valued field has d components, where d=omega.dimension(). A tensor-valued field has d*(d+1)/2 components, where d=omega.dimension().

BLOCKED AND UNBLOCKED ARRAYS

The field class contains two arrays of degrees-of-freedom (dof) associated respectively to blocked and unknown dofs. Blocked dofs corresponds to Dirichlet boundary conditions, as specified by space (See see space). For simpliity, direct public access to these array is allowed, as uh.b and uh.u: see see vec.

LOW-LEVEL DEGREE-OF-FREEDOM ACCESS

The field class provides a STL-like container interface for accessing the degrees-of-freedom (dof) of a finite element field uh. The number of dofs is uh.ndof() and any dof can be accessed via uh.dof(idof). A non-local dof at the partition interface can be obtain via uh.dis_dof(dis_idof) where dis_idof is the (global) distribued index assoiated to the distribution uh.ownership().

For performances, a STL-like iterator interface is available, with uh.begin_dof() and uh.end_dof() returns iterators to the arrays of dofs on the current processor. See see array for more about distributed arrays.

For convenience, uh.max(), uh.min() and uh.max_abs() retuns respectively the maximum, minimum and maximum of the absolute value of the degrees of freedom.

FILE FORMAT

TODO

IMPLEMENTATION NOTE

The field expression use the expression template technics in order to avoid temporaries when evaluating complex expressions.

See Also
array, form, space, vec.

Definition at line 208 of file field.h.

Member Typedef Documentation

template<class T, class M = rheo_default_memory_model>
typedef std::size_t rheolef::field_basic< T, M >::size_type

Definition at line 211 of file field.h.

template<class T, class M = rheo_default_memory_model>
typedef M rheolef::field_basic< T, M >::memory_type

Definition at line 212 of file field.h.

template<class T, class M = rheo_default_memory_model>
typedef T rheolef::field_basic< T, M >::scalar_type

Definition at line 213 of file field.h.

template<class T, class M = rheo_default_memory_model>
typedef float_traits<T>::type rheolef::field_basic< T, M >::float_type

Definition at line 214 of file field.h.

template<class T, class M = rheo_default_memory_model>
typedef T rheolef::field_basic< T, M >::value_type

Definition at line 216 of file field.h.

template<class T, class M = rheo_default_memory_model>
typedef space_constant::valued_type rheolef::field_basic< T, M >::valued_type

Definition at line 217 of file field.h.

template<class T, class M = rheo_default_memory_model>
typedef geo_basic<float_type,M> rheolef::field_basic< T, M >::geo_type

Definition at line 218 of file field.h.

template<class T, class M = rheo_default_memory_model>
typedef space_basic<float_type,M> rheolef::field_basic< T, M >::space_type

Definition at line 219 of file field.h.

Constructor & Destructor Documentation

template<class T , class M >
rheolef::field_basic< T, M >::field_basic ( )
inline

Definition at line 463 of file field.h.

template<class T, class M >
rheolef::field_basic< T, M >::field_basic ( const space_type V,
const T &  init_value = std::numeric_limits<T>::max() 
)
explicit

Definition at line 12 of file field.cc.

template<class T, class M>
rheolef::field_basic< T, M >::field_basic ( const field_indirect< T, M > &  expr)
inline

Definition at line 136 of file field_indirect.h.

template<class T, class M>
rheolef::field_basic< T, M >::field_basic ( const field_indirect_const< T, M > &  expr)
inline

Definition at line 289 of file field_indirect.h.

template<class T, class M>
rheolef::field_basic< T, M >::field_basic ( const field_component< T, M > &  uh_comp)
inline

Definition at line 279 of file field_component.h.

template<class T, class M>
rheolef::field_basic< T, M >::field_basic ( const field_component_const< T, M > &  uh_comp)
inline

Definition at line 289 of file field_component.h.

template<class T , class M >
template<class Expr >
rheolef::field_basic< T, M >::field_basic ( const field_expr< Expr > &  expr)
inline

Definition at line 438 of file field_expr.h.

template<class T, class M>
rheolef::field_basic< T, M >::field_basic ( const std::initializer_list< field_concat_value< T, M > > &  init_list)
inline

Definition at line 87 of file field_concat.h.

Member Function Documentation

template<class T, class M >
void rheolef::field_basic< T, M >::resize ( const space_type V,
const T &  init_value = std::numeric_limits<T>::max() 
)

Definition at line 25 of file field.cc.

template<class T, class M>
field_basic< T, M > & rheolef::field_basic< T, M >::operator= ( const field_indirect< T, M > &  expr)
inline

Definition at line 121 of file field_indirect.h.

template<class T, class M>
field_basic< T, M > & rheolef::field_basic< T, M >::operator= ( const field_indirect_const< T, M > &  expr)
inline

Definition at line 300 of file field_indirect.h.

template<class T, class M>
field_basic< T, M > & rheolef::field_basic< T, M >::operator= ( const field_component< T, M > &  uh_comp)
inline

Definition at line 273 of file field_component.h.

template<class T, class M>
field_basic< T, M > & rheolef::field_basic< T, M >::operator= ( const field_component_const< T, M > &  uh_comp)
inline

Definition at line 238 of file field_component.h.

template<class T , class M >
template<class Expr >
field_basic< T, M > & rheolef::field_basic< T, M >::operator= ( const field_expr< Expr > &  expr)
inline

Definition at line 405 of file field_expr.h.

template<class T, class M>
field_basic< T, M > & rheolef::field_basic< T, M >::operator= ( const T &  value)
inline

Definition at line 487 of file field.h.

template<class T, class M>
field_basic< T, M > & rheolef::field_basic< T, M >::operator= ( const std::initializer_list< field_concat_value< T, M > > &  init_list)
inline

Definition at line 95 of file field_concat.h.

template<class T, class M = rheo_default_memory_model>
const space_type& rheolef::field_basic< T, M >::get_space ( ) const
inline

Definition at line 260 of file field.h.

template<class T, class M = rheo_default_memory_model>
const geo_type& rheolef::field_basic< T, M >::get_geo ( ) const
inline

Definition at line 261 of file field.h.

template<class T, class M = rheo_default_memory_model>
std::string rheolef::field_basic< T, M >::stamp ( ) const
inline

Definition at line 262 of file field.h.

template<class T, class M = rheo_default_memory_model>
std::string rheolef::field_basic< T, M >::get_approx ( ) const
inline

Definition at line 263 of file field.h.

template<class T, class M = rheo_default_memory_model>
valued_type rheolef::field_basic< T, M >::valued_tag ( ) const
inline

Definition at line 264 of file field.h.

template<class T, class M = rheo_default_memory_model>
const std::string& rheolef::field_basic< T, M >::valued ( ) const
inline

Definition at line 265 of file field.h.

template<class T, class M = rheo_default_memory_model>
const vec<T,M>& rheolef::field_basic< T, M >::u ( ) const
inline

Definition at line 268 of file field.h.

template<class T, class M = rheo_default_memory_model>
const vec<T,M>& rheolef::field_basic< T, M >::b ( ) const
inline

Definition at line 269 of file field.h.

template<class T, class M = rheo_default_memory_model>
vec<T,M>& rheolef::field_basic< T, M >::set_u ( )
inline

Definition at line 270 of file field.h.

template<class T, class M = rheo_default_memory_model>
vec<T,M>& rheolef::field_basic< T, M >::set_b ( )
inline

Definition at line 271 of file field.h.

template<class T , class M >
T rheolef::field_basic< T, M >::min ( ) const
inline

Definition at line 520 of file field.h.

template<class T , class M >
T rheolef::field_basic< T, M >::max ( ) const
inline

Definition at line 536 of file field.h.

template<class T , class M >
T rheolef::field_basic< T, M >::max_abs ( ) const
inline

Definition at line 568 of file field.h.

template<class T , class M >
T rheolef::field_basic< T, M >::min_abs ( ) const
inline

Definition at line 552 of file field.h.

template<class T, class M>
field_indirect< T, M > rheolef::field_basic< T, M >::operator[] ( const geo_basic< T, M > &  dom)
inline

Definition at line 105 of file field_indirect.h.

template<class T, class M>
field_indirect_const< T, M > rheolef::field_basic< T, M >::operator[] ( const geo_basic< T, M > &  dom) const
inline

Definition at line 276 of file field_indirect.h.

template<class T, class M>
field_indirect< T, M > rheolef::field_basic< T, M >::operator[] ( std::string  dom_name)
inline

Definition at line 113 of file field_indirect.h.

template<class T, class M>
field_indirect_const< T, M > rheolef::field_basic< T, M >::operator[] ( std::string  dom_name) const
inline

Definition at line 283 of file field_indirect.h.

template<class T, class M = rheo_default_memory_model>
size_type rheolef::field_basic< T, M >::size ( ) const
inline

Definition at line 286 of file field.h.

template<class T, class M>
field_component< T, M > rheolef::field_basic< T, M >::operator[] ( size_type  i_comp)
inline

Definition at line 216 of file field_component.h.

template<class T, class M>
field_component_const< T, M > rheolef::field_basic< T, M >::operator[] ( size_type  i_comp) const
inline

Definition at line 231 of file field_component.h.

template<class T , class M >
field_component< T, M > rheolef::field_basic< T, M >::operator() ( size_type  i_comp,
size_type  j_comp 
)

Definition at line 440 of file field.cc.

template<class T , class M >
field_component_const< T, M > rheolef::field_basic< T, M >::operator() ( size_type  i_comp,
size_type  j_comp 
) const

Definition at line 432 of file field.cc.

template<class T, class M = rheo_default_memory_model>
const distributor& rheolef::field_basic< T, M >::ownership ( ) const
inline

Definition at line 293 of file field.h.

template<class T, class M = rheo_default_memory_model>
const communicator& rheolef::field_basic< T, M >::comm ( ) const
inline

Definition at line 294 of file field.h.

template<class T, class M = rheo_default_memory_model>
size_type rheolef::field_basic< T, M >::ndof ( ) const
inline

Definition at line 295 of file field.h.

template<class T, class M = rheo_default_memory_model>
size_type rheolef::field_basic< T, M >::dis_ndof ( ) const
inline

Definition at line 296 of file field.h.

template<class T , class M >
T & rheolef::field_basic< T, M >::dof ( size_type  idof)
inline

Definition at line 497 of file field.h.

template<class T , class M >
const T & rheolef::field_basic< T, M >::dof ( size_type  idof) const
inline

Definition at line 509 of file field.h.

template<class T , class M >
const T & rheolef::field_basic< T, M >::dis_dof ( size_type  dis_idof) const

Definition at line 275 of file field.cc.

template<class T , class M >
field_basic< T, M >::iterator rheolef::field_basic< T, M >::begin_dof ( )
inline

Definition at line 388 of file field.h.

template<class T , class M >
field_basic< T, M >::iterator rheolef::field_basic< T, M >::end_dof ( )
inline

Definition at line 396 of file field.h.

template<class T , class M >
field_basic< T, M >::const_iterator rheolef::field_basic< T, M >::begin_dof ( ) const
inline

Definition at line 450 of file field.h.

template<class T , class M >
field_basic< T, M >::const_iterator rheolef::field_basic< T, M >::end_dof ( ) const
inline

Definition at line 457 of file field.h.

template<class T , class M >
idiststream & rheolef::field_basic< T, M >::get ( idiststream &  ips)

Definition at line 85 of file field.cc.

template<class T , class M >
odiststream & rheolef::field_basic< T, M >::put ( odiststream ops) const

Definition at line 261 of file field.cc.

template<class T , class M >
odiststream & rheolef::field_basic< T, M >::put_field ( odiststream ops) const

Definition at line 210 of file field.cc.

template<class T, class M >
T rheolef::field_basic< T, M >::dis_evaluate ( const point_basic< T > &  x,
size_type  i_comp = 0 
) const

Definition at line 316 of file field.cc.

template<class T, class M = rheo_default_memory_model>
T rheolef::field_basic< T, M >::operator() ( const point_basic< T > &  x) const
inline

Definition at line 313 of file field.h.

template<class T, class M = rheo_default_memory_model>
point rheolef::field_basic< T, M >::vector_evaluate ( const point_basic< T > &  x) const
template<class T, class M >
T rheolef::field_basic< T, M >::evaluate ( const geo_element K,
const point_basic< T > &  hat_xq,
size_type  i_comp = 0 
) const

Definition at line 294 of file field.cc.

template<class T , class M >
void rheolef::field_basic< T, M >::dis_dof_update ( ) const

Definition at line 478 of file field.h.

template<class T , class M >
void rheolef::field_basic< T, M >::dis_dof_update_internal ( ) const
protected

Definition at line 268 of file field.cc.

template<class T , class M >
void rheolef::field_basic< T, M >::dis_dof_update_needed ( ) const
protected

Definition at line 472 of file field.h.

Member Data Documentation

template<class T, class M = rheo_default_memory_model>
space_type rheolef::field_basic< T, M >::_V
protected

Definition at line 326 of file field.h.

template<class T, class M = rheo_default_memory_model>
vec<T,M> rheolef::field_basic< T, M >::_u
protected

Definition at line 327 of file field.h.

template<class T, class M = rheo_default_memory_model>
vec<T,M> rheolef::field_basic< T, M >::_b
protected

Definition at line 328 of file field.h.

template<class T, class M = rheo_default_memory_model>
bool rheolef::field_basic< T, M >::_dis_dof_update_needed
mutableprotected

Definition at line 329 of file field.h.


The documentation for this class was generated from the following files: