mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
UList: Rationalize assignment (shallow-copy vs deep-copy)
//- Disallow default shallow-copy assignment
//
// Assignment of UList<T> may need to be either shallow (copy pointer)
// or deep (copy elements) depending on context or the particular type
// of list derived from UList and it is confusing and prone to error
// for the default assignment to be either. The solution is to
// disallow default assignment and provide separate 'shallowCopy' and
// 'deepCopy' member functions.
void operator=(const UList<T>&) = delete;
//- Copy the pointer held by the given UList.
inline void shallowCopy(const UList<T>&);
//- Copy elements of the given UList.
void deepCopy(const UList<T>&);
This commit is contained in:
@ -566,10 +566,8 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
}
|
||||
|
||||
// Which processor they will end up on
|
||||
SubList<label>(nbrNewNbrProc, pp.size(), offset).assign
|
||||
(
|
||||
UIndirectList<label>(distribution, pp.faceCells())()
|
||||
);
|
||||
SubList<label>(nbrNewNbrProc, pp.size(), offset) =
|
||||
UIndirectList<label>(distribution, pp.faceCells())();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1074,7 +1072,7 @@ void Foam::fvMeshDistribute::sendMesh
|
||||
|
||||
if (myZoneID != -1)
|
||||
{
|
||||
zonePoints[nameI].assign(pointZones[myZoneID]);
|
||||
zonePoints[nameI].deepCopy(pointZones[myZoneID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1106,8 +1104,8 @@ void Foam::fvMeshDistribute::sendMesh
|
||||
|
||||
if (myZoneID != -1)
|
||||
{
|
||||
zoneFaces[nameI].assign(faceZones[myZoneID]);
|
||||
zoneFaceFlip[nameI].assign(faceZones[myZoneID].flipMap());
|
||||
zoneFaces[nameI].deepCopy(faceZones[myZoneID]);
|
||||
zoneFaceFlip[nameI].deepCopy(faceZones[myZoneID].flipMap());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1137,7 +1135,7 @@ void Foam::fvMeshDistribute::sendMesh
|
||||
|
||||
if (myZoneID != -1)
|
||||
{
|
||||
zoneCells[nameI].assign(cellZones[myZoneID]);
|
||||
zoneCells[nameI].deepCopy(cellZones[myZoneID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user