1#ifndef APPARENT_HORIZON_FINDER_INTERPOLATION_H_
2#define APPARENT_HORIZON_FINDER_INTERPOLATION_H_
58 std::size_t neighbourCount
67 std::size_t neighbourCount
77 struct Implementation;
85 std::size_t neighbourCount
102 std::size_t neighbourCount
120 static constexpr std::size_t
NoTerm = std::numeric_limits<std::size_t>::max();
121 std::vector<PolynomialExponent>
terms;
181 std::span<const GridCoordinate> sampleCoordinates,
182 std::span<const double> sampleValues,
188 std::array<double, NumberOfCompactFields>
values{};
205 std::span<const std::size_t> neighbourIndices,
258 std::span<const GridCoordinate> targets,
259 std::vector<InterpolatedCartesianPoint>& output
317 std::span<const AngularSample> angularSamples = {});
Reusable Cartesian reconstruction context.
GridCoordinate _domainMinimum
bool coversTarget(const GridCoordinate &target) const
True when target lies inside the sampled Cartesian domain, widened by the configured domainRelativeTo...
CartesianToSurfaceOptions _options
CartesianSpatialIndex _spatialIndex
CartesianPointInterpolator(const GridData &gridData, const CartesianToSurfaceOptions &options={})
GridCoordinate domainMinimum() const
Corner-to-corner extent of the sampled domain, for diagnostics.
void interpolatePoints(std::span< const GridCoordinate > targets, std::vector< InterpolatedCartesianPoint > &output) const
Reconstruct physical fields in exactly the order of targets.
GridCoordinate _domainMaximum
GridCoordinate domainMaximum() const
const GridData * _gridData
Immutable k-d tree; concurrent nearest-neighbour queries are read-only.
std::vector< std::size_t > findNearest(const GridCoordinate &target, std::size_t neighbourCount) const
CartesianSpatialIndex(const GridData &gridData)
std::vector< std::size_t > findWithinRadius(const GridCoordinate &target, double radius) const
Return all cells with Euclidean distance strictly less than radius.
std::shared_ptr< const Implementation > _implementation
std::vector< std::size_t > FindNearestGridCells(const CartesianSpatialIndex &spatialIndex, const GridCoordinate &target, std::size_t neighbourCount)
Query a previously built index without rebuilding it.
LinearReconstructionMethod
@ RadiusWeightedWendlandC2
@ WeightedMovingLeastSquares
void InterpolateFromShellToSurface(const InterpolatedShell &interpolatedShell, const AHGuess &ahGuess, const ReferencePoint &referencePoint, InterpolatedSurface &interpolatedSurface)
Interpolate the shell data to the apparent-horizon surface defined by the current AH guess.
std::size_t PolynomialBasisSize(std::size_t degree)
void InterpolateCartesianToSurface(const CartesianPointInterpolator &interpolator, const AHGuess &ahGuess, const ReferencePoint &referencePoint, InterpolatedSurface &interpolatedSurface)
Surface adapter using an already-built, persistent Cartesian interpolator.
GridCoordinate SurfacePointToCartesian(const AHGuessPoint &surfacePoint, const ReferencePoint &referencePoint)
Convert one AH point (r, longitude rho, latitude sigma) into its global Cartesian target coordinate r...
CompactLinearFit FitCompactLinearPolynomial(const GridData &gridData, std::span< const std::size_t > neighbourIndices, const GridCoordinate &target, const LinearReconstructionOptions &options={})
Reconstruct all fourteen compact fields with one shared polynomial design matrix and one column-pivot...
double WendlandC2Weight(double q)
Wendland C2 compact kernel: (1-q)^4(4q+1) for 0<=q<1, else zero.
Tensor3 ComputeRadialProjectionTensor(const GridCoordinate &relativeCoordinate)
Compute T_ij = r^2 delta_ij - x_i x_j from relative coordinates.
std::array< double, 3 > Vector3
PolynomialBasis GeneratePolynomialBasis(std::size_t degree)
double LinearReconstructionWeight(double distance, double lengthScale, const LinearReconstructionOptions &options)
Evaluate the configured unweighted, Gaussian, or compact-support row weight.
LinearPolynomialFit FitLinearPolynomial(std::span< const GridCoordinate > sampleCoordinates, std::span< const double > sampleValues, const GridCoordinate &target, const LinearReconstructionOptions &options={})
Scalar total-degree polynomial least-squares reconstruction using a column-pivoted QR solve.
void InterpolateToSurfaceNearestNeighbour(const GridData &gridData, const AHGuess &ahGuess, const ReferencePoint &referencePoint, InterpolatedSurface &interpolatedSurface)
Sample each AH surface point from its nearest Cartesian cell centre and reconstruct the physical spat...
void InterpolateFromCartesianToShell(const GridData &gridData, const AHGuess &ahGuess, const ReferencePoint &referencePoint, InterpolatedShell &interpolatedShell, std::span< const AngularSample > angularSamples={})
Interpolate the Cartesian grid data to a shell-like subdomain around the current AH guess.
std::array< std::array< double, 3 >, 3 > Tensor3
std::vector< std::size_t > FindGridCellsWithinRadius(const CartesianSpatialIndex &spatialIndex, const GridCoordinate &target, double radius)
Query every indexed cell strictly inside radius, sorted by distance/index.
AnalyticCoordinateGeometry ComputeAnalyticCoordinateGeometry(const GridCoordinate &globalCoordinate, const ReferencePoint &referencePoint)
Compute the appendix's analytic rho/sigma coordinate geometry.
std::vector< std::size_t > FindNearestGridCellsBruteForce(const GridData &gridData, const GridCoordinate &target, std::size_t neighbourCount)
Return the indices of the neighbourCount nearest Cartesian cell centres.
One point on an apparent-horizon guess, expressed in spherical coordinates.
One apparent-horizon hypersurface guess.
std::array< Vector3, 2 > gradient
[u][i], with u=0 for rho, u=1 for sigma, and i=x,y,z.
std::array< Tensor3, 2 > hessian
[u][i][j] = partial_i partial_j u, with u=0 rho and u=1 sigma.
CartesianToSurfaceMethod method
std::size_t numberOfNeighbours
double supportRadius
Used only by RadiusWeightedPolynomial; must be finite and positive.
double rankToleranceMultiplier
double domainRelativeTolerance
Allowed distance outside the grid AABB as a fraction of its diagonal.
std::size_t polynomialDegree
std::array< Vector3, NumberOfCompactFields > gradients
std::size_t numberOfNeighbours
std::array< double, NumberOfCompactFields > values
std::size_t polynomialDegree
double conditionEstimate
Approximate max/min absolute diagonal ratio of the pivoted R factor.
Cartesian coordinate for one sampled grid point.
Pointwise Cartesian grid data.
Physical fields reconstructed at one arbitrary Cartesian target.
InterpolationDiagnostics diagnostics
InterpolatedGeometryData geometry
Physical and geometrical quantities shared by shell and surface samples.
Interpolated data on the shell-like subdomain around an AH guess.
Interpolated data on the current AH surface r = h(rho, sigma).
LinearReconstructionMethod method
double rankToleranceMultiplier
Multiplier applied to epsilon*n*largest-column-norm for rank detection.
std::size_t numberOfNeighbours
Zero uses every supplied sample; otherwise use the first requested samples.
double weightSupport
Gaussian support alpha in exp(-(distance/(alpha*ell))^2).
double supportRadius
Physical compact-support radius for RadiusWeightedWendlandC2.
std::size_t polynomialDegree
Supported reconstruction degree, currently 0 through 3.
std::vector< PolynomialExponent > terms
static constexpr std::size_t NoTerm
bool operator==(const PolynomialExponent &) const =default
Cartesian reference coordinate for one apparent-horizon centre point.