From 3a4b92c4b2c8fa16b28d3cecc6d2c7dda40ec203 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 22 Feb 2018 12:24:48 +0100 Subject: [PATCH] STYLE: remove deprecated and unused ListOps - deprecated MAR-2017 subset(const UList<T>& select, const T& value, const ListType&); inplaceSubset(const UList<T>& select, const T& value, ListType&); The subsetList/inplaceSubsetList variants with a unary predicate provide more flexible and robuster solutions. - deprecated MAR-2017 initList(const T[mRows]); initListList(const T[mRows][nColumns]); Required prior to the addition of constructors with std::initializer_list --- .../containers/Lists/ListOps/ListOps.H | 27 ----- .../Lists/ListOps/ListOpsTemplates.C | 104 ------------------ 2 files changed, 131 deletions(-) diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H index 941a1795e81..4f65d105236 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOps.H +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOps.H @@ -165,17 +165,6 @@ void inplaceUniqueSort ); -//- Extract elements of List when select is a certain value. -// \deprecated use subsetList instead (deprecated Mar 2017) -template<class T, class ListType> -ListType subset(const UList<T>& select, const T& value, const ListType&); - -//- Inplace extract elements of List when select is a certain value. -// \deprecated use inplaceSubsetList instead (deprecated Mar 2017) -template<class T, class ListType> -void inplaceSubset(const UList<T>& select, const T& value, ListType&); - - //- Extract elements of List when select is true // eg, to extract all selected elements: // subset<boolList, labelList>(selectedElems, list); @@ -336,22 +325,6 @@ label findLower ); -//- To construct a List from a C array. Has extra Container type -// to initialise e.g. wordList from arrays of char*. -// -// \deprecated can often use initializer_list instead (deprecated Mar 2017) -template<class Container, class T, int mRows> -List<Container> initList(const T[mRows]); - - -//- To construct a (square) ListList from a C array. Has extra Container type -// to initialise e.g. faceList from arrays of labels. -// -// \deprecated can often use initializer_list instead (deprecated Mar 2017) -template<class Container, class T, int mRows, int nColumns> -List<Container> initListList(const T[mRows][nColumns]); - - //- Helper class for list to append y onto the end of x template<class T> class ListAppendEqOp diff --git a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C index 7de2564ccea..0315a2465d2 100644 --- a/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C +++ b/src/OpenFOAM/containers/Lists/ListOps/ListOpsTemplates.C @@ -359,79 +359,6 @@ void Foam::inplaceUniqueSort } -template<class T, class ListType> -ListType Foam::subset -( - const UList<T>& select, - const T& value, - const ListType& input -) -{ - const label len = input.size(); - - // select must at least cover the list range - if (select.size() < len) - { - FatalErrorInFunction - << "select is of size " << select.size() - << "; but it must index a list of size " << len - << abort(FatalError); - } - - ListType output(len); - output.resize(len); // Consistent sizing (eg, DynamicList) - - label count = 0; - for (label i=0; i < len; ++i) - { - if (select[i] == value) - { - output[count] = input[i]; - ++count; - } - } - output.resize(count); - - return output; -} - - -template<class T, class ListType> -void Foam::inplaceSubset -( - const UList<T>& select, - const T& value, - ListType& input -) -{ - const label len = input.size(); - - // select must at least cover the list range - if (select.size() < len) - { - FatalErrorInFunction - << "select is of size " << select.size() - << "; but it must index a list of size " << len - << abort(FatalError); - } - - label count = 0; - for (label i=0; i < len; ++i) - { - if (select[i] == value) - { - if (count != i) - { - input[count] = std::move(input[i]); - } - ++count; - } - } - - input.resize(count); -} - - template<class BoolListType, class ListType> ListType Foam::subset ( @@ -809,37 +736,6 @@ Foam::label Foam::findLower } -template<class Container, class T, int mRows> -Foam::List<Container> Foam::initList(const T elems[mRows]) -{ - List<Container> lst(mRows); - - forAll(lst, rowI) - { - lst[rowI] = Container(elems[rowI]); - } - return lst; -} - - -template<class Container, class T, int mRows, int nColumns> -Foam::List<Container> Foam::initListList(const T elems[mRows][nColumns]) -{ - List<Container> lst(mRows); - - Container cols(nColumns); - forAll(lst, rowI) - { - forAll(cols, colI) - { - cols[colI] = elems[rowI][colI]; - } - lst[rowI] = cols; - } - return lst; -} - - template<class T> void Foam::ListAppendEqOp<T>::operator()(List<T>& x, const List<T>& y) const { -- GitLab