dolfinx.cpp.fem

FEM module

Functions

apply_lifting(arg0, arg1, arg2, arg3, arg4)

Modify vector for lifted boundary conditions

assemble_matrix(arg0, …)

Experimental assembly with Python insertion function.

assemble_matrix_petsc(*args, **kwargs)

Overloaded function.

assemble_matrix_petsc_unrolled(*args, **kwargs)

Overloaded function.

assemble_scalar(arg0)

Assemble functional over mesh

assemble_vector(b, L)

Assemble linear form into an existing vector

bcs_cols(arg0, arg1)

bcs_rows(arg0, arg1)

build_dofmap(arg0, arg1, arg2)

Build and dofmap on a mesh.

create_discrete_gradient(arg0, arg1)

create_dofmap(arg0, arg1, arg2, arg3)

Create DofMap object from a pointer to ufc_dofmap.

create_element_dof_layout(arg0, arg1, arg2)

Create ElementDofLayout object from a ufc dofmap.

create_form(arg0, arg1, arg2, arg3, arg4, …)

Create Form from a pointer to ufc_form.

create_matrix(a, type)

Create a PETSc Mat for bilinear form.

create_matrix_block(a, type)

Create monolithic sparse matrix for stacked bilinear forms.

create_matrix_nest(a, types)

Create nested sparse matrix for bilinear forms.

create_sparsity_pattern(arg0)

Create a sparsity pattern for bilinear form.

create_vector_block(arg0, int]])

Create a monolithic vector for multiple (stacked) linear forms.

create_vector_nest(arg0, int]])

Create nested vector for multiple (stacked) linear forms.

insert_diagonal(arg0, arg1, arg2, arg3)

locate_dofs_geometrical(*args, **kwargs)

Overloaded function.

locate_dofs_topological(*args, **kwargs)

Overloaded function.

pack_coefficients(*args, **kwargs)

Overloaded function.

pack_constants(*args, **kwargs)

Overloaded function.

set_bc(b, bcs, x0, scale)

transpose_dofmap(arg0, arg1)

Build the index to (cell, local index) map from a dofmap ((cell, local index ) -> index).

Classes

Constant(self, arg0, arg1)

A value constant with respect to integration domain

CoordinateElement(self, celltype, degree)

Coordinate map element

DirichletBC(*args, **kwargs)

Object for representing Dirichlet (essential) boundary conditions

DofMap(self, element_dof_layout, index_map, …)

DofMap object

ElementDofLayout(self, arg0, arg1, arg2, …)

Object describing the layout of dofs on a cell

Expression(self, coefficients, constants, …)

An Expression

FiniteElement(self, arg0)

Finite element object

Form(self, spaces, integrals, …)

Variational form object

Function(*args, **kwargs)

A finite element function

FunctionSpace(self, arg0, arg1, arg2)

IntegralType(self, value)

Members:

class dolfinx.cpp.fem.Constant(self: dolfinx.cpp.fem.Constant, arg0: List[int], arg1: List[float]) None

Bases: pybind11_builtins.pybind11_object

A value constant with respect to integration domain

Create a constant from a scalar value array

value(self: dolfinx.cpp.fem.Constant) numpy.ndarray
class dolfinx.cpp.fem.CoordinateElement(self: dolfinx.cpp.fem.CoordinateElement, celltype: dolfinx.cpp.mesh.CellType, degree: int) None

Bases: pybind11_builtins.pybind11_object

Coordinate map element

property dof_layout
property non_affine_atol
property non_affine_max_its
pull_back(self: dolfinx.cpp.fem.CoordinateElement, arg0: numpy.ndarray[numpy.float64], arg1: numpy.ndarray[numpy.float64]) numpy.ndarray[numpy.float64]
push_forward(self: dolfinx.cpp.fem.CoordinateElement, arg0: numpy.ndarray[numpy.float64], arg1: numpy.ndarray[numpy.float64]) numpy.ndarray[numpy.float64]
class dolfinx.cpp.fem.DirichletBC(*args, **kwargs)

