revision: v0.14
Vector.cc File Reference
#include "Vector.h"
#include "SmallVector.h"

Functions

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

Function Documentation

◆ operator<<()

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
362 {
363  os << a.X << ' ' << a.Y << ' ' << a.Z;
364  return os;
365 }

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

◆ operator>>()

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
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 }

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

Vec3D::X
Mdouble X
the vector components
Definition: Vector.h:65
Vec3D::Y
Mdouble Y
Definition: Vector.h:65
Vec3D::Z
Mdouble Z
Definition: Vector.h:65