CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
VectorFieldInterpolation Class Reference

#include <VectorFieldInterpolation.h>

Public Member Functions

void defineCellPoint000 (double X1, double X2, double X3, double F1, double F2, double F3)
 provide the interpolation algorithm with 8 points, where the field is known (in) More...
 
void defineCellPoint001 (double X1, double X2, double X3, double F1, double F2, double F3)
 
void defineCellPoint010 (double X1, double X2, double X3, double F1, double F2, double F3)
 
void defineCellPoint011 (double X1, double X2, double X3, double F1, double F2, double F3)
 
void defineCellPoint100 (double X1, double X2, double X3, double F1, double F2, double F3)
 
void defineCellPoint101 (double X1, double X2, double X3, double F1, double F2, double F3)
 
void defineCellPoint110 (double X1, double X2, double X3, double F1, double F2, double F3)
 
void defineCellPoint111 (double X1, double X2, double X3, double F1, double F2, double F3)
 
void putSCoordGetVField (double X1, double X2, double X3, double &F1, double &F2, double &F3)
 receive the interpolated field (out) at any point in space (in) More...
 
 VectorFieldInterpolation ()
 
 ~VectorFieldInterpolation ()
 

Private Attributes

double CellPoint000 [6]
 
double CellPoint001 [6]
 
double CellPoint010 [6]
 
double CellPoint011 [6]
 
double CellPoint100 [6]
 
double CellPoint101 [6]
 
double CellPoint110 [6]
 
double CellPoint111 [6]
 
double SC [3]
 
double VF [3]
 

Detailed Description

linear interpolation of a field (3D) in space (3D)

Author
: Volke.nosp@m.r.Dr.nosp@m.ollin.nosp@m.ger@.nosp@m.cern..nosp@m.ch

Modifications: droll: change from float to double droll: rename methods according to CMS coding rules

Definition at line 54 of file VectorFieldInterpolation.h.

Constructor & Destructor Documentation

◆ VectorFieldInterpolation()

VectorFieldInterpolation::VectorFieldInterpolation ( )
inline

Definition at line 57 of file VectorFieldInterpolation.h.

57 {}

◆ ~VectorFieldInterpolation()

VectorFieldInterpolation::~VectorFieldInterpolation ( )
inline

Definition at line 59 of file VectorFieldInterpolation.h.

59 {}

Member Function Documentation

◆ defineCellPoint000()

void VectorFieldInterpolation::defineCellPoint000 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

provide the interpolation algorithm with 8 points, where the field is known (in)

Definition at line 4 of file VectorFieldInterpolation.cc.

4  {
5  CellPoint000[0] = X1;
6  CellPoint000[1] = X2;
7  CellPoint000[2] = X3;
8  CellPoint000[3] = F1;
9  CellPoint000[4] = F2;
10  CellPoint000[5] = F3;
11  return;
12 }

References CellPoint000.

Referenced by MagneticFieldGrid::interpolateAtPoint().

◆ defineCellPoint001()

void VectorFieldInterpolation::defineCellPoint001 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 44 of file VectorFieldInterpolation.cc.

44  {
45  CellPoint001[0] = X1;
46  CellPoint001[1] = X2;
47  CellPoint001[2] = X3;
48  CellPoint001[3] = F1;
49  CellPoint001[4] = F2;
50  CellPoint001[5] = F3;
51  return;
52 }

References CellPoint001.

Referenced by MagneticFieldGrid::interpolateAtPoint().

◆ defineCellPoint010()

void VectorFieldInterpolation::defineCellPoint010 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 24 of file VectorFieldInterpolation.cc.

24  {
25  CellPoint010[0] = X1;
26  CellPoint010[1] = X2;
27  CellPoint010[2] = X3;
28  CellPoint010[3] = F1;
29  CellPoint010[4] = F2;
30  CellPoint010[5] = F3;
31  return;
32 }

References CellPoint010.

Referenced by MagneticFieldGrid::interpolateAtPoint().