Bases: pybind11_builtins.pybind11_object

Object for representing Dirichlet (essential) boundary conditions

Overloaded function.

  1. __init__(self: dolfinx.cpp.fem.DirichletBC, arg0: dolfinx::fem::Function<double>, arg1: numpy.ndarray[numpy.int32]) -> None

  2. __init__(self: dolfinx.cpp.fem.DirichletBC, arg0: dolfinx::fem::Function<double>, arg1: List[numpy.ndarray[numpy.int32][2]], arg2: dolfinx::fem::FunctionSpace) -> None

dof_indices(self: dolfinx.cpp.fem.DirichletBC) Tuple[numpy.ndarray[numpy.int32], int]
property function_space
property value
class dolfinx.cpp.fem.DofMap(self: dolfinx.cpp.fem.DofMap, element_dof_layout: dolfinx.cpp.fem.ElementDofLayout, index_map: dolfinx.cpp.common.IndexMap, index_map_bs: int, dofmap: dolfinx.cpp.graph.AdjacencyList_int32, bs: int) None

Bases: pybind11_builtins.pybind11_object

DofMap object

property bs
cell_dofs(self: dolfinx.cpp.fem.DofMap, arg0: int) numpy.ndarray[numpy.int32]
property dof_layout
property index_map
property index_map_bs
list(self: dolfinx.cpp.fem.DofMap) dolfinx.cpp.graph.AdjacencyList_int32
class dolfinx.cpp.fem.ElementDofLayout(self: dolfinx.cpp.fem.ElementDofLayout, arg0: int, arg1: List[List[Set[int]]], arg2: List[List[Set[int]]], arg3: List[int], arg4: List[dolfinx.cpp.fem.ElementDofLayout]) None

Bases: pybind11_builtins.pybind11_object

Object describing the layout of dofs on a cell

block_size(self: dolfinx.cpp.fem.ElementDofLayout) int
entity_closure_dofs(self: dolfinx.cpp.fem.ElementDofLayout, arg0: int, arg1: int) List[int]
entity_dofs(self: dolfinx.cpp.fem.ElementDofLayout, arg0: int, arg1: int) List[int]
property num_dofs
num_entity_closure_dofs(self: dolfinx.cpp.fem.ElementDofLayout, arg0: int) int
num_entity_dofs(self: dolfinx.cpp.fem.ElementDofLayout, arg0: int) int
class dolfinx.cpp.fem.Expression(self: dolfinx.cpp.fem.Expression, coefficients: List[dolfinx.cpp.fem.Function], constants: List[dolfinx.cpp.fem.Constant], mesh: dolfinx.cpp.mesh.Mesh, x: numpy.ndarray[numpy.float64], fn: object, value_size: int) None

Bases: pybind11_builtins.pybind11_object

An Expression

eval(self: dolfinx.cpp.fem.Expression, arg0: numpy.ndarray[numpy.int32], arg1: numpy.ndarray[numpy.float64]) None
property mesh
property num_points
property value_size
property x
class dolfinx.cpp.fem.FiniteElement(self: dolfinx.cpp.fem.FiniteElement, arg0: int) None

Bases: pybind11_builtins.pybind11_object

Finite element object

apply_dof_transformation(self: dolfinx.cpp.fem.FiniteElement, arg0: numpy.ndarray[numpy.float64], arg1: int, arg2: int) None
property interpolation_ident
interpolation_points(self: dolfinx.cpp.fem.FiniteElement) numpy.ndarray[numpy.float64]
property needs_dof_transformations
num_sub_elements(self: dolfinx.cpp.fem.FiniteElement) int
signature(self: dolfinx.cpp.fem.FiniteElement) str
space_dimension(self: dolfinx.cpp.fem.FiniteElement) int
value_dimension(self: dolfinx.cpp.fem.FiniteElement, arg0: int) int
property value_rank
class dolfinx.cpp.fem.Form(self: dolfinx.cpp.fem.Form, spaces: List[dolfinx::fem::FunctionSpace], integrals: Dict[dolfinx.cpp.fem.IntegralType, Tuple[List[Tuple[int, object]], dolfinx.cpp.mesh.MeshTags_int32]], coefficients: List[dolfinx::fem::Function<double>], constants: List[dolfinx::fem::Constant<double>], need_permutation_data: bool, mesh: dolfinx.cpp.mesh.Mesh = None) None

