ENH: cleanup List constructors (issue #725)

- add copy construct from UList

- remove copy construct from dissimilar types.

  This templated constructor was too generous in what it accepted.
  For the special cases where a copy constructor is required with
  a change in the data type, now use the createList factory method,
  which accepts a unary operator. Eg,

      auto scalars = scalarList::createList
      (
          labels,
          [](const label& val){ return 1.5*val; }
      );
This commit is contained in:
Mark Olesen
2018-02-08 08:53:14 +01:00
parent e2332d6bd2
commit e42c228155
10 changed files with 398 additions and 129 deletions

View File

@ -1007,7 +1007,11 @@ Foam::label Foam::checkGeometry
globalFaces().gather
(
UPstream::worldComm,
labelList(UPstream::procID(UPstream::worldComm)),
labelList::createList
(
UPstream::procID(UPstream::worldComm),
toLabel<int>() // int -> label
),
ami.srcWeightsSum(),
mergedWeights
);
@ -1057,7 +1061,11 @@ Foam::label Foam::checkGeometry
globalFaces().gather
(
UPstream::worldComm,
labelList(UPstream::procID(UPstream::worldComm)),
labelList::createList
(
UPstream::procID(UPstream::worldComm),
toLabel<int>() // int -> label
),
ami.tgtWeightsSum(),
mergedWeights
);