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 SAMM files
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "sammMesh.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  polyMesh pShapeMesh
43  (
44  IOobject
45  (
47  runTime_.constant(),
48  runTime_
49  ),
50  clone(points_), // we could probably re-use the data
51  cellShapes_,
52  boundary_,
53  patchNames_,
54  patchTypes_,
55  defaultFacesName_,
56  defaultFacesType_,
57  patchPhysicalTypes_
58  );
59 
61 
62  Info<< "Writing polyMesh" << endl;
63  pShapeMesh.write();
64  }
65  else
66  {
67  // This is a polyMesh.
68 
69  createPolyMeshData();
70 
71  Info<< "This is a polyMesh" << endl;
72 
73  polyMesh pMesh
74  (
75  IOobject
76  (
78  runTime_.constant(),
79  runTime_
80  ),
81  move(points_), // we could probably re-use the data
82  move(meshFaces_),
83  move(cellPolys_)
84  );
85 
86  pMesh.addPatches(polyBoundaryPatches(pMesh));
87 
89 
90  Info<< "Writing polyMesh" << endl;
91  pMesh.write();
92  }
93 }
94 
95 
96 // ************************************************************************* //
virtual Ostream & write(const char)=0
Write character.
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:325
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
const word & constant() const
Return constant name.
Definition: TimePaths.H:123
messageStream Info
void writeMesh()
Write mesh.