1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
//! The `MetricProvider` seam (design D8): a static-dispatch trait that lets the compressible marcher run
//! generically over *any* structured coordinate, so geometry is **data**, not a code path.
//!
//! A marcher written over `M: MetricProvider<R>` consumes only "there is a computational lattice, a way
//! to sample a field onto it, a physical gradient, and a Jacobian volume factor". `CartesianIdentity` is
//! the capture limit (any geometry, high rank); [`BodyFittedCoordinate`](BodyFittedCoordinate) is
//! the fitted limit (this geometry, `O(10)` rank). Body-fittedness becomes a choice of impl, recovering
//! generality at zero asymptotic rank cost — the result the `qtt_blend_metric` study measured.
//!
//! The continuous body-fit blend parameter `λ` is supplied by
//! [`BlendedMap`](crate::coordinate::BlendedMap), which computes both charts' **forward** Jacobians
//! analytically and exposes the blended *inverse* metric through this trait. It carries a validity
//! precondition this trait cannot express: the blended map must stay invertible, i.e. `det J` one-signed
//! over the closed domain. `BlendedMap::new` scans for that and refuses a folding configuration, but a
//! hand-written `MetricProvider` impl is **not** checked, so a caller supplying its own must respect it.
//! The blend is validated numerically by `studies/qtt_blend_metric`.
//!
//! **Scope of the seam.** This trait carries the contravariant basis and the Jacobian volume factor, and
//! nothing else. That is enough for the first-order chain-rule gradient the compressible marchers use.
//! Second-order or genuinely covariant operators (a curvilinear Laplacian, covariant derivatives) need
//! the metric tensor `g` and the Christoffel symbols as well, which would extend this trait; a consumer
//! should not assume the present seam suffices for them.
use crateCfdScalar;
use ConjugateScalar;
use PhysicsError;
use CausalTensorTrain;
/// A structured curvilinear coordinate over a `2^Lx × 2^Ly` computational lattice, supplying the pieces a
/// compressible marcher needs: field sampling, the chain-rule physical gradient, and the Jacobian volume
/// factor — all carried as low-rank tensor trains. Static dispatch only (used as a generic bound).