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

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

Read a single particle from a istream.

Definition at line 116 of file MercuryData.h.

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

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 }
double velocity[NDIMS]
Definition: MercuryData.h:51
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
double angularV[NDIMS]
Definition: MercuryData.h:59
double position[NDIMS]
Definition: MercuryData.h:47
double rotation[NDIMS]
Definition: MercuryData.h:55
std::size_t speciesID
Definition: MercuryData.h:69
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.

Definition at line 340 of file MercuryData.h.

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

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 }
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50
double min_[NDIMS]
Definition: MercuryData.h:312
double max_[NDIMS]
Definition: MercuryData.h:312
std::size_t numParticles_
Definition: MercuryData.h:308
template<>
std::istream& operator>>< 2 > ( std::istream &  in,
MercuryParticle< 2 > &  part 
)

Definition at line 145 of file MercuryData.h.

References constants::i.

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 }
std::size_t speciesID
Definition: MercuryData.h:108
const std::complex< Mdouble > i
Definition: ExtendedMath.h:50