Peano
Loading...
Searching...
No Matches
ahf-data.h
Go to the documentation of this file.
1#ifndef APPARENT_HORIZON_FINDER_AHF_DATA_H_
2#define APPARENT_HORIZON_FINDER_AHF_DATA_H_
3
4#include <algorithm>
5#include <array>
6#include <cmath>
7#include <cstddef>
8#include <limits>
9#include <optional>
10#include <span>
11#include <stdexcept>
12#include <string>
13#include <vector>
14
15namespace exahype2::ccz4::ahf {
16
21 double x;
22 double y;
23 double z;
24};
25
30 double r;
31 double rho;
32 double sigma;
33};
34
39 double rho = 0.0;
40 double sigma = 0.0;
41};
42
48struct AHGuess {
49 std::vector<AHGuessPoint> points;
50};
51
56 double x;
57 double y;
58 double z;
59};
60
71
82
106
107inline constexpr std::size_t NumberOfCompactFields =
108 static_cast<std::size_t>(CompactField::Count);
109
110inline constexpr std::array<const char*, NumberOfCompactFields> CompactFieldNames{
111 "gammaTilde_xx", "gammaTilde_xy", "gammaTilde_xz",
112 "gammaTilde_yy", "gammaTilde_yz", "gammaTilde_zz",
113 "ATilde_xx", "ATilde_xy", "ATilde_xz",
114 "ATilde_yy", "ATilde_yz", "ATilde_zz",
115 "K", "phi"
116};
117
119enum class SymmetricTensorComponent : std::size_t {
120 XX = 0,
121 XY = 1,
122 XZ = 2,
123 YY = 3,
124 YZ = 4,
125 ZZ = 5,
127};
128
129inline constexpr std::size_t NumberOfSymmetricTensorComponents =
130 static_cast<std::size_t>(SymmetricTensorComponent::Count);
131
132inline constexpr std::array<CompactField, NumberOfSymmetricTensorComponents>
138
139inline constexpr std::array<CompactField, NumberOfSymmetricTensorComponents>
144
150 using Index = std::size_t;
151 static constexpr Index NotStored = std::numeric_limits<Index>::max();
152
161
172
173 bool isComplete() const {
174 const auto components = componentsInCompactOrder();
175 return std::all_of(components.begin(), components.end(), [](Index index) {
176 return index != NotStored;
177 });
178 }
179
181 const auto components = componentsInCompactOrder();
182 for (std::size_t field = 0; field < components.size(); ++field) {
183 if (components[field] == NotStored) {
184 throw std::invalid_argument(
185 "SourceVariableMapping: required field "
186 + std::string(CompactFieldNames[field]) + " is NotStored");
187 }
188 }
189
190 for (std::size_t first = 0; first < components.size(); ++first) {
191 for (std::size_t second = first + 1; second < components.size(); ++second) {
192 if (components[first] == components[second]) {
193 throw std::invalid_argument(
194 "SourceVariableMapping: required fields "
195 + std::string(CompactFieldNames[first]) + " and "
196 + CompactFieldNames[second] + " both map to source component "
197 + std::to_string(components[first]));
198 }
199 }
200 }
201 }
202
203 void validateAgainstSourceTuple(std::size_t numberOfSourceComponents) const {
205 const auto components = componentsInCompactOrder();
206 for (std::size_t field = 0; field < components.size(); ++field) {
207 if (components[field] >= numberOfSourceComponents) {
208 throw std::invalid_argument(
209 "SourceVariableMapping: required field "
210 + std::string(CompactFieldNames[field]) + " selects source component "
211 + std::to_string(components[field]) + ", but the source tuple has only "
212 + std::to_string(numberOfSourceComponents) + " components");
213 }
214 }
215 }
216
217 bool isValid(std::size_t numberOfSourceComponents) const {
218 const auto components = componentsInCompactOrder();
219 for (std::size_t field = 0; field < components.size(); ++field) {
220 if (components[field] >= numberOfSourceComponents) {
221 return false;
222 }
223 for (std::size_t previous = 0; previous < field; ++previous) {
224 if (components[field] == components[previous]) {
225 return false;
226 }
227 }
228 }
229 return true;
230 }
231};
232
239 return {
240 .conformalMetric = {0, 1, 2, 3, 4, 5},
241 .conformalExtrinsicCurvature = {6, 7, 8, 9, 10, 11},
242 .traceK = 23,
243 .conformalFactor = 24
244 };
245}
246
253 return {
254 .conformalMetric = {0, 1, 2, 3, 4, 5},
255 .conformalExtrinsicCurvature = {6, 7, 8, 9, 10, 11},
256 .traceK = 53,
257 .conformalFactor = 54
258 };
259}
260
267inline constexpr std::array<const char*, NumberOfCompactFields> CCZ4SourceComponentNames{
268 "G[0]", "G[1]", "G[2]", "G[3]", "G[4]", "G[5]",
269 "K[0]", "K[1]", "K[2]", "K[3]", "K[4]", "K[5]",
270 "traceK", "phi"
271};
272
277inline std::optional<SourceVariableMapping> SourceVariableMappingFromComponentNames(
278 std::span<const std::string> componentNames
279) {
280 std::array<SourceVariableMapping::Index, NumberOfCompactFields> components;
281 components.fill(SourceVariableMapping::NotStored);
282 for (std::size_t component = 0; component < componentNames.size(); ++component) {
283 for (std::size_t field = 0; field < NumberOfCompactFields; ++field) {
284 if (componentNames[component] == CCZ4SourceComponentNames[field]) {
285 if (components[field] != SourceVariableMapping::NotStored) {
286 return std::nullopt;
287 }
288 components[field] = component;
289 }
290 }
291 }
292 if (std::find(components.begin(), components.end(), SourceVariableMapping::NotStored)
293 != components.end()) {
294 return std::nullopt;
295 }
296
297 SourceVariableMapping mapping;
298 for (std::size_t i = 0; i < NumberOfSymmetricTensorComponents; ++i) {
299 mapping.conformalMetric[i] = components[i];
301 }
302 mapping.traceK = components[static_cast<std::size_t>(CompactField::TraceK)];
303 mapping.conformalFactor = components[static_cast<std::size_t>(CompactField::Phi)];
304 return mapping;
305}
306
314 const SourceVariableMapping& sourceMapping,
315 std::span<const std::string> componentNames
316) {
317 const auto named = SourceVariableMappingFromComponentNames(componentNames);
318 if (!named) {
319 return;
320 }
321
322 const auto given = sourceMapping.componentsInCompactOrder();
323 const auto expected = named->componentsInCompactOrder();
324 for (std::size_t field = 0; field < given.size(); ++field) {
325 if (given[field] != expected[field]) {
326 const std::string givenComponent = given[field] < componentNames.size()
327 ? "which the data names " + componentNames[given[field]]
328 : std::string("which the data does not have");
329 throw std::invalid_argument(
330 "SourceVariableMapping: required field "
331 + std::string(CompactFieldNames[field]) + " selects source component "
332 + std::to_string(given[field]) + ", " + givenComponent + ", but "
333 + CCZ4SourceComponentNames[field] + " is component "
334 + std::to_string(expected[field])
335 + "; the mapping does not match this data's layout");
336 }
337 }
338}
339
345inline std::array<double, NumberOfCompactFields> CompactSourceTuple(
346 std::span<const double> sourceTuple,
347 const SourceVariableMapping& sourceMapping
348) {
349 sourceMapping.validateAgainstSourceTuple(sourceTuple.size());
350
351 const auto sourceComponents = sourceMapping.componentsInCompactOrder();
352
353 std::array<double, NumberOfCompactFields> compact{};
354 for (std::size_t column = 0; column < compact.size(); ++column) {
355 compact[column] = sourceTuple[sourceComponents[column]];
356 }
357 return compact;
358}
359
364public:
366 std::span<const double, NumberOfCompactFields> values
367 ): _values(values) {}
368
369 std::span<const double, NumberOfCompactFields> row() const {
370 return _values;
371 }
372
373 double conformalMetricComponent(std::size_t component) const {
374 return tensorComponent(component, ConformalMetricCompactFields, "conformal metric");
375 }
376
378 return conformalMetricComponent(static_cast<std::size_t>(component));
379 }
380
381 double conformalExtrinsicCurvatureComponent(std::size_t component) const {
382 return tensorComponent(
383 component,
385 "conformal extrinsic curvature"
386 );
387 }
388
390 return conformalExtrinsicCurvatureComponent(static_cast<std::size_t>(component));
391 }
392
393 double traceK() const {
395 }
396
397 double phi() const {
399 }
400
401private:
402 double compactValue(CompactField field) const {
403 return _values[static_cast<std::size_t>(field)];
404 }
405
407 std::size_t component,
408 const std::array<CompactField, NumberOfSymmetricTensorComponents>& fields,
409 const char* tensorName
410 ) const {
411 if (component >= fields.size()) {
412 throw std::out_of_range(
413 "CompactCellView: " + std::string(tensorName)
414 + " component index " + std::to_string(component)
415 + " is outside xx, xy, xz, yy, yz, zz");
416 }
417 return compactValue(fields[component]);
418 }
419
420 std::span<const double, NumberOfCompactFields> _values;
421};
422
429struct GridData {
430 std::vector<GridCoordinate> coordinates;
431 std::vector<double> values;
432
433 static constexpr std::size_t numberOfVariables = NumberOfCompactFields;
434
435 std::size_t numberOfPoints() const {
436 return coordinates.size();
437 }
438
439 void resize(std::size_t numberOfPoints) {
442 }
443
444 bool isConsistent() const {
445 return values.size() == coordinates.size() * numberOfVariables;
446 }
447
448 CompactCellView cell(std::size_t cellIndex) const {
449 if (!isConsistent()) {
450 throw std::logic_error(
451 "GridData::cell: malformed compact data; expected "
452 + std::to_string(coordinates.size() * numberOfVariables) + " values for "
453 + std::to_string(coordinates.size()) + " cells, but found "
454 + std::to_string(values.size()));
455 }
456 if (cellIndex >= coordinates.size()) {
457 throw std::out_of_range(
458 "GridData::cell: cell index " + std::to_string(cellIndex)
459 + " is outside " + std::to_string(coordinates.size()) + " cells");
460 }
461
462 return CompactCellView(
463 std::span<const double, NumberOfCompactFields>(
464 values.data() + cellIndex * numberOfVariables,
466 )
467 );
468 }
469
470 double& value(const GridCoordinate& coordinate, std::size_t variableIndex) {
471 return values[valueIndex(coordinate, variableIndex)];
472 }
473
474 const double& value(const GridCoordinate& coordinate, std::size_t variableIndex) const {
475 return values[valueIndex(coordinate, variableIndex)];
476 }
477
478 double& value(const GridCoordinate& coordinate, CompactField field) {
479 return value(coordinate, static_cast<std::size_t>(field));
480 }
481
482 const double& value(const GridCoordinate& coordinate, CompactField field) const {
483 return value(coordinate, static_cast<std::size_t>(field));
484 }
485
486private:
487 std::size_t valueIndex(const GridCoordinate& coordinate, std::size_t variableIndex) const {
488 if (variableIndex >= numberOfVariables) {
489 throw std::out_of_range("GridData variable index is out of range");
490 }
491
492 const auto point = std::find_if(
493 coordinates.begin(),
494 coordinates.end(),
495 [&coordinate](const GridCoordinate& candidate) {
496 return coordinatesEqual(candidate.x, coordinate.x)
497 && coordinatesEqual(candidate.y, coordinate.y)
498 && coordinatesEqual(candidate.z, coordinate.z);
499 }
500 );
501 if (point == coordinates.end()) {
502 throw std::out_of_range("GridData coordinate was not found");
503 }
504
505 const auto pointIndex = static_cast<std::size_t>(point - coordinates.begin());
506 return pointIndex * numberOfVariables + variableIndex;
507 }
508
509 static bool coordinatesEqual(double first, double second) {
510 constexpr double AbsoluteTolerance = 1.0e-12;
511 constexpr double RelativeTolerance = 1.0e-10;
512 return std::abs(first - second)
513 <= AbsoluteTolerance
514 + RelativeTolerance * std::max(std::abs(first), std::abs(second));
515 }
516};
517
518using Vector3 = std::array<double, 3>;
519using Tensor3 = std::array<std::array<double, 3>, 3>;
520using Tensor3Derivative = std::array<Tensor3, 3>; // [k][i][j] = partial_k tensor_ij
521
527 std::span<const double, NumberOfSymmetricTensorComponents> components
528) {
529 return Tensor3{{
530 {{components[0], components[1], components[2]}},
531 {{components[1], components[3], components[4]}},
532 {{components[2], components[4], components[5]}}
533 }};
534}
535
537inline constexpr double MinimumPhysicalPhi = 1.0e-2;
538
539inline void ValidatePhysicalPhi(double phi) {
540 if (!std::isfinite(phi)) {
541 throw std::invalid_argument(
542 "Geometry conversion: direct phi must be finite");
543 }
544 if (phi <= 0.0) {
545 throw std::invalid_argument(
546 "Geometry conversion: direct phi must be strictly positive");
547 }
548 if (phi < MinimumPhysicalPhi) {
549 throw std::invalid_argument(
550 "Geometry conversion: direct phi is below the safe division threshold 1e-2");
551 }
552}
553
555inline Tensor3 ComputePhysicalSpatialMetric(const Tensor3& gammaTilde, double phi) {
557 const double inversePhiSquared = 1.0 / (phi * phi);
558
559 Tensor3 gamma{};
560 for (std::size_t i = 0; i < 3; ++i) {
561 for (std::size_t j = i; j < 3; ++j) {
562 gamma[i][j] = gammaTilde[i][j] * inversePhiSquared;
563 gamma[j][i] = gamma[i][j];
564 }
565 }
566 return gamma;
567}
568
573 const Tensor3& ATilde,
574 double traceK,
575 const Tensor3& gammaTilde,
576 double phi
577) {
579 const double inversePhiSquared = 1.0 / (phi * phi);
580
581 Tensor3 extrinsicCurvature{};
582 for (std::size_t i = 0; i < 3; ++i) {
583 for (std::size_t j = i; j < 3; ++j) {
584 extrinsicCurvature[i][j] =
585 (ATilde[i][j] + traceK * gammaTilde[i][j] / 3.0) * inversePhiSquared;
586 extrinsicCurvature[j][i] = extrinsicCurvature[i][j];
587 }
588 }
589 return extrinsicCurvature;
590}
591
598 const Tensor3& gammaTilde,
599 const Tensor3Derivative& gammaTildeDerivative,
600 double phi,
601 const Vector3& phiDerivative
602) {
604 const double inversePhiSquared = 1.0 / (phi * phi);
605 const double inversePhiCubed = inversePhiSquared / phi;
606
607 Tensor3Derivative gammaDerivative{};
608 for (std::size_t k = 0; k < 3; ++k) {
609 for (std::size_t i = 0; i < 3; ++i) {
610 for (std::size_t j = i; j < 3; ++j) {
611 gammaDerivative[k][i][j] =
612 gammaTildeDerivative[k][i][j] * inversePhiSquared
613 - 2.0 * gammaTilde[i][j] * phiDerivative[k] * inversePhiCubed;
614 gammaDerivative[k][j][i] = gammaDerivative[k][i][j];
615 }
616 }
617 }
618 return gammaDerivative;
619}
620
629 std::array<Vector3, 2> coordinateGradient{}; // X^u_i
630 std::array<Tensor3, 2> coordinateHessian{}; // X^u_ij
631 Tensor3 spatialMetric{}; // gamma_ij
632 Tensor3Derivative spatialMetricDerivative{}; // [k][i][j] = partial_k gamma_ij
635 double traceK = 0.0;
636};
637
642 double r = 0.0;
643 double rho = 0.0;
644 double sigma = 0.0;
646};
647
657 double innerRadius = 0.0;
658 double outerRadius = 0.0;
659 std::vector<InterpolatedShellPoint> points;
660
661 std::size_t numberOfPoints() const {
662 return points.size();
663 }
664
666 return *findPoint(coordinate);
667 }
668
669 const InterpolatedShellPoint& value(const AHGuessPoint& coordinate) const {
670 return *findPoint(coordinate);
671 }
672
673 bool isConsistent() const {
674 if (!std::isfinite(innerRadius) || !std::isfinite(outerRadius)
675 || innerRadius > outerRadius || points.empty()) {
676 return false;
677 }
678
679 for (const InterpolatedShellPoint& point : points) {
680 if (!std::isfinite(point.r) || !std::isfinite(point.rho)
681 || !std::isfinite(point.sigma) || point.r < innerRadius
682 || point.r > outerRadius) {
683 return false;
684 }
685 }
686 return true;
687 }
688
689private:
690 std::vector<InterpolatedShellPoint>::iterator findPoint(const AHGuessPoint& coordinate) {
691 const auto point = std::find_if(
692 points.begin(),
693 points.end(),
694 [&coordinate](const InterpolatedShellPoint& candidate) {
695 return coordinatesEqual(candidate.r, coordinate.r)
696 && coordinatesEqual(candidate.rho, coordinate.rho)
697 && coordinatesEqual(candidate.sigma, coordinate.sigma);
698 }
699 );
700 if (point == points.end()) {
701 throw std::out_of_range("InterpolatedShell coordinate was not found");
702 }
703 return point;
704 }
705
706 std::vector<InterpolatedShellPoint>::const_iterator findPoint(const AHGuessPoint& coordinate) const {
707 const auto point = std::find_if(
708 points.begin(),
709 points.end(),
710 [&coordinate](const InterpolatedShellPoint& candidate) {
711 return coordinatesEqual(candidate.r, coordinate.r)
712 && coordinatesEqual(candidate.rho, coordinate.rho)
713 && coordinatesEqual(candidate.sigma, coordinate.sigma);
714 }
715 );
716 if (point == points.end()) {
717 throw std::out_of_range("InterpolatedShell coordinate was not found");
718 }
719 return point;
720 }
721
722 static bool coordinatesEqual(double first, double second) {
723 constexpr double AbsoluteTolerance = 1.0e-12;
724 constexpr double RelativeTolerance = 1.0e-10;
725 return std::abs(first - second)
726 <= AbsoluteTolerance
727 + RelativeTolerance * std::max(std::abs(first), std::abs(second));
728 }
729};
730
744
751 std::vector<InterpolatedSurfacePoint> points;
752
753 std::size_t numberOfPoints() const {
754 return points.size();
755 }
756
758 return *findPoint(coordinate);
759 }
760
761 const InterpolatedSurfacePoint& value(const AHGuessPoint& coordinate) const {
762 return *findPoint(coordinate);
763 }
764
765 bool isConsistent() const {
766 if (points.empty()) {
767 return false;
768 }
769
770 for (const InterpolatedSurfacePoint& point : points) {
771 if (!std::isfinite(point.r) || !std::isfinite(point.rho)
772 || !std::isfinite(point.sigma) || point.r < 0.0) {
773 return false;
774 }
775 }
776 return true;
777 }
778
779 bool matches(const AHGuess& ahGuess) const {
780 if (points.size() != ahGuess.points.size()) {
781 return false;
782 }
783
784 for (std::size_t i = 0; i < points.size(); ++i) {
785 if (points[i].r != ahGuess.points[i].r
786 || points[i].rho != ahGuess.points[i].rho
787 || points[i].sigma != ahGuess.points[i].sigma) {
788 return false;
789 }
790 }
791 return true;
792 }
793
794private:
795 std::vector<InterpolatedSurfacePoint>::iterator findPoint(const AHGuessPoint& coordinate) {
796 const auto point = std::find_if(
797 points.begin(),
798 points.end(),
799 [&coordinate](const InterpolatedSurfacePoint& candidate) {
800 return coordinatesEqual(candidate.r, coordinate.r)
801 && coordinatesEqual(candidate.rho, coordinate.rho)
802 && coordinatesEqual(candidate.sigma, coordinate.sigma);
803 }
804 );
805 if (point == points.end()) {
806 throw std::out_of_range("InterpolatedSurface coordinate was not found");
807 }
808 return point;
809 }
810
811 std::vector<InterpolatedSurfacePoint>::const_iterator findPoint(const AHGuessPoint& coordinate) const {
812 const auto point = std::find_if(
813 points.begin(),
814 points.end(),
815 [&coordinate](const InterpolatedSurfacePoint& candidate) {
816 return coordinatesEqual(candidate.r, coordinate.r)
817 && coordinatesEqual(candidate.rho, coordinate.rho)
818 && coordinatesEqual(candidate.sigma, coordinate.sigma);
819 }
820 );
821 if (point == points.end()) {
822 throw std::out_of_range("InterpolatedSurface coordinate was not found");
823 }
824 return point;
825 }
826
827 static bool coordinatesEqual(double first, double second) {
828 constexpr double AbsoluteTolerance = 1.0e-12;
829 constexpr double RelativeTolerance = 1.0e-10;
830 return std::abs(first - second)
831 <= AbsoluteTolerance
832 + RelativeTolerance * std::max(std::abs(first), std::abs(second));
833 }
834};
835
836} // namespace exahype2::ccz4::ahf
837
838#endif // APPARENT_HORIZON_FINDER_AHF_DATA_H_
Read-only, zero-copy view of one fixed-layout compact cell row.
Definition ahf-data.h:363
std::span< const double, NumberOfCompactFields > _values
Definition ahf-data.h:420
double conformalMetricComponent(SymmetricTensorComponent component) const
Definition ahf-data.h:377
double conformalExtrinsicCurvatureComponent(std::size_t component) const
Definition ahf-data.h:381
double compactValue(CompactField field) const
Definition ahf-data.h:402
CompactCellView(std::span< const double, NumberOfCompactFields > values)
Definition ahf-data.h:365
double conformalMetricComponent(std::size_t component) const
Definition ahf-data.h:373
double tensorComponent(std::size_t component, const std::array< CompactField, NumberOfSymmetricTensorComponents > &fields, const char *tensorName) const
Definition ahf-data.h:406
std::span< const double, NumberOfCompactFields > row() const
Definition ahf-data.h:369
double conformalExtrinsicCurvatureComponent(SymmetricTensorComponent component) const
Definition ahf-data.h:389
std::array< Tensor3, 3 > Tensor3Derivative
Definition ahf-data.h:520
constexpr std::size_t NumberOfCompactFields
Definition ahf-data.h:107
@ RadiusWeightedPolynomial
All cells inside supportRadius, using compact Wendland-C2 weights.
Definition ahf-data.h:66
@ UnweightedDegree1
Backward-compatible names retained for callers of the original degree-1 API.
Definition ahf-data.h:68
constexpr std::array< CompactField, NumberOfSymmetricTensorComponents > ConformalMetricCompactFields
Definition ahf-data.h:133
std::optional< SourceVariableMapping > SourceVariableMappingFromComponentNames(std::span< const std::string > componentNames)
Build the mapping from the component names of a source tuple.
Definition ahf-data.h:277
SourceVariableMapping ExaGRyPESourceMapping()
Mapping for output of the exagrype.api solvers, in the order of FOCCZ4Solver.Unknowns (src/exagrype/a...
Definition ahf-data.h:238
std::array< double, 3 > Vector3
Definition ahf-data.h:518
Tensor3 ComputePhysicalSpatialMetric(const Tensor3 &gammaTilde, double phi)
Compute gamma_ij = gammaTilde_ij / phi^2 for direct (not logarithmic) phi.
Definition ahf-data.h:555
constexpr std::size_t NumberOfSymmetricTensorComponents
Definition ahf-data.h:129
Tensor3 ComputePhysicalExtrinsicCurvature(const Tensor3 &ATilde, double traceK, const Tensor3 &gammaTilde, double phi)
Compute K_ij = (ATilde_ij + K gammaTilde_ij / 3) / phi^2 using direct phi.
Definition ahf-data.h:572
constexpr double MinimumPhysicalPhi
Active kernels use 1e-2 as the safe lower bound for direct phi.
Definition ahf-data.h:537
SymmetricTensorComponent
Symmetric-tensor component order used by both compact tensors.
Definition ahf-data.h:119
constexpr std::array< CompactField, NumberOfSymmetricTensorComponents > ConformalExtrinsicCurvatureCompactFields
Definition ahf-data.h:140
std::array< double, NumberOfCompactFields > CompactSourceTuple(std::span< const double > sourceTuple, const SourceVariableMapping &sourceMapping)
Apply the sole source-index to compact-index transformation.
Definition ahf-data.h:345
SourceVariableMapping LegacyCCZ4SourceMapping()
Mapping for output of the legacy applications/exahype2/ccz4/ccz4.py, which stores traceK at 53 and ph...
Definition ahf-data.h:252
CompactField
Fixed column layout of every compact row stored in GridData.
Definition ahf-data.h:89
void ValidatePhysicalPhi(double phi)
Definition ahf-data.h:539
std::array< std::array< double, 3 >, 3 > Tensor3
Definition ahf-data.h:519
void ValidateSourceMappingAgainstComponentNames(const SourceVariableMapping &sourceMapping, std::span< const std::string > componentNames)
Reject a mapping that contradicts the component names of the source tuple.
Definition ahf-data.h:313
constexpr std::array< const char *, NumberOfCompactFields > CompactFieldNames
Definition ahf-data.h:110
Tensor3Derivative ComputePhysicalSpatialMetricDerivative(const Tensor3 &gammaTilde, const Tensor3Derivative &gammaTildeDerivative, double phi, const Vector3 &phiDerivative)
Compute Cartesian physical-metric derivatives in [k][i][j] order: partial_k gamma_ij = partial_k gamm...
Definition ahf-data.h:597
Tensor3 UnpackSymmetricTensor(std::span< const double, NumberOfSymmetricTensorComponents > components)
Expand symmetric components ordered xx, xy, xz, yy, yz, zz into a 3x3 tensor.
Definition ahf-data.h:526
constexpr std::array< const char *, NumberOfCompactFields > CCZ4SourceComponentNames
Names the CCZ4 solvers give the AHF fields, in CompactField order.
Definition ahf-data.h:267
-source
One point on an apparent-horizon guess, expressed in spherical coordinates.
Definition ahf-data.h:29
One apparent-horizon hypersurface guess.
Definition ahf-data.h:48
std::vector< AHGuessPoint > points
Definition ahf-data.h:49
User-provided angular coordinate at which the shell should be sampled.
Definition ahf-data.h:38
Cartesian coordinate for one sampled grid point.
Definition ahf-data.h:55
Pointwise Cartesian grid data.
Definition ahf-data.h:429
const double & value(const GridCoordinate &coordinate, std::size_t variableIndex) const
Definition ahf-data.h:474
std::vector< double > values
Definition ahf-data.h:431
double & value(const GridCoordinate &coordinate, CompactField field)
Definition ahf-data.h:478
void resize(std::size_t numberOfPoints)
Definition ahf-data.h:439
static constexpr std::size_t numberOfVariables
Definition ahf-data.h:433
const double & value(const GridCoordinate &coordinate, CompactField field) const
Definition ahf-data.h:482
std::vector< GridCoordinate > coordinates
Definition ahf-data.h:430
std::size_t valueIndex(const GridCoordinate &coordinate, std::size_t variableIndex) const
Definition ahf-data.h:487
static bool coordinatesEqual(double first, double second)
Definition ahf-data.h:509
double & value(const GridCoordinate &coordinate, std::size_t variableIndex)
Definition ahf-data.h:470
CompactCellView cell(std::size_t cellIndex) const
Definition ahf-data.h:448
std::size_t numberOfPoints() const
Definition ahf-data.h:435
Physical and geometrical quantities shared by shell and surface samples.
Definition ahf-data.h:627
std::array< Tensor3, 2 > coordinateHessian
Definition ahf-data.h:630
std::array< Vector3, 2 > coordinateGradient
Definition ahf-data.h:629
Interpolated quantities at one spherical shell sample (r, rho, sigma).
Definition ahf-data.h:641
Interpolated data on the shell-like subdomain around an AH guess.
Definition ahf-data.h:656
std::vector< InterpolatedShellPoint >::iterator findPoint(const AHGuessPoint &coordinate)
Definition ahf-data.h:690
InterpolatedShellPoint & value(const AHGuessPoint &coordinate)
Definition ahf-data.h:665
std::vector< InterpolatedShellPoint > points
Definition ahf-data.h:659
static bool coordinatesEqual(double first, double second)
Definition ahf-data.h:722
const InterpolatedShellPoint & value(const AHGuessPoint &coordinate) const
Definition ahf-data.h:669
std::vector< InterpolatedShellPoint >::const_iterator findPoint(const AHGuessPoint &coordinate) const
Definition ahf-data.h:706
Interpolated quantities at one point on the current AH surface.
Definition ahf-data.h:734
InterpolationDiagnostics interpolationDiagnostics
Definition ahf-data.h:742
Interpolated data on the current AH surface r = h(rho, sigma).
Definition ahf-data.h:750
std::vector< InterpolatedSurfacePoint >::const_iterator findPoint(const AHGuessPoint &coordinate) const
Definition ahf-data.h:811
std::vector< InterpolatedSurfacePoint >::iterator findPoint(const AHGuessPoint &coordinate)
Definition ahf-data.h:795
bool matches(const AHGuess &ahGuess) const
Definition ahf-data.h:779
static bool coordinatesEqual(double first, double second)
Definition ahf-data.h:827
std::vector< InterpolatedSurfacePoint > points
Definition ahf-data.h:751
const InterpolatedSurfacePoint & value(const AHGuessPoint &coordinate) const
Definition ahf-data.h:761
InterpolatedSurfacePoint & value(const AHGuessPoint &coordinate)
Definition ahf-data.h:757
CartesianToSurfaceMethod requestedMethod
Definition ahf-data.h:73
Cartesian reference coordinate for one apparent-horizon centre point.
Definition ahf-data.h:20
Reader-side mapping from compact fields to components of a source tuple.
Definition ahf-data.h:149
std::array< Index, 6 > conformalExtrinsicCurvature
Definition ahf-data.h:156
bool isValid(std::size_t numberOfSourceComponents) const
Definition ahf-data.h:217
void validateAgainstSourceTuple(std::size_t numberOfSourceComponents) const
Definition ahf-data.h:203
std::array< Index, 6 > conformalMetric
Definition ahf-data.h:153
std::array< Index, NumberOfCompactFields > componentsInCompactOrder() const
Definition ahf-data.h:162