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

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.
340 {
341  std::size_t i;
342  in >> step.numParticles_ >> step.time_;
343 
344  for (i = 0; i < NDIMS; i++)
345  in >> step.min_[i];
346 
347  for (i = 0; i < NDIMS; i++)
348  in >> step.max_[i];
349 
350  return in;
351 }
std::size_t numParticles_
Definition: MercuryData.h:307
double max_[NDIMS]
Definition: MercuryData.h:311
double time_
Definition: MercuryData.h:299
double min_[NDIMS]
Definition: MercuryData.h:311

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  in >> part.position[0] >> part.position[2];
148  part.position[1] = 0;
149 
150  in >> part.velocity[0] >> part.velocity[2];
151  part.velocity[1] = 0;
152 
153  in >> part.radius;
154 
155  in >> part.rotation[1];
156  part.rotation[0] = part.rotation[2] = 0;
157 
158  in >> part.angularV[1];
159  part.angularV[0] = part.angularV[2] = 0;
160 
161  in >> part.speciesID;
162 
163  return in;
164 }
std::size_t speciesID
Definition: MercuryData.h:108
double rotation[3]
Definition: MercuryData.h:94
double angularV[3]
Definition: MercuryData.h:98
double velocity[3]
Definition: MercuryData.h:90
double position[3]
Definition: MercuryData.h:86
double radius
Definition: MercuryData.h:103