18#ifndef BDSINTERPOLATORROUTINES_H
19#define BDSINTERPOLATORROUTINES_H
23#include "BDSFieldValue.hh"
36 T
mag(
const T& v) {
return std::abs(v);}
46 {
return p[0]*(1.-x) + p[1]*x;}
55 arr[0] = BDS::Linear1D<T>(p[0], y);
56 arr[1] = BDS::Linear1D<T>(p[1], y);
57 return BDS::Linear1D<T>(arr, x);
68 arr[0] = BDS::Linear2D<T>(p[0], y, z);
69 arr[1] = BDS::Linear2D<T>(p[1], y, z);
70 return BDS::Linear1D<T>(arr, x);
82 arr[0] = BDS::Linear3D<T>(p[0], y, z, t);
83 arr[1] = BDS::Linear3D<T>(p[1], y, z, t);
84 return BDS::Linear1D<T>(arr, x);
93 return p[1]+0.5 * x*(p[2]-p[0]+x*(2.*p[0]-5.*p[1]+4.*p[2]-p[3]+x*(3.*(p[1]-p[2])+p[3]-p[0])));
103 arr[0] = BDS::Cubic1D<T>(p[0], y);
104 arr[1] = BDS::Cubic1D<T>(p[1], y);
105 arr[2] = BDS::Cubic1D<T>(p[2], y);
106 arr[3] = BDS::Cubic1D<T>(p[3], y);
107 return BDS::Cubic1D<T>(arr, x);
118 arr[0] = BDS::Cubic2D<T>(p[0], y, z);
119 arr[1] = BDS::Cubic2D<T>(p[1], y, z);
120 arr[2] = BDS::Cubic2D<T>(p[2], y, z);
121 arr[3] = BDS::Cubic2D<T>(p[3], y, z);
122 return BDS::Cubic1D<T>(arr, x);
134 arr[0] = BDS::Cubic3D<T>(p[0], y, z, t);
135 arr[1] = BDS::Cubic3D<T>(p[1], y, z, t);
136 arr[2] = BDS::Cubic3D<T>(p[2], y, z, t);
137 arr[3] = BDS::Cubic3D<T>(p[3], y, z, t);
138 return BDS::Cubic1D<T>(arr, x);
146 return (
double)(
mag(p[0])*(1.-x) +
mag(p[1])*x);
195 double factor = vMag /
mag(v);
196 if (std::isnan(factor))
210 double factor = vMag /
mag(v);
211 if (std::isnan(factor))
226 double factor = vMag /
mag(v);
227 if (std::isnan(factor))
243 double factor = vMag /
mag(v);
244 if (std::isnan(factor))
T mag() const
Get the magnitude of it.
Return either G4Tubs or G4CutTubs depending on flat face.
T Cubic3D(const T p[4][4][4], G4double x, G4double y, G4double z)
Cubic interpolation in 3 dimensions.
T Linear3DMag(const T p[2][2][2], G4double x, G4double y, G4double z)
Linear interpolation in 3 dimensions including magnitude interpolation.
T Linear1D(const T p[2], G4double x)
T Cubic4D(const T p[4][4][4][4], G4double x, G4double y, G4double z, G4double t)
Cubic interpolation in 4 dimensions.
T Linear1DMag(const T p[2], G4double x)
Linear interpolation in 1 dimension including magnitude interpolation.
T Cubic1D(const T p[4], G4double x)
T Linear4D(const T p[2][2][2][2], G4double x, G4double y, G4double z, G4double t)
Linear interpolation in 4 dimensions.
double Linear4DMagOnly(const T p[2][2][2][2], G4double x, G4double y, G4double z, G4double t)
Linear interpolation of the magnitude in 4 dimensions.
T Linear3D(const T p[2][2][2], G4double x, G4double y, G4double z)
Linear interpolation in 3 dimensions.
double Linear1DMagOnly(const T p[2], G4double x)
Linear interpolation of the magnitude in 1 dimension.
T Linear2D(const T p[2][2], G4double x, G4double y)
Linear interpolation in 2 dimensions.
T Linear2DMag(const T p[2][2], G4double x, G4double y)
Linear interpolation in 2 dimensions including magnitude interpolation.
T Linear4DMag(const T p[2][2][2][2], G4double x, G4double y, G4double z, G4double t)
Linear interpolation in 4 dimensions including magnitude interpolation.
T Cubic2D(const T p[4][4], G4double x, G4double y)
Cubic interpolation in 2 dimensions.
double Linear3DMagOnly(const T p[2][2][2], G4double x, G4double y, G4double z)
Linear interpolation of the magnitude in 3 dimensions.
double Linear2DMagOnly(const T p[2][2], G4double x, G4double y)
Linear interpolation of the magnitude in 2 dimensions.