SHiP Field Service
Framework-agnostic C++20 library exposing SHiP magnetic field maps.
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
ship::detail Namespace Reference

Classes

struct  GridSpec
 Axis-aligned grid: n[i] samples spanning [min[i], max[i]] (mm). More...
 

Typedefs

using stored_backend_t = covfie::backend::strided< covfie::vector::size3, covfie::backend::array< covfie::vector::float3 > >
 
using reader_field_t = covfie::field< covfie::backend::affine< covfie::backend::clamp< covfie::backend::linear< stored_backend_t > > > >
 
using writer_field_t = covfie::field< covfie::backend::affine< covfie::backend::clamp< covfie::backend::nearest_neighbour< stored_backend_t > > > >
 

Functions

void validate (GridSpec const &spec)
 Throw if spec cannot produce a well-formed grid: every axis needs at least two samples (n - 1 underflows for n == 0 and divides by zero in grid_pos/the affine scale for n == 1) and a positive extent (max > min, otherwise the affine scale is non-positive or infinite).
 
float grid_pos (float min, float max, std::size_t n, std::size_t i)
 Position of sample i on an axis with n samples spanning [min, max].
 
writer_field_t make_writer_field (GridSpec const &spec)
 Build an empty writer-chain field over spec, ready to be filled via writer_field_t::view_t::at(x, y, z) at grid_pos sample positions.
 

Typedef Documentation

◆ reader_field_t

using ship::detail::reader_field_t = typedef covfie::field< covfie::backend::affine<covfie::backend::clamp<covfie::backend::linear<stored_backend_t> >> >

◆ stored_backend_t

using ship::detail::stored_backend_t = typedef covfie::backend::strided<covfie::vector::size3, covfie::backend::array<covfie::vector::float3> >

◆ writer_field_t

using ship::detail::writer_field_t = typedef covfie::field<covfie::backend::affine< covfie::backend::clamp<covfie::backend::nearest_neighbour<stored_backend_t> >> >

Function Documentation

◆ grid_pos()

float ship::detail::grid_pos ( float  min,
float  max,
std::size_t  n,
std::size_t  i 
)
inline

Position of sample i on an axis with n samples spanning [min, max].

Must be used by writers so fill positions land exactly on the grid indices produced by the affine transform. n >= 2 is a precondition (see validate).

◆ make_writer_field()

writer_field_t ship::detail::make_writer_field ( GridSpec const &  spec)
inline

Build an empty writer-chain field over spec, ready to be filled via writer_field_t::view_t::at(x, y, z) at grid_pos sample positions.

◆ validate()

void ship::detail::validate ( GridSpec const &  spec)
inline

Throw if spec cannot produce a well-formed grid: every axis needs at least two samples (n - 1 underflows for n == 0 and divides by zero in grid_pos/the affine scale for n == 1) and a positive extent (max > min, otherwise the affine scale is non-positive or infinite).