avoid DynamicList::setSize()

This commit is contained in:
Mark Olesen
2008-12-12 09:47:37 +01:00
parent 07e604d4fa
commit df1573aae0
2 changed files with 10 additions and 16 deletions

View File

@ -135,26 +135,27 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
label regionI = 0; label regionI = 0;
label lineLabel, shapeId, nLabels, cellTableId, typeId; label lineLabel, shapeId, nLabels, cellTableId, typeId;
labelList starLabels(64); DynamicList<label> vertexLabels(64);
while ((is >> lineLabel).good()) while ((is >> lineLabel).good())
{ {
is >> shapeId >> nLabels >> cellTableId >> typeId; is >> shapeId >> nLabels >> cellTableId >> typeId;
if (nLabels > starLabels.size()) vertexLabels.clear();
{ vertexLabels.reserve(nLabels);
starLabels.setSize(nLabels);
}
starLabels = -1;
// read indices - max 8 per line // read indices - max 8 per line
for (label i = 0; i < nLabels; ++i) for (label i = 0; i < nLabels; ++i)
{ {
label vrtId;
if ((i % 8) == 0) if ((i % 8) == 0)
{ {
is >> lineLabel; is >> lineLabel;
} }
is >> starLabels[i]; is >> vrtId;
// convert original vertex id to point label
vertexLabels.append(mapPointId[vrtId]);
} }
if (typeId == starcdShellType_) if (typeId == starcdShellType_)
@ -178,14 +179,7 @@ bool Foam::fileFormats::STARCDsurfaceFormat<Face>::read
dynSizes.append(0); dynSizes.append(0);
} }
SubList<label> vertices(starLabels, nLabels); SubList<label> vertices(vertexLabels, vertexLabels.size());
// convert orig vertex id to point label
forAll(vertices, i)
{
vertices[i] = mapPointId[vertices[i]];
}
if (mustTriangulate && nLabels > 3) if (mustTriangulate && nLabels > 3)
{ {
face f(vertices); face f(vertices);

View File

@ -175,7 +175,7 @@ bool Foam::fileFormats::TRIsurfaceFormatCore::read
} }
} }
// truncate addressed size // truncate addressed size
dynSizes.setSize(nPatch); dynSizes.setCapacity(nPatch);
// transfer to normal lists // transfer to normal lists
points_.transfer(dynPoints); points_.transfer(dynPoints);