DOLFIN-X
DOLFIN-X C++ interface
Namespaces | Classes | Enumerations | Functions
dolfinx::fem Namespace Reference

Finite element method functionality. More...

Namespaces

 DofMapBuilder
 Builds a DofMap on a mesh::Mesh.
 
 SparsityPatternBuilder
 Functions to compute the sparsity pattern based on DOF maps.
 

Classes

class  CoordinateElement
 This class manages coordinate mappings for isoparametric cells. More...
 
class  DirichletBC
 Interface for setting (strong) Dirichlet boundary conditions. More...
 
class  DiscreteOperators
 Discrete gradient operators providing derivatives of functions. More...
 
class  DofMap
 Degree-of-freedom map. More...
 
class  ElementDofLayout
 The class represents the degree-of-freedom (dofs) for an element. Dofs are associated with a mesh entity. This class also handles sub-space dofs, which are views into the parent dofs. More...
 
class  FiniteElement
 Finite Element, containing the dof layout on a reference element, and various methods for evaluating and transforming the basis. More...
 
class  Form
 Class for variational forms. More...
 
class  FormCoefficients
 Storage for the coefficients of a Form consisting of Function and the Element objects they are defined on. More...
 
class  FormIntegrals
 Integrals of a Form, including those defined over cells, interior and exterior facets, and vertices. More...
 
class  ReferenceCellGeometry
 Tabulates the vertex positions for the reference cell. More...
 

Enumerations

enum  IntegralType : std::int8_t { cell = 0, exterior_facet = 1, interior_facet = 2, vertex = 3 }
 Type of integral.
 

Functions

template<typename T >
assemble_scalar (const Form< T > &M)
 Assemble functional into scalar. Caller is responsible for accumulation across processes. More...
 
template<typename T >
void assemble_vector (Eigen::Ref< Eigen::Matrix< T, Eigen::Dynamic, 1 >> b, const Form< T > &L)
 Assemble linear form into an Eigen vector. More...
 
template<typename T >
void apply_lifting (Eigen::Ref< Eigen::Matrix< T, Eigen::Dynamic, 1 >> b, const std::vector< std::shared_ptr< const Form< T >>> &a, const std::vector< std::vector< std::shared_ptr< const DirichletBC< T >>>> &bcs1, const std::vector< Eigen::Ref< const Eigen::Matrix< T, Eigen::Dynamic, 1 >>> &x0, double scale)
 Modify b such that: More...
 
template<typename T >
void assemble_matrix (const std::function< int(std::int32_t, const std::int32_t *, std::int32_t, const std::int32_t *, const T *)> &mat_add, const Form< T > &a, const std::vector< std::shared_ptr< const DirichletBC< T >>> &bcs)
 Assemble bilinear form into a matrix. More...
 
template<typename T >
void assemble_matrix (const std::function< int(std::int32_t, const std::int32_t *, std::int32_t, const std::int32_t *, const T *)> &mat_add, const Form< T > &a, const std::vector< bool > &dof_marker0, const std::vector< bool > &dof_marker1)
 Assemble bilinear form into a matrix. Matrix must already be initialised. Does not zero or finalise the matrix. More...
 
template<typename T >
void add_diagonal (const std::function< int(std::int32_t, const std::int32_t *, std::int32_t, const std::int32_t *, const T *)> &mat_add, const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> &rows, T diagonal=1.0)
 Adds a value to the diagonal of a matrix for specified rows. It is typically called after assembly. The assembly function zeroes Dirichlet rows and columns. For block matrices, this function should normally be called only on the diagonal blocks, i.e. blocks for which the test and trial spaces are the same. More...
 
template<typename T >
void add_diagonal (const std::function< int(std::int32_t, const std::int32_t *, std::int32_t, const std::int32_t *, const T *)> &mat_add, const function::FunctionSpace &V, const std::vector< std::shared_ptr< const DirichletBC< T >>> &bcs, T diagonal=1.0)
 Adds a value to the diagonal of the matrix for rows with a Dirichlet boundary conditions applied. This function is typically called after assembly. The assembly function zeroes Dirichlet rows and columns. This function adds the value only to rows that are locally owned, and therefore does not create a need for parallel communication. For block matrices, this function should normally be called only on the diagonal blocks, i.e. blocks for which the test and trial spaces are the same. More...
 
template<typename T >
void set_bc (Eigen::Ref< Eigen::Matrix< T, Eigen::Dynamic, 1 >> b, const std::vector< std::shared_ptr< const DirichletBC< T >>> &bcs, const Eigen::Ref< const Eigen::Matrix< T, Eigen::Dynamic, 1 >> &x0, double scale=1.0)
 Set bc values in owned (local) part of the PETScVector, multiplied by 'scale'. The vectors b and x0 must have the same local size. The bcs should be on (sub-)spaces of the form L that b represents.
 
template<typename T >
void set_bc (Eigen::Ref< Eigen::Matrix< T, Eigen::Dynamic, 1 >> b, const std::vector< std::shared_ptr< const DirichletBC< T >>> &bcs, double scale=1.0)
 Set bc values in owned (local) part of the PETScVector, multiplied by 'scale'. The bcs should be on (sub-)spaces of the form L that b represents.
 
template<typename T >
std::vector< std::vector< std::shared_ptr< const fem::DirichletBC< T > > > > bcs_rows (const std::vector< const Form< T > * > &L, const std::vector< std::shared_ptr< const fem::DirichletBC< T >>> &bcs)
 Arrange boundary conditions by block. More...
 
template<typename T >
std::vector< std::vector< std::vector< std::shared_ptr< const fem::DirichletBC< T > > > > > bcs_cols (const std::vector< std::vector< std::shared_ptr< const Form< T >>>> &a, const std::vector< std::shared_ptr< const DirichletBC< T >>> &bcs)
 Arrange boundary conditions by block. More...
 
Eigen::Array< std::int32_t, Eigen::Dynamic, Eigen::Dynamic > locate_dofs_topological (const std::vector< std::reference_wrapper< function::FunctionSpace >> &V, const int dim, const Eigen::Ref< const Eigen::ArrayXi > &entities, bool remote=true)
 Build an array of degree-of-freedom indices that are associated with give mesh entities (topological) More...
 
Eigen::Array< std::int32_t, Eigen::Dynamic, Eigen::Dynamic > locate_dofs_geometrical (const std::vector< std::reference_wrapper< function::FunctionSpace >> &V, const std::function< Eigen::Array< bool, Eigen::Dynamic, 1 >(const Eigen::Ref< const Eigen::Array< double, 3, Eigen::Dynamic, Eigen::RowMajor >> &)> &marker)
 Build an array of degree-of-freedom indices based on coordinates of the degree-of-freedom (geometric). More...
 
graph::AdjacencyList< std::int32_t > transpose_dofmap (graph::AdjacencyList< std::int32_t > &dofmap, std::int32_t num_cells)
 Create an adjacency list that maps a global index (process-wise) to the 'unassembled' cell-wise contributions. It is built from the usual (cell, local index) -> global index dof map. An 'unassembled' vector is the stacked cell contributions, ordered by cell index. More...
 
Eigen::Array< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > compute_dof_permutations (const mesh::Topology &topology, const fem::ElementDofLayout &dof_layout)
 Return the dof permutations for all cells. Each row contains the numbers from 0 to (number of dofs on reference - 1) permuted so that edges are oriented towards the higher global vertex index. More...
 
la::PETScMatrix create_matrix (const Form< PetscScalar > &a)
 Create a matrix. More...
 
la::PETScMatrix create_matrix_block (const Eigen::Ref< const Eigen::Array< const fem::Form< PetscScalar > *, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> &a)
 Initialise monolithic matrix for an array for bilinear forms. Matrix is not zeroed.
 
la::PETScMatrix create_matrix_nest (const Eigen::Ref< const Eigen::Array< const fem::Form< PetscScalar > *, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> &a)
 Create nested (MatNest) matrix. Matrix is not zeroed.
 
