00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 Description 00025 Update the polyMesh corresponding to the given map. 00026 00027 \*---------------------------------------------------------------------------*/ 00028 00029 #include "polyMesh.H" 00030 #include <OpenFOAM/mapPolyMesh.H> 00031 #include <OpenFOAM/Time.H> 00032 #include <OpenFOAM/globalMeshData.H> 00033 #include <OpenFOAM/pointMesh.H> 00034 00035 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00036 00037 void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm) 00038 { 00039 // Update boundaryMesh (note that patches themselves already ok) 00040 boundary_.updateMesh(); 00041 00042 // Update zones 00043 pointZones_.clearAddressing(); 00044 faceZones_.clearAddressing(); 00045 cellZones_.clearAddressing(); 00046 00047 // Update parallel data 00048 if (globalMeshDataPtr_) 00049 { 00050 globalMeshDataPtr_->updateMesh(); 00051 } 00052 00053 setInstance(time().timeName()); 00054 00055 // Map the old motion points if present 00056 if (oldPointsPtr_) 00057 { 00058 // Make a copy of the original points 00059 pointField oldMotionPoints = *oldPointsPtr_; 00060 00061 pointField& newMotionPoints = *oldPointsPtr_; 00062 00063 // Resize the list to new size 00064 newMotionPoints.setSize(points_.size()); 00065 00066 // Map the list 00067 newMotionPoints.map(oldMotionPoints, mpm.pointMap()); 00068 00069 // Any points created out-of-nothing get set to the current coordinate 00070 // for lack of anything better. 00071 forAll(mpm.pointMap(), newPointI) 00072 { 00073 if (mpm.pointMap()[newPointI] == -1) 00074 { 00075 newMotionPoints[newPointI] = points_[newPointI]; 00076 } 00077 } 00078 } 00079 00080 // Reset valid directions (could change by faces put into empty patches) 00081 geometricD_ = Vector<label>::zero; 00082 solutionD_ = Vector<label>::zero; 00083 00084 00085 // Hack until proper callbacks. Below are all the polyMesh-MeshObjects. 00086 00087 // pointMesh 00088 if (thisDb().foundObject<pointMesh>(pointMesh::typeName)) 00089 { 00090 const_cast<pointMesh&> 00091 ( 00092 thisDb().lookupObject<pointMesh> 00093 ( 00094 pointMesh::typeName 00095 ) 00096 ).updateMesh(mpm); 00097 } 00098 } 00099 00100 00101 // ************************ vim: set sw=4 sts=4 et: ************************ //