Commit 7c672a52 authored by Andrew Heather's avatar Andrew Heather
Browse files

nicer code for find faces

parent bb8f7a28
...@@ -45,7 +45,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces ...@@ -45,7 +45,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
const labelList& faces = mesh.cells()[celli_]; const labelList& faces = mesh.cells()[celli_];
const vector& C = mesh.cellCentres()[celli_]; const vector& C = mesh.cellCentres()[celli_];
labelList faceList(0); DynamicList<label> faceList(10);
forAll(faces, i) forAll(faces, i)
{ {
label facei = faces[i]; label facei = faces[i];
...@@ -53,12 +53,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces ...@@ -53,12 +53,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
if ((lam > 0) && (lam < 1.0)) if ((lam > 0) && (lam < 1.0))
{ {
label n = faceList.size(); faceList.append(facei);
faceList.setSize(n+1);
faceList[n] = facei;
} }
} }
faceList.shrink();
return faceList; return faceList;
} }
...@@ -75,7 +75,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces ...@@ -75,7 +75,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
const labelList& faces = mesh.cells()[celli]; const labelList& faces = mesh.cells()[celli];
const vector& C = mesh.cellCentres()[celli]; const vector& C = mesh.cellCentres()[celli];
labelList faceList(0); DynamicList<label> faceList(10);
forAll(faces, i) forAll(faces, i)
{ {
label facei = faces[i]; label facei = faces[i];
...@@ -83,12 +83,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces ...@@ -83,12 +83,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
if ((lam > 0) && (lam < 1.0)) if ((lam > 0) && (lam < 1.0))
{ {
label n = faceList.size(); faceList.append(facei);
faceList.setSize(n+1);
faceList[n] = facei;
} }
} }
faceList.shrink();
return faceList; return faceList;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment