CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ( )
inline

Definition at line 57 of file VectorFieldInterpolation.h.

57 {}
VectorFieldInterpolation::~VectorFieldInterpolation ( )
inline

Definition at line 59 of file VectorFieldInterpolation.h.

59 {}

Member Function Documentation

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 5 of file VectorFieldInterpolation.cc.

References CellPoint000.

Referenced by MagneticFieldGrid::interpolateAtPoint().

5  {
6  CellPoint000[0] = X1;
7  CellPoint000[1] = X2;
8  CellPoint000[2] = X3;
9  CellPoint000[3] = F1;
10  CellPoint000[4] = F2;
11  CellPoint000[5] = F3;
12  return;
13 }
void VectorFieldInterpolation::defineCellPoint001 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 49 of file VectorFieldInterpolation.cc.

References CellPoint001.

Referenced by MagneticFieldGrid::interpolateAtPoint().

49  {
50  CellPoint001[0] = X1;
51  CellPoint001[1] = X2;
52  CellPoint001[2] = X3;
53  CellPoint001[3] = F1;
54  CellPoint001[4] = F2;
55  CellPoint001[5] = F3;
56  return;
57 }
void VectorFieldInterpolation::defineCellPoint010 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 27 of file VectorFieldInterpolation.cc.

References CellPoint010.

Referenced by MagneticFieldGrid::interpolateAtPoint().

27  {
28  CellPoint010[0] = X1;
29  CellPoint010[1] = X2;
30  CellPoint010[2] = X3;
31  CellPoint010[3] = F1;
32  CellPoint010[4] = F2;
33  CellPoint010[5] = F3;
34  return;
35 }
void VectorFieldInterpolation::defineCellPoint011 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 71 of file VectorFieldInterpolation.cc.

References CellPoint011.

Referenced by MagneticFieldGrid::interpolateAtPoint().

71  {
72  CellPoint011[0] = X1;
73  CellPoint011[1] = X2;
74  CellPoint011[2] = X3;
75  CellPoint011[3] = F1;
76  CellPoint011[4] = F2;
77  CellPoint011[5] = F3;
78  return;
79 }
void VectorFieldInterpolation::defineCellPoint100 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 16 of file VectorFieldInterpolation.cc.

References CellPoint100.

Referenced by MagneticFieldGrid::interpolateAtPoint().

16  {
17  CellPoint100[0] = X1;
18  CellPoint100[1] = X2;
19  CellPoint100[2] = X3;
20  CellPoint100[3] = F1;
21  CellPoint100[4] = F2;
22  CellPoint100[5] = F3;
23  return;
24 }
void VectorFieldInterpolation::defineCellPoint101 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 60 of file VectorFieldInterpolation.cc.

References CellPoint101.

Referenced by MagneticFieldGrid::interpolateAtPoint().

60  {
61  CellPoint101[0] = X1;
62  CellPoint101[1] = X2;
63  CellPoint101[2] = X3;
64  CellPoint101[3] = F1;
65  CellPoint101[4] = F2;
66  CellPoint101[5] = F3;
67  return;
68 }
void VectorFieldInterpolation::defineCellPoint110 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 38 of file VectorFieldInterpolation.cc.

References CellPoint110.

Referenced by MagneticFieldGrid::interpolateAtPoint().

38  {
39  CellPoint110[0] = X1;
40  CellPoint110[1] = X2;
41  CellPoint110[2] = X3;
42  CellPoint110[3] = F1;
43  CellPoint110[4] = F2;
44  CellPoint110[5] = F3;
45  return;
46 }
void VectorFieldInterpolation::defineCellPoint111 ( double  X1,
double  X2,
double  X3,
double  F1,
double  F2,
double  F3 
)

Definition at line 82 of file VectorFieldInterpolation.cc.

References CellPoint111.

Referenced by MagneticFieldGrid::interpolateAtPoint().

82  {
83  CellPoint111[0] = X1;
84  CellPoint111[1] = X2;
85  CellPoint111[2] = X3;
86  CellPoint111[3] = F1;
87  CellPoint111[4] = F2;
88  CellPoint111[5] = F3;
89  return;
90 }
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 93 of file VectorFieldInterpolation.cc.

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

Referenced by MagneticFieldGrid::interpolateAtPoint().

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

Member Data Documentation

double VectorFieldInterpolation::CellPoint000[6]
private

Definition at line 69 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint000(), and putSCoordGetVField().

double VectorFieldInterpolation::CellPoint001[6]
private

Definition at line 73 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint001(), and putSCoordGetVField().

double VectorFieldInterpolation::CellPoint010[6]
private

Definition at line 71 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint010(), and putSCoordGetVField().

double VectorFieldInterpolation::CellPoint011[6]
private

Definition at line 75 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint011(), and putSCoordGetVField().

double VectorFieldInterpolation::CellPoint100[6]
private

Definition at line 70 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint100(), and putSCoordGetVField().

double VectorFieldInterpolation::CellPoint101[6]
private

Definition at line 74 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint101(), and putSCoordGetVField().

double VectorFieldInterpolation::CellPoint110[6]
private

Definition at line 72 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint110(), and putSCoordGetVField().

double VectorFieldInterpolation::CellPoint111[6]
private

Definition at line 76 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint111(), and putSCoordGetVField().

double VectorFieldInterpolation::SC[3]
private

Definition at line 64 of file VectorFieldInterpolation.h.

Referenced by putSCoordGetVField().

double VectorFieldInterpolation::VF[3]
private

Definition at line 80 of file VectorFieldInterpolation.h.

Referenced by putSCoordGetVField().