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

Degree-of-freedom map. More...

#include <DofMap.h>

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

Public Member Functions

 DofMap (std::shared_ptr< const ufc::dofmap > ufc_dofmap, const Mesh &mesh)
 
 DofMap (std::shared_ptr< const ufc::dofmap > ufc_dofmap, const Mesh &mesh, std::shared_ptr< const SubDomain > constrained_domain)
 
 ~DofMap ()
 Destructor.
 
bool is_view () const
 
std::size_t global_dimension () const
 
std::size_t num_element_dofs (std::size_t cell_index) const
 
std::size_t max_element_dofs () const
 
virtual std::size_t num_entity_dofs (std::size_t entity_dim) const
 
virtual std::size_t num_entity_closure_dofs (std::size_t entity_dim) const
 
std::size_t num_facet_dofs () const
 
std::pair< std::size_t, std::size_t > ownership_range () const
 
const std::vector< int > & off_process_owner () const
 
const std::unordered_map< int, std::vector< int > > & shared_nodes () const
 
const std::set< int > & neighbours () const
 
void clear_sub_map_data ()
 
Eigen::Map< const Eigen::Array< dolfin::la_index, Eigen::Dynamic, 1 > > cell_dofs (std::size_t cell_index) const
 
std::vector< dolfin::la_indexentity_dofs (const Mesh &mesh, std::size_t entity_dim, const std::vector< std::size_t > &entity_indices) const
 
std::vector< dolfin::la_indexentity_dofs (const Mesh &mesh, std::size_t entity_dim) const
 
std::vector< dolfin::la_indexentity_closure_dofs (const Mesh &mesh, std::size_t entity_dim, const std::vector< std::size_t > &entity_indices) const
 
std::vector< dolfin::la_indexentity_closure_dofs (const Mesh &mesh, std::size_t entity_dim) const
 
void tabulate_facet_dofs (std::vector< std::size_t > &element_dofs, std::size_t cell_facet_index) const
 
void tabulate_entity_dofs (std::vector< std::size_t > &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const
 
void tabulate_entity_closure_dofs (std::vector< std::size_t > &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const
 
void tabulate_global_dofs (std::vector< std::size_t > &element_dofs) const
 
std::shared_ptr< GenericDofMapcopy () const
 
std::shared_ptr< GenericDofMapcreate (const Mesh &new_mesh) const
 
std::shared_ptr< GenericDofMapextract_sub_dofmap (const std::vector< std::size_t > &component, const Mesh &mesh) const
 
std::shared_ptr< GenericDofMapcollapse (std::unordered_map< std::size_t, std::size_t > &collapsed_map, const Mesh &mesh) const
 
std::vector< dolfin::la_indexdofs (const Mesh &mesh, std::size_t dim) const
 
std::vector< dolfin::la_indexdofs () const
 Return list of global dof indices on this process.
 
void set (GenericVector &x, double value) const
 
std::shared_ptr< const IndexMapindex_map () const
 Return the map (const access)
 
int block_size () const
 
void tabulate_local_to_global_dofs (std::vector< std::size_t > &local_to_global_map) const
 
std::size_t local_to_global_index (int local_index) const
 
const std::vector< std::size_t > & local_to_global_unowned () const
 Return indices of dofs which are owned by other processes.
 
std::string str (bool verbose) const
 
- Public Member Functions inherited from dolfin::GenericDofMap
 GenericDofMap ()
 Constructor.
 
std::size_t cell_dimension (std::size_t index) const
 
std::size_t max_cell_dimension () const
 
- 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
 

Friends

class DofMapBuilder
 
class MultiMeshDofMap
 

Additional Inherited Members

- Public Attributes inherited from dolfin::GenericDofMap
std::shared_ptr< const SubDomainconstrained_domain
 
- Public Attributes inherited from dolfin::Variable
Parameters parameters
 Parameters.
 

Detailed Description

Degree-of-freedom map.

This class handles the mapping of degrees of freedom. It builds a dof map based on a ufc::dofmap on a specific mesh. It will reorder the dofs when running in parallel. Sub-dofmaps, both views and copies, are supported.

Constructor & Destructor Documentation

◆ DofMap() [1/2]

DofMap::DofMap ( std::shared_ptr< const ufc::dofmap >  ufc_dofmap,
const Mesh mesh 
)

Create dof map on mesh (mesh is not stored)

Parameters
[in]ufc_dofmap(ufc::dofmap) The ufc::dofmap.
[in]mesh(Mesh&) The mesh.

◆ DofMap() [2/2]

DofMap::DofMap ( std::shared_ptr< const ufc::dofmap >  ufc_dofmap,
const Mesh mesh,
std::shared_ptr< const SubDomain constrained_domain 
)

Create a periodic dof map on mesh (mesh is not stored)

Parameters
[in]ufc_dofmap(ufc::dofmap) The ufc::dofmap.
[in]mesh(Mesh) The mesh.
[in]constrained_domain(SubDomain) The subdomain marking the constrained (tied) boundaries.

Member Function Documentation

◆ block_size()

int dolfin::DofMap::block_size ( ) const
inlinevirtual

Return the block size for dof maps with components, typically used for vector valued functions.

Implements dolfin::GenericDofMap.

◆ cell_dofs()

Eigen::Map<const Eigen::Array<dolfin::la_index, Eigen::Dynamic, 1> > dolfin::DofMap::cell_dofs ( std::size_t  cell_index) const
inlinevirtual

Local-to-global mapping of dofs on a cell

Parameters
cell_index(std::size_t) The cell index.
Returns
ArrayView<const dolfin::la_index>

Implements dolfin::GenericDofMap.

◆ clear_sub_map_data()

void dolfin::DofMap::clear_sub_map_data ( )
inlinevirtual

Clear any data required to build sub-dofmaps (this is to reduce memory use)

Implements dolfin::GenericDofMap.

◆ collapse()

std::shared_ptr< GenericDofMap > DofMap::collapse ( std::unordered_map< std::size_t, std::size_t > &  collapsed_map,
const Mesh mesh 
) const
virtual

Create a "collapsed" dofmap (collapses a sub-dofmap)

Parameters
collapsed_map(std::unordered_map<std::size_t, std::size_t>) The "collapsed" map.
mesh(Mesh) The mesh.
Returns
DofMap The collapsed dofmap.

Implements dolfin::GenericDofMap.

◆ copy()

std::shared_ptr< GenericDofMap > DofMap::copy ( ) const
virtual

Create a copy of the dof map

Returns
DofMap The Dofmap copy.

Implements dolfin::GenericDofMap.

◆ create()

std::shared_ptr< GenericDofMap > DofMap::create ( const Mesh new_mesh) const
virtual

Create a copy of the dof map on a new mesh

Parameters
new_mesh(Mesh) The new mesh to create the dof map on.
Returns
DofMap The new Dofmap copy.

Implements dolfin::GenericDofMap.

◆ dofs()

std::vector< dolfin::la_index > DofMap::dofs ( const Mesh mesh,
std::size_t  dim 
) const
virtual

Return list of dof indices on this process that belong to mesh entities of dimension dim

Implements dolfin::GenericDofMap.

◆ entity_closure_dofs() [1/2]

std::vector< dolfin::la_index > DofMap::entity_closure_dofs ( const Mesh mesh,
std::size_t  entity_dim,
const std::vector< std::size_t > &  entity_indices 
) const
virtual

Return the dof indices associated with the closure of entities of given dimension and entity indices

Arguments entity_dim (std::size_t) Entity dimension. entity_indices (std::vector<dolfin::la_index>&) Entity indices to get dofs for. Returns std::vector<dolfin::la_index> Dof indices associated with selected entities and their closure.

Implements dolfin::GenericDofMap.

◆ entity_closure_dofs() [2/2]

std::vector< dolfin::la_index > DofMap::entity_closure_dofs ( const Mesh mesh,
std::size_t  entity_dim 
) const
virtual

Return the dof indices associated with the closure of all entities of given dimension

Parameters
mesh(Mesh) Mesh
entity_dim(std::size_t) Entity dimension.
Returns
std::vector<dolfin::la_index> Dof indices associated with selected entities and their closure.

Implements dolfin::GenericDofMap.

◆ entity_dofs() [1/2]

std::vector< dolfin::la_index > DofMap::entity_dofs ( const Mesh mesh,
std::size_t  entity_dim,
const std::vector< std::size_t > &  entity_indices 
) const
virtual

Return the dof indices associated with entities of given dimension and entity indices

Arguments entity_dim (std::size_t) Entity dimension. entity_indices (std::vector<dolfin::la_index>&) Entity indices to get dofs for. Returns std::vector<dolfin::la_index> Dof indices associated with selected entities.

Implements dolfin::GenericDofMap.

◆ entity_dofs() [2/2]

std::vector< dolfin::la_index > DofMap::entity_dofs ( const Mesh mesh,
std::size_t  entity_dim 
) const
virtual

Return the dof indices associated with all entities of given dimension

Arguments entity_dim (std::size_t) Entity dimension. Returns std::vector<dolfin::la_index> Dof indices associated with selected entities.

Implements dolfin::GenericDofMap.

◆ extract_sub_dofmap()

std::shared_ptr< GenericDofMap > DofMap::extract_sub_dofmap ( const std::vector< std::size_t > &  component,
const Mesh mesh 
) const
virtual

Extract subdofmap component

Parameters
component(std::vector<std::size_t>) The component.
mesh(Mesh) The mesh.
Returns
DofMap The subdofmap component.

Implements dolfin::GenericDofMap.

◆ global_dimension()

std::size_t DofMap::global_dimension ( ) const
virtual

Return the dimension of the global finite element function space. Use index_map()->size() to get the local dimension.

Returns std::size_t The dimension of the global finite element function space.

Implements dolfin::GenericDofMap.

◆ is_view()

bool dolfin::DofMap::is_view ( ) const
inlinevirtual

True iff dof map is a view into another map

Returns bool True if the dof map is a sub-dof map (a view into another map).

Implements dolfin::GenericDofMap.

◆ local_to_global_index()

std::size_t dolfin::DofMap::local_to_global_index ( int  local_index) const
inlinevirtual

Return global dof index for a given local (process) dof index

Parameters
local_index(int) The local local index.
Returns
std::size_t The global dof index.

Implements dolfin::GenericDofMap.

◆ max_element_dofs()

std::size_t DofMap::max_element_dofs ( ) const
virtual

Return the maximum dimension of the local finite element function space

Returns
std::size_t Maximum dimension of the local finite element function space.

Implements dolfin::GenericDofMap.

◆ neighbours()

const std::set< int > & DofMap::neighbours ( ) const
virtual

Return set of processes that share dofs with this process

Returns
std::set<int> The set of processes

Implements dolfin::GenericDofMap.

◆ num_element_dofs()

std::size_t DofMap::num_element_dofs ( std::size_t  cell_index) const
virtual

Return the dimension of the local finite element function space on a cell

Parameters
cell_index(std::size_t) Index of cell
Returns
std::size_t Dimension of the local finite element function space.

Implements dolfin::GenericDofMap.

◆ num_entity_closure_dofs()

std::size_t DofMap::num_entity_closure_dofs ( std::size_t  entity_dim) const
virtual

Return the number of dofs for the closure of an entity of given dimension

Arguments entity_dim (std::size_t) Entity dimension

Returns std::size_t Number of dofs associated with closure of an entity of given dimension

Implements dolfin::GenericDofMap.

◆ num_entity_dofs()

std::size_t DofMap::num_entity_dofs ( std::size_t  entity_dim) const
virtual

Return the number of dofs for a given entity dimension

Parameters
entity_dim(std::size_t) Entity dimension
Returns
std::size_t Number of dofs associated with given entity dimension

Implements dolfin::GenericDofMap.

◆ num_facet_dofs()

std::size_t DofMap::num_facet_dofs ( ) const
virtual

Return number of facet dofs

Returns
std::size_t The number of facet dofs.

Implements dolfin::GenericDofMap.

◆ off_process_owner()

const std::vector<int>& dolfin::DofMap::off_process_owner ( ) const
inlinevirtual

Return map from nonlocal dofs that appear in local dof map to owning process

Returns
std::vector<unsigned int> The map from non-local dofs.

Implements dolfin::GenericDofMap.

◆ ownership_range()

std::pair< std::size_t, std::size_t > DofMap::ownership_range ( ) const
virtual

Return the ownership range (dofs in this range are owned by this process)

Returns
std::pair<std::size_t, std::size_t> The ownership range.

Implements dolfin::GenericDofMap.

◆ set()

void DofMap::set ( GenericVector x,
double  value 
) const
virtual

Set dof entries in vector to a specified value. 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.

Parameters
x(GenericVector) The vector to set.
value(double) The value to set.

Implements dolfin::GenericDofMap.

◆ shared_nodes()

const std::unordered_map< int, std::vector< int > > & DofMap::shared_nodes ( ) const
virtual

Return map from all shared nodes to the sharing processes (not including the current process) that share it.

Returns
std::unordered_map<std::size_t, std::vector<unsigned int>> The map from dofs to list of processes

Implements dolfin::GenericDofMap.

◆ str()

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

Return informal string representation (pretty-print)

Parameters
verbose(bool) Flag to turn on additional output.
Returns
std::string An informal representation of the function space.

Implements dolfin::GenericDofMap.

◆ tabulate_entity_closure_dofs()

void DofMap::tabulate_entity_closure_dofs ( std::vector< std::size_t > &  element_dofs,
std::size_t  entity_dim,
std::size_t  cell_entity_index 
) const
virtual

Tabulate local-local mapping of dofs on closure of entity (dim, local_entity)

Parameters
element_dofs(std::size_t) Degrees of freedom on a single element.
entity_dim(std::size_t) The entity dimension.
cell_entity_index(std::size_t) The local entity index on the cell.

Implements dolfin::GenericDofMap.

◆ tabulate_entity_dofs()

void DofMap::tabulate_entity_dofs ( std::vector< std::size_t > &  element_dofs,
std::size_t  entity_dim,
std::size_t  cell_entity_index 
) const
virtual

Tabulate local-local mapping of dofs on entity (dim, local_entity)

Parameters
element_dofs(std::size_t) Degrees of freedom on a single element.
entity_dim(std::size_t) The entity dimension.
cell_entity_index(std::size_t) The local entity index on the cell.

Implements dolfin::GenericDofMap.

◆ tabulate_facet_dofs()

void DofMap::tabulate_facet_dofs ( std::vector< std::size_t > &  element_dofs,
std::size_t  cell_facet_index 
) const
virtual

Tabulate local-local facet dofs

Parameters
element_dofs(std::size_t) Degrees of freedom on a single element.
cell_facet_index(std::size_t) The local facet index on the cell.

Implements dolfin::GenericDofMap.

◆ tabulate_global_dofs()

void dolfin::DofMap::tabulate_global_dofs ( std::vector< std::size_t > &  element_dofs) const
inlinevirtual

Tabulate globally supported dofs

Parameters
element_dofs(std::size_t) Degrees of freedom.

Implements dolfin::GenericDofMap.

◆ tabulate_local_to_global_dofs()

void DofMap::tabulate_local_to_global_dofs ( std::vector< std::size_t > &  local_to_global_map) const
virtual

Compute the map from local (this process) dof indices to global dof indices.

Parameters
local_to_global_map(std::vector<std::size_t>) The local-to-global map to fill.

Implements dolfin::GenericDofMap.


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