[geos-commits] [SCM] GEOS branch main-relate-ng updated. 4775c8087a7fa9f136bd8bda41ef585e48597194
git at osgeo.org
git at osgeo.org
Wed Aug 7 12:44:37 PDT 2024
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, main-relate-ng has been updated
via 4775c8087a7fa9f136bd8bda41ef585e48597194 (commit)
from 222add30792744c4eeaefc8d5b785137709b92eb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4775c8087a7fa9f136bd8bda41ef585e48597194
Author: Martin Davis <mtnclimb at gmail.com>
Date: Wed Aug 7 12:44:03 2024 -0700
Add PreparedPolygon perf test for covers
diff --git a/benchmarks/geom/PreparedPolygonIntersectsPerfTest.cpp b/benchmarks/geom/PreparedPolygonIntersectsPerfTest.cpp
index f66ee0d10..4af663769 100644
--- a/benchmarks/geom/PreparedPolygonIntersectsPerfTest.cpp
+++ b/benchmarks/geom/PreparedPolygonIntersectsPerfTest.cpp
@@ -24,6 +24,7 @@ std::size_t NUM_LINES_PTS = 100;
#define INTERSECTS 0
#define CONTAINS 1
+#define COVERS 2
int predicateOp = INTERSECTS;
@@ -45,6 +46,15 @@ int testRelateOpContains(const Geometry& g, const std::vector<std::unique_ptr<Ge
return count;
}
+int testRelateOpCovers(const Geometry& g, const std::vector<std::unique_ptr<Geometry>>& geoms) {
+ int count = 0;
+ for (const auto& geom : geoms) {
+ auto im = g.relate(geom.get());
+ count += im->isCovers();
+ }
+ return count;
+}
+
int testGeometryIntersects(const Geometry& g, const std::vector<std::unique_ptr<Geometry>>& geoms) {
int count = 0;
for (const auto& geom : geoms) {
@@ -61,6 +71,14 @@ int testGeometryContains(const Geometry& g, const std::vector<std::unique_ptr<Ge
return count;
}
+int testGeometryCovers(const Geometry& g, const std::vector<std::unique_ptr<Geometry>>& geoms) {
+ int count = 0;
+ for (const auto& geom : geoms) {
+ count += g.covers(geom.get());
+ }
+ return count;
+}
+
int testPrepGeomIntersects(const Geometry& g, const std::vector<std::unique_ptr<Geometry>>& geoms) {
int count = 0;
auto prep = prep::PreparedGeometryFactory::prepare(&g);
@@ -79,6 +97,15 @@ int testPrepGeomContains(const Geometry& g, const std::vector<std::unique_ptr<Ge
return count;
}
+int testPrepGeomCovers(const Geometry& g, const std::vector<std::unique_ptr<Geometry>>& geoms) {
+ int count = 0;
+ auto prep = prep::PreparedGeometryFactory::prepare(&g);
+ for (const auto& geom : geoms) {
+ count += prep->covers(geom.get());
+ }
+ return count;
+}
+
int testRelateNGPreparedIntersects(const Geometry& g, const std::vector<std::unique_ptr<Geometry>>& geoms) {
int count = 0;
auto prep = geos::operation::relateng::RelateNG::prepare(&g);
@@ -97,6 +124,15 @@ int testRelateNGPreparedContains(const Geometry& g, const std::vector<std::uniqu
return count;
}
+int testRelateNGPreparedCovers(const Geometry& g, const std::vector<std::unique_ptr<Geometry>>& geoms) {
+ int count = 0;
+ auto prep = geos::operation::relateng::RelateNG::prepare(&g);
+ for (const auto& line : geoms) {
+ count += prep->evaluate(line.get(), *geos::operation::relateng::RelatePredicate::covers());
+ }
+ return count;
+}
+
template<typename F>
double test(const Geometry& g, const std::vector<std::unique_ptr<Geometry>>& geoms, const std::string& method, F&& fun, double baseTime)
{
@@ -151,6 +187,12 @@ void test(int dim, std::size_t npts) {
test(*target, geoms, "Geometry::contains", testGeometryIntersects, baseTime);
test(*target, geoms, "PreparedGeom contains", testPrepGeomContains, baseTime);
test(*target, geoms, "RelateNGPrepared contains", testRelateNGPreparedContains, baseTime);
+ break;
+ case COVERS:
+ baseTime = test(*target, geoms, "RelateOp covers", testRelateOpCovers, 0);
+ test(*target, geoms, "Geometry::covers", testGeometryCovers, baseTime);
+ test(*target, geoms, "PreparedGeom covers", testPrepGeomCovers, baseTime);
+ test(*target, geoms, "RelateNGPrepared covers", testRelateNGPreparedCovers, baseTime);
}
}
@@ -173,6 +215,9 @@ int main(int argc, char** argv) {
if (op == "contains") {
predicateOp = CONTAINS;
}
+ else if (op == "covers") {
+ predicateOp = COVERS;
+ }
}
std::cout << "target_points,num_tests,num_hits,test_type,pts_in_test,method,time,factor" << std::endl;
-----------------------------------------------------------------------
Summary of changes:
.../geom/PreparedPolygonIntersectsPerfTest.cpp | 45 ++++++++++++++++++++++
1 file changed, 45 insertions(+)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list