Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef VectorFieldInterpolation_H
0002 #define VectorFieldInterpolation_H
0003 
0004 /** \class VectorFieldInterpolation
0005  *
0006  * linear interpolation of a field (3D) in space (3D)
0007  *
0008  * \author : <Volker.Drollinger@cern.ch>
0009  *
0010  * Modifications:
0011  * droll: change from float to double
0012  * droll: rename methods according to CMS coding rules
0013  *
0014  */
0015 
0016 // ***************************************************************
0017 // by droll (19/07/03)
0018 //
0019 // basic equation (1D example):  y = y0 + (x-x0)/(x1-x0)*(y1-y0)
0020 // find field value y at point x
0021 // corner points x0 and x1 with field  values
0022 // field values y0 and y1 at points x0 and x1
0023 //
0024 // input should be organized like in the following sketch
0025 // 3D interpolation cell (example Cartesian coordinates):
0026 //
0027 //          (011) *-------------------* (111)
0028 //               /|                  /|
0029 //              / |                 / |
0030 //             /  |                /  |
0031 //            /   |               /   |
0032 //           /    |              /    |
0033 //          /     |             /     |
0034 //   (010) *-------------------* (110)|
0035 //         |      |            |      |
0036 //         |      |            |      |
0037 //         |(001) *------------|------* (101)
0038 //         |     /             |     /
0039 //         |    /              |    /
0040 //         |   /               |   /
0041 //         |  /                |  /
0042 //         | /                 | /
0043 //         |/                  |/
0044 //   (000) *-------------------* (100)
0045 //
0046 // 1. iteration: interpolation cell  -> interpolation plane
0047 //
0048 // 2. iteration: interpolation plane -> interpolation line
0049 //
0050 // 3. iteration: interpolation line  -> interpolation at SC[3]
0051 //
0052 // ***************************************************************
0053 
0054 class VectorFieldInterpolation {
0055 public:
0056   // constructor
0057   VectorFieldInterpolation() {}
0058   // destructor
0059   ~VectorFieldInterpolation() {}
0060 
0061 private:
0062   // spatial coordinates, where the field has to be calculated
0063   //                X1 ,  X2 , X3
0064   double SC[3];  // {0.0 ,0.0 ,0.0 };
0065 
0066   // values describing the 8 corners of an interpolation cell
0067   // 6 dimensions: 3 space dimensions + 3 field dimensions
0068   //                          X1 ,  X2 ,  X3 ,  F1 ,  F2 ,  F3
0069   double CellPoint000[6];  // {0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 };
0070   double CellPoint100[6];
0071   double CellPoint010[6];
0072   double CellPoint110[6];
0073   double CellPoint001[6];
0074   double CellPoint101[6];
0075   double CellPoint011[6];
0076   double CellPoint111[6];
0077 
0078   // 3 components of the interpolated vector field at spatial coordinates SC
0079   //                F1  , F2  , F3
0080   double VF[3];  // {0.0 , 0.0 , 0.0 };
0081 
0082 public:
0083   // Accessors
0084   /// provide the interpolation algorithm with 8 points, where the field is known (in)
0085   void defineCellPoint000(double X1, double X2, double X3, double F1, double F2, double F3);
0086   void defineCellPoint100(double X1, double X2, double X3, double F1, double F2, double F3);
0087   void defineCellPoint010(double X1, double X2, double X3, double F1, double F2, double F3);
0088   void defineCellPoint110(double X1, double X2, double X3, double F1, double F2, double F3);
0089   void defineCellPoint001(double X1, double X2, double X3, double F1, double F2, double F3);
0090   void defineCellPoint101(double X1, double X2, double X3, double F1, double F2, double F3);
0091   void defineCellPoint011(double X1, double X2, double X3, double F1, double F2, double F3);
0092   void defineCellPoint111(double X1, double X2, double X3, double F1, double F2, double F3);
0093   /// receive the interpolated field (out) at any point in space (in)
0094   void putSCoordGetVField(double X1, double X2, double X3, double &F1, double &F2, double &F3);
0095 };
0096 
0097 #endif