Commit 3bc78e5b authored by Mark Olesen's avatar Mark Olesen

COMP: resolve label-size=64 ambiguities

* The generic templated constructor and assignment
  Eg,
     template<class ListType> DynList(const ListType& lst)

  Provides the best candidate when there is a int32/int64 mismatch:
     DynList<int64_t> list(10)

  The cleanest solution would be avoid the generic templated versions
  entirely, but they are needed when converting from rows of graph data
  (which are stored as LongList). However, this approach introduced some
  odd regressions.
parent 64822c8c
......@@ -119,6 +119,14 @@ public:
//- Construct given size
explicit inline DynList(const label);
//- Construct given integer size
#if WM_LABEL_SIZE == 64
explicit inline DynList(const int32_t nElem)
:
DynList(label(nElem))
{}
#endif
//- Construct from given size and defualt value
explicit inline DynList(const label, const T&);
......@@ -217,10 +225,6 @@ public:
//- Copy of another list
inline void operator=(const DynList<T, staticSize>&);
//- 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;
inline bool operator!=(const DynList<T, staticSize>&) const;
......
......@@ -606,28 +606,6 @@ inline void Foam::Module::DynList<T, staticSize>::operator=
}
template<class T, Foam::label staticSize>
template<class ListType>
inline void Foam::Module::DynList<T, staticSize>::operator=(const ListType& l)
{
# 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];
}
}
template<class T, Foam::label staticSize>
inline bool Foam::Module::DynList<T, staticSize>::operator==
(
......
......@@ -121,7 +121,7 @@ void Foam::Module::meshOctree::setOctantVectorsAndPositions()
// set vrtLeavesPos_
for (label vrtI = 0; vrtI < 8; ++vrtI)
{
FixedList<label, 3> vc(0);
FixedList<label, 3> vc(Zero);
if (vrtI & 1)
{
......@@ -142,7 +142,7 @@ void Foam::Module::meshOctree::setOctantVectorsAndPositions()
for (label i = 0; i < 8; ++i)
{
FixedList<label, 3> pos;
FixedList<label, 3> pos(Zero);
for (label j = 0; j < 3; ++j)
{
......
......@@ -136,7 +136,8 @@ void Foam::Module::meshOctreeAutomaticRefinement::setMaxRefLevel()
{
finished = false;
const scalar lSize = size/pow(2, label(maxRefLevel_));
const scalar lSize = size/pow(label(2), label(maxRefLevel_));
// Or: const scalar lSize = size/(1L << maxRefLevel_);
if (lSize < cs)
{
......
......@@ -81,12 +81,15 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = size/Foam::pow(2, label(globalRefLevel_));
const scalar lSize = size/Foam::pow(label(2), label(globalRefLevel_));
// Or: const scalar lSize = size/(1L << globalRefLevel_);
if (lSize <(maxSize*(1.0 - SMALL)))
{
const scalar bbSize =
0.5*maxSize*Foam::pow(2, label(globalRefLevel_));
0.5*maxSize*Foam::pow(label(2), label(globalRefLevel_));
// Or: const scalar bbSize = 0.5*maxSize*(1L << globalRefLevel_);
rootBox.max() = c + point(bbSize, bbSize, bbSize);
rootBox.min() = c - point(bbSize, bbSize, bbSize);
finished = true;
......@@ -132,7 +135,8 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = maxSize/Foam::pow(2, addLevel);
const scalar lSize = maxSize/Foam::pow(label(2), addLevel);
// Or: const scalar lSize = maxSize/(1L << addLevel);
if (lSize <= cs)
{
......@@ -237,7 +241,8 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = maxSize/Foam::pow(2, addLevel);
const scalar lSize = maxSize/Foam::pow(label(2), addLevel);
// Or: const scalar lSize = maxSize/(1L << addLevel);
if (lSize <= cs)
{
......@@ -321,7 +326,8 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = maxSize/Foam::pow(2, addLevel);
const scalar lSize = maxSize/Foam::pow(label(2), addLevel);
// Or: const scalar lSize = maxSize/(1L << addLevel);
if (lSize <= cs)
{
......@@ -405,7 +411,9 @@ void Foam::Module::meshOctreeCreator::setRootCubeSizeAndRefParameters()
{
finished = false;
const scalar lSize = maxSize/Foam::pow(2, nLevel);
const scalar lSize =
maxSize/Foam::pow(label(2), nLevel);
// Or: const scalar lSize = maxSize/(1L << nLevel);
if (lSize <= cs)
{
......
......@@ -96,7 +96,7 @@ Foam::Module::meshOctreeCubeCoordinates::refineForPosition
) const
{
//- create new boxes in z-order fashion
FixedList<label, 3> addPos(0);
FixedList<label, 3> addPos(Zero);
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