STYLE: prefix zero/one with Foam:: qualifier

ENH: support construction of zero-sized IndirectList

- useful when addressing is to be generated in-place after construction.
  Eg,

      indirectPrimitivePatch myPatches
      (
          IndirectList<face>(mesh.faces(), Zero),
          mesh.points()
      );
      labelList& patchFaces = myPatches.addressing();

      patchFaces.resize(...);
      // populate patchFaces

STYLE: add noexcept for zero/one fields and remove old dependency files

COMP: correct typedefs for geometricOneField, geometricZeroField
This commit is contained in:
Mark Olesen
2020-10-24 13:32:44 +02:00
parent f126e29121
commit 98d05fa80a
62 changed files with 466 additions and 360 deletions

View File

@ -606,14 +606,14 @@ int main(int argc, char *argv[])
}
{
labelListList listlist(one(), identity(5));
labelListList listlist(one{}, identity(5));
Info<<"list-list 1/val:" << listlist << nl;
}
{
labelList content = identity(5);
labelListList listlist(one(), content);
labelListList listlist(one{}, content);
Info<<"list-list 1/copy val:" << listlist
<<" - from " << content << nl;
}
@ -621,13 +621,13 @@ int main(int argc, char *argv[])
{
labelList content = identity(5);
labelListList listlist(one(), std::move(content));
labelListList listlist(one{}, std::move(content));
Info<<"list-list 1/move val:" << listlist
<<" - from " << content << nl;
}
{
labelListList listlist(one(), Zero);
labelListList listlist(one{}, Zero);
Info<<"list-list 1/move val:" << listlist
<< nl;
}

View File

@ -0,0 +1,3 @@
Test-constantFields.C
EXE = $(FOAM_USER_APPBIN)/Test-constantFields

View File

