Commit 780125f8 authored by Sandro Christian Wenzel's avatar Sandro Christian Wenzel
Browse files

NavigationState: simple checksum function and more verbose printing

parent e299af1b
Pipeline #1269888 passed with stage
in 10 minutes and 41 seconds
......@@ -66,6 +66,8 @@ struct Index2PVolumeConverter {
return &vecgeom::globaldevicegeomdata::GetCompactPlacedVolBuffer()[index];
#else
#ifndef VECCORE_CUDA
assert(vecgeom::GeoManager::gCompactPlacedVolBuffer == nullptr ||
vecgeom::GeoManager::gCompactPlacedVolBuffer[index].id() == index);
return &vecgeom::GeoManager::gCompactPlacedVolBuffer[index];
#else
// this is the case when we compile with nvcc for host side
......@@ -417,6 +419,17 @@ public:
void printValueSequence(std::ostream & = std::cerr) const;
// calculates a checksum along the path
// can be used (as a quick criterion) to see whether 2 states are same
unsigned long getCheckSum() const
{
unsigned long s = 0;
for (int i = 0; i < fCurrentLevel; ++i) {
s += (ValueAt(i) + 1); // + 1 as offset otherwise may not distinguish TOP level and OUTSIDE level
}
return s;
}
#ifdef VECGEOM_ROOT
VECGEOM_FORCE_INLINE
void printVolumePath(std::ostream & = std::cerr) const;
......@@ -626,7 +639,7 @@ void NavigationState::Dump() const
inline void NavigationState::printValueSequence(std::ostream &stream) const
{
for (int i = 0; i < fCurrentLevel; ++i) {
stream << "/" << fPath[i];
stream << "/" << fPath[i] << "(" << At(i)->GetLabel() << ")";
}
}
......
Supports Markdown
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