revision: v0.14
MercuryData.h File Reference
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>

Go to the source code of this file.

Classes

struct  MercuryParticle< NDIMS >
 
struct  MercuryParticle< 2 >
 
class  MercuryTimeStep< NDIMS >
 
class  MercuryTimeStepIterator< NDIMS >
 
class  MercuryDataFile
 
class  MercuryDataFile::IteratorProxy< NDIMS >
 

Functions

template<std::size_t NDIMS>
std::istream & operator>> (std::istream &in, MercuryParticle< NDIMS > &part)
 Read a single particle from a istream. More...
 
template<>
std::istream & operator>><2 > (std::istream &in, MercuryParticle< 2 > &part)
 
template<std::size_t NDIMS>
std::istream & operator>> (std::istream &in, MercuryTimeStep< NDIMS > &step)
 

Function Documentation

◆ operator>>() [1/2]

template<std::size_t NDIMS>
std::istream& operator>> ( std::istream &  in,
MercuryParticle< NDIMS > &  part 
)

Read a single particle from a istream.

117 {
118  std::size_t i;
119  for (i = 0; i < NDIMS; i++)
120  in >> part.position[i];
121 
122  for (i = 0; i < NDIMS; i++) {
123  in >> part.velocity[i];
124  // convert velocities to float, because paraview cannot handle doubles
125  part.velocity[i] = (float)part.velocity[i];
126  }
127 
128  in >> part.radius;
129 
130  for (i = 0; i < NDIMS; i++)
131  in >> part.rotation[i];
132 
133  for (i = 0; i < NDIMS; i++) {
134  in >> part.angularV[i];
135  // convert velocities to float, because paraview cannot handle doubles
136  part.angularV[i] = (float)part.angularV[i];
137  }
138 
139  in >> part.speciesID;
140 
141  return in;
142 }

References MercuryParticle< NDIMS >::angularV, constants::i, MercuryParticle< NDIMS >::position, MercuryParticle< NDIMS >::radius, MercuryParticle< NDIMS >::rotation, MercuryParticle< NDIMS >::speciesID, and MercuryParticle< NDIMS >::velocity.

◆ operator>>() [2/2]

template<std::size_t NDIMS>
std::istream& operator>> ( std::istream &  in,
MercuryTimeStep< NDIMS > &  step 
)

Reads the time step header into the ts

Parameters
[in,out]inThe istream where we read from
[out]stepThe timestream read into
Returns
in for chaining.
341 {
342  std::size_t i;
343  in >> step.numParticles_ >> step.time_;
344 
345  for (i = 0; i < NDIMS; i++)
346  in >> step.min_[i];
347 
348  for (i = 0; i < NDIMS; i++)
349  in >> step.max_[i];
350 
351  return in;
352 }

References constants::i, MercuryTimeStep< NDIMS >::max_, MercuryTimeStep< NDIMS >::min_, MercuryTimeStep< NDIMS >::numParticles_, and MercuryTimeStep< NDIMS >::time_.

◆ operator>><2 >()

template<>
std::istream& operator>><2 > ( std::istream &  in,
MercuryParticle< 2 > &  part 
)
146 {
147  std::size_t i;
148  in >> part.position[0] >> part.position[2];
149  part.position[1] = 0;
150 
151  in >> part.velocity[0] >> part.velocity[2];
152  part.velocity[1] = 0;
153 
154  in >> part.radius;
155 
156  in >> part.rotation[1];
157  part.rotation[0] = part.rotation[2] = 0;
158 
159  in >> part.angularV[1];
160  part.angularV[0] = part.angularV[2] = 0;
161 
162  in >> part.speciesID;
163 
164  return in;
165 }

References constants::i.

MercuryTimeStep::numParticles_
std::size_t numParticles_
Definition: MercuryData.h:308
MercuryParticle::rotation
double rotation[NDIMS]
Definition: MercuryData.h:55
MercuryTimeStep::min_
double min_[NDIMS]
Definition: MercuryData.h:312
MercuryParticle< 2 >::velocity
double velocity[3]
Definition: MercuryData.h:90
MercuryParticle< 2 >::rotation
double rotation[3]
Definition: MercuryData.h:94
MercuryTimeStep::max_
double max_[NDIMS]
Definition: MercuryData.h:312
MercuryTimeStep::time_
double time_
Definition: MercuryData.h:300
MercuryParticle::speciesID
std::size_t speciesID
Definition: MercuryData.h:69
MercuryParticle< 2 >::position
double position[3]
Definition: MercuryData.h:86
MercuryParticle::velocity
double velocity[NDIMS]
Definition: MercuryData.h:51
MercuryParticle::angularV
double angularV[NDIMS]
Definition: MercuryData.h:59
constants::i
const std::complex< Mdouble > i
Definition: ExtendedMath.h:51
MercuryParticle< 2 >::speciesID
std::size_t speciesID
Definition: MercuryData.h:108
MercuryParticle< 2 >::radius
double radius
Definition: MercuryData.h:103
MercuryParticle< 2 >::angularV
double angularV[3]
Definition: MercuryData.h:98
MercuryParticle::radius
double radius
Definition: MercuryData.h:64
MercuryParticle::position
double position[NDIMS]
Definition: MercuryData.h:47