CMS 3D CMS Logo

Public Member Functions | Private Attributes

VectorFieldInterpolation Class Reference

#include <VectorFieldInterpolation.h>

List of all members.

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)
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)
 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:
: <Volker.Drollinger@cern.ch> $date : 04/08/2003 14:46:10 CET $

Modifications: droll: change from float to double $date : 08/09/2003 18:35:10 CET $ droll: rename methods according to CMS coding rules $date : 22/09/2003 11:15:38 CET $

Definition at line 57 of file VectorFieldInterpolation.h.


Constructor & Destructor Documentation

VectorFieldInterpolation::VectorFieldInterpolation ( ) [inline]

Definition at line 60 of file VectorFieldInterpolation.h.

{}
VectorFieldInterpolation::~VectorFieldInterpolation ( ) [inline]

Definition at line 62 of file VectorFieldInterpolation.h.

{}

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().

                                                                                                                 {
  CellPoint000[0] = X1;
  CellPoint000[1] = X2;
  CellPoint000[2] = X3;
  CellPoint000[3] = F1;
  CellPoint000[4] = F2;
  CellPoint000[5] = F3;
  return;
}
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().

                                                                                                                 {
  CellPoint001[0] = X1;
  CellPoint001[1] = X2;
  CellPoint001[2] = X3;
  CellPoint001[3] = F1;
  CellPoint001[4] = F2;
  CellPoint001[5] = F3;
  return;
}
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().

                                                                                                                 {
  CellPoint010[0] = X1;
  CellPoint010[1] = X2;
  CellPoint010[2] = X3;
  CellPoint010[3] = F1;
  CellPoint010[4] = F2;
  CellPoint010[5] = F3;
  return;
}
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().

                                                                                                                 {
  CellPoint011[0] = X1;
  CellPoint011[1] = X2;
  CellPoint011[2] = X3;
  CellPoint011[3] = F1;
  CellPoint011[4] = F2;
  CellPoint011[5] = F3;
  return;
}
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().

                                                                                                                 {
  CellPoint100[0] = X1;
  CellPoint100[1] = X2;
  CellPoint100[2] = X3;
  CellPoint100[3] = F1;
  CellPoint100[4] = F2;
  CellPoint100[5] = F3;
  return;
}
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().

                                                                                                                 {
  CellPoint101[0] = X1;
  CellPoint101[1] = X2;
  CellPoint101[2] = X3;
  CellPoint101[3] = F1;
  CellPoint101[4] = F2;
  CellPoint101[5] = F3;
  return;
}
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().

                                                                                                                 {
  CellPoint110[0] = X1;
  CellPoint110[1] = X2;
  CellPoint110[2] = X3;
  CellPoint110[3] = F1;
  CellPoint110[4] = F2;
  CellPoint110[5] = F3;
  return;
}
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().

                                                                                                                 {
  CellPoint111[0] = X1;
  CellPoint111[1] = X2;
  CellPoint111[2] = X3;
  CellPoint111[3] = F1;
  CellPoint111[4] = F2;
  CellPoint111[5] = F3;
  return;
}
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().

                                                                                                                    {
  SC[0] = X1;
  SC[1] = X2;
  SC[2] = X3;

  // values describing 4 help points after interpolation step of variables X1
  // 5 dimensions: 2 space dimensions + 3 field dimensions
  //                        X2' , X3' , F1' , F2' , F3'
  double HelpPoint00[5]; // {0.0 , 0.0 , 0.0 , 0.0 , 0.0};
  double HelpPoint10[5];
  double HelpPoint01[5];
  double HelpPoint11[5];

  // values describing 2 help points after interpolation step of variables X2'
  // 4 dimensions: 1 space dimensions + 3 field dimensions
  //                       X3" , F1" , F2" , F3"
  double HelpPoint0[4]; // {0.0 , 0.0 , 0.0 , 0.0};
  double HelpPoint1[4];


  // 1. iteration *****
  // prepare interpolation between CellPoint000 and CellPoint100
  double DeltaX100X000 = CellPoint100[0] - CellPoint000[0];
  double DeltaSC0X000overDeltaX100X000 = 0.;
  if (DeltaX100X000 != 0.) DeltaSC0X000overDeltaX100X000 = (SC[0] - CellPoint000[0]) / DeltaX100X000;

  // prepare interpolation between CellPoint010 and CellPoint110
  double DeltaX110X010 = CellPoint110[0] - CellPoint010[0];
  double DeltaSC0X010overDeltaX110X010 = 0.;
  if (DeltaX110X010 != 0.) DeltaSC0X010overDeltaX110X010 = (SC[0] - CellPoint010[0]) / DeltaX110X010;

  // prepare interpolation between CellPoint001 and CellPoint101
  double DeltaX101X001 = CellPoint101[0] - CellPoint001[0];
  double DeltaSC0X001overDeltaX101X001 = 0.;
  if (DeltaX101X001 != 0.) DeltaSC0X001overDeltaX101X001 = (SC[0] - CellPoint001[0]) / DeltaX101X001;

  // prepare interpolation between CellPoint011 and CellPoint111
  double DeltaX111X011 = CellPoint111[0] - CellPoint011[0];
  double DeltaSC0X011overDeltaX111X011 = 0.;
  if (DeltaX111X011 != 0.) DeltaSC0X011overDeltaX111X011 = (SC[0] - CellPoint011[0]) / DeltaX111X011;

  for (int i=0; i<5; ++i){
    int ip = i+1; 

    // interpolate between CellPoint000 and CellPoint100
    HelpPoint00[i] = CellPoint000[ip] + DeltaSC0X000overDeltaX100X000 * (CellPoint100[ip] - CellPoint000[ip]);

    // interpolate between CellPoint010 and CellPoint110
    HelpPoint10[i] = CellPoint010[ip] + DeltaSC0X010overDeltaX110X010 * (CellPoint110[ip] - CellPoint010[ip]);

    // interpolate between CellPoint001 and CellPoint101
    HelpPoint01[i] = CellPoint001[ip] + DeltaSC0X001overDeltaX101X001 * (CellPoint101[ip] - CellPoint001[ip]);

    // interpolate between CellPoint011 and CellPoint111
    HelpPoint11[i] = CellPoint011[ip] + DeltaSC0X011overDeltaX111X011 * (CellPoint111[ip] - CellPoint011[ip]);
  }

  // 2. iteration *****
  // prepare interpolation between HelpPoint00 and HelpPoint10
  double DeltaX10X00 = HelpPoint10[0] - HelpPoint00[0];
  double DeltaSC1X00overDeltaX10X00 = 0.;
  if (DeltaX10X00 != 0.) DeltaSC1X00overDeltaX10X00 = (SC[1] - HelpPoint00[0]) / DeltaX10X00;
  // prepare interpolation between HelpPoint01 and HelpPoint11
  double DeltaX11X01 = HelpPoint11[0] - HelpPoint01[0];
  double DeltaSC1X01overDeltaX11X01 = 0.;
  if (DeltaX11X01 != 0.) DeltaSC1X01overDeltaX11X01 = (SC[1] - HelpPoint01[0]) / DeltaX11X01;

  for (int i=0; i<4; ++i){
    int ip = i+1; 

    // interpolate between HelpPoint00 and HelpPoint10
    HelpPoint0[i] = HelpPoint00[ip] + DeltaSC1X00overDeltaX10X00 * (HelpPoint10[ip] - HelpPoint00[ip]);

    // interpolate between HelpPoint01 and HelpPoint11
    HelpPoint1[i] = HelpPoint01[ip] + DeltaSC1X01overDeltaX11X01 * (HelpPoint11[ip] - HelpPoint01[ip]);
  }

  // 3. iteration *****
  // prepare interpolation between HelpPoint0 and HelpPoint1
  double DeltaX1X0 = HelpPoint1[0] - HelpPoint0[0];
  double DeltaSC2X0overDeltaX1X0 = 0.;
  if (DeltaX1X0 != 0.) DeltaSC2X0overDeltaX1X0 = (SC[2] - HelpPoint0[0]) / DeltaX1X0;

  for (int i=0; i<3; ++i){
    int ip = i+1; 

    // interpolate between HelpPoint0 and HelpPoint1
    VF[i] = HelpPoint0[ip] + DeltaSC2X0overDeltaX1X0 * (HelpPoint1[ip] - HelpPoint0[ip]);
  }

  F1 = VF[0];
  F2 = VF[1];
  F3 = VF[2];

  return;
}

Member Data Documentation

Definition at line 72 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint000(), and putSCoordGetVField().

Definition at line 76 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint001(), and putSCoordGetVField().

Definition at line 74 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint010(), and putSCoordGetVField().

Definition at line 78 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint011(), and putSCoordGetVField().

Definition at line 73 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint100(), and putSCoordGetVField().

Definition at line 77 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint101(), and putSCoordGetVField().

Definition at line 75 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint110(), and putSCoordGetVField().

Definition at line 79 of file VectorFieldInterpolation.h.

Referenced by defineCellPoint111(), and putSCoordGetVField().

double VectorFieldInterpolation::SC[3] [private]

Definition at line 67 of file VectorFieldInterpolation.h.

Referenced by putSCoordGetVField().

double VectorFieldInterpolation::VF[3] [private]

Definition at line 83 of file VectorFieldInterpolation.h.

Referenced by putSCoordGetVField().