writeMesh.C
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-2020 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 #include "polyMeshUnMergeCyclics.H"
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
37 {
38  if (isShapeMesh_)
39  {
40  Info<< "This is a shapeMesh." << endl;
41 
42  Info<< "Default patch type set to empty" << endl;
43 
44  clearExtraStorage();
45 
46  polyMesh pShapeMesh
47  (
48  IOobject
49  (
51  runTime_.constant(),
52  runTime_
53  ),
54  clone(points_), // we could probably re-use the data
55  cellShapes_,
56  boundary_,
57  patchNames_,
58  patchTypes_,
59  defaultFacesName_,
60  defaultFacesType_,
61  patchPhysicalTypes_
62  );
63 
65 
66  Info<< "Writing polyMesh" << endl;
67  pShapeMesh.write();
68  }
69  else
70  {
71  // This is a polyMesh.
72 
73  createPolyMeshData();
74 
75  Info<< "This is a polyMesh" << endl;
76 
77  clearExtraStorage();
78 
79  polyMesh pMesh
80  (
81  IOobject
82  (
84  runTime_.constant(),
85  runTime_
86  ),
87  clone(points_), // we could probably re-use the data
88  clone(meshFaces_),
89  clone(cellPolys_)
90  );
91 
92  // adding patches also checks the mesh
93  pMesh.addPatches(polyBoundaryPatches(pMesh));
94 
96 
97  Info<< "Writing polyMesh" << endl;
98  pMesh.write();
99  }
100 }
101 
102 
103 // ************************************************************************* //
virtual Ostream & write(const char)=0
Write character.
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:309
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
polyMesh pShapeMesh(IOobject(polyMesh::defaultRegion, runTime.constant(), runTime), move(points), cellShapes, boundary, patchNames, patchDicts, defaultFacesName, defaultFacesType)
void polyMeshUnMergeCyclics(polyMesh &mesh, const scalar includedAngle=165)
Find all patches of type "mergedCyclic" in the given mesh and split them.
T clone(const T &t)
Definition: List.H:54
void writeMesh()
Write mesh.
const word & constant() const
Return constant name.
Definition: TimePaths.H:124
messageStream Info