ENH: prefer PtrList set/get/test instead of PtrList::operator() access

- clearer coding intent. Mark operator() as 'deprecated'

- add bounds checking to get(label) and set(label) methods.

  This gives failsafe behaviour for get() that is symmetric with
  HashPtrTable, autoPtr etc and aligns the set(label) methods
  for UPtrList, PtrList and PtrDynList.

- use top-level PtrList::clone() instead of cloning individual elements

ENH: support HashPtrTable set with refPtr/tmp (flexibility)
This commit is contained in:
Mark Olesen
2022-09-12 12:50:10 +02:00
parent b9ca63b118
commit a0282c7e41
18 changed files with 239 additions and 207 deletions

View File

@ -121,7 +121,7 @@ Foam::faFieldReconstructor::reconstructField
{
// Regular patch. Fast looping
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set
(
@ -195,7 +195,7 @@ Foam::faFieldReconstructor::reconstructField
}
}
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set
(
@ -230,7 +230,7 @@ Foam::faFieldReconstructor::reconstructField
if
(
isA<emptyFaPatch>(mesh_.boundary()[patchI])
&& !patchFields(patchI)
&& !patchFields.set(patchI)
)
{
patchFields.set
@ -362,7 +362,7 @@ Foam::faFieldReconstructor::reconstructField
{
// Regular patch. Fast looping
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set
(
@ -439,7 +439,7 @@ Foam::faFieldReconstructor::reconstructField
}
}
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set
(
@ -481,7 +481,7 @@ Foam::faFieldReconstructor::reconstructField
if
(
isA<emptyFaPatch>(mesh_.boundary()[patchI])
&& !patchFields(patchI)
&& !patchFields.set(patchI)
)
{
patchFields.set

View File

@ -116,7 +116,7 @@ Foam::fvFieldReconstructor::reconstructField
{
// Regular patch. Fast looping
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set
(
@ -184,7 +184,7 @@ Foam::fvFieldReconstructor::reconstructField
{
label curBPatch = mesh_.boundaryMesh().whichPatch(curF);
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set
(
@ -217,7 +217,7 @@ Foam::fvFieldReconstructor::reconstructField
if
(
isType<emptyFvPatch>(mesh_.boundary()[patchi])
&& !patchFields(patchi)
&& !patchFields.set(patchi)
)
{
patchFields.set
@ -314,7 +314,7 @@ Foam::fvFieldReconstructor::reconstructField
{
// Regular patch. Fast looping
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set
(
@ -370,7 +370,7 @@ Foam::fvFieldReconstructor::reconstructField
label curBPatch =
mesh_.boundaryMesh().whichPatch(curF);
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set
(
@ -410,7 +410,7 @@ Foam::fvFieldReconstructor::reconstructField
if
(
isType<emptyFvPatch>(mesh_.boundary()[patchi])
&& !patchFields(patchi)
&& !patchFields.set(patchi)
)
{
patchFields.set

View File

@ -70,9 +70,10 @@ Foam::pointFieldReconstructor::reconstructField
// check if the boundary patch is not a processor patch
if (curBPatch >= 0)
{
if (!patchFields(curBPatch))
if (!patchFields.set(curBPatch))
{
patchFields.set(
patchFields.set
(
curBPatch,
pointPatchField<Type>::New
(