CMS 3D CMS Logo

VectorFieldInterpolation.cc
Go to the documentation of this file.
1 // include header for VectorFieldInterpolation
3 
4 void VectorFieldInterpolation::defineCellPoint000(double X1, double X2, double X3, double F1, double F2, double F3) {
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 }
13 
14 void VectorFieldInterpolation::defineCellPoint100(double X1, double X2, double X3, double F1, double F2, double F3) {
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 }
23 
24 void VectorFieldInterpolation::defineCellPoint010(double X1, double X2, double X3, double F1, double F2, double F3) {
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 }
33 
34 void VectorFieldInterpolation::defineCellPoint110(double X1, double X2, double X3, double F1, double F2, double F3) {
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 }
43 
44 void VectorFieldInterpolation::defineCellPoint001(double X1, double X2, double X3, double F1, double F2, double F3) {
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 }
53 
54 void VectorFieldInterpolation::defineCellPoint101(double X1, double X2, double X3, double F1, double F2, double F3) {
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 }
63 
64 void VectorFieldInterpolation::defineCellPoint011(double X1, double X2, double X3, double F1, double F2, double F3) {
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 }
73 
74 void VectorFieldInterpolation::defineCellPoint111(double X1, double X2, double X3, double F1, double F2, double F3) {
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 }
83 
84 void VectorFieldInterpolation::putSCoordGetVField(double X1, double X2, double X3, double &F1, double &F2, double &F3) {
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 }
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)