From 8776981c716e97506ca8238bd10d6f7dded6acc0 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Fri, 21 Jun 2013 11:30:26 +0100 Subject: [PATCH] BUG: faceZone: checkAddressing gets called when mesh.nFaces not set yet. --- src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C index 7e3850891d2..0013d193e30 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C @@ -174,14 +174,17 @@ void Foam::faceZone::checkAddressing() const const labelList& mf = *this; + // Note: nFaces, nCells might not be set yet on mesh so use owner size + const label nFaces = zoneMesh().mesh().faceOwner().size(); + bool hasWarned = false; forAll(mf, i) { - if (!hasWarned && (mf[i] < 0 || mf[i] >= zoneMesh().mesh().nFaces())) + if (!hasWarned && (mf[i] < 0 || mf[i] >= nFaces)) { WarningIn("void Foam::faceZone::checkAddressing() const") << "Illegal face index " << mf[i] << " outside range 0.." - << zoneMesh().mesh().nFaces()-1 << endl; + << nFaces-1 << endl; hasWarned = true; } } -- GitLab