CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VectorFieldInterpolation.cc
Go to the documentation of this file.
1 // include header for VectorFieldInterpolation
3 
4 
5 void VectorFieldInterpolation::defineCellPoint000(double X1, double X2, double X3, double F1, double F2, double F3){
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 }
14 
15 
16 void VectorFieldInterpolation::defineCellPoint100(double X1, double X2, double X3, double F1, double F2, double F3){
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 }
25 
26 
27 void VectorFieldInterpolation::defineCellPoint010(double X1, double X2, double X3, double F1, double F2, double F3){
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 }
36 
37 
38 void VectorFieldInterpolation::defineCellPoint110(double X1, double X2, double X3, double F1, double F2, double F3){
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 }
47 
48 
49 void VectorFieldInterpolation::defineCellPoint001(double X1, double X2, double X3, double F1, double F2, double F3){
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 }
58 
59 
60 void VectorFieldInterpolation::defineCellPoint101(double X1, double X2, double X3, double F1, double F2, double F3){
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 }
69 
70 
71 void VectorFieldInterpolation::defineCellPoint011(double X1, double X2, double X3, double F1, double F2, double F3){
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 }
80 
81 
82 void VectorFieldInterpolation::defineCellPoint111(double X1, double X2, double X3, double F1, double F2, double F3){
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 }
91 
92 
93 void VectorFieldInterpolation::putSCoordGetVField(double X1, double X2, double X3, double &F1, double &F2, double &F3){
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 }
void defineCellPoint100(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 defineCellPoint101(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)
void defineCellPoint010(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 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)
void defineCellPoint001(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)