DOLFIN
DOLFIN C++ interface
Public Member Functions | Protected Member Functions | List of all members
dolfin::FunctionSpace Class Reference

#include <FunctionSpace.h>

Inheritance diagram for dolfin::FunctionSpace:
Inheritance graph
[legend]
Collaboration diagram for dolfin::FunctionSpace:
Collaboration graph
[legend]

Public Member Functions

 FunctionSpace (std::shared_ptr< const Mesh > mesh, std::shared_ptr< const FiniteElement > element, std::shared_ptr< const GenericDofMap > dofmap)
 
 FunctionSpace (const FunctionSpace &V)
 
virtual ~FunctionSpace ()
 Destructor.
 
const FunctionSpaceoperator= (const FunctionSpace &V)
 
bool operator== (const FunctionSpace &V) const
 
bool operator!= (const FunctionSpace &V) const
 
std::shared_ptr< const Meshmesh () const
 
std::shared_ptr< const FiniteElementelement () const
 
std::shared_ptr< const GenericDofMapdofmap () const
 
std::size_t dim () const
 
void interpolate (GenericVector &expansion_coefficients, const GenericFunction &v) const
 
std::shared_ptr< FunctionSpaceoperator[] (std::size_t i) const
 
std::shared_ptr< FunctionSpacesub (std::size_t component) const
 
std::shared_ptr< FunctionSpacesub (const std::vector< std::size_t > &component) const
 
std::shared_ptr< FunctionSpaceextract_sub_space (const std::vector< std::size_t > &component) const
 
bool contains (const FunctionSpace &V) const
 
std::shared_ptr< FunctionSpacecollapse () const
 
std::shared_ptr< FunctionSpacecollapse (std::unordered_map< std::size_t, std::size_t > &collapsed_dofs) const
 
bool has_cell (const Cell &cell) const
 
bool has_element (const FiniteElement &element) const
 
std::vector< std::size_t > component () const
 
std::vector< double > tabulate_dof_coordinates () const
 
void set_x (GenericVector &x, double value, std::size_t component) const
 
std::string str (bool verbose) const
 
void print_dofmap () const
 Print dofmap (useful for debugging)
 
- Public Member Functions inherited from dolfin::Variable
 Variable ()
 Create unnamed variable.
 
 Variable (const std::string name, const std::string label)
 Create variable with given name and label.
 
 Variable (const Variable &variable)
 Copy constructor.
 
virtual ~Variable ()
 Destructor.
 
const Variableoperator= (const Variable &variable)
 Assignment operator.
 
void rename (const std::string name, const std::string label)
 Rename variable.
 
std::string name () const
 Return name.
 
std::string label () const
 Return label (description)
 
std::size_t id () const
 
- Public Member Functions inherited from dolfin::Hierarchical< FunctionSpace >
 Hierarchical (FunctionSpace &self)
 Constructor.
 
virtual ~Hierarchical ()
 Destructor.
 
std::size_t depth () const
 
bool has_parent () const
 
bool has_child () const
 
FunctionSpaceparent ()
 
const FunctionSpaceparent () const
 Return parent in hierarchy (const version).
 
std::shared_ptr< FunctionSpaceparent_shared_ptr ()
 
std::shared_ptr< const FunctionSpaceparent_shared_ptr () const
 Return shared pointer to parent (const version).
 
FunctionSpacechild ()
 
const FunctionSpacechild () const
 Return child in hierarchy (const version).
 
std::shared_ptr< FunctionSpacechild_shared_ptr ()
 
std::shared_ptr< const FunctionSpacechild_shared_ptr () const
 Return shared pointer to child (const version).
 
FunctionSpaceroot_node ()
 
const FunctionSpaceroot_node () const
 Return root node object in hierarchy (const version).
 
std::shared_ptr< FunctionSpaceroot_node_shared_ptr ()
 
std::shared_ptr< const FunctionSpaceroot_node_shared_ptr () const
 Return shared pointer to root node object in hierarchy (const version).
 
FunctionSpaceleaf_node ()
 
const FunctionSpaceleaf_node () const
 Return leaf node object in hierarchy (const version).
 
std::shared_ptr< FunctionSpaceleaf_node_shared_ptr ()
 
std::shared_ptr< const FunctionSpaceleaf_node_shared_ptr () const
 Return shared pointer to leaf node object in hierarchy (const version).
 
void set_parent (std::shared_ptr< FunctionSpace > parent)
 Set parent.
 
void clear_child ()
 Clear child.
 
void set_child (std::shared_ptr< FunctionSpace > child)
 Set child.
 
const Hierarchicaloperator= (const Hierarchical &hierarchical)
 Assignment operator.
 
void _debug () const
 Function useful for debugging the hierarchy.
 

Protected Member Functions

 FunctionSpace (std::shared_ptr< const Mesh > mesh)
 
