1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
28 #include "EMESHedgeFormat.H"
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 Foam::edgeMesh::edgeMesh
46 Foam::edgeMesh::edgeMesh(const fileName& name)
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
58 bool Foam::edgeMesh::read(const fileName& name)
60 word ext = name.ext();
63 fileName unzipName = name.lessExt();
64 return read(unzipName, unzipName.ext());
68 return read(name, ext);
73 // Read from file in given format
74 bool Foam::edgeMesh::read
80 // read via selector mechanism
81 transfer(New(name, ext)());
86 void Foam::edgeMesh::write
94 Info<< "edgeMesh::write"
95 "(const fileName&, const edgeMesh&) : "
100 const word ext = name.ext();
102 writefileExtensionMemberFunctionTable::iterator mfIter =
103 writefileExtensionMemberFunctionTablePtr_->find(ext);
105 if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
109 "MeshedSurface::write"
110 "(const fileName&, const MeshedSurface&)"
111 ) << "Unknown file extension " << ext << nl << nl
112 << "Valid types are :" << endl
113 << writefileExtensionMemberFunctionTablePtr_->sortedToc()
118 mfIter()(name, mesh);
123 void Foam::edgeMesh::writeStats(Ostream& os) const
125 os << "points : " << points().size() << nl;
126 os << "edges : " << edges().size() << nl;
127 os << "boundingBox : " << boundBox(this->points()) << endl;
131 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
133 Foam::Ostream& Foam::operator<<(Ostream& os, const edgeMesh& em)
135 fileFormats::EMESHedgeFormat::write(os, em.points_, em.edges_);
137 // Check state of Ostream
138 os.check("Ostream& operator<<(Ostream&, const edgeMesh&)");
144 Foam::Istream& Foam::operator>>(Istream& is, edgeMesh& em)
146 fileFormats::EMESHedgeFormat::read(is, em.points_, em.edges_);
148 em.pointEdgesPtr_.clear();
150 // Check state of Istream
151 is.check("Istream& operator>>(Istream&, edgeMesh&)");
157 // ************************************************************************* //