dolfin/fem

Documentation for C++ code found in dolfin/fem/*.h

Type definitions

TensorProductForm

C++ documentation for TensorProductForm from dolfin/fem/LinearTimeDependentProblem.h:

type dolfin::TensorProductForm

FIXME: Temporary fix.

Functions

assemble

C++ documentation for assemble from dolfin/fem/assemble.h:

void dolfin::assemble(GenericTensor &A, const Form &a)

Assemble tensor.

Parameters:
  • A
  • a

C++ documentation for assemble from dolfin/fem/assemble.h:

double dolfin::assemble(const Form &a)

Assemble scalar.

Parameters:a

assemble_local

C++ documentation for assemble_local from dolfin/fem/assemble_local.h:

void dolfin::assemble_local(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> &A_e, const Form &a, const Cell &cell)

Assemble form to local tensor on a cell (Eigen version for pybind11)

Parameters:
  • A_e
  • a
  • cell

C++ documentation for assemble_local from dolfin/fem/assemble_local.h:

void dolfin::assemble_local(const Form &a, const Cell &cell, std::vector<double> &tensor)

Assemble form to local tensor on a cell (Legacy version for SWIG)

Parameters:
  • a
  • cell
  • tensor

assemble_multimesh

C++ documentation for assemble_multimesh from dolfin/fem/assemble.h:

void dolfin::assemble_multimesh(GenericTensor &A, const MultiMeshForm &a)

Assemble tensor from multimesh form.

Parameters:
  • A
  • a

C++ documentation for assemble_multimesh from dolfin/fem/assemble.h:

double dolfin::assemble_multimesh(const MultiMeshForm &a)

Assemble scalar from multimesh form.

Parameters:a

assemble_system

C++ documentation for assemble_system from dolfin/fem/assemble.h:

void dolfin::assemble_system(GenericMatrix &A, GenericVector &b, const Form &a, const Form &L, std::vector<std::shared_ptr<const DirichletBC>> bcs)

Assemble system (A, b) and apply Dirichlet boundary conditions.

Parameters:
  • A
  • b
  • a
  • L
  • bcs

C++ documentation for assemble_system from dolfin/fem/assemble.h:

void dolfin::assemble_system(GenericMatrix &A, GenericVector &b, const Form &a, const Form &L, std::vector<std::shared_ptr<const DirichletBC>> bcs, const GenericVector &x0)

Assemble system (A, b) on sub domains and apply Dirichlet boundary conditions

Parameters:
  • A
  • b
  • a
  • L
  • bcs
  • x0

create_mesh

C++ documentation for create_mesh from dolfin/fem/fem_utils.h:

Mesh dolfin::create_mesh(Function &coordinates)

Creates mesh from coordinate function Topology is given by underlying mesh of the function space and geometry is given by function values. Hence resulting mesh geometry has a degree of the function space degree. Geometry of function mesh is ignored. Mesh connectivities d-0, d-1, ..., d-r are built on function mesh (where d is topological dimension of the mesh and r is maximal dimension of entity associated with any coordinate node). Consider clearing unneeded connectivities when finished.

Parameters:coordinates – (Function ) Vector Lagrange function of any degree
Returns:Mesh The mesh

dof_to_vertex_map

C++ documentation for dof_to_vertex_map from dolfin/fem/fem_utils.h:

std::vector<std::size_t> dolfin::dof_to_vertex_map(const FunctionSpace &space)

Return a map between dof indices and vertex indices Only works for FunctionSpace with dofs exclusively on vertices. For mixed FunctionSpaces vertex index is offset with the number of dofs per vertex. In parallel the returned map maps both owned and unowned dofs (using local indices) thus covering all the vertices. Hence the returned map is an inversion of vertex_to_dof_map.

Parameters:space – (FunctionSpace ) The FunctionSpace for what the dof to vertex map should be computed for
Returns:std::vector<std::size_t> The dof to vertex map

get_coordinates

C++ documentation for get_coordinates from dolfin/fem/fem_utils.h:

void dolfin::get_coordinates(Function &position, const MeshGeometry &geometry)

Stores mesh coordinates into function Mesh connectivities d-0, d-1, ..., d-r are built on function mesh (where d is topological dimension of the mesh and r is maximal dimension of entity associated with any coordinate node). Consider clearing unneeded connectivities when finished.

Parameters:

set_coordinates

C++ documentation for set_coordinates from dolfin/fem/fem_utils.h:

void dolfin::set_coordinates(MeshGeometry &geometry, const Function &position)

Sets mesh coordinates from function Mesh connectivities d-0, d-1, ..., d-r are built on function mesh (where d is topological dimension of the mesh and r is maximal dimension of entity associated with any coordinate node). Consider clearing unneeded connectivities when finished.

Parameters:

solve

C++ documentation for solve from dolfin/fem/solve.h:

void dolfin::solve(const Equation &equation, Function &u, Parameters parameters = empty_parameters)

Solve linear variational problem a(u, v) == L(v) or nonlinear variational problem F(u; v) = 0 without boundary conditions. Optional parameters can be passed to the LinearVariationalSolver or NonlinearVariationalSolver classes.

Parameters:
  • equation
  • u
  • parameters

C++ documentation for solve from dolfin/fem/solve.h:

void dolfin::solve(const Equation &equation, Function &u, const DirichletBC &bc, Parameters parameters = empty_parameters)

Solve linear variational problem a(u, v) == L(v) or nonlinear variational problem F(u; v) = 0 with a single boundary condition. Optional parameters can be passed to the LinearVariationalSolver or NonlinearVariationalSolver classes.

Parameters:
  • equation
  • u
  • bc
  • parameters

C++ documentation for solve from dolfin/fem/solve.h:

void dolfin::solve(const Equation &equation, Function &u, const DirichletBC &bc, const Form &J, Parameters parameters = empty_parameters)

Solve nonlinear variational problem F(u; v) == 0 with a single boundary condition. The argument J should provide the Jacobian bilinear form J = dF/du. Optional parameters can be passed to the LinearVariationalSolver or NonlinearVariationalSolver classes.

Parameters:
  • equation
  • u
  • bc
  • J
  • parameters

C++ documentation for solve from dolfin/fem/solve.h:

void dolfin::solve(const Equation &equation, Function &u, const Form &J, Parameters parameters = empty_parameters)

Solve nonlinear variational problem F(u; v) == 0 without boundary conditions. The argument J should provide the Jacobian bilinear form J = dF/du. Optional parameters can be passed to the LinearVariationalSolver or NonlinearVariationalSolver classes.

Parameters:
  • equation
  • u
  • J
  • parameters

C++ documentation for solve from dolfin/fem/solve.h:

void dolfin::solve(const Equation &equation, Function &u, std::vector<const DirichletBC *> bcs, Parameters parameters = empty_parameters)

Solve linear variational problem a(u, v) == L(v) or nonlinear variational problem F(u; v) = 0 with a list of boundary conditions. Optional parameters can be passed to the LinearVariationalSolver or NonlinearVariationalSolver classes.

Parameters:
  • equation
  • u
  • bcs
  • parameters

C++ documentation for solve from dolfin/fem/solve.h:

void dolfin::solve(const Equation &equation, Function &u, std::vector<const DirichletBC *> bcs, const Form &J, Parameters parameters = empty_parameters)

Solve nonlinear variational problem F(u; v) == 0 with a list of boundary conditions. The argument J should provide the Jacobian bilinear form J = dF/du. Optional parameters can be passed to the LinearVariationalSolver or NonlinearVariationalSolver classes.

Parameters:
  • equation
  • u
  • bcs
  • J
  • parameters

vertex_to_dof_map

C++ documentation for vertex_to_dof_map from dolfin/fem/fem_utils.h:

std::vector<dolfin::la_index> dolfin::vertex_to_dof_map(const FunctionSpace &space)

Return a map between vertex indices and dof indices Only works for FunctionSpace with dofs exclusively on vertices. For mixed FunctionSpaces dof index is offset with the number of dofs per vertex.

Parameters:space – (FunctionSpace ) The FunctionSpace for what the vertex to dof map should be computed for
Returns:std::vector<dolfin::la_index> The vertex to dof map

Classes

Assembler

C++ documentation for Assembler from dolfin/fem/Assembler.h:

class dolfin::Assembler

This class provides automated assembly of linear systems, or more generally, assembly of a sparse tensor from a given variational form. Subdomains for cells and facets may be specified by assigning subdomain indicators specified by MeshFunction to the Form being assembled:

form.dx = cell_domains
form.ds = exterior_facet_domains
form.dS = interior_facet_domains
dolfin::Assembler::Assembler()

Constructor.

void dolfin::Assembler::assemble(GenericTensor &A, const Form &a)

Assemble tensor from given form

Parameters:
  • A – (GenericTensor ) The tensor to assemble. [direction=out]
  • a – (Form &) The form to assemble the tensor from. [direction=in]
void dolfin::Assembler::assemble_cells(GenericTensor &A, const Form &a, UFC &ufc, std::shared_ptr<const MeshFunction<std::size_t>> domains, std::vector<double> *values)

Assemble tensor from given form over cells. This function is provided for users who wish to build a customized assembler.

Parameters:
  • A – (GenericTensor &) The tensor to assemble. [direction=out]
  • a – (Form &) The form to assemble the tensor from. [direction=in]
  • ufc – (UFC &) [direction=in]
  • domains – (MeshFunction<std::size_t>) [direction=in]
  • values – (std::vector<double>*) [direction=in]
void dolfin::Assembler::assemble_exterior_facets(GenericTensor &A, const Form &a, UFC &ufc, std::shared_ptr<const MeshFunction<std::size_t>> domains, std::vector<double> *values)

Assemble tensor from given form over exterior facets. This function is provided for users who wish to build a customized assembler.

Parameters:
  • A – (GenericTensor ) The tensor to assemble. [direction=out]
  • a – (Form ) The form to assemble the tensor from. [direction=in]
  • ufc – (UFC ) [direction=in]
  • domains – (MeshFunction ) [direction=in]
  • values – (std::vector<double>*) [direction=in]
void dolfin::Assembler::assemble_interior_facets(GenericTensor &A, const Form &a, UFC &ufc, std::shared_ptr<const MeshFunction<std::size_t>> domains, std::shared_ptr<const MeshFunction<std::size_t>> cell_domains, std::vector<double> *values)

Assemble tensor from given form over interior facets. This function is provided for users who wish to build a customized assembler.

Parameters:
  • A – (GenericTensor ) The tensor to assemble. [direction=out]
  • a – (Form ) The form to assemble the tensor from. [direction=in]
  • ufc – (UFC ) [direction=in]
  • domains – (MeshFunction<std::size_t>) [direction=in]
  • cell_domains – (MeshFunction<std::size_t>) [direction=in]
  • values – (std::vector<double>*) [direction=in]
void dolfin::Assembler::assemble_vertices(GenericTensor &A, const Form &a, UFC &ufc, std::shared_ptr<const MeshFunction<std::size_t>> domains)

Assemble tensor from given form over vertices. This function is provided for users who wish to build a customized assembler.

Parameters:
  • A – (GenericTersn) The tensor to assemble. [direction=out]
  • a – (Form ) The form to assemble the tensor from. [direction=in]
  • ufc – (UFC ) [direction=in]
  • domains – (MeshFunction ) [direction=in]

AssemblerBase

C++ documentation for AssemblerBase from dolfin/fem/AssemblerBase.h:

class dolfin::AssemblerBase

Provide some common functions used in assembler classes.

dolfin::AssemblerBase::AssemblerBase()

Constructor.

bool dolfin::AssemblerBase::add_values

add_values (bool) Default value is false. This controls whether values are added to the given tensor or if it is zeroed prior to assembly.

void dolfin::AssemblerBase::check(const Form &a)

Check form.

Parameters:a
bool dolfin::AssemblerBase::finalize_tensor

finalize_tensor (bool) Default value is true. This controls whether the assembler finalizes the given tensor after assembly is completed by calling A.apply().

void dolfin::AssemblerBase::init_global_tensor(GenericTensor &A, const Form &a)

Initialize global tensor

Parameters:
bool dolfin::AssemblerBase::keep_diagonal

keep_diagonal (bool) Default value is false. This controls whether the assembler enures that a diagonal entry exists in an assembled matrix. It may be removed if the matrix is finalised.

std::string dolfin::AssemblerBase::progress_message(std::size_t rank, std::string integral_type)

Pretty-printing for progress bar.

Parameters:
  • rank
  • integral_type

BasisFunction

C++ documentation for BasisFunction from dolfin/fem/BasisFunction.h:

class dolfin::BasisFunction

Represention of a finite element basis function. It can be used for computation of basis function values and derivatives. Evaluation of basis functions is also possible through the use of the functions evaluate_basis and evaluate_basis_derivatives available in the FiniteElement class. The BasisFunction class relies on these functions for evaluation but also implements the ufc::function interface which allows evaluate_dof to be evaluated for a basis function (on a possibly different element).

dolfin::BasisFunction::BasisFunction(std::size_t index, std::shared_ptr<const FiniteElement> element, const std::vector<double> &coordinate_dofs)

Create basis function with given index on element on given cell

Parameters:
  • index – (std::size_t) The index of the basis function.
  • element – (FiniteElement ) The element to create basis function on.
  • coordinate_dofs – (std::vector<double>&) The coordinate dofs of the cell
void dolfin::BasisFunction::eval(double *values, const double *x) const

Evaluate basis function at given point

Parameters:
  • values – (double) The values of the function at the point.
  • x – (double) The coordinates of the point.
void dolfin::BasisFunction::eval_derivatives(double *values, const double *x, std::size_t n) const

Evaluate all order n derivatives at given point

Parameters:
  • values – (double) The values of derivatives at the point.
  • x – (double) The coordinates of the point.
  • n – (std::size_t) The order of derivation.
void dolfin::BasisFunction::evaluate(double *values, const double *coordinates, const ufc::cell &cell) const

Evaluate function at given point in cell

Parameters:
  • values – (double) The values of the function at the point..
  • coordinates – (double) The coordinates of the point.
  • cell – (ufc::cell ) The cell.
void dolfin::BasisFunction::update_index(std::size_t index)

Update the basis function index

Parameters:index – (std::size_t) The index of the basis function.
dolfin::BasisFunction::~BasisFunction()

Destructor.

DirichletBC

C++ documentation for DirichletBC from dolfin/fem/DirichletBC.h:

class dolfin::DirichletBC

Interface for setting (strong) Dirichlet boundary conditions. u = g on G, where u is the solution to be computed, g is a function and G is a sub domain of the mesh. A DirichletBC is specified by the function g, the function space (trial space) and boundary indicators on (a subset of) the mesh boundary. The boundary indicators may be specified in a number of different ways. The simplest approach is to specify the boundary by a SubDomain object, using the inside() function to specify on which facets the boundary conditions should be applied. The boundary facets will then be searched for and marked only on the first call to apply. This means that the mesh could be moved after the first apply and the boundary markers would still remain intact. Alternatively, the boundary may be specified by a MeshFunction over facets labeling all mesh facets together with a number that specifies which facets should be included in the boundary. The third option is to attach the boundary information to the mesh. This is handled automatically when exporting a mesh from for example VMTK. The ‘method’ variable may be used to specify the type of method used to identify degrees of freedom on the boundary. Available methods are: topological approach (default), geometric approach, and pointwise approach. The topological approach is faster, but will only identify degrees of freedom that are located on a facet that is entirely on the boundary. In particular, the topological approach will not identify degrees of freedom for discontinuous elements (which are all internal to the cell). A remedy for this is to use the geometric approach. In the geometric approach, each dof on each facet that matches the boundary condition will be checked. To apply pointwise boundary conditions e.g. pointloads, one will have to use the pointwise approach. The three possibilities are “topological”, “geometric” and “pointwise”. Note: when using “pointwise”, the boolean argument on_boundary in SubDomain::inside will always be false. The ‘check_midpoint’ variable can be used to decide whether or not the midpoint of each facet should be checked when a user-defined SubDomain is used to define the domain of the boundary condition. By default, midpoints are always checked. Note that this variable may be of importance close to corners, in which case it is sometimes important to check the midpoint to avoid including facets “on the diagonal close” to a corner. This variable is also of importance for curved boundaries (like on a sphere or cylinder), in which case it is important not to check the midpoint which will be located in the interior of a domain defined relative to a radius. Note that there may be caching employed in BC computation for performance reasons. In particular, applicable DOFs are cached by some methods on a first apply . This means that changing a supplied object (defining boundary subdomain) after first use may have no effect. But this is implementation and method specific.

dolfin::DirichletBC::DirichletBC(const DirichletBC &bc)

Copy constructor. Either cached DOF data are copied.

Parameters:bc – (DirichletBC() &) The object to be copied. [direction=in]
dolfin::DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V, std::shared_ptr<const GenericFunction> g, const std::vector<std::size_t> &markers, std::string method = "topological")

Create boundary condition for subdomain by boundary markers (cells, local facet numbers)

Parameters:
  • V – (FunctionSpace ) The function space. [direction=in]
  • g – (GenericFunction ) The value. [direction=in]
  • markers – (std::vector<std:size_t>&) Subdomain markers (facet index local to process) [direction=in]
  • method – (std::string) Optional argument: A string specifying the method to identify dofs. [direction=in]
dolfin::DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V, std::shared_ptr<const GenericFunction> g, std::shared_ptr<const MeshFunction<std::size_t>> sub_domains, std::size_t sub_domain, std::string method = "topological")

Create boundary condition for subdomain specified by index

Parameters:
  • V – (FunctionSpace ) The function space. [direction=in]
  • g – (GenericFunction ) The value. [direction=in]
  • sub_domains – (MeshFnunction<std::size_t>) Subdomain markers [direction=in]
  • sub_domain – (std::size_t) The subdomain index (number) [direction=in]
  • method – (std::string) Optional argument: A string specifying the method to identify dofs. [direction=in]
dolfin::DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V, std::shared_ptr<const GenericFunction> g, std::shared_ptr<const SubDomain> sub_domain, std::string method = "topological", bool check_midpoint = true)

Create boundary condition for subdomain

Parameters:
  • V – (FunctionSpace ) The function space [direction=in]
  • g – (GenericFunction ) The value [direction=in]
  • sub_domain – (SubDomain ) The subdomain [direction=in]
  • method – (std::string) Optional argument: A string specifying the method to identify dofs [direction=in]
  • check_midpoint – (bool) [direction=in]
dolfin::DirichletBC::DirichletBC(std::shared_ptr<const FunctionSpace> V, std::shared_ptr<const GenericFunction> g, std::size_t sub_domain, std::string method = "topological")

Create boundary condition for boundary data included in the mesh

Parameters:
  • V – (FunctionSpace ) The function space. [direction=in]
  • g – (GenericFunction ) The value. [direction=in]
  • sub_domain – (std::size_t) The subdomain index (number) [direction=in]
  • method – (std::string) Optional argument: A string specifying the method to identify dofs. [direction=in]
type dolfin::DirichletBC::Map

map type used by DirichletBC

void dolfin::DirichletBC::apply(GenericMatrix &A) const

Apply boundary condition to a matrix

Parameters:A – (GenericMatrix ) The matrix to apply boundary condition to. [direction=inout]
void dolfin::DirichletBC::apply(GenericMatrix &A, GenericVector &b) const

Apply boundary condition to a linear system

Parameters:
  • A – (GenericMatrix ) The matrix to apply boundary condition to. [direction=inout]
  • b – (GenericVector ) The vector to apply boundary condition to. [direction=inout]
void dolfin::DirichletBC::apply(GenericMatrix &A, GenericVector &b, const GenericVector &x) const

Apply boundary condition to a linear system for a nonlinear problem

Parameters:
  • A – (GenericMatrix ) The matrix to apply boundary conditions to. [direction=inout]
  • b – (GenericVector ) The vector to apply boundary conditions to. [direction=inout]
  • x – (GenericVector ) Another vector (nonlinear problem). [direction=in]
void dolfin::DirichletBC::apply(GenericMatrix *A, GenericVector *b, const GenericVector *x) const
Parameters:
  • A
  • b
  • x
void dolfin::DirichletBC::apply(GenericVector &b) const

Apply boundary condition to a vector

Parameters:b – (GenericVector ) The vector to apply boundary condition to. [direction=inout]
void dolfin::DirichletBC::apply(GenericVector &b, const GenericVector &x) const

Apply boundary condition to vectors for a nonlinear problem

Parameters:
  • b – (GenericVector ) The vector to apply boundary conditions to. [direction=inout]
  • x – (GenericVector ) Another vector (nonlinear problem). [direction=in]
void dolfin::DirichletBC::check() const
void dolfin::DirichletBC::check_arguments(GenericMatrix *A, GenericVector *b, const GenericVector *x, std::size_t dim) const
Parameters:
  • A
  • b
  • x
  • dim
void dolfin::DirichletBC::compute_bc(Map &boundary_values, LocalData &data, std::string method) const
Parameters:
  • boundary_values
  • data
  • method
void dolfin::DirichletBC::compute_bc_geometric(Map &boundary_values, LocalData &data) const
Parameters:
  • boundary_values
  • data
void dolfin::DirichletBC::compute_bc_pointwise(Map &boundary_values, LocalData &data) const
Parameters:
  • boundary_values
  • data
void dolfin::DirichletBC::compute_bc_topological(Map &boundary_values, LocalData &data) const
Parameters:
  • boundary_values
  • data
std::shared_ptr<const FunctionSpace> dolfin::DirichletBC::function_space() const

Return function space V

Returns:FunctionSpace The function space to which boundary conditions are applied.
void dolfin::DirichletBC::gather(Map &boundary_values) const

Get boundary values from neighbour processes. If a method other than “pointwise” is used, this is necessary to ensure all boundary dofs are marked on all processes.

Parameters:boundary_values – (Map&) Map from dof to boundary value. [direction=inout]
void dolfin::DirichletBC::get_boundary_values(Map &boundary_values) const

Get Dirichlet dofs and values. If a method other than ‘pointwise’ is used in parallel, the map may not be complete for local vertices since a vertex can have a bc applied, but the partition might not have a facet on the boundary. To ensure all local boundary dofs are marked, it is necessary to call gather() on the returned boundary values.

Parameters:boundary_values – (Map&) Map from dof to boundary value. [direction=inout]
void dolfin::DirichletBC::homogenize()

Set value to 0.0.

void dolfin::DirichletBC::init_facets(const MPI_Comm mpi_comm) const
Parameters:mpi_comm
void dolfin::DirichletBC::init_from_mesh(std::size_t sub_domain) const
Parameters:sub_domain
void dolfin::DirichletBC::init_from_mesh_function(const MeshFunction<std::size_t> &sub_domains, std::size_t sub_domain) const
Parameters:
  • sub_domains
  • sub_domain
void dolfin::DirichletBC::init_from_sub_domain(std::shared_ptr<const SubDomain> sub_domain) const
Parameters:sub_domain
const std::vector<std::size_t> &dolfin::DirichletBC::markers() const

Return boundary markers

Returns:std::vector<std::size_t>& Boundary markers (facets stored as pairs of cells and local facet numbers).
std::string dolfin::DirichletBC::method() const

Return method used for computing Dirichlet dofs

Returns:std::string Method used for computing Dirichlet dofs (“topological”, “geometric” or “pointwise”).
const std::set<std::string> dolfin::DirichletBC::methods
bool dolfin::DirichletBC::on_facet(const double *coordinates, const Facet &facet) const
Parameters:
  • coordinates
  • facet
const DirichletBC &dolfin::DirichletBC::operator=(const DirichletBC &bc)

Assignment operator. Either cached DOF data are assigned.

Parameters:bc – (DirichletBC ) Another DirichletBC object. [direction=in]
void dolfin::DirichletBC::set_value(std::shared_ptr<const GenericFunction> g)

Set value g for boundary condition, domain remains unchanged

Parameters:g – (GenericFucntion) The value. [direction=in]
std::shared_ptr<const SubDomain> dolfin::DirichletBC::user_sub_domain() const

Return shared pointer to subdomain

Returns:SubDomain Shared pointer to subdomain.
std::shared_ptr<const GenericFunction> dolfin::DirichletBC::value() const

Return boundary value g

Returns:GenericFunction The boundary values.
void dolfin::DirichletBC::zero(GenericMatrix &A) const

Make rows of matrix associated with boundary condition zero, useful for non-diagonal matrices in a block matrix.

Parameters:A – (GenericMatrix &) The matrix [direction=inout]
void dolfin::DirichletBC::zero_columns(GenericMatrix &A, GenericVector &b, double diag_val = 0) const

Make columns of matrix associated with boundary condition zero, and update a (right-hand side) vector to reflect the changes. Useful for non-diagonals.

Parameters:
  • A – (GenericMatrix &) The matrix [direction=inout]
  • b – (GenericVector &) The vector [direction=inout]
  • diag_val – (double) This parameter would normally be -1, 0 or 1. [direction=in]
dolfin::DirichletBC::~DirichletBC()

Destructor.

LocalData

C++ documentation for LocalData from dolfin/fem/DirichletBC.h:

class dolfin::DirichletBC::LocalData
dolfin::DirichletBC::LocalData::LocalData(const FunctionSpace &V)
Parameters:V
boost::multi_array<double, 2> dolfin::DirichletBC::LocalData::coordinates
std::vector<std::size_t> dolfin::DirichletBC::LocalData::facet_dofs
std::vector<double> dolfin::DirichletBC::LocalData::w

DiscreteOperators

C++ documentation for DiscreteOperators from dolfin/fem/DiscreteOperators.h:

class dolfin::DiscreteOperators

Discrete gradient operators providing derivatives of functions. This class computes discrete gradient operators (matrices) that map derivatives of finite element functions into other finite element spaces. An example of where discrete gradient operators are required is the creation of algebraic multigrid solvers for H(curl) and H(div) problems. NOTE: This class is highly experimental and likely to change. It will eventually be expanded to provide the discrete curl and divergence.

std::shared_ptr<GenericMatrix> dolfin::DiscreteOperators::build_gradient(const FunctionSpace &V0, const FunctionSpace &V1)

Build the discrete gradient operator A that takes a \(w \in H^1\) (P1, nodal Lagrange ) to \(v \in H(curl)\) (lowest order Nedelec), i.e. v = Aw. V0 is the H(curl) space, and V1 is the P1 Lagrange space.

Parameters:
Returns:

GenericMatrix

DofMap

C++ documentation for DofMap from dolfin/fem/DofMap.h:

class dolfin::DofMap : public dolfin::GenericDofMap

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.

Friends: DofMapBuilder, MultiMeshDofMap.

dolfin::DofMap::DofMap(const DofMap &dofmap)
Parameters:dofmap
dolfin::DofMap::DofMap(const DofMap &parent_dofmap, const std::vector<std::size_t> &component, const Mesh &mesh)
Parameters:
  • parent_dofmap
  • component
  • mesh
dolfin::DofMap::DofMap(std::shared_ptr<const ufc::dofmap> ufc_dofmap, const Mesh &mesh)

Create dof map on mesh (mesh is not stored)

Parameters:
dolfin::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:
  • ufc_dofmap – (ufc::dofmap ) The ufc::dofmap . [direction=in]
  • mesh – (Mesh ) The mesh. [direction=in]
  • constrained_domain – (SubDomain ) The subdomain marking the constrained (tied) boundaries. [direction=in]
dolfin::DofMap::DofMap(std::unordered_map<std::size_t, std::size_t> &collapsed_map, const DofMap &dofmap_view, const Mesh &mesh)
Parameters:
  • collapsed_map
  • dofmap_view
  • mesh
int dolfin::DofMap::block_size() const

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

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

Local-to-global mapping of dofs on a cell

Parameters:cell_index – (std::size_t) The cell index.
Returns:ArrayView<const dolfin::la_index>
void dolfin::DofMap::check_dimensional_consistency(const ufc::dofmap &dofmap, const Mesh &mesh)
Parameters:
  • dofmap
  • mesh
void dolfin::DofMap::check_provided_entities(const ufc::dofmap &dofmap, const Mesh &mesh)
Parameters:
  • dofmap
  • mesh
void dolfin::DofMap::clear_sub_map_data()

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

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

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.

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

Create a copy of the dof map

Returns:DofMap The Dofmap copy.
std::shared_ptr<GenericDofMap> dolfin::DofMap::create(const Mesh &new_mesh) const

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.
std::vector<dolfin::la_index> dolfin::DofMap::dofs() const

Return list of global dof indices on this process.

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

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

Parameters:
  • mesh
  • dim
std::vector<dolfin::la_index> dolfin::DofMap::entity_closure_dofs(const Mesh &mesh, std::size_t entity_dim) const

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.

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

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.

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

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.

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

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.

Parameters:
  • mesh
  • entity_dim
  • entity_indices
std::shared_ptr<GenericDofMap> dolfin::DofMap::extract_sub_dofmap(const std::vector<std::size_t> &component, const Mesh &mesh) const

Extract subdofmap component

Parameters:
  • component – (std::vector<std::size_t>) The component.
  • mesh – (Mesh ) The mesh.
Returns:

DofMap The subdofmap component.

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

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.

std::shared_ptr<const IndexMap> dolfin::DofMap::index_map() const

Return the map (const access)

bool dolfin::DofMap::is_view() const

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

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

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.
const std::vector<std::size_t> &dolfin::DofMap::local_to_global_unowned() const

Return indices of dofs which are owned by other processes.

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

Return the maximum dimension of the local finite element function space

Returns:std::size_t Maximum dimension of the local finite element function space.
const std::set<int> &dolfin::DofMap::neighbours() const

Return set of processes that share dofs with this process

Returns:std::set<int> The set of processes
std::size_t dolfin::DofMap::num_element_dofs(std::size_t cell_index) const

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.
std::size_t dolfin::DofMap::num_entity_closure_dofs(std::size_t entity_dim) const

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

Parameters:entity_dim
std::size_t dolfin::DofMap::num_entity_dofs(std::size_t entity_dim) const

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
std::size_t dolfin::DofMap::num_facet_dofs() const

Return number of facet dofs

Returns:std::size_t The number of facet dofs.
const std::vector<int> &dolfin::DofMap::off_process_owner() const

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.
std::pair<std::size_t, std::size_t> dolfin::DofMap::ownership_range() const

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.
void dolfin::DofMap::set(GenericVector &x, double value) const

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.
const std::unordered_map<int, std::vector<int>> &dolfin::DofMap::shared_nodes() const

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
std::string dolfin::DofMap::str(bool verbose) const

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.
void dolfin::DofMap::tabulate_entity_closure_dofs(std::vector<std::size_t> &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const

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.
void dolfin::DofMap::tabulate_entity_dofs(std::vector<std::size_t> &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const

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.
void dolfin::DofMap::tabulate_facet_dofs(std::vector<std::size_t> &element_dofs, std::size_t cell_facet_index) const

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.
void dolfin::DofMap::tabulate_global_dofs(std::vector<std::size_t> &element_dofs) const

Tabulate globally supported dofs

Parameters:element_dofs – (std::size_t) Degrees of freedom.
void dolfin::DofMap::tabulate_local_to_global_dofs(std::vector<std::size_t> &local_to_global_map) const

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.
dolfin::DofMap::~DofMap()

Destructor.

DofMapBuilder

C++ documentation for DofMapBuilder from dolfin/fem/DofMapBuilder.h:

class dolfin::DofMapBuilder

Builds a DofMap on a Mesh .

void dolfin::DofMapBuilder::build(DofMap &dofmap, const Mesh &dolfin_mesh, std::shared_ptr<const SubDomain> constrained_domain)

Build dofmap. The constrained domain may be a null pointer, in which case it is ignored.

Parameters:
  • dofmap – [direction=out]
  • dolfin_mesh – [direction=in]
  • constrained_domain – [direction=in]
std::size_t dolfin::DofMapBuilder::build_constrained_vertex_indices(const Mesh &mesh, const std::map<unsigned int, std::pair<unsigned int, unsigned int>> &slave_to_master_vertices, std::vector<std::int64_t> &modified_vertex_indices_global)
Parameters:
  • mesh
  • slave_to_master_vertices
  • modified_vertex_indices_global
void dolfin::DofMapBuilder::build_dofmap(std::vector<std::vector<la_index>> &dofmap, const std::vector<std::vector<la_index>> &node_dofmap, const std::vector<int> &old_to_new_node_local, const std::size_t block_size)
Parameters:
  • dofmap
  • node_dofmap
  • old_to_new_node_local
  • block_size
void dolfin::DofMapBuilder::build_local_ufc_dofmap(std::vector<std::vector<dolfin::la_index>> &dofmap, const ufc::dofmap &ufc_dofmap, const Mesh &mesh)
Parameters:
  • dofmap
  • ufc_dofmap
  • mesh
void dolfin::DofMapBuilder::build_sub_map_view(DofMap &sub_dofmap, const DofMap &parent_dofmap, const std::vector<std::size_t> &component, const Mesh &mesh)

Build sub-dofmap. This is a view into the parent dofmap.

Parameters:
  • sub_dofmap – [direction=out]
  • parent_dofmap – [direction=in]
  • component – [direction=in]
  • mesh – [direction=in]
std::shared_ptr<const ufc::dofmap> dolfin::DofMapBuilder::build_ufc_node_graph(std::vector<std::vector<la_index>> &node_dofmap, std::vector<std::size_t> &node_local_to_global, std::vector<std::size_t> &num_mesh_entities_global, std::shared_ptr<const ufc::dofmap> ufc_dofmap, const Mesh &mesh, std::shared_ptr<const SubDomain> constrained_domain, const std::size_t block_size)
Parameters:
  • node_dofmap
  • node_local_to_global
  • num_mesh_entities_global
  • ufc_dofmap
  • mesh
  • constrained_domain
  • block_size
std::shared_ptr<const ufc::dofmap> dolfin::DofMapBuilder::build_ufc_node_graph_constrained(std::vector<std::vector<la_index>> &node_dofmap, std::vector<std::size_t> &node_local_to_global, std::vector<int> &node_ufc_local_to_local, std::vector<std::size_t> &num_mesh_entities_global, std::shared_ptr<const ufc::dofmap> ufc_dofmap, const Mesh &mesh, std::shared_ptr<const SubDomain> constrained_domain, const std::size_t block_size)
Parameters:
  • node_dofmap
  • node_local_to_global
  • node_ufc_local_to_local
  • num_mesh_entities_global
  • ufc_dofmap
  • mesh
  • constrained_domain
  • block_size
std::size_t dolfin::DofMapBuilder::compute_blocksize(const ufc::dofmap &ufc_dofmap)
Parameters:ufc_dofmap
void dolfin::DofMapBuilder::compute_constrained_mesh_indices(std::vector<std::vector<std::int64_t>> &global_entity_indices, std::vector<std::size_t> &num_mesh_entities_global, const std::vector<bool> &needs_mesh_entities, const Mesh &mesh, const SubDomain &constrained_domain)
Parameters:
  • global_entity_indices
  • num_mesh_entities_global
  • needs_mesh_entities
  • mesh
  • constrained_domain
void dolfin::DofMapBuilder::compute_global_dofs(std::set<std::size_t> &global_dofs, std::size_t &offset_local, std::shared_ptr<const ufc::dofmap> ufc_dofmap, const std::vector<std::size_t> &num_mesh_entities_local)
Parameters:
  • global_dofs
  • offset_local
  • ufc_dofmap
  • num_mesh_entities_local
std::set<std::size_t> dolfin::DofMapBuilder::compute_global_dofs(std::shared_ptr<const ufc::dofmap> ufc_dofmap, const std::vector<std::size_t> &num_mesh_entities_local)
Parameters:
  • ufc_dofmap
  • num_mesh_entities_local
int dolfin::DofMapBuilder::compute_node_ownership(std::vector<short int> &node_ownership, std::unordered_map<int, std::vector<int>> &shared_node_to_processes, std::set<int> &neighbours, const std::vector<std::vector<la_index>> &node_dofmap, const std::vector<int> &boundary_nodes, const std::set<std::size_t> &global_nodes, const std::vector<std::size_t> &node_local_to_global, const Mesh &mesh, const std::size_t global_dim)
Parameters:
  • node_ownership
  • shared_node_to_processes
  • neighbours
  • node_dofmap
  • boundary_nodes
  • global_nodes
  • node_local_to_global
  • mesh
  • global_dim
void dolfin::DofMapBuilder::compute_node_reordering(IndexMap &index_map, std::vector<int> &old_to_new_local, const std::unordered_map<int, std::vector<int>> &node_to_sharing_processes, const std::vector<std::size_t> &old_local_to_global, const std::vector<std::vector<la_index>> &node_dofmap, const std::vector<short int> &node_ownership, const std::set<std::size_t> &global_nodes, const MPI_Comm mpi_comm)
Parameters:
  • index_map
  • old_to_new_local
  • node_to_sharing_processes
  • old_local_to_global
  • node_dofmap
  • node_ownership
  • global_nodes
  • mpi_comm
std::vector<std::size_t> dolfin::DofMapBuilder::compute_num_mesh_entities_local(const Mesh &mesh, const std::vector<bool> &needs_mesh_entities)
Parameters:
  • mesh
  • needs_mesh_entities
void dolfin::DofMapBuilder::compute_shared_nodes(std::vector<int> &boundary_nodes, const std::vector<std::vector<la_index>> &node_dofmap, const std::size_t num_nodes_local, const ufc::dofmap &ufc_dofmap, const Mesh &mesh)
Parameters:
  • boundary_nodes
  • node_dofmap
  • num_nodes_local
  • ufc_dofmap
  • mesh
std::shared_ptr<ufc::dofmap> dolfin::DofMapBuilder::extract_ufc_sub_dofmap(const ufc::dofmap &ufc_dofmap, std::size_t &offset, const std::vector<std::size_t> &component, const std::vector<std::size_t> &num_global_mesh_entities)
Parameters:
  • ufc_dofmap
  • offset
  • component
  • num_global_mesh_entities
void dolfin::DofMapBuilder::get_cell_entities_global(const Cell &cell, std::vector<std::vector<std::size_t>> &entity_indices, const std::vector<bool> &needs_mesh_entities)
Parameters:
  • cell
  • entity_indices
  • needs_mesh_entities
void dolfin::DofMapBuilder::get_cell_entities_global_constrained(const Cell &cell, std::vector<std::vector<std::size_t>> &entity_indices, const std::vector<std::vector<std::int64_t>> &global_entity_indices, const std::vector<bool> &needs_mesh_entities)
Parameters:
  • cell
  • entity_indices
  • global_entity_indices
  • needs_mesh_entities
void dolfin::DofMapBuilder::get_cell_entities_local(const Cell &cell, std::vector<std::vector<std::size_t>> &entity_indices, const std::vector<bool> &needs_mesh_entities)
Parameters:
  • cell
  • entity_indices
  • needs_mesh_entities

Equation

C++ documentation for Equation from dolfin/fem/Equation.h:

class dolfin::Equation

This class represents a variational equation lhs == rhs. The equation can be either linear or nonlinear:

  1. Linear (a == L), in which case a must be a bilinear form and L must be a linear form.
  2. Nonlinear (F == 0), in which case F must be a linear form.
dolfin::Equation::Equation(std::shared_ptr<const Form> F, int rhs)

Create equation F == 0

Parameters:
  • F – (Form ) [direction=in]
  • rhs – (int) [direction=in]
dolfin::Equation::Equation(std::shared_ptr<const Form> a, std::shared_ptr<const Form> L)

Create equation a == L

Parameters:
  • a – (Form ) Form representing the LHS [direction=in]
  • L – (Form ) Form representing the RHS [direction=in]
bool dolfin::Equation::is_linear() const

Check whether equation is linear

Returns:bool
std::shared_ptr<const Form> dolfin::Equation::lhs() const

Return form for left-hand side

Returns:Form LHS form
std::shared_ptr<const Form> dolfin::Equation::rhs() const

Return form for right-hand side

Returns:Form RHS form
int dolfin::Equation::rhs_int() const

Return value for right-hand side

Returns:int
dolfin::Equation::~Equation()

Destructor.

FiniteElement

C++ documentation for FiniteElement from dolfin/fem/FiniteElement.h:

class dolfin::FiniteElement

This is a wrapper for a UFC finite element (ufc::finite_element ).

dolfin::FiniteElement::FiniteElement(std::shared_ptr<const ufc::finite_element> element)

Create finite element from UFC finite element (data may be shared)

Parameters:element – (ufc::finite_element ) UFC finite element
ufc::shape dolfin::FiniteElement::cell_shape() const

Return the cell shape

Returns:ufc::shape
std::shared_ptr<const FiniteElement> dolfin::FiniteElement::create() const

Create a new class instance.

std::shared_ptr<const FiniteElement> dolfin::FiniteElement::create_sub_element(std::size_t i) const

Create a new finite element for sub element i (for a mixed element)

Parameters:i
void dolfin::FiniteElement::evaluate_basis(std::size_t i, double *values, const double *x, const double *coordinate_dofs, int cell_orientation) const

Evaluate basis function i at given point in cell.

Parameters:
  • i
  • values
  • x
  • coordinate_dofs
  • cell_orientation
void dolfin::FiniteElement::evaluate_basis_all(double *values, const double *x, const double *coordinate_dofs, int cell_orientation) const

Evaluate all basis functions at given point in cell.

Parameters:
  • values
  • x
  • coordinate_dofs
  • cell_orientation
void dolfin::FiniteElement::evaluate_basis_derivatives(unsigned int i, unsigned int n, double *values, const double *x, const double *coordinate_dofs, int cell_orientation) const

Evaluate order n derivatives of basis function i at given point in cell.

Parameters:
  • i
  • n
  • values
  • x
  • coordinate_dofs
  • cell_orientation
void dolfin::FiniteElement::evaluate_basis_derivatives_all(unsigned int n, double *values, const double *x, const double *coordinate_dofs, int cell_orientation) const

Evaluate order n derivatives of all basis functions at given point in cell

Parameters:
  • n
  • values
  • x
  • coordinate_dofs
  • cell_orientation
double dolfin::FiniteElement::evaluate_dof(std::size_t i, const ufc::function &function, const double *coordinate_dofs, int cell_orientation, const ufc::cell &c) const

Evaluate linear functional for dof i on the function f.

Parameters:
  • i
  • function
  • coordinate_dofs
  • cell_orientation
  • c
void dolfin::FiniteElement::evaluate_dofs(double *values, const ufc::function &f, const double *coordinate_dofs, int cell_orientation, const ufc::cell &c) const

Evaluate linear functionals for all dofs on the function f.

Parameters:
  • values
  • f
  • coordinate_dofs
  • cell_orientation
  • c
std::shared_ptr<const FiniteElement> dolfin::FiniteElement::extract_sub_element(const FiniteElement &finite_element, const std::vector<std::size_t> &component)
Parameters:
  • finite_element
  • component
std::shared_ptr<const FiniteElement> dolfin::FiniteElement::extract_sub_element(const std::vector<std::size_t> &component) const

Extract sub finite element for component.

Parameters:component
unsigned int dolfin::FiniteElement::geometric_dimension() const

Return the geometric dimension of the cell shape

Returns:unsigned int
std::size_t dolfin::FiniteElement::hash() const

Return simple hash of the signature string.

void dolfin::FiniteElement::interpolate_vertex_values(double *vertex_values, double *coefficients, const double *coordinate_dofs, int cell_orientation) const

Interpolate vertex values from dof values

Parameters:
  • vertex_values – (double*)
  • coefficients – (double*)
  • coordinate_dofs – (const double*)
  • cell_orientation – (int)
std::size_t dolfin::FiniteElement::num_sub_elements() const

Return the number of sub elements (for a mixed element)

Returns:std::size_t number of sub-elements
std::string dolfin::FiniteElement::signature() const

Return a string identifying the finite element

Returns:std::string
std::size_t dolfin::FiniteElement::space_dimension() const

Return the dimension of the finite element function space

Returns:std::size_t
void dolfin::FiniteElement::tabulate_dof_coordinates(boost::multi_array<double, 2> &coordinates, const std::vector<double> &coordinate_dofs, const Cell &cell) const

Tabulate the coordinates of all dofs on an element

Parameters:
  • coordinates – (boost::multi_array<double, 2>) The coordinates of all dofs on a cell. [direction=inout]
  • coordinate_dofs – (std::vector<double>) The cell coordinates [direction=in]
  • cell – (Cell ) The cell. [direction=in]
std::size_t dolfin::FiniteElement::topological_dimension() const

Return the topological dimension of the cell shape

Returns:std::size_t
std::shared_ptr<const ufc::finite_element> dolfin::FiniteElement::ufc_element() const

Return underlying UFC element. Intended for libray usage only and may change.

std::size_t dolfin::FiniteElement::value_dimension(std::size_t i) const

Return the dimension of the value space for axis i.

Parameters:i
std::size_t dolfin::FiniteElement::value_rank() const

Return the rank of the value space.

dolfin::FiniteElement::~FiniteElement()

Destructor.

Form

C++ documentation for Form from dolfin/fem/Form.h:

class dolfin::Form

Base class for UFC code generated by FFC for DOLFIN with option -l.

embed:rst:leading-slashes
/// A note on the order of trial and test spaces: FEniCS numbers
/// argument spaces starting with the leading dimension of the
/// corresponding tensor (matrix). In other words, the test space is
/// numbered 0 and the trial space is numbered 1. However, in order
/// to have a notation that agrees with most existing finite element
/// literature, in particular
///
///     a = a(u, v)
///
/// the spaces are numbered from right to
///
///     a: V_1 x V_0 -> R
///
/// .. note::
///
///     Figure out how to write this in math mode without it getting
///     messed up in the Python version.
///
/// This is reflected in the ordering of the spaces that should be
/// supplied to generated subclasses. In particular, when a bilinear
/// form is initialized, it should be initialized as
///
/// .. code-block:: c++
///
///     a(V_1, V_0) = ...
///
/// where ``V_1`` is the trial space and ``V_0`` is the test space.
/// However, when a form is initialized by a list of argument spaces
/// (the variable ``function_spaces`` in the constructors below, the
/// list of spaces should start with space number 0 (the test space)
/// and then space number 1 (the trial space).
///
dolfin::Form::Form(std::shared_ptr<const ufc::form> ufc_form, std::vector<std::shared_ptr<const FunctionSpace>> function_spaces)

Create form (shared data)

Parameters:
dolfin::Form::Form(std::size_t rank, std::size_t num_coefficients)

Create form of given rank with given number of coefficients

Parameters:
  • rank – (std::size_t) The rank. [direction=in]
  • num_coefficients – (std::size_t) The number of coefficients. [direction=in]
std::shared_ptr<const MeshFunction<std::size_t>> dolfin::Form::cell_domains() const

Return cell domains (zero pointer if no domains have been specified)

Returns:MeshFunction <std::size_t> The cell domains.
void dolfin::Form::check() const

Check function spaces and coefficients.

std::shared_ptr<const GenericFunction> dolfin::Form::coefficient(std::size_t i) const

Return coefficient with given number

Parameters:i – (std::size_t) Index [direction=in]
Returns:GenericFunction The coefficient.
std::shared_ptr<const GenericFunction> dolfin::Form::coefficient(std::string name) const

Return coefficient with given name

Parameters:name – (std::string) The name. [direction=in]
Returns:GenericFunction The coefficient.
std::string dolfin::Form::coefficient_name(std::size_t i) const

Return the name of the coefficient with this number

Parameters:i – (std::size_t) The number [direction=in]
Returns:std::string The name of the coefficient with the given number.
std::size_t dolfin::Form::coefficient_number(const std::string &name) const

Return the number of the coefficient with this name

Parameters:name – (std::string) The name. [direction=in]
Returns:std::size_t The number of the coefficient with the given name.
std::vector<std::shared_ptr<const GenericFunction>> dolfin::Form::coefficients() const

Return all coefficients

Returns:std::vector<GenericFunction > All coefficients.
std::vector<std::size_t> dolfin::Form::coloring(std::size_t entity_dim) const

Return coloring type for colored assembly of form over a mesh entity of a given dimension

Parameters:entity_dim – (std::size_t) Dimension. [direction=in]
Returns:std::vector<std::size_t> Coloring type.
std::shared_ptr<const MeshFunction<std::size_t>> dolfin::Form::dP

Domain markers for vertices.

std::shared_ptr<const MeshFunction<std::size_t>> dolfin::Form::dS

Domain markers for interior facets.

std::shared_ptr<const MeshFunction<std::size_t>> dolfin::Form::ds

Domain markers for exterior facets.

std::shared_ptr<const MeshFunction<std::size_t>> dolfin::Form::dx

Domain markers for cells.

std::shared_ptr<const MeshFunction<std::size_t>> dolfin::Form::exterior_facet_domains() const

Return exterior facet domains (zero pointer if no domains have been specified)

Returns:std::shared_ptr<MeshFunction <std::size_t>> The exterior facet domains.
std::shared_ptr<const FunctionSpace> dolfin::Form::function_space(std::size_t i) const

Return function space for given argument

Parameters:i – (std::size_t) Index
Returns:FunctionSpace Function space shared pointer.
std::vector<std::shared_ptr<const FunctionSpace>> dolfin::Form::function_spaces() const

Return function spaces for arguments

Returns:std::vector<FunctionSpace > Vector of function space shared pointers.
std::shared_ptr<const MeshFunction<std::size_t>> dolfin::Form::interior_facet_domains() const

Return interior facet domains (zero pointer if no domains have been specified)

Returns:MeshFunction <std::size_t> The interior facet domains.
std::shared_ptr<const Mesh> dolfin::Form::mesh() const

Extract common mesh from form

Returns:Mesh Shared pointer to the mesh.
std::size_t dolfin::Form::num_coefficients() const

Return number of coefficients

Returns:std::size_t The number of coefficients.
Equation dolfin::Form::operator==(const Form &rhs) const

Comparison operator, returning equation lhs == rhs.

Parameters:rhs
Equation dolfin::Form::operator==(int rhs) const

Comparison operator, returning equation lhs == 0.

Parameters:rhs
std::size_t dolfin::Form::original_coefficient_position(std::size_t i) const

Return original coefficient position for each coefficient (0 <= i < n)

Parameters:i
Returns:std::size_t The position of coefficient i in original ufl form coefficients.
std::size_t dolfin::Form::rank() const

Return rank of form (bilinear form = 2, linear form = 1, functional = 0, etc)

Returns:std::size_t The rank of the form.
void dolfin::Form::set_cell_domains(std::shared_ptr<const MeshFunction<std::size_t>> cell_domains)

Set cell domains

Parameters:cell_domains – (MeshFunction <std::size_t>) The cell domains. [direction=in]
void dolfin::Form::set_coefficient(std::size_t i, std::shared_ptr<const GenericFunction> coefficient)

Set coefficient with given number (shared pointer version)

Parameters:
  • i – (std::size_t) The given number. [direction=in]
  • coefficient – (GenericFunction ) The coefficient. [direction=in]
void dolfin::Form::set_coefficient(std::string name, std::shared_ptr<const GenericFunction> coefficient)

Set coefficient with given name (shared pointer version)

Parameters:
  • name – (std::string) The name. [direction=in]
  • coefficient – (GenericFunction ) The coefficient. [direction=in]
void dolfin::Form::set_coefficients(std::map<std::string, std::shared_ptr<const GenericFunction>> coefficients)

Set all coefficients in given map. All coefficients in the given map, which may contain only a subset of the coefficients of the form, will be set.

Parameters:coefficients – (std::map<std::string, GenericFunction >) The map of coefficients. [direction=in]
void dolfin::Form::set_exterior_facet_domains(std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains)

Set exterior facet domains

Parameters:exterior_facet_domains – (MeshFunction <std::size_t>) The exterior facet domains. [direction=in]
void dolfin::Form::set_interior_facet_domains(std::shared_ptr<const MeshFunction<std::size_t>> interior_facet_domains)

Set interior facet domains

Parameters:interior_facet_domains – (MeshFunction <std::size_t>) The interior facet domains. [direction=in]
void dolfin::Form::set_mesh(std::shared_ptr<const Mesh> mesh)

Set mesh, necessary for functionals when there are no function spaces

Parameters:mesh – (Mesh ) The mesh. [direction=in]
void dolfin::Form::set_some_coefficients(std::map<std::string, std::shared_ptr<const GenericFunction>> coefficients)

Set some coefficients in given map. Each coefficient in the given map will be set, if the name of the coefficient matches the name of a coefficient in the form. This is useful when reusing the same coefficient map for several forms, or when some part of the form has been outcommented (for testing) in the UFL file, which means that the coefficient and attaching it to the form does not need to be outcommented in a C++ program using code from the generated UFL file.

Parameters:coefficients – (std::map<std::string, GenericFunction >) The map of coefficients. [direction=in]
void dolfin::Form::set_vertex_domains(std::shared_ptr<const MeshFunction<std::size_t>> vertex_domains)

Set vertex domains

Parameters:vertex_domains – (MeshFunction <std::size_t>) The vertex domains. [direction=in]
std::shared_ptr<const ufc::form> dolfin::Form::ufc_form() const

Return UFC form shared pointer

Returns:ufc::form The UFC form.
std::shared_ptr<const MeshFunction<std::size_t>> dolfin::Form::vertex_domains() const

Return vertex domains (zero pointer if no domains have been specified)

Returns:MeshFunction <std::size_t> The vertex domains.
dolfin::Form::~Form()

Destructor.

GenericDofMap

C++ documentation for GenericDofMap from dolfin/fem/GenericDofMap.h:

class dolfin::GenericDofMap

This class provides a generic interface for dof maps.

dolfin::GenericDofMap::GenericDofMap()

Constructor.

int dolfin::GenericDofMap::block_size() const = 0

Get block size.

std::size_t dolfin::GenericDofMap::cell_dimension(std::size_t index) const

Return the dimension of the local finite element function space on a cell (deprecated API)

Parameters:index
Eigen::Map<const Eigen::Array<dolfin::la_index, Eigen::Dynamic, 1>> dolfin::GenericDofMap::cell_dofs(std::size_t cell_index) const = 0

Local-to-global mapping of dofs on a cell.

Parameters:cell_index
void dolfin::GenericDofMap::clear_sub_map_data() = 0

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

std::shared_ptr<GenericDofMap> dolfin::GenericDofMap::collapse(std::unordered_map<std::size_t, std::size_t> &collapsed_map, const Mesh &mesh) const = 0

Create a “collapsed” a dofmap (collapses from a sub-dofmap view)

Parameters:
  • collapsed_map
  • mesh
std::shared_ptr<const SubDomain> dolfin::GenericDofMap::constrained_domain

Subdomain mapping constrained boundaries, e.g. periodic conditions

std::shared_ptr<GenericDofMap> dolfin::GenericDofMap::copy() const = 0

Create a copy of the dof map.

std::shared_ptr<GenericDofMap> dolfin::GenericDofMap::create(const Mesh &new_mesh) const = 0

Create a new dof map on new mesh.

Parameters:new_mesh
std::vector<dolfin::la_index> dolfin::GenericDofMap::dofs() const = 0

Return list of global dof indices on this process.

std::vector<dolfin::la_index> dolfin::GenericDofMap::dofs(const Mesh &mesh, std::size_t dim) const = 0

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

Parameters:
  • mesh
  • dim
std::vector<dolfin::la_index> dolfin::GenericDofMap::entity_closure_dofs(const Mesh &mesh, std::size_t entity_dim) const = 0

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

Parameters:
  • mesh
  • entity_dim
std::vector<dolfin::la_index> dolfin::GenericDofMap::entity_closure_dofs(const Mesh &mesh, std::size_t entity_dim, const std::vector<std::size_t> &entity_indices) const = 0

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

Parameters:
  • mesh
  • entity_dim
  • entity_indices
std::vector<dolfin::la_index> dolfin::GenericDofMap::entity_dofs(const Mesh &mesh, std::size_t entity_dim) const = 0

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

Parameters:
  • mesh
  • entity_dim
std::vector<dolfin::la_index> dolfin::GenericDofMap::entity_dofs(const Mesh &mesh, std::size_t entity_dim, const std::vector<std::size_t> &entity_indices) const = 0

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

Parameters:
  • mesh
  • entity_dim
  • entity_indices
std::shared_ptr<GenericDofMap> dolfin::GenericDofMap::extract_sub_dofmap(const std::vector<std::size_t> &component, const Mesh &mesh) const = 0

Extract sub dofmap component.

Parameters:
  • component
  • mesh
std::size_t dolfin::GenericDofMap::global_dimension() const = 0

Return the dimension of the global finite element function space

std::shared_ptr<const IndexMap> dolfin::GenericDofMap::index_map() const = 0

Index map (const access)

bool dolfin::GenericDofMap::is_view() const = 0

True if dof map is a view into another map (is a sub-dofmap)

std::size_t dolfin::GenericDofMap::local_to_global_index(int local_index) const = 0

Return global dof index corresponding to a given local index.

Parameters:local_index
const std::vector<std::size_t> &dolfin::GenericDofMap::local_to_global_unowned() const = 0

Return the map from unowned local dofmap nodes to global dofmap nodes. Dofmap node is dof index modulo block size.

std::size_t dolfin::GenericDofMap::max_cell_dimension() const

Return the maximum dimension of the local finite element function space (deprecated API)

std::size_t dolfin::GenericDofMap::max_element_dofs() const = 0

Return the maximum dimension of the local finite element function space

const std::set<int> &dolfin::GenericDofMap::neighbours() const = 0

Return set of processes that share dofs with the this process.

std::size_t dolfin::GenericDofMap::num_element_dofs(std::size_t index) const = 0

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

Parameters:index
std::size_t dolfin::GenericDofMap::num_entity_closure_dofs(std::size_t entity_dim) const = 0

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

Parameters:entity_dim
std::size_t dolfin::GenericDofMap::num_entity_dofs(std::size_t entity_dim) const = 0

Return the number of dofs for a given entity dimension.

Parameters:entity_dim
std::size_t dolfin::GenericDofMap::num_facet_dofs() const = 0

Return number of facet dofs.

const std::vector<int> &dolfin::GenericDofMap::off_process_owner() const = 0

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

std::pair<std::size_t, std::size_t> dolfin::GenericDofMap::ownership_range() const = 0

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

void dolfin::GenericDofMap::set(GenericVector &x, double value) const = 0

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
  • value
const std::unordered_map<int, std::vector<int>> &dolfin::GenericDofMap::shared_nodes() const = 0

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

std::string dolfin::GenericDofMap::str(bool verbose) const = 0

Return informal string representation (pretty-print)

Parameters:verbose
void dolfin::GenericDofMap::tabulate_entity_closure_dofs(std::vector<std::size_t> &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const = 0

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

Parameters:
  • element_dofs
  • entity_dim
  • cell_entity_index
void dolfin::GenericDofMap::tabulate_entity_dofs(std::vector<std::size_t> &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const = 0

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

Parameters:
  • element_dofs
  • entity_dim
  • cell_entity_index
void dolfin::GenericDofMap::tabulate_facet_dofs(std::vector<std::size_t> &element_dofs, std::size_t cell_facet_index) const = 0

Tabulate local-local facet dofs.

Parameters:
  • element_dofs
  • cell_facet_index
void dolfin::GenericDofMap::tabulate_global_dofs(std::vector<std::size_t> &dofs) const = 0

Tabulate globally supported dofs.

Parameters:dofs
void dolfin::GenericDofMap::tabulate_local_to_global_dofs(std::vector<std::size_t> &local_to_global_map) const = 0

Tabulate map between local (process) and global dof indices.

Parameters:local_to_global_map

LinearTimeDependentProblem

C++ documentation for LinearTimeDependentProblem from dolfin/fem/LinearTimeDependentProblem.h:

class dolfin::LinearTimeDependentProblem

This class represents a linear time-dependent variational problem: Find u in U = U_h (x) U_k such that

a(u, v) = L(v)  for all v in V = V_h (x) V_k,

where U is a tensor-product trial space and V is a tensor-product test space.

dolfin::LinearTimeDependentProblem::LinearTimeDependentProblem(std::shared_ptr<const TensorProductForm> a, std::shared_ptr<const TensorProductForm> L, std::shared_ptr<Function> u, std::vector<std::shared_ptr<const BoundaryCondition>> bcs)

Create linear variational problem with a list of boundary conditions (shared pointer version)

Parameters:
  • a
  • L
  • u
  • bcs
std::vector<std::shared_ptr<const BoundaryCondition>> dolfin::LinearTimeDependentProblem::bcs() const

Return boundary conditions.

std::shared_ptr<const TensorProductForm> dolfin::LinearTimeDependentProblem::bilinear_form() const

Return bilinear form.

void dolfin::LinearTimeDependentProblem::check_forms() const
std::shared_ptr<const TensorProductForm> dolfin::LinearTimeDependentProblem::linear_form() const

Return linear form.

std::shared_ptr<Function> dolfin::LinearTimeDependentProblem::solution()

Return solution variable.

std::shared_ptr<const Function> dolfin::LinearTimeDependentProblem::solution() const

Return solution variable (const version)

std::shared_ptr<const FunctionSpace> dolfin::LinearTimeDependentProblem::test_space() const

Return test space.

std::shared_ptr<const FunctionSpace> dolfin::LinearTimeDependentProblem::trial_space() const

Return trial space.

LinearVariationalProblem

C++ documentation for LinearVariationalProblem from dolfin/fem/LinearVariationalProblem.h:

class dolfin::LinearVariationalProblem

This class represents a linear variational problem: Find u in V such that

a(u, v) = L(v)  for all v in V^,

where V is the trial space and V^ is the test space.

dolfin::LinearVariationalProblem::LinearVariationalProblem(std::shared_ptr<const Form> a, std::shared_ptr<const Form> L, std::shared_ptr<Function> u, std::vector<std::shared_ptr<const DirichletBC>> bcs)

Create linear variational problem with a list of boundary conditions

Parameters:
  • a
  • L
  • u
  • bcs
std::vector<std::shared_ptr<const DirichletBC>> dolfin::LinearVariationalProblem::bcs() const

Return boundary conditions.

std::shared_ptr<const Form> dolfin::LinearVariationalProblem::bilinear_form() const

Return bilinear form.

void dolfin::LinearVariationalProblem::check_forms() const
std::shared_ptr<const Form> dolfin::LinearVariationalProblem::linear_form() const

Return linear form.

std::shared_ptr<Function> dolfin::LinearVariationalProblem::solution()

Return solution variable.

std::shared_ptr<const Function> dolfin::LinearVariationalProblem::solution() const

Return solution variable (const version)

std::shared_ptr<const FunctionSpace> dolfin::LinearVariationalProblem::test_space() const

Return test space.

std::shared_ptr<const FunctionSpace> dolfin::LinearVariationalProblem::trial_space() const

Return trial space.

LinearVariationalSolver

C++ documentation for LinearVariationalSolver from dolfin/fem/LinearVariationalSolver.h:

class dolfin::LinearVariationalSolver

This class implements a solver for linear variational problems.

dolfin::LinearVariationalSolver::LinearVariationalSolver(std::shared_ptr<LinearVariationalProblem> problem)

Create linear variational solver for given problem.

Parameters:problem
void dolfin::LinearVariationalSolver::solve()

Solve variational problem.

LocalAssembler

C++ documentation for LocalAssembler from dolfin/fem/LocalAssembler.h:

class dolfin::LocalAssembler

Assembly of local cell tensors. Used by the adaptivity and LocalSolver functionality in dolfin. The local assembly functionality provided here is also wrapped as a free function assemble_local(form_a, cell) in Python for easier usage. Use from the C++ interface defined below will be faster than the free function as fewer objects need to be created and destroyed.

void dolfin::LocalAssembler::assemble(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> &A, UFC &ufc, const std::vector<double> &coordinate_dofs, ufc::cell &ufc_cell, const Cell &cell, const MeshFunction<std::size_t> *cell_domains, const MeshFunction<std::size_t> *exterior_facet_domains, const MeshFunction<std::size_t> *interior_facet_domains)

Assemble a local tensor on a cell. Internally calls assemble_cell() , assemble_exterior_facet() , assemble_interior_facet() .

Parameters:
  • A – The tensor to assemble.
  • ufc
  • coordinate_dofs
  • ufc_cell
  • cell
  • cell_domains
  • exterior_facet_domains
  • interior_facet_domains
void dolfin::LocalAssembler::assemble_cell(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> &A, UFC &ufc, const std::vector<double> &coordinate_dofs, const ufc::cell &ufc_cell, const Cell &cell, const MeshFunction<std::size_t> *cell_domains)

Worker method called by assemble() to perform assembly of volume integrals (UFL measure dx).

Parameters:
  • A – The tensor to assemble.
  • ufc
  • coordinate_dofs
  • ufc_cell
  • cell
  • cell_domains
void dolfin::LocalAssembler::assemble_exterior_facet(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> &A, UFC &ufc, const std::vector<double> &coordinate_dofs, const ufc::cell &ufc_cell, const Cell &cell, const Facet &facet, const std::size_t local_facet, const MeshFunction<std::size_t> *exterior_facet_domains)

Worker method called by assemble() for each of the cell’s external facets to perform assembly of external facet integrals (UFL measure ds).

Parameters:
  • A – The tensor to assemble.
  • ufc
  • coordinate_dofs
  • ufc_cell
  • cell
  • facet
  • local_facet
  • exterior_facet_domains
void dolfin::LocalAssembler::assemble_interior_facet(Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> &A, UFC &ufc, const std::vector<double> &coordinate_dofs, const ufc::cell &ufc_cell, const Cell &cell, const Facet &facet, const std::size_t local_facet, const MeshFunction<std::size_t> *interior_facet_domains, const MeshFunction<std::size_t> *cell_domains)

Worker method called by assemble() for each of the cell’s internal facets to perform assembly of internal facet integrals (UFL measure dS)

Parameters:
  • A – The tensor to assemble.
  • ufc
  • coordinate_dofs
  • ufc_cell
  • cell
  • facet
  • local_facet
  • interior_facet_domains
  • cell_domains

LocalSolver

C++ documentation for LocalSolver from dolfin/fem/LocalSolver.h:

class dolfin::LocalSolver

Solve problems cell-wise. This class solves problems cell-wise. It computes the local left-hand side A_local which must be square locally but not globally. The right-hand side b_local is either computed locally for one cell or globally for all cells depending on which of the solve_local_rhs or solve_global_rhs methods which are called. You can optionally assemble the right-hand side vector yourself and use the solve_local method. You must then provide the DofMap of the right-hand side. The local solver solves A_local x_local = b_local. The result x_local is copied into the global vector x of the provided Function u. You can optionally call the factorize method to pre-calculate the local left-hand side factorizations to speed up repeated applications of the LocalSolver with the same LHS. The solve_xxx methods will factorise the LHS A_local matrices each time if they are not cached by a previous call to factorize. You can chose upon initialization whether you want Cholesky or LU (default) factorisations. For forms with no coupling across cell edges, this function is identical to a global solve. For problems with coupling across cells it is not. This class can be used for post-processing solutions, e.g. computing stress fields for visualisation, far more cheaply that using global projections.

dolfin::LocalSolver::LocalSolver(std::shared_ptr<const Form> a, SolverType solver_type = SolverType::LU)

Constructor (shared pointer version)

Parameters:
  • a – (Form ) input LHS form
  • solver_type – (SolverType)
dolfin::LocalSolver::LocalSolver(std::shared_ptr<const Form> a, std::shared_ptr<const Form> L, SolverType solver_type = SolverType::LU)

Constructor (shared pointer version)

Parameters:
  • a – (Form ) input LHS form
  • L – (Form ) input RHS form
  • solver_type – (SolverType)
enum dolfin::LocalSolver::SolverType

SolverType.

enumerator dolfin::LocalSolver::SolverType::LU
enumerator dolfin::LocalSolver::SolverType::Cholesky
void dolfin::LocalSolver::clear_factorization()

Reset (clear) any stored factorizations.

void dolfin::LocalSolver::factorize()

Factorise the local LHS matrices for all cells and store in cache.

void dolfin::LocalSolver::solve_global_rhs(Function &u) const

Solve local (cell-wise) problems A_e x_e = b_e, where A_e is the cell matrix LHS and b_e is the global RHS vector b restricted to the cell, i.e. b_e may contain contributions from neighbouring cells. The solution is exact for the case in which there is no coupling between cell contributions to the global matrix A, e.g. the discontinuous Galerkin matrix. The result is copied into x.

Parameters:u – (Function &) Function
void dolfin::LocalSolver::solve_local(GenericVector &x, const GenericVector &b, const GenericDofMap &dofmap_b) const

Solve local problems for given RHS and corresponding dofmap for RHS

Parameters:
void dolfin::LocalSolver::solve_local_rhs(Function &u) const

Solve local (cell-wise) problems A_e x_e = b_e where A_e and b_e are the cell element tensors. Compared to solve_global_rhs this function calculates local RHS vectors for each cell and hence does not include contributions from neighbouring cells. This function is useful for computing (approximate) cell-wise projections, for example for post-processing. It much more efficient than computing global projections.

Parameters:u – (Function &) Function

MultiMeshAssembler

C++ documentation for MultiMeshAssembler from dolfin/fem/MultiMeshAssembler.h:

class dolfin::MultiMeshAssembler

This class implements functionality for finite element assembly over cut and composite finite element (MultiMesh ) function spaces.

dolfin::MultiMeshAssembler::MultiMeshAssembler()

Constructor.

void dolfin::MultiMeshAssembler::assemble(GenericTensor &A, const MultiMeshForm &a)

Assemble tensor from given form

Parameters:
  • A – (GenericTensor ) The tensor to assemble.
  • a – (Form ) The form to assemble the tensor from.
bool dolfin::MultiMeshAssembler::extend_cut_cell_integration

extend_cut_cell_integration (bool) Default value is false. This controls whether the integration over cut cells should extend to the part of cut cells covered by cells from higher ranked meshes - thus including both the cut cell part and the overlap part.

MultiMeshDirichletBC

C++ documentation for MultiMeshDirichletBC from dolfin/fem/MultiMeshDirichletBC.h:

class dolfin::MultiMeshDirichletBC

This class is used to set Dirichlet boundary conditions for multimesh function spaces.

dolfin::MultiMeshDirichletBC::MultiMeshDirichletBC(const MultiMeshDirichletBC &bc)

Copy constructor. Either cached DOF data are copied. Arguments bc (MultiMeshDirichletBC() ) The object to be copied.

Parameters:bc
dolfin::MultiMeshDirichletBC::MultiMeshDirichletBC(std::shared_ptr<const MultiMeshFunctionSpace> V, std::shared_ptr<const GenericFunction> g, std::shared_ptr<const MeshFunction<std::size_t>> sub_domains, std::size_t sub_domain, std::size_t part, std::string method = "topological")

Create boundary condition for subdomain specified by index

Parameters:
  • V – (FunctionSpace ) The function space.
  • g – (GenericFunction ) The value.
  • sub_domains – (MeshFunction <std::size_t>) Subdomain markers
  • sub_domain – (std::size_t) The subdomain index (number)
  • part – (std::size_t) The part on which to set boundary conditions
  • method – (std::string) Optional argument: A string specifying the method to identify dofs.
dolfin::MultiMeshDirichletBC::MultiMeshDirichletBC(std::shared_ptr<const MultiMeshFunctionSpace> V, std::shared_ptr<const GenericFunction> g, std::shared_ptr<const SubDomain> sub_domain, std::string method = "topological", bool check_midpoint = true, bool exclude_overlapped_boundaries = true)

Create boundary condition for subdomain

Parameters:
  • V – (MultiMeshFunctionSpace ) The function space
  • g – (GenericFunction ) The value
  • sub_domain – (SubDomain ) The subdomain
  • method – (std::string) Option passed to DirichletBC .
  • check_midpoint – (bool) Option passed to DirichletBC .
  • exclude_overlapped_boundaries – (bool) If true, then the variable on_boundary will be set to false for facets that are overlapped by another mesh (irrespective of the layering order of the meshes).
void dolfin::MultiMeshDirichletBC::apply(GenericMatrix &A) const

Apply boundary condition to a matrix

Parameters:A – (GenericMatrix ) The matrix to apply boundary condition to.
void dolfin::MultiMeshDirichletBC::apply(GenericMatrix &A, GenericVector &b) const

Apply boundary condition to a linear system

Parameters:
  • A – (GenericMatrix ) The matrix to apply boundary condition to.
  • b – (GenericVector ) The vector to apply boundary condition to.
void dolfin::MultiMeshDirichletBC::apply(GenericMatrix &A, GenericVector &b, const GenericVector &x) const

Apply boundary condition to a linear system for a nonlinear problem

Parameters:
void dolfin::MultiMeshDirichletBC::apply(GenericVector &b) const

Apply boundary condition to a vector

Parameters:b – (GenericVector ) The vector to apply boundary condition to.
void dolfin::MultiMeshDirichletBC::apply(GenericVector &b, const GenericVector &x) const

Apply boundary condition to vectors for a nonlinear problem

Parameters:
void dolfin::MultiMeshDirichletBC::homogenize()

Set value to 0.0.

void dolfin::MultiMeshDirichletBC::zero(GenericMatrix &A) const

Zero the rows in a matrix A corresponding to boundary dofs

Parameters:A – (GenericMatrix ) The matrix to zero rows in.
dolfin::MultiMeshDirichletBC::~MultiMeshDirichletBC()

Destructor.

MultiMeshSubDomain

C++ documentation for MultiMeshSubDomain from dolfin/fem/MultiMeshDirichletBC.h:

class dolfin::MultiMeshDirichletBC::MultiMeshSubDomain
dolfin::MultiMeshDirichletBC::MultiMeshSubDomain::MultiMeshSubDomain(std::shared_ptr<const SubDomain> sub_domain, std::shared_ptr<const MultiMesh> multimesh, bool exclude_overlapped_boundaries)
Parameters:
  • sub_domain
  • multimesh
  • exclude_overlapped_boundaries
bool dolfin::MultiMeshDirichletBC::MultiMeshSubDomain::inside(const Array<double> &x, bool on_boundary) const
Parameters:
  • x
  • on_boundary
void dolfin::MultiMeshDirichletBC::MultiMeshSubDomain::set_current_part(std::size_t current_part)
Parameters:current_part
dolfin::MultiMeshDirichletBC::MultiMeshSubDomain::~MultiMeshSubDomain()

MultiMeshDofMap

C++ documentation for MultiMeshDofMap from dolfin/fem/MultiMeshDofMap.h:

class dolfin::MultiMeshDofMap

This class handles the mapping of degrees of freedom for MultiMesh function spaces.

dolfin::MultiMeshDofMap::MultiMeshDofMap()

Constructor.

dolfin::MultiMeshDofMap::MultiMeshDofMap(const MultiMeshDofMap &dofmap)

Copy constructor.

Parameters:dofmap
void dolfin::MultiMeshDofMap::add(std::shared_ptr<const GenericDofMap> dofmap)

Add dofmap Arguments dofmap (GenericDofMap ) The dofmap.

Parameters:dofmap
void dolfin::MultiMeshDofMap::build(const MultiMeshFunctionSpace &function_space, const std::vector<dolfin::la_index> &offsets)

Build MultiMesh dofmap.

Parameters:
  • function_space
  • offsets
void dolfin::MultiMeshDofMap::clear()

Clear MultiMesh dofmap.

std::size_t dolfin::MultiMeshDofMap::global_dimension() const

Return the dimension of the global finite element function space

std::vector<dolfin::la_index> dolfin::MultiMeshDofMap::inactive_dofs(const MultiMesh &multimesh, std::size_t part_id) const

Return inactive dofs.

Parameters:
  • multimesh
  • part_id
std::shared_ptr<IndexMap> dolfin::MultiMeshDofMap::index_map() const

Return the map.

std::size_t dolfin::MultiMeshDofMap::num_parts() const

Return the number dofmaps (parts) of the MultiMesh dofmap Returns std::size_t The number of dofmaps (parts) of the MultiMesh dofmap

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

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

std::pair<std::size_t, std::size_t> dolfin::MultiMeshDofMap::ownership_range() const

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

std::shared_ptr<const GenericDofMap> dolfin::MultiMeshDofMap::part(std::size_t i) const

Return dofmap (part) number i Returns:cpp:any:GenericDofMap Dofmap (part) number i

Parameters:i
std::string dolfin::MultiMeshDofMap::str(bool verbose) const

Return informal string representation (pretty-print)

Parameters:verbose
dolfin::MultiMeshDofMap::~MultiMeshDofMap()

Destructor.

MultiMeshForm

C++ documentation for MultiMeshForm from dolfin/fem/MultiMeshForm.h:

class dolfin::MultiMeshForm

This class represents a variational form on a cut and composite finite element function space (MultiMesh ) defined on one or more possibly intersecting meshes.

dolfin::MultiMeshForm::MultiMeshForm()
dolfin::MultiMeshForm::MultiMeshForm(std::shared_ptr<const MultiMesh> multimesh)

Create empty multimesh functional.

Parameters:multimesh
dolfin::MultiMeshForm::MultiMeshForm(std::shared_ptr<const MultiMeshFunctionSpace> function_space)

Create empty linear multimesh variational form.

Parameters:function_space
dolfin::MultiMeshForm::MultiMeshForm(std::shared_ptr<const MultiMeshFunctionSpace> function_space_0, std::shared_ptr<const MultiMeshFunctionSpace> function_space_1)

Create empty bilinear multimesh variational form.

Parameters:
  • function_space_0
  • function_space_1
void dolfin::MultiMeshForm::add(std::shared_ptr<const Form> form)

Add form (shared pointer version)

Parameters:form – (Form ) The form.
void dolfin::MultiMeshForm::build()

Build MultiMesh form.

void dolfin::MultiMeshForm::clear()

Clear MultiMesh form.

std::shared_ptr<const MultiMeshFunctionSpace> dolfin::MultiMeshForm::function_space(std::size_t i) const

Return function space for given argument

Parameters:i – (std::size_t) Index
Returns:MultiMeshFunctionSpace Function space shared pointer.
std::shared_ptr<const MultiMesh> dolfin::MultiMeshForm::multimesh() const

Extract common multimesh from form

Returns:MultiMesh The mesh.
std::shared_ptr<const MultiMeshFunction> dolfin::MultiMeshForm::multimesh_coefficient(std::size_t i) const

Get one multimesh coefficient.

Parameters:i
std::vector<std::size_t> dolfin::MultiMeshForm::multimesh_coefficient_keys() const

Get multimesh coefficient keys.

std::map<std::size_t, std::shared_ptr<const MultiMeshFunction>> dolfin::MultiMeshForm::multimesh_coefficients() const

Get all MultiMesh Coefficients.

std::size_t dolfin::MultiMeshForm::num_parts() const

Return the number of forms (parts) of the MultiMesh form

Returns:std::size_t The number of forms (parts) of the MultiMesh form.
std::shared_ptr<const Form> dolfin::MultiMeshForm::part(std::size_t i) const

Return form (part) number i

Parameters:i
Returns:Form Form (part) number i.
std::size_t dolfin::MultiMeshForm::rank() const

Return rank of form (bilinear form = 2, linear form = 1, functional = 0, etc)

Returns:std::size_t The rank of the form.
void dolfin::MultiMeshForm::set_multimesh_coefficient(std::size_t i, std::shared_ptr<const MultiMeshFunction> coefficient)

Set MultiMeshCoeeficient.

Parameters:
  • i
  • coefficient
dolfin::MultiMeshForm::~MultiMeshForm()

Destructor.

NonlinearVariationalProblem

C++ documentation for NonlinearVariationalProblem from dolfin/fem/NonlinearVariationalProblem.h:

class dolfin::NonlinearVariationalProblem

This class represents a nonlinear variational problem: Find u in V such that

F(u; v) = 0  for all v in V^,

where V is the trial space and V^ is the test space.

dolfin::NonlinearVariationalProblem::NonlinearVariationalProblem(std::shared_ptr<const Form> F, std::shared_ptr<Function> u, std::vector<std::shared_ptr<const DirichletBC>> bcs, std::shared_ptr<const Form> J = nullptr)

Create nonlinear variational problem, shared pointer version. The Jacobian form is specified which allows the use of a nonlinear solver that relies on the Jacobian (using Newton’s method).

Parameters:
  • F
  • u
  • bcs
  • J
std::vector<std::shared_ptr<const DirichletBC>> dolfin::NonlinearVariationalProblem::bcs() const

Return boundary conditions.

void dolfin::NonlinearVariationalProblem::check_forms() const
bool dolfin::NonlinearVariationalProblem::has_jacobian() const

Check whether Jacobian has been defined.

bool dolfin::NonlinearVariationalProblem::has_lower_bound() const

Check whether lower bound has been defined.

bool dolfin::NonlinearVariationalProblem::has_upper_bound() const

Check whether upper bound have has defined.

std::shared_ptr<const Form> dolfin::NonlinearVariationalProblem::jacobian_form() const

Return Jacobian form.

std::shared_ptr<const GenericVector> dolfin::NonlinearVariationalProblem::lower_bound() const

Return lower bound.

std::shared_ptr<const Form> dolfin::NonlinearVariationalProblem::residual_form() const

Return residual form.

void dolfin::NonlinearVariationalProblem::set_bounds(const Function &lb_func, const Function &ub_func)

Set the bounds for bound constrained solver.

Parameters:
  • lb_func
  • ub_func
void dolfin::NonlinearVariationalProblem::set_bounds(std::shared_ptr<const GenericVector> lb, std::shared_ptr<const GenericVector> ub)

Set the bounds for bound constrained solver.

Parameters:
  • lb
  • ub
std::shared_ptr<Function> dolfin::NonlinearVariationalProblem::solution()

Return solution variable.

std::shared_ptr<const Function> dolfin::NonlinearVariationalProblem::solution() const

Return solution variable (const version)

std::shared_ptr<const FunctionSpace> dolfin::NonlinearVariationalProblem::test_space() const

Return test space.

std::shared_ptr<const FunctionSpace> dolfin::NonlinearVariationalProblem::trial_space() const

Return trial space.

std::shared_ptr<const GenericVector> dolfin::NonlinearVariationalProblem::upper_bound() const

Return upper bound.

NonlinearVariationalSolver

C++ documentation for NonlinearVariationalSolver from dolfin/fem/NonlinearVariationalSolver.h:

class dolfin::NonlinearVariationalSolver

This class implements a solver for nonlinear variational problems.

dolfin::NonlinearVariationalSolver::NonlinearVariationalSolver(std::shared_ptr<NonlinearVariationalProblem> problem)

Create nonlinear variational solver for given problem.

Parameters:problem
std::shared_ptr<NewtonSolver> dolfin::NonlinearVariationalSolver::newton_solver
std::shared_ptr<NonlinearDiscreteProblem> dolfin::NonlinearVariationalSolver::nonlinear_problem
std::shared_ptr<PETScSNESSolver> dolfin::NonlinearVariationalSolver::snes_solver
std::pair<std::size_t, bool> dolfin::NonlinearVariationalSolver::solve()

Solve variational problem Returns std::pair<std::size_t, bool> Pair of number of Newton iterations, and whether iteration converged)

NonlinearDiscreteProblem

C++ documentation for NonlinearDiscreteProblem from dolfin/fem/NonlinearVariationalSolver.h:

class dolfin::NonlinearVariationalSolver::NonlinearDiscreteProblem
void dolfin::NonlinearVariationalSolver::NonlinearDiscreteProblem::F(GenericVector &b, const GenericVector &x)
Parameters:
  • b
  • x
void dolfin::NonlinearVariationalSolver::NonlinearDiscreteProblem::J(GenericMatrix &A, const GenericVector &x)
Parameters:
  • A
  • x
dolfin::NonlinearVariationalSolver::NonlinearDiscreteProblem::NonlinearDiscreteProblem(std::shared_ptr<const NonlinearVariationalProblem> problem, std::shared_ptr<const NonlinearVariationalSolver> solver)
Parameters:
  • problem
  • solver
dolfin::NonlinearVariationalSolver::NonlinearDiscreteProblem::~NonlinearDiscreteProblem()

PETScDMCollection

C++ documentation for PETScDMCollection from dolfin/fem/PETScDMCollection.h:

class dolfin::PETScDMCollection

This class builds and stores of collection of PETSc DM objects from a hierarchy of FunctionSpaces objects. The DM objects are used to construct multigrid solvers via PETSc. Warning: This classs is highly experimental and will change

dolfin::PETScDMCollection::PETScDMCollection(std::vector<std::shared_ptr<const FunctionSpace>> function_spaces)

Construct PETScDMCollection() from a vector of FunctionSpaces. The vector of FunctionSpaces is stored from coarse to fine.

Parameters:function_spaces
void dolfin::PETScDMCollection::check_ref_count() const

These are test/debugging functions that will be removed.

PetscErrorCode dolfin::PETScDMCollection::coarsen(DM dmf, MPI_Comm comm, DM *dmc)
Parameters:
  • dmf
  • comm
  • dmc
PetscErrorCode dolfin::PETScDMCollection::create_global_vector(DM dm, Vec *vec)
Parameters:
  • dm
  • vec
PetscErrorCode dolfin::PETScDMCollection::create_interpolation(DM dmc, DM dmf, Mat *mat, Vec *vec)
Parameters:
  • dmc
  • dmf
  • mat
  • vec
std::shared_ptr<PETScMatrix> dolfin::PETScDMCollection::create_transfer_matrix(const FunctionSpace &coarse_space, const FunctionSpace &fine_space)

Create the interpolation matrix from the coarse to the fine space (prolongation matrix)

Parameters:
  • coarse_space
  • fine_space
void dolfin::PETScDMCollection::find_exterior_points(MPI_Comm mpi_comm, std::shared_ptr<const BoundingBoxTree> treec, int dim, int data_size, const std::vector<double> &send_points, const std::vector<int> &send_indices, std::vector<int> &indices, std::vector<std::size_t> &cell_ids, std::vector<double> &points)
Parameters:
  • mpi_comm
  • treec
  • dim
  • data_size
  • send_points
  • send_indices
  • indices
  • cell_ids
  • points
DM dolfin::PETScDMCollection::get_dm(int i)

Return the ith DM objects. The coarest DM has index 0. Use i=-1 to get the DM for the finest level, i=-2 for the DM for the second finest level, etc.

Parameters:i
PetscErrorCode dolfin::PETScDMCollection::refine(DM dmc, MPI_Comm comm, DM *dmf)
Parameters:
  • dmc
  • comm
  • dmf
void dolfin::PETScDMCollection::reset(int i)

Debugging use - to be removed.

Parameters:i
dolfin::PETScDMCollection::~PETScDMCollection()

Destructor.

PointSource

C++ documentation for PointSource from dolfin/fem/PointSource.h:

class dolfin::PointSource

This class provides an easy mechanism for adding a point quantities (Dirac delta function) to variational problems. The associated function space must be scalar in order for the inner product with the (scalar) Dirac delta function to be well defined. For each of the constructors, Points passed to PointSource will be copied. Note: the interface to this class will likely change.

dolfin::PointSource::PointSource(std::shared_ptr<const FunctionSpace> V, const Point &p, double magnitude = 1.0)

Create point source at given point of given magnitude.

Parameters:
  • V
  • p
  • magnitude
dolfin::PointSource::PointSource(std::shared_ptr<const FunctionSpace> V, const std::vector<std::pair<const Point *, double>> sources)

Create point sources at given points of given magnitudes.

Parameters:
  • V
  • sources
dolfin::PointSource::PointSource(std::shared_ptr<const FunctionSpace> V0, std::shared_ptr<const FunctionSpace> V1, const Point &p, double magnitude = 1.0)

Create point source at given point of given magnitude.

Parameters:
  • V0
  • V1
  • p
  • magnitude
dolfin::PointSource::PointSource(std::shared_ptr<const FunctionSpace> V0, std::shared_ptr<const FunctionSpace> V1, const std::vector<std::pair<const Point *, double>> sources)

Create point sources at given points of given magnitudes.

Parameters:
  • V0
  • V1
  • sources
void dolfin::PointSource::apply(GenericMatrix &A)

Apply (add) point source to matrix.

Parameters:A
void dolfin::PointSource::apply(GenericVector &b)

Apply (add) point source to right-hand side vector.

Parameters:b
void dolfin::PointSource::check_space_supported(const FunctionSpace &V)
Parameters:V
void dolfin::PointSource::distribute_sources(const Mesh &mesh, const std::vector<std::pair<Point, double>> &sources)
Parameters:
  • mesh
  • sources
dolfin::PointSource::~PointSource()

Destructor.

SparsityPatternBuilder

C++ documentation for SparsityPatternBuilder from dolfin/fem/SparsityPatternBuilder.h:

class dolfin::SparsityPatternBuilder

This class provides functions to compute the sparsity pattern based on DOF maps

void dolfin::SparsityPatternBuilder::build(SparsityPattern &sparsity_pattern, const Mesh &mesh, const std::vector<const GenericDofMap *> dofmaps, bool cells, bool interior_facets, bool exterior_facets, bool vertices, bool diagonal, bool init = true, bool finalize = true)

Build sparsity pattern for assembly of given form.

Parameters:
  • sparsity_pattern
  • mesh
  • dofmaps
  • cells
  • interior_facets
  • exterior_facets
  • vertices
  • diagonal
  • init
  • finalize
void dolfin::SparsityPatternBuilder::build_multimesh_sparsity_pattern(SparsityPattern &sparsity_pattern, const MultiMeshForm &form)

Build sparsity pattern for assembly of given multimesh form.

Parameters:
  • sparsity_pattern
  • form

SystemAssembler

C++ documentation for SystemAssembler from dolfin/fem/SystemAssembler.h:

class dolfin::SystemAssembler

This class provides an assembler for systems of the form Ax = b. It differs from the default DOLFIN assembler in that it applies boundary conditions at the time of assembly, which preserves any symmetries in A.

dolfin::SystemAssembler::SystemAssembler(std::shared_ptr<const Form> a, std::shared_ptr<const Form> L, std::vector<std::shared_ptr<const DirichletBC>> bcs)

Constructor.

Parameters:
  • a
  • L
  • bcs
void dolfin::SystemAssembler::apply_bc(double *A, double *b, const std::vector<DirichletBC::Map> &boundary_values, const ArrayView<const dolfin::la_index> &global_dofs0, const ArrayView<const dolfin::la_index> &global_dofs1)
Parameters:
  • A
  • b
  • boundary_values
  • global_dofs0
  • global_dofs1
void dolfin::SystemAssembler::assemble(GenericMatrix &A)

Assemble matrix A.

Parameters:A
void dolfin::SystemAssembler::assemble(GenericMatrix &A, GenericVector &b)

Assemble system (A, b)

Parameters:
  • A
  • b
void dolfin::SystemAssembler::assemble(GenericMatrix &A, GenericVector &b, const GenericVector &x0)

Assemble system (A, b) for (negative) increment dx, where x = x0 - dx is solution to system a == -L subject to bcs. Suitable for use inside a (quasi-)Newton solver.

Parameters:
  • A
  • b
  • x0
void dolfin::SystemAssembler::assemble(GenericMatrix *A, GenericVector *b, const GenericVector *x0)
Parameters:
  • A
  • b
  • x0
void dolfin::SystemAssembler::assemble(GenericVector &b)

Assemble vector b.

Parameters:b
void dolfin::SystemAssembler::assemble(GenericVector &b, const GenericVector &x0)

Assemble rhs vector b for (negative) increment dx, where x = x0 - dx is solution to system a == -L subject to bcs. Suitable for use inside a (quasi-)Newton solver.

Parameters:
  • b
  • x0
bool dolfin::SystemAssembler::cell_matrix_required(const GenericTensor *A, const void *integral, const std::vector<DirichletBC::Map> &boundary_values, const ArrayView<const dolfin::la_index> &dofs)
Parameters:
  • A
  • integral
  • boundary_values
  • dofs
void dolfin::SystemAssembler::cell_wise_assembly(std::array<GenericTensor *, 2> &tensors, std::array<UFC *, 2> &ufc, Scratch &data, const std::vector<DirichletBC::Map> &boundary_values, std::shared_ptr<const MeshFunction<std::size_t>> cell_domains, std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains)
Parameters:
  • tensors
  • ufc
  • data
  • boundary_values
  • cell_domains
  • exterior_facet_domains
void dolfin::SystemAssembler::check_arity(std::shared_ptr<const Form> a, std::shared_ptr<const Form> L)
Parameters:
  • a
  • L
bool dolfin::SystemAssembler::check_functionspace_for_bc(std::shared_ptr<const FunctionSpace> fs, std::size_t bc_index)
Parameters:
  • fs
  • bc_index
void dolfin::SystemAssembler::compute_exterior_facet_tensor(std::array<std::vector<double>, 2> &Ae, std::array<UFC *, 2> &ufc, ufc::cell &ufc_cell, std::vector<double> &coordinate_dofs, const std::array<bool, 2> &tensor_required_cell, const std::array<bool, 2> &tensor_required_facet, const Cell &cell, const Facet &facet, const std::array<const ufc::cell_integral *, 2> &cell_integrals, const std::array<const ufc::exterior_facet_integral *, 2> &exterior_facet_integrals, const bool compute_cell_tensor)
Parameters:
  • Ae
  • ufc
  • ufc_cell
  • coordinate_dofs
  • tensor_required_cell
  • tensor_required_facet
  • cell
  • facet
  • cell_integrals
  • exterior_facet_integrals
  • compute_cell_tensor
void dolfin::SystemAssembler::compute_interior_facet_tensor(std::array<UFC *, 2> &ufc, std::array<ufc::cell, 2> &ufc_cell, std::array<std::vector<double>, 2> &coordinate_dofs, const std::array<bool, 2> &tensor_required_cell, const std::array<bool, 2> &tensor_required_facet, const std::array<Cell, 2> &cell, const std::array<std::size_t, 2> &local_facet, const bool facet_owner, const std::array<const ufc::cell_integral *, 2> &cell_integrals, const std::array<const ufc::interior_facet_integral *, 2> &interior_facet_integrals, const std::array<std::size_t, 2> &matrix_size, const std::size_t vector_size, const std::array<bool, 2> compute_cell_tensor)
Parameters:
  • ufc
  • ufc_cell
  • coordinate_dofs
  • tensor_required_cell
  • tensor_required_facet
  • cell
  • local_facet
  • facet_owner
  • cell_integrals
  • interior_facet_integrals
  • matrix_size
  • vector_size
  • compute_cell_tensor
void dolfin::SystemAssembler::facet_wise_assembly(std::array<GenericTensor *, 2> &tensors, std::array<UFC *, 2> &ufc, Scratch &data, const std::vector<DirichletBC::Map> &boundary_values, std::shared_ptr<const MeshFunction<std::size_t>> cell_domains, std::shared_ptr<const MeshFunction<std::size_t>> exterior_facet_domains, std::shared_ptr<const MeshFunction<std::size_t>> interior_facet_domains)
Parameters:
  • tensors
  • ufc
  • data
  • boundary_values
  • cell_domains
  • exterior_facet_domains
  • interior_facet_domains
bool dolfin::SystemAssembler::has_bc(const DirichletBC::Map &boundary_values, const ArrayView<const dolfin::la_index> &dofs)
Parameters:
  • boundary_values
  • dofs
void dolfin::SystemAssembler::matrix_block_add(GenericTensor &tensor, std::vector<double> &Ae, std::vector<double> &macro_A, const std::array<bool, 2> &add_local_tensor, const std::array<std::vector<ArrayView<const la_index>>, 2> &cell_dofs)
Parameters:
  • tensor
  • Ae
  • macro_A
  • add_local_tensor
  • cell_dofs

Scratch

C++ documentation for Scratch from dolfin/fem/SystemAssembler.h:

class dolfin::SystemAssembler::Scratch
std::array<std::vector<double>, 2> dolfin::SystemAssembler::Scratch::Ae
dolfin::SystemAssembler::Scratch::Scratch(const Form &a, const Form &L)
Parameters:
  • a
  • L
dolfin::SystemAssembler::Scratch::~Scratch()

UFC

C++ documentation for UFC from dolfin/fem/UFC.h:

class dolfin::UFC : public dolfin::Form

This class is a simple data structure that holds data used during assembly of a given UFC form. Data is created for each primary argument, that is, v_j for j < r. In addition, nodal basis expansion coefficients and a finite element are created for each coefficient function.

std::vector<double> dolfin::UFC::A

Local tensor.

std::vector<double> dolfin::UFC::A_facet

Local tensor.

dolfin::UFC::UFC(const Form &form)

Constructor.

Parameters:form
dolfin::UFC::UFC(const UFC &ufc)

Copy constructor.

Parameters:ufc
std::vector<std::shared_ptr<ufc::cell_integral>> dolfin::UFC::cell_integrals
std::vector<FiniteElement> dolfin::UFC::coefficient_elements
const std::vector<std::shared_ptr<const GenericFunction>> dolfin::UFC::coefficients
std::vector<std::shared_ptr<ufc::custom_integral>> dolfin::UFC::custom_integrals
std::vector<std::shared_ptr<ufc::cutcell_integral>> dolfin::UFC::cutcell_integrals
const Form &dolfin::UFC::dolfin_form

The form.

std::vector<std::shared_ptr<ufc::exterior_facet_integral>> dolfin::UFC::exterior_facet_integrals
const ufc::form &dolfin::UFC::form

Form .

ufc::cell_integral *dolfin::UFC::get_cell_integral(std::size_t domain)

Get cell integral over a given domain, falling back to the default if necessary

Parameters:domain
ufc::custom_integral *dolfin::UFC::get_custom_integral(std::size_t domain)

Get custom integral over a given domain, falling back to the default if necessary

Parameters:domain
ufc::cutcell_integral *dolfin::UFC::get_cutcell_integral(std::size_t domain)

Get cutcell integral over a given domain, falling back to the default if necessary

Parameters:domain
ufc::exterior_facet_integral *dolfin::UFC::get_exterior_facet_integral(std::size_t domain)

Get exterior facet integral over a given domain, falling back to the default if necessary

Parameters:domain
ufc::interface_integral *dolfin::UFC::get_interface_integral(std::size_t domain)

Get interface integral over a given domain, falling back to the default if necessary

Parameters:domain
ufc::interior_facet_integral *dolfin::UFC::get_interior_facet_integral(std::size_t domain)

Get interior facet integral over a given domain, falling back to the default if necessary

Parameters:domain
ufc::overlap_integral *dolfin::UFC::get_overlap_integral(std::size_t domain)

Get overlap integral over a given domain, falling back to the default if necessary

Parameters:domain
ufc::vertex_integral *dolfin::UFC::get_vertex_integral(std::size_t domain)

Get point integral over a given domain, falling back to the default if necessary

Parameters:domain
void dolfin::UFC::init(const Form &form)

Initialise memory.

Parameters:form
std::vector<std::shared_ptr<ufc::interface_integral>> dolfin::UFC::interface_integrals
std::vector<std::shared_ptr<ufc::interior_facet_integral>> dolfin::UFC::interior_facet_integrals
std::vector<double> dolfin::UFC::macro_A

Local tensor for macro element.

double **dolfin::UFC::macro_w()

Pointer to macro element coefficient data. Used to support UFC interface. Non-const version.

const double *const *dolfin::UFC::macro_w() const

Pointer to macro element coefficient data. Used to support UFC interface.

std::vector<double *> dolfin::UFC::macro_w_pointer
std::vector<std::shared_ptr<ufc::overlap_integral>> dolfin::UFC::overlap_integrals
void dolfin::UFC::update(const Cell &cell, const std::vector<double> &coordinate_dofs0, const ufc::cell &ufc_cell)

Update current cell (TODO: Remove this when PointIntegralSolver supports the version with enabled_coefficients)

Parameters:
  • cell
  • coordinate_dofs0
  • ufc_cell
void dolfin::UFC::update(const Cell &cell, const std::vector<double> &coordinate_dofs0, const ufc::cell &ufc_cell, const std::vector<bool> &enabled_coefficients)

Update current cell.

Parameters:
  • cell
  • coordinate_dofs0
  • ufc_cell
  • enabled_coefficients
void dolfin::UFC::update(const Cell &cell0, const std::vector<double> &coordinate_dofs0, const ufc::cell &ufc_cell0, const Cell &cell1, const std::vector<double> &coordinate_dofs1, const ufc::cell &ufc_cell1)

Update current pair of cells for macro element (TODO: Remove this when PointIntegralSolver supports the version with enabled_coefficients)

Parameters:
  • cell0
  • coordinate_dofs0
  • ufc_cell0
  • cell1
  • coordinate_dofs1
  • ufc_cell1
void dolfin::UFC::update(const Cell &cell0, const std::vector<double> &coordinate_dofs0, const ufc::cell &ufc_cell0, const Cell &cell1, const std::vector<double> &coordinate_dofs1, const ufc::cell &ufc_cell1, const std::vector<bool> &enabled_coefficients)

Update current pair of cells for macro element.

Parameters:
  • cell0
  • coordinate_dofs0
  • ufc_cell0
  • cell1
  • coordinate_dofs1
  • ufc_cell1
  • enabled_coefficients
std::vector<std::shared_ptr<ufc::vertex_integral>> dolfin::UFC::vertex_integrals
double **dolfin::UFC::w()

Pointer to coefficient data. Used to support UFC interface. None const version

const double *const *dolfin::UFC::w() const

Pointer to coefficient data. Used to support UFC interface.

std::vector<double *> dolfin::UFC::w_pointer
dolfin::UFC::~UFC()

Destructor.