[Git][debian-gis-team/spatialindex][upstream] New upstream version 2.0.0~b3

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Wed May 29 14:14:27 BST 2024



Bas Couwenberg pushed to branch upstream at Debian GIS Project / spatialindex


Commits:
aa6c28ff by Bas Couwenberg at 2024-05-29T15:05:59+02:00
New upstream version 2.0.0~b3
- - - - -


14 changed files:

- include/spatialindex/tools/PointerPool.h
- src/CMakeLists.txt
- src/mvrtree/Index.cc
- src/mvrtree/MVRTree.cc
- src/mvrtree/PointerPoolNode.h
- src/rtree/BulkLoader.cc
- src/rtree/PointerPoolNode.h
- src/rtree/RTree.cc
- src/spatialindex/MovingRegion.cc
- src/spatialindex/Region.cc
- src/tprtree/Index.cc
- src/tprtree/Node.cc
- src/tprtree/PointerPoolNode.h
- src/tprtree/TPRTree.cc


Changes:

=====================================
include/spatialindex/tools/PointerPool.h
=====================================
@@ -5,7 +5,7 @@
  * Copyright (c) 2004, Marios Hadjieleftheriou
  *
  * All rights reserved.
- * 
+ *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * to deal in the Software without restriction, including without limitation
@@ -36,11 +36,6 @@ namespace Tools
 	public:
 		explicit PointerPool(uint32_t capacity) : m_capacity(capacity)
 		{
-			#ifndef NDEBUG
-			m_hits = 0;
-			m_misses = 0;
-			m_pointerCount = 0;
-			#endif
 		}
 
 		~PointerPool()
@@ -50,15 +45,8 @@ namespace Tools
 			while (! m_pool.empty())
 			{
 				X* x = m_pool.top(); m_pool.pop();
-				#ifndef NDEBUG
-				--m_pointerCount;
-				#endif
 				delete x;
 			}
-
-			#ifndef NDEBUG
-			std::cerr << "Lost pointers: " << m_pointerCount << std::endl;
-			#endif
 		}
 
 		PoolPointer<X> acquire()
@@ -68,17 +56,10 @@ namespace Tools
 			if (! m_pool.empty())
 			{
 				p = m_pool.top(); m_pool.pop();
-				#ifndef NDEBUG
-				m_hits++;
-				#endif
 			}
 			else
 			{
 				p = new X();
-				#ifndef NDEBUG
-				m_pointerCount++;
-				m_misses++;
-				#endif
 			}
 
 			return PoolPointer<X>(p, this);
@@ -92,9 +73,6 @@ namespace Tools
 			}
 			else
 			{
-				#ifndef NDEBUG
-				--m_pointerCount;
-				#endif
 				delete p;
 			}
 
@@ -112,12 +90,6 @@ namespace Tools
 		uint32_t m_capacity;
 		std::stack<X*> m_pool;
 
-	#ifndef NDEBUG
-	public:
-		uint64_t m_hits;
-		uint64_t m_misses;
-		uint64_t m_pointerCount;
-	#endif
 	};
 }
 


=====================================
src/CMakeLists.txt
=====================================
@@ -201,16 +201,6 @@ target_compile_options(spatialindex
 target_compile_options(spatialindex_c
   PRIVATE ${SIDX_COMMON_CXX_FLAGS})
 
-target_compile_definitions(spatialindex
-    PRIVATE
-        $<$<CONFIG:Debug>:SIDX_DEBUG>
-)
-
-target_compile_definitions(spatialindex_c
-    PRIVATE
-        $<$<CONFIG:Debug>:SIDX_DEBUG>
-)
-
 set_target_properties( spatialindex PROPERTIES
     RUNTIME_OUTPUT_DIRECTORY
     ${CMAKE_BINARY_DIR}/bin)


=====================================
src/mvrtree/Index.cc
=====================================
@@ -180,15 +180,6 @@ uint32_t Index::findLeastEnlargement(const TimeRegion& r) const
 		}
 	}
 
-#ifdef SIDX_DEBUG
-	if (best == std::numeric_limits<uint32_t>::max())
-	{
-		std::ostringstream s;
-		s << "findLeastEnlargement: All entries of node " << m_identifier << " are dead.";
-		throw Tools::IllegalStateException(s.str());
-	}
-#endif
-
 	return best;
 }
 
@@ -237,15 +228,6 @@ uint32_t Index::findLeastOverlap(const TimeRegion& r) const
 		++cLiveEntries;
 	}
 
-#ifdef SIDX_DEBUG
-	if (cLiveEntries == 0)
-	{
-		std::ostringstream s;
-		s << "findLeastOverlap: All entries of node " << m_identifier << " are dead.";
-		throw Tools::IllegalStateException(s.str());
-	}
-#endif
-
 	if (me < -std::numeric_limits<double>::epsilon() || me > std::numeric_limits<double>::epsilon())
 	{
 		uint32_t cIterations;


=====================================
src/mvrtree/MVRTree.cc
=====================================
@@ -1337,16 +1337,5 @@ std::ostream& SpatialIndex::MVRTree::operator<<(std::ostream& os, const MVRTree&
 	os << t.m_stats;
 	os << t.printRootInfo();
 
-	#ifdef SIDX_DEBUG
-	os 	<< "Leaf pool hits: " << t.m_leafPool.m_hits << std::endl
-		<< "Leaf pool misses: " << t.m_leafPool.m_misses << std::endl
-		<< "Index pool hits: " << t.m_indexPool.m_hits << std::endl
-		<< "Index pool misses: " << t.m_indexPool.m_misses << std::endl
-		<< "Region pool hits: " << t.m_regionPool.m_hits << std::endl
-		<< "Region pool misses: " << t.m_regionPool.m_misses << std::endl
-		<< "Point pool hits: " << t.m_pointPool.m_hits << std::endl
-		<< "Point pool misses: " << t.m_pointPool.m_misses << std::endl;
-	#endif
-
 	return os;
 }


=====================================
src/mvrtree/PointerPoolNode.h
=====================================
@@ -36,11 +36,6 @@ namespace Tools
 	public:
 		explicit PointerPool(uint32_t capacity) : m_capacity(capacity)
 		{
-			#ifdef SIDX_DEBUG
-			m_hits = 0;
-			m_misses = 0;
-			m_pointerCount = 0;
-			#endif
 		}
 
 		~PointerPool()
@@ -50,15 +45,7 @@ namespace Tools
 			while (! m_pool.empty())
 			{
 				SpatialIndex::MVRTree::Node* x = m_pool.top(); m_pool.pop();
-				#ifdef SIDX_DEBUG
-				--m_pointerCount;
-				#endif
-				delete x;
 			}
-
-			#ifdef SIDX_DEBUG
-			std::cerr << "Lost pointers: " << m_pointerCount << std::endl;
-			#endif
 		}
 
 		PoolPointer<SpatialIndex::MVRTree::Node> acquire()
@@ -66,21 +53,8 @@ namespace Tools
 			if (! m_pool.empty())
 			{
 				SpatialIndex::MVRTree::Node* p = m_pool.top(); m_pool.pop();
-				#ifdef SIDX_DEBUG
-				++m_hits;
-				#endif
-
 				return PoolPointer<SpatialIndex::MVRTree::Node>(p, this);
 			}
-			#ifdef SIDX_DEBUG
-			else
-			{
-				// fixme: well sort of...
-				++m_pointerCount;
-				++m_misses;
-			}
-			#endif
-
 			return PoolPointer<SpatialIndex::MVRTree::Node>();
 		}
 
@@ -107,9 +81,6 @@ namespace Tools
 				}
 				else
 				{
-					#ifdef SIDX_DEBUG
-					--m_pointerCount;
-					#endif
 					delete p;
 				}
 
@@ -128,12 +99,6 @@ namespace Tools
 		uint32_t m_capacity;
 		std::stack<SpatialIndex::MVRTree::Node*> m_pool;
 
-	#ifdef SIDX_DEBUG
-	public:
-		uint64_t m_hits;
-		uint64_t m_misses;
-		uint64_t m_pointerCount;
-	#endif
 	};
 }
 


=====================================
src/rtree/BulkLoader.cc
=====================================
@@ -333,10 +333,6 @@ void BulkLoader::bulkLoadUsingSTR(
 	NodePtr n = pTree->readNode(pTree->m_rootID);
 	pTree->deleteNode(n.get());
 
-	#ifdef SIDX_DEBUG
-	std::cerr << "RTree::BulkLoader: Sorting data." << std::endl;
-	#endif
-
     std::shared_ptr<ExternalSorter> es = std::shared_ptr<ExternalSorter>(new ExternalSorter(pageSize, numberOfPages));
 
 	while (stream.hasNext())
@@ -360,10 +356,6 @@ void BulkLoader::bulkLoadUsingSTR(
 
 	while (true)
 	{
-		#ifdef SIDX_DEBUG
-		std::cerr << "RTree::BulkLoader: Building level " << level << std::endl;
-		#endif
-
 		pTree->m_stats.m_nodesInLevel.push_back(0);
 
         std::shared_ptr<ExternalSorter> es2 = std::shared_ptr<ExternalSorter>(new ExternalSorter(pageSize, numberOfPages));


=====================================
src/rtree/PointerPoolNode.h
=====================================
@@ -38,11 +38,6 @@ namespace Tools
 	public:
 		explicit PointerPool(uint32_t capacity) : m_capacity(capacity)
 		{
-			#ifdef SIDX_DEBUG
-			m_hits = 0;
-			m_misses = 0;
-			m_pointerCount = 0;
-			#endif
 		}
 
 		~PointerPool()
@@ -52,15 +47,8 @@ namespace Tools
 			while (! m_pool.empty())
 			{
 				RTree::Node* x = m_pool.top(); m_pool.pop();
-				#ifdef SIDX_DEBUG
-				--m_pointerCount;
-				#endif
 				delete x;
 			}
-
-			#ifdef SIDX_DEBUG
-			std::cerr << "Lost pointers: " << m_pointerCount << std::endl;
-			#endif
 		}
 
 		PoolPointer<RTree::Node> acquire()
@@ -68,21 +56,8 @@ namespace Tools
 			if (! m_pool.empty())
 			{
 				RTree::Node* p = m_pool.top(); m_pool.pop();
-				#ifdef SIDX_DEBUG
-				++m_hits;
-				#endif
-
 				return PoolPointer<RTree::Node>(p, this);
 			}
-			#ifdef SIDX_DEBUG
-			else
-			{
-				// fixme: well sort of...
-				++m_pointerCount;
-				++m_misses;
-			}
-			#endif
-
 			return PoolPointer<RTree::Node>();
 		}
 
@@ -112,9 +87,6 @@ namespace Tools
 				}
 				else
 				{
-					#ifdef SIDX_DEBUG
-					--m_pointerCount;
-					#endif
 					delete p;
 				}
 
@@ -133,12 +105,6 @@ namespace Tools
 		uint32_t m_capacity;
 		std::stack<RTree::Node*> m_pool;
 
-	#ifdef SIDX_DEBUG
-	public:
-		uint64_t m_hits;
-		uint64_t m_misses;
-		uint64_t m_pointerCount;
-	#endif
 	};
 }
 


=====================================
src/rtree/RTree.cc
=====================================
@@ -1334,18 +1334,7 @@ SpatialIndex::id_type SpatialIndex::RTree::RTree::writeNode(Node* n)
 		n->m_identifier = page;
 		++(m_stats.m_u32Nodes);
 
-#ifdef SIDX_DEBUG
-		try
-		{
-			m_stats.m_nodesInLevel[n->m_level] = m_stats.m_nodesInLevel.at(n->m_level) + 1;
-		}
-		catch(...)
-		{
-			throw Tools::IllegalStateException("writeNode: writing past the end of m_nodesInLevel.");
-		}
-#else
 		m_stats.m_nodesInLevel[n->m_level] = m_stats.m_nodesInLevel[n->m_level] + 1;
-#endif
 	}
 
 	++(m_stats.m_u64Writes);
@@ -1563,16 +1552,5 @@ std::ostream& SpatialIndex::RTree::operator<<(std::ostream& os, const RTree& t)
 		os	<< "Utilization: " << 100 * t.m_stats.getNumberOfData() / (t.m_stats.getNumberOfNodesInLevel(0) * t.m_leafCapacity) << "%" << std::endl
 			<< t.m_stats;
 
