21 #ifndef FUB_AMREX_FARRAYBOX_HPP 
   22 #define FUB_AMREX_FARRAYBOX_HPP 
   29 #include <AMReX_BaseFab.H> 
   30 #include <AMReX_FArrayBox.H> 
   31 #include <AMReX_RealBox.H> 
   36                              const ::amrex::IntVect& value);
 
   44                              const ::amrex::RealBox& value);
 
   49 std::array<std::ptrdiff_t, AMREX_SPACEDIM> 
AsArray(const ::amrex::IntVect& vec);
 
   52   const std::array<std::ptrdiff_t, AMREX_SPACEDIM> lower =
 
   54   std::array<std::ptrdiff_t, AMREX_SPACEDIM> upper = 
AsArray(box.bigEnd());
 
   55   std::transform(upper.begin(), upper.end(), upper.begin(),
 
   56                  [](std::ptrdiff_t i) { return i + 1; });
 
   58   if constexpr (AMREX_SPACEDIM != Rank) {
 
   59     constexpr std::size_t sRank = 
static_cast<std::size_t
>(Rank);
 
   60     std::array<std::ptrdiff_t, sRank> lower1;
 
   61     std::array<std::ptrdiff_t, sRank> upper1;
 
   62     std::copy_n(lower.begin(), Rank, lower1.begin());
 
   63     std::copy_n(upper.begin(), Rank, upper1.begin());
 
   76   ::amrex::IntVect length{fab.box().length()};
 
   77   for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
 
   78     extents[
static_cast<std::size_t
>(i)] = length[i];
 
   80   extents[AMREX_SPACEDIM] = fab.nComp();
 
   90   std::copy_n(lower.begin(), AMREX_SPACEDIM, lower_comp.begin());
 
  100   ::amrex::IntVect length{fab.box().length()};
 
  101   for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
 
  102     extents[
static_cast<std::size_t
>(i)] = length[i];
 
  107 template <
typename T>
 
  118 template <
typename T>
 
  121   ::amrex::IntVect length{fab.box().length()};
 
  122   for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
 
  123     extents[
static_cast<std::size_t
>(i)] = length[i];
 
  125   extents[
static_cast<std::size_t
>(AMREX_SPACEDIM)] = fab.nComp();
 
  129 template <
typename T>
 
  135   std::copy_n(lower.begin(), AMREX_SPACEDIM, lower_comp.begin());
 
  136   lower_comp[AMREX_SPACEDIM] = 0;
 
  143 template <
typename T>
 
  147   ::amrex::IntVect length{fab.box().length()};
 
  148   for (
int i = 0; i < AMREX_SPACEDIM; ++i) {
 
  149     extents[
static_cast<std::size_t
>(i)] = length[i];
 
  154 template <
typename T>
 
  162 template <
typename T>
 
  169       .
Subview(AsIndexBox<AMREX_SPACEDIM>(box));
 
  172 template <
typename T>
 
  179       .
Subview(AsIndexBox<AMREX_SPACEDIM>(box));
 
  187   static constexpr 
int Rank = Equation::Rank();
 
  188   static constexpr std::size_t 
sRank = 
static_cast<std::size_t
>(
Rank);
 
  199           std::copy_n(efab.begin(), 
Rank, e.begin());
 
  202           index[
static_cast<std::size_t
>(AMREX_SPACEDIM)] = counter;
 
  204           std::copy_n(origin.begin(), 
Rank, this_origin.begin());
 
  213           std::copy_n(efab.begin(), 
Rank, e.begin());
 
  215           index[AMREX_SPACEDIM] = counter;
 
  217           std::copy_n(origin.begin(), 
Rank, this_origin.begin());
 
  224         [&](
auto& pdv, 
const auto& depth) { pdv = transform(depth); }, pd_views,
 
  230 template <
typename State, 
typename T, 
typename Equation>
 
  234   return make_view(fab, equation);
 
  237 template <
typename State, 
typename Equation>
 
  242 template <
typename State, 
typename Equation>
 
  247 template <
typename State, 
typename Equation>
 
  249               const IndexBox<Equation::Rank()>& box) {
 
  250   return Subview(MakeView<State>(fab, eq), box);
 
  253 template <
typename State, 
typename Equation>
 
  255               const IndexBox<Equation::Rank()>& box) {
 
  256   return Subview(MakeView<State>(fab, eq), box);
 
  259 template <
typename State, 
typename FAB, 
typename Equation>
 
  261   return MakeView<State>(std::forward<FAB>(fab), eq,
 
  265 std::array<::amrex::Box, 2>
 
Definition: mdspan.hpp:573
 
An extents object defines a multidimensional index space which is the Cartesian product of integers e...
Definition: mdspan.hpp:208
 
std::array<::amrex::Box, 2 > GetCellsAndFacesInStencilRange(const ::amrex::Box &cell_tilebox, const ::amrex::Box &face_validbox, int stencil_width, Direction dir)
 
IndexBox< Rank > AsIndexBox(const ::amrex::Box &box)
Definition: ViewFArrayBox.hpp:51
 
std::array< std::ptrdiff_t, AMREX_SPACEDIM > AsArray(const ::amrex::IntVect &vec)
 
auto MakeView(const PatchDataView< T, AMREX_SPACEDIM+1 > &fab, const Equation &equation)
Definition: ViewFArrayBox.hpp:231
 
mdspan< T, AMREX_SPACEDIM+1 > MakeMdSpan(::amrex::BaseFab< T > &fab)
Creates a mdspan which views all components of a mutable Fab.
Definition: ViewFArrayBox.hpp:74
 
PatchDataView< T, AMREX_SPACEDIM+1 > MakePatchDataView(::amrex::BaseFab< T > &fab)
Definition: ViewFArrayBox.hpp:86
 
The fub namespace.
Definition: AnyBoundaryCondition.hpp:31
 
View< State > Subview(const BasicView< State, Layout, Rank > &state, const IndexBox< Rank > &box)
Definition: Equation.hpp:86
 
void ForEachVariable(F function, Ts &&... states)
Definition: State.hpp:89
 
Direction
This is a type safe type to denote a dimensional split direction.
Definition: Direction.hpp:30
 
std::array< std::ptrdiff_t, static_cast< std::size_t >(Rank)> Index
Definition: PatchDataView.hpp:34
 
T GetOptionOr(const ProgramOptions &map, const std::string &name, const T &value)
Definition: ProgramOptions.hpp:48
 
IndexBox< Rank > Box(const BasicView< State, Layout, Rank > &view)
Definition: State.hpp:486
 
std::ptrdiff_t index
Definition: type_traits.hpp:179
 
std::map< std::string, pybind11::object > ProgramOptions
Definition: ProgramOptions.hpp:40
 
Definition: PatchDataView.hpp:56
 
Definition: PatchDataView.hpp:201
 
dynamic_extents< sRank > Extents() const noexcept
Definition: PatchDataView.hpp:214
 
const mdspan< T, sRank, Layout > & MdSpan() const noexcept
Definition: PatchDataView.hpp:206
 
PatchDataView< T, R, layout_stride > Subview(const IndexBox< R > &box) const
Definition: PatchDataView.hpp:245
 
const std::array< std::ptrdiff_t, sRank > & Origin() const noexcept
Definition: PatchDataView.hpp:210
 
This type is used to tag scalar quantities.
Definition: State.hpp:109
 
Definition: State.hpp:162
 
Definition: ViewFArrayBox.hpp:182
 
State operator()(const PatchDataView< ValueType, AMREX_SPACEDIM+1 > &fab, const Equation &equation)
Definition: ViewFArrayBox.hpp:190
 
static constexpr std::size_t sRank
Definition: ViewFArrayBox.hpp:188
 
static constexpr int Rank
Definition: ViewFArrayBox.hpp:187
 
typename State::Equation Equation
Definition: ViewFArrayBox.hpp:183
 
typename State::ValueType ValueType
Definition: ViewFArrayBox.hpp:185
 
meta::Depths< State > Depths
Definition: ViewFArrayBox.hpp:184
 
Definition: type_traits.hpp:291