STYLE: patch field Internal::null() instead of DimensionedField equivalent

- makes for more consistent coding

STYLE: use two-parameter clone when making a copy of patch fields
This commit is contained in:
Mark Olesen
2024-01-08 17:34:00 +01:00
committed by Andrew Heather
parent 987dbe4589
commit 2190684914
19 changed files with 187 additions and 147 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,9 +30,8 @@ License
#include "Time.H"
#include "PtrList.H"
#include "fvPatchFields.H"
#include "fvsPatchFields.H"
#include "emptyFvPatch.H"
#include "emptyFvPatchField.H"
#include "emptyFvsPatchField.H"
#include "IOobjectList.H"
#include "mapDistributePolyMesh.H"
#include "processorFvPatch.H"
@ -123,15 +122,19 @@ Foam::parFvFieldDistributor::distributeField
{
if (patchFaceMaps_.set(patchi))
{
// Clone local patch field
oldPatchFields.set(patchi, bfld[patchi].clone());
distributedFvPatchFieldMapper mapper
(
labelUList::null(),
patchFaceMaps_[patchi]
);
// Clone local patch field
oldPatchFields.set
(
patchi,
bfld[patchi].clone(fld.internalField())
);
// Map into local copy
oldPatchFields[patchi].autoMap(mapper);
}
@ -159,7 +162,7 @@ Foam::parFvFieldDistributor::distributeField
(
pfld,
tgtMesh_.boundary()[patchi],
DimensionedField<Type, volMesh>::null(),
fvPatchField<Type>::Internal::null(),
dummyMapper
)
);
@ -178,9 +181,9 @@ Foam::parFvFieldDistributor::distributeField
patchi,
fvPatchField<Type>::New
(
emptyFvPatchField<Type>::typeName,
fvPatchFieldBase::emptyType(),
tgtMesh_.boundary()[patchi],
DimensionedField<Type, volMesh>::null()
fvPatchField<Type>::Internal::null()
)
);
}
@ -268,15 +271,19 @@ Foam::parFvFieldDistributor::distributeField
{
if (patchFaceMaps_.set(patchi))
{
// Clone local patch field
oldPatchFields.set(patchi, bfld[patchi].clone());
distributedFvPatchFieldMapper mapper
(
labelUList::null(),
patchFaceMaps_[patchi]
);
// Clone local patch field
oldPatchFields.set
(
patchi,
bfld[patchi].clone(fld.internalField())
);
// Map into local copy
oldPatchFields[patchi].autoMap(mapper);
}
@ -303,7 +310,7 @@ Foam::parFvFieldDistributor::distributeField
(
pfld,
tgtMesh_.boundary()[patchi],
DimensionedField<Type, surfaceMesh>::null(),
fvsPatchField<Type>::Internal::null(),
dummyMapper
)
);
@ -321,9 +328,9 @@ Foam::parFvFieldDistributor::distributeField
patchi,
fvsPatchField<Type>::New
(
emptyFvsPatchField<Type>::typeName,
fvsPatchFieldBase::emptyType(),
tgtMesh_.boundary()[patchi],
DimensionedField<Type, surfaceMesh>::null()
fvsPatchField<Type>::Internal::null()
)
);
}

View File

@ -26,11 +26,11 @@ License
\*---------------------------------------------------------------------------*/
#include "Time.H"
#include "emptyPointPatchField.H"
#include "IOobjectList.H"
#include "mapDistributePolyMesh.H"
#include "distributedFieldMapper.H"
#include "distributedPointPatchFieldMapper.H"
#include "emptyPointPatch.H"
#include "pointFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -108,7 +108,7 @@ Foam::parPointFieldDistributor::distributeField
(
bfld[patchi],
tgtMesh.boundary()[patchi], // pointPatch
DimensionedField<Type, pointMesh>::null(),
pointPatchField<Type>::Internal::null(),
mapper
)
);
@ -122,7 +122,7 @@ Foam::parPointFieldDistributor::distributeField
// bfld[patchi].clone
// (
// tgtMesh.boundary()[patchi],
// DimensionedField<Type, pointMesh>::null(),
// pointPatchField<Type>::Internal::null(),
// mapper
// )
//);
@ -140,9 +140,9 @@ Foam::parPointFieldDistributor::distributeField
patchi,
pointPatchField<Type>::New
(
emptyPointPatchField<Type>::typeName,
pointPatchFieldBase::emptyType(),
tgtMesh.boundary()[patchi],
DimensionedField<Type, pointMesh>::null()
pointPatchField<Type>::Internal::null()
)
);
}