Changeset: 6c9d9691fb45 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6c9d9691fb45 Modified Files: geom/monetdb5/gpu.c geom/monetdb5/gpu.h geom/monetdb5/gpu.mal Branch: sfcgal Log Message:
Run Contains in the GPU. Set the GPU settings and reset the settings diffs (134 lines): diff --git a/geom/monetdb5/gpu.c b/geom/monetdb5/gpu.c --- a/geom/monetdb5/gpu.c +++ b/geom/monetdb5/gpu.c @@ -12,7 +12,7 @@ */ #include "gpu.h" - +#define GEOMBULK_DEBUG static str GpnpolyWithHoles(bat *out, int nvert, dbl *vx, dbl *vy, int nholes, dbl **hx, dbl **hy, int *hn, bat *point_x, bat *point_y) { @@ -20,6 +20,10 @@ GpnpolyWithHoles(bat *out, int nvert, db dbl *px = NULL, *py = NULL; BUN i = 0, cnt = 0; bit *cs = NULL; + char **mc = NULL; + int npoint = 0; + float *mpx = NULL, *mpy = NULL, *mvx = NULL, *mvy = NULL; + #ifdef GEOMBULK_DEBUG static struct timeval start, stop; unsigned long long t; @@ -58,6 +62,7 @@ GpnpolyWithHoles(bat *out, int nvert, db #endif /*Call to the GPU function*/ + pnpoly_GPU(&cs, nvert, cnt, px, py, vx, vy); /* * Verify if GPU has enough memory to get all the data @@ -84,7 +89,28 @@ GpnpolyWithHoles(bat *out, int nvert, db } str -wkbGContains_point_bat(bat *out, wkb **a, bat *point_x, bat *point_y, bat *point_z, int *srid) +geom_gpu_gcontains(bit *res, wkb **a, double *x, double *y, double *z, int *srid) +{ + vertexWKB *verts = NULL; + wkb *geom = NULL; + str msg = NULL; + (void) z; + + geom = (wkb *) *a; + if ((msg = getVerts(geom, &verts)) != MAL_SUCCEED) { + return msg; + } + + //msg = GpnpolyWithHoles(out, (int) verts->nvert, verts->vert_x, verts->vert_y, verts->nholes, verts->holes_x, verts->holes_y, verts->holes_n, point_x, point_y); + + if (verts) + freeVerts(verts); + + return msg; +} + +str +geom_gpu_gcontains_bat(bat *out, wkb **a, bat *point_x, bat *point_y, bat *point_z, int *srid) { vertexWKB *verts = NULL; wkb *geom = NULL; @@ -103,3 +129,23 @@ wkbGContains_point_bat(bat *out, wkb **a return msg; } + +str +geom_gpu_setup(bit *res, int *flag) { + str msg = MAL_SUCCEED; + (void) res; + + setup_GPU(); + + return msg; +} + +str +geom_gpu_reset(bit *res, int *flag) { + str msg = MAL_SUCCEED; + (void) res; + + reset_GPU(); + + return msg; +} diff --git a/geom/monetdb5/gpu.h b/geom/monetdb5/gpu.h --- a/geom/monetdb5/gpu.h +++ b/geom/monetdb5/gpu.h @@ -13,6 +13,7 @@ #include <monetdb_config.h> #include "libgeom.h" #include "geom.h" +#include "g_pnpoly.h" #ifdef WIN32 #ifndef LIBGEOM @@ -24,4 +25,7 @@ #define geom_export extern #endif -geom_export str wkbGContains_point_bat(int *res, wkb **geom, int *xBAT_id, int *yBAT_id, int *zBAT_id, int *srid); +geom_export str geom_gpu_setup(bit *res, int *flag); +geom_export str geom_gpu_reset(bit *res, int *flag); +geom_export str geom_gpu_gcontains(bit *res, wkb **geom, double *x, double *y, double *z, int *srid); +geom_export str geom_gpu_gcontains_bat(int *res, wkb **geom, int *xBAT_id, int *yBAT_id, int *zBAT_id, int *srid); diff --git a/geom/monetdb5/gpu.mal b/geom/monetdb5/gpu.mal --- a/geom/monetdb5/gpu.mal +++ b/geom/monetdb5/gpu.mal @@ -6,12 +6,20 @@ module geom; -command GContains(a:wkb, x:dbl, y:dbl, z:dbl, srid:int) :bit -address wkbContainsXYZ +command gsetup(a:int) :bit +address geom_gpu_setup +comment "Setup GPU"; + +command greset(a:int) :bit +address geom_gpu_reset +comment "Reset GPU"; + +command gcontains(a:wkb, x:dbl, y:dbl, z:dbl, srid:int) :bit +address geom_gpu_gcontains comment "Returns true if the Geometry a 'spatially contains' Geometry b"; module batgeom; +command gcontains(a:wkb, px:bat[:dbl], py:bat[:dbl], pz:bat[:dbl], srid:int) :bat[:bit] +address geom_gpu_gcontains_bat +comment "Returns true if the Geometry a 'spatially contains' Geometry b"; -command GContains(a:wkb, px:bat[:dbl], py:bat[:dbl], pz:bat[:dbl], srid:int) :bat[:bit] -address wkbGContains_point_bat -comment "Returns true if the Geometry a 'spatially contains' Geometry b"; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list