Commit 3a4b92c4 authored by Mark Olesen's avatar Mark Olesen
Browse files

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
parent 37e248c7
......@@ -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
......
......@@ -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
{
......
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