-	#ifdef SIDX_DEBUG
-	os	<< "Leaf pool hits: " << t.m_leafPool.m_hits << std::endl
-		<< "Leaf pool misses: " << t.m_leafPool.m_misses << std::endl
-		<< "Index pool hits: " << t.m_indexPool.m_hits << std::endl
-		<< "Index pool misses: " << t.m_indexPool.m_misses << std::endl
-		<< "Region pool hits: " << t.m_regionPool.m_hits << std::endl
-		<< "Region pool misses: " << t.m_regionPool.m_misses << std::endl
-		<< "Point pool hits: " << t.m_pointPool.m_hits << std::endl
-		<< "Point pool misses: " << t.m_pointPool.m_misses << std::endl;
-	#endif
-
 	return os;
 }


=====================================
src/spatialindex/MovingRegion.cc
=====================================
@@ -183,13 +183,6 @@ void MovingRegion::initialize(
 
 	if (m_endTime <= m_startTime) throw Tools::IllegalArgumentException("MovingRegion: Cannot support degenerate time intervals.");
 
-#ifdef SIDX_DEBUG
-	for (uint32_t cDim = 0; cDim < m_dimension; ++cDim)
-	{
-		if (pLow[cDim] > pHigh[cDim]) throw Tools::IllegalArgumentException("MovingRegion: Low point has larger coordinates than High point.");
-	}
-#endif
-
 	try
 	{
 		m_pLow = new double[m_dimension];
@@ -982,17 +975,10 @@ double MovingRegion::getIntersectingAreaInTime(const IInterval& ivI, const Movin
 
 	// add up the total area of the intersecting pieces.
 	double area = 0.0;
-#ifdef SIDX_DEBUG
-	double _t = -std::numeric_limits<double>::max();
-#endif
 
 	while (! pq.empty())
 	{
 		c = pq.top(); pq.pop();
-#ifdef SIDX_DEBUG
-		assert(_t <= c.m_t);
-		_t = c.m_t;
-#endif
 
 		// needed in case two consecutive points have the same intersection time.
 		if (c.m_t > tmin) area += x.getAreaInTime(Tools::Interval(tmin, c.m_t));


=====================================
src/spatialindex/Region.cc
=====================================
@@ -61,22 +61,6 @@ void Region::initialize(const double* pLow, const double* pHigh, uint32_t dimens
 	m_pLow = nullptr;
 	m_dimension = dimension;
 
-#ifdef SIDX_DEBUG
-    for (uint32_t cDim = 0; cDim < m_dimension; ++cDim)
-    {
-     if ((pLow[cDim] > pHigh[cDim]))
-     {
-         // check for infinitive region
-         if (!(pLow[cDim] == std::numeric_limits<double>::max() ||
-             pHigh[cDim] == -std::numeric_limits<double>::max() ))
-             throw Tools::IllegalArgumentException(
-                 "Region::initialize: Low point has larger coordinates than High point."
-                 " Neither point is infinity."
-             );
-     }
-    }
-#endif
-
 	try
 	{
 		m_pLow = new double[m_dimension];


=====================================
src/tprtree/Index.cc
=====================================
@@ -321,13 +321,6 @@ void Index::adjustTree(Node* n, std::stack<id_type>& pathBuffer)
 		}
 	//}
 
-#ifdef SIDX_DEBUG
-	for (uint32_t cChild = 0; cChild < m_children; ++cChild)
-	{
-		assert(m_nodeMBR.containsRegionAfterTime(m_pTree->m_currentTime, *(m_ptrMBR[cChild])) == true);
-	}
-#endif
-
 	m_pTree->writeNode(this);
 
 	if (/*! bContained && */ ! pathBuffer.empty())
@@ -382,13 +375,6 @@ void Index::adjustTree(Node* n1, Node* n2, std::stack<id_type>& pathBuffer, uint
 		}
 	//}
 
-#ifdef SIDX_DEBUG
-	for (uint32_t cChild = 0; cChild < m_children; ++cChild)
-	{
-		assert(m_nodeMBR.containsRegionAfterTime(m_pTree->m_currentTime, *(m_ptrMBR[cChild])) == true);
-	}
-#endif
-
 	// No write necessary here. insertData will write the node if needed.
 	//m_pTree->writeNode(this);
 


=====================================
src/tprtree/Node.cc
=====================================
@@ -376,13 +376,6 @@ bool Node::insertEntry(uint32_t dataLength, uint8_t* pData, MovingRegion& mbr, i
 		}
 	}
 
-#ifdef SIDX_DEBUG
-	for (uint32_t cChild = 0; cChild < m_children; ++cChild)
-	{
-		assert(m_nodeMBR.containsRegionAfterTime(m_nodeMBR.m_startTime, *(m_ptrMBR[cChild])));
-	}
-#endif
-
 	return true;
 }
 
@@ -434,12 +427,6 @@ void Node::deleteEntry(uint32_t index)
 			m_nodeMBR.m_pHigh[cDim] += 2.0 * std::numeric_limits<double>::epsilon();
 		}
 
-#ifdef SIDX_DEBUG
-		for (uint32_t cChild = 0; cChild < m_children; ++cChild)
-		{
-			assert(m_nodeMBR.containsRegionAfterTime(m_pTree->m_currentTime, *(m_ptrMBR[cChild])) == true);
-		}
-#endif
 	}
 }
 