@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,63 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
Application
Test-constantields
Description
Simple compilation tests for constant fields
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "geometricOneField.H"
#include "geometricZeroField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
{
geometricZeroField fld0;
geometricOneField fld1;
Info<< "dims 0: " << fld0.dimensions() << nl;
Info<< "internal 0: " << scalar(fld0.internalField()[0]) << nl;
Info<< "boundary 0: " << scalar(fld0.boundaryField()[0][0]) << nl;
Info<< "dims 1: " << fld1.dimensions() << nl;
Info<< "internal 1: " << scalar(fld1.internalField()[0]) << nl;
Info<< "boundary 1: " << scalar(fld1.boundaryField()[0][0]) << nl;
}
Info<< "\nDone\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -152,7 +152,7 @@ typename outerProduct1<Type>::type mySumSqr(const UList<Type>& f)
int main(int argc, char *argv[])
{
scalarField sfield(10, one());
scalarField sfield(10, one{});
forAll(sfield, i)
{
@ -165,7 +165,7 @@ int main(int argc, char *argv[])
Info<< "negated: " << sfield << nl;
// Does not compile (ambiguous)
// boolField lfield(10, one());
// boolField lfield(10, one{});
boolField lfield(10, true);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
Info<< nl << "tensorFieldField" << nl;
FieldField<Field, tensor> tff1(1);
tff1.set(0, new tensorField(1, t19));
tff1.set(0, new tensorField(one{}, t19));
FixedList<FieldField<Field, scalar>, 9> cmpts;
allocComponents(cmpts, 1);
@ -178,7 +178,7 @@ int main(int argc, char *argv[])
Info<< nl << "symmTensorField" << nl;
FieldField<Field, symmTensor> sf1(1);
sf1.set(0, new symmTensorField(1, symmTensor(1, 2, 3, 4, 5, 6)));
sf1.set(0, new symmTensorField(one{}, symmTensor(1, 2, 3, 4, 5, 6)));
FixedList<FieldField<Field, scalar>, 6> cmpts;
allocComponents(cmpts, 1);
@ -224,7 +224,7 @@ int main(int argc, char *argv[])
Info<< nl << "sphericalTensorField" << nl;
FieldField<Field, sphericalTensor> sf1(1);
sf1.set(0, new sphericalTensorField(1, sphericalTensor(4)));
sf1.set(0, new sphericalTensorField(one{}, sphericalTensor(4)));
FixedList<FieldField<Field, scalar>, 1> cmpts;
allocComponents(cmpts, 1);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -148,7 +148,7 @@ int main(int argc, char *argv[])
tensorField tf1(2, tensor(1, 2, 3, 4, 5, 6, 7, 8, 9));
tf1.last() = tf1.last().T();
scalarField f1(2, one());
scalarField f1(2, one{});
symmTensorField sf1(2, symmTensor::one);
symmTensorField sf2(2, symmTensor::one);
@ -210,9 +210,9 @@ int main(int argc, char *argv[])
{
Info<< nl << "sphericalTensorField" << nl;
scalarField f1(2, one());
sphericalTensorField sf1(2, 1);
sphericalTensorField sf2(2, 2);
scalarField f1(2, one{});
sphericalTensorField sf1(2, sphericalTensor(1));
sphericalTensorField sf2(2, sphericalTensor(2));
tensorField tf1(2, tensor::one);
Info<< (tf1 & sf2) << nl;

View File

@ -31,7 +31,7 @@ Description
A List with indirect addressing.
See also
Foam::UIndirectList for a version without any addressing allocation.
Foam::UIndirectList for a version without addressing allocation.
SourceFiles
IndirectListI.H
@ -63,19 +63,22 @@ public:
// Constructors
//- Copy construct addressing, shallow copy values list reference
//- Copy construct addressing, shallow copy values reference
inline IndirectList(const UList<T>& values, const labelUList& addr);
//- Move construct addressing, shallow copy values list reference
//- Move construct addressing, shallow copy values reference
inline IndirectList(const UList<T>& values, labelList&& addr);
//- Copy construct addressing, shallow copy values list reference
//- Zero-sized addressing, shallow copy values reference
inline IndirectList(const UList<T>& values, const Foam::zero);
//- Copy construct addressing, shallow copy values reference
inline IndirectList(const IndirectList<T>& list);
//- Move construct addressing, shallow copy values list reference
//- Move construct addressing, shallow copy values reference
inline IndirectList(IndirectList<T>&& list);
//- Copy construct addressing, shallow copy values list reference
//- Copy construct addressing, shallow copy values reference
inline explicit IndirectList(const UIndirectList<T>& list);

View File

@ -60,6 +60,22 @@ inline Foam::IndirectList<T>::IndirectList
{}
template<class T>
inline Foam::IndirectList<T>::IndirectList
(
const UList<T>& values,
const Foam::zero
)
:
IndirectListAddressing<labelList>(labelList()), // zero-size addressing
UIndirectList<T>
(
values,
IndirectListAddressing<labelList>::addressing()
)
{}
template<class T>
inline Foam::IndirectList<T>::IndirectList(const IndirectList<T>& list)
:

View File

@ -215,7 +215,7 @@ public:
inline void operator=(const T& val);
//- Assignment of all entries to zero
inline void operator=(const zero);
inline void operator=(const Foam::zero);
//- Deep copy values from a list of the addressed elements
// Fatal if list sizes are not identical

View File

@ -156,7 +156,7 @@ inline void Foam::IndirectListBase<T, Addr>::operator=(const T& val)
template<class T, class Addr>
inline void Foam::IndirectListBase<T, Addr>::operator=(const zero)
inline void Foam::IndirectListBase<T, Addr>::operator=(const Foam::zero)
{
// Or std::fill(this->begin(), this->end(), Zero);
for (const label idx : addr_)

View File

@ -71,13 +71,13 @@ public:
// Constructors
//- Shallow copy values and addressing arrays
//- Shallow copy values and addressing
UIndirectList(const UList<T>& values, const labelUList& addr)
:
IndirectListBase<T, labelUList>(values, addr)
{}
//- Copy construct (shallow copy of values and addressing arrays)
//- Copy construct (shallow copy values and addressing)
UIndirectList(const UIndirectList<T>& list)
:
UIndirectList<T>(list.values(), list.addressing())

View File

@ -124,7 +124,7 @@ public:
inline DynamicList(const label nElem, const T& val);
//- Construct with given size initializing all elements to zero
inline DynamicList(const label nElem, const zero);
inline DynamicList(const label nElem, const Foam::zero);
//- Copy construct.
inline DynamicList(const DynamicList<T, SizeMin>& lst);
@ -319,7 +319,7 @@ public:
inline void operator=(const T& val);
//- Assignment of all entries to zero
inline void operator=(const zero);
inline void operator=(const Foam::zero);
//- Assignment to UList
inline void operator=(const UList<T>& lst);

View File

@ -150,7 +150,7 @@ public:
inline explicit FixedList(const T& val);
//- Construct and initialize all entries to zero
inline explicit FixedList(const zero);
inline explicit FixedList(const Foam::zero);
//- Copy construct from C-array
inline explicit FixedList(const T list[N]);

View File

@ -53,7 +53,7 @@ inline Foam::FixedList<T, N>::FixedList(const T& val)
template<class T, unsigned N>
inline Foam::FixedList<T, N>::FixedList(const zero)
inline Foam::FixedList<T, N>::FixedList(const Foam::zero)
{
for (unsigned i=0; i<N; ++i)
{

View File

@ -132,7 +132,7 @@ Foam::List<T>::List(const label len, const T& val)
template<class T>
Foam::List<T>::List(const label len, const zero)
Foam::List<T>::List(const label len, const Foam::zero)
:
UList<T>(nullptr, len)
{
@ -157,7 +157,7 @@ Foam::List<T>::List(const label len, const zero)
template<class T>
Foam::List<T>::List(const one, const T& val)
Foam::List<T>::List(const Foam::one, const T& val)
:
UList<T>(new T[1], 1)
{
@ -166,7 +166,7 @@ Foam::List<T>::List(const one, const T& val)
template<class T>
Foam::List<T>::List(const one, T&& val)
Foam::List<T>::List(const Foam::one, T&& val)
:
UList<T>(new T[1], 1)
{
@ -175,7 +175,7 @@ Foam::List<T>::List(const one, T&& val)
template<class T>
Foam::List<T>::List(const one, const zero)
Foam::List<T>::List(const Foam::one, const Foam::zero)
:
UList<T>(new T[1], 1)
{

View File

@ -133,16 +133,16 @@ public:
List(const label len, const T& val);
//- Construct with given size initializing all elements to zero
List(const label len, const zero);
List(const label len, const Foam::zero);
//- Construct with length=1, copying the value as the only content
List(const one, const T& val);
List(const Foam::one, const T& val);
//- Construct with length=1, moving the value as the only content
List(const one, T&& val);
List(const Foam::one, T&& val);
//- Construct with length=1, initializing content to zero
List(const one, const zero);
List(const Foam::one, const Foam::zero);
//- Copy construct from list
List(const List<T>& a);
@ -283,7 +283,7 @@ public:
inline void operator=(const T& val);
//- Assignment of all entries to zero
inline void operator=(const zero);
inline void operator=(const Foam::zero);
//- Move assignment. Takes constant time
void operator=(List<T>&& list);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -242,7 +242,7 @@ inline void Foam::List<T>::operator=(const T& val)
template<class T>
inline void Foam::List<T>::operator=(const zero)
inline void Foam::List<T>::operator=(const Foam::zero)
{
UList<T>::operator=(Zero);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,9 +46,9 @@ inline Foam::SortableList<T>::SortableList(const label size)
template<class T>
inline Foam::SortableList<T>::SortableList(const label size, const zero)
inline Foam::SortableList<T>::SortableList(const label size, const Foam::zero)
:
List<T>(size, zero())
List<T>(size, Zero)
{}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -81,7 +81,7 @@ public:
//- Construct zero-initialized with given size, sort later.
// The indices remain empty until the list is sorted
inline SortableList(const label size, const zero);
inline SortableList(const label size, const Foam::zero);
//- Construct given size and initial value, sorting later.
// The indices remain empty until the list is sorted

View File

@ -135,7 +135,7 @@ public:
inline void operator=(const T& val);
//- Assign all entries to zero
inline void operator=(const zero);
inline void operator=(const Foam::zero);
};

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -143,7 +143,7 @@ inline void Foam::SubList<T>::operator=(const T& val)
template<class T>
inline void Foam::SubList<T>::operator=(const zero)
inline void Foam::SubList<T>::operator=(const Foam::zero)
{
UList<T>::operator=(Zero);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -172,7 +172,7 @@ void Foam::UList<T>::operator=(const T& val)
template<class T>
void Foam::UList<T>::operator=(const zero)
void Foam::UList<T>::operator=(const Foam::zero)
{
const label len = this->size();

View File

@ -365,7 +365,7 @@ public:
void operator=(const T& val);
//- Assignment of all entries to zero
void operator=(const zero);
void operator=(const Foam::zero);
// Random access iterator (non-const)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,15 +59,15 @@ public:
// Constructors
//- Construct null
oneFieldField() = default;
//- Default construct
oneFieldField() noexcept = default;
// Member Operators
oneField operator[](const label) const
oneField operator[](const label) const noexcept
{
return oneField();
return oneField{};
}
};

View File

@ -1 +0,0 @@
#warning File removed - left for old dependency check only

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,27 +48,26 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class zeroField Declaration
Class zeroFieldField Declaration
\*---------------------------------------------------------------------------*/
class zeroFieldField
:
public zero
{
public:
// Constructors
//- Construct null
zeroFieldField() = default;
//- Default construct
zeroFieldField() noexcept = default;
// Member Operators
zeroField operator[](const label) const
zeroField operator[](const label) const noexcept
{
return zeroField();
return zeroField{};
}
};

View File

@ -1 +0,0 @@
#warning File removed - left for old dependency check only

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -112,7 +112,7 @@ public:
inline DynamicField(const label len, const T& val);
//- Construct given size and initial value of zero
inline DynamicField(const label len, const zero);
inline DynamicField(const label len, const Foam::zero);
//- Copy construct
inline DynamicField(const DynamicField<T, SizeMin>& list);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2015-2019 OpenCFD Ltd.
Copyright (C) 2015-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -81,7 +81,6 @@ class Field
public FieldBase,
public List<Type>
{
public:
//- Component type
@ -114,7 +113,16 @@ public:
inline Field(const label len, const Type& val);
//- Construct given size and initial values of zero
inline Field(const label len, const zero);
inline Field(const label len, const Foam::zero);
//- Construct with length=1, copying the value as the only content
inline Field(const Foam::one, const Type& val);
//- Construct with length=1, moving the value as the only content
inline Field(const Foam::one, Type&& val);
//- Construct with length=1, initializing content to zero
inline Field(const Foam::one, const Foam::zero);
//- Copy construct
inline Field(const Field<Type>& fld);
@ -379,7 +387,7 @@ public:
//- Value assignment
inline void operator=(const Type& val);
inline void operator=(const zero);
inline void operator=(const Foam::zero);
template<class Form, class Cmpt, direction nCmpt>
void operator=(const VectorSpace<Form,Cmpt,nCmpt>&);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,12 +49,33 @@ inline Foam::Field<Type>::Field(const label len, const Type& val)
template<class Type>
inline Foam::Field<Type>::Field(const label len, const zero)
inline Foam::Field<Type>::Field(const label len, const Foam::zero)
:
List<Type>(len, Zero)
{}
template<class Type>
inline Foam::Field<Type>::Field(const Foam::one, const Type& val)
:
List<Type>(Foam::one{}, val)
{}
template<class Type>
inline Foam::Field<Type>::Field(const Foam::one, Type&& val)
:
List<Type>(Foam::one{}, std::move(val))
{}
template<class Type>
inline Foam::Field<Type>::Field(const Foam::one, const Foam::zero)
:
List<Type>(Foam::one{}, Zero)
{}
template<class Type>
inline Foam::Field<Type>::Field(const Field<Type>& fld)
:
@ -181,7 +202,7 @@ inline void Foam::Field<Type>::operator=(const Type& val)
template<class Type>
inline void Foam::Field<Type>::operator=(const zero)
inline void Foam::Field<Type>::operator=(const Foam::zero)
{
List<Type>::operator=(Zero);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2019 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -143,7 +143,7 @@ public:
inline void operator=(const Type& val);
//- Assign all entries to zero
inline void operator=(const zero);
inline void operator=(const Foam::zero);
//- Copy assign via UList operator. Takes linear time.
template<class Form, direction Ncmpts>

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -161,7 +161,7 @@ inline void Foam::SubField<Type>::operator=(const Type& val)
template<class Type>
inline void Foam::SubField<Type>::operator=(const zero)
inline void Foam::SubField<Type>::operator=(const Foam::zero)
{
SubList<Type>::operator=(Zero);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,30 +57,30 @@ class oneField
{
public:
// Public typedefs
// Public Typedefs
typedef oneField FieldType;
// Constructors
//- Construct null
oneField() = default;
//- Default construct
oneField() noexcept = default;
// Member Functions
oneField field() const
oneField field() const noexcept
{
return oneField();
return oneField{};
}
// Member Operators
one operator[](const label) const
one operator[](const label) const noexcept
{
return one();
return one{};
}
};
@ -91,6 +91,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Global Operators
#include "oneFieldI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,17 +31,26 @@ namespace Foam
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline const oneField& operator*(const oneField& of, const oneField&)
inline const oneField& operator*
(
const oneField& of,
const oneField& /*ignore*/
)
{
return of;
}
inline const oneField& operator/(const oneField& of, const oneField&)
inline const oneField& operator/
(
const oneField& of,
const oneField& /*ignore*/
)
{
return of;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -59,33 +59,33 @@ public:
// Constructors
//- Construct null
zeroField() = default;
//- Default construct
zeroField() noexcept = default;
// Member Functions
zeroField field() const
zeroField field() const noexcept
{
return zeroField();
return zeroField{};
}
// Member Operators
scalar operator[](const label) const
scalar operator[](const label) const noexcept
{
return scalar(0);
}
zeroField operator()() const
zeroField operator()() const noexcept
{
return zeroField();
return zeroField{};
}
zeroField operator-() const
zeroField operator-() const noexcept
{
return zeroField();
return zeroField{};
}
};
@ -96,6 +96,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Global Operators
#include "zeroFieldI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,86 +57,83 @@ class geometricOneField
:
public one
{
public:
// Public typedefs
// Public Typedefs
typedef oneField Internal;
typedef oneField Patch;
typedef oneFieldField Boundary;
typedef one cmptType;
// Constructors
//- Construct null
geometricOneField()
{}
//- Default construct
geometricOneField() noexcept = default;
// Member Functions
const dimensionSet& dimensions() const noexcept
{
return dimless;
}
oneField field() const noexcept
{
return oneField{};
}
oneField oldTime() const noexcept
{
return oneField{};
}
Internal internalField() const noexcept
{
return Internal{};
}
Internal primitiveField() const noexcept
{
return Internal{};
}
Boundary boundaryField() const noexcept
{
return Boundary{};
}
// Same as internalField()
Internal v() const noexcept
{
return Internal{};
}
// Member Operators
inline const dimensionSet& dimensions() const;
one operator[](const label) const noexcept
{
return one{};
}
inline one operator[](const label) const;
inline oneField field() const;
inline oneField oldTime() const;
inline Internal operator()() const;
inline Internal v() const;
inline typename Internal::FieldType primitiveField() const;
inline Boundary boundaryField() const;
Internal operator()() const noexcept
{
return Internal{};
}
};
inline const geometricOneField& operator*
(
const geometricOneField&,
const geometricOneField&
);
inline const geometricOneField::Internal& operator*
(
const geometricOneField::Internal&,
const geometricOneField&
);
inline const geometricOneField::Internal& operator*
(
const geometricOneField&,
const geometricOneField::Internal&
);
inline const geometricOneField& operator/
(
const geometricOneField&,
const geometricOneField&
);
inline const geometricOneField::Internal& operator/
(
const geometricOneField::Internal&,
const geometricOneField&
);
inline const geometricOneField::Internal& operator/
(
const geometricOneField&,
const geometricOneField::Internal&
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Global Operators
#include "geometricOneFieldI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,120 +26,73 @@ License
\*---------------------------------------------------------------------------*/
#include "geometricOneField.H"
namespace Foam
{
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline const geometricOneField& operator*
(
const geometricOneField& of,
const geometricOneField& /*ignore*/
)
{
return of;
}
inline const geometricOneField::Internal& operator*
(
const geometricOneField::Internal& of,
const geometricOneField& /*ignore*/
)
{
return of;
}
inline const geometricOneField::Internal& operator*
(
const geometricOneField& /*ignore*/,
const geometricOneField::Internal& of
)
{
return of;
}
inline const geometricOneField& operator/
(
const geometricOneField& of,
const geometricOneField& /*ignore*/
)
{
return of;
}
inline const geometricOneField::Internal& operator/
(
const geometricOneField::Internal& of,
const geometricOneField& /*ignore*/
)
{
return of;
}
inline const geometricOneField::Internal& operator/
(
const geometricOneField& /*ignore*/,
const geometricOneField::Internal& of
)
{
return of;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::dimensionSet& Foam::geometricOneField::dimensions() const
{
return dimless;
}
inline Foam::one Foam::geometricOneField::operator[](const label) const
{
return one();
}
inline Foam::oneField Foam::geometricOneField::field() const
{
return oneField();
}
inline Foam::oneField Foam::geometricOneField::oldTime() const
{
return oneField();
}
inline Foam::geometricOneField::Internal
Foam::geometricOneField::operator()() const
{
return Internal();
}
inline Foam::geometricOneField::Internal
Foam::geometricOneField::v() const
{
return Internal();
}
inline typename Foam::geometricOneField::Internal::FieldType
Foam::geometricOneField::primitiveField() const
{
return typename Internal::FieldType();
}
inline Foam::geometricOneField::Boundary
Foam::geometricOneField::boundaryField() const
{
return Boundary();
}
inline const Foam::geometricOneField& Foam::operator*
(
const geometricOneField& gof,
const geometricOneField&
)
{
return gof;
}
inline const Foam::geometricOneField::Internal& Foam::operator*
(
const geometricOneField::Internal& of,
const geometricOneField&
)
{
return of;
}
inline const Foam::geometricOneField::Internal& Foam::operator*
(
const geometricOneField&,
const geometricOneField::Internal& of
)
{
return of;
}
inline const Foam::geometricOneField& Foam::operator/
(
const geometricOneField& gof,
const geometricOneField&
)
{
return gof;
}
inline const Foam::geometricOneField::Internal& Foam::operator/
(
const geometricOneField::Internal& of,
const geometricOneField&
)
{
return of;
}
inline const Foam::geometricOneField::Internal& Foam::operator/
(
const geometricOneField&,
const geometricOneField::Internal& of
)
{
return of;
}
} // End namespace Foam
// ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,10 +57,9 @@ class geometricZeroField
:
public zero
{
public:
// Public typedefs
// Public Typedefs
typedef zeroField Internal;
typedef zeroField Patch;
@ -69,24 +69,60 @@ public:
// Constructors
//- Construct null
geometricZeroField()
{}
//- Default construct
geometricZeroField() noexcept = default;
// Member Functions
const dimensionSet& dimensions() const noexcept
{
return dimless;
}
zeroField field() const noexcept
{
return zeroField{};
}
zeroField oldTime() const noexcept
{
return zeroField{};
}
Internal internalField() const noexcept
{
return Internal{};
}
Internal primitiveField() const noexcept
{
return Internal{};
}
Boundary boundaryField() const noexcept
{
return Boundary{};
}
// Same as internalField()
Internal v() const noexcept
{
return Internal{};
}
// Member Operators
inline const dimensionSet& dimensions() const;
scalar operator[](const label) const noexcept
{
return 0;
}
inline scalar operator[](const label) const;
inline zeroField field() const;
inline zeroField operator()() const;
inline zeroField oldTime() const;
inline zeroFieldField boundaryField() const;
Internal operator()() const noexcept
{
return Internal{};
}
};
@ -96,6 +132,8 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Global Operators
#include "geometricZeroFieldI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -25,39 +25,16 @@ License
\*---------------------------------------------------------------------------*/
#include "geometricZeroField.H"
namespace Foam
{
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
// None defined
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::dimensionSet& Foam::geometricZeroField::dimensions() const
{
return dimless;
}
inline Foam::scalar Foam::geometricZeroField::operator[](const label) const
{
return scalar(0);
}
inline Foam::zeroField Foam::geometricZeroField::field() const
{
return zeroField();
}
inline Foam::zeroField Foam::geometricZeroField::operator()() const
{
return zeroField();
}
inline Foam::zeroField Foam::geometricZeroField::oldTime() const
{
return zeroField();
}
inline Foam::zeroFieldField Foam::geometricZeroField::boundaryField() const
{
return zeroFieldField();
}
} // End namespace Foam
// ************************************************************************* //

View File

@ -38,7 +38,7 @@ Foam::DiagonalMatrix<Type>::DiagonalMatrix(const label n)
template<class Type>
Foam::DiagonalMatrix<Type>::DiagonalMatrix(const label n, const zero)
Foam::DiagonalMatrix<Type>::DiagonalMatrix(const label n, const Foam::zero)
:
List<Type>(n, Zero)
{}

View File

@ -82,7 +82,7 @@ public:
explicit DiagonalMatrix<Type>(const label n);
//- Construct from size and initialise all elems to zero
DiagonalMatrix<Type>(const label n, const zero);
DiagonalMatrix<Type>(const label n, const Foam::zero);
//- Construct from size and initialise all elems to value
DiagonalMatrix<Type>(const label n, const Type& val);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -119,7 +119,7 @@ Foam::Matrix<Form, Type>::Matrix(const label m, const label n)
template<class Form, class Type>
Foam::Matrix<Form, Type>::Matrix(const label m, const label n, const zero)
Foam::Matrix<Form, Type>::Matrix(const label m, const label n, const Foam::zero)
:
mRows_(m),
nCols_(n),
@ -538,7 +538,7 @@ void Foam::Matrix<Form, Type>::operator=(const Type& val)
template<class Form, class Type>
void Foam::Matrix<Form, Type>::operator=(const zero)
void Foam::Matrix<Form, Type>::operator=(const Foam::zero)
{
std::fill(begin(), end(), Zero);
}

View File

@ -131,7 +131,7 @@ public:
//- Construct with given number of rows/columns
//- initializing all elements to zero
Matrix(const label m, const label n, const zero);
Matrix(const label m, const label n, const Foam::zero);
//- Construct with given number of rows/columns
//- initializing all elements to the given value
@ -142,7 +142,7 @@ public:
//- Construct given number of rows/columns
//- initializing all elements to zero
inline Matrix(const labelPair& dims, const zero);
inline Matrix(const labelPair& dims, const Foam::zero);
//- Construct with given number of rows/columns
//- initializing all elements to the given value
@ -417,7 +417,7 @@ public:
void operator=(const MatrixBlock<MatrixType>& Mb);
//- Assignment of all elements to zero
void operator=(const zero);
void operator=(const Foam::zero);
//- Assignment of all elements to the given value
void operator=(const Type& val);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -61,7 +61,7 @@ inline Foam::Matrix<Form, Type>::Matrix(const labelPair& dims)
template<class Form, class Type>
inline Foam::Matrix<Form, Type>::Matrix(const labelPair& dims, const zero)
inline Foam::Matrix<Form, Type>::Matrix(const labelPair& dims, const Foam::zero)
:
Matrix<Form, Type>(dims.first(), dims.second(), Zero)
{}

View File

@ -84,7 +84,12 @@ public:
//- Construct given number of rows/columns
//- initializing all elements to zero
inline RectangularMatrix(const label m, const label n, const zero);
inline RectangularMatrix
(
const label m,
const label n,
const Foam::zero
);
//- Construct given number of rows/columns
//- initializing all elements to the given value
@ -93,14 +98,18 @@ public:
//- Construct for given number of rows/columns
//- initializing all elements to zero, and diagonal to one
template<class AnyType>
inline RectangularMatrix(const labelPair& dims, const Identity<AnyType>);
inline RectangularMatrix
(
const labelPair& dims,
const Identity<AnyType>
);
//- Construct given number of rows/columns by using a label pair
inline explicit RectangularMatrix(const labelPair& dims);
//- Construct given number of rows/columns by using a label pair
//- and initializing all elements to zero
inline RectangularMatrix(const labelPair& dims, const zero);
inline RectangularMatrix(const labelPair& dims, const Foam::zero);
//- Construct given number of rows/columns by using a label pair
//- and initializing all elements to the given value
@ -127,7 +136,7 @@ public:
// Member Operators
//- Assign all elements to zero
inline void operator=(const zero);
inline void operator=(const Foam::zero);
//- Assign all elements to value
inline void operator=(const Type& val);

View File

@ -54,7 +54,7 @@ inline Foam::RectangularMatrix<Type>::RectangularMatrix
(
const label m,
const label n,
const zero
const Foam::zero
)
:
Matrix<RectangularMatrix<Type>, Type>(m, n, Zero)
@ -104,7 +104,7 @@ template<class Type>
inline Foam::RectangularMatrix<Type>::RectangularMatrix
(
const labelPair& dims,
const zero
const Foam::zero
)
:
RectangularMatrix<Type>(dims.first(), dims.second(), Zero)
@ -172,7 +172,7 @@ Foam::RectangularMatrix<Type>::clone() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
inline void Foam::RectangularMatrix<Type>::operator=(const zero)
inline void Foam::RectangularMatrix<Type>::operator=(const Foam::zero)
{
Matrix<RectangularMatrix<Type>, Type>::operator=(Zero);
}

View File

@ -87,7 +87,7 @@ public:
//- Construct for given size (rows == cols)
//- initializing all elements to zero
inline SquareMatrix(const label n, const zero);
inline SquareMatrix(const label n, const Foam::zero);
//- Construct for given size (rows == cols)
//- initializing all elements to the given value
@ -112,7 +112,7 @@ public:
//- by using a labelPair (checked to be equal)
//- and initializing all elements to zero
// For constructor consistency with rectangular matrices
inline SquareMatrix(const labelPair& dims, const zero);
inline SquareMatrix(const labelPair& dims, const Foam::zero);
//- Construct given number of rows/columns
//- by using a labelPair (checked to be equal)
@ -122,7 +122,7 @@ public:
//- Construct given number of rows/columns (checked to be equal)
//- initializing all elements to zero
inline SquareMatrix(const label m, const label n, const zero);
inline SquareMatrix(const label m, const label n, const Foam::zero);
//- Construct from const sub-matrix block
template<class MatrixType>
@ -182,7 +182,7 @@ public:
// Member Operators
//- Assign all elements to zero
inline void operator=(const zero);
inline void operator=(const Foam::zero);
//- Assign all elements to value
inline void operator=(const Type& val);

View File

@ -48,7 +48,7 @@ template<class Type>
inline Foam::SquareMatrix<Type>::SquareMatrix
(
const label n,
const zero
const Foam::zero
)
:
Matrix<SquareMatrix<Type>, Type>(n, n, Zero)
@ -118,7 +118,7 @@ template<class Type>
inline Foam::SquareMatrix<Type>::SquareMatrix
(
const labelPair& dims,
const zero
const Foam::zero
)
:
Matrix<SquareMatrix<Type>, Type>(dims, Zero)
@ -145,7 +145,7 @@ inline Foam::SquareMatrix<Type>::SquareMatrix
(
const label m,
const label n,
const zero
const Foam::zero
)
:
Matrix<SquareMatrix<Type>, Type>(m, n, Zero)
@ -291,7 +291,7 @@ inline bool Foam::SquareMatrix<Type>::tridiagonal() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
inline void Foam::SquareMatrix<Type>::operator=(const zero)
inline void Foam::SquareMatrix<Type>::operator=(const Foam::zero)
{
Matrix<SquareMatrix<Type>, Type>::operator=(Zero);
}

View File

@ -81,7 +81,7 @@ public:
//- Construct for given size (rows == cols)
//- initializing all elements to zero
inline SymmetricSquareMatrix(const label n, const zero);
inline SymmetricSquareMatrix(const label n, const Foam::zero);
//- Construct for given size (rows == cols)
//- initializing all elements to the given value
@ -102,7 +102,7 @@ public:
// Member Operators
//- Assign all elements to zero
inline void operator=(const zero);
inline void operator=(const Foam::zero);
//- Assign all elements to value
inline void operator=(const Type& val);

View File

@ -48,7 +48,7 @@ template<class Type>
inline Foam::SymmetricSquareMatrix<Type>::SymmetricSquareMatrix
(
const label n,
const zero
const Foam::zero
)
:
Matrix<SymmetricSquareMatrix<Type>, Type>(n, n, Zero)
@ -103,7 +103,7 @@ Foam::SymmetricSquareMatrix<Type>::clone() const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Type>
inline void Foam::SymmetricSquareMatrix<Type>::operator=(const zero)
inline void Foam::SymmetricSquareMatrix<Type>::operator=(const Foam::zero)
{
Matrix<SymmetricSquareMatrix<Type>, Type>::operator=(Zero);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -81,7 +81,7 @@ public:
inline IjkField(const labelVector& ijk, const Type& val);
//- Construct with sizing information and initial values of zero
inline IjkField(const labelVector& ijk, const zero);
inline IjkField(const labelVector& ijk, const Foam::zero);
//- Copy construct from components
inline IjkField(const labelVector& ijk, const UList<Type>& list);
@ -161,7 +161,7 @@ public:
//- Value assignment
inline void operator=(const Type& val);
inline void operator=(const zero);
inline void operator=(const Foam::zero);
};

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -75,7 +75,7 @@ template<class Type>
inline Foam::IjkField<Type>::IjkField
(
const labelVector& ijk,
const zero
const Foam::zero
)
:
Field<Type>(cmptProduct(ijk), Zero),
@ -245,7 +245,7 @@ inline void Foam::IjkField<Type>::operator=(const Type& val)
template<class Type>
inline void Foam::IjkField<Type>::operator=(const zero)
inline void Foam::IjkField<Type>::operator=(const Foam::zero)
{
Field<Type>::operator=(Zero);
}

View File

@ -1 +0,0 @@
#warning File removed - left for old dependency check only

View File

@ -33,7 +33,7 @@ inline Foam::cubicEqn::cubicEqn()
inline Foam::cubicEqn::cubicEqn(const Foam::zero)
:
VectorSpace<cubicEqn, scalar, 4>(Foam::zero())
VectorSpace<cubicEqn, scalar, 4>(Foam::zero{})
{}

View File

@ -34,7 +34,7 @@ inline Foam::linearEqn::linearEqn()
inline Foam::linearEqn::linearEqn(const Foam::zero)
:
VectorSpace<linearEqn, scalar, 2>(Foam::zero())
VectorSpace<linearEqn, scalar, 2>(Foam::zero{})
{}

View File

@ -33,7 +33,7 @@ inline Foam::quadraticEqn::quadraticEqn()
inline Foam::quadraticEqn::quadraticEqn(const Foam::zero)
:
VectorSpace<quadraticEqn, scalar, 3>(Foam::zero())
VectorSpace<quadraticEqn, scalar, 3>(Foam::zero{})
{}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -153,7 +153,7 @@ public:
inline MinMax(const Pair<T>& range);
//- Construct with a single zero value
inline explicit MinMax(const zero);
inline explicit MinMax(const Foam::zero);
//- Construct with a single initial value
inline explicit MinMax(const T& val);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -79,7 +79,7 @@ inline Foam::MinMax<T>::MinMax(const Pair<T>& range)
template<class T>
inline Foam::MinMax<T>::MinMax(const zero)
inline Foam::MinMax<T>::MinMax(const Foam::zero)
:
Tuple2<T,T>(pTraits<T>::zero, pTraits<T>::zero)
{}

View File

@ -189,9 +189,9 @@ namespace fvc
);
//- Interpolate 'one' returning 'one'
inline one interpolate(const one&)
inline Foam::one interpolate(const Foam::one&)
{
return one();
return Foam::one{};
}

View File

@ -74,7 +74,7 @@ public:
forceSuSp() = default;
//- Construct zero-initialized content
inline forceSuSp(const zero);
inline forceSuSp(const Foam::zero);
//- Construct given Tuple2
inline forceSuSp(const Tuple2<vector, scalar>& susp);

View File

@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * //
inline Foam::forceSuSp::forceSuSp(const zero)
inline Foam::forceSuSp::forceSuSp(const Foam::zero)
:
Tuple2<vector, scalar>(vector::zero, 0)
{}