OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

writeMesh.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Description
00026     Create intermediate mesh files from SAMM files
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 #include "sammMesh.H"
00031 #include "Time.H"
00032 #include "polyMesh.H"
00033 
00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00035 
00036 void sammMesh::writeMesh()
00037 {
00038     if (isShapeMesh_)
00039     {
00040         Info << "This is a shapeMesh." << endl;
00041 
00042         polyMesh pShapeMesh
00043         (
00044             IOobject
00045             (
00046                 polyMesh::defaultRegion,
00047                 runTime_.constant(),
00048                 runTime_
00049             ),
00050             xferCopy(points_),           // we could probably re-use the data
00051             cellShapes_,
00052             boundary_,
00053             patchNames_,
00054             patchTypes_,
00055             defaultFacesName_,
00056             defaultFacesType_,
00057             patchPhysicalTypes_
00058         );
00059 
00060         Info << "Writing polyMesh" << endl;
00061         pShapeMesh.write();
00062     }
00063     else
00064     {
00065         // This is a polyMesh.
00066 
00067         createPolyMeshData();
00068 
00069         Info << "This is a polyMesh" << endl;
00070 
00071         polyMesh pMesh
00072         (
00073             IOobject
00074             (
00075                 polyMesh::defaultRegion,
00076                 runTime_.constant(),
00077                 runTime_
00078             ),
00079             xferCopy(points_),           // we could probably re-use the data
00080             xferCopy(meshFaces_),
00081             xferCopy(cellPolys_)
00082         );
00083 
00084         pMesh.addPatches(polyBoundaryPatches(pMesh));
00085 
00086         Info << "Writing polyMesh" << endl;
00087         pMesh.write();
00088     }
00089 }
00090 
00091 
00092 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd