From 5dce1d372fdbe40fe974b1563acfdf218be7b52b Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 10 Apr 2012 12:31:26 +0100 Subject: [PATCH] ENH: polyMeshIO: clear storage before reading points; added check on sizes --- src/OpenFOAM/meshes/polyMesh/polyMeshIO.C | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C index ea3b05f0ca..a296fd336a 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -407,9 +407,12 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate() clearGeom(); - points_.instance() = pointsInst; - points_ = pointIOField + label nOldPoints = points_.size(); + + points_.clear(); + + pointIOField newPoints ( IOobject ( @@ -423,6 +426,19 @@ Foam::polyMesh::readUpdateState Foam::polyMesh::readUpdate() ) ); + if (nOldPoints != 0 && nOldPoints != newPoints.size()) + { + FatalErrorIn("polyMesh::readUpdate()") + << "Point motion detected but number of points " + << newPoints.size() << " in " + << newPoints.objectPath() << " does not correspond to " + << " current " << nOldPoints + << exit(FatalError); + } + + points_.transfer(newPoints); + points_.instance() = pointsInst; + // Derived info bounds_ = boundBox(points_);