la::PETScVector create_vector_block (const std::vector< std::reference_wrapper< const common::IndexMap >> &maps)
 Initialise monolithic vector. Vector is not zeroed.
 
la::PETScVector create_vector_nest (const std::vector< const common::IndexMap * > &maps)
 Create nested (VecNest) vector. Vector is not zeroed.
 
void assemble_vector_petsc (Vec b, const Form< PetscScalar > &L)
 Assemble linear form into an already allocated PETSc vector. Ghost contributions are not accumulated (not sent to owner). Caller is responsible for calling VecGhostUpdateBegin/End. More...
 
void apply_lifting_petsc (Vec b, const std::vector< std::shared_ptr< const Form< PetscScalar >>> &a, const std::vector< std::vector< std::shared_ptr< const DirichletBC< PetscScalar >>>> &bcs1, const std::vector< Vec > &x0, double scale)
 Modify b such that: More...
 
void set_bc_petsc (Vec b, const std::vector< std::shared_ptr< const DirichletBC< PetscScalar >>> &bcs, const Vec x0, double scale=1.0)
 Set bc values in owned (local) part of the PETScVector, multiplied by 'scale'. The vectors b and x0 must have the same local size. The bcs should be on (sub-)spaces of the form L that b represents.
 
template<typename T >
std::vector< std::vector< std::array< std::shared_ptr< const function::FunctionSpace >, 2 > > > extract_function_spaces (const Eigen::Ref< const Eigen::Array< const fem::Form< T > *, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> &a)
 Extract test (0) and trial (1) function spaces pairs for each bilinear form for a rectangular array of forms. More...
 
template<typename T >
la::SparsityPattern create_sparsity_pattern (const Form< T > &a)
 Create a sparsity pattern for a given form. The pattern is not finalised, i.e. the caller is responsible for calling SparsityPattern::assemble. More...
 
la::SparsityPattern create_sparsity_pattern (const mesh::Topology &topology, const std::array< const DofMap *, 2 > &dofmaps, const std::set< IntegralType > &integrals)
 Create a sparsity pattern for a given form. The pattern is not finalised, i.e. the caller is responsible for calling SparsityPattern::assemble.
 
ElementDofLayout create_element_dof_layout (const ufc_dofmap &dofmap, const mesh::CellType cell_type, const std::vector< int > &parent_map={})
 Create an ElementDofLayout from a ufc_dofmap.
 
DofMap create_dofmap (MPI_Comm comm, const ufc_dofmap &dofmap, mesh::Topology &topology)
 Create dof map on mesh from a ufc_dofmap. More...
 
template<typename T >
std::vector< std::tuple< int, std::string, std::shared_ptr< function::Function< T > > > > get_coeffs_from_ufc_form (const ufc_form &ufc_form)
 Extract coefficients from a UFC form.
 
template<typename T >
std::vector< std::pair< std::string, std::shared_ptr< const function::Constant< T > > > > get_constants_from_ufc_form (const ufc_form &ufc_form)
 Extract coefficients from a UFC form.
 
template<typename T >
Form< T > create_form (const ufc_form &ufc_form, const std::vector< std::shared_ptr< const function::FunctionSpace >> &spaces)
 Create a Form from UFC input. More...
 
template<typename T >
std::shared_ptr< Form< T > > create_form (ufc_form *(*fptr)(), const std::vector< std::shared_ptr< const function::FunctionSpace >> &spaces)
 Create a form from a form_create function returning a pointer to a ufc_form, taking care of memory allocation. More...
 
fem::CoordinateElement create_coordinate_map (const ufc_coordinate_mapping &ufc_cmap)
 Create a CoordinateElement from ufc. More...
 
fem::CoordinateElement create_coordinate_map (ufc_coordinate_mapping *(*fptr)())
 Create a CoordinateElement from ufc. More...
 
std::shared_ptr< function::FunctionSpacecreate_functionspace (ufc_function_space *(*fptr)(const char *), const std::string function_name, std::shared_ptr< mesh::Mesh > mesh)
 Create FunctionSpace from UFC. More...
 
template<typename T >
Eigen::Array< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > pack_coefficients (const fem::Form< T > &form)
 Pack form coefficients ready for assembly.
 
template<typename T >
Eigen::Array< T, Eigen::Dynamic, 1 > pack_constants (const fem::Form< T > &form)
 Pack form constants ready for assembly.
 

Detailed Description

Finite element method functionality.

Classes and algorithms for finite element method operations, e.g. assembly.

Function Documentation

◆ add_diagonal() [1/2]

template<typename T >
void dolfinx::fem::add_diagonal ( const std::function< int(std::int32_t, const std::int32_t *, std::int32_t, const std::int32_t *, const T *)> &  mat_add,
const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> &  rows,
diagonal = 1.0 
)

Adds a value to the diagonal of a matrix for specified rows. It is typically called after assembly. The assembly function zeroes Dirichlet rows and columns. For block matrices, this function should normally be called only on the diagonal blocks, i.e. blocks for which the test and trial spaces are the same.

Parameters
[in]mat_addThe function for adding values to a matrix
[in]rowsThe rows, in local indices, for which to add a value to the diagonal
[in]diagonalThe value to add to the diagonal for the specified rows

◆ add_diagonal() [2/2]

template<typename T >
void dolfinx::fem::add_diagonal ( const std::function< int(std::int32_t, const std::int32_t *, std::int32_t, const std::int32_t *, const T *)> &  mat_add,
const function::FunctionSpace V,
const std::vector< std::shared_ptr< const DirichletBC< T >>> &  bcs,
diagonal = 1.0 
)

Adds a value to the diagonal of the matrix for rows with a Dirichlet boundary conditions applied. This function is typically called after assembly. The assembly function zeroes Dirichlet rows and columns. This function adds the value only to rows that are locally owned, and therefore does not create a need for parallel communication. For block matrices, this function should normally be called only on the diagonal blocks, i.e. blocks for which the test and trial spaces are the same.

Parameters
[in]mat_addThe function for adding values to a matrix
[in]VThe function space for the rows and columns of the matrix. It is used to extract only the Dirichlet boundary conditions that are define on V or subspaces of V.
[in]bcsThe Dirichlet boundary condtions
[in]diagonalThe value to add to the diagonal for rows with a boundary condition applied

◆ apply_lifting()

template<typename T >
void dolfinx::fem::apply_lifting ( Eigen::Ref< Eigen::Matrix< T, Eigen::Dynamic, 1 >>  b,
const std::vector< std::shared_ptr< const Form< T >>> &  a,
const std::vector< std::vector< std::shared_ptr< const DirichletBC< T >>>> &  bcs1,
const std::vector< Eigen::Ref< const Eigen::Matrix< T, Eigen::Dynamic, 1 >>> &  x0,
double  scale 
)

Modify b such that:

b <- b - scale * A_j (g_j - x0_j)

where j is a block (nest) index. For a non-blocked problem j = 0. The boundary conditions bcs1 are on the trial spaces V_j. The forms in [a] must have the same test space as L (from which b was built), but the trial space may differ. If x0 is not supplied, then it is treated as zero.

Ghost contributions are not accumulated (not sent to owner). Caller is responsible for calling VecGhostUpdateBegin/End.

◆ apply_lifting_petsc()

void dolfinx::fem::apply_lifting_petsc ( Vec  b,
const std::vector< std::shared_ptr< const Form< PetscScalar >>> &  a,
const std::vector< std::vector< std::shared_ptr< const DirichletBC< PetscScalar >>>> &  bcs1,
const std::vector< Vec > &  x0,
double  scale 
)

Modify b such that:

b <- b - scale * A_j (g_j - x0_j)

where j is a block (nest) index. For a non-blocked problem j = 0. The boundary conditions bcs1 are on the trial spaces V_j. The forms in [a] must have the same test space as L (from which b was built), but the trial space may differ. If x0 is not supplied, then it is treated as zero.

Ghost contributions are not accumulated (not sent to owner). Caller is responsible for calling VecGhostUpdateBegin/End.

◆ assemble_matrix() [1/2]

template<typename T >
void dolfinx::fem::assemble_matrix ( const std::function< int(std::int32_t, const std::int32_t *, std::int32_t, const std::int32_t *, const T *)> &  mat_add,
const Form< T > &  a,
const std::vector< bool > &  dof_marker0,
const std::vector< bool > &  dof_marker1 
)

Assemble bilinear form into a matrix. Matrix must already be initialised. Does not zero or finalise the matrix.

Parameters
[in]mat_addThe function for adding values into the matrix
[in]aThe bilinear form to assemble
[in]dof_marker0Boundary condition markers for the rows. If bc[i] is true then rows i in A will be zeroed. The index i is a local index.
[in]dof_marker1Boundary condition markers for the columns. If bc[i] is true then rows i in A will be zeroed. The index i is a local index.

◆ assemble_matrix() [2/2]

template<typename T >
void dolfinx::fem::assemble_matrix ( const std::function< int(std::int32_t, const std::int32_t *, std::int32_t, const std::int32_t *, const T *)> &  mat_add,
const Form< T > &  a,
const std::vector< std::shared_ptr< const DirichletBC< T >>> &  bcs 
)

Assemble bilinear form into a matrix.

Parameters
[in]mat_addThe function for adding values into the matrix
[in]aThe bilinear from to assemble
[in]bcsBoundary conditions to apply. For boundary condition dofs the row and column are zeroed. The diagonal entry is not set.

◆ assemble_scalar()

template<typename T >
T dolfinx::fem::assemble_scalar ( const Form< T > &  M)

Assemble functional into scalar. Caller is responsible for accumulation across processes.

Parameters
[in]MThe form (functional) to assemble
Returns
The contribution to the form (functional) from the local process

◆ assemble_vector()

template<typename T >
void dolfinx::fem::assemble_vector ( Eigen::Ref< Eigen::Matrix< T, Eigen::Dynamic, 1 >>  b,
const Form< T > &  L 
)

Assemble linear form into an Eigen vector.

Parameters
[in,out]bThe Eigen vector to be assembled. It will not be zeroed before assembly.
[in]LThe linear forms to assemble into b

◆ assemble_vector_petsc()

void dolfinx::fem::assemble_vector_petsc ( Vec  b,
const Form< PetscScalar > &  L 
)

Assemble linear form into an already allocated PETSc vector. Ghost contributions are not accumulated (not sent to owner). Caller is responsible for calling VecGhostUpdateBegin/End.

Parameters
[in,out]bThe PETsc vector to assemble the form into. The vector must already be initialised with the correct size. The process-local contribution of the form is assembled into this vector. It is not zeroed before assembly.
[in]LThe linear form to assemble

◆ bcs_cols()

template<typename T >
std::vector< std::vector<std::vector<std::shared_ptr<const fem::DirichletBC<T> > > > > dolfinx::fem::bcs_cols ( const std::vector< std::vector< std::shared_ptr< const Form< T >>>> &  a,
const std::vector< std::shared_ptr< const DirichletBC< T >>> &  bcs 
)

Arrange boundary conditions by block.

Parameters
[in]aBiinear forms for each block
[in]bcsBoundary conditions
Returns
The boundary conditions collected by block, i.e. bcs_block[i] is the list of boundary conditions applied to the trial space of a[i]. The order within bcs_block[i] preserves the input order of the bcs array.

◆ bcs_rows()

template<typename T >
std::vector<std::vector<std::shared_ptr<const fem::DirichletBC<T> > > > dolfinx::fem::bcs_rows ( const std::vector< const Form< T > * > &  L,
const std::vector< std::shared_ptr< const fem::DirichletBC< T >>> &  bcs 
)

Arrange boundary conditions by block.

Parameters
[in]LLinear forms for each block
[in]bcsBoundary conditions
Returns
The boundary conditions collected by block, i.e. bcs_block[i] is the list of boundary conditions applied to L[i]. The order within bcs_block[i] preserves the input order of the bcs array.

