File indexing completed on 2025-08-06 08:17:57
0001
0002 #ifndef PHFIELD_PHFIELD2D_H
0003 #define PHFIELD_PHFIELD2D_H
0004
0005 #include "PHField.h"
0006
0007 #include <map>
0008 #include <string>
0009 #include <tuple>
0010 #include <vector>
0011
0012 class PHField2D : public PHField
0013 {
0014 typedef std::tuple<float, float> trio;
0015
0016 public:
0017 PHField2D(const std::string &filename, const int verb = 0, const float magfield_rescale = 1.0);
0018
0019
0020
0021
0022
0023 void GetFieldValue(const double Point[4], double *Bfield) const override;
0024
0025
0026 void GetFieldValue_nocache(const double Point[4], double *Bfield) const override;
0027
0028 void GetFieldCyl(const double CylPoint[4], double *Bfield) const;
0029
0030 void GetFieldCyl_nocache(const double CylPoint[4], double *Bfield) const;
0031
0032 protected:
0033
0034 std::vector<std::vector<float> > BFieldZ_;
0035 std::vector<std::vector<float> > BFieldR_;
0036 std::vector<std::vector<float> > BFieldPHI_;
0037
0038
0039 std::vector<float> z_map_;
0040 std::vector<float> r_map_;
0041 std::vector<float> phi_map_;
0042
0043 float maxz_, minz_;
0044 double magfield_unit;
0045
0046 private:
0047 void print_map(std::map<trio, trio>::iterator &it) const;
0048
0049
0050
0051
0052
0053
0054
0055 mutable unsigned int r_index0_cache;
0056 mutable unsigned int r_index1_cache;
0057 mutable unsigned int z_index0_cache;
0058 mutable unsigned int z_index1_cache;
0059 };
0060
0061 #endif