BUG: triSurface IO operators are asymmetrical (fixed #225)

- Also reported as http://bugs.openfoam.org/view.php?id=2188
This commit is contained in:
Mark Olesen
2016-09-06 14:57:40 +02:00
parent 29d5a10f97
commit 99efe5f8d8
3 changed files with 21 additions and 3 deletions

View File

@ -97,7 +97,11 @@ int main(int argc, char *argv[])
"surfMesh",
"test surfMesh output"
);
argList::addBoolOption("triSurface");
argList::addBoolOption
(
"triSurface",
"use triSurface for read/write"
);
argList::addBoolOption
(
"unsorted",
@ -164,10 +168,14 @@ int main(int argc, char *argv[])
os << surf;
IStringStream is(os.str());
// both work:
triSurface surf2(is);
// OR
// is.rewind();
// is >> surf2; // FAIL: uses List<labelledTri> base class
// triSurface surf2;
// is >> surf2;
// surf2.read(is); // FAIL: private method
}

View File

@ -1108,6 +1108,15 @@ void Foam::triSurface::operator=(const triSurface& ts)
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, triSurface& sm)
{
sm.clearOut();
sm.read(is);
sm.setDefaultPatches();
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const triSurface& sm)
{
sm.write(os);

View File

@ -409,8 +409,9 @@ public:
void operator=(const triSurface&);
// Ostream Operator
// IOstream Operators
friend Istream& operator>>(Istream&, triSurface&);
friend Ostream& operator<<(Ostream&, const triSurface&);
};