mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
SortableList, sortedOrder - micro-optimization
This commit is contained in:
@ -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);
|
||||
|
||||
@ -705,6 +705,7 @@ bool Foam::meshWriters::STARCD::writeSurface
|
||||
}
|
||||
}
|
||||
toc.sort();
|
||||
toc.shrink();
|
||||
pointHash.clear();
|
||||
|
||||
// write points in sorted order
|
||||
|
||||
Reference in New Issue
Block a user