rheolef  7.0
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_expr_v2_utilities.h>

Inherits unary_function< point_basic< scalar_traits< T >::type >, T >.

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, Mgeo_type
 
typedef space_basic< float_type, Mspace_type
 
typedef vec< T, M >::dis_reference dis_reference
 

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< T, M > & operator= (const T &)
 
field_basic< T, M > & operator= (const field_basic< T, M > &)
 
template<class Expr , class Sfinae = typename std::enable_if< details::is_field_expr_v2_linear_arg<Expr>::value && ! details::is_field<Expr>::value >::type>
 field_basic (const Expr &expr)
 
template<class Expr , class Sfinae = typename std::enable_if< details::is_field_expr_v2_linear_arg<Expr>::value && ! details::is_field<Expr>::value >::type>
field_basic< T, M > & operator= (const Expr &)
 
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, Moperator[] (const geo_basic< T, M > &dom)
 
field_indirect_const< T, Moperator[] (const geo_basic< T, M > &dom) const
 
field_indirect< T, Moperator[] (std::string dom_name)
 
field_indirect_const< T, Moperator[] (std::string dom_name) const
 
size_type size () const
 
field_component< T, Moperator[] (size_type i_comp)
 
field_component_const< T, Moperator[] (size_type i_comp) const
 
field_component< T, Moperator() (size_type i_comp, size_type j_comp)
 
field_component_const< T, Moperator() (size_type i_comp, size_type j_comp) const
 
const distributorownership () const
 
const communicatorcomm () 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
 
dis_reference dis_dof_entry (size_type dis_idof)
 
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_basic< T > dis_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
 
template<class Expr >
void assembly_internal (const geo_basic< T, M > &dom, const geo_basic< T, M > &band, const band_basic< T, M > &gh, const Expr &expr, const quadrature_option &qopt, bool is_on_band)
 
template<class Expr >
void assembly (const geo_basic< T, M > &domain, const Expr &expr, const quadrature_option &qopt)
 
template<class Expr >
void assembly (const band_basic< T, M > &gh, const Expr &expr, const quadrature_option &qopt)
 

Protected Member Functions

void dis_dof_indexes_requires_update () const
 
void dis_dof_assembly_requires_update () const
 

Protected Attributes

space_type _V
 
vec< T, M_u
 
vec< T, M_b
 
bool _dis_dof_indexes_requires_update
 
bool _dis_dof_assembly_requires_update
 

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.

There is a special predefined class-function named normal that represents the outer unnit normal vector on a boundary domain or surfacic mesh:

size_t k = omega.order();
string n_approx = "P" + itos(k-1) + "d";
space Nh (omega["boundary"], n_approx, "vector");
field nh = interpolate(Nh, normal());

The normal() function could appear in any nonlinear field expression: it is evaluated on the fly, based on the current mesh. Notice that when using isoparametric elements, the normal vector is no more constant along any face of the mesh. Also, on general curved domains, the unit normal vector is discontinuous across boundary element interfaces.

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 vectors 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). Access to these vectors is allowed via some accessors: a read-only one, as uh.u() and uh.b(), and a read-and-write one, as uh.set_u() and uh.set_b(), 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 dofs on the current processor. See see disarray for more about distributed arrays.

For convenience, uh.max(), uh.min() and uh.max_abs() returns 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
disarray, form, space, vec.

Definition at line 11 of file field_expr_v2_utilities.h.

Member Typedef Documentation

◆ size_type

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

Definition at line 234 of file field.h.

◆ memory_type

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

Definition at line 235 of file field.h.

◆ scalar_type

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

Definition at line 236 of file field.h.

◆ float_type

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

Definition at line 237 of file field.h.

◆ value_type

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

Definition at line 239 of file field.h.

◆ valued_type

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

Definition at line 240 of file field.h.

◆ geo_type

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 241 of file field.h.

◆ space_type

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 242 of file field.h.

◆ dis_reference

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

Definition at line 243 of file field.h.

Constructor & Destructor Documentation

◆ field_basic() [1/3]

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

Definition at line 508 of file field.h.

◆ field_basic() [2/3]

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 10 of file field.cc.

◆ field_basic() [3/3]

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

Definition at line 271 of file field_expr_v2_linear.h.

Member Function Documentation

◆ resize()

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 23 of file field.cc.

◆ operator=() [1/3]

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

Definition at line 543 of file field.h.

◆ operator=() [2/3]

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

Definition at line 519 of file field.h.

◆ operator=() [3/3]

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

Definition at line 258 of file field_expr_v2_linear.h.

◆ get_space()

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

Definition at line 283 of file field.h.

◆ get_geo()

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

