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

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