Form¶
-
class
dolfin.cpp.fem.
Form
(*args)¶ Bases:
dolfin.cpp.fem.HierarchicalForm
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). ///
Create form (shared data)
Parameters: - const ufc::form > ufc_form (std::shared_ptr<) – (ufc::form) The
UFC
form. [direction=in] - std::shared_ptr< const FunctionSpace >> function_spaces (std::vector<) – (std::vector<
FunctionSpace
>)Vector
of function spaces. [direction=in]
-
cell_domains
()¶ Return cell domains (zero pointer if no domains have been specified)
Return type: std::shared_ptr< const MeshFunction< std::size_t > > Returns: MeshFunction
<std::size_t> The cell domains.
-
check
()¶ Check function spaces and coefficients.
Return type: void
-
coefficient
()¶ Return coefficient with given number
Parameters: i (std::size_t) – (std::size_t) Index [direction=in] Return type: std::shared_ptr< const GenericFunction > Returns: GenericFunction
The coefficient.
-
coefficient_name
()¶ Return the name of the coefficient with this number
Parameters: i (std::size_t) – (std::size_t) The number [direction=in] Return type: std::string Returns: std::string The name of the coefficient with the given number.
-
coefficient_number
()¶ Return the number of the coefficient with this name
Parameters: std::string & name (const) – (std::string) The name. [direction=in] Return type: std::size_t Returns: std::size_t The number of the coefficient with the given name.
-
coefficients
()¶ Return all coefficients
Return type: std::vector< std::shared_ptr< const GenericFunction > > Returns: std::vector< GenericFunction
> All coefficients.
-
coloring
()¶ Return coloring type for colored assembly of form over a mesh entity of a given dimension
Parameters: entity_dim (std::size_t) – (std::size_t) Dimension. [direction=in] Return type: std::vector< std::size_t > Returns: std::vector<std::size_t> Coloring type.
-
exterior_facet_domains
()¶ Return exterior facet domains (zero pointer if no domains have been specified)
Return type: std::shared_ptr< const MeshFunction< std::size_t > > Returns: std::shared_ptr< MeshFunction
<std::size_t>> The exterior facet domains.
-
function_space
(i)¶ Return function space for given argument
- Arguments
- i (std::size_t)
- Index
- Returns
- _FunctionSpace_
- Function space shared pointer.
-
function_spaces
()¶ Return function spaces for arguments
Return type: std::vector< std::shared_ptr< const FunctionSpace > > Returns: std::vector< FunctionSpace
>Vector
of function space shared pointers.
-
interior_facet_domains
()¶ Return interior facet domains (zero pointer if no domains have been specified)
Return type: std::shared_ptr< const MeshFunction< std::size_t > > Returns: MeshFunction
<std::size_t> The interior facet domains.
-
mesh
()¶ Extract common mesh from form
Return type: std::shared_ptr< const Mesh > Returns: Mesh
Shared pointer to the mesh.
-
num_coefficients
()¶ Return number of coefficients
Return type: std::size_t Returns: std::size_t The number of coefficients.
-
original_coefficient_position
()¶ Return original coefficient position for each coefficient (0 <= i < n)
Parameters: i (std::size_t) – Return type: std::size_t Returns: std::size_t The position of coefficient i in original ufl form coefficients.
-
rank
()¶ Return rank of form (bilinear form = 2, linear form = 1, functional = 0, etc)
Return type: std::size_t Returns: std::size_t The rank of the form.
-
set_cell_domains
()¶ Set
cell domainsParameters: const MeshFunction< std::size_t >> cell_domains (std::shared_ptr<) – ( MeshFunction
<std::size_t>) The cell domains. [direction=in]Return type: void
-
set_coefficient
()¶ Set
coefficient with given number (shared pointer version)Parameters: - i (std::size_t) – (std::size_t) The given number. [direction=in]
- const GenericFunction > coefficient (std::shared_ptr<) – (
GenericFunction
) The coefficient. [direction=in]
Return type: void
-
set_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: std::string, std::shared_ptr< const GenericFunction >> coefficients (std::map<) – (std::map<std::string, GenericFunction
>) The map of coefficients. [direction=in]Return type: void
-
set_exterior_facet_domains
()¶ Set
exterior facet domainsParameters: const MeshFunction< std::size_t >> exterior_facet_domains (std::shared_ptr<) – ( MeshFunction
<std::size_t>) The exterior facet domains. [direction=in]Return type: void
-
set_interior_facet_domains
()¶ Set
interior facet domainsParameters: const MeshFunction< std::size_t >> interior_facet_domains (std::shared_ptr<) – ( MeshFunction
<std::size_t>) The interior facet domains. [direction=in]Return type: void
-
set_mesh
()¶ Set
mesh, necessary for functionals when there are no function spacesParameters: const Mesh > mesh (std::shared_ptr<) – ( Mesh
) The mesh. [direction=in]Return type: void
-
set_some_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: std::string, std::shared_ptr< const GenericFunction >> coefficients (std::map<) – (std::map<std::string, GenericFunction
>) The map of coefficients. [direction=in]Return type: void
-
set_vertex_domains
()¶ Set
vertex domainsParameters: const MeshFunction< std::size_t >> vertex_domains (std::shared_ptr<) – ( MeshFunction
<std::size_t>) The vertex domains. [direction=in]Return type: void
-
thisown
¶ The membership flag
-
ufc_form
()¶ Return
UFC
form shared pointerReturn type: std::shared_ptr< const ufc::form > Returns: ufc::form The UFC
form.
-
vertex_domains
()¶ Return vertex domains (zero pointer if no domains have been specified)
Return type: std::shared_ptr< const MeshFunction< std::size_t > > Returns: MeshFunction
<std::size_t> The vertex domains.
- const ufc::form > ufc_form (std::shared_ptr<) – (ufc::form) The