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 PROSTAR files
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 #include "starMesh.H"
00031 #include "Time.H"
00032 #include "polyMesh.H"
00033 
00034 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00035 
00036 void starMesh::writeMesh()
00037 {
00038     if (isShapeMesh_)
00039     {
00040         Info << "This is a shapeMesh." << endl;
00041 
00042         Info << "Default patch type set to empty" << endl;
00043 
00044         clearExtraStorage();
00045 
00046         polyMesh pShapeMesh
00047         (
00048             IOobject
00049             (
00050                 polyMesh::defaultRegion,
00051                 runTime_.constant(),
00052                 runTime_
00053             ),
00054             xferCopy(points_),           // we could probably re-use the data
00055             cellShapes_,
00056             boundary_,
00057             patchNames_,
00058             patchTypes_,
00059             defaultFacesName_,
00060             defaultFacesType_,
00061             patchPhysicalTypes_
00062         );
00063 
00064         Info << "Writing polyMesh" << endl;
00065         pShapeMesh.write();
00066     }
00067     else
00068     {
00069         // This is a polyMesh.
00070 
00071         createPolyMeshData();
00072 
00073         Info << "This is a polyMesh" << endl;
00074 
00075         clearExtraStorage();
00076 
00077         polyMesh pMesh
00078         (
00079             IOobject
00080             (
00081                 polyMesh::defaultRegion,
00082                 runTime_.constant(),
00083                 runTime_
00084             ),
00085             xferCopy(points_),           // we could probably re-use the data
00086             xferCopy(meshFaces_),
00087             xferCopy(cellPolys_)
00088         );
00089 
00090         // adding patches also checks the mesh
00091         pMesh.addPatches(polyBoundaryPatches(pMesh));
00092 
00093         Info << "Writing polyMesh" << endl;
00094         pMesh.write();
00095     }
00096 }
00097 
00098 
00099 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd