Commit 362722e9 authored by Andrew Heather's avatar Andrew Heather

Revert "COMP: resolve label-size=64 ambiguities for clang"

This reverts commit 89e12df4
due to causing multiple tutorial failures.

Temporary measure for OpenFOAM-v1712 - to be revisited post-release
parent 57b9896a
......@@ -77,7 +77,7 @@ template<class T, Foam::label staticSize = 16>
class DynList
{
// Private data
//
//- pointer to the data
T* dataPtr_;
......@@ -108,14 +108,6 @@ class DynList
//- check if nAllocated_ is greater or equal to nextFree_
inline void checkAllocation() const;
//- Copy construct from almost any other type of list
template<class ListType>
inline void copyConstructList(const ListType& lst);
//- Copy assign from almost any other type of list
template<class ListType>
inline void copyAssignList(const ListType& lst);
public:
......@@ -125,15 +117,7 @@ public:
inline DynList();
//- Construct given size
explicit inline DynList(const label nElem);
//- Construct given integer size
#if WM_LABEL_SIZE == 64
explicit inline DynList(const int32_t nElem)
:
DynList(label(nElem))
{}
#endif
explicit inline DynList(const label);
//- Construct from given size and defualt value
explicit inline DynList(const label, const T&);
......@@ -228,18 +212,14 @@ public:
inline const T& rcValue(const label index) const;
//- Assignment of all entries to the given value
inline void operator=(const T& val);
//- Copy of another list
template<label AnySize>
inline void operator=(const DynList<T, AnySize>&);
inline void operator=(const T&);
//- Copy of another list
inline void operator=(const UList<T>& lst);
inline void operator=(const DynList<T, staticSize>&);
//- Copy of another list
template<unsigned FixedSize>
inline void operator=(const FixedList<T, FixedSize>& lst);
//- Copy of another list type
template<class ListType>
inline void operator=(const ListType&);
//- Compare the list with the another one
inline bool operator==(const DynList<T, staticSize>&) const;
......
......@@ -124,50 +124,6 @@ inline void Foam::Module::DynList<T, staticSize>::checkAllocation() const
}
template<class T, Foam::label staticSize>
template<class ListType>
inline void Foam::Module::DynList<T, staticSize>::copyConstructList
(
const ListType& lst
)
{
setSize(lst.size());
for (label i = 0; i < nextFree_; ++i)
{
this->operator[](i) = lst[i];
}
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
template<class ListType>
inline void Foam::Module::DynList<T, staticSize>::copyAssignList
(
const ListType& lst
)
{
# ifdef DEBUG
checkAllocation();
# endif
allocateSize(lst.size());
nextFree_ = lst.size();
# ifdef DEBUG
checkAllocation();
# endif
for (label i = 0; i < nextFree_; ++i)
{
this->operator[](i) = lst[i];
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class T, Foam::label staticSize>
......@@ -179,25 +135,35 @@ inline Foam::Module::DynList<T, staticSize>::DynList()
nextFree_(0)
{
setSize(0);
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline Foam::Module::DynList<T, staticSize>::DynList(const label nElem)
inline Foam::Module::DynList<T, staticSize>::DynList(const label s)
:
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{
setSize(nElem);
setSize(s);
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline Foam::Module::DynList<T, staticSize>::DynList
(
const label nElem,
const label s,
const T& val
)
:
......@@ -206,44 +172,65 @@ inline Foam::Module::DynList<T, staticSize>::DynList
staticData_(),
nextFree_(0)
{
setSize(nElem);
setSize(s);
for (label i = 0; i < nElem; ++i)
for (label i = 0; i < s; ++i)
{
this->operator[](i) = val;
}
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline Foam::Module::DynList<T, staticSize>::DynList(const UList<T>& lst)
inline Foam::Module::DynList<T, staticSize>::DynList(const UList<T>& ul)
:
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{
copyConstructList(lst);
setSize(ul.size());
forAll(ul, i)
{
this->operator[](i) = ul[i];
}
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
template<class ListType>
inline Foam::Module::DynList<T, staticSize>::DynList(const ListType& lst)
inline Foam::Module::DynList<T, staticSize>::DynList(const ListType& l)
:
dataPtr_(nullptr),
nAllocated_(0),
staticData_(),
nextFree_(0)
{
copyConstructList(lst);
setSize(l.size());
for (label i = 0; i < nextFree_; ++i)
{
this->operator[](i) = l[i];
}
# ifdef DEBUG
checkAllocation();
# endif
}
template<class T, Foam::label staticSize>
inline Foam::Module::DynList<T, staticSize>::DynList
(
const DynList<T, staticSize>& lst
const DynList<T, staticSize>& dl
)
:
dataPtr_(nullptr),
......@@ -251,7 +238,15 @@ inline Foam::Module::DynList<T, staticSize>::DynList
staticData_(),
nextFree_(0)
{
copyConstructList(lst);
setSize(dl.size());
for (label i = 0; i < nextFree_; ++i)
{
this->operator[](i) = dl[i];
}
# ifdef DEBUG
checkAllocation();
# endif
}
......@@ -588,34 +583,48 @@ inline void Foam::Module::DynList<T, staticSize>::operator=(const T& t)
template<class T, Foam::label staticSize>
template<Foam::label AnySize>
inline void Foam::Module::DynList<T, staticSize>::operator=
(
const DynList<T, AnySize>& lst
const DynList<T, staticSize>& dl
)
{
copyAssignList(lst);
}
# ifdef DEBUG
checkAllocation();
# endif
allocateSize(dl.size());
nextFree_ = dl.size();
template<class T, Foam::label staticSize>
inline void Foam::Module::DynList<T, staticSize>::operator=
(
const UList<T>& lst
)
{
copyAssignList(lst);
# ifdef DEBUG
checkAllocation();
# endif
for (label i = 0; i < nextFree_; ++i)
{
this->operator[](i) = dl[i];
}
}
template<class T, Foam::label staticSize>
template<unsigned FixedSize>
inline void Foam::Module::DynList<T, staticSize>::operator=
(
const FixedList<T, FixedSize>& lst
)
template<class ListType>
inline void Foam::Module::DynList<T, staticSize>::operator=(const ListType& l)
{
copyAssignList(lst);
# ifdef DEBUG
checkAllocation();
# endif
allocateSize(l.size());
nextFree_ = l.size();
# ifdef DEBUG
checkAllocation();
# endif
for (label i = 0; i < nextFree_; ++i)
{
this->operator[](i) = l[i];
}
}
......
......@@ -121,7 +121,7 @@ void Foam::Module::meshOctree::setOctantVectorsAndPositions()
// set vrtLeavesPos_
for (label vrtI = 0; vrtI < 8; ++vrtI)
{
FixedList<label, 3> vc(Zero);
FixedList<label, 3> vc(0);
if (vrtI & 1)
{
......@@ -142,7 +142,7 @@ void Foam::Module::meshOctree::setOctantVectorsAndPositions()
for (label i = 0; i < 8; ++i)
{
FixedList<label, 3> pos(Zero);
FixedList<label, 3> pos;
for (label j = 0; j < 3; ++j)
{
......
......@@ -136,7 +136,7 @@ void Foam::Module::meshOctreeAutomaticRefinement::setMaxRefLevel()
{
finished = false;
const scalar lSize = size/pow(label(2), label(maxRefLevel_));
const scalar lSize = size/pow(2, label(maxRefLevel_));
if (lSize < cs)
{
......
......@@ -81,12 +81,12 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = size/Foam::pow(label(2), label(globalRefLevel_));
const scalar lSize = size/Foam::pow(2, label(globalRefLevel_));
if (lSize <(maxSize*(1.0 - SMALL)))
{
const scalar bbSize =
0.5*maxSize*Foam::pow(label(2), label(globalRefLevel_));
0.5*maxSize*Foam::pow(2, label(globalRefLevel_));
rootBox.max() = c + point(bbSize, bbSize, bbSize);
rootBox.min() = c - point(bbSize, bbSize, bbSize);
finished = true;
......@@ -132,7 +132,7 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = maxSize/Foam::pow(label(2), addLevel);
const scalar lSize = maxSize/Foam::pow(2, addLevel);
if (lSize <= cs)
{
......@@ -237,7 +237,7 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = maxSize/Foam::pow(label(2), addLevel);
const scalar lSize = maxSize/Foam::pow(2, addLevel);
if (lSize <= cs)
{
......@@ -321,7 +321,7 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = maxSize/Foam::pow(label(2), addLevel);
const scalar lSize = maxSize/Foam::pow(2, addLevel);
if (lSize <= cs)
{
......@@ -405,8 +405,7 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize =
maxSize/Foam::pow(label(2), nLevel);
const scalar lSize = maxSize/Foam::pow(2, nLevel);
if (lSize <= cs)
{
......
......@@ -96,7 +96,7 @@ Foam::Module::meshOctreeCubeCoordinates::refineForPosition
) const
{
//- create new boxes in z-order fashion
FixedList<label, 3> addPos(Zero);
FixedList<label, 3> addPos(0);
if (i & 1)
{
addPos[0] = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment