writeMesh.C
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) 2011-2015 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 Description
25  Create intermediate mesh files from PROSTAR files
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "starMesh.H"
30 #include "Time.H"
31 #include "polyMesh.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
36 {
37  if (isShapeMesh_)
38  {
39  Info<< "This is a shapeMesh." << endl;
40 
41  Info<< "Default patch type set to empty" << endl;
42 
43  clearExtraStorage();
44 
45  polyMesh pShapeMesh
46  (
47  IOobject
48  (
50  runTime_.constant(),
51  runTime_
52  ),
53  xferCopy(points_), // we could probably re-use the data
54  cellShapes_,
55  boundary_,
56  patchNames_,
57  patchTypes_,
58  defaultFacesName_,
59  defaultFacesType_,
60  patchPhysicalTypes_
61  );
62 
63  Info<< "Writing polyMesh" << endl;
64  pShapeMesh.write();
65  }
66  else
67  {
68  // This is a polyMesh.
69 
70  createPolyMeshData();
71 
72  Info<< "This is a polyMesh" << endl;
73 
74  clearExtraStorage();
75 
76  polyMesh pMesh
77  (
78  IOobject
79  (
81  runTime_.constant(),
82  runTime_
83  ),
84  xferCopy(points_), // we could probably re-use the data
85  xferCopy(meshFaces_),
86  xferCopy(cellPolys_)
87  );
88 
89  // adding patches also checks the mesh
90  pMesh.addPatches(polyBoundaryPatches(pMesh));
91 
92  Info<< "Writing polyMesh" << endl;
93  pMesh.write();
94  }
95 }
96 
97 
98 // ************************************************************************* //
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:306
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Xfer< T > xferCopy(const T &)
Construct by copying the contents of the arg.
void writeMesh()
Write mesh.
polyMesh pShapeMesh(IOobject(polyMesh::defaultRegion, runTime.constant(), runTime), xferMove(points), cellShapes, boundary, patchNames, patchDicts, defaultFacesName, defaultFacesType)
const word & constant() const
Return constant name.
Definition: TimePaths.H:124
messageStream Info
virtual Ostream & write(const token &)=0
Write next token to stream.