1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 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,
140 IOstream::currentVersion,
146 os << this->points();
148 io.writeEndDivider(os);
152 // write surfMesh/faces
160 surfMesh::meshSubDir,
172 IOstream::currentVersion,
177 if (this->useFaceMap())
179 // this is really a bit annoying (and wasteful) but no other way
180 os << reorder(this->faceMap(), this->faces());
187 io.writeEndDivider(os);
191 // write surfMesh/surfZones
199 surfMesh::meshSubDir,
208 OFstream os(objectDir/io.name());
211 os << this->surfZones();
213 io.writeEndDivider(os);
219 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
222 Foam::MeshedSurfaceProxy<Face>::MeshedSurfaceProxy
224 const pointField& pointLst,
225 const List<Face>& faceLst,
226 const List<surfZone>& zoneLst,
227 const List<label>& faceMap
237 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
240 Foam::MeshedSurfaceProxy<Face>::~MeshedSurfaceProxy()
244 // ************************************************************************* //