FunctionSpace.h¶
Note
The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.
-
class
FunctionSpace
¶ Parent class(es)
This class represents a finite element function space defined by a mesh, a finite element, and a local-to-global mapping of the degrees of freedom (dofmap).
Create function space for given mesh, element and dofmap (shared data)
- Arguments
- mesh (
Mesh
) - The mesh.
- element (
FiniteElement
) - The element.
- dofmap (
GenericDofMap
) - The dofmap.
- mesh (
Create empty function space for later initialization. This constructor is intended for use by any sub-classes which need to construct objects before the initialisation of the base class. Data can be attached to the base class using FunctionSpace::attach(...).
- Arguments
- mesh (
Mesh
) - The mesh.
- mesh (
-
FunctionSpace
(const FunctionSpace &V)¶ Copy constructor
- Arguments
- V (
FunctionSpace
) - The object to be copied.
- V (
Attach data to an empty function space
- Arguments
- element (
FiniteElement
) - The element.
- dofmap (
GenericDofMap
) - The dofmap.
- element (
-
const FunctionSpace &
operator=
(const FunctionSpace &V)¶ Assignment operator
- Arguments
- V (
FunctionSpace
) - Another function space.
- V (
-
bool
operator==
(const FunctionSpace &V) const¶ Equality operator
- Arguments
- V (
FunctionSpace
) - Another function space.
- V (
-
bool
operator!=
(const FunctionSpace &V) const¶ Inequality operator
- Arguments
- V (
FunctionSpace
) - Another function space.
- V (
-
std::shared_ptr<const FiniteElement>
element
() const¶ Return finite element
- Returns
FiniteElement
- The finite element.
-
std::shared_ptr<const GenericDofMap>
dofmap
() const¶ Return dofmap
- Returns
GenericDofMap
- The dofmap.
-
std::size_t
dim
() const¶ Return dimension of function space
- Returns
- std::size_t
- The dimension of the function space.
-
void
interpolate
(GenericVector &expansion_coefficients, const GenericFunction &v) const¶ Interpolate function v into function space, returning the vector of expansion coefficients
- Arguments
- expansion_coefficients (
GenericVector
) - The expansion coefficients.
- v (
GenericFunction
) - The function to be interpolated.
- expansion_coefficients (
-
std::shared_ptr<FunctionSpace>
operator[]
(std::size_t i) const¶ Extract subspace for component
- Arguments
- i (std::size_t)
- Index of the subspace.
- Returns
FunctionSpace
- The subspace.
-
std::shared_ptr<FunctionSpace>
sub
(std::size_t component) const¶ Extract subspace for component
- Arguments
- component (std::size_t)
- Index of the subspace.
- Returns
FunctionSpace
- The subspace.
-
std::shared_ptr<FunctionSpace>
sub
(const std::vector<std::size_t> &component) const¶ Extract subspace for component
- Arguments
- component (std::vector<std::size_t>)
- The component.
- Returns
FunctionSpace
- The subspace.
-
std::shared_ptr<FunctionSpace>
extract_sub_space
(const std::vector<std::size_t> &component) const¶ Extract subspace for component
- Arguments
- component (std::vector<std::size_t>)
- The component.
- Returns
FunctionSpace
- The subspace.
-
std::shared_ptr<FunctionSpace>
collapse
() const¶ Collapse a subspace and return a new function space
- Returns
FunctionSpace
- The new function space.
-
std::shared_ptr<FunctionSpace>
collapse
(std::unordered_map<std::size_t, std::size_t> &collapsed_dofs) const¶ Collapse a subspace and return a new function space and a map from new to old dofs
- Arguments
- collapsed_dofs (std::unordered_map<std::size_t, std::size_t>)
- The map from new to old dofs.
- Returns
FunctionSpace
- The new function space.
-
bool
has_cell
(const Cell &cell) const¶ Check if function space has given cell
- Arguments
- cell (
Cell
) - The cell.
- cell (
- Returns
- bool
- True if the function space has the given cell.
-
bool
has_element
(const FiniteElement &element) const¶ Check if function space has given element
- Arguments
- element (
FiniteElement
) - The finite element.
- element (
- Returns
- bool
- True if the function space has the given element.
-
std::vector<std::size_t>
component
() const¶ Return component
- Returns
- std::vector<std::size_t>
- The component (relative to superspace).
-
std::vector<double>
tabulate_dof_coordinates
() const¶ Tabulate the coordinates of all dofs on this process. This function is typically used by preconditioners that require the spatial coordinates of dofs, for example for re-partitioning or nullspace computations.
- Arguments
- mesh (
Mesh
) - The mesh.
- mesh (
- Returns
- std::vector<double>
- The dof coordinates (x0, y0, x1, y1, . . .)
-
void
set_x
(GenericVector &x, double value, std::size_t component) const¶ Set dof entries in vector to value*x[i], where [x][i] is the coordinate of the dof spatial coordinate. Parallel layout of vector must be consistent with dof map range This function is typically used to construct the null space of a matrix operator, e.g. rigid body rotations.
- Arguments
- vector (
GenericVector
) - The vector to set.
- value (double)
- The value to multiply to coordinate by.
- component (std::size_t)
- The coordinate index.
- mesh (
Mesh
) - The mesh.
- vector (
-
std::string
str
(bool verbose) const¶ Return informal string representation (pretty-print)
- Arguments
- verbose (bool)
- Flag to turn on additional output.
- Returns
- std::string
- An informal representation of the function space.
-
void
print_dofmap
() const¶ Print dofmap (useful for debugging)