DOLFINx
0.1.0
DOLFINx C++ interface
|
Interface for setting (strong) Dirichlet boundary conditions. More...
#include <DirichletBC.h>
Public Member Functions | |
template<typename U > | |
DirichletBC (const std::shared_ptr< const fem::Function< T >> &g, U &&dofs) | |
Create a representation of a Dirichlet boundary condition where the space being constrained is the same as the function that defines the constraint values, i.e. share the same FunctionSpace . More... | |
DirichletBC (const std::shared_ptr< const fem::Function< T >> &g, const std::array< std::vector< std::int32_t >, 2 > &V_g_dofs, std::shared_ptr< const fem::FunctionSpace > V) | |
Create a representation of a Dirichlet boundary condition where the space being constrained and the function that defines the constraint values do not share the same FunctionSpace . A typical examples is when applying a constraint on a subspace. The (sub)space and the constrain function must have the same finite element. More... | |
DirichletBC (const DirichletBC &bc)=default | |
Copy constructor. More... | |
DirichletBC (DirichletBC &&bc)=default | |
Move constructor. More... | |
~DirichletBC ()=default | |
Destructor. | |
DirichletBC & | operator= (const DirichletBC &bc)=default |
Assignment operator. More... | |
DirichletBC & | operator= (DirichletBC &&bc)=default |
Move assignment operator. | |
std::shared_ptr< const fem::FunctionSpace > | function_space () const |
The function space to which boundary conditions are applied. More... | |
std::shared_ptr< const fem::Function< T > > | value () const |
Return boundary value function g. More... | |
std::pair< xtl::span< const std::int32_t >, std::int32_t > | dof_indices () const |
Access dof indices (local indices, unrolled), including ghosts, to which a Dirichlet condition is applied, and the index to the first non-owned (ghost) index. The array of indices is sorted. More... | |
void | set (xtl::span< T > x, double scale=1.0) const |
Set bc entries in x to scale * x_bc More... | |
void | set (xtl::span< T > x, const xtl::span< const T > &x0, double scale=1.0) const |
Set bc entries in x to scale * (x0 - x_bc) More... | |
void | dof_values (xtl::span< T > values) const |
void | mark_dofs (std::vector< bool > &markers) const |
Set markers[i] = true if dof i has a boundary condition applied. Value of markers[i] is not changed otherwise. More... | |
Interface for setting (strong) Dirichlet boundary conditions.
\(u = g \ \text{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 degrees of freedom to which the boundary condition applies.
|
inline |
Create a representation of a Dirichlet boundary condition where the space being constrained is the same as the function that defines the constraint values, i.e. share the same FunctionSpace
.
[in] | g | The boundary condition value. The boundary condition can be applied to a function on the same space as g. |
[in] | dofs | Degree-of-freedom block indices (std::vector<std::int32_t> ) in the space of the boundary value function applied to V_dofs[i]. The dof block indices must be sorted. |
dofs
are for blocks, e.g. a block index maps to 3 degrees-of-freedom if the dofmap associated with g
has block size 3
|
inline |
Create a representation of a Dirichlet boundary condition where the space being constrained and the function that defines the constraint values do not share the same FunctionSpace
. A typical examples is when applying a constraint on a subspace. The (sub)space and the constrain function must have the same finite element.
[in] | g | The boundary condition value |
[in] | V_g_dofs | Two arrays of degree-of-freedom indices. First array are indices in the space where boundary condition is applied (V), second array are indices in the space of the boundary condition value function g. The arrays must be sorted by the indices in the first array. The dof indices are unrolled, i.e. are not by dof block. |
[in] | V | The function (sub)space on which the boundary condition is applied |
dofs
are unrolled and not for blocks
|
default |
Copy constructor.
[in] | bc | The object to be copied |
|
default |
Move constructor.
[in] | bc | The object to be moved |
|
inline |
Access dof indices (local indices, unrolled), including ghosts, to which a Dirichlet condition is applied, and the index to the first non-owned (ghost) index. The array of indices is sorted.
dofs[:pos]
are owned and entries dofs[pos:]
are ghosts.
|
inline |
Set boundary condition value for entries with an applied boundary condition. Other entries are not modified.
[in,out] | values | The array in which to set the dof values. The array must be at least as long as the array associated with V1 (the space of the function that provides the dof values) |
|
inline |
The function space to which boundary conditions are applied.
|
inline |
Set markers[i] = true if dof i has a boundary condition applied. Value of markers[i] is not changed otherwise.
[in,out] | markers | Entry makers[i] is set to true if dof i in V0 had a boundary condition applied, i.e. dofs which are fixed by a boundary condition. Other entries in markers are left unchanged. |
|
default |
Assignment operator.
[in] | bc | Another DirichletBC object |
|
inline |
Set bc entries in x
to scale * (x0 - x_bc)
[in] | x | The array in which to set scale * (x0 - x_bc) |
[in] | x0 | The array used in compute the value to set |
[in] | scale | The scaling value to apply |
|
inline |
Set bc entries in x
to scale * x_bc
[in] | x | The array in which to set scale * x_bc[i] , where x_bc[i] is the boundary value of x[i]. Entries in x that do not have a Dirichlet condition applied to them are unchanged. The length of x must be less than or equal to the index of the greatest boundary dof index. To set values only for degrees-of-freedom that are owned by the calling rank, the length of the array x should be equal to the number of dofs owned by this rank. |
[in] | scale | The scaling value to apply |
|
inline |
Return boundary value function g.