criptic v1
Cosmic Ray Interstellar Propagation Tool using Itô Calculus
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
criptic::ThreadVec< T > Class Template Reference

A class to automate private thread copies of objects. More...

#include <ThreadVec.H>

Public Member Functions

 ThreadVec ()
 Construct an empty threadvec.
 
IdxType size () const
 Return the number of distinct objects stored.
 
T & operator() ()
 Return the element private to this thread.
 
const T & operator() () const
 Return the element private to this thread.
 
T & operator[] (const int i)
 Return the object belonging to the specified thread.
 
const T & operator[] (const int i) const
 Return the object belonging to the specified thread.
 

Private Attributes

std::vector< T > obj
 

Detailed Description

template<class T>
class criptic::ThreadVec< T >

A class to automate private thread copies of objects.

Template Parameters
TType of object the ThreadVec holds

This class is a container to automate the process of each thread having its own private copy of an object. It is a vector that on creation automatically resizes itself to the number of threads in the openMP threadpool, and when accessed by a thread automatically returns the element of the vector that is private to that thread.

Constructor & Destructor Documentation

◆ ThreadVec()

template<class T >
criptic::ThreadVec< T >::ThreadVec ( )
inline

Construct an empty threadvec.

Member Function Documentation

◆ operator()() [1/2]

template<class T >
criptic::ThreadVec< T >::operator() ( )
inline

Return the element private to this thread.

Returns
Return the element of the ThreadVec private to this thread

◆ operator()() [2/2]

template<class T >
criptic::ThreadVec< T >::operator() ( ) const
inline

Return the element private to this thread.

Returns
Return the element of the ThreadVec private to this thread

◆ operator[]() [1/2]

template<class T >
criptic::ThreadVec< T >::operator[] ( const int  i)
inline

Return the object belonging to the specified thread.

Parameters
iThe thread number whose object should be returned
Returns
The object belonging to thread i

◆ operator[]() [2/2]

template<class T >
criptic::ThreadVec< T >::operator[] ( const int  i) const
inline

Return the object belonging to the specified thread.

Parameters
iThe thread number whose object should be returned
Returns
The object belonging to thread i

◆ size()

template<class T >
IdxType criptic::ThreadVec< T >::size ( ) const
inline

Return the number of distinct objects stored.

Returns
The number of objects stored

Member Data Documentation

◆ obj

template<class T >
std::vector<T> criptic::ThreadVec< T >::obj
private

The stored objects


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