`form`

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;
rheolef::form
form_basic< Float, rheo_default_memory_model > form
Definition: form.h:293

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 typename scalar_traits<T>::type float_type;
typedef geo_basic<float_type,M> geo_type;
typedef space_basic<float_type,M> space_type;
// allocator/deallocator:
form_basic ();
form_basic (const form_basic<T,M>&);
form_basic<T,M>& operator= (const form_basic<T,M>&);
// 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) 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; }
size_type
field::size_type size_type
Definition: branch.cc:425
rheolef::form_basic::operator-
form_basic< T, M > operator-(const form_basic< T, M > &b) const
Definition: form.h:369
rheolef::form_basic::float_type
scalar_traits< T >::type float_type
Definition: form.h:150
rheolef::form_basic::set_uu
csr< T, M > & set_uu()
Definition: form.h:196
rheolef::form_basic::bu
const csr< T, M > & bu() const
Definition: form.h:194
rheolef::form_basic::value_type
T value_type
Definition: form.h:149
rheolef::form_basic::operator*
form_basic< T, M > operator*(const form_basic< T, M > &b) const
Definition: form.h:381
rheolef::form_basic::put
odiststream & put(odiststream &ops, bool show_partition=true) const
Definition: form.cc:235
rheolef::form_basic::set_bb
csr< T, M > & set_bb()
Definition: form.h:199
rheolef::form_basic::space_type
space_basic< float_type, M > space_type
Definition: form.h:152
rheolef::form_basic::_uu
csr< T, M > _uu
Definition: form.h:207
rheolef::form_basic::operator()
float_type operator()(const field_basic< T, M > &uh, const field_basic< T, M > &vh) const
Definition: form.cc:143
rheolef::form_basic::bb
const csr< T, M > & bb() const
Definition: form.h:195
rheolef::form_basic::ub
const csr< T, M > & ub() const
Definition: form.h:193
rheolef::form_basic::form_basic
form_basic()
Definition: form.h:300
rheolef::form_basic::set_symmetry
void set_symmetry(bool is_symm) const
Definition: form.h:427
rheolef::form_basic::operator=
form_basic< T, M > & operator=(const form_basic< T, M > &)
Definition: form.h:313
rheolef::form_basic::_bb
csr< T, M > _bb
Definition: form.h:210
rheolef::form_basic::operator*=
form_basic< T, M > & operator*=(const T &lambda)
Definition: form.h:393
rheolef::form_basic::_ub
csr< T, M > _ub
Definition: form.h:208
rheolef::form_basic::set_bu
csr< T, M > & set_bu()
Definition: form.h:198
rheolef::form_basic::is_symmetric
bool is_symmetric() const
Definition: form.h:420
rheolef::form_basic::size_type
csr< T, M >::size_type size_type
Definition: form.h:148
rheolef::form_basic::get_first_space
const space_type & get_first_space() const
Definition: form.h:326
rheolef::form_basic::trans_mult
field_basic< T, M > trans_mult(const field_basic< T, M > &yh) const
Definition: form.cc:134
rheolef::form_basic::dump
void dump(std::string name) const
Definition: form.cc:262
rheolef::form_basic::geo_type
geo_basic< float_type, M > geo_type
Definition: form.h:151
rheolef::form_basic::set_ub
csr< T, M > & set_ub()
Definition: form.h:197
rheolef::form_basic::_bu
csr< T, M > _bu
Definition: form.h:209
rheolef::form_basic::uu
const csr< T, M > & uu() const
Definition: form.h:192
rheolef::form_basic::get_second_space
const space_type & get_second_space() const
Definition: form.h:333
rheolef::form_basic::operator+
form_basic< T, M > operator+(const form_basic< T, M > &b) const
Definition: form.h:357
rheolef::form_basic::get_geo
const geo_type & get_geo() const
Definition: form.h:340
rheolef::form_basic::comm
const communicator & comm() const
Definition: form.h:347
T
Expr1::float_type T
Definition: field_expr.h:261
mkgeo_ball.b
int b
Definition: mkgeo_ball.sh:152
mkgeo_contraction.name
string name
Definition: mkgeo_contraction.sh:133
lambda
Definition: yield_slip_circle.h:34
rheolef::scalar_traits::type
T type
Definition: point.h:324
};
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);
rheolef::trans
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
Definition: csr.h:455
rheolef::diag
csr< T, M > diag(const vec< T, M > &d)
Definition: csr.cc:56
a
Definition: diffusion_isotropic.h:25