Definition at line 284 of file field.h.

◆ stamp()

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

Definition at line 285 of file field.h.

◆ get_approx()

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

Definition at line 286 of file field.h.

◆ valued_tag()

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

Definition at line 287 of file field.h.

◆ valued()

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

Definition at line 288 of file field.h.

◆ u()

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

Definition at line 291 of file field.h.

◆ b()

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

Definition at line 292 of file field.h.

◆ set_u()

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

Definition at line 293 of file field.h.

◆ set_b()

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

Definition at line 294 of file field.h.

◆ min()

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

Definition at line 576 of file field.h.

◆ max()

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

Definition at line 592 of file field.h.

◆ max_abs()

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

Definition at line 624 of file field.h.

◆ min_abs()

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

Definition at line 608 of file field.h.

◆ operator[]() [1/6]

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 92 of file field_indirect.h.

◆ operator[]() [2/6]

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 240 of file field_indirect.h.

◆ operator[]() [3/6]

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

Definition at line 100 of file field_indirect.h.

◆ operator[]() [4/6]

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 247 of file field_indirect.h.

◆ size()

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

Definition at line 309 of file field.h.

◆ operator[]() [5/6]

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

Definition at line 236 of file field_component.h.

◆ operator[]() [6/6]

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 251 of file field_component.h.

◆ operator()() [1/3]

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 392 of file field.cc.

◆ operator()() [2/3]

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 384 of file field.cc.

◆ ownership()

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

Definition at line 316 of file field.h.

◆ comm()

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

Definition at line 317 of file field.h.

◆ ndof()

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

Definition at line 318 of file field.h.

◆ dis_ndof()

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

Definition at line 319 of file field.h.

◆ dof() [1/2]

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

Definition at line 553 of file field.h.

◆ dof() [2/2]

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

Definition at line 565 of file field.h.

◆ dis_dof()

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

Definition at line 270 of file field.cc.

◆ dis_dof_entry()

template<class T , class M >
field_basic< T, M >::dis_reference rheolef::field_basic< T, M >::dis_dof_entry ( size_type  dis_idof)

Definition at line 292 of file field.cc.

◆ begin_dof() [1/2]

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

Definition at line 433 of file field.h.

◆ end_dof() [1/2]

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

Definition at line 441 of file field.h.

◆ begin_dof() [2/2]

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

Definition at line 495 of file field.h.

◆ end_dof() [2/2]

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

Definition at line 502 of file field.h.

◆ get()

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

Definition at line 83 of file field.cc.

◆ put()

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

Definition at line 263 of file field.cc.

◆ put_field()

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

Definition at line 209 of file field.cc.

◆ dis_evaluate()

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 348 of file field.cc.

◆ operator()() [3/3]

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 338 of file field.h.

◆ dis_vector_evaluate()

template<class T, class M >
point_basic< T > rheolef::field_basic< T, M >::dis_vector_evaluate ( const point_basic< T > &  x) const

Definition at line 377 of file field.cc.

◆ evaluate()

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 326 of file field.cc.

◆ dis_dof_update()

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

Definition at line 304 of file field.cc.

◆ assembly_internal()

template<class T, class M>
template<class Expr >
void rheolef::field_basic< T, M >::assembly_internal ( const geo_basic< T, M > &  dom,
const geo_basic< T, M > &  band,
const band_basic< T, M > &  gh,
const Expr &  expr,
const quadrature_option qopt,
bool  is_on_band 
)

Definition at line 79 of file field_vf_assembly.h.

◆ assembly() [1/2]

template<class T, class M>
template<class Expr >
void rheolef::field_basic< T, M >::assembly ( const geo_basic< T, M > &  domain,
const Expr &  expr,
const quadrature_option qopt 
)
inline

Definition at line 173 of file field_vf_assembly.h.

◆ assembly() [2/2]

template<class T, class M>
template<class Expr >
void rheolef::field_basic< T, M >::assembly ( const band_basic< T, M > &  gh,
const Expr &  expr,
const quadrature_option qopt 
)
inline

Definition at line 184 of file field_vf_assembly.h.

◆ dis_dof_indexes_requires_update()

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

Definition at line 530 of file field.h.

◆ dis_dof_assembly_requires_update()

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

Definition at line 536 of file field.h.

Member Data Documentation

◆ _V

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

Definition at line 370 of file field.h.

◆ _u

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

Definition at line 371 of file field.h.

◆ _b

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

Definition at line 372 of file field.h.

◆ _dis_dof_indexes_requires_update

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

Definition at line 373 of file field.h.

◆ _dis_dof_assembly_requires_update

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

Definition at line 374 of file field.h.


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