9 #ifndef __INTERPOLATOR_H 10 #define __INTERPOLATOR_H 12 #include "../Core/SharedLibraryExportMacros.h" 16 #include "../Core/StellarZone.h" 17 #include "../Core/Error.h" 23 #include <boost/archive/text_oarchive.hpp> 24 #include <boost/archive/text_iarchive.hpp> 25 #include <boost/serialization/base_object.hpp> 26 #include <boost/serialization/list.hpp> 27 #include <boost/serialization/valarray.hpp> 28 #include <boost/serialization/vector.hpp> 44 friend class boost::serialization::access;
47 template<
class Archive>
void serialize(
68 std::vector< std::vector<const OneArgumentDiffFunction*> >
81 int find_first_core_index(
82 const std::valarray<double> &core_mass
86 void perform_queued_interpolations(
91 unsigned num_threads = 1
100 __core_formation(
Core::NaN)
107 const std::valarray<double> &tabulated_masses,
110 const std::valarray<double> &tabulated_feh,
115 const std::list< std::valarray<double> > &tabulated_ages,
120 const std::vector< std::list< std::valarray<double> > >
121 &tabulated_quantities,
126 const std::vector<double> &smoothing,
132 const std::vector<int> &nodes,
136 const std::vector<bool> &vs_log_age,
140 const std::vector<bool> &log_quantity,
147 create_from(tabulated_masses,
150 tabulated_quantities,
162 const std::valarray<double> &tabulated_masses,
166 const std::valarray<double> &tabulated_feh,
171 const std::list< std::valarray<double> > &tabulated_ages,
176 const std::vector< std::list< std::valarray<double> > >
177 &tabulated_quantities,
182 const std::vector<double> &smoothing,
188 const std::vector<int> &nodes,
192 const std::vector<bool> &vs_log_age,
196 const std::vector<bool> &log_quantity,
222 virtual void save_state(
228 const std::string &filename=
"../interp_state_data" 250 virtual void load_state(
252 const std::string &filename=
"../interp_state_data" 263 void delete_tracks();
275 if(!std::isfinite(__core_formation)) __core_formation = -1;
279 ar & __interpolated_quantities;
284 ar & __core_formation;
286 std::cerr <<
"Track masses: " << __track_masses << std::endl;
287 std::cerr <<
"Track [Fe/H]: " << __track_masses << std::endl;
288 std::cerr <<
"Quantities with sizes: ";
289 for(
unsigned i = 0; i < __interpolated_quantities.size(); ++i)
290 std::cerr << (i ?
", " :
"") << __interpolated_quantities[i].size();
291 std::cerr << std::endl;
293 std::cerr <<
"vs log(age): ";
294 for(
unsigned i = 0; i < __vs_log_age.size(); ++i)
295 std::cerr << (i ?
", " :
"") << __vs_log_age[i];
296 std::cerr << std::endl;
298 std::cerr <<
"log(quantity): ";
299 for(
unsigned i = 0; i < __log_quantity.size(); ++i)
300 std::cerr << (i ?
", " :
"") << __log_quantity[i];
301 std::cerr << std::endl;
303 if(__core_formation < 0) __core_formation = Core::Inf;
std::valarray< double > __track_masses
Declaration of a class that handles multithreaded stellar evolution interpolation.
std::vector< bool > __log_quantity
Was the interpolation of the log(corresponding quantity)?
Defines constant to serve as identifier of the various quantities handled by the stellar evolution in...
Declares a class implementing the intepolation of a single stellar quantity from stellar evolution tr...
virtual double core_formation_age() const
The age at which the core begins to form in Gyr.
void serialize(Archive &ar, const unsigned int)
Serialize the current interpolation.
A class for stellar properties that depend on age.
A class that interpolates among stellar evolution tracks.
std::vector< std::vector< const OneArgumentDiffFunction * > > __interpolated_quantities
The interpolated stellar evolution quantities for each track.
A class that handles a queue of interpolation tasks. Also functions as an iterator over the results...
double __core_formation
The age at which the core starts forming in Gyr.
Interpolator(const std::valarray< double > &tabulated_masses, const std::valarray< double > &tabulated_feh, const std::list< std::valarray< double > > &tabulated_ages, const std::vector< std::list< std::valarray< double > > > &tabulated_quantities, const std::vector< double > &smoothing, const std::vector< int > &nodes, const std::vector< bool > &vs_log_age, const std::vector< bool > &log_quantity, unsigned num_threads)
Creates a fully functional stellar evolution interpolator.
const int NUM_QUANTITIES
The number of interpolation quantities currentyl supported.
QuantityID
Defines the quantities tracked by stellar evolution and their order.
std::vector< bool > __vs_log_age
Was the interpolation of the corresponding quantity vs. log(age)?
Interpolator()
Construct an object that can be set to interpolate between tabulated evolution tracks.