Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:32

0001 // include header for VectorFieldInterpolation
0002 #include "VectorFieldInterpolation.h"
0003 
0004 void VectorFieldInterpolation::defineCellPoint000(double X1, double X2, double X3, double F1, double F2, double F3) {
0005   CellPoint000[0] = X1;
0006   CellPoint000[1] = X2;
0007   CellPoint000[2] = X3;
0008   CellPoint000[3] = F1;
0009   CellPoint000[4] = F2;
0010   CellPoint000[5] = F3;
0011   return;
0012 }
0013 
0014 void VectorFieldInterpolation::defineCellPoint100(double X1, double X2, double X3, double F1, double F2, double F3) {
0015   CellPoint100[0] = X1;
0016   CellPoint100[1] = X2;
0017   CellPoint100[2] = X3;
0018   CellPoint100[3] = F1;
0019   CellPoint100[4] = F2;
0020   CellPoint100[5] = F3;
0021   return;
0022 }
0023 
0024 void VectorFieldInterpolation::defineCellPoint010(double X1, double X2, double X3, double F1, double F2, double F3) {
0025   CellPoint010[0] = X1;
0026   CellPoint010[1] = X2;
0027   CellPoint010[2] = X3;
0028   CellPoint010[3] = F1;
0029   CellPoint010[4] = F2;
0030   CellPoint010[5] = F3;
0031   return;
0032 }
0033 
0034 void VectorFieldInterpolation::defineCellPoint110(double X1, double X2, double X3, double F1, double F2, double F3) {
0035   CellPoint110[0] = X1;
0036   CellPoint110[1] = X2;
0037   CellPoint110[2] = X3;
0038   CellPoint110[3] = F1;
0039   CellPoint110[4] = F2;
0040   CellPoint110[5] = F3;
0041   return;
0042 }
0043 
0044 void VectorFieldInterpolation::defineCellPoint001(double X1, double X2, double X3, double F1, double F2, double F3) {
0045   CellPoint001[0] = X1;
0046   CellPoint001[1] = X2;
0047   CellPoint001[2] = X3;
0048   CellPoint001[3] = F1;
0049   CellPoint001[4] = F2;
0050   CellPoint001[5] = F3;
0051   return;
0052 }
0053 
0054 void VectorFieldInterpolation::defineCellPoint101(double X1, double X2, double X3, double F1, double F2, double F3) {
0055   CellPoint101[0] = X1;
0056   CellPoint101[1] = X2;
0057   CellPoint101[2] = X3;
0058   CellPoint101[3] = F1;
0059   CellPoint101[4] = F2;
0060   CellPoint101[5] = F3;
0061   return;
0062 }
0063 
0064 void VectorFieldInterpolation::defineCellPoint011(double X1, double X2, double X3, double F1, double F2, double F3) {
0065   CellPoint011[0] = X1;
0066   CellPoint011[1] = X2;
0067   CellPoint011[2] = X3;
0068   CellPoint011[3] = F1;
0069   CellPoint011[4] = F2;
0070   CellPoint011[5] = F3;
0071   return;
0072 }
0073 
0074 void VectorFieldInterpolation::defineCellPoint111(double X1, double X2, double X3, double F1, double F2, double F3) {
0075   CellPoint111[0] = X1;
0076   CellPoint111[1] = X2;
0077   CellPoint111[2] = X3;
0078   CellPoint111[3] = F1;
0079   CellPoint111[4] = F2;
0080   CellPoint111[5] = F3;
0081   return;
0082 }
0083 
0084 void VectorFieldInterpolation::putSCoordGetVField(double X1, double X2, double X3, double &F1, double &F2, double &F3) {
0085   SC[0] = X1;
0086   SC[1] = X2;
0087   SC[2] = X3;
0088 
0089   // values describing 4 help points after interpolation step of variables X1
0090   // 5 dimensions: 2 space dimensions + 3 field dimensions
0091   //                        X2' , X3' , F1' , F2' , F3'
0092   double HelpPoint00[5];  // {0.0 , 0.0 , 0.0 , 0.0 , 0.0};
0093   double HelpPoint10[5];
0094   double HelpPoint01[5];
0095   double HelpPoint11[5];
0096 
0097   // values describing 2 help points after interpolation step of variables X2'
0098   // 4 dimensions: 1 space dimensions + 3 field dimensions
0099   //                       X3" , F1" , F2" , F3"
0100   double HelpPoint0[4];  // {0.0 , 0.0 , 0.0 , 0.0};
0101   double HelpPoint1[4];
0102 
0103   // 1. iteration *****
0104   // prepare interpolation between CellPoint000 and CellPoint100
0105   double DeltaX100X000 = CellPoint100[0] - CellPoint000[0];
0106   double DeltaSC0X000overDeltaX100X000 = 0.;
0107   if (DeltaX100X000 != 0.)
0108     DeltaSC0X000overDeltaX100X000 = (SC[0] - CellPoint000[0]) / DeltaX100X000;
0109 
0110   // prepare interpolation between CellPoint010 and CellPoint110
0111   double DeltaX110X010 = CellPoint110[0] - CellPoint010[0];
0112   double DeltaSC0X010overDeltaX110X010 = 0.;
0113   if (DeltaX110X010 != 0.)
0114     DeltaSC0X010overDeltaX110X010 = (SC[0] - CellPoint010[0]) / DeltaX110X010;
0115 
0116   // prepare interpolation between CellPoint001 and CellPoint101
0117   double DeltaX101X001 = CellPoint101[0] - CellPoint001[0];
0118   double DeltaSC0X001overDeltaX101X001 = 0.;
0119   if (DeltaX101X001 != 0.)
0120     DeltaSC0X001overDeltaX101X001 = (SC[0] - CellPoint001[0]) / DeltaX101X001;
0121 
0122   // prepare interpolation between CellPoint011 and CellPoint111
0123   double DeltaX111X011 = CellPoint111[0] - CellPoint011[0];
0124   double DeltaSC0X011overDeltaX111X011 = 0.;
0125   if (DeltaX111X011 != 0.)
0126     DeltaSC0X011overDeltaX111X011 = (SC[0] - CellPoint011[0]) / DeltaX111X011;
0127 
0128   for (int i = 0; i < 5; ++i) {
0129     int ip = i + 1;
0130 
0131     // interpolate between CellPoint000 and CellPoint100
0132     HelpPoint00[i] = CellPoint000[ip] + DeltaSC0X000overDeltaX100X000 * (CellPoint100[ip] - CellPoint000[ip]);
0133 
0134     // interpolate between CellPoint010 and CellPoint110
0135     HelpPoint10[i] = CellPoint010[ip] + DeltaSC0X010overDeltaX110X010 * (CellPoint110[ip] - CellPoint010[ip]);
0136 
0137     // interpolate between CellPoint001 and CellPoint101
0138     HelpPoint01[i] = CellPoint001[ip] + DeltaSC0X001overDeltaX101X001 * (CellPoint101[ip] - CellPoint001[ip]);
0139 
0140     // interpolate between CellPoint011 and CellPoint111
0141     HelpPoint11[i] = CellPoint011[ip] + DeltaSC0X011overDeltaX111X011 * (CellPoint111[ip] - CellPoint011[ip]);
0142   }
0143 
0144   // 2. iteration *****
0145   // prepare interpolation between HelpPoint00 and HelpPoint10
0146   double DeltaX10X00 = HelpPoint10[0] - HelpPoint00[0];
0147   double DeltaSC1X00overDeltaX10X00 = 0.;
0148   if (DeltaX10X00 != 0.)
0149     DeltaSC1X00overDeltaX10X00 = (SC[1] - HelpPoint00[0]) / DeltaX10X00;
0150   // prepare interpolation between HelpPoint01 and HelpPoint11
0151   double DeltaX11X01 = HelpPoint11[0] - HelpPoint01[0];
0152   double DeltaSC1X01overDeltaX11X01 = 0.;
0153   if (DeltaX11X01 != 0.)
0154     DeltaSC1X01overDeltaX11X01 = (SC[1] - HelpPoint01[0]) / DeltaX11X01;
0155 
0156   for (int i = 0; i < 4; ++i) {
0157     int ip = i + 1;
0158 
0159     // interpolate between HelpPoint00 and HelpPoint10
0160     HelpPoint0[i] = HelpPoint00[ip] + DeltaSC1X00overDeltaX10X00 * (HelpPoint10[ip] - HelpPoint00[ip]);
0161 
0162     // interpolate between HelpPoint01 and HelpPoint11
0163     HelpPoint1[i] = HelpPoint01[ip] + DeltaSC1X01overDeltaX11X01 * (HelpPoint11[ip] - HelpPoint01[ip]);
0164   }
0165 
0166   // 3. iteration *****
0167   // prepare interpolation between HelpPoint0 and HelpPoint1
0168   double DeltaX1X0 = HelpPoint1[0] - HelpPoint0[0];
0169   double DeltaSC2X0overDeltaX1X0 = 0.;
0170   if (DeltaX1X0 != 0.)
0171     DeltaSC2X0overDeltaX1X0 = (SC[2] - HelpPoint0[0]) / DeltaX1X0;
0172 
0173   for (int i = 0; i < 3; ++i) {
0174     int ip = i + 1;
0175 
0176     // interpolate between HelpPoint0 and HelpPoint1
0177     VF[i] = HelpPoint0[ip] + DeltaSC2X0overDeltaX1X0 * (HelpPoint1[ip] - HelpPoint0[ip]);
0178   }
0179 
0180   F1 = VF[0];
0181   F2 = VF[1];
0182   F3 = VF[2];
0183 
0184   return;
0185 }