BoundaryConditionManager< dim, number > Class Template Reference

Developer Documentation: MeltPoolDG::BoundaryConditionManager< dim, number > Class Template Reference
Developer Documentation
MeltPoolDG::BoundaryConditionManager< dim, number > Class Template Reference

#include <boundary_conditions.hpp>

Public Member Functions

void attach_boundary_condition (std::pair< const dealii::types::boundary_id, const std::shared_ptr< dealii::Function< dim > > > id_and_function, const std::string &type)
 Attach a boundary condition to the manager.
 
void set_time (const number time)
 Set the time for all time-dependent boundary conditions.
 
std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > get_bc_of_type (const std::string type, const bool is_optional=true) const
 Retrieve all boundary conditions of a specific type.
 
std::vector< dealii::types::boundary_id > get_indices_of_type (const std::string type, const bool is_optional=true) const
 Get all boundary IDs associated with a specific type.
 
std::string get_type (dealii::types::boundary_id id, const bool is_optional=true) const
 Retrieve the type of a boundary condition by its ID.
 

Private Attributes

std::map< std::string, std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > > bc
 Nested map for storing boundary conditions.
 

Member Function Documentation

◆ attach_boundary_condition()

template<int dim, typename number >
void MeltPoolDG::BoundaryConditionManager< dim, number >::attach_boundary_condition ( std::pair< const dealii::types::boundary_id, const std::shared_ptr< dealii::Function< dim > > >  id_and_function,
const std::string &  type 
)
inline

Attach a boundary condition to the manager.

Adds a boundary condition specified by its type, boundary ID, and function. Ensures that no duplicate boundary conditions are assigned to the same ID for the same type.

Parameters
id_and_functionA pair consisting of:
  • dealii::types::boundary_id: The unique ID for the boundary.
  • std::shared_ptr<dealii::Function<dim>>: A shared pointer to the function defining the boundary condition.
typeThe type of the boundary condition (e.g., "dirichlet", "neumann").
Exceptions
ExcBCAlreadyAssignedIf a boundary condition is already assigned to the given ID and type.

◆ get_bc_of_type()

template<int dim, typename number >
std::map< dealii::types::boundary_id, std::shared_ptr< dealii::Function< dim > > > MeltPoolDG::BoundaryConditionManager< dim, number >::get_bc_of_type ( const std::string  type,
const bool  is_optional = true 
) const
inline

Retrieve all boundary conditions of a specific type.

Provides access to the boundary conditions associated with a given type.

Parameters
typeThe type of the boundary conditions to retrieve.
is_optionalA flag indicating whether the bc is optional. Defaults to true, requiring the bc not to be present.
Returns
A map of boundary IDs to their corresponding functions.
Exceptions
dealii::ExcMessageIf the specified type does not exist in the manager.

◆ get_indices_of_type()

template<int dim, typename number >
std::vector< dealii::types::boundary_id > MeltPoolDG::BoundaryConditionManager< dim, number >::get_indices_of_type ( const std::string  type,
const bool  is_optional = true 
) const
inline

Get all boundary IDs associated with a specific type.

Retrieves a list of boundary IDs for a given type of boundary condition.

Parameters
typeThe type of the boundary conditions.
is_optionalA flag indicating whether the bc is optional. Defaults to true, requiring the bc not to be present.
Returns
A vector of boundary IDs (dealii::types::boundary_id) associated with the given type.

◆ get_type()

template<int dim, typename number >
std::string MeltPoolDG::BoundaryConditionManager< dim, number >::get_type ( dealii::types::boundary_id  id,
const bool  is_optional = true 
) const
inline

Retrieve the type of a boundary condition by its ID.

This function searches through the boundary condition manager to find a boundary condition matching the specified ID and returns its associated type. If the ID is not found, the behavior depends on the is_optional flag:

  • If is_optional is true, the function returns an empty string.
  • If is_optional is false, the function throws an exception.
Parameters
idThe boundary ID to search for.
is_optionalA flag indicating whether the boundary condition ID is optional.
  • If true, the function returns an empty string if the ID is not found.
  • If false, the function throws an exception if the ID is not found.

◆ set_time()

template<int dim, typename number >
void MeltPoolDG::BoundaryConditionManager< dim, number >::set_time ( const number  time)
inline

Set the time for all time-dependent boundary conditions.

Updates the time for all boundary conditions that are associated with functions supporting time-dependent behavior.

Parameters
timeThe current simulation time.

Member Data Documentation

◆ bc

template<int dim, typename number >
std::map<std::string, std::map<dealii::types::boundary_id, std::shared_ptr<dealii::Function<dim> > > > MeltPoolDG::BoundaryConditionManager< dim, number >::bc
private

Nested map for storing boundary conditions.

The map structure is organized as:

  • bc[<type>][<id>] = <function>
    • <type>: A string representing the type of the boundary condition (e.g., "dirichlet", "Neumann").
    • <id>: A unique boundary identifier of type dealii::types::boundary_id.
    • <function>: A shared pointer to a Function<dim> object that defines the behavior of the boundary condition.

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