@@ -559,13 +546,6 @@ bool Node::insertData(uint32_t dataLength, uint8_t* pData, MovingRegion& mbr, id
 			m_nodeMBR.m_pHigh[cDim] += 2.0 * std::numeric_limits<double>::epsilon();
 		}
 
-#ifdef SIDX_DEBUG
-		for (uint32_t cChild = 0; cChild < m_children; ++cChild)
-		{
-			assert(m_nodeMBR.containsRegionAfterTime(m_nodeMBR.m_startTime, *(m_ptrMBR[cChild])));
-		}
-#endif
-
 		m_pTree->writeNode(this);
 
 		// Divertion from R*-Tree algorithm here. First adjust
@@ -604,17 +584,6 @@ bool Node::insertData(uint32_t dataLength, uint8_t* pData, MovingRegion& mbr, id
 			n->m_identifier = -1;
 			nn->m_identifier = -1;
 
-#ifdef SIDX_DEBUG
-			for (uint32_t cChild = 0; cChild < n->m_children; ++cChild)
-			{
-				assert(n->m_nodeMBR.containsRegionAfterTime(n->m_nodeMBR.m_startTime, *(n->m_ptrMBR[cChild])) == true);
-			}
-			for (uint32_t cChild = 0; cChild < nn->m_children; ++cChild)
-			{
-				assert(nn->m_nodeMBR.containsRegionAfterTime(nn->m_nodeMBR.m_startTime, *(nn->m_ptrMBR[cChild])) == true);
-			}
-#endif
-
 			m_pTree->writeNode(n.get());
 			m_pTree->writeNode(nn.get());
 
@@ -647,17 +616,6 @@ bool Node::insertData(uint32_t dataLength, uint8_t* pData, MovingRegion& mbr, id
 			n->m_identifier = m_identifier;
 			nn->m_identifier = -1;
 
-#ifdef SIDX_DEBUG
-			for (uint32_t cChild = 0; cChild < n->m_children; ++cChild)
-			{
-				assert(n->m_nodeMBR.containsRegionAfterTime(n->m_nodeMBR.m_startTime, *(n->m_ptrMBR[cChild])) == true);
-			}
-			for (uint32_t cChild = 0; cChild < nn->m_children; ++cChild)
-			{
-				assert(nn->m_nodeMBR.containsRegionAfterTime(nn->m_nodeMBR.m_startTime, *(nn->m_ptrMBR[cChild])) == true);
-			}
-#endif
-
 			m_pTree->writeNode(n.get());
 			m_pTree->writeNode(nn.get());
 


=====================================
src/tprtree/PointerPoolNode.h
=====================================
@@ -37,11 +37,6 @@ namespace Tools
 	public:
 		explicit PointerPool(uint32_t capacity) : m_capacity(capacity)
 		{
-			#ifdef SIDX_DEBUG
-			m_hits = 0;
-			m_misses = 0;
-			m_pointerCount = 0;
-			#endif
 		}
 
 		~PointerPool()
@@ -51,15 +46,8 @@ namespace Tools
 			while (! m_pool.empty())
 			{
 				TPRTree::Node* x = m_pool.top(); m_pool.pop();
-				#ifdef SIDX_DEBUG
-				--m_pointerCount;
-				#endif
 				delete x;
 			}
-
-			#ifdef SIDX_DEBUG
-			std::cerr << "Lost pointers: " << m_pointerCount << std::endl;
-			#endif
 		}
 
 		PoolPointer<TPRTree::Node> acquire()
@@ -67,21 +55,8 @@ namespace Tools
 			if (! m_pool.empty())
 			{
 				TPRTree::Node* p = m_pool.top(); m_pool.pop();
-				#ifdef SIDX_DEBUG
-				++m_hits;
-				#endif
-
 				return PoolPointer<TPRTree::Node>(p, this);
 			}
-			#ifdef SIDX_DEBUG
-			else
-			{
-				// fixme: well sort of...
-				++m_pointerCount;
-				++m_misses;
-			}
-			#endif
-
 			return PoolPointer<TPRTree::Node>();
 		}
 
