FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::MeshedSurfaceProxy
00026 
00027 Description
00028     A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh
00029     to various file formats.
00030 
00031 SourceFiles
00032     MeshedSurfaceProxy.C
00033     MeshedSurfaceProxyCore.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef MeshedSurfaceProxy_H
00038 #define MeshedSurfaceProxy_H
00039 
00040 #include <OpenFOAM/pointField.H>
00041 #include <OpenFOAM/face.H>
00042 #include <OpenFOAM/triFace.H>
00043 
00044 #include <surfMesh/surfZoneList.H>
00045 #include <surfMesh/surfaceFormatsCore.H>
00046 #include <OpenFOAM/runTimeSelectionTables.H>
00047 #include <OpenFOAM/memberFunctionSelectionTables.H>
00048 #include <OpenFOAM/HashSet.H>
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 // Forward declaration of friend functions and operators
00056 
00057 template<class Face> class MeshedSurface;
00058 
00059 /*---------------------------------------------------------------------------*\
00060                      Class MeshedSurfaceProxy Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 template<class Face>
00064 class MeshedSurfaceProxy
00065 :
00066     public fileFormats::surfaceFormatsCore
00067 {
00068     //- Private data
00069 
00070         const pointField& points_;
00071 
00072         const List<Face>& faces_;
00073 
00074         const List<surfZone>& zones_;
00075 
00076         const List<label>& faceMap_;
00077 
00078 
00079 public:
00080 
00081     // Static
00082 
00083         //- Runtime type information
00084         ClassName("MeshedSurfaceProxy");
00085 
00086         //- The file format types that can be written via MeshedSurfaceProxy
00087         static wordHashSet writeTypes();
00088 
00089         //- Can this file format type be written via MeshedSurfaceProxy?
00090         static bool canWriteType(const word& ext, const bool verbose=false);
00091 
00092 
00093     // Constructors
00094 
00095         //- Construct from component references
00096         MeshedSurfaceProxy
00097         (
00098             const pointField&,
00099             const List<Face>&,
00100             const List<surfZone>& = List<surfZone>(),
00101             const List<label>& faceMap = List<label>()
00102         );
00103 
00104 
00105     // Destructor
00106 
00107         virtual ~MeshedSurfaceProxy();
00108 
00109 
00110     // Member Function Selectors
00111 
00112         declareMemberFunctionSelectionTable
00113         (
00114             void,
00115             MeshedSurfaceProxy,
00116             write,
00117             fileExtension,
00118             (
00119                 const fileName& name,
00120                 const MeshedSurfaceProxy<Face>& surf
00121             ),
00122             (name, surf)
00123         );
00124 
00125         //- Write to file
00126         static void write(const fileName&, const MeshedSurfaceProxy<Face>&);
00127 
00128 
00129     // Member Functions
00130 
00131         // Access
00132 
00133             //- Return const access to the points
00134             inline const pointField& points() const
00135             {
00136                 return points_;
00137             }
00138 
00139             //- Return const access to the faces
00140             inline const List<Face>& faces() const
00141             {
00142                 return faces_;
00143             }
00144 
00145             //- Const access to the surface zones.
00146             //  If zones are defined, they must be contiguous and cover the
00147             //  entire surface
00148             inline const List<surfZone>& surfZones() const
00149             {
00150                 return zones_;
00151             }
00152 
00153             //- Const access to the faceMap, zero-sized when unused
00154             inline const List<label>& faceMap() const
00155             {
00156                 return faceMap_;
00157             }
00158 
00159             //- Use faceMap?
00160             inline bool useFaceMap() const
00161             {
00162                 return faceMap_.size() == faces_.size();
00163             }
00164 
00165         // Write
00166 
00167             //- Generic write routine. Chooses writer based on extension.
00168             virtual void write(const fileName& name) const
00169             {
00170                 write(name, *this);
00171             }
00172 
00173             //- Write to database
00174             virtual void write(const Time&, const word& surfName = "") const;
00175 };
00176 
00177 
00178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00179 
00180 } // End namespace Foam
00181 
00182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00183 
00184 #ifdef NoRepository
00185 #   include "MeshedSurfaceProxy.C"
00186 #endif
00187 
00188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00189 
00190 #endif
00191 
00192 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines