Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
<tt>form</tt>

finite element bilinear form

Description

The form class groups four sparse matrix, associated to a bilinear form defined on two finite element spaces:

   a: Uh*Vh   ----> IR
     (uh,vh)  +---> a(uh,vh)

The A operator associated to the bilinear form is defined by:

   A: Uh  ----> Vh
      uh  +---> A*uh

where uh is a field, and vh=A*uh in Vh is such that a(uh,vh)=dual(A*uh,vh) for all vh in Vh and where dual(.,.) denotes the duality product between Vh and its dual. Since Vh is a finite dimensional space, its dual is identified to Vh itself and the duality product is the euclidean product in IR^dim(Vh). Also, the linear operator can be represented by a matrix.

In practice, bilinear forms are created by using the integrate function.

Algebra

Forms, as matrix, support standard algebra. Adding or subtracting two forms writes a+b and a-b, respectively, while multiplying by a scalar lambda writes lambda*a and multiplying two forms writes a*b. Also, multiplying a form by a field uh writes a*uh. The form inversion is not as direct as e.g. as inv(a), since forms are very large matrix in practice: form inversion can be obtained via the solver class. A notable exception is the case of block-diagonal forms at the element level: in that case, a direct inversion is possible during the assembly process, see integrate_option.

Representation

The degrees of freedom (see space) are splited between unknowns and blocked, i.e. uh=[uh.u,uh.b] for any field uh in Uh. Conversely, vh=[vh.u,vh.b] for any field vh in Vh. Then, the form-field vh=a*uh operation is formally equivalent to the following matrix-vector block operations:

    [ vh.u ]   [ a.uu  a.ub ] [ uh.u ]
    [      ] = [            ] [      ]
    [ vh.b ]   [ a.bu  a.bb ] [ uh.n ]

or, after expansion:

    vh.u = a.uu*uh.u + a.ub*vh.b
    vh.b = a.bu*uh.b + a.bb*vh.b

i.e. the A matrix also admits a 2x2 block structure. Then, the form class is represented by four sparse matrix and the csr compressed format is used. Note that the previous formal relations for vh=a*uh writes equivalently within the Rheolef library as:

    vh.set_u() = a.uu()*uh.u() + a.ub()*uh.b();
    vh.set_b() = a.bu()*uh.u() + a.bb()*uh.b();

Implementation

This documentation has been generated from file main/lib/form.h

The form class is simply an alias to the form_basic class

typedef form_basic<Float,rheo_default_memory_model> form;
see the form page for the full documentation

The form_basic class provides an interface to four sparse matrix:

template<class T, class M>
class form_basic {
public :
// typedefs:
typedef typename csr<T,M>::size_type size_type;
typedef T value_type;
typedef geo_basic<float_type,M> geo_type;
typedef space_basic<float_type,M> space_type;
// allocator/deallocator:
form_basic (const form_basic<T,M>&);
form_basic<T,M>& operator= (const form_basic<T,M>&);
template<class Expr, class Sfinae = typename std::enable_if<details::is_form_lazy<Expr>::value, Expr>::type>
form_basic (const Expr&);
template<class Expr, class Sfinae = typename std::enable_if<details::is_form_lazy<Expr>::value, Expr>::type>
form_basic<T,M>& operator= (const Expr&);
// allocators from initializer list (c++ 2011):
form_basic (const std::initializer_list<details::form_concat_value<T,M> >& init_list);
form_basic (const std::initializer_list<details::form_concat_line <T,M> >& init_list);
// accessors:
const space_type& get_first_space() const;
const space_type& get_second_space() const;
const geo_type& get_geo() const;
bool is_symmetric() const;
void set_symmetry (bool is_symm = true) const;
bool is_definite_positive() const;
void set_definite_positive (bool is_dp = true) const;
const communicator& comm() const;
// linear algebra:
form_basic<T,M> operator+ (const form_basic<T,M>& b) const;
form_basic<T,M> operator- (const form_basic<T,M>& b) const;
form_basic<T,M> operator* (const form_basic<T,M>& b) const;
form_basic<T,M>& operator*= (const T& lambda);
field_basic<T,M> operator* (const field_basic<T,M>& xh) const;
field_basic<T,M> trans_mult (const field_basic<T,M>& yh) const;
float_type operator () (const field_basic<T,M>& uh, const field_basic<T,M>& vh) const;
// io:
odiststream& put (odiststream& ops, bool show_partition = true) const;
void dump (std::string name) const;
// accessors & modifiers to unknown & blocked parts:
const csr<T,M>& uu() const { return _uu; }
const csr<T,M>& ub() const { return _ub; }
const csr<T,M>& bu() const { return _bu; }
const csr<T,M>& bb() const { return _bb; }
csr<T,M>& set_uu() { return _uu; }
csr<T,M>& set_ub() { return _ub; }
csr<T,M>& set_bu() { return _bu; }
csr<T,M>& set_bb() { return _bb; }
see the communicator page for the full documentation
form_basic< T, M > operator-(const form_basic< T, M > &b) const
Definition form.h:385
csr< T, M > & set_ub()
Definition form.h:209
scalar_traits< T >::type float_type
Definition form.h:152
const csr< T, M > & bb() const
Definition form.h:207
const csr< T, M > & ub() const
Definition form.h:205
form_basic< T, M > operator*(const form_basic< T, M > &b) const
Definition form.h:397
odiststream & put(odiststream &ops, bool show_partition=true) const
Definition form.cc:235
csr< T, M > & set_bu()
Definition form.h:210
space_basic< float_type, M > space_type
Definition form.h:154
csr< T, M > _uu
Definition form.h:219
bool is_definite_positive() const
Definition form.h:451
float_type operator()(const field_basic< T, M > &uh, const field_basic< T, M > &vh) const
Definition form.cc:143
void set_definite_positive(bool is_dp=true) const
Definition form.h:458
form_basic< T, M > & operator=(const form_basic< T, M > &)
Definition form.h:329
csr< T, M > _bb
Definition form.h:222
form_basic< T, M > & operator*=(const T &lambda)
Definition form.h:409
csr< T, M > _ub
Definition form.h:220
csr< T, M > & set_uu()
Definition form.h:208
csr< T, M > & set_bb()
Definition form.h:211
const csr< T, M > & uu() const
Definition form.h:204
bool is_symmetric() const
Definition form.h:436
csr< T, M >::size_type size_type
Definition form.h:150
bool is_symmetric_definite_positive() const
Definition form.h:466
void set_symmetry(bool is_symm=true) const
Definition form.h:443
const space_type & get_first_space() const
Definition form.h:342
field_basic< T, M > trans_mult(const field_basic< T, M > &yh) const
Definition form.cc:134
const csr< T, M > & bu() const
Definition form.h:206
geo_basic< float_type, M > geo_type
Definition form.h:153
csr< T, M > _bu
Definition form.h:221
const space_type & get_second_space() const
Definition form.h:349
form_basic< T, M > operator+(const form_basic< T, M > &b) const
Definition form.h:373
const geo_type & get_geo() const
Definition form.h:356
void set_symmetric_definite_positive() const
Definition form.h:473
const communicator & comm() const
Definition form.h:363
Expr1::float_type T
Definition field_expr.h:230
verbose clean transpose logscale grid shrink ball stereo iso volume skipvtk deformation fastfieldload lattice reader_on_stdin color format format format format format format format format format format format format format format format format format format dump
};
template<class T, class M> form_basic<T,M> trans (const form_basic<T,M>& a);
template<class T, class M> field_basic<T,M> diag (const form_basic<T,M>& a);
template<class T, class M> form_basic<T,M> diag (const field_basic<T,M>& dh);
csr< T, M > diag(const vec< T, M > &d)
Definition csr.cc:56
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
Definition csr.h:455