10#ifndef PECLET_AMR_REFINE_HPP
11#define PECLET_AMR_REFINE_HPP
21#include "peclet/core/common/types.hpp"
33template <
int Dim,
unsigned Bits,
class SdfFn>
40 for (
Index i = 0;
i <
t.numLeaves(); ++
i) {
41 const unsigned L =
t.level(
i);
52 for (
int d = 0; d < Dim; ++d)
63 [&](Code
c,
unsigned) {
return std::binary_search(
toRefine.begin(),
toRefine.end(),
c); });
84template <
int Dim,
unsigned Bits,
class SdfFn,
class TargetFn>
92 for (
Index i = 0;
i <
t.numLeaves(); ++
i) {
93 const unsigned L =
t.level(
i);
103 for (
int d = 0; d < Dim; ++d) {
120 [&](Code
c,
unsigned) {
return std::binary_search(
toRefine.begin(),
toRefine.end(),
c); });
137template <
int Dim,
class GapFn>
Per-block adaptive octree over block-local Morton codes.
typename M::code_type Code
Index refineToSdf(BlockOctree< Dim, Bits > &t, const AmrGeometry< Dim > &geo, SdfFn &&sdf, unsigned targetLevel, Real band=1.0, bool balance=true)
Refine leaves near an SDF interface down to targetLevel.
Index refineToSdfGraded(BlockOctree< Dim, Bits > &t, const AmrGeometry< Dim > &geo, SdfFn &&sdf, TargetFn &&targetFn, Real band=2.0, bool balance=true)
Graded variant of refineToSdf: a per-point TARGET LEVEL function instead of one global targetLevel — ...
auto gapFloorTarget(GapFn &&gapFn, Real h0, unsigned coarsestLevel, Real n=4.0)
The plan's §7 criterion 1 as a ready-made targetFn for refineToSdfGraded: the GAP-WIDTH FLOOR.
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,...