56 size_t *total_delauny) {
57 clock_t start_t = clock();
59 const int tuple_limit = 1000000;
61 size_t total_tuples = 0;
66 for (i = 0; i < 4; ++i) {
88 (*total_delauny) = total_tuples;
90 while (moredata ==
true) {
91 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
92 if (total_tuples == 0)
95 size_t ntuples = SPI_processed;
96 total_tuples += ntuples;
99 if ((*delauny) == NULL)
101 palloc0(total_tuples *
sizeof(
Delauny_t));
107 if ((*delauny) == NULL) {
108 elog(ERROR,
"Out of memory");
111 SPITupleTable *tuptable = SPI_tuptable;
112 TupleDesc tupdesc = SPI_tuptable->tupdesc;
115 for (t = 0; t < ntuples; t++) {
116 HeapTuple tuple = tuptable->vals[t];
118 &(*delauny)[total_tuples - ntuples + t]);
120 SPI_freetuptable(tuptable);
126 SPI_cursor_close(SPIportal);
129 if (total_tuples == 0) {
130 (*total_delauny) = 0;
134 (*total_delauny) = total_tuples;
136 time_msg(
" calculating Delauny triangles:", start_t, clock());