SHiP Field Service
Framework-agnostic C++20 library exposing SHiP magnetic field maps.
Loading...
Searching...
No Matches
IFieldSource.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 CERN for the benefit of the SHiP Collaboration
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4#pragma once
5
6#include <array>
7#include <memory>
8#include <mp-units/systems/si.h>
9#include <string>
10#include <vector>
11
12namespace ship {
13
20 public:
21 using pos_q = mp_units::quantity<mp_units::si::milli<mp_units::si::metre>, double>;
22 using field_q = mp_units::quantity<mp_units::si::tesla, double>;
23
24 virtual ~IFieldEvaluator() = default;
25
29 [[nodiscard]] virtual std::array<field_q, 3> at(pos_q x, pos_q y, pos_q z) const = 0;
30};
31
38 std::string name;
39 std::string volume_pattern;
40 std::shared_ptr<IFieldEvaluator> field;
41};
42
46 public:
47 virtual ~IFieldSource() = default;
48
50 [[nodiscard]] virtual std::vector<FieldRegion> const& regions() const = 0;
51};
52
53} // namespace ship
Framework-agnostic point-query evaluator for one magnetic field region.
Definition IFieldSource.h:19
virtual std::array< field_q, 3 > at(pos_q x, pos_q y, pos_q z) const =0
Return {Bx, By, Bz} in Tesla at global position (x, y, z) in mm.
mp_units::quantity< mp_units::si::tesla, double > field_q
Definition IFieldSource.h:22
virtual ~IFieldEvaluator()=default
mp_units::quantity< mp_units::si::milli< mp_units::si::metre >, double > pos_q
Definition IFieldSource.h:21
Source of one or more named field regions.
Definition IFieldSource.h:45
virtual ~IFieldSource()=default
virtual std::vector< FieldRegion > const & regions() const =0
Idempotent. Ownership of the evaluators stays with the source.
Definition CovfieFieldSource.h:12
One magnet's worth of field, tagged by a host-geometry volume pattern.
Definition IFieldSource.h:37
std::shared_ptr< IFieldEvaluator > field
Definition IFieldSource.h:40
std::string name
Definition IFieldSource.h:38
std::string volume_pattern
Definition IFieldSource.h:39