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:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -325,7 +325,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
|
||||
label nTotalPoints = 0;
|
||||
// Master first
|
||||
SubField<point>(allPoints, points.size()).assign(points);
|
||||
SubField<point>(allPoints, points.size()) = points;
|
||||
nTotalPoints += points.size();
|
||||
|
||||
// Add slaves
|
||||
@ -338,7 +338,7 @@ Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
allPoints,
|
||||
nbrPoints.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrPoints);
|
||||
) = nbrPoints;
|
||||
nTotalPoints += nbrPoints.size();
|
||||
}
|
||||
|
||||
@ -401,8 +401,8 @@ Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
|
||||
label nTotalPoints = 0;
|
||||
// Master first
|
||||
SubField<point>(allPoints, points.size()).assign(points);
|
||||
SubField<scalar>(allWeights, points.size()).assign(weights);
|
||||
SubField<point>(allPoints, points.size()) = points;
|
||||
SubField<scalar>(allWeights, points.size()) = weights;
|
||||
nTotalPoints += points.size();
|
||||
|
||||
// Add slaves
|
||||
@ -416,13 +416,13 @@ Foam::labelList Foam::simpleGeomDecomp::decompose
|
||||
allPoints,
|
||||
nbrPoints.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrPoints);
|
||||
) = nbrPoints;
|
||||
SubField<scalar>
|
||||
(
|
||||
allWeights,
|
||||
nbrWeights.size(),
|
||||
nTotalPoints
|
||||
).assign(nbrWeights);
|
||||
) = nbrWeights;
|
||||
nTotalPoints += nbrPoints.size();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user