From 7c672a52a4757a4eace0460416fc3a2e599b503f Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Fri, 22 May 2009 14:42:48 +0100 Subject: [PATCH] nicer code for find faces --- src/lagrangian/basic/Particle/Particle.C | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lagrangian/basic/Particle/Particle.C b/src/lagrangian/basic/Particle/Particle.C index 099c8cde01a..9f27af0b322 100644 --- a/src/lagrangian/basic/Particle/Particle.C +++ b/src/lagrangian/basic/Particle/Particle.C @@ -45,7 +45,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces const labelList& faces = mesh.cells()[celli_]; const vector& C = mesh.cellCentres()[celli_]; - labelList faceList(0); + DynamicList<label> faceList(10); forAll(faces, i) { label facei = faces[i]; @@ -53,12 +53,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces if ((lam > 0) && (lam < 1.0)) { - label n = faceList.size(); - faceList.setSize(n+1); - faceList[n] = facei; + faceList.append(facei); } } + faceList.shrink(); + return faceList; } @@ -75,7 +75,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces const labelList& faces = mesh.cells()[celli]; const vector& C = mesh.cellCentres()[celli]; - labelList faceList(0); + DynamicList<label> faceList(10); forAll(faces, i) { label facei = faces[i]; @@ -83,12 +83,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces if ((lam > 0) && (lam < 1.0)) { - label n = faceList.size(); - faceList.setSize(n+1); - faceList[n] = facei; + faceList.append(facei); } } + faceList.shrink(); + return faceList; } -- GitLab