MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

Definition at line 178 of file MercuryData.h.

Constructor & Destructor Documentation

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

Definition at line 284 of file MercuryData.h.

285  : time_(0), ID_(id), numParticles_(0), dataFile_(pData)
286  {
287  }
MercuryDataFile * dataFile_
Definition: MercuryData.h:318
std::size_t numParticles_
Definition: MercuryData.h:308
std::size_t ID_
Definition: MercuryData.h:304
template<std::size_t NDIMS>
MercuryTimeStep< NDIMS >::MercuryTimeStep ( )
inlineprivate

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

Definition at line 292 of file MercuryData.h.

293  : time_(0), ID_(0), numParticles_(0), dataFile_(nullptr)
294  {
295  }
MercuryDataFile * dataFile_
Definition: MercuryData.h:318
std::size_t numParticles_
Definition: MercuryData.h:308
std::size_t ID_
Definition: MercuryData.h:304

Member Function Documentation

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

Iterator functions for range based for loops.

Definition at line 233 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

234  {
235  return storage_.begin();
236  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:323
template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> >::const_iterator MercuryTimeStep< NDIMS >::begin ( ) const
inline

Iterator functions for range based for loops.

Definition at line 241 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

242  {
243  return storage_.begin();
244  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:323
template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> >::iterator MercuryTimeStep< NDIMS >::end ( )
inline

Iterator functions for range based for loops.

Definition at line 249 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

250  {
251  return storage_.end();
252  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:323
template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> >::const_iterator MercuryTimeStep< NDIMS >::end ( ) const
inline

Iterator functions for range based for loops.

Definition at line 257 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

258  {
259  return storage_.end();
260  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:323
template<std::size_t NDIMS>
constexpr std::size_t MercuryTimeStep< NDIMS >::getNumberOfDimensions ( ) const
inline

returns the number of dimensions used.

Returns
the number of dimensions.

Definition at line 225 of file MercuryData.h.

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

Definition at line 206 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::numParticles_.

207  {
208  return numParticles_;
209  }
std::size_t numParticles_
Definition: MercuryData.h:308
template<std::size_t NDIMS>
double MercuryTimeStep< NDIMS >::getTime ( ) const
inline

Gets the time associated with this time step.

Returns
the time

Definition at line 185 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::time_.

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

Definition at line 196 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::ID_.

197  {
198  return ID_;
199  }
std::size_t ID_
Definition: MercuryData.h:304
template<std::size_t NDIMS>
MercuryParticle<NDIMS>& MercuryTimeStep< NDIMS >::operator[] ( std::size_t  idx)
inline

Random access function into the particles.

Definition at line 265 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

266  {
267  return storage_[idx];
268  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:323
template<std::size_t NDIMS>
const MercuryParticle<NDIMS>& MercuryTimeStep< NDIMS >::operator[] ( std::size_t  idx) const
inline

Random access function into the particles.

Definition at line 273 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

274  {
275  return storage_[idx];
276  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:323
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()

Definition at line 216 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::numParticles_.

217  {
218  return numParticles_;
219  }
std::size_t numParticles_
Definition: MercuryData.h:308

Friends And Related Function Documentation

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

Definition at line 330 of file MercuryData.h.

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

Definition at line 328 of file MercuryData.h.

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

Member Data Documentation

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

Definition at line 318 of file MercuryData.h.

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

Unique ID associated with this MercuryTimeStep

Definition at line 304 of file MercuryData.h.

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

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

Definition at line 312 of file MercuryData.h.

Referenced by operator>>().

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.

Definition at line 312 of file MercuryData.h.

Referenced by operator>>().

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

Cached count of particles in this MercuryTimeStep

Definition at line 308 of file MercuryData.h.

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

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

Backing storage vector used for the particles in this time step

Definition at line 323 of file MercuryData.h.

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

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

Time associated with this MercuryTimeStep

Definition at line 300 of file MercuryData.h.

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


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