Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
hit_gctile.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 _HitGCTile_
43 #define _HitGCTile_
44 
45 
46 #include "hit_tile.h"
47 #include "hit_cshape.h"
48 
49 /* 1. DECLARATION AND INITIALIZATION OF THE VARIABLES */
58 #define hit_gcTileDomainShape(newVarP, baseType, shape, allocOpts) \
59  hit_gcTileDomainShapeInternal(newVarP, sizeof(baseType), shape, allocOpts)
60 
70 void hit_gcTileDomainShapeInternal(void * newVarP, size_t baseExtent, HitShape shape, int allocOpts);
71 
77 #define hit_gcTileAlloc(var) hit_gcTileAllocInternal(var, #var, __FILE__, __LINE__)
78 
86 void hit_gcTileAllocInternal(void *newVarP, const char *name, const char *file, int numLine);
87 
99 #define hit_gcTileDomainShapeAlloc(var, baseType, shape, allocOpts) \
100  hit_gcTileDomainShapeInternal(var, sizeof(baseType), shape, allocOpts); \
101  hit_gcTileAllocInternal(var, #var, __FILE__, __LINE__);
102 
103 
104 /* 2. INDEX ACCESS FUNCTIONS */
112 inline int hit_gcTileGraphVertexAtIndex(void * varP, int vertex);
113 
122 static inline int hit_gcTileEdgeAtIndex(void * varP, int local1, int local2){
123 
124  /* 1. Get the shape of the tile */
125  HitTile *var = (HitTile *)varP;
126  HitShape shape = hit_tileShape(*var);
127 
128  int edge;
129  hit_cShapeEdgeIterator(edge,shape,local1){
130  int dst = hit_cShapeEdgeTarget(shape,edge);
131  if(dst == local2) return edge;
132  }
133 
134  return -1;
135 }
136 
145 int hit_gcTileGraphEdgeAtIndex(void * varP, int pos1, int pos2);
146 
147 
148 
149 /* 3. ELEMENT ACCESS FUNCTIONS */
157 #define hit_gcTileVertexAt(var, vertex) ((var).dataVertices[vertex])
158 
167 #define hit_gcTileEdgeAt(var, pos1, pos2) ((var).data[hit_gcTileEdgeAtIndex(&(var),(pos1),(pos2))])
168 
176 #define hit_gcTileGraphVertexAt(var, vertex) ((var).dataVertices[hit_gcTileGraphVertexAtIndex(&(var),(vertex))])
177 
186 #define hit_gcTileGraphEdgeAt(var, pos1, pos2) ((var).data[hit_gcTileGraphEdgeAtIndex(&(var),(pos1),(pos2))])
187 
188 
189 /* 4. OTHER FUNCTIONS */
197 #define hit_gcTileVerticesCopy(dstTileP,srcTileP) hit_gcTileCopyVerticesInternal(dstTileP,srcTileP,1)
198 
209 void hit_gcTileCopyVerticesInternal(void * dstTileP, void * srcTileP, int clear);
210 
220 #define hit_gcTileEdgeIteratorAt(var, vertex, edge_index) ((var).data[edge_index])
221 
222 
223 // 4. OTHER FUNCTIONS
229 void hit_gcTileClearVertices(void * varP);
230 
237 void hit_gcTileCopyVertices(void * destP, void * srcP);
238 
239 
240 
241 /* END OF HEADER FILE _HitGCTile_ */
242 #endif
void hit_gcTileCopyVertices(void *destP, void *srcP)
Definition: hit_gctile.c:145
#define hit_cShapeEdgeTarget(s, edge)
void hit_gcTileAllocInternal(void *newVarP, const char *name, const char *file, int numLine)
Definition: hit_gctile.c:67
int hit_gcTileGraphVertexAtIndex(void *varP, int vertex)
Definition: hit_gctile.c:119
#define hit_cShapeEdgeIterator(var, shape, vertex)
Definition: hit_cshape.h:416
void hit_gcTileClearVertices(void *varP)
Definition: hit_gctile.c:132
HitShape shape
void hit_gcTileCopyVerticesInternal(void *dstTileP, void *srcTileP, int clear)
void hit_gcTileDomainShapeInternal(void *newVarP, size_t baseExtent, HitShape shape, int allocOpts)
Definition: hit_gctile.c:39
static int hit_gcTileEdgeAtIndex(void *varP, int local1, int local2)
Definition: hit_gctile.h:122
#define hit_tileShape(var)
Definition: hit_tile.h:723
int hit_gcTileGraphEdgeAtIndex(void *varP, int pos1, int pos2)
Definition: hit_gctile.c:100