source: CIVL/examples/mpi-omp/AMG2013/struct_mv/box_manager.h

main
Last change on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 8.1 KB
Line 
1#ifndef hypre_BOX_MANAGER_HEADER
2#define hypre_BOX_MANAGER_HEADER
3
4
5/*---------------------------------------------------------------------------
6 *
7 * Box Manager: organizes arbitrary information in a spatial way
8 *
9 *----------------------------------------------------------------------------*/
10
11
12typedef struct hypre_BoxManEntry_struct
13{
14 hypre_Index imin; /*extents of box */
15 hypre_Index imax;
16
17 int proc; /*this is a two-part unique id: (proc, id) */
18 int id;
19 int num_ghost[6];
20
21 void *info;
22
23 struct hypre_BoxManEntry_struct *next;
24
25} hypre_BoxManEntry;
26
27
28/*-----------------------------------------------------------------------------*/
29
30typedef struct
31{
32
33 MPI_Comm comm;
34
35 int max_nentries; /* storage in entries allocated to this
36 amount */
37
38
39 int is_gather_called; /* boolean to indicate whether GatherEntries
40 function has been called (prior to
41 assemble) - may not want this (can tell
42 by the size of gather_regions array) */
43
44 hypre_BoxArray *gather_regions; /*this is where we collect boxes input
45 by calls to BoxManGatherEntries - to be
46 gathered in the assemble. These are then
47 deleted after the assemble */
48
49
50 int all_global_known; /* Boolean to say that every
51 processor already has all
52 of the global data for
53 this manager (this could be
54 acessed by a coarsening routine,
55 for example) */
56
57
58 int entry_info_size; /* in bytes, the (max) size of the info
59 object for the entries */
60
61 /* storing the entries */
62 int nentries; /* number of entries stored */
63 hypre_BoxManEntry *entries; /* These are the actual box manager entries */
64
65
66
67 /* for accessing an entry via (proc, id) */
68
69 hypre_BoxManEntry **sort_table; /* points into *entries and is sorted
70 by each entry's unique two-part id:
71 (proc, id) */
72
73 int *procs_sort; /* the sorted procs corresponding to entries*/
74 int *ids_sort; /* sorted ids corresponding to the entries */
75
76 int num_procs_sort; /* number of distinct procs in *entries */
77 int *procs_sort_offsets; /* offsets for procs into the
78 *entry_sort array */
79 int first_local; /* position of local infomation */
80 int local_proc_offset; /*position of local information in offsets */
81
82 /* here is the table that organizes the entires spatially (by index)*/
83 hypre_BoxManEntry **index_table; /* this points into 'entries' array
84 and corresponds to the index arays*/
85
86 int *indexes[3]; /* here we have the x,y,z indexes (ordered)
87 for the imin and imax
88 of each box in the entries array*/
89 int size[3]; /* how many indexes we have in each direction
90 - x,y,z */
91
92 int last_index[3]; /* the last index used in the indexes map */
93
94 /* extra stuff needed for AP implementation */
95
96 int num_my_entries; /* number of entries with proc_id = myid */
97 int *my_ids; /* an array of ids corresponding to my entries */
98 hypre_BoxManEntry **my_entries; /* points into *entries that are mine & corresponds to
99 my_ids array. This is destroyed in the assemble */
100
101 hypre_StructAssumedPart *assumed_partition; /* the assumed partition object - for now this is only
102 us ed during the assemble (where it is created)*/
103 int dim; /* problem dimension (known in the grid) */
104
105 /* ghost stuff - leave for now */
106
107 int num_ghost[6];
108
109
110
111} hypre_BoxManager;
112
113
114/*--------------------------------------------------------------------------
115 * Accessor macros: hypre_BoxMan
116 *--------------------------------------------------------------------------*/
117
118#define hypre_BoxManComm(manager) ((manager) -> comm)
119
120#define hypre_BoxManMaxNEntries(manager) ((manager) -> max_nentries)
121
122#define hypre_BoxManIsGatherCalled(manager) ((manager) -> is_gather_called)
123#define hypre_BoxManGatherRegions(manager) ((manager) -> gather_regions)
124#define hypre_BoxManAllGlobalKnown(manager) ((manager) -> all_global_known)
125#define hypre_BoxManEntryInfoSize(manager) ((manager) -> entry_info_size)
126#define hypre_BoxManNEntries(manager) ((manager) -> nentries)
127#define hypre_BoxManEntries(manager) ((manager) -> entries)
128
129#define hypre_BoxManSortTable(manager) ((manager) -> sort_table)
130#define hypre_BoxManProcsSort(manager) ((manager) -> procs_sort)
131#define hypre_BoxManIdsSort(manager) ((manager) -> ids_sort)
132#define hypre_BoxManNumProcsSort(manager) ((manager) -> num_procs_sort)
133#define hypre_BoxManProcsSortOffsets(manager) ((manager) -> procs_sort_offsets)
134#define hypre_BoxManLocalProcOffset(manager) ((manager) -> local_proc_offset)
135
136#define hypre_BoxManFirstLocal(manager) ((manager) -> first_local)
137
138#define hypre_BoxManIndexTable(manager) ((manager) -> index_table)
139#define hypre_BoxManIndexes(manager) ((manager) -> indexes)
140#define hypre_BoxManSize(manager) ((manager) -> size)
141#define hypre_BoxManLastIndex(manager) ((manager) -> last_index)
142
143#define hypre_BoxManNumMyEntries(manager) ((manager) -> num_my_entries)
144#define hypre_BoxManMyIds(manager) ((manager) -> my_ids)
145#define hypre_BoxManMyEntries(manager) ((manager) -> my_entries)
146#define hypre_BoxManAssumedPartition(manager) ((manager) -> assumed_partition)
147#define hypre_BoxManDim(manager) ((manager) -> dim)
148
149#define hypre_BoxManNumGhost(manager) ((manager) -> num_ghost)
150
151#define hypre_BoxManIndexesD(manager, d) hypre_BoxManIndexes(manager)[d]
152#define hypre_BoxManSizeD(manager, d) hypre_BoxManSize(manager)[d]
153#define hypre_BoxManLastIndexD(manager, d) hypre_BoxManLastIndex(manager)[d]
154#define hypre_BoxManIndexTableEntry(manager, i, j, k) \
155hypre_BoxManIndexTable(manager)[((k*hypre_BoxManSizeD(manager, 1) + j)*\
156 hypre_BoxManSizeD(manager, 0) + i)]
157
158
159
160
161/*--------------------------------------------------------------------------
162 * Accessor macros: hypre_BoxManEntry
163 *--------------------------------------------------------------------------*/
164
165#define hypre_BoxManEntryIMin(entry) ((entry) -> imin)
166#define hypre_BoxManEntryIMax(entry) ((entry) -> imax)
167#define hypre_BoxManEntryProc(entry) ((entry) -> proc)
168#define hypre_BoxManEntryId(entry) ((entry) -> id)
169#define hypre_BoxManEntryInfo(entry) ((entry) -> info)
170#define hypre_BoxManEntryNumGhost(entry) ((entry) -> num_ghost)
171#define hypre_BoxManEntryNext(entry) ((entry) -> next)
172
173
174
175
176/*--------------------------------------------------------------------------
177 * Info objects
178 *--------------------------------------------------------------------------*/
179
180
181
182typedef struct
183{
184 int type;
185 int proc;
186 int offset;
187 int box;
188 int ghoffset;
189
190} hypre_BoxManInfoDefault;
191
192#define hypre_BoxManInfoDType(info) ((info) -> type)
193#define hypre_BoxManInfoDProc(info) ((info) -> proc)
194#define hypre_BoxManInfoDOffset(info) ((info) -> offset)
195#define hypre_BoxManInfoDBox(info) ((info) -> box)
196#define hypre_BoxManInfoDGhoffset(info) ((info) -> ghoffset)
197
198
199#endif
Note: See TracBrowser for help on using the repository browser.