◆ defineCellPoint011()

void VectorFieldInterpolation::defineCellPoint011 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 64 of file VectorFieldInterpolation.cc.

64  {
65  CellPoint011[0] = X1;
66  CellPoint011[1] = X2;
67  CellPoint011[2] = X3;
68  CellPoint011[3] = F1;
69  CellPoint011[4] = F2;
70  CellPoint011[5] = F3;
71  return;
72 }

References CellPoint011.

Referenced by MagneticFieldGrid::interpolateAtPoint().

◆ defineCellPoint100()

void VectorFieldInterpolation::defineCellPoint100 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 14 of file VectorFieldInterpolation.cc.

14  {
15  CellPoint100[0] = X1;
16  CellPoint100[1] = X2;
17  CellPoint100[2] = X3;
18  CellPoint100[3] = F1;
19  CellPoint100[4] = F2;
20  CellPoint100[5] = F3;
21  return;
22 }

References CellPoint100.

Referenced by MagneticFieldGrid::interpolateAtPoint().

◆ defineCellPoint101()

void VectorFieldInterpolation::defineCellPoint101 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 54 of file VectorFieldInterpolation.cc.

54  {
55  CellPoint101[0] = X1;
56  CellPoint101[1] = X2;
57  CellPoint101[2] = X3;
58  CellPoint101[3] = F1;
59  CellPoint101[4] = F2;
60  CellPoint101[5] = F3;
61  return;
62 }

References CellPoint101.

Referenced by MagneticFieldGrid::interpolateAtPoint().

◆ defineCellPoint110()

void VectorFieldInterpolation::defineCellPoint110 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 34 of file VectorFieldInterpolation.cc.

34  {
35  CellPoint110[0] = X1;
36  CellPoint110[1] = X2;
37  CellPoint110[2] = X3;
38  CellPoint110[3] = F1;
39  CellPoint110[4] = F2;
40  CellPoint110[5] = F3;
41  return;
42 }

References CellPoint110.

Referenced by MagneticFieldGrid::interpolateAtPoint().

◆ defineCellPoint111()

void VectorFieldInterpolation::defineCellPoint111 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 74 of file VectorFieldInterpolation.cc.

74  {
75  CellPoint111[0] = X1;
76  CellPoint111[1] = X2;
77  CellPoint111[2] = X3;
78  CellPoint111[3] = F1;
79  CellPoint111[4] = F2;
80  CellPoint111[5] = F3;
81  return;
82 }

References CellPoint111.

Referenced by MagneticFieldGrid::interpolateAtPoint().

◆ putSCoordGetVField()

void VectorFieldInterpolation::putSCoordGetVField ( double  X1,
double  X2,
double  X3,
double &  F1,
double &  F2,
double &  F3 
)

receive the interpolated field (out) at any point in space (in)

Definition at line 84 of file VectorFieldInterpolation.cc.

84  {
85  SC[0] = X1;
86  SC[1] = X2;
87  SC[2] = X3;
88 
89  // values describing 4 help points after interpolation step of variables X1
90  // 5 dimensions: 2 space dimensions + 3 field dimensions
91  // X2' , X3' , F1' , F2' , F3'
92  double HelpPoint00[5]; // {0.0 , 0.0 , 0.0 , 0.0 , 0.0};
93  double HelpPoint10[5];
94  double HelpPoint01[5];
95  double HelpPoint11[5];
96 
97  // values describing 2 help points after interpolation step of variables X2'
98  // 4 dimensions: 1 space dimensions + 3 field dimensions
99  // X3" , F1" , F2" , F3"
100  double HelpPoint0[4]; // {0.0 , 0.0 , 0.0 , 0.0};
101  double HelpPoint1[4];
102 
103  // 1. iteration *****
104  // prepare interpolation between CellPoint000 and CellPoint100
105  double DeltaX100X000 = CellPoint100[0] - CellPoint000[0];
106  double DeltaSC0X000overDeltaX100X000 = 0.;
107  if (DeltaX100X000 != 0.)
108  DeltaSC0X000overDeltaX100X000 = (SC[0] - CellPoint000[0]) / DeltaX100X000;
109 
110  // prepare interpolation between CellPoint010 and CellPoint110
111  double DeltaX110X010 = CellPoint110[0] - CellPoint010[0];
112  double DeltaSC0X010overDeltaX110X010 = 0.;
113  if (DeltaX110X010 != 0.)
114  DeltaSC0X010overDeltaX110X010 = (SC[0] - CellPoint010[0]) / DeltaX110X010;
115 
116  // prepare interpolation between CellPoint001 and CellPoint101
117  double DeltaX101X001 = CellPoint101[0] - CellPoint001[0];
118  double DeltaSC0X001overDeltaX101X001 = 0.;
119  if (DeltaX101X001 != 0.)
120  DeltaSC0X001overDeltaX101X001 = (SC[0] - CellPoint001[0]) / DeltaX101X001;
121 
122  // prepare interpolation between CellPoint011 and CellPoint111
123  double DeltaX111X011 = CellPoint111[0] - CellPoint011[0];
124  double DeltaSC0X011overDeltaX111X011 = 0.;
125  if (DeltaX111X011 != 0.)
126  DeltaSC0X011overDeltaX111X011 = (SC[0] - CellPoint011[0]) / DeltaX111X011;
127 
128  for (int i = 0; i < 5; ++i) {
129  int ip = i + 1;
130 
131  // interpolate between CellPoint000 and CellPoint100
132  HelpPoint00[i] = CellPoint000[ip] + DeltaSC0X000overDeltaX100X000 * (CellPoint100[ip] - CellPoint000[ip]);
133 
134  // interpolate between CellPoint010 and CellPoint110
135  HelpPoint10[i] = CellPoint010[ip] + DeltaSC0X010overDeltaX110X010 * (CellPoint110[ip] - CellPoint010[ip]);
136 
137  // interpolate between CellPoint001 and CellPoint101
138  HelpPoint01[i] = CellPoint001[ip] + DeltaSC0X001overDeltaX101X001 * (CellPoint101[ip] - CellPoint001[ip]);
139 
140  // interpolate between CellPoint011 and CellPoint111
141  HelpPoint11[i] = CellPoint011[ip] + DeltaSC0X011overDeltaX111X011 * (CellPoint111[ip] - CellPoint011[ip]);
142  }
143 
144  // 2. iteration *****
145  // prepare interpolation between HelpPoint00 and HelpPoint10
146  double DeltaX10X00 = HelpPoint10[0] - HelpPoint00[0];
147  double DeltaSC1X00overDeltaX10X00 = 0.;
148  if (DeltaX10X00 != 0.)
149  DeltaSC1X00overDeltaX10X00 = (SC[1] - HelpPoint00[0]) / DeltaX10X00;
150  // prepare interpolation between HelpPoint01 and HelpPoint11
151  double DeltaX11X01 = HelpPoint11[0] - HelpPoint01[0];
152  double DeltaSC1X01overDeltaX11X01 = 0.;
153  if (DeltaX11X01 != 0.)
154  DeltaSC1X01overDeltaX11X01 = (SC[1] - HelpPoint01[0]) / DeltaX11X01;
155 
156  for (int i = 0; i < 4; ++i) {
157  int ip = i + 1;
158 
159  // interpolate between HelpPoint00 and HelpPoint10
160  HelpPoint0[i] = HelpPoint00[ip] + DeltaSC1X00overDeltaX10X00 * (HelpPoint10[ip] - HelpPoint00[ip]);
161 
162  // interpolate between HelpPoint01 and HelpPoint11
163  HelpPoint1[i] = HelpPoint01[ip] + DeltaSC1X01overDeltaX11X01 * (HelpPoint11[ip] - HelpPoint01[ip]);
164  }
165 
166  // 3. iteration *****
167  // prepare interpolation between HelpPoint0 and HelpPoint1
168  double DeltaX1X0 = HelpPoint1[0] - HelpPoint0[0];
169  double DeltaSC2X0overDeltaX1X0 = 0.;
170  if (DeltaX1X0 != 0.)
171  DeltaSC2X0overDeltaX1X0 = (SC[2] - HelpPoint0[0]) / DeltaX1X0;
172 
173  for (int i = 0; i < 3; ++i) {
174  int ip = i + 1;
175 
176  // interpolate between HelpPoint0 and HelpPoint1
177  VF[i] = HelpPoint0[ip] + DeltaSC2X0overDeltaX1X0 * (HelpPoint1[ip] - HelpPoint0[ip]);
178  }
179 
180  F1 = VF[0];
181  F2 = VF[1];
182  F3 = VF[2];
183 
184  return;
185 }

References CellPoint000, CellPoint001, CellPoint010, CellPoint011, CellPoint100, CellPoint101, CellPoint110, CellPoint111, mps_fire::i, SC, and VF.

Referenced by MagneticFieldGrid::interpolateAtPoint().

Member Data Documentation

◆ CellPoint000

double VectorFieldInterpolation::CellPoint000[6]
private

Definition at line 69 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint000(), and putSCoordGetVField().

◆ CellPoint001

double VectorFieldInterpolation::CellPoint001[6]
private

Definition at line 73 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint001(), and putSCoordGetVField().

◆ CellPoint010

double VectorFieldInterpolation::CellPoint010[6]
private

Definition at line 71 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint010(), and putSCoordGetVField().

◆ CellPoint011

double VectorFieldInterpolation::CellPoint011[6]
private

Definition at line 75 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint011(), and putSCoordGetVField().

◆ CellPoint100

double VectorFieldInterpolation::CellPoint100[6]
private

Definition at line 70 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint100(), and putSCoordGetVField().

◆ CellPoint101

double VectorFieldInterpolation::CellPoint101[6]
private

Definition at line 74 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint101(), and putSCoordGetVField().

◆ CellPoint110

double VectorFieldInterpolation::CellPoint110[6]
private

Definition at line 72 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint110(), and putSCoordGetVField().

◆ CellPoint111

double VectorFieldInterpolation::CellPoint111[6]
private

Definition at line 76 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint111(), and putSCoordGetVField().

◆ SC

double VectorFieldInterpolation::SC[3]
private

Definition at line 64 of file VectorFieldInterpolation.h.

Referenced by putSCoordGetVField().

◆ VF

double VectorFieldInterpolation::VF[3]
private

Definition at line 80 of file VectorFieldInterpolation.h.

Referenced by putSCoordGetVField().

mps_fire.i
i
Definition: mps_fire.py:355
VectorFieldInterpolation::VF
double VF[3]
Definition: VectorFieldInterpolation.h:80
VectorFieldInterpolation::CellPoint111
double CellPoint111[6]
Definition: VectorFieldInterpolation.h:76
VectorFieldInterpolation::CellPoint000
double CellPoint000[6]
Definition: VectorFieldInterpolation.h:69
VectorFieldInterpolation::CellPoint110
double CellPoint110[6]
Definition: VectorFieldInterpolation.h:72
VectorFieldInterpolation::CellPoint101
double CellPoint101[6]
Definition: VectorFieldInterpolation.h:74
VectorFieldInterpolation::CellPoint010
double CellPoint010[6]
Definition: VectorFieldInterpolation.h:71
VectorFieldInterpolation::SC
double SC[3]
Definition: VectorFieldInterpolation.h:64
VectorFieldInterpolation::CellPoint100
double CellPoint100[6]
Definition: VectorFieldInterpolation.h:70
VectorFieldInterpolation::CellPoint001
double CellPoint001[6]
Definition: VectorFieldInterpolation.h:73
VectorFieldInterpolation::CellPoint011
double CellPoint011[6]
Definition: VectorFieldInterpolation.h:75