Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
hit_shape.h
Go to the documentation of this file.
1 
15 /*
16  * <license>
17  *
18  * Hitmap v1.2
19  *
20  * This software is provided to enhance knowledge and encourage progress in the scientific
21  * community. It should be used only for research and educational purposes. Any reproduction
22  * or use for commercial purpose, public redistribution, in source or binary forms, with or
23  * without modifications, is NOT ALLOWED without the previous authorization of the copyright
24  * holder. The origin of this software must not be misrepresented; you must not claim that you
25  * wrote the original software. If you use this software for any purpose (e.g. publication),
26  * a reference to the software package and the authors must be included.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
29  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
31  * THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
35  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  * Copyright (c) 2007-2015, Trasgo Group, Universidad de Valladolid.
39  * All rights reserved.
40  *
41  * More information on http://trasgo.infor.uva.es/
42  *
43  * </license>
44 */
45 
46 #ifndef _HitShape_
47 #define _HitShape_
48 
49 #include "hit_sig.h"
50 
51 // @cond INTERNAL
52 #ifndef INCLUDE_METIS__H
53  #define INCLUDE_METIS__H
54  #include "metis.h"
55 #endif
56 
57 #ifdef __cplusplus
58  extern "C" {
59 #endif
60 // @endcond
61 
62 
63 /* MAXIMUM NUMBER OF DIMENSIONS, FIXED AT COMPILATION TIME */
64 #ifndef HIT_MAXDIMS
65 
72 #define HIT_MAXDIMS 4
73 #endif
74 
81 #define HIT_SPARSE_MAXDIMS 2
82 
83 
84 
85 /* Hit SHAPES */
86 
87 /* 1. DATA STRUCTURE */
88 /* 1.1 SigShape data structure */
89 typedef struct {
91  int numDims;
92  HitSig sig[HIT_MAXDIMS];
93 } HitSigShape;
94 
95 
96 /* 1.2 LIST OF NAME ALIASES FOR THE INDEX IN AN SPARSE DOMAIN */
97 // @cond INTERNAL
102 typedef struct {
104  int * names;
105  int nNames;
106  int flagNames;
107  int * invNames;
108  int nInvNames;
109 } HitNameList;
110 // @endcond
111 
112 
113 /* 1.3 CShape data structure */
124 typedef struct{
126  int cards[HIT_SPARSE_MAXDIMS];
127  idxtype * xadj;
128  idxtype * adjncy;
129  HitNameList names[HIT_SPARSE_MAXDIMS];
130 } HitCShape;
131 
132 
133 /* 1.3 BitmapShape data structure */
134 // @cond INTERNAL
136 #define HIT_BITMAP_TYPE unsigned int
137 
138 #define HIT_BITMAP_COMM_TYPE MPI_UNSIGNED
139 
140 #define HIT_BITMAP_SIZE (sizeof(HIT_BITMAP_TYPE) * (size_t) 8)
141 // @endcond
142 
156 typedef struct{
158  int cards[HIT_SPARSE_MAXDIMS];
159  int nz;
160  HIT_BITMAP_TYPE * data;
161  HitNameList names[HIT_SPARSE_MAXDIMS];
162 } HitBShape;
163 
164 
165 /* 1.4 Shape data structure */
166 /* Constants for the class of shape: Signature and sparse shapes */
171 #define HIT_SIG_SHAPE 0
172 
177 #define HIT_CSR_SHAPE 1
178 
183 #define HIT_BITMAP_SHAPE 2
184 
193 typedef struct {
195  int type;
199  union{
201  HitSigShape sig;
202  HitCShape csr;
203  HitBShape bitmap;
204  } info;
205 } HitShape;
206 
207 
208 // CONSTANTS FOR THE INVERSE TRANSLATION LIST IN THE CSR AND BITMAP SHAPES.
209 // @cond INTERNAL
214 #define HIT_SHAPE_NAMES_NOARRAY 0
215 
219 #define HIT_SHAPE_NAMES_ARRAY 1
220 
225 #define HIT_SHAPE_NAMES_ORDERED 2
226 // @endcond
227 
228 
229 /* 2. Hit SHAPE NULL CONSTANT */
230 
236 extern HitShape HIT_SHAPE_NULL;
237 // @cond INTERNAL
239 #define HIT_SHAPE_NULL_STATIC { HIT_SIG_SHAPE, { { -1, { HIT_SIG_NULL_STATIC, HIT_SIG_NULL_STATIC, HIT_SIG_NULL_STATIC, HIT_SIG_NULL_STATIC } } } }
240 // @endcond
241 
242 
243 // @cond INTERNAL
247 extern HitNameList HIT_NAMELIST_NULL;
251 #define HIT_NAMELIST_NULL_STATIC {NULL,0,HIT_SHAPE_NAMES_NOARRAY,NULL,0}
252 // @endcond
253 
254 
255 /* HIT SHAPE ACCESS MACROS */
266 #define hit_shapeType(s) ((s).type)
267 
268 
269 // @cond INTERNAL
275 #define hit_cShapeAccess(s) ((s).info.csr)
276 
283 #define hit_bShapeAccess(s) ((s).info.bitmap)
284 // @endcond
285 
286 /* 6. HIT SHAPE FREE FUNTION */
295 void hit_shapeFree(HitShape s);
296 
297 // @cond INTERNAL
298 /* 12. Name list functionalities for sparse (csr and bitmap) shapes */
305 #define hit_nameListIndex2Name(list, index) (list.names[(index)])
306 
313 int hit_nameListName2Index(HitNameList list, int name);
314 
320 void hit_nameListCreate(HitNameList * list, int nelems);
321 
326 void hit_nameListFree(HitNameList list);
327 
333 void hit_nameListAdd(HitNameList * list, int x);
334 
339 void hit_nameListCreateInvNames(HitNameList * list);
340 
346 void hit_nameListClone(HitNameList * dst, HitNameList * src);
347 // @endcond
348 
349 /* END OF HEADER FILE _HitShape_ */
350 #endif
void hit_nameListCreateInvNames(HitNameList *list)
Definition: hit_shape.c:361
void hit_nameListClone(HitNameList *dst, HitNameList *src)
Definition: hit_shape.c:318
void hit_nameListAdd(HitNameList *list, int x)
Definition: hit_shape.c:337
int hit_nameListName2Index(HitNameList list, int name)
Definition: hit_shape.c:262
Definition: hit_sig.h:79
void hit_nameListFree(HitNameList list)
Definition: hit_shape.c:291
#define HIT_MAXDIMS
Definition: hit_shape.h:72
int idxtype
Definition: struct.h:19
void hit_nameListCreate(HitNameList *list, int nelems)
Definition: hit_shape.c:301
#define x
HitShape HIT_SHAPE_NULL
Definition: hit_shape.c:60
#define s
HitNameList HIT_NAMELIST_NULL
Definition: hit_shape.c:80
void hit_shapeFree(HitShape s)
Definition: hit_shape.c:84
#define HIT_SPARSE_MAXDIMS
Definition: hit_shape.h:81