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 <SHiP/Units.hpp>
7#include <array>
8#include <memory>
9#include <string>
10#include <vector>
11
12namespace ship {
13
20 public:
21 // Aliases of the canonical ShipSoft quantity types (SHiP/Units.hpp);
22 // kept for source compatibility with existing implementations.
23 using pos_q = ship::Length;
24 using field_q = ship::MagneticField;
25
26 virtual ~IFieldEvaluator() = default;
27
31 [[nodiscard]] virtual std::array<field_q, 3> at(pos_q x, pos_q y, pos_q z) const = 0;
32};
33
40 std::string name;
41 std::string volume_pattern;
42 std::shared_ptr<IFieldEvaluator> field;
43};
44
48 public:
49 virtual ~IFieldSource() = default;
50
52 [[nodiscard]] virtual std::vector<FieldRegion> const& regions() const = 0;
53};
54
55} // 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.
ship::Length pos_q
Definition IFieldSource.h:23
ship::MagneticField field_q
Definition IFieldSource.h:24
virtual ~IFieldEvaluator()=default
Source of one or more named field regions.
Definition IFieldSource.h:47
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:39
std::shared_ptr< IFieldEvaluator > field
Definition IFieldSource.h:42
std::string name
Definition IFieldSource.h:40
std::string volume_pattern
Definition IFieldSource.h:41