A class that handles a queue of interpolation tasks. Also functions as an iterator over the results. More...
#include <ThreadedInterpolation.h>
Public Member Functions | |
InterpolationQueue () | |
Create an empty queue. More... | |
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. More... | |
void | calculate (unsigned num_threads) |
int | quantity_id () const |
The quantity ID of the currently selected result. More... | |
int | grid_index () const |
The grid index of the currently selected result. More... | |
Core::InterpolatingFunctionALGLIB * | result () const |
The currently selected interupolation result. More... | |
void | pop_front () |
Move to the next result in the queue (earlier results are no longer accessible. More... | |
operator bool () const | |
Are there any un-popped results? More... | |
Private Member Functions | |
void | interpolate_thread () |
Interpolate the first quantity and discard it from __x, __y, __npoints, __nodes and __smoothing. More... | |
Private Attributes | |
std::list< const double * > | __x |
The array of x values to use in the interpolation. More... | |
std::list< const double * > | __y |
The array of y values to use in the interpolation. More... | |
std::list< size_t > | __npoints |
The number of points to use in the interpolation. More... | |
std::list< int > | __nodes |
The number of nodes to use in the interpolation. More... | |
std::list< double > | __smoothing |
The smoothing to use in the interpolation. More... | |
std::list< int > | __quantity_id |
The quantity ID of the quantity being interpolated. More... | |
std::list< int > | __grid_index |
The index of the grid point being interpolated. More... | |
std::vector< Core::InterpolatingFunctionALGLIB * > | __result |
The interpolation results. More... | |
pthread_mutex_t | __sync_mutex |
A pthread mutex used to ensure that only one thread is extracting the next quantity for interpolation. More... | |
std::list< int >::const_iterator | __quantity_id_iter |
Friends | |
void * | do_interpolation (void *) |
A class that handles a queue of interpolation tasks. Also functions as an iterator over the results.
Definition at line 24 of file ThreadedInterpolation.h.
|
inline |
Create an empty queue.
Definition at line 66 of file ThreadedInterpolation.h.
void StellarEvolution::InterpolationQueue::calculate | ( | unsigned | num_threads | ) |
Carry out the interpoltaions using the specified number of simultaneous threads.
Definition at line 104 of file ThreadedInterpolation.cpp.
|
inline |
The grid index of the currently selected result.
Definition at line 90 of file ThreadedInterpolation.h.
|
private |
Interpolate the first quantity and discard it from __x, __y, __npoints, __nodes and __smoothing.
Definition at line 36 of file ThreadedInterpolation.cpp.
|
inline |
Are there any un-popped results?
Definition at line 104 of file ThreadedInterpolation.h.
void StellarEvolution::InterpolationQueue::pop_front | ( | ) |
Move to the next result in the queue (earlier results are no longer accessible.
Does not actually delete the result, since it is intended to be grabbed by the user.
Definition at line 131 of file ThreadedInterpolation.cpp.
void StellarEvolution::InterpolationQueue::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.
Definition at line 19 of file ThreadedInterpolation.cpp.
|
inline |
The quantity ID of the currently selected result.
Definition at line 87 of file ThreadedInterpolation.h.
|
inline |
The currently selected interupolation result.
Definition at line 93 of file ThreadedInterpolation.h.
|
private |
The index of the grid point being interpolated.
Definition at line 45 of file ThreadedInterpolation.h.
|
private |
The number of nodes to use in the interpolation.
Definition at line 36 of file ThreadedInterpolation.h.
|
private |
The number of points to use in the interpolation.
Definition at line 33 of file ThreadedInterpolation.h.
|
private |
The quantity ID of the quantity being interpolated.
Definition at line 42 of file ThreadedInterpolation.h.
|
private |
The interpolation results.
Definition at line 48 of file ThreadedInterpolation.h.
|
private |
The smoothing to use in the interpolation.
Definition at line 39 of file ThreadedInterpolation.h.
|
private |
A pthread mutex used to ensure that only one thread is extracting the next quantity for interpolation.
Definition at line 53 of file ThreadedInterpolation.h.
|
private |
The array of x values to use in the interpolation.
Definition at line 27 of file ThreadedInterpolation.h.
|
private |
The array of y values to use in the interpolation.
Definition at line 30 of file ThreadedInterpolation.h.