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 }
Mdouble Y
Definition: Vector.h:66
Mdouble Z
Definition: Vector.h:66
Mdouble X
the vector components
Definition: Vector.h:66

◆ 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;
378  if (is.fail()) {
379  logger(VERBOSE,"Failed to read x-value %", a.X);
380  //a.X = 0;
381  is.clear();
382  }
383  is >> a.Y;
384  if (is.fail()) {
385  logger(VERBOSE,"Failed to read y-value %", a.Y);
386  //a.Y = 0;
387  is.clear();
388  }
389  is >> a.Z;
390  if (is.fail()) {
391  logger(VERBOSE,"Failed to read z-value %", a.Z);
392  //a.Z = 0;
393  is.clear();
394  }
395  return is;
396 }
LL< Log::VERBOSE > VERBOSE
Verbose information.
Definition: Logger.cc:57
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.