Forward compatibility: flex
[foam-extend-3.2.git] / src / conversion / meshWriter / meshWriter.H
blobed85e93b9f867908bf37b8fe8364a61088d01f53
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation, either version 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Namespace
25     Foam::meshWriters
27 Description
28     A namespace for holding various types of mesh writers.
31 Class
32     Foam::meshWriter
34 Description
35     write foam meshes and/or results to another CFD format
36     - currently just STAR-CD
38 @par Files
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             }
50             1
51             {
52                 BoundaryType    inlet;
53                 Label           inlet_1;
54             }
56             ...
58             4
59             {
60                 BoundaryType    pressure;
61                 Label           outlet;
62             }
63         )
64     @endverbatim
67 SourceFiles
68     meshWriterI.H
69     meshWriter.C
70     meshWriterIO.C
72 \*---------------------------------------------------------------------------*/
74 #ifndef meshWriter_H
75 #define meshWriter_H
77 #include "polyMesh.H"
78 #include "boundaryRegion.H"
79 #include "cellTable.H"
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
83 namespace Foam
86 /*---------------------------------------------------------------------------*\
87                         Class meshWriter Declaration
88 \*---------------------------------------------------------------------------*/
90 class meshWriter
92     // Private Member Functions
94         //- Disallow default bitwise copy construct
95         meshWriter(const meshWriter&);
97         //- Disallow default bitwise assignment
98         void operator=(const meshWriter&);
101 protected:
103     // Protected data
105         //- Mesh reference
106         const polyMesh& mesh_;
108         //- Scaling factor for points (eg, [m] -> [mm])
109         scalar scaleFactor_;
111         //- Write bnd file
112         bool writeBoundary_;
114         //- boundaryRegion persistent data saved as a dictionary
115         boundaryRegion boundaryRegion_;
117         //- cellTable persistent data saved as a dictionary
118         cellTable cellTable_;
120         //- cellTable IDs for each cell
121         labelList cellTableId_;
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;
131 public:
133     // Static data members
135         static string defaultMeshName;
136         static string defaultSurfaceName;
139     // Constructors
141         //- Ccreate a writer obejct
142         meshWriter
143         (
144             const polyMesh&,
145             const scalar scaleFactor = 1.0
146         );
149     //- Destructor
150     virtual ~meshWriter();
153     // Member Functions
155         // Edit
157             //- Set points scaling
158             void scaleFactor(const scalar scaling)
159             {
160                 scaleFactor_ = scaling;
161             }
163             //- Suppress writing bnd file
164             void noBoundary()
165             {
166                 writeBoundary_ = false;
167             }
170         // Write
172             //- Write volume mesh
173             //  subclass must to supply this method
174             virtual bool write
175             (
176                 const fileName& timeName = fileName::null
177             ) const = 0;
179             //- Write surface mesh with optional triangulation
180             //  subclass could supply this information
181             virtual bool writeSurface
182             (
183                 const fileName& timeName = fileName::null,
184                 const bool& triangulate = false
185             ) const
186             {
187                 return false;
188             }
192 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 } // End namespace Foam
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 #endif
200 // ************************************************************************* //