1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "MeshedSurfaceProxy.H"
34 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
37 Foam::wordHashSet Foam::MeshedSurfaceProxy<Face>::writeTypes()
39 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
44 bool Foam::MeshedSurfaceProxy<Face>::canWriteType
50 return checkSupport(writeTypes(), ext, verbose, "writing");
55 void Foam::MeshedSurfaceProxy<Face>::write
58 const MeshedSurfaceProxy& surf
63 Info<< "MeshedSurfaceProxy::write"
64 "(const fileName&, const MeshedSurfaceProxy&) : "
69 word ext = name.ext();
71 typename writefileExtensionMemberFunctionTable::iterator mfIter =
72 writefileExtensionMemberFunctionTablePtr_->find(ext);
74 if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
78 "MeshedSurfaceProxy::write(const fileName&)"
79 ) << "Unknown file extension " << ext << nl << nl
80 << "Valid types are :" << endl
90 void Foam::MeshedSurfaceProxy<Face>::write
96 // the surface name to be used
97 word name(surfName.size() ? surfName : surfaceRegistry::defaultName);
101 Info<< "MeshedSurfaceProxy::write"
102 "(const Time&, const word&) : "
103 "writing to " << name
108 // the local location
109 const fileName objectDir
111 t.timePath()/surfaceRegistry::prefix/name/surfMesh::meshSubDir
114 if (!isDir(objectDir))
120 // write surfMesh/points
128 surfMesh::meshSubDir,
139 ios_base::out|ios_base::trunc,
141 IOstream::currentVersion,
147 os << this->points();
149 io.writeEndDivider(os);
153 // write surfMesh/faces
161 surfMesh::meshSubDir,
172 ios_base::out|ios_base::trunc,
174 IOstream::currentVersion,
179 if (this->useFaceMap())
181 // this is really a bit annoying (and wasteful) but no other way
182 os << reorder(this->faceMap(), this->faces());
189 io.writeEndDivider(os);
193 // write surfMesh/surfZones
201 surfMesh::meshSubDir,
210 OFstream os(objectDir/io.name());
213 os << this->surfZones();
215 io.writeEndDivider(os);
221 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
224 Foam::MeshedSurfaceProxy<Face>::MeshedSurfaceProxy
226 const pointField& pointLst,
227 const List<Face>& faceLst,
228 const List<surfZone>& zoneLst,
229 const List<label>& faceMap
239 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
242 Foam::MeshedSurfaceProxy<Face>::~MeshedSurfaceProxy()
246 // ************************************************************************* //