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

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