diff --git a/src/meshTools/octree/octree.C b/src/meshTools/octree/octree.C index 86c2ffc62a1f3faadfbaa2af2e03c3ddea948093..8731f0ef1ffa6eaec3b967d59c6e9932ea40871b 100644 --- a/src/meshTools/octree/octree.C +++ b/src/meshTools/octree/octree.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -149,6 +149,7 @@ Foam::octree<Type>::octree // - has some guaranteed maximum size (maxShapeRatio) label oldNLeaves = -1; // make test below pass first time. + label oldNNodes = -1; deepestLevel_ = 1; while ( @@ -169,11 +170,11 @@ Foam::octree<Type>::octree break; } - if (oldNLeaves == nLeaves()) + if ((oldNLeaves == nLeaves()) && (oldNNodes == nNodes())) { if (debug & 1) { - Pout<< "octree : exiting since nLeaves does not change" + Pout<< "octree : exiting since nLeaves and nNodes do not change" << endl; } break; @@ -185,6 +186,7 @@ Foam::octree<Type>::octree } oldNLeaves = nLeaves(); + oldNNodes = nNodes(); topNode_->redistribute (