9 #define BUILDING_LIBRARY 13 void *do_interpolation (
void *queue)
15 reinterpret_cast<InterpolationQueue*
>(queue)->interpolate_thread();
39 #ifndef TOOLCHAIN_MSVC 44 assert(
__y.size() == 0);
57 const double *x =
__x.back(),
68 int destination =
__x.size();
73 << QUANTITY_NAME[*__quantity_id_iter]
74 <<
" using " << nodes <<
" nodes and " 75 << smoothing <<
" smoothing." 80 #ifndef TOOLCHAIN_MSVC 91 #ifndef TOOLCHAIN_MSVC 95 std::clog <<
"Created result @: " << quantity << std::endl;
98 #ifndef TOOLCHAIN_MSVC 106 #ifdef TOOLCHAIN_MSVC 107 assert(num_threads == 1);
109 pthread_attr_t thread_attributes;
110 pthread_attr_init(&thread_attributes);
111 pthread_attr_setdetachstate(&thread_attributes,
112 PTHREAD_CREATE_JOINABLE);
113 std::vector<pthread_t> threads(num_threads);
119 #ifdef TOOLCHAIN_MSVC 121 for(
unsigned i = 0; i < num_threads; ++i)
122 pthread_create(&threads[i],
125 reinterpret_cast<void*>(
this));
126 for(
unsigned i = 0; i < num_threads; ++i)
127 pthread_join(threads[i], NULL);
135 std::clog <<
"quantity ID size: " <<
__quantity_id.size() << std::endl;
136 std::clog <<
"grid index size: " <<
__grid_index.size() << std::endl;
137 std::clog <<
"result size: " <<
__result.size() << std::endl;
std::list< const double * > __y
The array of y values to use in the interpolation.
std::list< const double * > __x
The array of x values to use in the interpolation.
Declaration of a class that handles multithreaded stellar evolution interpolation.
std::list< int > __grid_index
The index of the grid point being interpolated.
void interpolate_thread()
Interpolate the first quantity and discard it from __x, __y, __npoints, __nodes and __smoothing...
std::list< int > __quantity_id
The quantity ID of the quantity being interpolated.
void push_back(const double *x, const double *y, size_t npoints, int nodes, double smoothing, int quantity_id, int grid_index)
Add an interpolation taks to the queue.
std::list< size_t > __npoints
The number of points to use in the interpolation.
std::list< int > __nodes
The number of nodes to use in the interpolation.
Function which interpolates, with possible smoothing, between points.
void pop_front()
Move to the next result in the queue (earlier results are no longer accessible.
std::list< double > __smoothing
The smoothing to use in the interpolation.
void calculate(unsigned num_threads)
pthread_mutex_t __sync_mutex
A pthread mutex used to ensure that only one thread is extracting the next quantity for interpolation...
std::vector< Core::InterpolatingFunctionALGLIB * > __result
The interpolation results.