Bases: pybind11_builtins.pybind11_object

Variational form object

property coefficients
domains(self: dolfinx.cpp.fem.Form, arg0: dolfinx.cpp.fem.IntegralType, arg1: int) numpy.ndarray[numpy.int32]
property function_spaces
integral_ids(self: dolfinx.cpp.fem.Form, arg0: dolfinx.cpp.fem.IntegralType) List[int]
property mesh
property needs_facet_permutations
property rank
class dolfinx.cpp.fem.Function(*args, **kwargs)

Bases: pybind11_builtins.pybind11_object

A finite element function

Overloaded function.

  1. __init__(self: dolfinx.cpp.fem.Function, arg0: dolfinx::fem::FunctionSpace) -> None

Create a function on the given function space

  1. __init__(self: dolfinx.cpp.fem.Function, arg0: dolfinx::fem::FunctionSpace, arg1: dolfinx::la::Vector<double, std::allocator<double> >) -> None

collapse(self: dolfinx.cpp.fem.Function) dolfinx.cpp.fem.Function

Collapse sub-function view

compute_point_values(self: dolfinx.cpp.fem.Function) numpy.ndarray[numpy.float64]

Compute values at all mesh points

eval(self: dolfinx.cpp.fem.Function, x: numpy.ndarray[numpy.float64], cells: numpy.ndarray[numpy.int32], values: numpy.ndarray[numpy.float64]) None

Evaluate Function

property function_space
property id
interpolate(*args, **kwargs)

Overloaded function.

  1. interpolate(self: dolfinx.cpp.fem.Function, f: Callable[[numpy.ndarray[numpy.float64]], numpy.ndarray[numpy.float64]]) -> None

Interpolate an expression

  1. interpolate(self: dolfinx.cpp.fem.Function, u: dolfinx.cpp.fem.Function) -> None

Interpolate a finite element function

interpolate_ptr(self: dolfinx.cpp.fem.Function, arg0: int) None

Interpolate using a pointer to an expression with a C signature

property name
sub(self: dolfinx.cpp.fem.Function, arg0: int) dolfinx.cpp.fem.Function

