27 float ox = 0.0f,
float oy = 0.0f,
float oz = 0.0f);
32 int nx()
const {
return grid_.
nx(); }
33 int ny()
const {
return grid_.
ny(); }
34 int nz()
const {
return grid_.
nz(); }
35 float dx()
const {
return static_cast<float>(grid_.
dx()); }
36 float ox()
const {
return ox_; }
37 float oy()
const {
return oy_; }
38 float oz()
const {
return oz_; }
45 float sample(
float x,
float y,
float z)
const;
60 float ox = 0.0f,
float oy = 0.0f,
float oz = 0.0f);
63 std::array<float, 3>
sample(
float px,
float py,
float pz)
const;
99 static constexpr double MU0 = 1.2566370614e-6;
static VectorField3D gradient(const ScalarField3D &phi)
Compute ∇φ via central finite differences (one-sided at boundaries).
static SolverResult solve_poisson(ScalarField3D &phi, const ScalarField3D &source, double tol=1e-6, int max_iter=500)
static VectorField3D curl(const VectorField3D &A)
Compute ∇×A via central finite differences (one-sided at boundaries).
static ScalarField3D divergence(const VectorField3D &f)
Compute ∇·f via central finite differences.
void set(int i, int j, int k, real v)
static VectorField3D solve_magnetic_field(const VectorField3D &J, double tol=1e-6, int max_iter=500)
static VectorField3D current_density(const ScalarField3D &sigma, const ScalarField3D &phi)
Compute current density J = −σ∇φ [A/m²].
static constexpr double MU0
μ₀ [H/m]
void set(int i, int j, int k, double v)
float sample(float x, float y, float z) const
const Grid3D & grid() const
3D Cartesian scalar grid backed by num::Vector storage.
constexpr real phi
Golden ratio.
constexpr T ipow(T x) noexcept
Compute x^N at compile time via repeated squaring.
Umbrella include for all linear solvers.
std::array< float, 3 > sample(float px, float py, float pz) const
Trilinear-interpolated field vector at world position.
ScalarField3D z
x, y, z components on the same grid layout
void scale(float s)
Multiply all components by scalar s.