ENH: noexcept size_bytes() method for lists

- for use when the is_contiguous check has already been done outside
  the loop. Naming as per std::span.

STYLE: use data/cdata instead of begin

ENH: replace random_shuffle with shuffle, fix OSX int64 ambiguity
This commit is contained in:
Mark Olesen
2021-02-26 18:10:42 +01:00
parent 51cd7ceecb
commit fa645c2dac
40 changed files with 188 additions and 132 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2015 OpenFOAM Foundation
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,6 +34,8 @@ License
#include "scalarIOField.H"
#include "labelIOField.H"
#include "pointConversion.H"
#include <algorithm>
#include <random>
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -304,7 +307,7 @@ Foam::Map<Foam::label> Foam::DelaunayMesh<Triangulation>::rangeInsertWithInfo
);
}
std::random_shuffle(points.begin(), points.end());
std::shuffle(points.begin(), points.end(), std::default_random_engine());
spatial_sort
(

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,6 +33,8 @@ License
#include "pointConversion.H"
#include "indexedVertexEnum.H"
#include "IOmanip.H"
#include <algorithm>
#include <random>
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
@ -880,7 +882,12 @@ Foam::DistributedDelaunayMesh<Triangulation>::rangeInsertReferredWithInfo
);
}
std::random_shuffle(pointsBbDistSqr.begin(), pointsBbDistSqr.end());
std::shuffle
(
pointsBbDistSqr.begin(),
pointsBbDistSqr.end(),
std::default_random_engine()
);
// Sort in ascending order by the distance of the point from the centre
// of the processor bounding box