OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

MeshedSurfaceProxy.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::MeshedSurfaceProxy
00027 
00028 Description
00029     A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh
00030     to various file formats.
00031 
00032 SourceFiles
00033     MeshedSurfaceProxy.C
00034     MeshedSurfaceProxyCore.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef MeshedSurfaceProxy_H
00039 #define MeshedSurfaceProxy_H
00040 
00041 #include "pointField.H"
00042 #include "face.H"
00043 #include "triFace.H"
00044 
00045 #include "surfZoneList.H"
00046 #include "surfaceFormatsCore.H"
00047 #include "runTimeSelectionTables.H"
00048 #include "memberFunctionSelectionTables.H"
00049 #include "HashSet.H"
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 // Forward declaration of friend functions and operators
00057 
00058 template<class Face> class MeshedSurface;
00059 
00060 /*---------------------------------------------------------------------------*\
00061                      Class MeshedSurfaceProxy Declaration
00062 \*---------------------------------------------------------------------------*/
00063 
00064 template<class Face>
00065 class MeshedSurfaceProxy
00066 :
00067     public fileFormats::surfaceFormatsCore
00068 {
00069     //- Private data
00070 
00071         const pointField& points_;
00072 
00073         const List<Face>& faces_;
00074 
00075         const List<surfZone>& zones_;
00076 
00077         const List<label>& faceMap_;
00078 
00079 
00080 public:
00081 
00082     // Static
00083 
00084         //- Runtime type information
00085         ClassName("MeshedSurfaceProxy");
00086 
00087         //- The file format types that can be written via MeshedSurfaceProxy
00088         static wordHashSet writeTypes();
00089 
00090         //- Can this file format type be written via MeshedSurfaceProxy?
00091         static bool canWriteType(const word& ext, const bool verbose=false);
00092 
00093 
00094     // Constructors
00095 
00096         //- Construct from component references
00097         MeshedSurfaceProxy
00098         (
00099             const pointField&,
00100             const List<Face>&,
00101             const List<surfZone>& = List<surfZone>(),
00102             const List<label>& faceMap = List<label>()
00103         );
00104 
00105 
00106     // Destructor
00107 
00108         virtual ~MeshedSurfaceProxy();
00109 
00110 
00111     // Member Function Selectors
00112 
00113         declareMemberFunctionSelectionTable
00114         (
00115             void,
00116             MeshedSurfaceProxy,
00117             write,
00118             fileExtension,
00119             (
00120                 const fileName& name,
00121                 const MeshedSurfaceProxy<Face>& surf
00122             ),
00123             (name, surf)
00124         );
00125 
00126         //- Write to file
00127         static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
00128 
00129 
00130     // Member Functions
00131 
00132         // Access
00133 
00134             //- Return const access to the points
00135             inline const pointField& points() const
00136             {
00137                 return points_;
00138             }
00139 
00140             //- Return const access to the faces
00141             inline const List<Face>& faces() const
00142             {
00143                 return faces_;
00144             }
00145 
00146             //- Const access to the surface zones.
00147             //  If zones are defined, they must be contiguous and cover the
00148             //  entire surface
00149             inline const List<surfZone>& surfZones() const
00150             {
00151                 return zones_;
00152             }
00153 
00154             //- Const access to the faceMap, zero-sized when unused
00155             inline const List<label>& faceMap() const
00156             {
00157                 return faceMap_;
00158             }
00159 
00160             //- Use faceMap?
00161             inline bool useFaceMap() const
00162             {
00163                 return faceMap_.size() == faces_.size();
00164             }
00165 
00166         // Write
00167 
00168             //- Generic write routine. Chooses writer based on extension.
00169             virtual void write(const fileName& name) const
00170             {
00171                 write(name, *this);
00172             }
00173 
00174             //- Write to database
00175             virtual void write(const Time&, const word& surfName = "") const;
00176 };
00177 
00178 
00179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00180 
00181 } // End namespace Foam
00182 
00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00184 
00185 #ifdef NoRepository
00186 #   include "MeshedSurfaceProxy.C"
00187 #endif
00188 
00189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00190 
00191 #endif
00192 
00193 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd