space(3)
NAME
space -- piecewise polynomial finite element space
DESCRIPTION
The space class contains some numbering for unknowns and blocked
@emph{degrees of freedoms} related to a given mesh and polynomial
approximation.
DEGREE OF FREEDOM NUMBERING
Numbering of degrees of freedom (or shortly, dof) depends upon the mesh
and the piecewise polynomial approximation used. This numbering is
then used by the field and form classes. See also field(3) and
form(3).
The degree-of-freedom (or shortly, dof) follows some simple rules, that
depends of course of the approximation. These rules are suitable for
easy .field file retrieval (see field(3)).
P0
bubble dof numbers follow element numbers in mesh.
P1 dof numbers follow vertice numbers in mesh.
- P2 dof numbers related to vertices follow vertice numbers in mesh.
- Follow dof numbers related to edges, in the edge numbering order.
- P1d dof numbers follow element numbers in mesh. In each element, we
- loop on vertices following the local vertice order provided in the mesh.
UNKNOWN AND BLOCKED DEGREE OF FREEDOM
- A second numbering is related to the unknown and blocked degrees of
freedom.
- geo omega("square");
space V(omega,"P1");
V.block ("boundary"); - Here, all degrees of freedom located on the domain "boundary" are marked as blocked.
FILE FORMAT
- File output format for space is not of practical interest. This file
format is provided for completness. Here is a small example
- space
1 6
square
P10 B
1 B1
2 B
2 - where the `B' denotes blocked degres of freedom. The method set_dof(K, dof_array) gives the numbering in dof_array, supplying an element K. The method index(dof) gives the unknown or blocked numbering from the initial numbering, suppling a given dof
ADDITIONAL FEATURES
The method xdof(K, i) gives the geometrical location of the i-th degree
of freedom in the element K.
Product spaces, for non-scalar fields, such as vector-valued or tensorvalued (symmetric) fields,
CAN ALSO BE DEFINED
- space U (omega, "P1", "vector");
space T (omega, "P1", "tensor"); - Then, the number of component depends upon the geometrical dimension of the mesh omega.
- Arbitrarily product spaces can also be constructed
space X = V0*V1;- Spaces for fields defined on a boundary domain can also be constructed
space W (omega, omega["top"], "P1");- The correspondance between the degree-of-freedom numbering for the space W and the global degree-of-freedom numbering for the space V is supported. The method set_global_dof(S, dof_array) gives the global numbering in dof_array, supplying a boundary element S. The method domain_index(global_dof) gives the unknown or blocked numbering from the initial numbering, suppling a given global_dof, related to the space V.
IMPLEMENTATION
- class space : public smart_pointer<spacerep> {
public:
// typdefs: - typedef spacerep::size_type size_type;
- // allocator/deallocator:
space ();
space (const geo& g, const std::string& approx_name, const std::string& valued = "scalar");
space (const geo& g, const std::string& approx_name,const domain& interface, const domain& subgeo, const std::string& valued = "scalar");
// For spaces with a discontinuity through domain `interface', but otherwise continuous- space (const geo& g, const domain& d, const std::string& approx_name);
space(const const_space_component&); - space operator = (const const_space_component&);
friend space operator * (const space&, const space&);
friend space pow (const space&, size_type); - // modifiers:
void block () const;
void block (size_type i_comp) const;
void block (const std::string& d_name) const;
void block (const domain& d) const;
void block (const std::string& d_name, size_type i_comp) const;
void block (const domain& d, size_type i_comp) const;
void block_dof (size_type dof_idx, size_type i_comp) const;
void block_dof (size_type dof_idx) const;
void unblock_dof (size_type dof_idx, size_type i_comp) const;
void unblock_dof (size_type dof_idx) const;
void set_periodic (const domain& d1, const domain& d2) const;
void set_periodic (const std::string& d1_name, const std::string& d2_name) const;
void lock_components (const domain& d, point locked_dir) const;
void lock_components (const std::string& d_name, point locked_dir) const;
template <class Function>
void lock_components (const std::string& d_name, Function locked_dir) const;// Allows to enforce vector-boundary conditions.
/* Allows to enforce vector-boundary conditions.*!
*! Current limitation: only 2D vector fields with components having same FE approximation. *! The space has a dof for the direction normal to locked_dir, while the value in the *! direction locked_dir is blocked.
*! The field::at function implements the reconstruction of the original cartesian components. */template <class Function>
void lock_components (const domain& d, Function locked_dir) const;- // accessors:
size_type size() const;
size_type degree () const;
size_type n_blocked() const;
size_type n_unknown() const;
size_type dimension() const;
std::string coordinate_system() const;
fem_helper::coordinate_type coordinate_system_type() const;const geo& get_geo () const;
const basis& get_basis (size_type i_component = 0) const;
const numbering& get_numbering (size_type i_component = 0) const;
std::string get_approx(size_type i_component = 0) const;
const basis& get_p1_transformation () const;std::string get_valued() const;
fem_helper::valued_field_type get_valued_type() const;size_type n_component() const;
space_component operator [] (size_type i_comp);
const_space_component operator [] (size_type i_comp) const;size_type size_component (size_type i_component = 0) const;
size_type n_unknown_component (size_type i_component = 0) const;
size_type n_blocked_component (size_type i_component = 0) const;
size_type start (size_type i_component = 0) const;
size_type start_unknown (size_type i_component = 0) const;
size_type start_blocked (size_type i_component = 0) const;size_type index (size_type degree_of_freedom) const;
size_type period_association (size_type degree_of_freedom) const;
bool is_blocked (size_type degree_of_freedom) const;
bool is_periodic (size_type degree_of_freedom) const;bool has_locked () const;// for (2D) vector spaces only, field is only blocked along locked_dirbool is_locked (size_type degree_of_freedom) const;// for tangential-normal representationsize_type locked_with (size_type degree_of_freedom) const;
size_type index_locked_with (size_type degree_of_freedom) const;// dof with the other component (thru space::index() as well)Float locked_component (size_type dof, size_type i_comp) const;// i-th component of locked directionFloat unlocked_component (size_type dof, size_type i_comp) const;// i-th component of unlocked directionvoid freeze () const;
bool is_frozen() const;// informations related to boundary spaces
bool is_on_boundary_domain() const;
const domain& get_boundary_domain() const;
const geo& get_global_geo () const;
size_type global_size () const;
size_type domain_dof (size_type global_dof) const;
size_type domain_index (size_type global_dof) const;// get indices of degrees of freedom associated to an element// the tiny_vector is a "local index" -> "global index" table // "global" variants differ only for boundary spaces (non-global uses domain-indices, global use // mesh-wide indices)void set_dof (const geo_element& K, tiny_vector<size_type>& idx) const;
void set_global_dof (const geo_element& K, tiny_vector<size_type>& idx) const;
void set_dof (const geo_element& K, tiny_vector<size_type>& idx, size_type i_comp) const;
void set_global_dof (const geo_element& K, tiny_vector<size_type>& idx, size_type i_comp) const;
point x_dof (const geo_element& K, size_type i_local) const;// evaluate the basis and derivative of basis functions at a given point of reference element Float reference_eval (const reference_element& hat_K, const tiny_vector<Float>& dof, const point& hat_x,size_type i_comp = 0) const;Float reference_d_dxi_eval (size_type i, const reference_element& hat_K,const tiny_vector<Float>& dof, const point& hat_x,
size_type i_comp) const;// piola transformation
meshpoint hatter (const point& x, size_type K) const;
point dehatter (const meshpoint& S) const;
point dehatter (const point& x_hat, size_type e) const; - // comparator
bool operator == (const space&) const;
bool operator != (const space&) const; - // input/output
friend std::ostream& operator << (std::ostream&, const space&);
friend std::istream& operator >> (std::istream&, space&);
std::ostream& dump(std::ostream& s = std::cerr) const;
void check() const; - // inquires:
static size_type inquire_size(const geo&, const numbering&); - // implementation:
protected:space(smart_pointer<spacerep>);
space (const space&, const space&); // X*Y
space (const space&, size_type i_comp); // X[i_comp]
friend class field; - };