MADNESS 0.10.1
madness::BoundaryConditions< NDIM > Class Template Reference

This class is used to specify boundary conditions for all operators. More...

#include <bc.h>

Public Member Functions

 BoundaryConditions (BCType code=BC_FREE)
 Constructor. Default boundary condition set to free space.
 BoundaryConditions (const BoundaryConditions< NDIM > &other)
 Copy constructor is deep.
template<std::size_t N = NDIM, typename = std::enable_if_t<N!=0>>
 BoundaryConditions (const std::array< BCType, N *2 > &bc_per_boundary)
 Constructor sets boundary condition per boundary.
template<std::size_t N = NDIM, typename = std::enable_if_t<N!=0>>
 BoundaryConditions (const std::array< BCType, N > &bc_per_axis)
 Constructor sets boundary condition per axis.
template<std::size_t ND = NDIM>
std::enable_if_t< ND<=NDIM, array_of_bools< ND > > is_periodic () const
 Convenience for application of integral operators.
bool is_periodic_all () const
 Checks whether the boundary condition along all axes is periodic.
bool is_periodic_any () const
 Checks whether the boundary condition along any axis is periodic.
std::array< LatticeRange, NDIM > lattice_range () const
template<std::size_t ND = NDIM>
std::enable_if_t< ND<=NDIM, std::array< KernelRange, ND > > make_range (unsigned int r, std::optional< double > sigma={}) const
 Convenience for construction of range-restricted integral operators.
std::vector< KernelRange > make_range_vector (unsigned int r, std::optional< double > sigma={}) const
 Convenience for construction of range-restricted integral operators.
BCType & operator() (std::size_t d, int i)
 Returns reference to boundary condition.
BCType operator() (std::size_t d, int i) const
 Returns value of boundary condition.
BoundaryConditions< NDIM > & operator= (const BoundaryConditions< NDIM > &other)
 Assignment makes deep copy.
template<typename Archive>
void serialize (const Archive &ar)

Static Public Member Functions

static const char * code_as_string (BCType code)
 Translates code into human readable string.

Private Attributes

BCType bc [NDIM *2]

Detailed Description

template<std::size_t NDIM>
class madness::BoundaryConditions< NDIM >

This class is used to specify boundary conditions for all operators.

Exterior boundary conditions (i.e., on the simulation domain) are associated with operators (not functions). The types of boundary conditions available are in the enum BCType.

The default boundary conditions are obtained from the FunctionDefaults. For non-zero Dirichlet and Neumann conditions additional information must be provided when derivative operators are constructed. For integral operators, only periodic and free space are supported.

Constructor & Destructor Documentation

◆ BoundaryConditions() [1/4]

template<std::size_t NDIM>
madness::BoundaryConditions< NDIM >::BoundaryConditions ( BCType code = BC_FREE)
inline

Constructor. Default boundary condition set to free space.

References bc, madness::BC_FREE, and NDIM.

Referenced by BoundaryConditions(), and operator=().

◆ BoundaryConditions() [2/4]

template<std::size_t NDIM>
template<std::size_t N = NDIM, typename = std::enable_if_t<N!=0>>
madness::BoundaryConditions< NDIM >::BoundaryConditions ( const std::array< BCType, N > & bc_per_axis)
inline

Constructor sets boundary condition per axis.

References bc, and NDIM.

◆ BoundaryConditions() [3/4]

template<std::size_t NDIM>
template<std::size_t N = NDIM, typename = std::enable_if_t<N!=0>>
madness::BoundaryConditions< NDIM >::BoundaryConditions ( const std::array< BCType, N *2 > & bc_per_boundary)
inline

Constructor sets boundary condition per boundary.

References bc, and NDIM.

◆ BoundaryConditions() [4/4]

template<std::size_t NDIM>
madness::BoundaryConditions< NDIM >::BoundaryConditions ( const BoundaryConditions< NDIM > & other)
inline

Copy constructor is deep.

References BoundaryConditions().

Member Function Documentation

◆ code_as_string()

template<std::size_t NDIM>
const char * madness::BoundaryConditions< NDIM >::code_as_string ( BCType code)
inlinestatic

Translates code into human readable string.

Parameters
codeCode for boundary condition
Returns
String describing boundary condition code

◆ is_periodic()

template<std::size_t NDIM>
template<std::size_t ND = NDIM>
std::enable_if_t< ND<=NDIM, array_of_bools< ND > > madness::BoundaryConditions< NDIM >::is_periodic ( ) const
inline

Convenience for application of integral operators.

Returns
Returns a vector indicating if dimensions [0, ND) are periodic

References bc, madness::BC_PERIODIC, d, MADNESS_ASSERT, and v.

Referenced by lattice_range().

◆ is_periodic_all()

template<std::size_t NDIM>
bool madness::BoundaryConditions< NDIM >::is_periodic_all ( ) const
inline

Checks whether the boundary condition along all axes is periodic.

Returns
Returns true if every dimension is periodic

References bc, madness::BC_PERIODIC, d, MADNESS_ASSERT, and NDIM.

◆ is_periodic_any()

template<std::size_t NDIM>
bool madness::BoundaryConditions< NDIM >::is_periodic_any ( ) const
inline

Checks whether the boundary condition along any axis is periodic.

Returns
Returns true if any dimension is periodic

References bc, madness::BC_PERIODIC, d, MADNESS_ASSERT, and NDIM.

◆ lattice_range()

template<std::size_t NDIM>
std::array< LatticeRange, NDIM > madness::BoundaryConditions< NDIM >::lattice_range ( ) const
inline

References is_periodic(), and NDIM.

Referenced by main().

◆ make_range()

template<std::size_t NDIM>
template<std::size_t ND = NDIM>
std::enable_if_t< ND<=NDIM, std::array< KernelRange, ND > > madness::BoundaryConditions< NDIM >::make_range ( unsigned int r,
std::optional< double > sigma = {} ) const
inline

Convenience for construction of range-restricted integral operators.

constructs array of KernelRange objects for every dimension; for every periodic dimension the range is restricted according to r and sigma

Parameters
rrange extent in simulation cell units; kernel is restricted to [-r/2, r/2]
sigmaoptional smoothing paramter (in simulation cell units); if given, use erf-attenuated range restriction (
See also
KernelRange::Type)
Returns
an array of kernel ranges for each dimension

References sigma.

◆ make_range_vector()

template<std::size_t NDIM>
std::vector< KernelRange > madness::BoundaryConditions< NDIM >::make_range_vector ( unsigned int r,
std::optional< double > sigma = {} ) const
inline

Convenience for construction of range-restricted integral operators.

Note
same as make_range(), but makes a std::vector constructs vector of KernelRange objects for every dimension; for every periodic dimension the range is restricted according to r and sigma
Parameters
rrange extent in simulation cell units; kernel is restricted to [-r/2, r/2]
sigmaoptional smoothing paramter (in simulation cell units); if given, use erf-attenuated range restriction (
See also
KernelRange::Type)
Returns
a vector of kernel ranges for each dimension

References sigma.

◆ operator()() [1/2]

template<std::size_t NDIM>
BCType & madness::BoundaryConditions< NDIM >::operator() ( std::size_t d,
int i )
inline

Returns reference to boundary condition.

Parameters
dDimension (0,...,NDIM-1) for boundary condition
iSide (0=left, 1=right) for boundary condition
Returns
Value of boundary condition

References bc, d, and MADNESS_ASSERT.

◆ operator()() [2/2]

template<std::size_t NDIM>
BCType madness::BoundaryConditions< NDIM >::operator() ( std::size_t d,
int i ) const
inline

Returns value of boundary condition.

Parameters
dDimension (0,...,NDIM-1) for boundary condition
iSide (0=left, 1=right) for boundary condition
Returns
Value of boundary condition

References bc, d, and MADNESS_ASSERT.

◆ operator=()

template<std::size_t NDIM>
BoundaryConditions< NDIM > & madness::BoundaryConditions< NDIM >::operator= ( const BoundaryConditions< NDIM > & other)
inline

Assignment makes deep copy.

References BoundaryConditions(), bc, and NDIM.

◆ serialize()

template<std::size_t NDIM>
template<typename Archive>
void madness::BoundaryConditions< NDIM >::serialize ( const Archive & ar)
inline

References bc.

Member Data Documentation

◆ bc


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