Commit f19150cd authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: relocate identity() declaration to List.H (was in ListOps.H)

- remove unused and deprecated emptyList() casting function.

  This function is disllowed by many modern compilers and is no longer
  used within OpenFOAM - was deprecated 2018-07.
parent dfc83858
......@@ -47,6 +47,7 @@ $(ints)/int64/int64IO.C
$(ints)/int/intIO.C
$(ints)/label/label.C
$(ints)/uLabel/uLabel.C
$(ints)/lists/labelList.C
$(ints)/lists/labelIOList.C
$(ints)/lists/labelListIOList.C
......
......@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -346,6 +346,11 @@ public:
// * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
//- Create identity map of the given length with (map[i] == i)
// Optionally with an alternative start index, so that (map[i] == i+start)
labelList identity(const label len, label start=0);
//- Hashing for List data, which uses Hasher for contiguous data and
//- element-wise incrementally hashing otherwise.
template<class T>
......
......@@ -24,12 +24,6 @@ License
\*---------------------------------------------------------------------------*/
#include "ListOps.H"
#include <numeric>
// * * * * * * * * * * * * * * Global Data Members * * * * * * * * * * * * * //
const Foam::labelList Foam::emptyLabelList;
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
......@@ -47,6 +41,16 @@ Foam::labelList Foam::invert
if (newIdx >= 0)
{
#ifdef FULLDEBUG
if (newIdx >= len)
{
FatalErrorInFunction
<< "Inverse location " << newIdx
<< " is out of range. List has size " << len
<< abort(FatalError);
}
#endif
if (inverse[newIdx] >= 0)
{
FatalErrorInFunction
......@@ -76,7 +80,7 @@ Foam::labelListList Foam::invertOneToMany
{
if (newIdx >= 0)
{
sizes[newIdx]++;
++sizes[newIdx];
}
}
......@@ -102,15 +106,6 @@ Foam::labelListList Foam::invertOneToMany
}
Foam::labelList Foam::identity(const label len, label start)
{
labelList map(len);
std::iota(map.begin(), map.end(), start);
return map;
}
Foam::bitSet Foam::reorder
(
const labelUList& oldToNew,
......
......@@ -55,17 +55,6 @@ SourceFiles
namespace Foam
{
//- Deprecated(2018-07) reference to zero-sized list.
// Compare to List::null() which returns null pointer cast as list reference.
//
// \deprecated(2018-07) This cast is disallowed with many modern compilers
template<class T>
static const List<T>& emptyList()
{
return *reinterpret_cast<const List<T>*>(&emptyLabelList);
}
//- Renumber the values (not the indices) of a list.
// Negative IntListType elements are left untouched.
template<class IntListType>
......@@ -372,9 +361,6 @@ List<OutputIntListType> invertManyToMany
return output;
}
//- Create identity map of the given length with (map[i] == i)
// Optionally with an alternative start index, so that (map[i] == i+start)
labelList identity(const label len, label start=0);
//- Deprecated(2017-10) search for first occurence of the given element.
// \return The index found or return -1 if not found.
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "List.H"
#include <numeric>
// * * * * * * * * * * * * * * Global Data Members * * * * * * * * * * * * * //
const Foam::labelList Foam::emptyLabelList;
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
Foam::labelList Foam::identity(const label len, label start)
{
labelList map(len);
std::iota(map.begin(), map.end(), start);
return map;
}
// ************************************************************************* //
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment