.TH "field" 2rheolef "Sat Mar 13 2021" "Version 7.1" "rheolef" \" -*- nroff -*- .ad l .nh .SH NAME field \- piecewise polynomial finite element function (rheolef-7\&.1) .SH "DESCRIPTION" .PP This class represents a piecewise polynomial finite element function\&. Since this function spans onto a finite dimensional basis, it simply stores its coefficients on this basis: these coefficients are called the \fIdegrees of freedom\fP (see \fBspace(2)\fP)\&. .SH "INTERPOLATION" .PP For any function \fCu\fP, its interpolation on the finite element space \fCXh\fP as a field \fCuh in Xh\fP expresses simply via the \fBinterpolate(3)\fP function: .PP .nf Float u (const point& x) { return exp(x[0]*x[1]); } ... field uh = interpolate (Xh, u); .fi .PP .SH "LINEAR ALGEBRA" .PP Linear algebra, such as \fCuh+vh\fP, \fCuh-vh\fP and \fClambda*uh + mu*vh\fP, where \fClambda\fP and \fCmu\fP are of type \fCFloat\fP, are supported\&. The duality product between two fields \fClh\fP and \fCuh\fP writes simply \fCdual(lh,uh)\fP\&. As we consider finite dimensional spaces, this duality product coincides with the usual Euclidean dot product in \fCIR^dim(Xh)\fP\&. The application of the \fCa\fP bilinear \fBform(2)\fP writes \fCa(uh,vh)\fP and is equivalent to \fCdual(m*uh,vh)\fP\&. .SH "COMMON ACCESSORS" .PP For convenience, \fCuh\&.max()\fP, \fCuh\&.min()\fP and \fCuh\&.max_abs()\fP returns respectively the maximum, minimum and maximum of the absolute value of the degrees of freedom\&. .SH "NON-LINEAR ALGEBRA" .PP Non-linear operations, such as \fCsqrt(uh)\fP or \fC1/uh\fP are also available\&. Note that non-linear operations do not returns in general piecewise polynomials: the value returned by \fCsqrt(uh)\fP may be filtered by \fBinterpolate(3)\fP function: .PP .nf field vh = interpolate (Xh, sqrt(uh)); .fi .PP Also, the multiplication \fCuh*vh\fP and the division \fCuh/vh\fP returns a result that is not in the same discrete finite element space: its result also may be filtered by \fBinterpolate(3)\fP`: .PP .nf field wh = interpolate(Xh, uh*vh); .fi .PP All standard unary and binary math functions \fCabs, cos, sin\fP\&.\&.\&. are extended to scalar fields\&. Also \fCsqr(uh)\fP, the square of a field, and \fCmin(uh,vh)\fP, \fCmax(uh,vh)\fP are provided\&. Binary functions can be used also with a scalar, as in .PP .nf field vh = interpolate (Xh, max (abs(uh), 0)); field wh = interpolate (Xh, pow (abs(uh), 1./3)); .fi .PP For applying a user-provided function to a field, please see the \fBcompose(3)\fP function\&. .SH "ACCESS BY DOMAIN" .PP The restriction of a field to a geometric domain, says \fC'boundary'\fP writes \fCuh['boundary']\fP: it represents the trace of the field on the boundary: .PP .nf space Xh (omega, "P1"); uh["boundary"] = 0; .fi .PP .SH "MULTI-VALUED FIELDS" .PP A vector-valued field contains several components, as: .PP .nf space Xh (omega, "P2", "vector"); field uh (Xh); .fi .PP Conversely, for a tensor-valued field: .PP .nf space Th (omega, "P1d", "tensor"); field sigma_h (Xh); .fi .PP .SH "GENERAL SPACE PRODUCT INTERFACE" .PP A general multi-component field writes: .PP .nf 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 .fi .PP 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: the hierarchy is not flattened\&. .PP The \fCxh\&.size()\fP returns the number of field components\&. When the field is scalar, it returns zero by convention, and \fCxh[0]\fP is undefined\&. .SH "DIRECT ACCESS TO DEGREES-OF-FREEDOM" .PP The field class provides a STL-like container interface for accessing the degrees-of-freedom (dofs) of a finite element field \fCuh\fP\&. The number of dofs is \fCuh\&.ndof()\fP and any dof can be accessed via \fCuh\&.dof(idof)\fP\&. In a distributed memory environment, a non-local dof at the partition interface can be obtain via \fCuh\&.dis_dof(dis_idof)\fP where \fCdis_idof\fP is the (global) distributed index assoiated to the distribution \fCuh\&.ownership()\fP\&. See \fBdistributor(4)\fP\&. .PP For better performances, a STL-like iterator interface is available, with \fCuh\&.begin_dof()\fP and \fCuh\&.end_dof()\fP returns iterators to the dofs on the current processor\&. .SH "REPRESENTATION" .PP The degrees of freedom (see \fBspace(2)\fP) are splited between \fIunknowns and blocked\fP, i\&.e\&. \fCuh=[uh\&.u,uh\&.b]\fP for any field \fCuh in Xh\fP\&. Access to these vectors is allowed via some accessors: a read-only one, as \fCuh\&.u()\fP and \fCuh\&.b()\fP, and a read-and-write one, as \fCuh\&.set_u()\fP and \fCuh\&.set_b()\fP, see \fBvec(4)\fP\&. .PP Note that blocked and unknown degrees of freedom could also be elegantly set by using a domain name indexation (see \fBgeo(2)\fP): .PP .nf geo omega ("circle"); space Xh (omega, "P1"); Xh.block ("boundary"); field uh (Xh); uh ["boundary"] = 0; .fi .PP .SH "IMPLEMENTATION" .PP This documentation has been generated from file main/lib/field\&.h .PP The \fCfield\fP class is simply an alias to the \fC\fBfield_basic\fP\fP class .PP .PP .nf typedef field_basic field; .fi .PP \fB\fP .RS 4 .RE .PP The \fC\fBfield_basic\fP\fP class provides an interface to a vector data container: .PP .PP .nf template class field_basic { public : // typedefs: using size_type = std::size_t; using memory_type = M; using value_type = T; // TODO: run-time dependent using result_type = T; // TODO: run-time dependent // using value_type = undeterminated_basic; // TODO using scalar_type = T; using float_type = typename float_traits::type; using valued_type = space_constant::valued_type; using geo_type = geo_basic ; using space_type = space_basic; using dis_reference = typename vec::dis_reference; class iterator; class const_iterator; // allocator/deallocator: field_basic(); explicit field_basic ( const space_type& V, const T& init_value = std::numeric_limits::max()); void resize ( const space_type& V, const T& init_value = std::numeric_limits::max()); // expressions: template ::value && ! details::is_field::value>::type> field_basic (const Expr& expr); // initializer list (c++ 2011): field_basic (const std::initializer_list >& init_list); // assignments: field_basic& operator= (const field_basic&); template typename std::enable_if< details::is_rheolef_arithmetic::value ,field_basic& >::type operator= (const Value& value); template typename std::enable_if< details::is_field_expr_affine_homogeneous::value && ! details::is_field_expr_v2_constant ::value && ! details::is_field ::value ,field_basic&>::type operator= (const Expr&); // initializer list (c++ 2011): field_basic& operator= (const std::initializer_list >& init_list); // accessors: const space_type& get_space() const { return _V; } const geo_type& get_geo() const { return _V\&.get_geo(); } std::string name() const { return _V\&.name(); } std::string get_approx() const { return _V\&.get_approx(); } valued_type valued_tag() const { return _V\&.valued_tag(); } const std::string& valued() const { return _V\&.valued(); } bool have_homogeneous_space (space_basic& Xh) const { Xh = get_space(); return true; } // accessors & modifiers to unknown & blocked parts: const vec& u() const { return _u; } const vec& b() const { return _b; } vec& set_u() { dis_dof_indexes_requires_update(); return _u; } vec& set_b() { dis_dof_indexes_requires_update(); return _b; } // accessors to extremas: T min() const; T max() const; T max_abs() const; T min_abs() const; // accessors by domains: field_indirect operator[] (const geo_basic& dom); field_indirect_const operator[] (const geo_basic& dom) const; field_indirect operator[] (std::string dom_name); field_indirect_const operator[] (std::string dom_name) const; // accessors by components: size_type size() const { return _V\&.size(); } field_component operator[] (size_type i_comp); field_component_const operator[] (size_type i_comp) const; field_component operator() (size_type i_comp, size_type j_comp); field_component_const operator() (size_type i_comp, size_type j_comp) const; // accessors by degrees-of-freedom (dof): const distributor& ownership() const { return get_space()\&.ownership(); } const communicator& comm() const { return ownership()\&.comm(); } size_type ndof() const { return ownership()\&.size(); } size_type dis_ndof() const { return ownership()\&.dis_size(); } T& dof (size_type idof); const T& dof (size_type idof) const; const T& dis_dof (size_type dis_idof) const; // write access to non-local dis_idof changes to others procs 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; // input/output: idiststream& get (idiststream& ips); odiststream& put (odiststream& ops) const; odiststream& put_field (odiststream& ops) const; // evaluate uh(x) where x is given locally as hat_x in K: T dis_evaluate (const point_basic& x, size_type i_comp = 0) const; T operator() (const point_basic& x) const { return dis_evaluate (x,0); } point_basic dis_vector_evaluate (const point_basic& x) const; .fi .PP .PP .nf }; .fi .PP .SH AUTHOR Pierre Saramito .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.