From b0450ccd252c0984e6f52e7d164fc9018bfc3d3b Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 10 Sep 2021 14:48:21 +0100 Subject: [PATCH] DynamicList, DynamicField: Add Fwd.H headers The Fwd.H headers define the default template arguments. This means the dynamic list/field can be forward declared without there being any confusion with regards to the specification of these arguments. --- .../Lists/DynamicList/DynamicList.H | 8 ++- .../Lists/DynamicList/DynamicListFwd.H | 53 +++++++++++++++++++ src/OpenFOAM/containers/Lists/List/List.H | 6 +-- .../fields/Fields/DynamicField/DynamicField.H | 6 +-- .../Fields/DynamicField/DynamicFieldFwd.H | 53 +++++++++++++++++++ src/OpenFOAM/meshes/meshShapes/face/face.H | 6 +-- 6 files changed, 115 insertions(+), 17 deletions(-) create mode 100644 src/OpenFOAM/containers/Lists/DynamicList/DynamicListFwd.H create mode 100644 src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldFwd.H diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H index 89f4aa92dd..69ff78be7d 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.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-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -44,6 +44,7 @@ SourceFiles #define DynamicList_H #include "List.H" +#include "DynamicListFwd.H" #include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,9 +54,6 @@ namespace Foam // Forward declaration of friend functions and operators -template -class DynamicList; - template Ostream& operator<< ( @@ -74,7 +72,7 @@ Istream& operator>> Class DynamicList Declaration \*---------------------------------------------------------------------------*/ -template +template class DynamicList : public List diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListFwd.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListFwd.H new file mode 100644 index 0000000000..bcf1e901e8 --- /dev/null +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListFwd.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef DynamicListFwd_H +#define DynamicListFwd_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +< + class Type, + unsigned SizeInc = 0, + unsigned SizeMult = 2, + unsigned SizeDiv = 1 +> +class DynamicList; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index 19ba4a3c0f..9c5c10c249 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,6 +42,7 @@ SourceFiles #include "UList.H" #include "autoPtr.H" +#include "DynamicListFwd.H" #include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -75,9 +76,6 @@ template class LList; template using SLList = LList; -template -class DynamicList; - template class SortableList; template class IndirectList; template class UIndirectList; diff --git a/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H b/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H index 460228c182..60166d9b9b 100644 --- a/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H +++ b/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H @@ -37,6 +37,7 @@ SourceFiles #define DynamicField_H #include "Field.H" +#include "DynamicFieldFwd.H" #include // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,9 +47,6 @@ namespace Foam // Forward declaration of friend functions and operators -template -class DynamicField; - template Ostream& operator<< ( @@ -68,7 +66,7 @@ Istream& operator>> Class DynamicField Declaration \*---------------------------------------------------------------------------*/ -template +template class DynamicField : public Field diff --git a/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldFwd.H b/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldFwd.H new file mode 100644 index 0000000000..3f86d1ff6b --- /dev/null +++ b/src/OpenFOAM/fields/Fields/DynamicField/DynamicFieldFwd.H @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#ifndef DynamicFieldFwd_H +#define DynamicFieldFwd_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +< + class Type, + unsigned SizeInc = 0, + unsigned SizeMult = 2, + unsigned SizeDiv = 1 +> +class DynamicField; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index 2f41fecf4f..3a705132bc 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.H +++ b/src/OpenFOAM/meshes/meshShapes/face/face.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,7 @@ SourceFiles #include "edgeList.H" #include "vectorField.H" #include "faceListFwd.H" +#include "DynamicListFwd.H" #include "intersection.H" #include "pointHit.H" #include "ListListOps.H" @@ -62,9 +63,6 @@ namespace Foam class face; class triFace; -template -class DynamicList; - inline bool operator==(const face& a, const face& b); inline bool operator!=(const face& a, const face& b); inline Istream& operator>>(Istream&, face&);