18#ifndef PECLET_AMR_INDICATORS_HPP
19#define PECLET_AMR_INDICATORS_HPP
26#include "peclet/core/common/types.hpp"
37template <
int Dim,
unsigned Bits>
41 std::vector<double> e(
static_cast<std::size_t
>(n), 0.0);
42 for (Index i = 0; i < n; ++i) {
43 const double ui = u[
static_cast<std::size_t
>(i)];
44 double num2 = 0.0, den2 = 0.0;
45 for (
int axis = 0; axis < Dim; ++axis) {
50 const double up = u[
static_cast<std::size_t
>(jp)];
51 const double um = u[
static_cast<std::size_t
>(jm)];
52 const double d2 = up - 2.0 * ui + um;
53 const double nrm = std::fabs(up - ui) + std::fabs(ui - um) +
54 eps * (std::fabs(up) + 2.0 * std::fabs(ui) + std::fabs(um));
58 e[
static_cast<std::size_t
>(i)] = (den2 > 0.0) ? std::sqrt(num2 / den2) : 0.0;
67template <
int Dim,
unsigned Bits>
69 const std::vector<double>& u) {
71 std::vector<double> e(
static_cast<std::size_t
>(n), 0.0);
72 for (Index i = 0; i < n; ++i) {
73 const double ui = u[
static_cast<std::size_t
>(i)];
75 for (
int axis = 0; axis < Dim; ++axis) {
81 u[
static_cast<std::size_t
>(jp)] - 2.0 * ui + u[
static_cast<std::size_t
>(jm)];
84 e[
static_cast<std::size_t
>(i)] = std::sqrt(s);
Per-block adaptive octree over block-local Morton codes.
Index faceNeighbor(Index i, int axis, int dir) const
The leaf across leaf i's face on axis in direction dir (±1), or -1 if it lies outside the block.
std::vector< double > lohnerIndicator(const BlockOctree< Dim, Bits > &t, const std::vector< double > &u, double eps=0.01)
Löhner normalized second-difference indicator E_i ∈ [0,1], per leaf, for scalar u (indexed by leaf sl...
std::vector< double > secondDiffIndicator(const BlockOctree< Dim, Bits > &t, const std::vector< double > &u)
Raw second-derivative magnitude indicator, per leaf: the L2 norm over axes of the undivided second di...