ENH: add single-parameter sortedOrder() function

This commit is contained in:
Mark Olesen
2019-07-17 11:08:40 +02:00
committed by Andrew Heather
parent 5788fe056c
commit 1d86fc4f6b
33 changed files with 134 additions and 117 deletions

View File

@ -1183,8 +1183,8 @@ void Foam::polyMeshAdder::mergeFaceZones
fzFaces[i].shrink();
fzFlips[i].shrink();
labelList order;
sortedOrder(fzFaces[i], order);
labelList order(sortedOrder(fzFaces[i]));
fzFaces[i] = labelUIndList(fzFaces[i], order)();
fzFlips[i] = boolUIndList(fzFlips[i], order)();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
@ -583,9 +583,7 @@ Foam::edgeCollapser::collapseType Foam::edgeCollapser::collapseFace
// Sort the projected distances and the corresponding vertex
// indices along the collapse axis
labelList oldToNew;
sortedOrder(d, oldToNew);
labelList oldToNew(sortedOrder(d));
oldToNew = invert(oldToNew.size(), oldToNew);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2015-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2015-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
@ -725,7 +725,6 @@ void Foam::polyTopoChange::getFaceOrder
label nFaces = cellFaceOffsets[celli+1] - startOfCell;
// Neighbouring cells
//SortableList<label> nbr(nFaces);
nbr.setSize(nFaces);
for (label i = 0; i < nFaces; i++)
@ -765,21 +764,10 @@ void Foam::polyTopoChange::getFaceOrder
}
}
//nbr.sort();
order.setSize(nFaces);
sortedOrder(nbr, order);
//forAll(nbr, i)
//{
// if (nbr[i] != -1)
// {
// oldToNew[cellFaces[startOfCell + nbr.indices()[i]]] =
// newFacei++;
// }
//}
forAll(order, i)
for (const label index : order)
{
label index = order[i];
if (nbr[index] != -1)
{
oldToNew[cellFaces[startOfCell + index]] = newFacei++;
@ -1672,8 +1660,7 @@ void Foam::polyTopoChange::resetZones
// Sort the addressing
forAll(addressing, zonei)
{
labelList newToOld;
sortedOrder(addressing[zonei], newToOld);
labelList newToOld(sortedOrder(addressing[zonei]));
{
labelList newAddressing(addressing[zonei].size());
forAll(newAddressing, i)