void attach (std::shared_ptr< const FiniteElement > element, std::shared_ptr< const GenericDofMap > dofmap)
 

Additional Inherited Members

- Public Attributes inherited from dolfin::Variable
Parameters parameters
 Parameters.
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ FunctionSpace() [1/3]

FunctionSpace::FunctionSpace ( std::shared_ptr< const Mesh mesh,
std::shared_ptr< const FiniteElement element,
std::shared_ptr< const GenericDofMap 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.

◆ FunctionSpace() [2/3]

FunctionSpace::FunctionSpace ( std::shared_ptr< const Mesh mesh)
explicitprotected

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.

◆ FunctionSpace() [3/3]

FunctionSpace::FunctionSpace ( const FunctionSpace V)

Copy constructor

Arguments V (FunctionSpace) The object to be copied.

Member Function Documentation

◆ attach()

void FunctionSpace::attach ( std::shared_ptr< const FiniteElement element,
std::shared_ptr< const GenericDofMap dofmap 
)
protected

Attach data to an empty function space

Arguments element (FiniteElement) The element. dofmap (GenericDofMap) The dofmap.

◆ collapse() [1/2]

std::shared_ptr< FunctionSpace > FunctionSpace::collapse ( ) const

Collapse a subspace and return a new function space

Returns FunctionSpace The new function space.

◆ collapse() [2/2]

std::shared_ptr< FunctionSpace > 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.

◆ component()

std::vector< std::size_t > FunctionSpace::component ( ) const

Return component w.r.t. to root superspace, i.e. W.sub(1).sub(0) == [1, 0].

Returns std::vector<std::size_t> The component (w.r.t to root superspace).

◆ contains()

bool FunctionSpace::contains ( const FunctionSpace V) const

Check whether V is subspace of this, or this itself

Arguments V (FunctionSpace) The space to be tested for inclusion.

Returns bool True if V is contained or equal to this.

◆ dim()

std::size_t FunctionSpace::dim ( ) const

Return global dimension of the function space. Equivalent to dofmap()->global_dimension()

Returns std::size_t The dimension of the function space.

◆ dofmap()

std::shared_ptr< const GenericDofMap > FunctionSpace::dofmap ( ) const

Return dofmap

Returns GenericDofMap The dofmap.

◆ element()

std::shared_ptr< const FiniteElement > FunctionSpace::element ( ) const

Return finite element

Returns FiniteElement The finite element.

◆ extract_sub_space()

std::shared_ptr< FunctionSpace > 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.

◆ has_cell()

bool dolfin::FunctionSpace::has_cell ( const Cell cell) const
inline

Check if function space has given cell

Arguments cell (Cell) The cell.

Returns bool True if the function space has the given cell.

◆ has_element()

bool dolfin::FunctionSpace::has_element ( const FiniteElement element) const
inline

Check if function space has given element

Arguments element (FiniteElement) The finite element.

Returns bool True if the function space has the given element.

◆ interpolate()

void FunctionSpace::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.

◆ mesh()

std::shared_ptr< const Mesh > FunctionSpace::mesh ( ) const

Return mesh

Returns Mesh The mesh.

◆ operator!=()

bool FunctionSpace::operator!= ( const FunctionSpace V) const

Inequality operator

Arguments V (FunctionSpace) Another function space.

◆ operator=()

const FunctionSpace & FunctionSpace::operator= ( const FunctionSpace V)

Assignment operator

Arguments V (FunctionSpace) Another function space.

◆ operator==()

bool FunctionSpace::operator== ( const FunctionSpace V) const

Equality operator

Arguments V (FunctionSpace) Another function space.

◆ operator[]()

std::shared_ptr< FunctionSpace > FunctionSpace::operator[] ( std::size_t  i) const

Extract subspace for component

Arguments i (std::size_t) Index of the subspace. Returns FunctionSpace The subspace.

◆ set_x()

void FunctionSpace::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.

◆ str()

std::string FunctionSpace::str ( bool  verbose) const
virtual

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.

Reimplemented from dolfin::Variable.

◆ sub() [1/2]

std::shared_ptr<FunctionSpace> dolfin::FunctionSpace::sub ( std::size_t  component) const
inline

Extract subspace for component

Arguments component (std::size_t) Index of the subspace. Returns FunctionSpace The subspace.

◆ sub() [2/2]

std::shared_ptr<FunctionSpace> dolfin::FunctionSpace::sub ( const std::vector< std::size_t > &  component) const
inline

Extract subspace for component

Arguments component (std::vector<std::size_t>) The component. Returns FunctionSpace The subspace.

◆ tabulate_dof_coordinates()

std::vector< double > FunctionSpace::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.

Returns std::vector<double> The dof coordinates (x0, y0, x1, y1, . . .)


The documentation for this class was generated from the following files: