initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / surfMesh / MeshedSurfaceProxy / MeshedSurfaceProxy.H
blob776c68372f5d5d27a79d38ac4a597da04c42e180
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 Class
26     Foam::MeshedSurfaceProxy
28 Description
29     A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh
30     to various file formats.
32 SourceFiles
33     MeshedSurfaceProxy.C
34     MeshedSurfaceProxyCore.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef MeshedSurfaceProxy_H
39 #define MeshedSurfaceProxy_H
41 #include "pointField.H"
42 #include "face.H"
43 #include "triFace.H"
45 #include "surfZoneList.H"
46 #include "surfaceFormatsCore.H"
47 #include "runTimeSelectionTables.H"
48 #include "memberFunctionSelectionTables.H"
49 #include "HashSet.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 // Forward declaration of friend functions and operators
58 template<class Face> class MeshedSurface;
60 /*---------------------------------------------------------------------------*\
61                      Class MeshedSurfaceProxy Declaration
62 \*---------------------------------------------------------------------------*/
64 template<class Face>
65 class MeshedSurfaceProxy
67     public fileFormats::surfaceFormatsCore
69     //- Private data
71         const pointField& points_;
73         const List<Face>& faces_;
75         const List<surfZone>& zones_;
77         const List<label>& faceMap_;
80 public:
82     // Static
84         //- Runtime type information
85         ClassName("MeshedSurfaceProxy");
87         //- The file format types that can be written via MeshedSurfaceProxy
88         static wordHashSet writeTypes();
90         //- Can this file format type be written via MeshedSurfaceProxy?
91         static bool canWriteType(const word& ext, const bool verbose=false);
94     // Constructors
96         //- Construct from component references
97         MeshedSurfaceProxy
98         (
99             const pointField&,
100             const List<Face>&,
101             const List<surfZone>& = List<surfZone>(),
102             const List<label>& faceMap = List<label>()
103         );
106     // Destructor
108         virtual ~MeshedSurfaceProxy();
111     // Member Function Selectors
113         declareMemberFunctionSelectionTable
114         (
115             void,
116             MeshedSurfaceProxy,
117             write,
118             fileExtension,
119             (
120                 const fileName& name,
121                 const MeshedSurfaceProxy<Face>& surf
122             ),
123             (name, surf)
124         );
126         //- Write to file
127         static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
130     // Member Functions
132         // Access
134             //- Return const access to the points
135             inline const pointField& points() const
136             {
137                 return points_;
138             }
140             //- Return const access to the faces
141             inline const List<Face>& faces() const
142             {
143                 return faces_;
144             }
146             //- Const access to the surface zones.
147             //  If zones are defined, they must be contiguous and cover the
148             //  entire surface
149             inline const List<surfZone>& surfZones() const
150             {
151                 return zones_;
152             }
154             //- Const access to the faceMap, zero-sized when unused
155             inline const List<label>& faceMap() const
156             {
157                 return faceMap_;
158             }
160             //- Use faceMap?
161             inline bool useFaceMap() const
162             {
163                 return faceMap_.size() == faces_.size();
164             }
166         // Write
168             //- Generic write routine. Chooses writer based on extension.
169             virtual void write(const fileName& name) const
170             {
171                 write(name, *this);
172             }
174             //- Write to database
175             virtual void write(const Time&, const word& surfName = "") const;
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 } // End namespace Foam
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 #ifdef NoRepository
186 #   include "MeshedSurfaceProxy.C"
187 #endif
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 #endif
193 // ************************************************************************* //