ENH: return UList range slice as a SubList

- previously returned the range slice as a UList,
  but this prevents convenient assignment.
  Apply similar handling for Field/SubField

  Allows the following

     labelRange range(...);
     fullList.slice(range) = identity(range.size());

  and

     fullList.slice(range) = UIndirectList<T>(other, addr);

ENH: create SubList from full FixedList (simplifies interface)

- allow default constructed SubList. Use shallowCopy to 'reset' later
This commit is contained in:
Mark Olesen
2021-10-21 17:35:03 +02:00
parent 3781f17eee
commit e2861cc200
14 changed files with 269 additions and 96 deletions

View File

@ -79,7 +79,7 @@ inline const Foam::labelList& Foam::ensightCells::cellIds() const
inline const Foam::labelUList
Foam::ensightCells::cellIds(const elemType etype) const
{
return addressing()[range(etype)];
return addressing().slice(range(etype));
}

View File

@ -85,7 +85,7 @@ inline const Foam::labelList& Foam::ensightFaces::faceIds() const noexcept
inline const Foam::labelUList
Foam::ensightFaces::faceIds(const elemType etype) const
{
return addressing()[range(etype)];
return addressing().slice(range(etype));
}
@ -111,7 +111,7 @@ Foam::ensightFaces::faceOrder() const noexcept
inline const Foam::labelUList
Foam::ensightFaces::faceOrder(const elemType etype) const
{
return faceOrder_[range(etype)];
return faceOrder_.slice(range(etype));
}