DOLFIN-X
DOLFIN-X C++ interface
Public Member Functions | List of all members
dolfinx::fem::DirichletBC Class Reference

Interface for setting (strong) Dirichlet boundary conditions. More...

#include <DirichletBC.h>

Public Member Functions

 DirichletBC (const std::shared_ptr< const function::Function > &g, const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> &dofs)
 Create boundary condition. More...
 
 DirichletBC (const std::shared_ptr< const function::Function > &g, const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 2 >> &V_g_dofs, std::shared_ptr< const function::FunctionSpace > V)
 Create boundary condition. More...
 
 DirichletBC (const DirichletBC &bc)=default
 Copy constructor. More...
 
 DirichletBC (DirichletBC &&bc)=default
 Move constructor. More...
 
 ~DirichletBC ()=default
 Destructor.
 
DirichletBCoperator= (const DirichletBC &bc)=default
 Assignment operator. More...
 
DirichletBCoperator= (DirichletBC &&bc)=default
 Move assignment operator.
 
std::shared_ptr< const function::FunctionSpacefunction_space () const
 The function space to which boundary conditions are applied. More...
 
std::shared_ptr< const function::Functionvalue () const
 Return boundary value function g. More...
 
const Eigen::Array< std::int32_t, Eigen::Dynamic, 2 > & dofs () const
 Get array of dof indices to which a Dirichlet boundary condition is applied. The array is sorted and may contain ghost entries.
 
const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 2 > > dofs_owned () const
 Get array of dof indices owned by this process to which a Dirichlet BC is applied. The array is sorted and does not contain ghost entries.
 
void set (Eigen::Ref< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >> x, double scale=1.0) const
 Set bc entries in x to scale*x_bc. More...
 
void set (Eigen::Ref< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >> x, const Eigen::Ref< const Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >> &x0, double scale=1.0) const
 Set bc entries in x to scale*(x0 - x_bc). More...
 
void dof_values (Eigen::Ref< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >> values) const
 Set boundary condition value for entres with an applied boundary condition. Other entries are not modified. More...
 
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...
 

Detailed Description

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 degrees of freedom to which the boundary condition applies.

Constructor & Destructor Documentation

◆ DirichletBC() [1/4]

DirichletBC::DirichletBC ( const std::shared_ptr< const function::Function > &  g,
const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 1 >> &  dofs 
)

Create boundary condition.

Parameters
[in]gThe boundary condition value. The boundary condition can be applied to a a function on the same space as g.
[in]dofsDegree-of-freedom indices in the space of the boundary value function applied to V_dofs[i]

◆ DirichletBC() [2/4]

DirichletBC::DirichletBC ( const std::shared_ptr< const function::Function > &  g,
const Eigen::Ref< const Eigen::Array< std::int32_t, Eigen::Dynamic, 2 >> &  V_g_dofs,
std::shared_ptr< const function::FunctionSpace V 
)

Create boundary condition.

Parameters
[in]gThe boundary condition value
[in]V_g_dofs2D array of degree-of-freedom indices. First column are indices in the space where boundary condition is applied (V), second column are indices in the space of the boundary condition value function g.
[in]VThe function (sub)space on which the boundary condition is applied

◆ DirichletBC() [3/4]

dolfinx::fem::DirichletBC::DirichletBC ( const DirichletBC bc)
default

Copy constructor.

Parameters
[in]bcThe object to be copied

◆ DirichletBC() [4/4]

dolfinx::fem::DirichletBC::DirichletBC ( DirichletBC &&  bc)
default

Move constructor.

Parameters
[in]bcThe object to be moved

Member Function Documentation

◆ dof_values()

void DirichletBC::dof_values ( Eigen::Ref< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >>  values) const

Set boundary condition value for entres with an applied boundary condition. Other entries are not modified.

Todo:
Clarify w.r.t ghosts

◆ function_space()

std::shared_ptr< const function::FunctionSpace > DirichletBC::function_space ( ) const

The function space to which boundary conditions are applied.

Returns
The function space

◆ mark_dofs()

void DirichletBC::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.

Todo:
Clarify w.r.t ghosts

◆ operator=()

DirichletBC& dolfinx::fem::DirichletBC::operator= ( const DirichletBC bc)
default

Assignment operator.

Parameters
[in]bcAnother DirichletBC object

◆ set() [1/2]

void DirichletBC::set ( Eigen::Ref< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >>  x,
const Eigen::Ref< const Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >> &  x0,
double  scale = 1.0 
) const

Set bc entries in x to scale*(x0 - x_bc).

Todo:
Clarify w.r.t ghosts

◆ set() [2/2]

void DirichletBC::set ( Eigen::Ref< Eigen::Matrix< PetscScalar, Eigen::Dynamic, 1 >>  x,
double  scale = 1.0 
) const

Set bc entries in x to scale*x_bc.

Todo:
Clarify w.r.t ghosts

◆ value()

std::shared_ptr< const function::Function > DirichletBC::value ( ) const

Return boundary value function g.

Returns
The boundary values Function

The documentation for this class was generated from the following files: