1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
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 \*---------------------------------------------------------------------------*/
26 #include "MeshedSurfaceProxy.H"
33 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
36 Foam::wordHashSet Foam::MeshedSurfaceProxy<Face>::writeTypes()
38 return wordHashSet(*writefileExtensionMemberFunctionTablePtr_);
43 bool Foam::MeshedSurfaceProxy<Face>::canWriteType
49 return fileFormats::surfaceFormatsCore::checkSupport
51 writeTypes(), ext, verbose, "writing"
57 void Foam::MeshedSurfaceProxy<Face>::write
60 const MeshedSurfaceProxy& surf
65 Info<< "MeshedSurfaceProxy::write"
66 "(const fileName&, const MeshedSurfaceProxy&) : "
71 word ext = name.ext();
73 typename writefileExtensionMemberFunctionTable::iterator mfIter =
74 writefileExtensionMemberFunctionTablePtr_->find(ext);
76 if (mfIter == writefileExtensionMemberFunctionTablePtr_->end())
80 "MeshedSurfaceProxy::write(const fileName&)"
81 ) << "Unknown file extension " << ext << nl << nl
82 << "Valid types are :" << endl
92 void Foam::MeshedSurfaceProxy<Face>::write
98 // the surface name to be used
99 word name(surfName.size() ? surfName : surfaceRegistry::defaultName);
103 Info<< "MeshedSurfaceProxy::write"
104 "(const Time&, const word&) : "
105 "writing to " << name
110 // the local location
111 const fileName objectDir
113 t.timePath()/surfaceRegistry::prefix/name/surfMesh::meshSubDir
116 if (!isDir(objectDir))
122 // write surfMesh/points
130 surfMesh::meshSubDir,
142 IOstream::currentVersion,
148 os << this->points();
150 io.writeEndDivider(os);
154 // write surfMesh/faces
162 surfMesh::meshSubDir,
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 // ************************************************************************* //