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