STYLE: consistent declarations for oneField, zeroField etc

This commit is contained in:
Mark Olesen
2019-11-19 09:38:52 +01:00
committed by Andrew Heather
parent 2d080ff331
commit cf917b4103
8 changed files with 47 additions and 95 deletions

View File

@ -65,7 +65,7 @@ public:
// Member Operators
inline oneField operator[](const label) const
oneField operator[](const label) const
{
return oneField();
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -60,13 +61,15 @@ public:
// Constructors
//- Construct null
zeroFieldField()
{}
zeroFieldField() = default;
// Member Operators
inline zeroField operator[](const label) const;
zeroField operator[](const label) const
{
return zeroField();
}
};
@ -74,10 +77,6 @@ public:
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "zeroFieldFieldI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif

View File

@ -1,38 +1 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "zeroFieldField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::zeroField Foam::zeroFieldField::operator[](const label) const
{
return zeroField();
}
// ************************************************************************* //
#warning File removed - left for old dependency check only

View File

@ -68,17 +68,20 @@ public:
oneField() = default;
// Member Operators
// Member Functions
inline one operator[](const label) const
{
return one();
}
inline oneField field() const
oneField field() const
{
return oneField();
}
// Member Operators
one operator[](const label) const
{
return one();
}
};

View File

@ -26,11 +26,11 @@ License
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline const oneField& operator*(const oneField& of, const oneField&)
{
return of;
@ -46,5 +46,4 @@ inline const oneField& operator/(const oneField& of, const oneField&)
} // End namespace Foam
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,19 +60,33 @@ public:
// Constructors
//- Construct null
zeroField()
{}
zeroField() = default;
// Member Functions
zeroField field() const
{
return zeroField();
}
// Member Operators
inline scalar operator[](const label) const;
scalar operator[](const label) const
{
return scalar(0);
}
inline zeroField field() const;
zeroField operator()() const
{
return zeroField();
}
inline zeroField operator()() const;
inline zeroField operator-() const;
zeroField operator-() const
{
return zeroField();
}
};

View File

@ -25,40 +25,10 @@ License
\*---------------------------------------------------------------------------*/
#include "zeroField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::scalar Foam::zeroField::operator[](const label) const
{
return scalar(0);
}
inline Foam::zeroField Foam::zeroField::field() const
{
return zeroField();
}
inline Foam::zeroField Foam::zeroField::operator()() const
{
return zeroField();
}
inline Foam::zeroField Foam::zeroField::operator-() const
{
return zeroField();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline const zeroField operator+(const zeroField&, const zeroField&)
{

View File

@ -34,7 +34,7 @@ License
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline constexpr zero operator+(const zero&, const zero&) noexcept
{
@ -93,6 +93,9 @@ inline constexpr zero operator/(const zero&, const Type& val) noexcept
return Zero;
}
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
inline zero min(const zero&, const zero&)
{
return Zero;