tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
grid.h
Go to the documentation of this file.
1 /* =============================================================================
2  *
3  * grid.h
4  *
5  * =============================================================================
6  *
7  * Copyright (C) Stanford University, 2006. All Rights Reserved.
8  * Author: Chi Cao Minh
9  *
10  * =============================================================================
11  *
12  * For the license of bayes/sort.h and bayes/sort.c, please see the header
13  * of the files.
14  *
15  * ------------------------------------------------------------------------
16  *
17  * For the license of kmeans, please see kmeans/LICENSE.kmeans
18  *
19  * ------------------------------------------------------------------------
20  *
21  * For the license of ssca2, please see ssca2/COPYRIGHT
22  *
23  * ------------------------------------------------------------------------
24  *
25  * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the
26  * header of the files.
27  *
28  * ------------------------------------------------------------------------
29  *
30  * For the license of lib/rbtree.h and lib/rbtree.c, please see
31  * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree
32  *
33  * ------------------------------------------------------------------------
34  *
35  * Unless otherwise noted, the following license applies to STAMP files:
36  *
37  * Copyright (c) 2007, Stanford University
38  * All rights reserved.
39  *
40  * Redistribution and use in source and binary forms, with or without
41  * modification, are permitted provided that the following conditions are
42  * met:
43  *
44  * * Redistributions of source code must retain the above copyright
45  * notice, this list of conditions and the following disclaimer.
46  *
47  * * Redistributions in binary form must reproduce the above copyright
48  * notice, this list of conditions and the following disclaimer in
49  * the documentation and/or other materials provided with the
50  * distribution.
51  *
52  * * Neither the name of Stanford University nor the names of its
53  * contributors may be used to endorse or promote products derived
54  * from this software without specific prior written permission.
55  *
56  * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY
57  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
58  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
59  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE
60  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
61  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
62  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
63  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
64  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
66  * THE POSSIBILITY OF SUCH DAMAGE.
67  *
68  * =============================================================================
69  */
70 
71 
72 #ifndef GRID_H
73 #define GRID_H 1
74 
75 
76 #include "types.h"
77 #include "vector.h"
78 
79 
80 typedef struct grid {
81  long width;
82  long height;
83  long depth;
84  long* points;
86 } grid_t;
87 
88 enum {
91 };
92 
93 
94 /* =============================================================================
95  * grid_alloc
96  * =============================================================================
97  */
98 grid_t*
99 grid_alloc (long width, long height, long depth);
100 
101 
102 /* =============================================================================
103  * TMgrid_alloc
104  * =============================================================================
105  */
106 grid_t*
107 Pgrid_alloc (long width, long height, long depth);
108 
109 
110 /* =============================================================================
111  * grid_free
112  * =============================================================================
113  */
114 void
115 grid_free (grid_t* gridPtr);
116 
117 
118 /* =============================================================================
119  * Pgrid_free
120  * =============================================================================
121  */
122 void
123 Pgrid_free (grid_t* gridPtr);
124 
125 
126 /* =============================================================================
127  * grid_copy
128  * =============================================================================
129  */
130 void
131 grid_copy (grid_t* dstGridPtr, grid_t* srcGridPtr);
132 
133 
134 /* =============================================================================
135  * grid_isPointValid
136  * =============================================================================
137  */
138 bool_t
139 grid_isPointValid (grid_t* gridPtr, long x, long y, long z);
140 
141 
142 /* =============================================================================
143  * grid_getPointRef
144  * =============================================================================
145  */
146 long*
147 grid_getPointRef (grid_t* gridPtr, long x, long y, long z);
148 
149 
150 /* =============================================================================
151  * grid_getPointIndices
152  * =============================================================================
153  */
154 void
155 grid_getPointIndices (grid_t* gridPtr,
156  long* gridPointPtr, long* xPtr, long* yPtr, long* zPtr);
157 
158 
159 /* =============================================================================
160  * grid_getPoint
161  * =============================================================================
162  */
163 long
164 grid_getPoint (grid_t* gridPtr, long x, long y, long z);
165 
166 
167 /* =============================================================================
168  * grid_isPointEmpty
169  * =============================================================================
170  */
171 bool_t
172 grid_isPointEmpty (grid_t* gridPtr, long x, long y, long z);
173 
174 
175 /* =============================================================================
176  * grid_isPointFull
177  * =============================================================================
178  */
179 bool_t
180 grid_isPointFull (grid_t* gridPtr, long x, long y, long z);
181 
182 
183 /* =============================================================================
184  * grid_setPoint
185  * =============================================================================
186  */
187 void
188 grid_setPoint (grid_t* gridPtr, long x, long y, long z, long value);
189 
190 
191 /* =============================================================================
192  * grid_addPath
193  * =============================================================================
194  */
195 void
196 grid_addPath (grid_t* gridPtr, vector_t* pointVectorPtr);
197 
198 
199 /* =============================================================================
200  * TMgrid_addPath
201  * =============================================================================
202  */
204 void
205 TMgrid_addPath (TM_ARGDECL grid_t* gridPtr, vector_t* pointVectorPtr);
206 
207 
208 /* =============================================================================
209  * grid_print
210  * =============================================================================
211  */
212 void
213 grid_print (grid_t* gridPtr);
214 
215 
216 #define PGRID_ALLOC(x, y, z) Pgrid_alloc(x, y, z)
217 #define PGRID_FREE(g) Pgrid_free(g)
218 
219 #define TMGRID_ADDPATH(g, p) TMgrid_addPath(TM_ARG g, p)
220 
221 
222 #endif /* GRID_H */
223 
224 
225 /* =============================================================================
226  *
227  * End of grid.c
228  *
229  * =============================================================================
230  */
void grid_free(grid_t *gridPtr)
Definition: grid.c:147
Definition: vector.h:85
#define TM_CALLABLE
Definition: cxxtm.hpp:32
Definition: grid.h:80
grid_t * Pgrid_alloc(long width, long height, long depth)
Definition: grid.c:119
bool_t grid_isPointFull(grid_t *gridPtr, long x, long y, long z)
Definition: grid.c:267
bool_t grid_isPointValid(grid_t *gridPtr, long x, long y, long z)
Definition: grid.c:196
bool_t grid_isPointEmpty(grid_t *gridPtr, long x, long y, long z)
Definition: grid.c:255
Definition: grid.h:90
long width
Definition: grid.h:81
long * points
Definition: grid.h:84
int bool_t
Definition: portable_defns.h:32
#define TM_ARGDECL
Definition: tm.h:532
void grid_copy(grid_t *dstGridPtr, grid_t *srcGridPtr)
Definition: grid.c:171
void grid_setPoint(grid_t *gridPtr, long x, long y, long z, long value)
Definition: grid.c:279
void Pgrid_free(grid_t *gridPtr)
Definition: grid.c:159
struct grid grid_t
grid_t * grid_alloc(long width, long height, long depth)
Definition: grid.c:91
void grid_addPath(grid_t *gridPtr, vector_t *pointVectorPtr)
Definition: grid.c:290
long grid_getPoint(grid_t *gridPtr, long x, long y, long z)
Definition: grid.c:244
void grid_print(grid_t *gridPtr)
Definition: grid.c:331
TM_CALLABLE void TMgrid_addPath(TM_ARGDECL grid_t *gridPtr, vector_t *pointVectorPtr)
Definition: grid.c:310
long * points_unaligned
Definition: grid.h:85
long * grid_getPointRef(grid_t *gridPtr, long x, long y, long z)
Definition: grid.c:214
long depth
Definition: grid.h:83
long height
Definition: grid.h:82
Definition: grid.h:89
void grid_getPointIndices(grid_t *gridPtr, long *gridPointPtr, long *xPtr, long *yPtr, long *zPtr)
Definition: grid.c:225