Overload operator<< for Position

This commit is contained in:
Paul Romano 2019-05-14 08:47:57 -05:00
parent 73c4d97a37
commit b2ad4d37dd
2 changed files with 10 additions and 0 deletions

View file

@ -3,6 +3,7 @@
#include <array>
#include <cmath> // for sqrt
#include <iostream>
#include <stdexcept> // for out_of_range
#include <vector>
@ -94,6 +95,8 @@ inline bool operator==(Position a, Position b)
inline bool operator!=(Position a, Position b)
{return a.x != b.x || a.y != b.y || a.z != b.z;}
std::ostream& operator<<(std::ostream& os, Position a);
//==============================================================================
//! Type representing a vector direction in Cartesian coordinates
//==============================================================================

View file

@ -94,4 +94,11 @@ Position::rotate(const std::vector<double>& rotation) const
};
}
std::ostream&
operator<<(std::ostream& os, Position r)
{
os << "(" << r.x << ", " << r.y << ", " << r.z << ")";
return os;
}
} // namespace openmc