mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
binary output
This commit is contained in:
@ -87,9 +87,47 @@ boundBox::boundBox(Istream& is)
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
Ostream& operator<<(Ostream& os, const boundBox& b)
|
||||
Ostream& operator<<(Ostream& os, const boundBox& bb)
|
||||
{
|
||||
return os << b.min() << token::SPACE << b.max();
|
||||
if (os.format() == IOstream::ASCII)
|
||||
{
|
||||
os << bb.min_ << token::SPACE << bb.max_;
|
||||
}
|
||||
else
|
||||
{
|
||||
os.write
|
||||
(
|
||||
reinterpret_cast<const char*>(&bb.min_),
|
||||
sizeof(boundBox)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Ostream
|
||||
os.check("Ostream& operator<<(Ostream&, const boundBox&)");
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
Istream& operator>>(Istream& is, boundBox& bb)
|
||||
{
|
||||
if (is.format() == IOstream::ASCII)
|
||||
{
|
||||
return is >> bb.min_ >> bb.max_;
|
||||
}
|
||||
else
|
||||
{
|
||||
is.read
|
||||
(
|
||||
reinterpret_cast<char*>(&bb.min_),
|
||||
sizeof(boundBox)
|
||||
);
|
||||
}
|
||||
|
||||
// Check state of Istream
|
||||
is.check("Istream& operator>>(Istream&, boundBox&)");
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -153,12 +153,31 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Ostream operator
|
||||
// Friend Operators
|
||||
|
||||
friend Ostream& operator<<(Ostream& os, const boundBox& b);
|
||||
friend bool operator==(const boundBox& a, const boundBox& b)
|
||||
{
|
||||
return (a.min_ == b.min_) && (a.max_ == b.max_);
|
||||
}
|
||||
|
||||
friend bool operator!=(const boundBox& a, const boundBox& b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
|
||||
// IOstream operator
|
||||
|
||||
friend Istream& operator>>(Istream& is, boundBox&);
|
||||
friend Ostream& operator<<(Ostream& os, const boundBox&);
|
||||
};
|
||||
|
||||
|
||||
//- Specify data associated with boundBox type is contiguous
|
||||
template<>
|
||||
inline bool contiguous<boundBox>() {return contiguous<point>();}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
Reference in New Issue
Block a user