Skip to content
Snippets Groups Projects
Commit b5231f2e authored by mark's avatar mark Committed by Mark OLESEN
Browse files

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

- Also reported as http://bugs.openfoam.org/view.php?id=2188
parent fa2ae8e7
Branches
No related merge requests found
...@@ -97,7 +97,11 @@ int main(int argc, char *argv[]) ...@@ -97,7 +97,11 @@ int main(int argc, char *argv[])
"surfMesh", "surfMesh",
"test surfMesh output" "test surfMesh output"
); );
argList::addBoolOption("triSurface"); argList::addBoolOption
(
"triSurface",
"use triSurface for read/write"
);
argList::addBoolOption argList::addBoolOption
( (
"unsorted", "unsorted",
...@@ -164,10 +168,14 @@ int main(int argc, char *argv[]) ...@@ -164,10 +168,14 @@ int main(int argc, char *argv[])
os << surf; os << surf;
IStringStream is(os.str()); IStringStream is(os.str());
// both work:
triSurface surf2(is); triSurface surf2(is);
// OR
// is.rewind(); // is.rewind();
// is >> surf2; // FAIL: uses List<labelledTri> base class // triSurface surf2;
// is >> surf2;
// surf2.read(is); // FAIL: private method // surf2.read(is); // FAIL: private method
} }
......
...@@ -1108,6 +1108,15 @@ void Foam::triSurface::operator=(const triSurface& ts) ...@@ -1108,6 +1108,15 @@ void Foam::triSurface::operator=(const triSurface& ts)
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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) Foam::Ostream& Foam::operator<<(Ostream& os, const triSurface& sm)
{ {
sm.write(os); sm.write(os);
......
...@@ -409,8 +409,9 @@ public: ...@@ -409,8 +409,9 @@ public:
void operator=(const triSurface&); void operator=(const triSurface&);
// Ostream Operator // IOstream Operators
friend Istream& operator>>(Istream&, triSurface&);
friend Ostream& operator<<(Ostream&, const triSurface&); friend Ostream& operator<<(Ostream&, const triSurface&);
}; };
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment