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
35 [[nodiscard]] virtual std::array<field_q, 3> at(pos_q x, pos_q y, pos_q z) const = 0;
36};
37
44 std::string name;
45 std::string volume_pattern;
46 std::shared_ptr<IFieldEvaluator> field;
47};
48
52 public:
53 virtual ~IFieldSource() = default;
54
56 [[nodiscard]] virtual std::vector<FieldRegion> const& regions() const = 0;
57};
58
59} // namespace SHiP
Framework-agnostic point-query evaluator for one magnetic field region.
Definition IFieldSource.h:19
SHiP::Length pos_q
Definition IFieldSource.h:23
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 position (x, y, z) in the evaluator's frame.
SHiP::MagneticField field_q
Definition IFieldSource.h:24
virtual ~IFieldEvaluator()=default
Source of one or more named field regions.
Definition IFieldSource.h:51
virtual ~IFieldSource()=default
virtual std::vector< FieldRegion > const & regions() const =0
Idempotent. Ownership of the evaluators stays with the source.
Definition ActsFieldAdapter.h:25
One magnet's worth of field, tagged by a host-geometry volume pattern.
Definition IFieldSource.h:43
std::shared_ptr< IFieldEvaluator > field
Definition IFieldSource.h:46
std::string name
Definition IFieldSource.h:44
std::string volume_pattern
Definition IFieldSource.h:45