ENH: sort cellCentre output according to global cell index (issue #869)
- replace SortableList with sortedOrder, to reduce some overhead
This commit is contained in:
parent
22a7c8bb7f
commit
67310ed4ef
@ -27,6 +27,7 @@ License
|
||||
#include "meshSearch.H"
|
||||
#include "polyMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "globalIndex.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -44,6 +45,8 @@ void Foam::cellCentreSet::genSamples()
|
||||
{
|
||||
const label len = mesh().nCells();
|
||||
|
||||
const globalIndex globalSampleNumbers(len);
|
||||
|
||||
const auto& cellCentres =
|
||||
refCast<const fvMesh>(mesh()).C().primitiveField();
|
||||
|
||||
@ -70,8 +73,13 @@ void Foam::cellCentreSet::genSamples()
|
||||
}
|
||||
|
||||
labelList samplingFaces(selectedCells.size(), -1);
|
||||
labelList samplingSegments(selectedCells.size(), -1);
|
||||
scalarList samplingCurveDist(selectedCells.size(), 0.0);
|
||||
labelList samplingSegments(selectedCells.size(), 0);
|
||||
scalarList samplingCurveDist(selectedCells.size());
|
||||
|
||||
forAll(selectedCells, i)
|
||||
{
|
||||
samplingCurveDist[i] = globalSampleNumbers.toGlobal(selectedCells[i]);
|
||||
}
|
||||
|
||||
// Move into *this
|
||||
setSamples
|
||||
|
@ -29,7 +29,6 @@ License
|
||||
#include "meshSearch.H"
|
||||
#include "writer.H"
|
||||
#include "particle.H"
|
||||
#include "SortableList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -467,7 +466,7 @@ Foam::autoPtr<Foam::coordSet> Foam::sampledSet::gather
|
||||
);
|
||||
|
||||
|
||||
if (Pstream::master() && allCurveDist.size() == 0)
|
||||
if (Pstream::master() && allCurveDist.empty())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Sample set " << name()
|
||||
@ -475,8 +474,8 @@ Foam::autoPtr<Foam::coordSet> Foam::sampledSet::gather
|
||||
}
|
||||
|
||||
// Sort curveDist and use to fill masterSamplePts
|
||||
SortableList<scalar> sortedDist(allCurveDist);
|
||||
indexSet = sortedDist.indices();
|
||||
Foam::sortedOrder(allCurveDist, indexSet); // uses stable sort
|
||||
scalarList sortedDist(allCurveDist, indexSet); // with indices for mapping
|
||||
|
||||
return autoPtr<coordSet>::New
|
||||
(
|
||||
|
@ -28,7 +28,6 @@ License
|
||||
#include "Time.H"
|
||||
#include "volFields.H"
|
||||
#include "ListListOps.H"
|
||||
#include "SortableList.H"
|
||||
#include "volPointInterpolation.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
Loading…
Reference in New Issue
Block a user