.\" .de Id .. .de Sp .if n .sp .if t .sp 0.4 .. .TH form 2rheolef "rheolef-6.1" "rheolef-6.1" "rheolef-6.1" .\" label: /*Class:form .SH NAME \fBform\fP - representation of a finite element bilinear form .SH DESCRIPTION The form class groups four sparse matrix, associated to a bilinear form on two finite element spaces: .\" begin_example .Sp .nf a: U*V ----> IR (u,v) |---> a(u,v) .Sp .fi .\" end_example The operator \fBA\fP associated to the bilinear form is defined by: .\" begin_example .Sp .nf A: U ----> V' u |---> A(u) .Sp .fi .\" end_example where \fBu\fP and \fBv\fP are fields (see field(2)), and \fBA(u)\fP is such that \fBa(u,v)=\fP for all u in U and v in V and where \fB<.,.>\fP denotes the duality product between V and V'. Since V is a finite dimensional spaces, the duality product is the euclidian product in IR^dim(V). .PP Since both U and V are finite dimensional spaces, the linear operator can be represented by a matrix. The \fBform\fP class is represented by four sparse matrix in \fBcsr\fP format (see csr(2)), associated to unknown and blocked degrees of freedom of origin and destination spaces (see space(2)). .SH EXAMPLE .PP The operator A associated to a bilinear form a(.,.) by the relation (Au,v) = a(u,v) could be applied by using a sample matrix notation A*u, as shown by the following code: .\" begin_example .Sp .nf geo omega("square"); space V (omega,"P1"); form a (V,V,"grad_grad"); field uh = interpolate (fct, V); field vh = a*uh; cout << v; .Sp .fi .\" end_example .PP The form-field \fBvh=a*uh\fP operation is equivalent to the following matrix-vector operations: .\" begin_example .Sp .nf vh.set_u() = a.uu()*uh.u() + a.ub()*uh.b(); vh.set_b() = a.bu()*uh.u() + a.bb()*uh.b(); .Sp .fi .\" end_example .SH ALGABRA Forms, as matrices (see csr(2)), support linear algebra: Adding or substracting two forms writes \fBa+b\fP and \fBa-b\fP, respectively, and multiplying a form by a field \fBuh\fP writes \fBa*uh\fP. Thus, any linear combination of forms is available. .PP .\" skip start:SEE ALSO: .\" skip start:AUTHOR: .\" skip start:DATE: .\" skip start:METHODS: .\" END .SH IMPLEMENTATION .\" begin_example .Sp .nf template class form_basic { public : // typedefs: typedef typename csr::size_type size_type; typedef T value_type; typedef typename scalar_traits::type float_type; typedef geo_basic geo_type; typedef space_basic space_type; // allocator/deallocator: form_basic (); form_basic (const form_basic&); form_basic (const space_type& X, const space_type& Y, const std::string& name = "", quadrature_option_type qopt = quadrature_option_type(quadrature_option_type::max_family,0)); form_basic (const space_type& X, const space_type& Y, const std::string& name, const geo_basic& gamma, quadrature_option_type qopt = quadrature_option_type(quadrature_option_type::max_family,0)); form_basic (const space_type& X, const space_type& Y, const std::string& name, const field_basic& weight, quadrature_option_type qopt = quadrature_option_type(quadrature_option_type::max_family,0)); form_basic (const space_type& X, const space_type& Y, const std::string& name, const band_basic& bh, quadrature_option_type qopt = quadrature_option_type(quadrature_option_type::max_family,0)); // allocators from initializer list (c++ 2011): #ifdef _RHEOLEF_HAVE_STD_INITIALIZER_LIST form_basic (const std::initializer_list >& init_list); form_basic (const std::initializer_list >& init_list); #endif // _RHEOLEF_HAVE_STD_INITIALIZER_LIST // accessors: const space_type& get_first_space() const; const space_type& get_second_space() const; const geo_type& get_geo() const; const communicator& comm() const; // linear algebra: form_basic operator+ (const form_basic& b) const; form_basic operator- (const form_basic& b) const; form_basic& operator*= (const T& lambda); field_basic operator* (const field_basic& xh) const; #ifdef TO_CLEAN template field_basic operator* (const field_expr& xh) const; #endif // TO_CLEAN field_basic trans_mult (const field_basic& yh) const; float_type operator () (const field_basic& uh, const field_basic& 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& uu() const { return _uu; } const csr& ub() const { return _ub; } const csr& bu() const { return _bu; } const csr& bb() const { return _bb; } csr& set_uu() { return _uu; } csr& set_ub() { return _ub; } csr& set_bu() { return _bu; } csr& set_bb() { return _bb; } // data protected: space_type _X; space_type _Y; csr _uu; csr _ub; csr _bu; csr _bb; // internals: void assembly (const form_element& form_e, const geo_basic& X_geo, const geo_basic& Y_geo, bool X_geo_is_background = true); void form_init ( const std::string& name, bool has_weight, const field_basic& weight, quadrature_option_type qopt); }; template form_basic trans (const form_basic& a); typedef form_basic form; .Sp .fi .\" end_example .\" LENGTH = 4 .SH SEE ALSO field(2), csr(2), space(2), csr(2)