MercuryDPM  Alpha
 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 timestep. More...
 
std::size_t getTimeStepID () const
 Gets the timestep ID Returns the timestep ID, which is a consecutively ascending number unique for the timestep. More...
 
std::size_t getNumberOfParticles () const
 Gets the number of particles recorded in this timestep. More...
 
std::size_t size () const
 Gets the number of particles recorded in this timestep. 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 timestep. 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 timestep in the Mercury 3D .data format. This holds all the particles used in this timestep.

Author
dducks

Definition at line 172 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 timestep.

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 278 of file MercuryData.h.

279  : time_(0), ID_(id), numParticles_(0), dataFile_(pData)
280  {
281  }
MercuryDataFile * dataFile_
Definition: MercuryData.h:311
std::size_t numParticles_
Definition: MercuryData.h:302
std::size_t ID_
Definition: MercuryData.h:298
template<std::size_t NDIMS>
MercuryTimeStep< NDIMS >::MercuryTimeStep ( )
inlineprivate

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

Definition at line 286 of file MercuryData.h.

287  : time_(0), ID_(0), numParticles_(0), dataFile_(nullptr)
288  {
289  }
MercuryDataFile * dataFile_
Definition: MercuryData.h:311
std::size_t numParticles_
Definition: MercuryData.h:302
std::size_t ID_
Definition: MercuryData.h:298

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 227 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

228  {
229  return storage_.begin();
230  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:316
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 235 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

236  {
237  return storage_.begin();
238  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:316
template<std::size_t NDIMS>
std::vector< MercuryParticle<NDIMS> >::iterator MercuryTimeStep< NDIMS >::end ( )
inline

Iterator functions for range based for loops.

Definition at line 243 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

244  {
245  return storage_.end();
246  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:316
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 251 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

252  {
253  return storage_.end();
254  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:316
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 219 of file MercuryData.h.

220  {
221  return NDIMS;
222  }
template<std::size_t NDIMS>
std::size_t MercuryTimeStep< NDIMS >::getNumberOfParticles ( ) const
inline

Gets the number of particles recorded in this timestep.

Returns
the number of particles
See also
size()

Definition at line 200 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::numParticles_.

201  {
202  return numParticles_;
203  }
std::size_t numParticles_
Definition: MercuryData.h:302
template<std::size_t NDIMS>
double MercuryTimeStep< NDIMS >::getTime ( ) const
inline

Gets the time associated with this timestep.

Returns
the time

Definition at line 179 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::time_.

180  {
181  return time_;
182  }
template<std::size_t NDIMS>
std::size_t MercuryTimeStep< NDIMS >::getTimeStepID ( ) const
inline

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

Returns
a unique ID for this timestep

Definition at line 190 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::ID_.

191  {
192  return ID_;
193  }
std::size_t ID_
Definition: MercuryData.h:298
template<std::size_t NDIMS>
MercuryParticle<NDIMS>& MercuryTimeStep< NDIMS >::operator[] ( std::size_t  idx)
inline

Random access function into the particles.

Definition at line 259 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

260  {
261  return storage_[idx];
262  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:316
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 267 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::storage_.

268  {
269  return storage_[idx];
270  }
std::vector< MercuryParticle< NDIMS > > storage_
Definition: MercuryData.h:316
template<std::size_t NDIMS>
std::size_t MercuryTimeStep< NDIMS >::size ( ) const
inline

Gets the number of particles recorded in this timestep.

Returns
the number of particles
See also
getNumberOfParticles()

Definition at line 210 of file MercuryData.h.

References MercuryTimeStep< NDIMS >::numParticles_.

211  {
212  return numParticles_;
213  }
std::size_t numParticles_
Definition: MercuryData.h:302

Friends And Related Function Documentation

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

Definition at line 323 of file MercuryData.h.

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

Definition at line 321 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 311 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 298 of file MercuryData.h.

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

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

Definition at line 306 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 306 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 302 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 timestep

Definition at line 316 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 294 of file MercuryData.h.

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


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