revision: v0.14
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
285  : time_(0), ID_(id), numParticles_(0), dataFile_(pData)
286  {
287  }

◆ MercuryTimeStep() [2/2]

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

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

293  : time_(0), ID_(0), numParticles_(0), dataFile_(nullptr)
294  {
295  }

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.

234  {
235  return storage_.begin();
236  }

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.

242  {
243  return storage_.begin();
244  }

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.

250  {
251  return storage_.end();
252  }

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.

258  {
259  return storage_.end();
260  }

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.
226  {
227  return NDIMS;
228  }

◆ 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()
207  {
208  return numParticles_;
209  }

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
186  {
187  return time_;
188  }

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
197  {
198  return ID_;
199  }

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.

266  {
267  return storage_[idx];
268  }

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.

274  {
275  return storage_[idx];
276  }

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()
217  {
218  return numParticles_;
219  }

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:
MercuryTimeStep::numParticles_
std::size_t numParticles_
Definition: MercuryData.h:308
MercuryTimeStep::time_
double time_
Definition: MercuryData.h:300
MercuryTimeStep::ID_
std::size_t ID_
Definition: MercuryData.h:304
MercuryTimeStep::storage_
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:323
MercuryTimeStep::dataFile_
MercuryDataFile * dataFile_
Definition: MercuryData.h:318