8 #ifndef EXPEVALUATOR_H_     9 #define EXPEVALUATOR_H_    12 #define _USE_MATH_DEFINES    40   FP_PRECISION _exp_table_spacing;
    43   FP_PRECISION _inverse_exp_table_spacing;
    46   FP_PRECISION _sin_theta_no_offset;
    49   FP_PRECISION _inverse_sin_theta_no_offset;
    55   FP_PRECISION* _exp_table;
    61   FP_PRECISION _max_optical_length;
    64   FP_PRECISION _exp_precision;
   102   void initialize(
int azim_index, 
int polar_index, 
bool solve_3D);
   105                                     FP_PRECISION dt, FP_PRECISION dt2);
   107                                     FP_PRECISION dt, FP_PRECISION dt2);
   109                                    FP_PRECISION dt, FP_PRECISION dt2);
   111                                      FP_PRECISION* exp_F1,
   112                                      FP_PRECISION* exp_F2,
   113                                      FP_PRECISION* exp_H);
   127   return int(tau * _inverse_exp_table_spacing);
   139   return tau - index * _exp_table_spacing;
   149   return length * _sin_theta_no_offset;
   158   return _inverse_sin_theta_no_offset;
   173                                                    _polar_index + polar_offset);
   175   FP_PRECISION inv_sin_theta = _inverse_sin_theta_no_offset;
   180   return inv_sin_theta * exp_F1;
   209   int full_index = (index * _num_polar_terms + polar_offset) * _num_exp_terms;
   212     return _exp_table[full_index] + _exp_table[full_index + 1] * dt +
   213         _exp_table[full_index + 2] * dt2;
   216     int polar_index = _polar_index + polar_offset;
   217     FP_PRECISION tau = index * _exp_table_spacing + dt;
   218     FP_PRECISION inv_sin_theta = 1.0 / _quadrature->