◆ compute_dof_permutations()

Eigen::Array< int, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > dolfinx::fem::compute_dof_permutations ( const mesh::Topology topology,
const fem::ElementDofLayout dof_layout 
)

Return the dof permutations for all cells. Each row contains the numbers from 0 to (number of dofs on reference - 1) permuted so that edges are oriented towards the higher global vertex index.

Parameters
[in]topologyThe mesh topology
[in]dof_layoutThe layout of dofs on a each cell
Returns
The permutations

◆ create_coordinate_map() [1/2]

fem::CoordinateElement dolfinx::fem::create_coordinate_map ( const ufc_coordinate_mapping &  ufc_cmap)

Create a CoordinateElement from ufc.

Parameters
[in]ufc_cmapUFC coordinate mapping
Returns
A DOLFINX coordinate map

◆ create_coordinate_map() [2/2]

fem::CoordinateElement dolfinx::fem::create_coordinate_map ( ufc_coordinate_mapping *(*)()  fptr)

Create a CoordinateElement from ufc.

Parameters
[in]fptrFunction Pointer to a ufc_function_coordinate_map function
Returns
A DOLFINX coordinate map

◆ create_dofmap()

fem::DofMap dolfinx::fem::create_dofmap ( MPI_Comm  comm,
const ufc_dofmap &  dofmap,
mesh::Topology topology 
)

Create dof map on mesh from a ufc_dofmap.

Parameters
[in]commMPI communicator
[in]dofmapThe ufc_dofmap
[in]topologyThe mesh topology

◆ create_form() [1/2]

template<typename T >
Form<T> dolfinx::fem::create_form ( const ufc_form &  ufc_form,
const std::vector< std::shared_ptr< const function::FunctionSpace >> &  spaces 
)

Create a Form from UFC input.

Parameters
[in]ufc_formThe UFC form
[in]spacesVector of function spaces

◆ create_form() [2/2]

template<typename T >
std::shared_ptr<Form<T> > dolfinx::fem::create_form ( ufc_form *(*)()  fptr,
const std::vector< std::shared_ptr< const function::FunctionSpace >> &  spaces 
)

Create a form from a form_create function returning a pointer to a ufc_form, taking care of memory allocation.

Parameters
[in]fptrpointer to a function returning a pointer to ufc_form
[in]spacesfunction spaces
Returns
Form

◆ create_functionspace()

std::shared_ptr< function::FunctionSpace > dolfinx::fem::create_functionspace ( ufc_function_space *(*)(const char *)  fptr,
const std::string  function_name,
std::shared_ptr< mesh::Mesh mesh 
)

Create FunctionSpace from UFC.

Parameters
[in]fptrFunction Pointer to a ufc_function_space_create function
[in]function_nameName of a function whose function space to create. Function name is the name of Python variable for ufl.Coefficient, ufl.TrialFunction or ufl.TestFunction as defined in the UFL file.
[in]meshMesh
Returns
The created FunctionSpace

◆ create_matrix()

la::PETScMatrix dolfinx::fem::create_matrix ( const Form< PetscScalar > &  a)

Create a matrix.

Parameters
[in]aA bilinear form
Returns
A matrix. The matrix is not zeroed.

◆ create_sparsity_pattern()

template<typename T >
la::SparsityPattern dolfinx::fem::create_sparsity_pattern ( const Form< T > &  a)

Create a sparsity pattern for a given form. The pattern is not finalised, i.e. the caller is responsible for calling SparsityPattern::assemble.

Parameters
[in]aA bilinear form
Returns
The corresponding sparsity pattern

◆ extract_function_spaces()

template<typename T >
std::vector< std::vector<std::array<std::shared_ptr<const function::FunctionSpace>, 2> > > dolfinx::fem::extract_function_spaces ( const Eigen::Ref< const Eigen::Array< const fem::Form< T > *, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor >> &  a)

Extract test (0) and trial (1) function spaces pairs for each bilinear form for a rectangular array of forms.

