MercuryDPM  Trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Vector.cc File Reference
#include "Vector.h"
#include "SmallVector.h"

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const Vec3D &a)
 
std::istream & operator>> (std::istream &is, Vec3D &a)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Vec3D a 
)

Adds all elements of the vector to an output stream. NB: this is a global function and a friend of the Vec3D class!

Parameters
[in]osthe output stream,
[in]aThe vector of interest
Returns
the output stream with vector elements added

Definition at line 361 of file Vector.cc.

References Vec3D::X, Vec3D::Y, and Vec3D::Z.

362 {
363  os << a.X << ' ' << a.Y << ' ' << a.Z;
364  return os;
365 }
Mdouble X
the vector components
Definition: Vector.h:65
Mdouble Y
Definition: Vector.h:65
Mdouble Z
Definition: Vector.h:65
std::istream& operator>> ( std::istream &  is,
Vec3D a 
)

Reads all elements of a given vector from an input stream. NB: this is a global function and a friend of the Vec3D class!

Parameters
[in,out]isthe input stream
[in,out]athe vector to be read in
Returns
the input stream from which the vector elements were read

Definition at line 374 of file Vector.cc.

References Vec3D::X, Vec3D::Y, and Vec3D::Z.

375 {
376  //TW: clearing the stream avoids the nasty problem that the failbit is set to true if numbers below DBL_MIN=1e-308 are read.
377  is >> a.X; is.clear();
378  is >> a.Y; is.clear();
379  is >> a.Z; //is.clear();
380  return is;
381 }
Mdouble X
the vector components
Definition: Vector.h:65
Mdouble Y
Definition: Vector.h:65
Mdouble Z
Definition: Vector.h:65