diff --git a/applications/test/List/Test-List.C b/applications/test/List/Test-List.C
index a09ac01ab6..c78ddaac88 100644
--- a/applications/test/List/Test-List.C
+++ b/applications/test/List/Test-List.C
@@ -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;
}
diff --git a/applications/test/constantFields/Make/files b/applications/test/constantFields/Make/files
new file mode 100644
index 0000000000..02ad66be1b
--- /dev/null
+++ b/applications/test/constantFields/Make/files
@@ -0,0 +1,3 @@
+Test-constantFields.C
+
+EXE = $(FOAM_USER_APPBIN)/Test-constantFields
diff --git a/applications/test/constantFields/Make/options b/applications/test/constantFields/Make/options
new file mode 100644
index 0000000000..d27c95d033
--- /dev/null
+++ b/applications/test/constantFields/Make/options
@@ -0,0 +1,7 @@
+EXE_INC = \
+ -I$(LIB_SRC)/finiteVolume/lnInclude \
+ -I$(LIB_SRC)/meshTools/lnInclude
+
+EXE_LIBS = \
+ -lfiniteVolume \
+ -lmeshTools
diff --git a/applications/test/constantFields/Test-constantFields.C b/applications/test/constantFields/Test-constantFields.C
new file mode 100644
index 0000000000..af34d90db5
--- /dev/null
+++ b/applications/test/constantFields/Test-constantFields.C
@@ -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 .
+
+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;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/test/field1/Test-field1.C b/applications/test/field1/Test-field1.C
index 77e046d161..2cd6bc6c01 100644
--- a/applications/test/field1/Test-field1.C
+++ b/applications/test/field1/Test-field1.C
@@ -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 mySumSqr(const UList& 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);
diff --git a/applications/test/tensorFieldFields1/Test-tensorFieldFields1.C b/applications/test/tensorFieldFields1/Test-tensorFieldFields1.C
index 3c93f17753..ad9cf11ddf 100644
--- a/applications/test/tensorFieldFields1/Test-tensorFieldFields1.C
+++ b/applications/test/tensorFieldFields1/Test-tensorFieldFields1.C
@@ -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 tff1(1);
- tff1.set(0, new tensorField(1, t19));
+ tff1.set(0, new tensorField(one{}, t19));
FixedList, 9> cmpts;
allocComponents(cmpts, 1);
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
Info<< nl << "symmTensorField" << nl;
FieldField 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, 6> cmpts;
allocComponents(cmpts, 1);
@@ -224,7 +224,7 @@ int main(int argc, char *argv[])
Info<< nl << "sphericalTensorField" << nl;
FieldField sf1(1);
- sf1.set(0, new sphericalTensorField(1, sphericalTensor(4)));
+ sf1.set(0, new sphericalTensorField(one{}, sphericalTensor(4)));
FixedList, 1> cmpts;
allocComponents(cmpts, 1);
diff --git a/applications/test/tensorFields1/Test-tensorFields1.C b/applications/test/tensorFields1/Test-tensorFields1.C
index 9604704f25..c6e0598bd9 100644
--- a/applications/test/tensorFields1/Test-tensorFields1.C
+++ b/applications/test/tensorFields1/Test-tensorFields1.C
@@ -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;
diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectList/IndirectList.H b/src/OpenFOAM/containers/IndirectLists/IndirectList/IndirectList.H
index f79a9a6c27..63c43d4792 100644
--- a/src/OpenFOAM/containers/IndirectLists/IndirectList/IndirectList.H
+++ b/src/OpenFOAM/containers/IndirectLists/IndirectList/IndirectList.H
@@ -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& values, const labelUList& addr);
- //- Move construct addressing, shallow copy values list reference
+ //- Move construct addressing, shallow copy values reference
inline IndirectList(const UList& values, labelList&& addr);
- //- Copy construct addressing, shallow copy values list reference
+ //- Zero-sized addressing, shallow copy values reference
+ inline IndirectList(const UList& values, const Foam::zero);
+
+ //- Copy construct addressing, shallow copy values reference
inline IndirectList(const IndirectList& list);
- //- Move construct addressing, shallow copy values list reference
+ //- Move construct addressing, shallow copy values reference
inline IndirectList(IndirectList&& list);
- //- Copy construct addressing, shallow copy values list reference
+ //- Copy construct addressing, shallow copy values reference
inline explicit IndirectList(const UIndirectList& list);
diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectList/IndirectListI.H b/src/OpenFOAM/containers/IndirectLists/IndirectList/IndirectListI.H
index 13e8dcd7c5..76b3415844 100644
--- a/src/OpenFOAM/containers/IndirectLists/IndirectList/IndirectListI.H
+++ b/src/OpenFOAM/containers/IndirectLists/IndirectList/IndirectListI.H
@@ -60,6 +60,22 @@ inline Foam::IndirectList::IndirectList
{}
+template
+inline Foam::IndirectList::IndirectList
+(
+ const UList& values,
+ const Foam::zero
+)
+:
+ IndirectListAddressing(labelList()), // zero-size addressing
+ UIndirectList
+ (
+ values,
+ IndirectListAddressing::addressing()
+ )
+{}
+
+
template
inline Foam::IndirectList::IndirectList(const IndirectList& list)
:
diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBase.H b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBase.H
index ac10191c7b..95fa0d3fe6 100644
--- a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBase.H
+++ b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBase.H
@@ -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
diff --git a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseI.H b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseI.H
index db117469e7..bc1aa07431 100644
--- a/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseI.H
+++ b/src/OpenFOAM/containers/IndirectLists/IndirectListBase/IndirectListBaseI.H
@@ -156,7 +156,7 @@ inline void Foam::IndirectListBase::operator=(const T& val)
template
-inline void Foam::IndirectListBase::operator=(const zero)
+inline void Foam::IndirectListBase::operator=(const Foam::zero)
{
// Or std::fill(this->begin(), this->end(), Zero);
for (const label idx : addr_)
diff --git a/src/OpenFOAM/containers/IndirectLists/UIndirectList/UIndirectList.H b/src/OpenFOAM/containers/IndirectLists/UIndirectList/UIndirectList.H
index f252a7921d..8fc20ac6fe 100644
--- a/src/OpenFOAM/containers/IndirectLists/UIndirectList/UIndirectList.H
+++ b/src/OpenFOAM/containers/IndirectLists/UIndirectList/UIndirectList.H
@@ -71,13 +71,13 @@ public:
// Constructors
- //- Shallow copy values and addressing arrays
+ //- Shallow copy values and addressing
UIndirectList(const UList& values, const labelUList& addr)
:
IndirectListBase(values, addr)
{}
- //- Copy construct (shallow copy of values and addressing arrays)
+ //- Copy construct (shallow copy values and addressing)
UIndirectList(const UIndirectList& list)
:
UIndirectList(list.values(), list.addressing())
diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
index 2170385c51..9a81878b5d 100644
--- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
+++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H
@@ -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& 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& lst);
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
index 6c0361c549..ac652d033d 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedList.H
@@ -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]);
diff --git a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H
index bb24c9a64e..e93be1b5fa 100644
--- a/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H
+++ b/src/OpenFOAM/containers/Lists/FixedList/FixedListI.H
@@ -53,7 +53,7 @@ inline Foam::FixedList::FixedList(const T& val)
template
-inline Foam::FixedList::FixedList(const zero)
+inline Foam::FixedList::FixedList(const Foam::zero)
{
for (unsigned i=0; i::List(const label len, const T& val)
template
-Foam::List::List(const label len, const zero)
+Foam::List::List(const label len, const Foam::zero)
:
UList(nullptr, len)
{
@@ -157,7 +157,7 @@ Foam::List::List(const label len, const zero)
template
-Foam::List::List(const one, const T& val)
+Foam::List::List(const Foam::one, const T& val)
:
UList(new T[1], 1)
{
@@ -166,7 +166,7 @@ Foam::List::List(const one, const T& val)
template
-Foam::List::List(const one, T&& val)
+Foam::List::List(const Foam::one, T&& val)
:
UList(new T[1], 1)
{
@@ -175,7 +175,7 @@ Foam::List::List(const one, T&& val)
template
-Foam::List::List(const one, const zero)
+Foam::List::List(const Foam::one, const Foam::zero)
:
UList(new T[1], 1)
{
diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H
index 3f8b19d71e..fb07dc4b95 100644
--- a/src/OpenFOAM/containers/Lists/List/List.H
+++ b/src/OpenFOAM/containers/Lists/List/List.H
@@ -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& 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&& list);
diff --git a/src/OpenFOAM/containers/Lists/List/ListI.H b/src/OpenFOAM/containers/Lists/List/ListI.H
index f57187f979..a7b0aca30c 100644
--- a/src/OpenFOAM/containers/Lists/List/ListI.H
+++ b/src/OpenFOAM/containers/Lists/List/ListI.H
@@ -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::operator=(const T& val)
template
-inline void Foam::List::operator=(const zero)
+inline void Foam::List::operator=(const Foam::zero)
{
UList::operator=(Zero);
}
diff --git a/src/OpenFOAM/containers/Lists/SortableList/SortableList.C b/src/OpenFOAM/containers/Lists/SortableList/SortableList.C
index 4d3d755a2f..5d006387ee 100644
--- a/src/OpenFOAM/containers/Lists/SortableList/SortableList.C
+++ b/src/OpenFOAM/containers/Lists/SortableList/SortableList.C
@@ -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::SortableList(const label size)
template
-inline Foam::SortableList::SortableList(const label size, const zero)
+inline Foam::SortableList::SortableList(const label size, const Foam::zero)
:
- List(size, zero())
+ List(size, Zero)
{}
diff --git a/src/OpenFOAM/containers/Lists/SortableList/SortableList.H b/src/OpenFOAM/containers/Lists/SortableList/SortableList.H
index 263c56e411..51da600d8e 100644
--- a/src/OpenFOAM/containers/Lists/SortableList/SortableList.H
+++ b/src/OpenFOAM/containers/Lists/SortableList/SortableList.H
@@ -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
diff --git a/src/OpenFOAM/containers/Lists/SubList/SubList.H b/src/OpenFOAM/containers/Lists/SubList/SubList.H
index 02ab2d896e..061028554c 100644
--- a/src/OpenFOAM/containers/Lists/SubList/SubList.H
+++ b/src/OpenFOAM/containers/Lists/SubList/SubList.H
@@ -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);
};
diff --git a/src/OpenFOAM/containers/Lists/SubList/SubListI.H b/src/OpenFOAM/containers/Lists/SubList/SubListI.H
index 796f09371b..3ec6aa5fa3 100644
--- a/src/OpenFOAM/containers/Lists/SubList/SubListI.H
+++ b/src/OpenFOAM/containers/Lists/SubList/SubListI.H
@@ -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::operator=(const T& val)
template
-inline void Foam::SubList::operator=(const zero)
+inline void Foam::SubList::operator=(const Foam::zero)
{
UList::operator=(Zero);
}
diff --git a/src/OpenFOAM/containers/Lists/UList/UList.C b/src/OpenFOAM/containers/Lists/UList/UList.C
index 6564cf6642..118c4e1fc0 100644
--- a/src/OpenFOAM/containers/Lists/UList/UList.C
+++ b/src/OpenFOAM/containers/Lists/UList/UList.C
@@ -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::operator=(const T& val)
template
-void Foam::UList::operator=(const zero)
+void Foam::UList::operator=(const Foam::zero)
{
const label len = this->size();
diff --git a/src/OpenFOAM/containers/Lists/UList/UList.H b/src/OpenFOAM/containers/Lists/UList/UList.H
index 19c8321dcd..4335993228 100644
--- a/src/OpenFOAM/containers/Lists/UList/UList.H
+++ b/src/OpenFOAM/containers/Lists/UList/UList.H
@@ -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)
diff --git a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H
index 809e213b69..c6d31e6aca 100644
--- a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H
+++ b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldField.H
@@ -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{};
}
};
diff --git a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H b/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H
deleted file mode 100644
index 7cec1b4541..0000000000
--- a/src/OpenFOAM/fields/FieldFields/oneFieldField/oneFieldFieldI.H
+++ /dev/null
@@ -1 +0,0 @@
-#warning File removed - left for old dependency check only
diff --git a/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldField.H b/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldField.H
index 200affc60d..1a2aa0f5a5 100644
--- a/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldField.H
+++ b/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldField.H
@@ -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{};
}
};
diff --git a/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldFieldI.H b/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldFieldI.H
deleted file mode 100644
index 7cec1b4541..0000000000
--- a/src/OpenFOAM/fields/FieldFields/zeroFieldField/zeroFieldFieldI.H
+++ /dev/null
@@ -1 +0,0 @@
-#warning File removed - left for old dependency check only
diff --git a/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H b/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H
index fcf932f3ed..75761896c6 100644
--- a/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H
+++ b/src/OpenFOAM/fields/Fields/DynamicField/DynamicField.H
@@ -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& list);
diff --git a/src/OpenFOAM/fields/Fields/Field/Field.H b/src/OpenFOAM/fields/Fields/Field/Field.H
index 9737bbcab6..916c0944a1 100644
--- a/src/OpenFOAM/fields/Fields/Field/Field.H
+++ b/src/OpenFOAM/fields/Fields/Field/Field.H
@@ -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
{
-
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& 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
void operator=(const VectorSpace