Skip to content

Commit d9239bd

Browse files
committed
add field getter for doubles
1 parent c6115c4 commit d9239bd

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

Common/Field/include/Field/MagFieldFast.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class MagFieldFast
5353
bool Field(const double xyz[3], double bxyz[3]) const;
5454
bool Field(const float xyz[3], float bxyz[3]) const;
5555
bool Field(const math_utils::Point3D<float> xyz, float bxyz[3]) const;
56+
bool Field(const math_utils::Point3D<double> xyz, double bxyz[3]) const;
5657
bool GetBcomp(EDim comp, const double xyz[3], double& b) const;
5758
bool GetBcomp(EDim comp, const float xyz[3], float& b) const;
5859
bool GetBcomp(EDim comp, const math_utils::Point3D<float> xyz, double& b) const;

Common/Field/src/MagFieldFast.cxx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,22 @@ bool MagFieldFast::Field(const math_utils::Point3D<float> xyz, float bxyz[3]) co
217217
return true;
218218
}
219219

220+
//_______________________________________________________________________
221+
bool MagFieldFast::Field(const math_utils::Point3D<double> xyz, double bxyz[3]) const
222+
{
223+
// get field
224+
int zSeg, rSeg, quadrant;
225+
if (!GetSegment(xyz.X(), xyz.Y(), xyz.Z(), zSeg, rSeg, quadrant)) {
226+
return false;
227+
}
228+
const SolParam* par = &mSolPar[rSeg][zSeg][quadrant];
229+
bxyz[kX] = CalcPol(par->parBxyz[kX], xyz.X(), xyz.Y(), xyz.Z()) * mFactorSol;
230+
bxyz[kY] = CalcPol(par->parBxyz[kY], xyz.X(), xyz.Y(), xyz.Z()) * mFactorSol;
231+
bxyz[kZ] = CalcPol(par->parBxyz[kZ], xyz.X(), xyz.Y(), xyz.Z()) * mFactorSol;
232+
//
233+
return true;
234+
}
235+
220236
//_______________________________________________________________________
221237
bool MagFieldFast::GetSegment(float x, float y, float z, int& zSeg, int& rSeg, int& quadrant) const
222238
{

0 commit comments

Comments
 (0)