17#include "marley/CachedOpticalModel.hh"
18#include "marley/LinearInterpolatingFunction.hh"
24 double total_KE_CM,
int fragment_pdg,
int two_j,
int l,
int two_s,
32 TCKey temp_key( fragment_pdg, two_j, l, two_s, target_charge );
33 const auto cache_iter =
tc_cache_.find( temp_key );
38 return cache_iter->second->evaluate( total_KE_CM );
43 std::function< double(
double) > t_coeff = [
this, fragment_pdg, two_j,
44 l, two_s, target_charge ](
double tot_KE_CM ) ->
double
47 two_j, l, two_s, target_charge );
50 auto t_coeff_interp = std::make_shared<
56 double tc_result = t_coeff_interp->
evaluate( total_KE_CM );
60 tc_cache_[ temp_key ] = std::move( t_coeff_interp );
67 two_j, l, two_s, target_charge );
static bool USE_CACHE
Boolean switch that allows global enabling/disabling of the cache, which is used by default.
static constexpr double MIN_TOTAL_KE_CM
Minimum kinetic energy to use when interacting with the cache.
static constexpr double MAX_TOTAL_KE_CM
Maximum kinetic energy to use when interacting with the cache.
std::map< TCKey, std::shared_ptr< InterpolatingFunction > > tc_cache_
Saved InterpolatingFunction objects corresponding to previously-encountered transmission coefficient ...
virtual double compute_transmission_coefficient(double total_KE_CM, int fragment_pdg, int two_j, int l, int two_s, int target_charge=0)=0
Do the actual calculation of the transmission coefficient.
virtual double transmission_coefficient(double total_KE_CM, int fragment_pdg, int two_j, int l, int two_s, int target_charge=0) override
Calculate the transmission coefficient for a nuclear fragment.
Approximates a 1D function using linear interpolation on a grid of regularly-spaced points.
double evaluate(double x) const override
Returns an approximate value of the represented function.