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

polyMeshUpdate.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     Update the polyMesh corresponding to the given map.
00027 
00028 \*---------------------------------------------------------------------------*/
00029 
00030 #include "polyMesh.H"
00031 #include "mapPolyMesh.H"
00032 #include "Time.H"
00033 #include "globalMeshData.H"
00034 #include "pointMesh.H"
00035 
00036 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00037 
00038 void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm)
00039 {
00040     // Update boundaryMesh (note that patches themselves already ok)
00041     boundary_.updateMesh();
00042 
00043     // Update zones
00044     pointZones_.clearAddressing();
00045     faceZones_.clearAddressing();
00046     cellZones_.clearAddressing();
00047 
00048     // Update parallel data
00049     if (globalMeshDataPtr_)
00050     {
00051         globalMeshDataPtr_->updateMesh();
00052     }
00053 
00054     setInstance(time().timeName());
00055 
00056     // Map the old motion points if present
00057     if (oldPointsPtr_)
00058     {
00059         // Make a copy of the original points
00060         pointField oldMotionPoints = *oldPointsPtr_;
00061 
00062         pointField& newMotionPoints = *oldPointsPtr_;
00063 
00064         // Resize the list to new size
00065         newMotionPoints.setSize(points_.size());
00066 
00067         // Map the list
00068         newMotionPoints.map(oldMotionPoints, mpm.pointMap());
00069     }
00070 
00071     // Reset valid directions (could change by faces put into empty patches)
00072     geometricD_ = Vector<label>::zero;
00073     solutionD_ = Vector<label>::zero;
00074 
00075 
00076     // Hack until proper callbacks. Below are all the polyMesh-MeshObjects.
00077 
00078     // pointMesh
00079     if (thisDb().foundObject<pointMesh>(pointMesh::typeName))
00080     {
00081         const_cast<pointMesh&>
00082         (
00083             thisDb().lookupObject<pointMesh>
00084             (
00085                 pointMesh::typeName
00086             )
00087         ).updateMesh(mpm);
00088     }
00089 }
00090 
00091 
00092 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd