35#ifndef PECLET_AMR_SEAM_RECON_HPP
36#define PECLET_AMR_SEAM_RECON_HPP
46#include "peclet/core/common/types.hpp"
64 std::vector<double>
d1I;
65 std::vector<double>
d1J;
81template <
unsigned Bits>
83 std::array<Index, 4>& cells) {
87 const std::array<long, 3>
lo = ap.
loOf(
C);
88 const long sc = 1L <<
Lc,
sh =
sc >> 1;
89 std::array<long, 3>
p =
lo;
90 p[axis] = (dir > 0) ?
lo[axis] +
sc :
lo[axis] - 1;
91 for (
int k = 0; k < 4; ++k) {
92 std::array<long, 3>
q =
p;
94 for (
int t = 0;
t < 3; ++
t) {
101 if (
c < 0 ||
Lq + 1 !=
Lc)
103 cells[
static_cast<std::size_t
>(k)] =
c;
128template <
unsigned Bits,
class RegularFn,
class Flu
idFn>
133 std::vector<std::vector<detail::ScalarEnt>>
rec;
134 std::vector<double> dist;
143 const std::array<Index, 3>
key{
C,
F,
static_cast<Index>(axis)};
149 std::vector<detail::ScalarEnt>
e;
152 id =
static_cast<Index>(
rec.size());
153 rec.push_back(std::move(
e));
154 dist.push_back(1.5 *
static_cast<double>(ap.
cellWidth(
F, axis)));
155 ++
out.numSampleRecords;
164 const std::array<Index, 3>
key{
C,
static_cast<Index>(axis),
static_cast<Index>(dir)};
169 std::array<Index, 4> cells{};
172 for (
const Index c : cells)
175 std::vector<detail::ScalarEnt>
e;
176 for (
const Index c : cells)
178 id =
static_cast<Index>(
rec.size());
179 rec.push_back(std::move(
e));
180 dist.push_back(0.75 *
static_cast<double>(ap.
cellWidth(
C, axis)));
181 ++
out.numLayerRecords;
189 ap.forEachFaceFull(
i, [&](
Index j,
int a,
int d,
double,
double,
double) {
190 const unsigned Li = ap.levelOf(
i),
Lj = ap.levelOf(
j);
202 const Index uI = ap.periodicNeighbor(
i,
a, -d);
204 const unsigned Lu = ap.levelOf(
uI);
210 const Index uJ = ap.periodicNeighbor(
j,
a, d);
212 const unsigned Lu = ap.levelOf(
uJ);
219 out.seam.push_back(-1);
222 out.seam.push_back(
out.numDescriptors());
225 out.uuRecI.push_back(
ruI);
226 out.uuRecJ.push_back(
ruJ);
227 out.d1I.push_back(0.5 *
static_cast<double>(ap.cellWidth(
i,
a)));
228 out.d1J.push_back(0.5 *
static_cast<double>(ap.cellWidth(
j,
a)));
233 out.recStart.assign(
static_cast<std::size_t
>(
nRec) + 1, 0);
235 out.recStart[
static_cast<std::size_t
>(
r) + 1] =
236 out.recStart[
static_cast<std::size_t
>(
r)] +
237 static_cast<Index>(
rec[
static_cast<std::size_t
>(
r)].size());
238 out.recDist = std::move(dist);
239 out.recCell.reserve(
static_cast<std::size_t
>(
out.recStart[
static_cast<std::size_t
>(
nRec)]));
240 out.recW.reserve(
static_cast<std::size_t
>(
out.recStart[
static_cast<std::size_t
>(
nRec)]));
243 out.recCell.push_back(
e.cell);
244 out.recW.push_back(
e.w);
Cell-centered FV Poisson operator on one (periodic) block octree.
unsigned levelOf(Index slot) const
Octree level of an extended slot (local leaf or declared ghost).
Real cellWidth(Index i, int axis) const
Cell width along axis (Phase 3: per axis).
std::pair< Index, unsigned > probeSlot(const std::array< long, Dim > &p) const
Covering slot + level of a block-local probe (longs, possibly outside the block).
const Octree & octree() const
std::array< long, Dim > loOf(Index slot) const
Block-local lo corner of an extended slot as longs (ghosts may lie outside the block).
void cfAppendStencil(const AmrPoisson< 3, Bits > &ap, std::vector< Ent > &out, Index coarse, Index fine, int axis, double scale, FluidFn &&fluidOk, CfScheme scheme, const Ent &proto=Ent{})
Append the scheme's (coarse* − coarse_raw) substitution stencil for ONE directed C/F sub-face to out,...
bool seamFaceLayer(const AmrPoisson< 3, Bits > &ap, Index C, int axis, int dir, std::array< Index, 4 > &cells)
The four sub-face neighbour leaves across C's face (axis, dir), in forEachFaceFull's own sub-face ord...
SeamReconHost buildSeamRecon(const AmrPoisson< 3, Bits > &ap, RegularFn &®ularOk, FluidFn &&fluidOk, CfScheme scheme)
Build the seam-reconstruction tables over the LOCAL rows of ap (docs/amr_cf_convective....
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,...
CfScheme
Coarse/fine interface scheme for the collocated flow operators.
Host-side seam-reconstruction tables (docs/amr_cf_convective.md §5.2), built once per AmrFlow::setSol...
Index numDescriptors() const
Number of descriptors, i.e. of face slots that take the seam path (seam[slot] >= 0).
std::vector< Index > recStart
record CSR offsets, size nRec+1
std::vector< double > recW
record entries: weight
Index numSampleRecords
diagnostics: how many of the records are sample records
Index numLayerRecords
diagnostics: how many are layer records
std::vector< double > d1J
per descriptor: half width of j along the face axis (physical)
std::vector< Index > seam
per face slot: descriptor id, −1 = plain slot
std::vector< double > recDist
per record: dUU for UPSTREAM use (unused as a φ_U* sample)
std::vector< Index > sampI
per descriptor: sample record when i is the COARSE cell, else −1
std::vector< double > d1I
per descriptor: half width of i along the face axis (physical)
std::vector< Index > uuRecJ
per descriptor: upstream-probe record for up == j, else −1
std::vector< Index > sampJ
per descriptor: sample record when j is the COARSE cell, else −1
std::vector< Index > recCell
record entries: cell slot
std::vector< Index > uuRecI
per descriptor: upstream-probe record for up == i, else −1