SortableList, sortedOrder - micro-optimization

This commit is contained in:
Mark Olesen
2009-01-14 10:15:01 +01:00
parent c5bb3f5d1d
commit 9bce583063
7 changed files with 39 additions and 31 deletions

View File

@ -30,7 +30,7 @@ License
#include "wallPolyPatch.H"
#include "symmetryPolyPatch.H"
#include "cellModeller.H"
#include "SortableList.H"
#include "ListOps.H"
#include "IFstream.H"
#include "IOMap.H"
@ -797,14 +797,15 @@ void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName)
patchNames_[nPatches-1] = defaultBoundaryName;
// sort according to ascending region numbers, but leave
// Default_Boundary_Region as the last patch
// Default_Boundary_Region as the final patch
{
SortableList<label> sortedOrder(SubList<label>(origRegion, nPatches-1));
labelList sortedIndices;
sortedOrder(SubList<label>(origRegion, nPatches-1), sortedIndices);
labelList oldToNew = identity(nPatches);
forAll(sortedOrder, i)
forAll(sortedIndices, i)
{
oldToNew[sortedOrder.indices()[i]] = i;
oldToNew[sortedIndices[i]] = i;
}
inplaceReorder(oldToNew, origRegion);

View File

@ -705,6 +705,7 @@ bool Foam::meshWriters::STARCD::writeSurface
}
}
toc.sort();
toc.shrink();
pointHash.clear();
// write points in sorted order