mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added initList for initialisation of Lists.
This commit is contained in:
@ -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])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user