10#ifndef PECLET_AMR_LEAF_FIELD_HPP
11#define PECLET_AMR_LEAF_FIELD_HPP
19#include "peclet/core/common/types.hpp"
28 for (
int d = 0; d < Dim; ++d)
55 g.
h0 = detail::filledVec<Dim>(
h);
63 for (
int d = 1; d < Dim; ++d)
64 m =
h0[d] < m ?
h0[d] : m;
69 for (
int d = 1; d < Dim; ++d)
70 m =
h0[d] > m ?
h0[d] : m;
74 for (
int d = 1; d < Dim; ++d)
82 for (
int d = 1; d < Dim; ++d)
89 return h0[d] *
static_cast<Real>(
Index(1) << level);
95 for (
int d = 0; d < Dim; ++d)
101 template <
class Coord>
104 for (
int d = 0; d < Dim; ++d)
110 template <
class Coord>
113 for (
int d = 0; d < Dim; ++d)
116 (
static_cast<Real>(b[0][d]) + 0.5 * (
static_cast<Real>(b[1][d] - b[0][d]) + 1.0)) *
h0[d];
129 template <
int Dim,
unsigned Bits>
Per-block adaptive octree over block-local Morton codes.
Vec< Dim > filledVec(Real v)
Vec<Dim> with every component set to v (C++ has no aggregate-fill initializer).
std::vector< std::array< double, Dim > > transferFieldGradients(const BlockOctree< Dim, Bits > &oldT, const std::vector< double > &oldF)
Per-old-leaf minmod prolongation gradients (per fine-coordinate unit) — transferField's stencil,...
World-space placement of a block-local octree: fine coordinate (0,..,0) sits at origin,...
void setIsotropic(Real h)
Set all axes to one spacing (the cubic case), in place.
Real cellVolume() const
World volume of a level-0 fine cell.
Vec< Dim > lowerCorner(const std::array< Coord, Dim > &lo) const
World coordinate of a leaf's lower corner, given its integer lower bound (fine units).
Vec< Dim > center(const std::array< std::array< Coord, Dim >, 2 > &b) const
World coordinate of a leaf centre, from its integer bounds [lo,hi] (inclusive, fine units).
static AmrGeometry isotropicAt(const Vec< Dim > &o, Real h)
Cubic-cell convenience: the pre-Phase-3 {origin, h} construction.
Real leafSize(unsigned level, int d) const
World width of a leaf at level on axis d (it covers 2^level fine cells).
Vec< Dim > leafSize(unsigned level) const
World widths of a leaf at level, per axis.
A value per leaf, in the octree's Z-order leaf slot order.
LeafField(Index n, T init=T{})
const T & operator[](Index i) const
LeafField(const BlockOctree< Dim, Bits > &t, T init=T{})