From 5e74e289a52e8dac97a6d91ce7caf27698e32dde Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 3 Jan 2023 08:45:44 +0000 Subject: [PATCH] SubField: Added "reuse" constructor This doesn't add any functionality, but it is necessary to unify the interface with Field for classes that are templated on their container --- src/OpenFOAM/fields/Fields/Field/SubField.H | 5 ++++- src/OpenFOAM/fields/Fields/Field/SubFieldI.H | 14 +++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/fields/Fields/Field/SubField.H b/src/OpenFOAM/fields/Fields/Field/SubField.H index 68674044d6..5ce67ab1e4 100644 --- a/src/OpenFOAM/fields/Fields/Field/SubField.H +++ b/src/OpenFOAM/fields/Fields/Field/SubField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -95,6 +95,9 @@ public: //- Copy constructor inline SubField(const SubField&); + //- Copy constructor or reuse as specified + inline SubField(SubField&, bool reuse); + // Member Functions diff --git a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H b/src/OpenFOAM/fields/Fields/Field/SubFieldI.H index b3633ed50f..fc29b36052 100644 --- a/src/OpenFOAM/fields/Fields/Field/SubFieldI.H +++ b/src/OpenFOAM/fields/Fields/Field/SubFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,6 +79,18 @@ inline Foam::SubField::SubField {} +template +inline Foam::SubField::SubField +( + SubField& sfield, + bool reuse +) +: + tmp>::refCount(), + SubList(sfield) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template