19#ifndef BDSINTERPOLATORROUTINES_H
20#define BDSINTERPOLATORROUTINES_H
24#include "BDSFieldValue.hh"
37 T
mag(
const T& v) {
return std::abs(v);}
47 {
return p[0]*(1.-x) + p[1]*x;}
56 arr[0] = BDS::Linear1D<T>(p[0], y);
57 arr[1] = BDS::Linear1D<T>(p[1], y);
58 return BDS::Linear1D<T>(arr, x);
69 arr[0] = BDS::Linear2D<T>(p[0], y, z);
70 arr[1] = BDS::Linear2D<T>(p[1], y, z);
71 return BDS::Linear1D<T>(arr, x);
83 arr[0] = BDS::Linear3D<T>(p[0], y, z, t);
84 arr[1] = BDS::Linear3D<T>(p[1], y, z, t);
85 return BDS::Linear1D<T>(arr, x);
94 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])));
104 arr[0] = BDS::Cubic1D<T>(p[0], y);
105 arr[1] = BDS::Cubic1D<T>(p[1], y);
106 arr[2] = BDS::Cubic1D<T>(p[2], y);
107 arr[3] = BDS::Cubic1D<T>(p[3], y);
108 return BDS::Cubic1D<T>(arr, x);
119 arr[0] = BDS::Cubic2D<T>(p[0], y, z);
120 arr[1] = BDS::Cubic2D<T>(p[1], y, z);
121 arr[2] = BDS::Cubic2D<T>(p[2], y, z);
122 arr[3] = BDS::Cubic2D<T>(p[3], y, z);
123 return BDS::Cubic1D<T>(arr, x);
135 arr[0] = BDS::Cubic3D<T>(p[0], y, z, t);
136 arr[1] = BDS::Cubic3D<T>(p[1], y, z, t);
137 arr[2] = BDS::Cubic3D<T>(p[2], y, z, t);
138 arr[3] = BDS::Cubic3D<T>(p[3], y, z, t);
139 return BDS::Cubic1D<T>(arr, x);
147 return (
double)(
mag(p[0])*(1.-x) +
mag(p[1])*x);
196 double factor = vMag /
mag(v);
197 if (std::isnan(factor))
211 double factor = vMag /
mag(v);
212 if (std::isnan(factor))
227 double factor = vMag /
mag(v);
228 if (std::isnan(factor))
244 double factor = vMag /
mag(v);
245 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.