Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:11:32

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file celeritas/field/LoadCovfieField.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <string>
0010 
0011 #include "corecel/Config.hh"
0012 
0013 #include "corecel/Macros.hh"
0014 #include "celeritas/inp/Field.hh"
0015 
0016 #include "RZMapFieldInput.hh"
0017 
0018 namespace celeritas
0019 {
0020 //---------------------------------------------------------------------------//
0021 #if CELERITAS_USE_COVFIE
0022 /*!
0023  * Load a Cartesian magnetic field map from a binary covfie file.
0024  *
0025  * The covfie file must have been written with the stateful pipeline:
0026  *   affine(3D) -> strided(3D) -> array(float3)
0027  * with any stateless interpolation backend (e.g. \c linear or \c
0028  * nearest_neighbour) between the \c affine and \c strided layers.  Stateless
0029  * backends do not write IO headers, so the binary format is identical
0030  * regardless of which one was used when writing the file.
0031  *
0032  * The returned coordinates and field values are in *native Celeritas units*.
0033  * No unit conversion is applied; the caller is responsible for ensuring the
0034  * covfie file was written in the correct unit system or for converting the
0035  * returned data afterward.
0036  *
0037  * The returned \c inp::CartMapField has the field driver options left at their
0038  * defaults. The caller is responsible for setting them before passing the
0039  * input to a factory.
0040  */
0041 inp::CartMapField load_covfie_cart_field(std::string const& filename);
0042 
0043 //---------------------------------------------------------------------------//
0044 /*!
0045  * Load a 2D BrBz cylindrical magnetic field map from a binary covfie file.
0046  *
0047  * The covfie file must have been written with the stateful pipeline:
0048  *   affine(2D) -> strided(2D) -> array(float2)
0049  * with any stateless interpolation backend between the \c affine and \c
0050  * strided layers.
0051  *
0052  * The two axes are (r, z) and the two field components are (Br, Bz).
0053  *
0054  * The returned \c RZMapFieldInput uses [Z][R] indexing (R stride 1),
0055  * matching the existing Celeritas convention.
0056  *
0057  * The returned coordinates and field values are in *native Celeritas units*.
0058  * No unit conversion is applied.
0059  *
0060  * The returned \c RZMapFieldInput has the field driver options left at their
0061  * defaults. The caller is responsible for setting them before passing the
0062  * input to a factory.
0063  */
0064 RZMapFieldInput load_covfie_rz_field(std::string const& filename);
0065 
0066 #else
0067 
0068 inline inp::CartMapField load_covfie_cart_field(std::string const&)
0069 {
0070     CELER_NOT_CONFIGURED("covfie");
0071 }
0072 
0073 inline RZMapFieldInput load_covfie_rz_field(std::string const&)
0074 {
0075     CELER_NOT_CONFIGURED("covfie");
0076 }
0077 #endif
0078 
0079 //---------------------------------------------------------------------------//
0080 }  // namespace celeritas