ENH: uniformFixedValue: avoid unallocated autoPtr error

This commit is contained in:
Kutalmis Bercin 2023-03-31 08:59:31 +01:00
parent ddf9d528e2
commit bd1e1ec9c7

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -130,7 +130,11 @@ void Foam::uniformFixedValueFvPatchField<Type>::autoMap
) )
{ {
fixedValueFvPatchField<Type>::autoMap(mapper); fixedValueFvPatchField<Type>::autoMap(mapper);
refValueFunc_().autoMap(mapper);
if (refValueFunc_)
{
refValueFunc_().autoMap(mapper);
}
if (refValueFunc_().constant()) if (refValueFunc_().constant())
{ {
@ -152,7 +156,10 @@ void Foam::uniformFixedValueFvPatchField<Type>::rmap
const uniformFixedValueFvPatchField& tiptf = const uniformFixedValueFvPatchField& tiptf =
refCast<const uniformFixedValueFvPatchField>(ptf); refCast<const uniformFixedValueFvPatchField>(ptf);
refValueFunc_().rmap(tiptf.refValueFunc_(), addr); if (refValueFunc_)
{
refValueFunc_().rmap(tiptf.refValueFunc_(), addr);
}
} }
@ -174,7 +181,12 @@ template<class Type>
void Foam::uniformFixedValueFvPatchField<Type>::write(Ostream& os) const void Foam::uniformFixedValueFvPatchField<Type>::write(Ostream& os) const
{ {
fvPatchField<Type>::write(os); fvPatchField<Type>::write(os);
refValueFunc_->writeData(os);
if (refValueFunc_)
{
refValueFunc_->writeData(os);
}
fvPatchField<Type>::writeValueEntry(os); fvPatchField<Type>::writeValueEntry(os);
} }