Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
StellarEvolution::InterpolationQueue Class Reference

A class that handles a queue of interpolation tasks. Also functions as an iterator over the results. More...

#include <ThreadedInterpolation.h>

+ Collaboration diagram for StellarEvolution::InterpolationQueue:

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::InterpolatingFunctionALGLIBresult () 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 *)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ InterpolationQueue()

StellarEvolution::InterpolationQueue::InterpolationQueue ( )
inline

Create an empty queue.

Definition at line 66 of file ThreadedInterpolation.h.

Member Function Documentation

◆ calculate()

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.

◆ grid_index()

int StellarEvolution::InterpolationQueue::grid_index ( ) const
inline

The grid index of the currently selected result.

Definition at line 90 of file ThreadedInterpolation.h.

◆ interpolate_thread()

void StellarEvolution::InterpolationQueue::interpolate_thread ( )
private

Interpolate the first quantity and discard it from __x, __y, __npoints, __nodes and __smoothing.

Definition at line 36 of file ThreadedInterpolation.cpp.

◆ operator bool()

StellarEvolution::InterpolationQueue::operator bool ( ) const
inline

Are there any un-popped results?

Definition at line 104 of file ThreadedInterpolation.h.

◆ pop_front()

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.

◆ push_back()

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.

◆ quantity_id()

int StellarEvolution::InterpolationQueue::quantity_id ( ) const
inline

The quantity ID of the currently selected result.

Definition at line 87 of file ThreadedInterpolation.h.

◆ result()

Core::InterpolatingFunctionALGLIB* StellarEvolution::InterpolationQueue::result ( ) const
inline

The currently selected interupolation result.

Definition at line 93 of file ThreadedInterpolation.h.

Member Data Documentation

◆ __grid_index

std::list<int> StellarEvolution::InterpolationQueue::__grid_index
private

The index of the grid point being interpolated.

Definition at line 45 of file ThreadedInterpolation.h.

◆ __nodes

std::list<int> StellarEvolution::InterpolationQueue::__nodes
private

The number of nodes to use in the interpolation.

Definition at line 36 of file ThreadedInterpolation.h.

◆ __npoints

std::list<size_t> StellarEvolution::InterpolationQueue::__npoints
private

The number of points to use in the interpolation.

Definition at line 33 of file ThreadedInterpolation.h.

◆ __quantity_id

std::list<int> StellarEvolution::InterpolationQueue::__quantity_id
private

The quantity ID of the quantity being interpolated.

Definition at line 42 of file ThreadedInterpolation.h.

◆ __result

std::vector<Core::InterpolatingFunctionALGLIB*> StellarEvolution::InterpolationQueue::__result
private

The interpolation results.

Definition at line 48 of file ThreadedInterpolation.h.

◆ __smoothing

std::list<double> StellarEvolution::InterpolationQueue::__smoothing
private

The smoothing to use in the interpolation.

Definition at line 39 of file ThreadedInterpolation.h.

◆ __sync_mutex

pthread_mutex_t StellarEvolution::InterpolationQueue::__sync_mutex
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.

◆ __x

std::list<const double *> StellarEvolution::InterpolationQueue::__x
private

The array of x values to use in the interpolation.

Definition at line 27 of file ThreadedInterpolation.h.

◆ __y

std::list<const double *> StellarEvolution::InterpolationQueue::__y
private

The array of y values to use in the interpolation.

Definition at line 30 of file ThreadedInterpolation.h.


The documentation for this class was generated from the following files: