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

STARCDMeshWriter.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::meshWriters::STARCD
00026 
00027 Description
00028     Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format
00029 
00030     Alternatively, extracts the surface of the FOAM mesh into
00031     pro-STAR (v4) .cel/.vrt/ format.
00032     This can be useful, for example, for surface morphing in an external
00033     package.
00034 
00035     The cellTableId and cellTable information are used (if available).
00036     Otherwise the cellZones are used (if available).
00037 
00038 SourceFiles
00039     STARCDMeshWriter.C
00040 
00041 \*---------------------------------------------------------------------------*/
00042 
00043 #ifndef STARCDMeshWriter_H
00044 #define STARCDMeshWriter_H
00045 
00046 #include <conversion/meshWriter.H>
00047 #include <OpenFOAM/IOstream.H>
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 namespace meshWriters
00055 {
00056 
00057 /*---------------------------------------------------------------------------*\
00058                     Class meshWriters::STARCD Declaration
00059 \*---------------------------------------------------------------------------*/
00060 
00061 class STARCD
00062 :
00063     public meshWriter
00064 {
00065     // Private Data
00066 
00067         static const char* defaultBoundaryName;
00068 
00069 
00070     // Private Member Functions
00071 
00072         //- Disallow default bitwise copy construct
00073         STARCD(const STARCD&);
00074 
00075         //- Disallow default bitwise assignment
00076         void operator=(const STARCD&);
00077 
00078         //- Pro-STAR 4+ header format
00079         static void writeHeader(Ostream&, const char* filetype);
00080 
00081         //- Write points
00082         void writePoints(const fileName& baseName) const;
00083 
00084         //- Write cells
00085         void writeCells(const fileName& baseName) const;
00086 
00087         //- Write boundary
00088         void writeBoundary(const fileName& baseName) const;
00089 
00090         void getCellTable();
00091 
00092         label findDefaultBoundary() const;
00093 
00094 
00095 public:
00096 
00097     // Static data members
00098 
00099         //- Face addressing from OpenFOAM faces -> pro-STAR faces
00100         static const label foamToStarFaceAddr[4][6];
00101 
00102 
00103     // Constructors
00104 
00105         //- Open a file for writing
00106         STARCD
00107         (
00108             const polyMesh&,
00109             const scalar scaleFactor = 1.0
00110         );
00111 
00112 
00113     //- Destructor
00114     virtual ~STARCD();
00115 
00116 
00117     // Member Functions
00118 
00119         // Edit
00120 
00121             //- Remove STAR-CD files for the baseName
00122             void rmFiles(const fileName& baseName) const;
00123 
00124 
00125         // Write
00126 
00127             //- Write volume mesh
00128             virtual bool write
00129             (
00130                 const fileName& meshName = fileName::null
00131             ) const;
00132 
00133             //- Write surface mesh with optional triangulation
00134             virtual bool writeSurface
00135             (
00136                 const fileName& meshName = fileName::null,
00137                 const bool& triangulate = false
00138             ) const;
00139 };
00140 
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 } // End namespace meshWriters
00145 } // End namespace Foam
00146 
00147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00148 
00149 #endif
00150 
00151 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines