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:
Henry Weller
2016-04-03 10:26:05 +01:00
parent 06f7682413
commit ac71f86574
31 changed files with 122 additions and 100 deletions

View File

@ -424,14 +424,14 @@ int main(int argc, char *argv[])
(
availablePoints,
upp.faceCentres().size()
).assign(upp.faceCentres());
) = upp.faceCentres();
SubList<point>
(
availablePoints,
upp.localPoints().size(),
upp.faceCentres().size()
).assign(upp.localPoints());
) = upp.localPoints();
point cfo = cf;
scalar dist = GREAT;
@ -592,8 +592,8 @@ int main(int argc, char *argv[])
DynamicList<label> compactPatchId(map.constructSize());
// Insert my coarse local values
SubList<point>(compactCoarseSf, nCoarseFaces).assign(localCoarseSf);
SubList<point>(compactCoarseCf, nCoarseFaces).assign(localCoarseCf);
SubList<point>(compactCoarseSf, nCoarseFaces) = localCoarseSf;
SubList<point>(compactCoarseCf, nCoarseFaces) = localCoarseCf;
// Insert my fine local values
label compactI = 0;