MercuryTimeStep< NDIMS > Class Template Reference

#include <MercuryData.h>

Public Member Functions

double getTime () const
 Gets the time associated with this time step. More...
 
std::size_t getTimeStepID () const
 Gets the time step ID Returns the time step ID, which is a consecutively ascending number unique for the time step. More...
 
std::size_t getNumberOfParticles () const
 Gets the number of particles recorded in this time step. More...
 
std::size_t size () const
 Gets the number of particles recorded in this time step. More...
 
constexpr std::size_t getNumberOfDimensions () const
 returns the number of dimensions used. More...
 
std::vector< MercuryParticle< NDIMS > >::iterator begin ()
 Iterator functions for range based for loops. More...
 
std::vector< MercuryParticle< NDIMS > >::const_iterator begin () const
 Iterator functions for range based for loops. More...
 
std::vector< MercuryParticle< NDIMS > >::iterator end ()
 Iterator functions for range based for loops. More...
 
std::vector< MercuryParticle< NDIMS > >::const_iterator end () const
 Iterator functions for range based for loops. More...
 
MercuryParticle< NDIMS > & operator[] (std::size_t idx)
 Random access function into the particles. More...
 
const MercuryParticle< NDIMS > & operator[] (std::size_t idx) const
 Random access function into the particles. More...
 

Private Member Functions

 MercuryTimeStep (std::size_t id, MercuryDataFile *pData)
 Constructor used by the MercuryTimeStepIterator, to flag a functional time step. More...
 
 MercuryTimeStep ()
 EOF-TimeStep constructor used by MercuryTimeStepIterator (and MercuryDataFile::isMercury3DDataFile()) More...
 

Private Attributes

double time_
 
std::size_t ID_
 
std::size_t numParticles_
 
double min_ [NDIMS]
 
double max_ [NDIMS]
 
MercuryDataFiledataFile_
 
std::vector< MercuryParticle< NDIMS > > storage_
 

Friends

class MercuryTimeStepIterator< NDIMS >
 
class MercuryDataFile
 
template<std::size_t NDIMS2>
std::istream & operator>> (std::istream &, MercuryTimeStep< NDIMS2 > &)
 

Detailed Description

template<std::size_t NDIMS>
class MercuryTimeStep< NDIMS >

Full time step in the Mercury 3D .data format. This holds all the particles used in this time step.

Author
dducks

Constructor & Destructor Documentation

◆ MercuryTimeStep() [1/2]

template<std::size_t NDIMS>
MercuryTimeStep< NDIMS >::MercuryTimeStep ( std::size_t  id,
MercuryDataFile pData 
)
inlineprivate

Constructor used by the MercuryTimeStepIterator, to flag a functional time step.

Parameters
[in]idThe unique ID given to this particle
[in,out]pDataA pointer to the MercuryDataFile, which contains the backing std::ifstream
263  : time_(0), ID_(id), numParticles_(0), dataFile_(pData)
264  {
265  }
std::size_t numParticles_
Definition: MercuryData.h:286
std::size_t ID_
Definition: MercuryData.h:282
double time_
Definition: MercuryData.h:278
MercuryDataFile * dataFile_
Definition: MercuryData.h:296

◆ MercuryTimeStep() [2/2]

template<std::size_t NDIMS>
MercuryTimeStep< NDIMS >::MercuryTimeStep ( )
inlineprivate

EOF-TimeStep constructor used by MercuryTimeStepIterator (and MercuryDataFile::isMercury3DDataFile())

271  : time_(0), ID_(0), numParticles_(0), dataFile_(nullptr)
272  {
273  }

Member Function Documentation

◆ begin() [1/2]

template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> >::iterator MercuryTimeStep< NDIMS >::begin ( )
inline

Iterator functions for range based for loops.

