|
|
|||
File indexing completed on 2026-11-19 09:41:43
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/MagneticField/MagneticFieldProvider.hpp" 0012 0013 #include <functional> 0014 0015 namespace Acts { 0016 0017 /// A field provider paired with its own reusable lookup cache. 0018 /// Construct once per magnetic field context and reuse for sequential lookups. 0019 /// The provider and context are borrowed and must outlive the query. The 0020 /// context and any context-dependent data referenced by the cache must remain 0021 /// unchanged while the query is in use. Do not share a query between concurrent 0022 /// operations; construct independent queries for them (and for a new magnetic 0023 /// field context). 0024 class MagneticFieldQuery { 0025 public: 0026 /// @param provider Field provider used for both cache creation and lookup 0027 /// @param mctx Borrowed context for cache creation and propagation 0028 MagneticFieldQuery(const MagneticFieldProvider& provider, 0029 const MagneticFieldContext& mctx); 0030 0031 // Borrowed objects must not be temporaries. 0032 MagneticFieldQuery(const MagneticFieldProvider&& provider, 0033 const MagneticFieldContext& mctx) = delete; 0034 0035 MagneticFieldQuery(const MagneticFieldProvider& provider, 0036 const MagneticFieldContext&& mctx) = delete; 0037 0038 /// Access the context used to create this query's cache. 0039 /// @return Borrowed magnetic field context 0040 const MagneticFieldContext& context() const; 0041 0042 /// Query the field, updating the private provider-specific cache. 0043 /// @param position Global position of the lookup 0044 /// @return Magnetic field or the provider's lookup error 0045 Result<Vector3> getField(const Vector3& position); 0046 0047 private: 0048 std::reference_wrapper<const MagneticFieldProvider> m_provider; 0049 std::reference_wrapper<const MagneticFieldContext> m_context; 0050 MagneticFieldProvider::Cache m_cache; 0051 }; 0052 0053 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|