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/>.
25 Foam::MeshedSurfaceProxy
28 A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh
29 to various file formats.
33 MeshedSurfaceProxyCore.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef MeshedSurfaceProxy_H
38 #define MeshedSurfaceProxy_H
40 #include "pointField.H"
44 #include "surfZoneList.H"
45 #include "surfaceFormatsCore.H"
46 #include "runTimeSelectionTables.H"
47 #include "memberFunctionSelectionTables.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 // Forward declaration of friend functions and operators
57 template<class Face> class MeshedSurface;
59 /*---------------------------------------------------------------------------*\
60 Class MeshedSurfaceProxy Declaration
61 \*---------------------------------------------------------------------------*/
64 class MeshedSurfaceProxy
66 public fileFormats::surfaceFormatsCore
70 const pointField& points_;
72 const List<Face>& faces_;
74 const List<surfZone>& zones_;
76 const List<label>& faceMap_;
84 typedef Face FaceType;
89 //- Runtime type information
90 ClassName("MeshedSurfaceProxy");
92 //- The file format types that can be written via MeshedSurfaceProxy
93 static wordHashSet writeTypes();
95 //- Can this file format type be written via MeshedSurfaceProxy?
96 static bool canWriteType(const word& ext, const bool verbose=false);
101 //- Construct from component references
106 const List<surfZone>& = List<surfZone>(),
107 const List<label>& faceMap = List<label>()
112 virtual ~MeshedSurfaceProxy();
115 // Member Function Selectors
117 declareMemberFunctionSelectionTable
124 const fileName& name,
125 const MeshedSurfaceProxy<Face>& surf
131 static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
138 //- Return const access to the points
139 inline const pointField& points() const
144 //- Return const access to the faces
145 inline const List<Face>& faces() const
150 //- Const access to the surface zones.
151 // If zones are defined, they must be contiguous and cover the
153 inline const List<surfZone>& surfZones() const
158 //- Const access to the faceMap, zero-sized when unused
159 inline const List<label>& faceMap() const
165 inline bool useFaceMap() const
167 return faceMap_.size() == faces_.size();
172 //- Generic write routine. Chooses writer based on extension.
173 virtual void write(const fileName& name) const
178 //- Write to database
179 virtual void write(const Time&, const word& surfName = "") const;
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 } // End namespace Foam
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 # include "MeshedSurfaceProxy.C"
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 // ************************************************************************* //