Skip to content
Snippets Groups Projects
Commit bd27a662 authored by mattijs's avatar mattijs
Browse files

binary output

parent 05e733ce
No related branches found
No related tags found
No related merge requests found
...@@ -94,6 +94,12 @@ public: ...@@ -94,6 +94,12 @@ public:
index_(-1) index_(-1)
{} {}
//- Construct from Istream
PointIndexHit(Istream& is)
{
is >> *this;
}
// Member Functions // Member Functions
...@@ -193,13 +199,45 @@ public: ...@@ -193,13 +199,45 @@ public:
friend Ostream& operator<< (Ostream& os, const PointIndexHit& pHit) friend Ostream& operator<< (Ostream& os, const PointIndexHit& pHit)
{ {
return os << pHit.hit_ << token::SPACE << pHit.hitPoint_ if (os.format() == IOstream::ASCII)
<< token::SPACE << pHit.index_; {
os << pHit.hit_ << token::SPACE << pHit.hitPoint_
<< token::SPACE << pHit.index_;
}
else
{
os.write
(
reinterpret_cast<const char*>(&pHit),
sizeof(PointIndexHit)
);
}
// Check state of Ostream
os.check("Ostream& operator<<(Ostream&, const PointIndexHit&)");
return os;
} }
friend Istream& operator>>(Istream& is, PointIndexHit& pHit) friend Istream& operator>>(Istream& is, PointIndexHit& pHit)
{ {
return is >> pHit.hit_ >> pHit.hitPoint_ >> pHit.index_; if (is.format() == IOstream::ASCII)
{
return is >> pHit.hit_ >> pHit.hitPoint_ >> pHit.index_;
}
else
{
is.read
(
reinterpret_cast<char*>(&pHit),
sizeof(PointIndexHit)
);
}
// Check state of Istream
is.check("Istream& operator>>(Istream&, PointIndexHit&)");
return is;
} }
}; };
......
...@@ -39,7 +39,14 @@ Description ...@@ -39,7 +39,14 @@ Description
namespace Foam namespace Foam
{ {
typedef PointIndexHit<point> pointIndexHit;
typedef PointIndexHit<point> pointIndexHit;
//- Specify data associated with pointIndexHit type is contiguous
template<>
inline bool contiguous<pointIndexHit>() {return true;}
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment