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
284  : time_(0), ID_(id), numParticles_(0), dataFile_(pData)
285  {
286  }
std::size_t numParticles_
Definition: MercuryData.h:307
std::size_t ID_
Definition: MercuryData.h:303
double time_
Definition: MercuryData.h:299
MercuryDataFile * dataFile_
Definition: MercuryData.h:317

◆ MercuryTimeStep() [2/2]

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

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

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

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.

233  {
234  return storage_.begin();
235  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:322

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.

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

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.

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

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.

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

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

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

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

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

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.

265  {
266  return storage_[idx];
267  }

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.

273  {
274  return storage_[idx];
275  }

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

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: