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  (
47  runTime_
48  ),
49  xferCopy(points_), // we could probably re-use the data
51  boundary_,
57  );
58 
59  Info<< "Writing polyMesh" << endl;
60  pShapeMesh.write();
61  }
62  else
63  {
64  // This is a polyMesh.
65 
67 
68  Info<< "This is a polyMesh" << endl;
69 
70  polyMesh pMesh
71  (
72  IOobject
73  (
76  runTime_
77  ),
78  xferCopy(points_), // we could probably re-use the data
81  );
82 
83  pMesh.addPatches(polyBoundaryPatches(pMesh));
84 
85  Info<< "Writing polyMesh" << endl;
86  pMesh.write();
87  }
88 }
89 
90 
91 // ************************************************************************* //
Foam::sammMesh::polyBoundaryPatches
List< polyPatch * > polyBoundaryPatches(const polyMesh &)
Add polyhedral boundary.
Foam::sammMesh::createPolyMeshData
void createPolyMeshData()
Make polyhedral mesh data (packing)
Foam::sammMesh::cellPolys_
cellList cellPolys_
Cells as polyhedra for polyMesh.
Definition: sammMesh.H:100
Foam::polyMesh::defaultRegion
static word defaultRegion
Return the default region name.
Definition: polyMesh.H:306
Foam::sammMesh::cellShapes_
cellShapeList cellShapes_
Cell shapes.
Definition: sammMesh.H:67
Foam::sammMesh::boundary_
faceListList boundary_
Boundary faces.
Definition: sammMesh.H:70
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::sammMesh::patchNames_
wordList patchNames_
Boundary patch names.
Definition: sammMesh.H:82
Foam::sammMesh::isShapeMesh_
bool isShapeMesh_
Can the mesh be treated as a shapeMesh?
Definition: sammMesh.H:114
polyMesh.H
Foam::sammMesh::defaultFacesName_
word defaultFacesName_
Default boundary patch name.
Definition: sammMesh.H:76
Foam::sammMesh::runTime_
const Time & runTime_
Database.
Definition: sammMesh.H:61
Foam::Ostream::write
virtual Ostream & write(const token &)=0
Write next token to stream.
Foam::Info
messageStream Info
Foam::sammMesh::patchPhysicalTypes_
wordList patchPhysicalTypes_
Boundary patch physical types.
Definition: sammMesh.H:85
Foam::sammMesh::points_
pointField points_
Points supporting the mesh.
Definition: sammMesh.H:64
pShapeMesh
polyMesh pShapeMesh(IOobject(polyMesh::defaultRegion, runTime.constant(), runTime), xferMove(points), cellShapes, boundary, patchNames, patchDicts, defaultFacesName, defaultFacesType)
Foam::sammMesh::defaultFacesType_
word defaultFacesType_
Default boundary patch types.
Definition: sammMesh.H:79
Foam::xferCopy
Xfer< T > xferCopy(const T &)
Construct by copying the contents of the arg.
Foam::sammMesh::meshFaces_
faceList meshFaces_
Global face list for polyMesh.
Definition: sammMesh.H:97
sammMesh.H
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePaths.H:130
Foam::sammMesh::writeMesh
void writeMesh()
Write mesh.
Foam::sammMesh::patchTypes_
wordList patchTypes_
Boundary patch types.
Definition: sammMesh.H:73