getSinTheta(_azim_index,
   220     return (1.0 - exp(- tau * inv_sin_theta)) / tau;
   249   int full_index = (index * _num_polar_terms + polar_offset) * _num_exp_terms;
   252     return _exp_table[full_index + 3] + _exp_table[full_index + 4] * dt +
   253         _exp_table[full_index + 5] * dt2;
   256     int polar_index = _polar_index + polar_offset;
   257     FP_PRECISION tau = index * _exp_table_spacing + dt;
   258     FP_PRECISION inv_sin_theta = 1.0 / _quadrature->
getSinTheta(_azim_index,
   260     FP_PRECISION tau_m = tau * inv_sin_theta;
   261     FP_PRECISION F1 = (1.0 - exp(- tau_m)) / tau;
   262     return 2.0 / tau * (inv_sin_theta - F1) - inv_sin_theta * F1;
   291   int full_index = (index * _num_polar_terms + polar_offset) * _num_exp_terms;
   294     return _exp_table[full_index + 6] + _exp_table[full_index + 7] * dt +
   295         _exp_table[full_index + 8] * dt2;
   297     int polar_index = _polar_index + polar_offset;
   298     FP_PRECISION tau = index * _exp_table_spacing + dt;
   299     FP_PRECISION inv_sin_theta = 1.0 / _quadrature->
getSinTheta(_azim_index,
   301     FP_PRECISION tau_m = tau * inv_sin_theta;
   302     FP_PRECISION F1 = (1.0 - exp(- tau_m)) / tau;
   303     FP_PRECISION G1 = 1.0 / tau + 0.5 * inv_sin_theta - (1.0 + 1.0 / tau_m) * F1;
   304     return 0.5 * inv_sin_theta - G1;
   350                                                         FP_PRECISION* exp_F1,
   351                                                         FP_PRECISION* exp_F2,
   352                                                         FP_PRECISION* exp_H) {
   354                                               FP_PRECISION* __restrict__ exp_F1,
   355                                               FP_PRECISION* __restrict__ exp_F2,
   356                                               FP_PRECISION* __restrict__ exp_H) {
   361                                                    _polar_index + polar_offset);
   363   FP_PRECISION inv_sin_theta = _inverse_sin_theta_no_offset;
   367   tau = std::max(FP_PRECISION(1e-8), tau * inv_sin_theta);
   372    *exp_F1 = 1.f - tau*exp_G;
   373    *exp_F1 *= inv_sin_theta;
   375    exp_G *= inv_sin_theta;
   376    *exp_F2 = 2.f*exp_G - *exp_F1;
   377    *exp_F2 *= inv_sin_theta;
   379    *exp_H = *exp_F1 - exp_G;
 void expF1_fractional(FP_PRECISION x, FP_PRECISION *expF1)
Computes the F1 exponential term. 
Definition: exponentials.h:156
 
double getSinTheta(size_t azim, size_t polar) const
Returns the  value for a particular polar angle. 
Definition: Quadrature.cpp:41
 
void setExpPrecision(FP_PRECISION exp_precision)
Sets the maximum acceptable approximation error for exponentials. 
Definition: ExpEvaluator.cpp:68
 
int getTableSize()
Get the number of entries in the exponential interpolation table. 
Definition: ExpEvaluator.cpp:149
 
void setMaxOpticalLength(FP_PRECISION max_optical_length)
Sets the maximum optical length covered in the exponential interpolation table. 
Definition: ExpEvaluator.cpp:50
 
double getSinThetaInline(size_t azim, size_t polar) const
Returns the  value for a particular polar angle. 
Definition: Quadrature.h:296
 
FP_PRECISION getTableSpacing()
Returns the exponential table spacing. 
Definition: ExpEvaluator.cpp:135
 
void retrieveExponentialComponents(FP_PRECISION tau, int polar_offset, FP_PRECISION *exp_F1, FP_PRECISION *exp_F2, FP_PRECISION *exp_H)
Computes the F1, F2, H exponential term. 
Definition: ExpEvaluator.h:347
 
void initialize(int azim_index, int polar_index, bool solve_3D)
If using linear interpolation, builds the table for each polar angle. 
Definition: ExpEvaluator.cpp:179
 
Math approximations for computing exponentials. 
 
void useInterpolation()
Use linear interpolation to compute exponentials. 
Definition: ExpEvaluator.cpp:81
 
FP_PRECISION computeExponentialF1(int index, int polar_offset, FP_PRECISION dt, FP_PRECISION dt2)
Computes the F1 exponential term. 
Definition: ExpEvaluator.h:203
 
The arbitrary quadrature parent class. 
Definition: Quadrature.h:76
 
FP_PRECISION getExpPrecision()
Gets the maximum acceptable approximation error for exponentials. 
Definition: ExpEvaluator.cpp:117
 
int getExponentialIndex(FP_PRECISION tau)
Get the index on the exponential interpolation grid of the value right beneath tau. 
Definition: ExpEvaluator.h:126
 
ExpEvaluator()
Constructor initializes array pointers to NULL. 
Definition: ExpEvaluator.cpp:9
 
ExpEvaluator * deepCopy()
Deep copies an ExpEvaluator, for developing purposes. 
Definition: ExpEvaluator.cpp:351
 
virtual ~ExpEvaluator()
Destructor deletes table for linear interpolation of exponentials. 
Definition: ExpEvaluator.cpp:30
 
FP_PRECISION * getExpTable()
Returns a pointer to the exponential interpolation table. 
Definition: ExpEvaluator.cpp:163
 
This is a class for evaluating exponentials. 
Definition: ExpEvaluator.h:29
 
void expG2_fractional(FP_PRECISION x, FP_PRECISION *expG2)
Computes the G2 exponential term. 
Definition: exponentials.h:293
 
FP_PRECISION computeExponential(FP_PRECISION tau, int polar_offset)
Computes the F1 exponential term. 
Definition: ExpEvaluator.h:168
 
void useIntrinsic()
Use the exponential intrinsic exp(...) to compute exponentials. 
Definition: ExpEvaluator.cpp:89
 
The Quadrature abstract class and subclasses. 
 
FP_PRECISION convertDistance3Dto2D(FP_PRECISION length)
Convert a 3D distance to a 2D based on the evaluator's polar angle. 
Definition: ExpEvaluator.h:148
 
FP_PRECISION getDifference(int index, FP_PRECISION tau)
Compute the difference between an optical path and an indexed value in the exponential interpolation ...
Definition: ExpEvaluator.h:138
 
FP_PRECISION computeExponentialF2(int index, int polar_offset, FP_PRECISION dt, FP_PRECISION dt2)
Computes the F2 exponential term. 
Definition: ExpEvaluator.h:244
 
FP_PRECISION computeExponentialH(int index, int polar_offset, FP_PRECISION dt, FP_PRECISION dt2)
Computes the H exponential term. 
Definition: ExpEvaluator.h:286
 
void useLinearSource()
Use linear source exponentials. 
Definition: ExpEvaluator.cpp:97
 
FP_PRECISION getMaxOpticalLength()
Gets the maximum optical length covered with the exponential interpolation table. ...
Definition: ExpEvaluator.cpp:108
 
void expG_fractional(FP_PRECISION x, FP_PRECISION *expG)
Computes an exponential G term, used to reconstruct F1, F2 and H. 
Definition: exponentials.h:110
 
FP_PRECISION computeExponentialG2(FP_PRECISION tau)
Computes the G2 exponential term for a optical length and polar angle. 
Definition: ExpEvaluator.h:322
 
Utility functions for writing log messages to the screen. 
 
void setQuadrature(Quadrature *quadrature)
Set the Quadrature to use when computing exponentials. 
Definition: ExpEvaluator.cpp:40
 
FP_PRECISION getInverseSinTheta()
Get the inverse of sin theta from the ExpEvaluator. 
Definition: ExpEvaluator.h:157
 
bool isUsingInterpolation()
Returns true if using linear interpolation to compute exponentials. 
Definition: ExpEvaluator.cpp:126