Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
hit_gbtile.h
Go to the documentation of this file.
1 
11 /*
12  * <license>
13  *
14  * Hitmap v1.2
15  *
16  * This software is provided to enhance knowledge and encourage progress in the scientific
17  * community. It should be used only for research and educational purposes. Any reproduction
18  * or use for commercial purpose, public redistribution, in source or binary forms, with or
19  * without modifications, is NOT ALLOWED without the previous authorization of the copyright
20  * holder. The origin of this software must not be misrepresented; you must not claim that you
21  * wrote the original software. If you use this software for any purpose (e.g. publication),
22  * a reference to the software package and the authors must be included.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
25  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
27  * THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * Copyright (c) 2007-2015, Trasgo Group, Universidad de Valladolid.
35  * All rights reserved.
36  *
37  * More information on http://trasgo.infor.uva.es/
38  *
39  * </license>
40 */
41 
42 #ifndef _HitGBTile_
43 #define _HitGBTile_
44 
45 
46 #include "hit_tile.h"
47 
48 
49 /* 1. DECLARATION AND INITIALIZATION OF THE VARIABLES */
58 #define hit_gbTileDomainShape(newVarP, baseType, shape, allocOpts) \
59  hit_gbTileDomainShapeInternal(newVarP, sizeof(baseType), shape, allocOpts)
60 
70 void hit_gbTileDomainShapeInternal(void * newVarP, size_t baseExtent, HitShape shape, int allocOpts);
71 
77 #define hit_gbTileAlloc(var) hit_gbTileAllocInternal(var, #var, __FILE__, __LINE__)
78 
86 void hit_gbTileAllocInternal(void *newVarP, const char *name, const char *file, int numLine);
87 
99 #define hit_gbTileDomainShapeAlloc(var, baseType, shape, allocOpts) \
100  hit_gbTileDomainShapeInternal(var, sizeof(baseType), shape, allocOpts); \
101  hit_gbTileAllocInternal(var, #var, __FILE__, __LINE__);
102 
103 
104 
105 /* 2. INDEX ACCESS FUNCTIONS */
113 inline int hit_gbTileGraphVertexAtIndex(void * varP, int vertex);
114 
123 static inline int hit_gbTileEdgeAtIndex(void * varP, int local1, int local2){
124 
125  /* 1. Get the shape of the tile */
126  HitTile *var = (HitTile *)varP;
127  HitShape shape = hit_tileShape(*var);
128 
129  int nvertices = hit_bShapeNvertices(shape);
130 
131  return local1 * nvertices + local2;
132 }
133 
134 
143 inline int hit_gbTileGraphEdgeAtIndex(void * varP, int pos1, int pos2);
144 
145 
146 /* 3. ELEMENT ACCESS FUNCTIONS */
154 #define hit_gbTileVertexAt(var, vertex) ((var).dataVertices[vertex])
155 
164 #define hit_gbTileEdgeAt(var, pos1, pos2) ((var).data[hit_gbTileEdgeAtIndex(&(var),(pos1),(pos2))])
165 
173 #define hit_gbTileGraphVertexAt(var, vertex) ((var).dataVertices[hit_gbTileGraphVertexAtIndex(&(var),(vertex))])
174 
183 #define hit_gbTileGraphEdgeAt(var, pos1, pos2) ((var).data[hit_gbTileGraphEdgeAtIndex(&(var),(pos1),(pos2))])
184 
194 #define hit_gbTileEdgeIteratorAt(var, vertex, edge_index) ((var).data[vertex * hit_bShapeNvertices(hit_tileShape(var)) + edge_index])
195 
206 #define hit_gbTileEdgeIteratorSkipAt(var, vertex, edge_index) ((var).data[edge_index])
207 
208 
209 
210 // 4. OTHER FUNCTIONS
216 void hit_gbTileClearVertices(void * varP);
217 
224 void hit_gbTileCopyVertices(void * destP, void * srcP);
225 
226 
227 
228 /* END OF HEADER FILE _HitGBTile_ */
229 #endif
int hit_gbTileGraphVertexAtIndex(void *varP, int vertex)
Definition: hit_gbtile.c:113
void hit_gbTileAllocInternal(void *newVarP, const char *name, const char *file, int numLine)
Definition: hit_gbtile.c:78
void hit_gbTileDomainShapeInternal(void *newVarP, size_t baseExtent, HitShape shape, int allocOpts)
Definition: hit_gbtile.c:49
void hit_gbTileCopyVertices(void *destP, void *srcP)
Definition: hit_gbtile.c:159
void hit_gbTileClearVertices(void *varP)
Definition: hit_gbtile.c:146
int hit_gbTileGraphEdgeAtIndex(void *varP, int pos1, int pos2)
Definition: hit_gbtile.c:128
HitShape shape
#define hit_bShapeNvertices(shape)
static int hit_gbTileEdgeAtIndex(void *varP, int local1, int local2)
Definition: hit_gbtile.h:123
#define hit_tileShape(var)
Definition: hit_tile.h:723