diff --git a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H index 1a56d74cbe..b81b9382b2 100644 --- a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H +++ b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -47,26 +47,27 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class oneField Declaration + Class oneFieldField Declaration \*---------------------------------------------------------------------------*/ class oneFieldField : public one { - public: // Constructors //- Construct null - oneFieldField() - {} + oneFieldField() = default; // Member Operators - inline oneField operator[](const label) const; + inline oneField operator[](const label) const + { + return oneField(); + } }; @@ -74,10 +75,6 @@ public: } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - #include "oneFieldFieldI.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H index 188bd57069..7cec1b4541 100644 --- a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H +++ b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H @@ -1,38 +1 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | - \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2011 OpenFOAM Foundation -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "oneFieldField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -inline Foam::oneField Foam::oneFieldField::operator[](const label) const -{ - return oneField(); -} - - -// ************************************************************************* // +#warning File removed - left for old dependency check only diff --git a/src/OpenFOAM/fields/Fields/oneField/oneField.H b/src/OpenFOAM/fields/Fields/oneField/oneField.H index 1acc041b2f..4f1130605f 100644 --- a/src/OpenFOAM/fields/Fields/oneField/oneField.H +++ b/src/OpenFOAM/fields/Fields/oneField/oneField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -54,7 +54,6 @@ class oneField : public one { - public: // Public typedefs @@ -65,23 +64,23 @@ public: // Constructors //- Construct null - oneField() - {} + oneField() = default; // Member Operators - inline one operator[](const label) const; + inline one operator[](const label) const + { + return one(); + } - inline oneField field() const; + inline oneField field() const + { + return oneField(); + } }; -inline const oneField& operator*(const oneField&, const oneField&); - -inline const oneField& operator/(const oneField&, const oneField&); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H b/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H index b04852a864..63bf55b21c 100644 --- a/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H +++ b/src/OpenFOAM/fields/Fields/oneField/oneFieldI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | + \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -25,40 +25,25 @@ License \*---------------------------------------------------------------------------*/ -#include "oneField.H" +// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // + +namespace Foam +{ + +inline const oneField& operator*(const oneField& of, const oneField&) +{ + return of; +} + + +inline const oneField& operator/(const oneField& of, const oneField&) +{ + return of; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -inline Foam::one Foam::oneField::operator[](const label) const -{ - return one(); -} - - -inline Foam::oneField Foam::oneField::field() const -{ - return oneField(); -} - - -inline const Foam::oneField& Foam::operator* -( - const oneField& of, - const oneField& -) -{ - return of; -} - - -inline const Foam::oneField& Foam::operator/ -( - const oneField& of, - const oneField& -) -{ - return of; -} +} // End namespace Foam // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/nullObject/nullObject.H b/src/OpenFOAM/primitives/nullObject/nullObject.H index d232cdcb66..4c7086e5f4 100644 --- a/src/OpenFOAM/primitives/nullObject/nullObject.H +++ b/src/OpenFOAM/primitives/nullObject/nullObject.H @@ -31,11 +31,9 @@ Description Its contents occupy enough space to also be reinterpreted as another class with a null pointer or zero long for its first - member. There is an additional zero second parameter for safe - casting to List etc. + member, with additional zero parameters for safe casting to List etc. SourceFiles - nullObjectI.H nullObject.C \*---------------------------------------------------------------------------*/ @@ -137,50 +135,74 @@ public: }; -// IOstream Operators - -//- Read from Istream consumes no content. -inline Istream& operator>>(Istream& is, NullObject&) -{ - return is; -} - -//- Write to Ostream emits no content. -inline Ostream& operator<<(Ostream& os, const NullObject&) -{ - return os; -} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Globals //- Pointer to the unique nullObject extern const NullObject* nullObjectPtr; -//- Reference to the nullObject of type T +// IOstream Operators + +//- Read from Istream consumes no content. +inline Istream& operator>>(Istream& is, NullObject&) noexcept +{ + return is; +} + +//- Write to Ostream emits no content. +inline Ostream& operator<<(Ostream& os, const NullObject&) noexcept +{ + return os; +} + + +// Global Functions + +//- Pointer (of type T) to the nullObject template -inline const T& NullObjectRef(); +inline const T* NullObjectPtr() +{ + return reinterpret_cast(nullObjectPtr); +} -//- Pointer to the nullObject of type T +//- Reference (of type T) to the nullObject template -inline const T* NullObjectPtr(); +inline const T& NullObjectRef() +{ + return *reinterpret_cast(nullObjectPtr); +} -//- True if t is a reference to the nullObject of type T +//- True if ptr is a pointer (of type T) to the nullObject template -inline bool isNull(const T& t); +inline bool isNull(const T* ptr) +{ + return ptr == NullObjectPtr(); +} -//- True if t is not a reference to the nullObject of type T +//- True if obj is a reference (of type T) to the nullObject template -inline bool notNull(const T& t); +inline bool isNull(const T& obj) +{ + return &obj == NullObjectPtr(); +} -//- True if t is a pointer to the nullObject of type T +//- True if ptr is not a pointer (of type T) to the nullObject template -inline bool isNull(const T* t); +inline bool notNull(const T* ptr) +{ + return ptr != NullObjectPtr(); +} -//- True if t is not a pointer to the nullObject of type T +//- True if obj is not a reference (of type T) to the nullObject template -inline bool notNull(const T* t); +inline bool notNull(const T& obj) +{ + return &obj != NullObjectPtr(); +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -189,10 +211,6 @@ inline bool notNull(const T* t); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "nullObjectI.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/nullObject/nullObjectI.H b/src/OpenFOAM/primitives/nullObject/nullObjectI.H index b1f95733b3..7cec1b4541 100644 --- a/src/OpenFOAM/primitives/nullObject/nullObjectI.H +++ b/src/OpenFOAM/primitives/nullObject/nullObjectI.H @@ -1,67 +1 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | - \\/ M anipulation | -------------------------------------------------------------------------------- - | Copyright (C) 2014-2016 OpenFOAM Foundation -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -template -inline const T& Foam::NullObjectRef() -{ - return *reinterpret_cast(nullObjectPtr); -} - -template -inline const T* Foam::NullObjectPtr() -{ - return reinterpret_cast(nullObjectPtr); -} - - -template -inline bool Foam::isNull(const T& t) -{ - return &t == NullObjectPtr(); -} - -template -inline bool Foam::notNull(const T& t) -{ - return &t != NullObjectPtr(); -} - - -template -inline bool Foam::isNull(const T* t) -{ - return t == NullObjectPtr(); -} - -template -inline bool Foam::notNull(const T* t) -{ - return t != NullObjectPtr(); -} - - -// ************************************************************************* // +#warning File removed - left for old dependency check only diff --git a/src/OpenFOAM/primitives/one/one.H b/src/OpenFOAM/primitives/one/one.H index 20f3c7e527..3c1758174b 100644 --- a/src/OpenFOAM/primitives/one/one.H +++ b/src/OpenFOAM/primitives/one/one.H @@ -28,11 +28,14 @@ Class Description A class representing the concept of 1 (one), which can be used to avoid - manipulating objects that are known to be 'one' at compile-time. + manipulating objects that are known to be \em one at compile-time. SourceFiles oneI.H +SeeAlso + Foam::zero + \*---------------------------------------------------------------------------*/ #ifndef one_H diff --git a/src/OpenFOAM/primitives/zero/zero.H b/src/OpenFOAM/primitives/zero/zero.H index 1dc512948e..99d50777ec 100644 --- a/src/OpenFOAM/primitives/zero/zero.H +++ b/src/OpenFOAM/primitives/zero/zero.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- | Copyright (C) 2011-2016 OpenFOAM Foundation @@ -28,12 +28,15 @@ Class Description A class representing the concept of 0 (zero), which can be used to avoid - manipulating objects that are known to be 'zero' at compile-time. + manipulating objects that are known to be \em zero at compile-time. SourceFiles zero.C zeroI.H +SeeAlso + Foam::one + \*---------------------------------------------------------------------------*/ #ifndef zero_H @@ -112,7 +115,7 @@ public: static null dummy; //- Null constructible - constexpr null() noexcept{} + constexpr null() noexcept {} //- Construct from Istream consumes no content. explicit constexpr null(Istream&) noexcept {} @@ -121,7 +124,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Global zero +//- Global zero static constexpr const zero Zero; // IOstream Operators