212  {
213  return storage_.begin();
214  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:301

References MercuryTimeStep< NDIMS >::storage_.

◆ begin() [2/2]

template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> >::const_iterator MercuryTimeStep< NDIMS >::begin ( ) const
inline

Iterator functions for range based for loops.

220  {
221  return storage_.begin();
222  }

References MercuryTimeStep< NDIMS >::storage_.

◆ end() [1/2]

template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> >::iterator MercuryTimeStep< NDIMS >::end ( )
inline

Iterator functions for range based for loops.

228  {
229  return storage_.end();
230  }

References MercuryTimeStep< NDIMS >::storage_.

◆ end() [2/2]

template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> >::const_iterator MercuryTimeStep< NDIMS >::end ( ) const
inline

Iterator functions for range based for loops.

236  {
237  return storage_.end();
238  }

References MercuryTimeStep< NDIMS >::storage_.

◆ getNumberOfDimensions()

template<std::size_t NDIMS>
constexpr std::size_t MercuryTimeStep< NDIMS >::getNumberOfDimensions ( ) const
inlineconstexpr

returns the number of dimensions used.

Returns
the number of dimensions.
204  {
205  return NDIMS;
206  }

◆ getNumberOfParticles()

template<std::size_t NDIMS>
std::size_t MercuryTimeStep< NDIMS >::getNumberOfParticles ( ) const
inline

Gets the number of particles recorded in this time step.

Returns
the number of particles
See also
size()
185  {
186  return numParticles_;
187  }

References MercuryTimeStep< NDIMS >::numParticles_.

◆ getTime()

template<std::size_t NDIMS>
double MercuryTimeStep< NDIMS >::getTime ( ) const
inline

Gets the time associated with this time step.

Returns
the time
164  {
165  return time_;
166  }

References MercuryTimeStep< NDIMS >::time_.

◆ getTimeStepID()

template<std::size_t NDIMS>
std::size_t MercuryTimeStep< NDIMS >::getTimeStepID ( ) const
inline

Gets the time step ID Returns the time step ID, which is a consecutively ascending number unique for the time step.

Returns
a unique ID for this time step
175  {
176  return ID_;
177  }

References MercuryTimeStep< NDIMS >::ID_.

◆ operator[]() [1/2]

template<std::size_t NDIMS>
MercuryParticle<NDIMS>& MercuryTimeStep< NDIMS >::operator[] ( std::size_t  idx)
inline

Random access function into the particles.

244  {
245  return storage_[idx];
246  }

References MercuryTimeStep< NDIMS >::storage_.

◆ operator[]() [2/2]

template<std::size_t NDIMS>
const MercuryParticle<NDIMS>& MercuryTimeStep< NDIMS >::operator[] ( std::size_t  idx) const
inline

Random access function into the particles.

252  {
253  return storage_[idx];
254  }

References MercuryTimeStep< NDIMS >::storage_.

◆ size()

template<std::size_t NDIMS>
std::size_t MercuryTimeStep< NDIMS >::size ( ) const
inline

Gets the number of particles recorded in this time step.

Returns
the number of particles
See also
getNumberOfParticles()
195  {
196  return numParticles_;
197  }

References MercuryTimeStep< NDIMS >::numParticles_.

Friends And Related Function Documentation

◆ MercuryDataFile

template<std::size_t NDIMS>
friend class MercuryDataFile
friend

◆ MercuryTimeStepIterator< NDIMS >

template<std::size_t NDIMS>
friend class MercuryTimeStepIterator< NDIMS >
friend

◆ operator>>

template<std::size_t NDIMS>
template<std::size_t NDIMS2>
std::istream& operator>> ( std::istream &  ,
MercuryTimeStep< NDIMS2 > &   
)
friend

Member Data Documentation

◆ dataFile_

template<std::size_t NDIMS>
MercuryDataFile* MercuryTimeStep< NDIMS >::dataFile_
private

Pointer to the base file, required for the backing std::ifstream

Todo:
Chris, please check if this parameter is needed; it causes a warning with [-Wunused-private-field]
Author
weinhartt

◆ ID_

template<std::size_t NDIMS>
std::size_t MercuryTimeStep< NDIMS >::ID_
private

Unique ID associated with this MercuryTimeStep

Referenced by MercuryTimeStep< NDIMS >::getTimeStepID().

◆ max_

template<std::size_t NDIMS>
double MercuryTimeStep< NDIMS >::max_[NDIMS]
private

Referenced by operator>>().

◆ min_

template<std::size_t NDIMS>
double MercuryTimeStep< NDIMS >::min_[NDIMS]
private

Minima and maxima of the AABB of the domain; none of these are used.

Referenced by operator>>().

◆ numParticles_

template<std::size_t NDIMS>
std::size_t MercuryTimeStep< NDIMS >::numParticles_
private

Cached count of particles in this MercuryTimeStep

Referenced by MercuryTimeStep< NDIMS >::getNumberOfParticles(), operator>>(), and MercuryTimeStep< NDIMS >::size().

◆ storage_

template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> > MercuryTimeStep< NDIMS >::storage_
private

Backing storage vector used for the particles in this time step

Referenced by MercuryTimeStep< NDIMS >::begin(), MercuryTimeStep< NDIMS >::end(), and MercuryTimeStep< NDIMS >::operator[]().

◆ time_

template<std::size_t NDIMS>
double MercuryTimeStep< NDIMS >::time_
private

Time associated with this MercuryTimeStep

Referenced by MercuryTimeStep< NDIMS >::getTime(), and operator>>().


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