Return sub-function (view into parent Function

property vector

Return the PETSc vector associated with the finite element Function

property x

Return the vector associated with the finite element Function

class dolfinx.cpp.fem.FunctionSpace(self: dolfinx.cpp.fem.FunctionSpace, arg0: dolfinx.cpp.mesh.Mesh, arg1: dolfinx.cpp.fem.FiniteElement, arg2: dolfinx.cpp.fem.DofMap) None

Bases: pybind11_builtins.pybind11_object

collapse(self: dolfinx.cpp.fem.FunctionSpace) Tuple[dolfinx.cpp.fem.FunctionSpace, List[int]]
component(self: dolfinx.cpp.fem.FunctionSpace) List[int]
contains(self: dolfinx.cpp.fem.FunctionSpace, arg0: dolfinx.cpp.fem.FunctionSpace) bool
property dofmap
property element
property id
property mesh
sub(self: dolfinx.cpp.fem.FunctionSpace, arg0: List[int]) dolfinx.cpp.fem.FunctionSpace
tabulate_dof_coordinates(self: dolfinx.cpp.fem.FunctionSpace) numpy.ndarray[numpy.float64]
class dolfinx.cpp.fem.IntegralType(self: dolfinx.cpp.fem.IntegralType, value: int) None

Bases: pybind11_builtins.pybind11_object

Members:

cell

exterior_facet

interior_facet

vertex

cell = <IntegralType.cell: 0>
exterior_facet = <IntegralType.exterior_facet: 1>
interior_facet = <IntegralType.interior_facet: 2>
property name
property value
vertex = <IntegralType.vertex: 3>
dolfinx.cpp.fem.apply_lifting(arg0: numpy.ndarray[numpy.float64], arg1: List[dolfinx::fem::Form<double>], arg2: List[List[dolfinx.cpp.fem.DirichletBC]], arg3: List[numpy.ndarray[numpy.float64]], arg4: float) None

Modify vector for lifted boundary conditions

dolfinx.cpp.fem.assemble_matrix(arg0: Callable[[numpy.ndarray[numpy.int32], numpy.ndarray[numpy.int32], numpy.ndarray[numpy.float64]], int], arg1: dolfinx::fem::Form<double>, arg2: List[dolfinx.cpp.fem.DirichletBC]) None

Experimental assembly with Python insertion function. This will be slow. Testing use only.

dolfinx.cpp.fem.assemble_matrix_petsc(*args, **kwargs)

Overloaded function.

  1. assemble_matrix_petsc(arg0: mat, arg1: dolfinx::fem::Form<double>, arg2: List[dolfinx.cpp.fem.DirichletBC]) -> None

  2. assemble_matrix_petsc(arg0: mat, arg1: dolfinx::fem::Form<double>, arg2: List[bool], arg3: List[bool]) -> None

dolfinx.cpp.fem.assemble_matrix_petsc_unrolled(*args, **kwargs)

Overloaded function.

  1. assemble_matrix_petsc_unrolled(arg0: mat, arg1: dolfinx::fem::Form<double>, arg2: List[dolfinx.cpp.fem.DirichletBC]) -> None

  2. assemble_matrix_petsc_unrolled(arg0: mat, arg1: dolfinx::fem::Form<double>, arg2: List[bool], arg3: List[bool]) -> None

dolfinx.cpp.fem.assemble_scalar(arg0: dolfinx::fem::Form<double>) float

Assemble functional over mesh

dolfinx.cpp.fem.assemble_vector(b: numpy.ndarray[numpy.float64], L: dolfinx::fem::Form<double>) None

Assemble linear form into an existing vector

dolfinx.cpp.fem.bcs_cols(arg0: List[List[dolfinx::fem::Form<double>]], arg1: List[dolfinx.cpp.fem.DirichletBC]) List[List[List[dolfinx.cpp.fem.DirichletBC]]]
dolfinx.cpp.fem.bcs_rows(arg0: List[dolfinx::fem::Form<double>], arg1: List[dolfinx.cpp.fem.DirichletBC]) List[List[dolfinx.cpp.fem.DirichletBC]]
dolfinx.cpp.fem.build_dofmap(arg0: MPICommWrapper, arg1: dolfinx.cpp.mesh.Topology, arg2: dolfinx::fem::ElementDofLayout) Tuple[dolfinx.cpp.common.IndexMap, int, dolfinx.cpp.graph.AdjacencyList_int32]

Build and dofmap on a mesh.

dolfinx.cpp.fem.create_discrete_gradient(arg0: dolfinx::fem::FunctionSpace, arg1: dolfinx::fem::FunctionSpace) mat
dolfinx.cpp.fem.create_dofmap(arg0: MPICommWrapper, arg1: int, arg2: dolfinx.cpp.mesh.Topology, arg3: dolfinx::fem::FiniteElement) dolfinx::fem::DofMap

Create DofMap object from a pointer to ufc_dofmap.

dolfinx.cpp.fem.create_element_dof_layout(arg0: int, arg1: dolfinx.cpp.mesh.CellType, arg2: List[int]) dolfinx::fem::ElementDofLayout

Create ElementDofLayout object from a ufc dofmap.

dolfinx.cpp.fem.create_form(arg0: int, arg1: List[dolfinx::fem::FunctionSpace], arg2: List[dolfinx::fem::Function<double>], arg3: List[dolfinx::fem::Constant<double>], arg4: Dict[dolfinx::fem::IntegralType, dolfinx.cpp.mesh.MeshTags_int32], arg5: dolfinx.cpp.mesh.Mesh) dolfinx::fem::Form<double>

Create Form from a pointer to ufc_form.

dolfinx.cpp.fem.create_matrix(a: dolfinx::fem::Form<double>, type: str = '') mat

Create a PETSc Mat for bilinear form.

dolfinx.cpp.fem.create_matrix_block(a: List[List[dolfinx::fem::Form<double>]], type: str = '') mat

Create monolithic sparse matrix for stacked bilinear forms.

dolfinx.cpp.fem.create_matrix_nest(a: List[List[dolfinx::fem::Form<double>]], types: List[List[str]] = []) mat

Create nested sparse matrix for bilinear forms.

dolfinx.cpp.fem.create_sparsity_pattern(arg0: dolfinx::fem::Form<double>) dolfinx::la::SparsityPattern

Create a sparsity pattern for bilinear form.

dolfinx.cpp.fem.create_vector_block(arg0: List[Tuple[dolfinx.cpp.common.IndexMap, int]]) vec

Create a monolithic vector for multiple (stacked) linear forms.

dolfinx.cpp.fem.create_vector_nest(arg0: List[Tuple[dolfinx.cpp.common.IndexMap, int]]) vec

Create nested vector for multiple (stacked) linear forms.

dolfinx.cpp.fem.insert_diagonal(arg0: mat, arg1: dolfinx::fem::FunctionSpace, arg2: List[dolfinx.cpp.fem.DirichletBC], arg3: float) None
dolfinx.cpp.fem.locate_dofs_geometrical(*args, **kwargs)

Overloaded function.

  1. locate_dofs_geometrical(V: List[dolfinx::fem::FunctionSpace], marker: Callable[[numpy.ndarray[numpy.float64]], numpy.ndarray[bool]]) -> List[numpy.ndarray[2]]

  2. locate_dofs_geometrical(V: dolfinx::fem::FunctionSpace, marker: Callable[[numpy.ndarray[numpy.float64]], numpy.ndarray[bool]]) -> numpy.ndarray[numpy.int32]

dolfinx.cpp.fem.locate_dofs_topological(*args, **kwargs)

Overloaded function.

  1. locate_dofs_topological(V: List[dolfinx::fem::FunctionSpace], dim: int, entities: numpy.ndarray[numpy.int32], remote: bool = True) -> List[numpy.ndarray[2]]

  2. locate_dofs_topological(V: dolfinx::fem::FunctionSpace, dim: int, entities: numpy.ndarray[numpy.int32], remote: bool = True) -> numpy.ndarray[numpy.int32]

dolfinx.cpp.fem.pack_coefficients(*args, **kwargs)

Overloaded function.

  1. pack_coefficients(arg0: dolfinx::fem::Form<double>) -> numpy.ndarray[numpy.float64]

Pack coefficients for a Form.

  1. pack_coefficients(arg0: dolfinx::fem::Expression<double>) -> numpy.ndarray[numpy.float64]

Pack coefficients for an Expression.

dolfinx.cpp.fem.pack_constants(*args, **kwargs)

Overloaded function.

  1. pack_constants(arg0: dolfinx::fem::Form<double>) -> numpy.ndarray[numpy.float64]

Pack constants for a Form.

  1. pack_constants(arg0: dolfinx::fem::Expression<double>) -> numpy.ndarray[numpy.float64]

Pack constants for an Expression.

dolfinx.cpp.fem.set_bc(b: numpy.ndarray[numpy.float64], bcs: List[dolfinx.cpp.fem.DirichletBC], x0: numpy.ndarray[numpy.float64] = None, scale: float = 1.0) None
dolfinx.cpp.fem.transpose_dofmap(arg0: dolfinx.cpp.graph.AdjacencyList_int32, arg1: int) dolfinx.cpp.graph.AdjacencyList_int32

Build the index to (cell, local index) map from a dofmap ((cell, local index ) -> index).