OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
BCHandler< Dim > Class Template Reference

Handler for boundary conditions per spatial dimension. More...

#include <BCHandler.hpp>

Collaboration diagram for BCHandler< Dim >:
Collaboration graph

Public Types

enum  BCType { OPEN , PERIODIC , DIRICHLET }
 Supported boundary condition types. More...
 

Public Member Functions

 BCHandler (const BCHandler &other)=default
 Defaulted copy constructor.
 
template<typename... Bcs>
 BCHandler (Bcs... bcs)
 Variadic constructor accepting exactly Dim BC values.
 
bool isAll (BCType bc_type) const
 Return true if every stored BC equals bc_type.
 
bool isAllEqual () const
 Check whether all stored BCs are equal (all the same value).
 
template<typename Field >
ippl::BConds< Field, DimtoIPPLBConds () const
 

Static Public Member Functions

static BCType strToBCType (const std::string &str)
 Convert a textual boundary-condition name to BCType enum.
 

Private Attributes

std::array< BCType, Dimbcs_m
 Internal storage of boundary conditions, one per dimension.
 

Friends

std::ostream & operator<< (std::ostream &os, const BCHandler &h)
 Stream output helper for debugging and logging.
 

Detailed Description

template<unsigned Dim>
class BCHandler< Dim >

Handler for boundary conditions per spatial dimension.

BCHandler<Dim> stores a boundary-condition type for each of the Dim dimensions. It offers simple construction, string-to-enum parsing, and some basic functionality used in the field container environment.

Usage examples:

Template Parameters
DimNumber of spatial dimensions.
Note
This class is currently not designed to be used on device.
Examples
/home/runner/work/PhysicsManual/PhysicsManual/.external/OPALX/src/PartBunch/BCHandler.hpp.

Definition at line 29 of file BCHandler.hpp.

Member Enumeration Documentation

◆ BCType

template<unsigned Dim>
enum BCHandler::BCType

Supported boundary condition types.

  • OPEN: non-periodic/open boundary.
  • PERIODIC: periodic boundary across the corresponding dimension.
  • DIRICHLET: fixed potential (zero for now) at the boundary.
Note
This enum needs to be updated should there be other supported BC types in the future (DIRICHLET!).
Enumerator
OPEN 
PERIODIC 
DIRICHLET 
Examples
/home/runner/work/PhysicsManual/PhysicsManual/.external/OPALX/src/PartBunch/BCHandler.hpp.

Definition at line 41 of file BCHandler.hpp.

Constructor & Destructor Documentation

◆ BCHandler() [1/2]

template<unsigned Dim>
BCHandler< Dim >::BCHandler ( const BCHandler< Dim > &  other)
default

Defaulted copy constructor.

◆ BCHandler() [2/2]

template<unsigned Dim>
template<typename... Bcs>
BCHandler< Dim >::BCHandler ( Bcs...  bcs)
inline

Variadic constructor accepting exactly Dim BC values.

Each argument should be convertible to BCType. The constructor validates that the number of provided BCs equals Dim and throws an OpalException otherwise.

Template Parameters
BcsVariadic parameter pack type.
Parameters
bcsBoundary condition values for each dimension.
Exceptions
OpalExceptionwhen the number of provided BCs != Dim.

Definition at line 85 of file BCHandler.hpp.

Member Function Documentation

◆ isAll()

template<unsigned Dim>
bool BCHandler< Dim >::isAll ( BCType  bc_type) const
inline

Return true if every stored BC equals bc_type.

Parameters
bc_typeBoundary condition value to compare against.
Returns
true if all dimensions have bc_type, otherwise false.
Examples
/home/runner/work/PhysicsManual/PhysicsManual/.external/OPALX/src/PartBunch/BCHandler.hpp.

Definition at line 98 of file BCHandler.hpp.

References Dim.

Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ isAllEqual()

template<unsigned Dim>
bool BCHandler< Dim >::isAllEqual ( ) const
inline

Check whether all stored BCs are equal (all the same value).

This function is necesary, since current IPPL does not support mixed BCs, so this consistency check validates user input.

Returns
true when every element in the internal array equals the first element.
Examples
/home/runner/work/PhysicsManual/PhysicsManual/.external/OPALX/src/PartBunch/BCHandler.hpp.

Definition at line 114 of file BCHandler.hpp.

References Dim.

Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ strToBCType()

template<unsigned Dim>
static BCType BCHandler< Dim >::strToBCType ( const std::string &  str)
inlinestatic

Convert a textual boundary-condition name to BCType enum.

Currently recognised strings are "OPEN", "PERIODIC", and "DIRICHLET". The strings come from the pre-defined strings in the FieldSolverCmd class. If these don't match, you might get an exception during current FieldSolver construction.

Parameters
strInput string representing the boundary condition.
Returns
Corresponding BCType value.
Exceptions
OpalExceptionif the string does not match an implemented BC type.
Examples
/home/runner/work/PhysicsManual/PhysicsManual/.external/OPALX/src/PartBunch/BCHandler.hpp.

Definition at line 55 of file BCHandler.hpp.

References BCHandler< Dim >::DIRICHLET, BCHandler< Dim >::OPEN, and BCHandler< Dim >::PERIODIC.

Referenced by TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ toIPPLBConds()

template<unsigned Dim>
template<typename Field >
ippl::BConds< Field, Dim > BCHandler< Dim >::toIPPLBConds ( ) const
inline

Friends And Related Symbol Documentation

◆ operator<<

template<unsigned Dim>
std::ostream & operator<< ( std::ostream &  os,
const BCHandler< Dim > &  h 
)
friend

Stream output helper for debugging and logging.

Produces a compact, human-readable representation such as: * BCHandler<3>: [OPEN, PERIODIC, OPEN].

Examples
/home/runner/work/PhysicsManual/PhysicsManual/.external/OPALX/src/PartBunch/BCHandler.hpp.

Definition at line 128 of file BCHandler.hpp.

Member Data Documentation

◆ bcs_m

template<unsigned Dim>
std::array<BCType, Dim> BCHandler< Dim >::bcs_m
private

Internal storage of boundary conditions, one per dimension.

Examples
/home/runner/work/PhysicsManual/PhysicsManual/.external/OPALX/src/PartBunch/BCHandler.hpp.

Definition at line 202 of file BCHandler.hpp.


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