Parameters
[in]aA rectangular block on bilinear forms
Returns
Rectangular array of the same shape as a with a pair of function spaces in each array entry. If a form is null, then the returned function space pair is (null, null).

◆ locate_dofs_geometrical()

Eigen::Array< std::int32_t, Eigen::Dynamic, Eigen::Dynamic > dolfinx::fem::locate_dofs_geometrical ( const std::vector< std::reference_wrapper< function::FunctionSpace >> &  V,
const std::function< Eigen::Array< bool, Eigen::Dynamic, 1 >(const Eigen::Ref< const Eigen::Array< double, 3, Eigen::Dynamic, Eigen::RowMajor >> &)> &  marker 
)

Build an array of degree-of-freedom indices based on coordinates of the degree-of-freedom (geometric).

Finds degrees of freedom whose geometric coordinate is true for the provided marking function.

Attention
This function is slower than the topological version
Parameters
[in]VThe function (sub)space(s) on which degrees of freedom will be located. The spaces must share the same mesh and element type.
[in]markerFunction marking tabulated degrees of freedom
Returns
Array of local DOF indices in the spaces V[0] (and V[1] is two spaces are passed in). If two spaces are passed in, the (i, 0) entry is the DOF index in the space V[0] and (i, 1) is the correspinding DOF entry in the space V[1].

◆ locate_dofs_topological()

Eigen::Array< std::int32_t, Eigen::Dynamic, Eigen::Dynamic > dolfinx::fem::locate_dofs_topological ( const std::vector< std::reference_wrapper< function::FunctionSpace >> &  V,
const int  dim,
const Eigen::Ref< const Eigen::ArrayXi > &  entities,
bool  remote = true 
)

Build an array of degree-of-freedom indices that are associated with give mesh entities (topological)

Finds degrees-of-freedom which belong to provided mesh entities. Note that degrees-of-freedom for discontinuous elements are associated with the cell even if they may appear to be associated with a facet/edge/vertex.

Parameters
[in]VThe function (sub)space(s) on which degrees-of-freedom (DOFs) will be located. The spaces must share the same mesh and element type.
[in]dimTopological dimension of mesh entities on which degrees-of-freedom will be located
[in]entitiesIndices of mesh entities. All DOFs associated with the closure of these indices will be returned
[in]remoteTrue to return also "remotely located" degree-of-freedom indices. Remotely located degree-of-freedom indices are local/owned by the current process, but which the current process cannot identify because it does not recognize mesh entity as a marked. For example, a boundary condition dof at a vertex where this process does not have the associated boundary facet. This commonly occurs with partitioned meshes.
Returns
Array of local DOF indices in the spaces V[0] (and V[1] is two spaces are passed in). If two spaces are passed in, the (i, 0) entry is the DOF index in the space V[0] and (i, 1) is the correspinding DOF entry in the space V[1].

◆ transpose_dofmap()

graph::AdjacencyList< std::int32_t > dolfinx::fem::transpose_dofmap ( graph::AdjacencyList< std::int32_t > &  dofmap,
std::int32_t  num_cells 
)

Create an adjacency list that maps a global index (process-wise) to the 'unassembled' cell-wise contributions. It is built from the usual (cell, local index) -> global index dof map. An 'unassembled' vector is the stacked cell contributions, ordered by cell index.

If the usual dof map is:

Cell: 0 1 2 3 Global index: [ [0, 3, 5], [3, 2, 4], [4, 3, 2], [2, 1, 0]]

the 'transpose' dof map will be:

Global index: 0 1 2 3 4 5 Unassembled index: [ [0, 11], [10], [4, 8, 9], [1, 3, 7], [5, 6], [2] ]

Parameters
[in]dofmapThe standard dof map that for each cell (node) gives the global (process-wise) index of each local (cell-wise) index.
[in]num_cellsThe number of cells (nodes) in dofmap to consider. The first num_cells are used. This is argument is typically used to exclude ghost cell contributions.
Returns
Map from global (process-wise) index to positions in an unaassembled array. The links for each node are sorted.