File indexing completed on 2025-08-06 08:17:58
0001 #ifndef PHFIELD_PHFIELD3DCARTESIAN_H
0002 #define PHFIELD_PHFIELD3DCARTESIAN_H
0003
0004 #include "PHField.h"
0005
0006 #include <cmath>
0007 #include <map>
0008 #include <set>
0009 #include <string>
0010 #include <tuple>
0011
0012 class PHField3DCartesian : public PHField
0013 {
0014 public:
0015
0016
0017 explicit PHField3DCartesian(const std::string &fname, const float magfield_rescale = 1.0, const float innerradius = 0, const float outerradius = 1.e10, const float size_z = 1.e10);
0018
0019
0020 ~PHField3DCartesian() override;
0021
0022
0023
0024
0025
0026 void GetFieldValue(const double Point[4], double *Bfield) const override;
0027
0028 void GetFieldValue_nocache(const double Point[4], double *Bfield) const override;
0029
0030 private:
0031 std::string filename;
0032 double xmin = 1000000;
0033 double xmax = -1000000;
0034 double ymin = 1000000;
0035 double ymax = -1000000;
0036 double zmin = 1000000;
0037 double zmax = -1000000;
0038 double xstepsize = NAN;
0039 double ystepsize = NAN;
0040 double zstepsize = NAN;
0041
0042
0043
0044 mutable double bf[2][2][2][3]{};
0045 mutable double xkey_save = NAN;
0046 mutable double ykey_save = NAN;
0047 mutable double zkey_save = NAN;
0048 mutable int cache_hits = 0;
0049 mutable int cache_misses = 0;
0050
0051 typedef std::tuple<float, float, float> trio;
0052 std::map<std::tuple<float, float, float>, std::tuple<float, float, float> > fieldmap;
0053 std::set<float> xvals;
0054 std::set<float> yvals;
0055 std::set<float> zvals;
0056 };
0057
0058 #endif