diff --git a/src/OpenFOAM/db/typeInfo/typeInfo.H b/src/OpenFOAM/db/typeInfo/typeInfo.H index 01af6c7201..b9a2257c0d 100644 --- a/src/OpenFOAM/db/typeInfo/typeInfo.H +++ b/src/OpenFOAM/db/typeInfo/typeInfo.H @@ -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 #include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -151,6 +152,11 @@ inline word typedName(Name name) } +//- Determine whether a type is a reference +template +constexpr bool isRef = std::is_reference::value; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.C b/src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.C index ebef27d06a..dd41b983e2 100644 --- a/src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.C +++ b/src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -95,7 +95,7 @@ void Foam::fvMeshMovers::interpolator::mapMesh(const polyMeshMap& map) { if (displacement_) { - points0_() == mesh().points(); + points0_().primitiveFieldRef() = mesh().points(); } } diff --git a/src/meshTools/PrimitiveOldTimePatch/PrimitiveOldTimePatch.C b/src/meshTools/PrimitiveOldTimePatch/PrimitiveOldTimePatch.C index 3fa039db98..ad2e248b74 100644 --- a/src/meshTools/PrimitiveOldTimePatch/PrimitiveOldTimePatch.C +++ b/src/meshTools/PrimitiveOldTimePatch/PrimitiveOldTimePatch.C @@ -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::PrimitiveOldTimePatch ) : PrimitivePatch(faces, points), - points0_(points0), + points0Ptr_(isRef ? nullptr : new Field(points0)), + points0_(isRef ? points0 : points0Ptr_()), patch0Ptr_(new patch0Type(faces, points0_)), localPoints0Ptr_(nullptr) {} @@ -64,6 +65,7 @@ Foam::PrimitiveOldTimePatch::PrimitiveOldTimePatch ) : PrimitivePatch(faces, points), + points0Ptr_(nullptr), points0_(NullObjectRef>()), patch0Ptr_(nullptr), localPoints0Ptr_(nullptr) diff --git a/src/meshTools/PrimitiveOldTimePatch/PrimitiveOldTimePatch.H b/src/meshTools/PrimitiveOldTimePatch/PrimitiveOldTimePatch.H index e08271688d..8daf3e184e 100644 --- a/src/meshTools/PrimitiveOldTimePatch/PrimitiveOldTimePatch.H +++ b/src/meshTools/PrimitiveOldTimePatch/PrimitiveOldTimePatch.H @@ -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::type, - const PointFieldType& + const Field& > patch0Type; // Private Data + //- Stored old-time points + autoPtr> points0Ptr_; + //- Reference to global list of old-time points - PointField points0_; + const Field& points0_; //- Engine for calculating old-time geometry. Note: Methods that // generate topology should not be called here. The base patch should diff --git a/wmake/rules/linux64Clang/c++ b/wmake/rules/linux64Clang/c++ index 57b0aee6a5..fe76c92623 100644 --- a/wmake/rules/linux64Clang/c++ +++ b/wmake/rules/linux64Clang/c++ @@ -2,7 +2,7 @@ SUFFIXES += .C c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor \ -Wno-unused-parameter -Wno-invalid-offsetof \ - -Wno-undefined-var-template + -Wno-undefined-var-template -Wno-unqualified-std-cast-call # Suppress some warnings for flex++ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs \ diff --git a/wmake/rules/linuxClang/c++ b/wmake/rules/linuxClang/c++ index 1f5c47fa88..f76912152b 100644 --- a/wmake/rules/linuxClang/c++ +++ b/wmake/rules/linuxClang/c++ @@ -2,7 +2,7 @@ SUFFIXES += .C c++WARN = -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor \ -Wno-unused-parameter -Wno-invalid-offsetof \ - -Wno-undefined-var-template + -Wno-undefined-var-template -Wno-unqualified-std-cast-call # Suppress some warnings for flex++ c++LESSWARN = -Wno-old-style-cast -Wno-unused-local-typedefs \