32#ifndef MADNESS_MRA_BC_H__INCLUDED
33#define MADNESS_MRA_BC_H__INCLUDED
81 for (std::size_t i = 0; i <
NDIM * 2; ++i)
86 template <std::
size_t N = NDIM,
typename = std::enable_if_t<N!=0>>
88 for (std::size_t i = 0; i <
NDIM * 2; ++i)
89 bc[i] = bc_per_axis[i / 2];
93 template <std::
size_t N = NDIM,
typename = std::enable_if_t<N!=0>>
95 for (std::size_t i = 0; i <
NDIM * 2; ++i)
96 bc[i] = bc_per_boundary[i];
104 if (&other !=
this) {
105 for (std::size_t i = 0; i <
NDIM * 2; ++i)
118 return bc[2 *
d + i];
128 return bc[2 *
d + i];
131 template <
typename Archive>
void serialize(
const Archive &ar) { ar &
bc; }
138 static const char *codes[] = {
"zero",
"periodic",
"free",
139 "Dirichlet",
"zero Neumann",
"Neumann"};
146 template <std::
size_t ND = NDIM>
147 std::enable_if_t<ND <= NDIM, array_of_bools<ND>> is_periodic()
const {
149 for (std::size_t
d = 0;
d < ND; ++
d) {
159 bool is_periodic_any()
const {
160 for (std::size_t
d = 0;
d <
NDIM; ++
d) {
171 bool is_periodic_all()
const {
172 for (std::size_t
d = 0;
d <
NDIM; ++
d) {
186 template <std::
size_t ND = NDIM>
187 std::enable_if_t<ND <= NDIM, std::array<KernelRange, ND>> make_range(
unsigned int r, std::optional<double>
sigma = {})
const {
188 std::array<KernelRange, ND> result;
189 for (std::size_t
d = 0;
d < ND; ++
d) {
192 result[
d] =
sigma ? KernelRange{r, *
sigma} : KernelRange{r};
204 std::vector<KernelRange> make_range_vector(
unsigned int r, std::optional<double>
sigma = {})
const {
205 const auto result_array = make_range(r,
sigma);
206 return std::vector<KernelRange>(result_array.begin(), result_array.end());
211template <std::
size_t NDIM>
214 s <<
"BoundaryConditions(";
215 for (
unsigned int d = 0;
d <
NDIM; ++
d) {
225template <std::
size_t NDIM>
230template <std::
size_t NDIM>
This class is used to specify boundary conditions for all operators.
Definition bc.h:72
BCType bc[NDIM *2]
Definition bc.h:76
BoundaryConditions(BCType code=BC_FREE)
Constructor. Default boundary condition set to free space.
Definition bc.h:80
BoundaryConditions(const std::array< BCType, N > &bc_per_axis)
Constructor sets boundary condition per axis.
Definition bc.h:87
BCType operator()(std::size_t d, int i) const
Returns value of boundary condition.
Definition bc.h:116
BoundaryConditions< NDIM > & operator=(const BoundaryConditions< NDIM > &other)
Assignment makes deep copy.
Definition bc.h:103
BCType & operator()(std::size_t d, int i)
Returns reference to boundary condition.
Definition bc.h:126
BoundaryConditions(const BoundaryConditions< NDIM > &other)
Copy constructor is deep.
Definition bc.h:100
static const char * code_as_string(BCType code)
Translates code into human readable string.
Definition bc.h:137
void serialize(const Archive &ar)
Definition bc.h:131
BoundaryConditions(const std::array< BCType, N *2 > &bc_per_boundary)
Constructor sets boundary condition per boundary.
Definition bc.h:94
syntactic sugar for std::array<bool, N>
Definition array_of_bools.h:19
const double sigma
Definition dielectric.cc:185
static const double v
Definition hatom_sf_dirac.cc:20
Defines madness::MadnessException for exception handling.
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
Namespace for all elements and tools of MADNESS.
Definition DFParameters.h:10
array_of_bools< NDIM > lattice_sum()
Definition bc.h:231
@ BC_DIRICHLET
Definition bc.h:54
@ BC_NEUMANN
Definition bc.h:56
@ BC_ZERO
Definition bc.h:51
@ BC_PERIODIC
Definition bc.h:52
@ BC_ZERONEUMANN
Definition bc.h:55
@ BC_FREE
Definition bc.h:53
std::ostream & operator<<(std::ostream &os, const particle< PDIM > &p)
Definition lowrankfunction.h:397
array_of_bools< NDIM > no_lattice_sum()
Definition bc.h:226
static const double d
Definition nonlinschro.cc:121
constexpr std::size_t NDIM
Definition testgconv.cc:54