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

meshWriter.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 Namespace
00025     Foam::meshWriters
00026 
00027 Description
00028     A namespace for holding various types of mesh writers.
00029 
00030 
00031 Class
00032     Foam::meshWriter
00033 
00034 Description
00035     write OpenFOAM meshes and/or results to another CFD format
00036     - currently just STAR-CD
00037 
00038 @par Files
00039 
00040     "constant/boundaryRegion" is an IOMap<dictionary> that contains
00041     the boundary type and names. eg,
00042     @verbatim
00043         (
00044             0
00045             {
00046                 BoundaryType    wall;
00047                 Label           Default_Boundary_Region;
00048             }
00049 
00050             1
00051             {
00052                 BoundaryType    inlet;
00053                 Label           inlet_1;
00054             }
00055 
00056             ...
00057 
00058             4
00059             {
00060                 BoundaryType    pressure;
00061                 Label           outlet;
00062             }
00063         )
00064     @endverbatim
00065 
00066 
00067 SourceFiles
00068     meshWriterI.H
00069     meshWriter.C
00070     meshWriterIO.C
00071 
00072 \*---------------------------------------------------------------------------*/
00073 
00074 #ifndef meshWriter_H
00075 #define meshWriter_H
00076 
00077 #include <OpenFOAM/polyMesh.H>
00078 #include <conversion/boundaryRegion.H>
00079 #include <conversion/cellTable.H>
00080 
00081 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00082 
00083 namespace Foam
00084 {
00085 
00086 /*---------------------------------------------------------------------------*\
00087                         Class meshWriter Declaration
00088 \*---------------------------------------------------------------------------*/
00089 
00090 class meshWriter
00091 {
00092     // Private Member Functions
00093 
00094         //- Disallow default bitwise copy construct
00095         meshWriter(const meshWriter&);
00096 
00097         //- Disallow default bitwise assignment
00098         void operator=(const meshWriter&);
00099 
00100 
00101 protected:
00102 
00103     // Protected data
00104 
00105         //- Mesh reference
00106         const polyMesh& mesh_;
00107 
00108         //- Scaling factor for points (eg, [m] -> [mm])
00109         scalar scaleFactor_;
00110 
00111         //- Write bnd file
00112         bool writeBoundary_;
00113 
00114         //- boundaryRegion persistent data saved as a dictionary
00115         boundaryRegion boundaryRegion_;
00116 
00117         //- cellTable persistent data saved as a dictionary
00118         cellTable cellTable_;
00119 
00120         //- cellTable IDs for each cell
00121         labelList cellTableId_;
00122 
00123         //- Pointers to cell shape models
00124         static const cellModel* unknownModel;
00125         static const cellModel* tetModel;
00126         static const cellModel* pyrModel;
00127         static const cellModel* prismModel;
00128         static const cellModel* hexModel;
00129 
00130 
00131 public:
00132 
00133     // Static data members
00134 
00135         static string defaultMeshName;
00136         static string defaultSurfaceName;
00137 
00138 
00139     // Constructors
00140 
00141         //- Ccreate a writer obejct
00142         meshWriter
00143         (
00144             const polyMesh&,
00145             const scalar scaleFactor = 1.0
00146         );
00147 
00148 
00149     //- Destructor
00150     virtual ~meshWriter();
00151 
00152 
00153     // Member Functions
00154 
00155         // Edit
00156 
00157             //- Set points scaling
00158             void scaleFactor(const scalar scaling)
00159             {
00160                 scaleFactor_ = scaling;
00161             }
00162 
00163             //- Suppress writing bnd file
00164             void noBoundary()
00165             {
00166                 writeBoundary_ = false;
00167             }
00168 
00169 
00170         // Write
00171 
00172             //- Write volume mesh
00173             //  subclass must to supply this method
00174             virtual bool write
00175             (
00176                 const fileName& timeName = fileName::null
00177             ) const = 0;
00178 
00179             //- Write surface mesh with optional triangulation
00180             //  subclass could supply this information
00181             virtual bool writeSurface
00182             (
00183                 const fileName& timeName = fileName::null,
00184                 const bool& triangulate = false
00185             ) const
00186             {
00187                 return false;
00188             }
00189 };
00190 
00191 
00192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00193 
00194 } // End namespace Foam
00195 
00196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00197 
00198 #endif
00199 
00200 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines