.\" .de Id .. .de Sp .if n .sp .if t .sp 0.4 .. .TH form 2rheolef "rheolef-7.0" "rheolef-7.0" "rheolef-7.0" .\" 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 .PP .SH ALGEBRA Forms, as matrices (see csr(2)), support linear algebra: Adding or subtracting 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: @cindex quarature formula .SH WEIGHTED FORM A weighted form is a form with an extra weight function \fBw(x)\fP, e.g.: .\" begin_example .Sp .nf / | a(uh,vh) = | grad(uh).grad(vh) w(x) dx | / Omega .Sp .fi .\" end_example In the present implementation, \fBw\fP can be any field, function or class-function or any nonlinear field expression (see field(2)). As the integration cannot be performed exactly in general, a quadrature formula can be supplied. This feature is extensively used when solving nonlinear problems. .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& operator= (const form_basic&); // 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 form_basic& b) const; form_basic& operator*= (const T& lambda); field_basic operator* (const field_basic& xh) const; 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: public: // with vf expression arg template void assembly_internal ( const geo_basic& dom, const geo_basic& band, const band_basic& gh, const Expr& expr, const integrate_option& fopt, bool is_on_band); template void assembly ( const geo_basic& domain, const Expr& expr, const integrate_option& fopt); template void assembly ( const band_basic& gh, const Expr& expr, const integrate_option& fopt); // backward compat: named forms form_basic (const space_type& X, const space_type& Y, const std::string& name = "", const quadrature_option& qopt = quadrature_option()); form_basic (const space_type& X, const space_type& Y, const std::string& name, const field_basic& weight, const quadrature_option& qopt = quadrature_option()); template form_basic (const space_type& X, const space_type& Y, const std::string& name, Function weight, const quadrature_option& qopt = quadrature_option()); form_basic (const space_type& X, const space_type& Y, const std::string& name, const geo_basic& gamma, const quadrature_option& qopt = quadrature_option()); form_basic (const space_type& X, const space_type& Y, const std::string& name, const geo_basic& gamma, const field_basic& weight, const quadrature_option& qopt = quadrature_option()); template form_basic ( const space_type& X, const space_type& Y, const std::string& name, const geo_basic& gamma, Function weight, const quadrature_option& qopt = quadrature_option()); protected: // backward compat: named forms (cont.) template void form_init ( const std::string& name, bool has_weight, WeightFunction weight, const quadrature_option& qopt); template void form_init_on_domain ( const std::string& name, const geo_basic& gamma, bool has_weight, WeightFunction weight, const geo_basic& w_omega, // the domain where the fct weight is defined const quadrature_option& qopt); }; template form_basic trans (const form_basic& a); template field_basic diag (const form_basic& a); template form_basic diag (const field_basic& dh); typedef form_basic form; .Sp .fi .\" end_example .\" LENGTH = 5 .SH SEE ALSO field(2), csr(2), space(2), csr(2), field(2) .SH COPYRIGHT Copyright (C) 2000-2018 Pierre Saramito GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.