21 #ifndef FUB_STATE_ROW_HPP 
   22 #define FUB_STATE_ROW_HPP 
   38   template <
typename Depth>
 
   40   using type = boost::mp11::mp_transform<fn, meta::Depths<State>>;
 
   44   template <
typename Depth>
 
   46   using type = boost::mp11::mp_transform<fn, meta::Depths<State>>;
 
   52   static constexpr 
int Rank = 1;
 
   55       std::conditional_t<std::is_const_v<State>, 
const double, 
double>;
 
   75 template <
typename State>
 
   85             p = std::pair{mds.get_span().begin(), mds.stride(1)};
 
   88             p = std::pair{mds.get_span().begin(), mds.stride(1)};
 
  101             p = std::pair{mds.get_span().end(), mds.stride(1)};
 
  104             p = std::pair{mds.get_span().end(), mds.stride(1)};
 
  111   template <
typename T, 
int R, 
typename L>
 
  113     if constexpr (R == 1) {
 
  116       return pdv.
Stride(
static_cast<int>(Dir));
 
  120   template <
typename T, 
typename L, 
int R>
 
  122     return get<0>(view).Stride(
static_cast<int>(Dir));
 
  126 template <Direction Dir, 
typename T, 
int R, 
typename L>
 
  128   return pdv.
Extent(
static_cast<std::size_t
>(Dir));
 
  131 template <Direction Dir, 
typename T, 
typename L, 
int R>
 
  133   return Extent<Dir>(get<0>(view));
 
  148 template <
typename T> 
void Advance(T*& pointer, std::ptrdiff_t n) {
 
  152 template <
typename T, 
int R, 
typename L>
 
  154   return pdv.
Span().begin();
 
  157 template <
typename T, 
int R, 
typename L>
 
  159   return pdv.
Span().end();
 
  162 template <
int N, 
typename T> constexpr T* 
GetOrForward(T* pointer) noexcept {
 
  166 template <
int N, 
typename T>
 
  168   return get<N>(pointer);
 
  171 template <
typename Tuple, 
typename Function>
 
  173   std::tuple firsts = 
Transform(views, [](
const auto& v) { 
return Begin(v); });
 
  174   const std::ptrdiff_t row_extent = Extent<Direction::X>(std::get<0>(views));
 
  175   if constexpr (std::tuple_element_t<0, Tuple>::rank() == 1) {
 
  178   } 
else if constexpr (std::tuple_element_t<0, Tuple>::rank() == 2) {
 
  179     std::tuple lasts = 
Transform(views, [](
const auto& v) { 
return End(v); });
 
  181     const auto& first = std::get<0>(firsts);
 
  182     const auto& last = std::get<0>(lasts);
 
  183     std::ptrdiff_t n = GetOrForward<0>(last) - GetOrForward<0>(first);
 
  184     while (n >= std::get<0>(strides)) {
 
  187       std::tuple firsts_and_strides = 
Zip(firsts, strides);
 
  189           [](
auto&... ps) { (
Advance(std::get<0>(ps), std::get<1>(ps)), ...); },
 
  192           [](
auto&&... fs) { 
return std::tuple{std::get<0>(fs)...}; },
 
  194       n = GetOrForward<0>(last) - GetOrForward<0>(first);
 
  197     const std::ptrdiff_t ny = Extent<Direction::Y>(std::get<0>(views));
 
  198     const std::ptrdiff_t nz = Extent<Direction::Z>(std::get<0>(views));
 
  201     for (std::ptrdiff_t j = 0; j < nz; ++j) {
 
  202       std::tuple pointers = firsts;
 
  203       for (std::ptrdiff_t i = 0; i < ny; ++i) {
 
  206         pointers = std::apply(
 
  208               (
Advance(std::get<0>(ps), std::get<1>(ps)), ...);
 
  209               return std::tuple{std::get<0>(ps)...};
 
  211             Zip(pointers, strides_y));
 
  215             (
Advance(std::get<0>(ps), std::get<1>(ps)), ...);
 
  216             return std::tuple{std::get<0>(ps)...};
 
  218           Zip(firsts, strides_z));
 
Definition: mdspan.hpp:573
 
Definition: mdspan.hpp:473
 
A span is a view over a contiguous sequence of objects, the storage of which is owned by some other o...
Definition: span.hpp:81
 
The fub namespace.
Definition: AnyBoundaryCondition.hpp:31
 
constexpr auto Transform(Tuple &&tuple, Function f)
Definition: tuple.hpp:53
 
void ForEachVariable(F function, Ts &&... states)
Definition: State.hpp:89
 
typename dynamic_extents_< make_index_sequence< Rank > >::type dynamic_extents
Definition: mdspan.hpp:725
 
void ForEachRow(const Tuple &views, Function f)
Definition: StateRow.hpp:172
 
ViewPointer< State > Begin(const BasicView< State, Layout, Rank > &view)
Definition: State.hpp:769
 
std::ptrdiff_t Extent(const PatchDataView< T, R, L > &pdv)
Definition: StateRow.hpp:127
 
void Advance(ViewPointer< State > &pointer, std::ptrdiff_t n) noexcept
Definition: State.hpp:825
 
constexpr auto Zip(Ts &&... ts)
Definition: State.hpp:65
 
ViewPointer< State > End(const BasicView< State, Layout, Rank > &view)
Definition: State.hpp:782
 
constexpr T * GetOrForward(T *pointer) noexcept
Definition: StateRow.hpp:162
 
typename RowBaseImpl< State >::type RowBase
Definition: StateRow.hpp:49
 
Definition: State.hpp:403
 
Definition: StateRow.hpp:29
 
Definition: PatchDataView.hpp:201
 
std::ptrdiff_t Stride(std::size_t n) const
Definition: PatchDataView.hpp:228
 
std::ptrdiff_t Extent(std::size_t n) const
Definition: PatchDataView.hpp:230
 
span< T > Span() const noexcept
Definition: PatchDataView.hpp:226
 
boost::mp11::mp_transform< fn, meta::Depths< State > > type
Definition: StateRow.hpp:46
 
typename DepthToRowType< const double, Depth >::type fn
Definition: StateRow.hpp:45
 
Definition: StateRow.hpp:37
 
boost::mp11::mp_transform< fn, meta::Depths< State > > type
Definition: StateRow.hpp:40
 
typename DepthToRowType< double, Depth >::type fn
Definition: StateRow.hpp:39
 
Definition: StateRow.hpp:51
 
std::conditional_t< std::is_const_v< State >, const double, double > ElementType
Definition: StateRow.hpp:55
 
Row(const ViewPointer< State > &pointer, std::ptrdiff_t extent)
Definition: StateRow.hpp:59
 
static constexpr int Rank
Definition: StateRow.hpp:52
 
This type is used to tag scalar quantities.
Definition: State.hpp:109
 
Definition: StateRow.hpp:136
 
span< T > operator()(T *pointer)
Definition: StateRow.hpp:139
 
std::ptrdiff_t extent
Definition: StateRow.hpp:137
 
Row< T > operator()(const ViewPointer< T > &pointer)
Definition: StateRow.hpp:143
 
Definition: StateRow.hpp:110
 
std::ptrdiff_t operator()(const PatchDataView< T, R, L > &pdv) const
Definition: StateRow.hpp:112
 
std::ptrdiff_t operator()(const BasicView< T, L, R > &view) const
Definition: StateRow.hpp:121
 
Definition: State.hpp:750
 
Definition: type_traits.hpp:291