@@ -108,9 +83,6 @@ namespace Tools
 				}
 				else
 				{
-					#ifdef SIDX_DEBUG
-					--m_pointerCount;
-					#endif
 					delete p;
 				}
 
@@ -128,13 +100,6 @@ namespace Tools
 	protected:
 		uint32_t m_capacity;
 		std::stack<TPRTree::Node*> m_pool;
-
-	#ifdef SIDX_DEBUG
-	public:
-		uint64_t m_hits;
-		uint64_t m_misses;
-		uint64_t m_pointerCount;
-	#endif
 	};
 }
 


=====================================
src/tprtree/TPRTree.cc
=====================================
@@ -1098,18 +1098,7 @@ SpatialIndex::id_type SpatialIndex::TPRTree::TPRTree::writeNode(Node* n)
 		n->m_identifier = page;
 		++(m_stats.m_nodes);
 
-#ifdef SIDX_DEBUG
-		try
-		{
-			m_stats.m_nodesInLevel[n->m_level] = m_stats.m_nodesInLevel.at(n->m_level) + 1;
-		}
-		catch(...)
-		{
-			throw Tools::IllegalStateException("writeNode: writing past the end of m_nodesInLevel.");
-		}
-#else
 		m_stats.m_nodesInLevel[n->m_level] = m_stats.m_nodesInLevel[n->m_level] + 1;
-#endif
 	}
 
 	++(m_stats.m_writes);
@@ -1264,16 +1253,5 @@ std::ostream& SpatialIndex::TPRTree::operator<<(std::ostream& os, const TPRTree&
 		os	<< "Utilization: " << 100 * t.m_stats.getNumberOfData() / (t.m_stats.getNumberOfNodesInLevel(0) * t.m_leafCapacity) << "%" << std::endl
 			<< t.m_stats;
 
-	#ifdef SIDX_DEBUG
-	os	<< "Leaf pool hits: " << t.m_leafPool.m_hits << std::endl
-		<< "Leaf pool misses: " << t.m_leafPool.m_misses << std::endl
-		<< "Index pool hits: " << t.m_indexPool.m_hits << std::endl
-		<< "Index pool misses: " << t.m_indexPool.m_misses << std::endl
-		<< "Region pool hits: " << t.m_regionPool.m_hits << std::endl
-		<< "Region pool misses: " << t.m_regionPool.m_misses << std::endl
-		<< "Point pool hits: " << t.m_pointPool.m_hits << std::endl
-		<< "Point pool misses: " << t.m_pointPool.m_misses << std::endl;
-	#endif
-
 	return os;
 }



View it on GitLab: https://salsa.debian.org/debian-gis-team/spatialindex/-/commit/aa6c28ff26d38d782886cca4d693d606ce0f6106

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://salsa.debian.org/debian-gis-team/spatialindex/-/commit/aa6c28ff26d38d782886cca4d693d606ce0f6106
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240529/01874801/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list