FreeFOAM The Cross-Platform CFD Toolkit
STARCDMeshWriter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::meshWriters::STARCD
26 
27 Description
28  Writes polyMesh in pro-STAR (v4) bnd/cel/vrt format
29 
30  Alternatively, extracts the surface of the FOAM mesh into
31  pro-STAR (v4) .cel/.vrt/ format.
32  This can be useful, for example, for surface morphing in an external
33  package.
34 
35  The cellTableId and cellTable information are used (if available).
36  Otherwise the cellZones are used (if available).
37 
38 SourceFiles
39  STARCDMeshWriter.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef STARCDMeshWriter_H
44 #define STARCDMeshWriter_H
45 
46 #include <conversion/meshWriter.H>
47 #include <OpenFOAM/IOstream.H>
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 namespace meshWriters
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class meshWriters::STARCD Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class STARCD
62 :
63  public meshWriter
64 {
65  // Private Data
66 
67  static const char* defaultBoundaryName;
68 
69 
70  // Private Member Functions
71 
72  //- Disallow default bitwise copy construct
73  STARCD(const STARCD&);
74 
75  //- Disallow default bitwise assignment
76  void operator=(const STARCD&);
77 
78  //- Pro-STAR 4+ header format
79  static void writeHeader(Ostream&, const char* filetype);
80 
81  //- Write points
82  void writePoints(const fileName& baseName) const;
83 
84  //- Write cells
85  void writeCells(const fileName& baseName) const;
86 
87  //- Write boundary
88  void writeBoundary(const fileName& baseName) const;
89 
90  void getCellTable();
91 
92  label findDefaultBoundary() const;
93 
94 
95 public:
96 
97  // Static data members
98 
99  //- Face addressing from OpenFOAM faces -> pro-STAR faces
100  static const label foamToStarFaceAddr[4][6];
101 
102 
103  // Constructors
104 
105  //- Open a file for writing
106  STARCD
107  (
108  const polyMesh&,
109  const scalar scaleFactor = 1.0
110  );
111 
112 
113  //- Destructor
114  virtual ~STARCD();
115 
116 
117  // Member Functions
118 
119  // Edit
120 
121  //- Remove STAR-CD files for the baseName
122  void rmFiles(const fileName& baseName) const;
123 
124 
125  // Write
126 
127  //- Write volume mesh
128  virtual bool write
129  (
131  ) const;
132 
133  //- Write surface mesh with optional triangulation
134  virtual bool writeSurface
135  (
137  const bool& triangulate = false
138  ) const;
139 };
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace meshWriters
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #endif
150 
151 // ************************ vim: set sw=4 sts=4 et: ************************ //