PrimitiveOldTimePatch: Fix construction from null reference
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,6 +55,7 @@ Description
|
||||
|
||||
#include "error.H"
|
||||
#include "className.H"
|
||||
#include <type_traits>
|
||||
#include <typeinfo>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -151,6 +152,11 @@ inline word typedName(Name name)
|
||||
}
|
||||
|
||||
|
||||
//- Determine whether a type is a reference
|
||||
template<class Type>
|
||||
constexpr bool isRef = std::is_reference<Type>::value;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,7 +36,8 @@ Foam::PrimitiveOldTimePatch<FaceList, PointField>::PrimitiveOldTimePatch
|
||||
)
|
||||
:
|
||||
PrimitivePatch<FaceList, PointField>(faces, points),
|
||||
points0_(points0),
|
||||
points0Ptr_(isRef<PointField> ? nullptr : new Field<PointType>(points0)),
|
||||
points0_(isRef<PointField> ? points0 : points0Ptr_()),
|
||||
patch0Ptr_(new patch0Type(faces, points0_)),
|
||||
localPoints0Ptr_(nullptr)
|
||||
{}
|
||||
@ -64,6 +65,7 @@ Foam::PrimitiveOldTimePatch<FaceList, PointField>::PrimitiveOldTimePatch
|
||||
)
|
||||
:
|
||||
PrimitivePatch<FaceList, PointField>(faces, points),
|
||||
points0Ptr_(nullptr),
|
||||
points0_(NullObjectRef<Field<PointType>>()),
|
||||
patch0Ptr_(nullptr),
|
||||
localPoints0Ptr_(nullptr)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,15 +85,18 @@ private:
|
||||
PrimitivePatch
|
||||
<
|
||||
typename UFaceList<FaceListType>::type,
|
||||
const PointFieldType&
|
||||
const Field<PointType>&
|
||||
>
|
||||
patch0Type;
|
||||
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Stored old-time points
|
||||
autoPtr<Field<PointType>> points0Ptr_;
|
||||
|
||||
//- Reference to global list of old-time points
|
||||
PointField points0_;
|
||||
const Field<PointType>& points0_;
|
||||
|
||||
//- Engine for calculating old-time geometry. Note: Methods that
|
||||
// generate topology should not be called here. The base patch should
|
||||
|
||||
Reference in New Issue
Block a user