diff --git a/Common/DataModel/vtkHyperTreeGrid.h b/Common/DataModel/vtkHyperTreeGrid.h index a131f4e2be4a7e95a28787d610dc5559b5b48d99..976c606eacee416bf7e4c93e1b97a3908aebeb89 100644 --- a/Common/DataModel/vtkHyperTreeGrid.h +++ b/Common/DataModel/vtkHyperTreeGrid.h @@ -105,6 +105,12 @@ public: vtkTypeMacro(vtkHyperTreeGrid, vtkDataObject); void PrintSelf(ostream& os, vtkIndent indent) override; + /** + * Invalid index that is returned for undefined nodes, for example for nodes that are out of + * bounds (they can exist with the super cursors). + */ + static constexpr vtkIdType InvalidIndex = ~0; + /** * Set/Get mode squeeze */ diff --git a/Common/DataModel/vtkHyperTreeGridGeometryEntry.cxx b/Common/DataModel/vtkHyperTreeGridGeometryEntry.cxx index 4203023946f2087274457a34604ea0f023fda255..910183dfcbaed37291d827979e5edf239e608b6f 100644 --- a/Common/DataModel/vtkHyperTreeGridGeometryEntry.cxx +++ b/Common/DataModel/vtkHyperTreeGridGeometryEntry.cxx @@ -21,6 +21,16 @@ PURPOSE. See the above copyright notice for more information. #include <cassert> +//----------------------------------------------------------------------------- +vtkHyperTreeGridGeometryEntry::vtkHyperTreeGridGeometryEntry() +{ + this->Index = 0; + for (unsigned int d = 0; d < 3; ++d) + { + this->Origin[d] = 0.; + } +} + //----------------------------------------------------------------------------- void vtkHyperTreeGridGeometryEntry::PrintSelf(ostream& os, vtkIndent indent) { diff --git a/Common/DataModel/vtkHyperTreeGridGeometryEntry.h b/Common/DataModel/vtkHyperTreeGridGeometryEntry.h index 90731ff2829c8a96c07d8b5da92f6d556155a9ca..8714c37b79b032d22e426c5c1f2c095647c62cf2 100644 --- a/Common/DataModel/vtkHyperTreeGridGeometryEntry.h +++ b/Common/DataModel/vtkHyperTreeGridGeometryEntry.h @@ -56,14 +56,7 @@ public: /** * Constructor */ - vtkHyperTreeGridGeometryEntry() - { - this->Index = 0; - for (unsigned int d = 0; d < 3; ++d) - { - this->Origin[d] = 0.; - } - } + vtkHyperTreeGridGeometryEntry(); /** * Constructor diff --git a/Common/DataModel/vtkHyperTreeGridGeometryLevelEntry.cxx b/Common/DataModel/vtkHyperTreeGridGeometryLevelEntry.cxx index beb8f98448b4ef1cf395d81ba649147501046a9d..437cea69918a5e9a30d4208c9d23d86a01e25dc0 100644 --- a/Common/DataModel/vtkHyperTreeGridGeometryLevelEntry.cxx +++ b/Common/DataModel/vtkHyperTreeGridGeometryLevelEntry.cxx @@ -56,8 +56,8 @@ vtkHyperTree* vtkHyperTreeGridGeometryLevelEntry::Initialize( //----------------------------------------------------------------------------- vtkIdType vtkHyperTreeGridGeometryLevelEntry::GetGlobalNodeIndex() const { - assert("pre: not_tree" && this->Tree); - return this->Tree->GetGlobalIndexFromLocal(this->Index); + return this->Tree ? this->Tree->GetGlobalIndexFromLocal(this->Index) + : vtkHyperTreeGrid::InvalidIndex; } //-----------------------------------------------------------------------------