|
template<typename S , typename X , typename = std::enable_if_t<std::is_convertible_v<S, T> or std::is_convertible_v<S, std::span<const T>>>>
requires std::is_convertible_v<std::remove_cvref_t<X>, std::vector<std::int32_t>> |
| DirichletBC (const S &g, X &&dofs, std::shared_ptr< const FunctionSpace< U > > V) |
| Create a representation of a Dirichlet boundary condition constrained by a scalar- or vector-valued constant.
|
|
template<typename X >
requires std::is_convertible_v<std::remove_cvref_t<X>, std::vector<std::int32_t>> |
| DirichletBC (std::shared_ptr< const Constant< T > > g, X &&dofs, std::shared_ptr< const FunctionSpace< U > > V) |
| Create a representation of a Dirichlet boundary condition constrained by a fem::Constant.
|
|
template<typename X >
requires std::is_convertible_v<std::remove_cvref_t<X>, std::vector<std::int32_t>> |
| DirichletBC (std::shared_ptr< const Function< T, U > > g, X &&dofs) |
| Create a representation of a Dirichlet boundary condition where the space being constrained is the same as the function that defines the constraint Function, i.e. share the same fem::FunctionSpace.
|
|
template<typename X > |
| DirichletBC (std::shared_ptr< const Function< T, U > > g, X &&V_g_dofs, std::shared_ptr< const FunctionSpace< U > > 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 fem::FunctionSpace.
|
|
| DirichletBC (const DirichletBC &bc)=default |
| Copy constructor.
|
|
| DirichletBC (DirichletBC &&bc)=default |
| Move constructor.
|
|
| ~DirichletBC ()=default |
| Destructor.
|
|
DirichletBC & | operator= (const DirichletBC &bc)=default |
| Assignment operator.
|
|
DirichletBC & | operator= (DirichletBC &&bc)=default |
| Move assignment operator.
|
|
std::shared_ptr< const FunctionSpace< U > > | function_space () const |
| The function space to which boundary conditions are applied.
|
|
std::variant< std::shared_ptr< const Function< T, U > >, std::shared_ptr< const Constant< T > > > | value () const |
| Return boundary value function g.
|
|
std::pair< std::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.
|
|
void | set (std::span< T > x, T scale=1) const |
| Set bc entries in x to scale * x_bc
|
|
void | set (std::span< T > x, std::span< const T > x0, T scale=1) const |
| Set bc entries in x to scale * (x0 - x_bc)
|
|
void | dof_values (std::span< T > values) const |
|
void | mark_dofs (std::span< std::int8_t > markers) const |
| Set markers[i] = true if dof i has a boundary condition applied. Value of markers[i] is not changed otherwise.
|
|
template<
dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
class dolfinx::fem::DirichletBC< T, U >
Object 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.
template<
dolfinx::scalar T, std::floating_point U = dolfinx::scalar_value_type_t<T>>
template<typename S , typename X , typename = std::enable_if_t<std::is_convertible_v<S, T> or std::is_convertible_v<S, std::span<const T>>>>
requires std::is_convertible_v<std::remove_cvref_t<X>, std::vector<std::int32_t>>
Create a representation of a Dirichlet boundary condition constrained by a scalar- or vector-valued constant.
- Precondition
dofs
must be sorted.
- Parameters
-
[in] | g | The boundary condition value (T or convertible to std::span<const T> ) |
[in] | dofs | Degree-of-freedom block indices to be constrained. The indices must be sorted. |
[in] | V | The function space to be constrained |
- Note
- Can be used only with point-evaluation elements.
-
The indices in
dofs
are for blocks, e.g. a block index corresponds to 3 degrees-of-freedom if the dofmap associated with g
has block size 3.
-
The size of of
g
must be equal to the block size if V
. Use the Function version if this is not the case, e.g. for some mixed spaces.