MobilityDB 1.1
tpoint_tile.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2023, Université libre de Bruxelles and MobilityDB
5 * contributors
6 *
7 * MobilityDB includes portions of PostGIS version 3 source code released
8 * under the GNU General Public License (GPLv2 or later).
9 * Copyright (c) 2001-2023, PostGIS contributors
10 *
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose, without fee, and without a written
13 * agreement is hereby granted, provided that the above copyright notice and
14 * this paragraph and the following two paragraphs appear in all copies.
15 *
16 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20 * OF SUCH DAMAGE.
21 *
22 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
27 *
28 *****************************************************************************/
29
34#ifndef __TPOINT_TILE_H__
35#define __TPOINT_TILE_H__
36
37/* MEOS */
38#include "general/temporal.h"
39
40#define MAXDIMS 4
41
42/*****************************************************************************/
43
47typedef struct
48{
49 int numdims;
50 int count[MAXDIMS];
51 uint8_t byte[1];
52} BitMatrix;
53
58typedef struct STboxGridState
59{
60 bool done;
61 int i;
62 double size;
65 const Temporal *temp;
68 double x;
69 double y;
70 double z;
74
75/*****************************************************************************/
76
77extern BitMatrix *bitmatrix_make(int *count, int numdims);
78extern void tpoint_set_tiles(const Temporal *temp, const STboxGridState *state,
79 BitMatrix *bm);
80
81extern void stbox_tile_set(double x, double y, double z, TimestampTz t,
82 double size, int64 tunits, bool hasz, bool hast, int32 srid, STBox *result);
84 const STBox *box, double size, int64 tunits, POINT3DZ sorigin,
85 TimestampTz torigin);
88
89/*****************************************************************************/
90
91#endif
int64 TimestampTz
Definition: pg_ext_defs.in.h:19
signed int int32
Definition: pg_ext_defs.in.h:8
long int int64
Definition: pg_ext_defs.in.h:9
int numdims
Number of dimensions.
Definition: tpoint_tile.h:49
Structure for storing a bit matrix.
Definition: tpoint_tile.h:48
Definition: postgis_ext_defs.in.h:91
Structure to represent spatiotemporal boxes.
Definition: meos.h:107
BitMatrix * bm
Optional bit matrix for speeding up the computation of the split functions.
Definition: tpoint_tile.h:66
int coords[MAXDIMS]
Coordinates of the current tile.
Definition: tpoint_tile.h:72
double y
Minimum y value of the current tile.
Definition: tpoint_tile.h:69
STBox box
Bounding box of the grid.
Definition: tpoint_tile.h:64
int64 tunits
Size of the time dimension.
Definition: tpoint_tile.h:63
TimestampTz t
Minimum t value of the current tile.
Definition: tpoint_tile.h:71
double x
Minimum x value of the current tile.
Definition: tpoint_tile.h:68
bool done
True when all tiles have been processed.
Definition: tpoint_tile.h:60
int i
Number of current tile.
Definition: tpoint_tile.h:61
double size
Size of the x, y, and z dimension.
Definition: tpoint_tile.h:62
const Temporal * temp
Optional temporal point to be split.
Definition: tpoint_tile.h:65
double z
Minimum z value of the current tile.
Definition: tpoint_tile.h:70
Struct for storing the state that persists across multiple calls generating a multidimensional grid.
Definition: tpoint_tile.h:59
Structure to represent the common structure of temporal values of any temporal subtype.
Definition: meos.h:136
Definition: pgtz.h:42
bool stbox_tile_state_get(STboxGridState *state, STBox *box)
Get the current tile of the multidimensional grid.
Definition: tpoint_tile.c:561
#define MAXDIMS
Functions for spatiotemporal bounding boxes.
Definition: tpoint_tile.h:40
void stbox_tile_state_next(STboxGridState *state)
Increment the current state to the next tile of the multidimensional grid.
Definition: tpoint_tile.c:477
BitMatrix * bitmatrix_make(int *count, int numdims)
Functions for spatial and spatiotemporal tiles.
Definition: tpoint_tile.c:58
STboxGridState * stbox_tile_state_make(const Temporal *temp, const STBox *box, double size, int64 tunits, POINT3DZ sorigin, TimestampTz torigin)
Create the initial state that persists across multiple calls of the function.
Definition: tpoint_tile.c:436
struct STboxGridState STboxGridState
Struct for storing the state that persists across multiple calls generating a multidimensional grid.
void stbox_tile_set(double x, double y, double z, TimestampTz t, double size, int64 tunits, bool hasz, bool hast, int32 srid, STBox *result)
Generate a tile from the current state of the multidimensional grid.
Definition: tpoint_tile.c:399
void tpoint_set_tiles(const Temporal *temp, const STboxGridState *state, BitMatrix *bm)
Set the bit corresponding to the tiles intersecting the temporal point.
Definition: tpoint_tile.c:813