Commit d4912038 authored by Andreas Dedner's avatar Andreas Dedner

id type = int becomes quickly too small, e.g., assert in

dune/alugrid/3d/indexsets.hh:504 fails
alugrid_assert ( creatorNumber < nEntitiesFactor[creatorCodim] * nElements );
with for example nEntitiesFactor[creatorCodim]=2 and
const typename IdType::IntegerType nElements = std::pow(nChildren,level);
                                             = 5^13 = 1220703125
The compare in the assert is then done after converting to int - which causes problems

The question is if unsigned int is big enough or if we want unsigned long?
parent 06f216d7
Pipeline #22274 failed with stage
in 26 minutes and 30 seconds
......@@ -181,7 +181,7 @@ namespace Dune
//
// The template parameter IntegerType allows to switch between
// more elements in the grid and a smaller size of the global Ids
template <class MacroKeyImp, class IntegerImp = int>
template <class MacroKeyImp, class IntegerImp = unsigned int>
class ALUGridId
{
public:
......@@ -196,7 +196,7 @@ namespace Dune
public:
ALUGridId() : key_()
, nChild_(-1)
, nChild_(0)
, codim_(-1)
, level_(-1)
{}
......@@ -256,25 +256,25 @@ namespace Dune
}
const MacroKeyImp & getKey() const { return key_; }
IntegerType nChild() const { return nChild_; }
IntegerType nChild() const { return nChild_-1; }
int codim() const { return int(codim_) ; }
int level() const { return int(level_) ; }
bool isValid () const
{
return ( (nChild_ >= 0) && (codim_ >= 0) && (level_ >= 0) );
return ( (nChild() >= 0) && (codim_ >= 0) && (level_ >= 0) );
}
void reset()
{
nChild_ = -1;
nChild_ = 0;
codim_ = -1;
level_ = -1;
}
void print(std::ostream & out) const
{
out << "AluGridID: (" << getKey() << "," << nChild_ << "," << int(codim_) << "," << int(level_) << ")";
out << "AluGridID: (" << getKey() << "," << nChild() << "," << int(codim_) << "," << int(level_) << ")";
}
inline friend std::size_t hash_value(const ALUGridId& arg)
......
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