meshWriter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
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 "polyMesh.H"
78 #include "boundaryRegion.H"
79 #include "cellTable.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 /*---------------------------------------------------------------------------*\
87  Class meshWriter Declaration
88 \*---------------------------------------------------------------------------*/
89 
90 class meshWriter
91 {
92 protected:
93 
94  // Protected data
95 
96  //- Mesh reference
97  const polyMesh& mesh_;
98 
99  //- Scaling factor for points (eg, [m] -> [mm])
100  scalar scaleFactor_;
101 
102  //- Write bnd file
103  bool writeBoundary_;
104 
105  //- boundaryRegion persistent data saved as a dictionary
107 
108  //- cellTable persistent data saved as a dictionary
110 
111  //- cellTable IDs for each cell
113 
114  //- Pointers to cell shape models
115  static const cellModel* unknownModel;
116  static const cellModel* tetModel;
117  static const cellModel* pyrModel;
118  static const cellModel* prismModel;
119  static const cellModel* hexModel;
120 
121 
122 public:
123 
124  // Static Data Members
125 
126  //- Specify a default mesh name
127  static string defaultMeshName;
128 
129  // Constructors
130 
131  //- Create a writer object
132  meshWriter
133  (
134  const polyMesh&,
135  const scalar scaleFactor = 1.0
136  );
137 
138  //- Disallow default bitwise copy construction
139  meshWriter(const meshWriter&) = delete;
140 
141 
142  //- Destructor
143  virtual ~meshWriter();
144 
145 
146  // Member Functions
147 
148  // Edit
149 
150  //- Set points scaling
151  void scaleFactor(const scalar scaling)
152  {
153  scaleFactor_ = scaling;
154  }
155 
156  //- Suppress writing bnd file
157  void noBoundary()
158  {
159  writeBoundary_ = false;
160  }
161 
162  // Write
163 
164  //- Write volume mesh. Subclass must supply this method
165  virtual bool write
166  (
168  ) const = 0;
169 
170 
171  // Member Operators
172 
173  //- Disallow default bitwise assignment
174  void operator=(const meshWriter&) = delete;
175 };
176 
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 } // End namespace Foam
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************************************************************* //
The boundaryRegion persistent data saved as a Map<dictionary>.
Maps a geometry to a set of cell primitives, which enables geometric cell data to be calculated witho...
Definition: cellModel.H:65
The cellTable persistent data saved as a Map<dictionary>.
Definition: cellTable.H:80
A class for handling file names.
Definition: fileName.H:82
static const fileName null
An empty fileName.
Definition: fileName.H:97
write OpenFOAM meshes and/or results to another CFD format
Definition: meshWriter.H:90
scalar scaleFactor_
Scaling factor for points (eg, [m] -> [mm])
Definition: meshWriter.H:99
void scaleFactor(const scalar scaling)
Set points scaling.
Definition: meshWriter.H:150
static const cellModel * prismModel
Definition: meshWriter.H:117
static const cellModel * unknownModel
Pointers to cell shape models.
Definition: meshWriter.H:114
boundaryRegion boundaryRegion_
boundaryRegion persistent data saved as a dictionary
Definition: meshWriter.H:105
cellTable cellTable_
cellTable persistent data saved as a dictionary
Definition: meshWriter.H:108
labelList cellTableId_
cellTable IDs for each cell
Definition: meshWriter.H:111
static string defaultMeshName
Specify a default mesh name.
Definition: meshWriter.H:126
static const cellModel * hexModel
Definition: meshWriter.H:118
virtual bool write(const fileName &timeName=fileName::null) const =0
Write volume mesh. Subclass must supply this method.
void noBoundary()
Suppress writing bnd file.
Definition: meshWriter.H:156
static const cellModel * tetModel
Definition: meshWriter.H:115
void operator=(const meshWriter &)=delete
Disallow default bitwise assignment.
virtual ~meshWriter()
Destructor.
Definition: meshWriter.C:84
static const cellModel * pyrModel
Definition: meshWriter.H:116
const polyMesh & mesh_
Mesh reference.
Definition: meshWriter.H:96
meshWriter(const polyMesh &, const scalar scaleFactor=1.0)
Create a writer object.
Definition: meshWriter.C:71
bool writeBoundary_
Write bnd file.
Definition: meshWriter.H:102
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
word timeName
Definition: getTimeIndex.H:3
Namespace for OpenFOAM.