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 SAMM files
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "sammMesh.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  polyMesh pShapeMesh
42  (
43  IOobject
44  (
46  runTime_.constant(),
47  runTime_
48  ),
49  xferCopy(points_), // we could probably re-use the data
50  cellShapes_,
51  boundary_,
52  patchNames_,
53  patchTypes_,
54  defaultFacesName_,
55  defaultFacesType_,
56  patchPhysicalTypes_
57  );
58 
59  Info<< "Writing polyMesh" << endl;
60  pShapeMesh.write();
61  }
62  else
63  {
64  // This is a polyMesh.
65 
66  createPolyMeshData();
67 
68  Info<< "This is a polyMesh" << endl;
69 
70  polyMesh pMesh
71  (
72  IOobject
73  (
75  runTime_.constant(),
76  runTime_
77  ),
78  xferCopy(points_), // we could probably re-use the data
79  xferCopy(meshFaces_),
80  xferCopy(cellPolys_)
81  );
82 
83  pMesh.addPatches(polyBoundaryPatches(pMesh));
84 
85  Info<< "Writing polyMesh" << endl;
86  pMesh.write();
87  }
88 }
89 
90 
91 // ************************************************************************* //
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.
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.
void writeMesh()
Write mesh.