Commit b914228f authored by Mattijs Janssens's avatar Mattijs Janssens
Browse files

Added initList for initialisation of Lists.

parent b6c51971
......@@ -183,6 +183,12 @@ label findLower
);
//- To construct a List from a C array. Has extra Container type
// to initialise e.g. wordList from arrays of char*.
template<class Container, class T, int nRows>
List<Container> initList(const T[nRows]);
//- To construct a (square) ListList from a C array. Has extra Container type
// to initialise e.g. faceList from arrays of labels.
template<class Container, class T, int nRows, int nColumns>
......
......@@ -486,6 +486,19 @@ Foam::label Foam::findLower
}
template<class Container, class T, int nRows>
Foam::List<Container> Foam::initList(const T elems[nRows])
{
List<Container> faces(nRows);
forAll(faces, faceI)
{
faces[faceI] = Container(elems[faceI]);
}
return faces;
}
template<class Container, class T, int nRows, int nColumns>
Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns])
{
......
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