Skip to content

Commit

Permalink
BoundaryConditions: array ctors
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Dec 6, 2024
1 parent 23ec4de commit 4d1174b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/madness/mra/bc.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ template <std::size_t NDIM> class BoundaryConditions {
bc[i] = code;
}

/// Constructor sets boundary condition per axis
template <std::size_t N = NDIM, typename = std::enable_if_t<N!=0>>
BoundaryConditions(const std::array<BCType, N>& bc_per_axis) {
for (std::size_t i = 0; i < NDIM * 2; ++i)
bc[i] = bc_per_axis[i / 2];
}

/// 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*2>& bc_per_boundary) {
for (std::size_t i = 0; i < NDIM * 2; ++i)
bc[i] = bc_per_boundary[i];
}

/// Copy constructor is deep
BoundaryConditions(const BoundaryConditions<NDIM> &other) { *this = other; }

Expand Down

0 comments on commit 4d1174b

Please sign in to comment.