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:
@ -644,17 +644,14 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
forAll(allPoints, procI)
|
||||
{
|
||||
const pointField& pts = allPoints[procI];
|
||||
SubList<point>(tgtPoints, pts.size(), pointOffset[procI]).assign(pts);
|
||||
SubList<point>(tgtPoints, pts.size(), pointOffset[procI]) = pts;
|
||||
}
|
||||
|
||||
// Insert cellIDs
|
||||
forAll(allTgtCellIDs, procI)
|
||||
{
|
||||
const labelList& cellIDs = allTgtCellIDs[procI];
|
||||
SubList<label>(tgtCellIDs, cellIDs.size(), cellOffset[procI]).assign
|
||||
(
|
||||
cellIDs
|
||||
);
|
||||
SubList<label>(tgtCellIDs, cellIDs.size(), cellOffset[procI]) = cellIDs;
|
||||
}
|
||||
|
||||
|
||||
@ -671,7 +668,7 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
allNInternalFaces[procI],
|
||||
internalFaceOffset[procI]
|
||||
);
|
||||
slice.assign(SubList<face>(fcs, allNInternalFaces[procI]));
|
||||
slice = SubList<face>(fcs, allNInternalFaces[procI]);
|
||||
forAll(slice, i)
|
||||
{
|
||||
add(slice[i], pointOffset[procI]);
|
||||
@ -683,7 +680,7 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
allNInternalFaces[procI],
|
||||
internalFaceOffset[procI]
|
||||
);
|
||||
ownSlice.assign(SubField<label>(faceOs, allNInternalFaces[procI]));
|
||||
ownSlice = SubField<label>(faceOs, allNInternalFaces[procI]);
|
||||
add(ownSlice, cellOffset[procI]);
|
||||
|
||||
SubField<label> nbrSlice
|
||||
@ -692,7 +689,7 @@ void Foam::meshToMesh::distributeAndMergeCells
|
||||
allNInternalFaces[procI],
|
||||
internalFaceOffset[procI]
|
||||
);
|
||||
nbrSlice.assign(SubField<label>(faceNs, allNInternalFaces[procI]));
|
||||
nbrSlice = SubField<label>(faceNs, allNInternalFaces[procI]);
|
||||
add(nbrSlice, cellOffset[procI]);
|
||||
|
||||
internalFaceOffset[procI] += allNInternalFaces[procI];
|
||||
|
||||
Reference in New Issue
Block a user