FreeFOAM The Cross-Platform CFD Toolkit
meshWriter.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 Namespace
25  Foam::meshWriters
26 
27 Description
28  A namespace for holding various types of mesh writers.
29 
30 
31 Class
32  Foam::meshWriter
33 
34 Description
35  write OpenFOAM meshes and/or results to another CFD format
36  - currently just STAR-CD
37 
38 @par Files
39 
40  "constant/boundaryRegion" is an IOMap<dictionary> that contains
41  the boundary type and names. eg,
42  @verbatim
43  (
44  0
45  {
46  BoundaryType wall;
47  Label Default_Boundary_Region;
48  }
49 
50  1
51  {
52  BoundaryType inlet;
53  Label inlet_1;
54  }
55 
56  ...
57 
58  4
59  {
60  BoundaryType pressure;
61  Label outlet;
62  }
63  )
64  @endverbatim
65 
66 
67 SourceFiles
68  meshWriterI.H
69  meshWriter.C
70  meshWriterIO.C
71 
72 \*---------------------------------------------------------------------------*/
73 
74 #ifndef meshWriter_H
75 #define meshWriter_H
76 
77 #include <OpenFOAM/polyMesh.H>
79 #include <conversion/cellTable.H>
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class meshWriter Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class meshWriter
91 {
92  // Private Member Functions
93 
94  //- Disallow default bitwise copy construct
95  meshWriter(const meshWriter&);
96 
97  //- Disallow default bitwise assignment
98  void operator=(const meshWriter&);
99 
100 
101 protected:
102 
103  // Protected data
104 
105  //- Mesh reference
106  const polyMesh& mesh_;
107 
108  //- Scaling factor for points (eg, [m] -> [mm])
109  scalar scaleFactor_;
110 
111  //- Write bnd file
112  bool writeBoundary_;
113 
114  //- boundaryRegion persistent data saved as a dictionary
116 
117  //- cellTable persistent data saved as a dictionary
119 
120  //- cellTable IDs for each cell
122 
123  //- Pointers to cell shape models
124  static const cellModel* unknownModel;
125  static const cellModel* tetModel;
126  static const cellModel* pyrModel;
127  static const cellModel* prismModel;
128  static const cellModel* hexModel;
129 
130 
131 public:
132 
133  // Static data members
135  static string defaultMeshName;
136  static string defaultSurfaceName;
137 
138 
139  // Constructors
140 
141  //- Ccreate a writer obejct
142  meshWriter
143  (
144  const polyMesh&,
145  const scalar scaleFactor = 1.0
146  );
147 
148 
149  //- Destructor
150  virtual ~meshWriter();
151 
152 
153  // Member Functions
154 
155  // Edit
156 
157  //- Set points scaling
158  void scaleFactor(const scalar scaling)
159  {
160  scaleFactor_ = scaling;
161  }
162 
163  //- Suppress writing bnd file
164  void noBoundary()
165  {
166  writeBoundary_ = false;
167  }
168 
169 
170  // Write
171 
172  //- Write volume mesh
173  // subclass must to supply this method
174  virtual bool write
175  (
177  ) const = 0;
178 
179  //- Write surface mesh with optional triangulation
180  // subclass could supply this information
181  virtual bool writeSurface
182  (
184  const bool& triangulate = false
185  ) const
186  {
187  return false;
188  }
189 };
190 
191 
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 
194 } // End namespace Foam
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 #endif
199 
200 // ************************ vim: set sw=4 sts=4 et: ************************ //