Original WRF subgrid support version from John Michalakes without fire
[wrffire.git] / wrfv2_fire / external / RSL / RSL / comp_world.c
blob8b345c68ac85474814042a0c4ca6bb2c53119b27
1 /***********************************************************************
3 COPYRIGHT
5 The following is a notice of limited availability of the code and
6 Government license and disclaimer which must be included in the
7 prologue of the code and in all source listings of the code.
9 Copyright notice
10 (c) 1977 University of Chicago
12 Permission is hereby granted to use, reproduce, prepare
13 derivative works, and to redistribute to others at no charge. If
14 you distribute a copy or copies of the Software, or you modify a
15 copy or copies of the Software or any portion of it, thus forming
16 a work based on the Software and make and/or distribute copies of
17 such work, you must meet the following conditions:
19 a) If you make a copy of the Software (modified or verbatim)
20 it must include the copyright notice and Government
21 license and disclaimer.
23 b) You must cause the modified Software to carry prominent
24 notices stating that you changed specified portions of
25 the Software.
27 This software was authored by:
29 Argonne National Laboratory
30 J. Michalakes: (630) 252-6646; email: michalak@mcs.anl.gov
31 Mathematics and Computer Science Division
32 Argonne National Laboratory, Argonne, IL 60439
34 ARGONNE NATIONAL LABORATORY (ANL), WITH FACILITIES IN THE STATES
35 OF ILLINOIS AND IDAHO, IS OWNED BY THE UNITED STATES GOVERNMENT,
36 AND OPERATED BY THE UNIVERSITY OF CHICAGO UNDER PROVISION OF A
37 CONTRACT WITH THE DEPARTMENT OF ENERGY.
39 GOVERNMENT LICENSE AND DISCLAIMER
41 This computer code material was prepared, in part, as an account
42 of work sponsored by an agency of the United States Government.
43 The Government is granted for itself and others acting on its
44 behalf a paid-up, nonexclusive, irrevocable worldwide license in
45 this data to reproduce, prepare derivative works, distribute
46 copies to the public, perform publicly and display publicly, and
47 to permit others to do so. NEITHER THE UNITED STATES GOVERNMENT
48 NOR ANY AGENCY THEREOF, NOR THE UNIVERSITY OF CHICAGO, NOR ANY OF
49 THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR
50 ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY,
51 COMPLETENESS, OR USEFULNESS OF ANY INFORMATION, APPARATUS,
52 PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD
53 NOT INFRINGE PRIVATELY OWNED RIGHTS.
55 ***************************************************************************/
57 #include <stdio.h>
58 #include <stdlib.h>
59 #include "rsl.h"
61 /*@
62 RSL_GET_RUN_INFO - get RSL information about size and shape local allocation.
64 Notes:
65 This routine is used to initialize loops over each processor's
66 local partition of the decomposed domain. The routine can be used
67 directly, or RSL-provided macros may be used in the code that expand
68 to the proper calls. Both M4 and CPP macros are provided in the
69 RSL distribution (see LoopMacros).
70 The macro approach is recommended
71 for readability, simplicity,
72 and also to insulate the code from future potential updates in RSL.
73 Of the two sets, the M4 macros are recommended since they
74 are more flexible.
76 RSL returns through the arguments Arg6, Arg7, and Arg8 information
77 for iterating over the local processor partition N-major, M-minor.
78 Argument Arg4 is the number of iterations to cover the part of the
79 domain allocated to the processor. Arg6 contains the
80 J-indices (Arg4 of them) of each I-strip local to the processor.
81 The first index into the local partition is stored at stored at Arg6(3).
82 The locations Arg6(1) and Arg6(2) are placeholders for indices
83 if one wishes to include one or two of the pad or ghost cells in
84 the iteration (see RSL_GET_INFOP).
85 Arg7 contains the starting and ending indices of each I-strip. Likewise,
86 the first actual index in Arg7 is at Arg7(3).
87 The arguments Arg9, Arg10, and
88 Arg11 have the same sense as Arg6, Arg7, and Arg8, except that they
89 provide information for
90 iteration in M-major, N-minor order. Argument Arg5 is
91 the number of major iterations over M.
92 The arrays Arg6, Arg7, Arg8, Arg9, Arg10, and Arg11 store local (memory)
93 indices. The logical (global) indices can be obtained by subtracting
94 Arg12 (for M-dimension indices) or Arg13 (for N-dimension indices).
96 Unlike programs that are implemented in single address
97 spaces, the identical
98 relationship between logical and memory
99 indices does not hold for data-domain decomposition over distributed
100 memories. That is, the memory index (the subscripts into a model
101 array) may not be used for testing proximity of the point to a
102 boundary in the logical domain. Further, the relationship between
103 logical and memory indices differs on each processor. The Arg12 and
104 Arg13 arguments are the differences between the local and global
105 indices in the M and N dimensions, respectively, and can be used by
106 the program for converting between logical and memory indices. For
107 example, the local index I in the M dimension is equal to Arg12 plus
108 the global index IG.
110 All of these arrays -- Arg6, Arg7, Arg8, Arg9, Arg10, and Arg11
111 are integers and must have been allocated by the user with size
112 large enough to fit the largest possible run through a dimension.
113 The argument Arg2 is the length of the arrays.
114 The integer Arg1 is an RSL domain descriptor.
116 The integer Arg3
117 is the nest level of the domain (mother domain is at nest-level 1),
118 which is not necessary for iteration over the domain but which
119 is information that RSL has available and that is useful to have
120 at the beginning of a module.
122 Example:
124 $ -- original code --
126 $ subroutine F( ... )
127 $ ...
128 $ do j = 3, jl-2
129 $ do i = 3, il-2
130 $ a(i,j) = b(i,j) + c(i,j)
131 $ enddo
132 $ enddo
134 $ -- example using M4 macros in LoopMacros.m4 --
136 $ subroutine F( ... )
137 $ RSL_RUN_DECL
138 $ ...
139 $ RSL_INIT_RUNVARS(d) ! d is an RSL domain descriptor
140 $ RSL_DO_N(j,3,jl-2)
141 $ RSL_DO_M(i,3,il-2)
142 $ a(i,j) = b(i,j) + c(i,j)
143 $ RSL_ENDDO
144 $ RSL_ENDDO
146 $ -- example using CPP macros in LoopMacros.inc --
148 $ #include "LoopMacros.cpp"
149 $ subroutine F( ... )
150 $ RSL_DECLARE_RUN_VARS
151 $ ...
152 $ RSL_INIT_RUNS(d) ! d is an RSL domain descriptor
153 $ RSL_MAJOR_BOUND(j,3,jl-2)
154 $ RSL_MINOR_BOUND(j,3,jl-2)
155 $ a(i,j) = b(i,j) + c(i,j)
156 $ RSL_END_MINOR_LOOPB
157 $ RSL_END_MAJOR_LOOPB
159 $ -- example with macros expanded --
161 $ subroutine F( ... )
162 $ integer ig,jg,nruni,nrunj,js,is,ie,is2,js2,je2,idif,jdif,nr
163 $ dimension js(512) ,is(512) ,ie(512) ! for N-major iteration
164 $ dimension is2(512) ,js2(512) ,je2(512) ! for M-major iteration
166 $ call rsl_get_run_info( d, 512, nl, nrunj, nruni,
167 $ + js, is, ie,
168 $ + js2, is2, ie2,
169 $ + idif, jdif )
171 $ do nr = 3, nrun+2
172 $ j=js(nr)
173 $ jg=j-jdif
174 $ if ( jg .ge. 3 .and. jg .le. maxj-2 ) then
175 $ do i=is(nr),ie1(nr)
176 $ ig=i-idif
177 $ if ( ig .ge. 3 .and. ig .le. maxi-2 ) then
178 $ a(i,j) = b(i,j) + c(i,j)
179 $ endif
180 $ enddo
181 $ endif
182 $ enddo
184 BREAKTHEEXAMPLECODE
186 See also:
187 RSL_GET_RUN_INFOP, LoopMacros.m4
191 RSL_GET_RUN_INFO ( d_p, maxrun_p, nl_p, nrunj_p, nruni_p, js, is, ie, is2, js2, je2, idif_p, jdif_p )
192 int_p
193 d_p /* (I) RSL domain descriptor (input) */
194 ,maxrun_p /* (I) Number of elements in array arguments to this routine */
195 ,nl_p /* (O) Nest level of the domain */
196 ,nrunj_p /* (O) Number of runs through domain in j-major traversal */
197 ,nruni_p ; /* (O) Number of runs through domain in i-minor traversal */
199 js[] /* (O) Local J-index of each run in j-major traversal */
200 ,is[] /* (O) Starting local I-index of each run in j-major traversal */
201 ,ie[] /* (O) Ending local I-index of each run in j-major traversal */
202 ,is2[] /* (O) Local I-index of each run in i-major traversal */
203 ,js2[] /* (O) Starting local J-index of each run in i-major traversal */
204 ,je2[] ; /* (O) Ending local J-index of each run in i-major traversal */
205 int_p
206 idif_p /* (O) Difference between local and global I indices (i-ig). */
207 ,jdif_p ; /* (O) Difference between local and global J indices (j-jg). */
209 int x ;
210 int *dummy ;
211 x = 0 ;
212 dummy = NULL ;
213 RSL_GET_RUN_INFOP ( d_p, &x, maxrun_p, nl_p, nrunj_p, nruni_p,
214 js, is, ie, is2, js2, je2, idif_p, jdif_p,
215 dummy, dummy ) ;
218 /* additional P argument is the width of pad to allow for */
220 RSL_GET_RUN_INFOP - get RSL information about size and shape local allocation.
222 Notes:
223 This routine is similar to RSL_GET_RUN_INFO except that it allows for
224 execution on the extended array pads of the local processor
225 subdomains. This can be useful for trading off computation for
226 communication in the code and can simplify the implementation
227 by allowing fewer modifications for distributed memory
228 parallelism. The argument Arg2 may be set to
229 for one of 3 modes of iteration over the local subdomain ---
230 Arg2 = 2 gives iteration over the local subdomain and the set of
231 ghost points that are two-away from points in the local subdomain,
232 Arg2 = 1 gives iteration over the local subdomain and the set of
233 ghost points that are one-away from points in the local subdomain, and
234 Arg2 = 0 gives iteration over just the local subdomain (no ghost points).
235 that are immediately adjacent to the local processor subdomain, or
236 the set that is within 2 cells of the local processor subdomain. The
237 information for controlling iteration over the region is returned in
238 the arguments Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, and Arg12.
240 The M4 RSL loop macros automatically initialize 3 separate sets of
241 these data structures for the 3 available modes of iteration.
243 See also:
244 RSL_GET_RUN_INFO, LoopMacros.m4
246 RSL_GET_RUN_INFOP ( d_p, p_p, maxrun_p, nl_p, nrunj_p, nruni_p,
247 js, is, ie, is2, js2, je2, idif_p, jdif_p,
248 jg2n, ig2n )
249 int_p
250 d_p /* (I) RSL domain descriptor (input) */
251 ,p_p /* (I) How many extra pad cells to include (0, 1, or 2) */
252 ,maxrun_p /* (I) Number of elements in array arguments to this routine */
253 ,nl_p /* (O) Nest level of the domain */
254 ,nrunj_p /* (O) Number of runs through domain in j-major traversal */
255 ,nruni_p /* (O) Number of runs through domain in i-minor traversal */
256 ,js /* (OA) Local J-index of each run in j-major traversal */
257 ,is /* (OA) Starting local I-index of each run in j-major traversal */
258 ,ie /* (OA) Ending local I-index of each run in j-major traversal */
259 ,is2 /* (OA) Local I-index of each run in i-major traversal */
260 ,js2 /* (OA) Starting local J-index of each run in i-major traversal */
261 ,je2 /* (OA) Ending local J-index of each run in i-major traversal */
262 ,idif_p /* (O) Difference between local and global I indices (i-ig). */
263 ,jdif_p /* (O) Difference between local and global J indices (j-jg). */
264 ,jg2n /* (OA) Number of run for a global J-index in j-major traversal. */
265 ,ig2n /* (OA) Number of run for a global I-index in i-major traversal. */
268 int d, i, p ;
269 d = *d_p ;
270 p = *p_p ;
272 RSL_TEST_ERR( d < 0 || d >= RSL_MAXDOMAINS,
273 "rsl_get_run_info: bad domain") ;
274 RSL_TEST_ERR( p < 0, "Negative pad arg for RSL_GET_RUN_INFOP") ;
275 if ( p > MAX_KINDPAD )
277 sprintf(mess,"RSL_GET_RUN_INFOP: pad arg (%d) larger than %d",p,MAX_KINDPAD) ;
278 RSL_TEST_ERR( 1, mess ) ;
280 RSL_TEST_ERR( domain_info[d].valid != RSL_VALID,
281 "rsl_init_nextcell: invalid domain") ;
282 if ( domain_info[d].decomposed != 1 )
284 default_decomposition( d_p,
285 &(domain_info[*d_p].loc_m),
286 &(domain_info[*d_p].loc_n) ) ;
289 *nl_p = domain_info[d].nest_level ;
290 *idif_p = domain_info[d].idif ;
291 *jdif_p = domain_info[d].jdif ;
293 *nrunj_p = domain_info[d].nrun[p] ;
294 if ( *maxrun_p < *nrunj_p )
296 sprintf(mess,
297 "rsl_get_run_info: would overwrite user arrays: maxrun (%d) < nruni (%d)",
298 *maxrun_p, *nrunj_p ) ;
299 RSL_TEST_ERR( 1, mess ) ;
302 /*****************/
303 if ( p <= MAX_RUNPAD )
305 for ( i = 0 ; i < MAX_RUNPAD-p ; i++ )
307 js[i] = 0 ;
308 is[i] = 0 ;
309 ie[i] = -1 ;
311 for ( i = 0 ; i < *nrunj_p ; i++ )
313 js[i+(MAX_RUNPAD-p)] = domain_info[d].js[p][i] ;
314 is[i+(MAX_RUNPAD-p)] = domain_info[d].is[p][i] ;
315 ie[i+(MAX_RUNPAD-p)] = domain_info[d].ie[p][i] ;
317 if ( jg2n != NULL )
319 for ( i = 0 ; i < domain_info[d].len_n ; i++ )
321 jg2n[i] = domain_info[d].jg2n[p][i] + MAX_RUNPAD-p;
325 *nruni_p = domain_info[d].nruni[p] ;
326 if ( *maxrun_p < *nruni_p )
328 sprintf(mess,
329 "rsl_get_run_info: would overwrite user arrays: maxrun (%d) < nruni (%d)",
330 *maxrun_p, *nruni_p ) ;
331 RSL_TEST_ERR( 1, mess ) ;
333 for ( i = 0 ; i < MAX_RUNPAD-p ; i++ )
335 is2[i] = 0 ;
336 js2[i] = 0 ;
337 je2[i] = -1 ;
339 for ( i = 0 ; i < *nruni_p ; i++ )
341 is2[i+(MAX_RUNPAD-p)] = domain_info[d].is2[p][i] ;
342 js2[i+(MAX_RUNPAD-p)] = domain_info[d].js2[p][i] ;
343 je2[i+(MAX_RUNPAD-p)] = domain_info[d].je2[p][i] ;
345 if ( ig2n != NULL )
347 for ( i = 0 ; i < domain_info[d].len_n ; i++ )
349 ig2n[i] = domain_info[d].ig2n[p][i] + MAX_RUNPAD-p;
353 /*****************/
354 /*****************/
355 else if ( p > 3 && p <= 4)
357 int p1 ;
358 p1 = 0 ;
359 for ( i = 0 ; i < MAX_RUNPAD-p1 ; i++ )
361 js[i] = 0 ;
362 is[i] = 0 ;
363 ie[i] = -1 ;
365 for ( i = 0 ; i < *nrunj_p ; i++ )
367 js[i+(MAX_RUNPAD-0)] = domain_info[d].js[p][i] ;
368 is[i+(MAX_RUNPAD-0)] = domain_info[d].is[p][i] ;
369 ie[i+(MAX_RUNPAD-0)] = domain_info[d].ie[p][i] ;
371 if ( jg2n != NULL )
373 for ( i = 0 ; i < domain_info[d].len_n ; i++ )
375 jg2n[i] = domain_info[d].jg2n[p][i] + MAX_RUNPAD-0;
379 *nruni_p = domain_info[d].nruni[p] ;
380 if ( *maxrun_p < *nruni_p )
382 sprintf(mess,
383 "rsl_get_run_info: would overwrite user arrays: maxrun (%d) < nruni (%d)",
384 *maxrun_p, *nruni_p ) ;
385 RSL_TEST_ERR( 1, mess ) ;
387 for ( i = 0 ; i < MAX_RUNPAD-0 ; i++ )
389 is2[i] = 0 ;
390 js2[i] = 0 ;
391 je2[i] = -1 ;
393 for ( i = 0 ; i < *nruni_p ; i++ )
395 is2[i+(MAX_RUNPAD-0)] = domain_info[d].is2[p][i] ;
396 js2[i+(MAX_RUNPAD-0)] = domain_info[d].js2[p][i] ;
397 je2[i+(MAX_RUNPAD-0)] = domain_info[d].je2[p][i] ;
399 if ( ig2n != NULL )
401 for ( i = 0 ; i < domain_info[d].len_n ; i++ )
403 ig2n[i] = domain_info[d].ig2n[p][i] + MAX_RUNPAD-0;
407 /*****************/
410 RSL_REG_RUN_INFOP ( d_p, p_p, maxrun_p, nl_p,
411 is, ie,
412 js, je,
413 idif_p, jdif_p )
414 int_p
415 d_p /* (I) RSL domain descriptor (input) */
416 ,p_p /* (I) How many extra pad cells to include (0, 1, or 2) */
417 ,maxrun_p /* (I) Number of elements in array arguments to this routine */
418 ,nl_p /* (O) Nest level of the domain */
423 ,idif_p
424 ,jdif_p ;
426 int d, i, j, p, cnt ;
427 d = *d_p ;
428 p = *p_p ;
430 RSL_TEST_ERR( d < 0 || d >= RSL_MAXDOMAINS,
431 "rsl_get_run_info: bad domain") ;
432 RSL_TEST_ERR( p < 0, "Negative pad arg for RSL_GET_RUN_INFOP") ;
433 if ( p > MAX_KINDPAD )
435 sprintf(mess,"RSL_GET_RUN_INFOP: pad arg (%d) larger than %d",p,MAX_KINDPAD)
437 RSL_TEST_ERR( 1, mess ) ;
439 RSL_TEST_ERR( ((! sw_allow_dynpad) && p > 4),
440 "Invalid to call RSL_REG_RUN_INFOP with p > 4 if RSL_ALLOW_DYNPAD has not been called.\n") ;
441 RSL_TEST_ERR( domain_info[d].valid != RSL_VALID,
442 "rsl_init_nextcell: invalid domain") ;
443 if ( domain_info[d].decomposed != 1 )
445 default_decomposition( d_p,
446 &(domain_info[*d_p].loc_m),
447 &(domain_info[*d_p].loc_n) ) ;
449 RSL_TEST_ERR( domain_info[*d_p].len_n > *maxrun_p,
450 "domain_info[*d_p].len_n > *maxrun_p") ;
451 RSL_TEST_ERR( domain_info[*d_p].len_m > *maxrun_p,
452 "domain_info[*d_p].len_m > *maxrun_p") ;
454 *nl_p = domain_info[d].nest_level ;
455 *idif_p = domain_info[d].idif ;
456 *jdif_p = domain_info[d].jdif ;
458 #define WHICH_RUN 0
459 /* in following code, note assumptions on order of traversal,
460 contiguity of points, and rectangularity of partitions */
461 /** js, je **/
462 for ( j=0, cnt=0 ; j < domain_info[*d_p].len_n ; j++ )
464 if ( j+1 < domain_info[d].js2[p][WHICH_RUN]-*jdif_p )
466 js[j]=domain_info[d].js2[p][WHICH_RUN] ;
467 je[j]=-9999999 ;
469 else if ( j+1 > domain_info[d].je2[p][WHICH_RUN]-*jdif_p )
471 js[j]=9999999 ;
472 je[j]=domain_info[d].je2[p][WHICH_RUN] ;
474 else
476 js[j]=domain_info[d].js2[p][WHICH_RUN] + cnt ;
477 je[j]=domain_info[d].js2[p][WHICH_RUN] + cnt ; /* yes -> js2 */
478 cnt++ ;
481 /** is, ie **/
482 for ( i=0, cnt=0 ; i < domain_info[*d_p].len_m ; i++ )
484 if ( i+1 < domain_info[d].is[p][WHICH_RUN]-*idif_p )
486 is[i]=domain_info[d].is[p][WHICH_RUN] ;
487 ie[i]=-9999999 ;
489 else if ( i+1 > domain_info[d].ie[p][WHICH_RUN]-*idif_p )
491 is[i]=9999999 ;
492 ie[i]=domain_info[d].ie[p][WHICH_RUN] ;
494 else
496 is[i]=domain_info[d].is[p][WHICH_RUN] + cnt ;
497 ie[i]=domain_info[d].is[p][WHICH_RUN] + cnt ; /* yes -> is */
498 cnt++ ;
503 RSL_DYNPAD_7 ( d_p, maxrun_p, nl_p,
504 is, ie,
505 js, je,
506 idif_p, jdif_p )
507 int_p
508 d_p /* (I) RSL domain descriptor (input) */
509 ,maxrun_p /* (I) Number of elements in array arguments to this routine */
510 ,nl_p /* (O) Nest level of the domain */
511 ,is /* 2d arrays -- first index is array elements, second is runpad from 0..6 */
515 ,idif_p
516 ,jdif_p ;
518 int d, i, j, p, cnt ;
519 d = *d_p ;
521 RSL_TEST_ERR( d < 0 || d >= RSL_MAXDOMAINS,
522 "rsl_get_run_info: bad domain") ;
523 RSL_TEST_ERR( domain_info[d].valid != RSL_VALID,
524 "rsl_init_nextcell: invalid domain") ;
525 RSL_TEST_ERR( ! sw_allow_dynpad, "RSL_DYNPAD_7 cannot be used unless RSL_ALLOW_DYNPAD has been called") ;
526 if ( domain_info[d].decomposed != 1 )
528 default_decomposition( d_p,
529 &(domain_info[*d_p].loc_m),
530 &(domain_info[*d_p].loc_n) ) ;
532 RSL_TEST_ERR( domain_info[*d_p].len_n > *maxrun_p,
533 "domain_info[*d_p].len_n > *maxrun_p") ;
534 RSL_TEST_ERR( domain_info[*d_p].len_m > *maxrun_p,
535 "domain_info[*d_p].len_m > *maxrun_p") ;
537 *nl_p = domain_info[d].nest_level ;
538 *idif_p = domain_info[d].idif ;
539 *jdif_p = domain_info[d].jdif ;
541 for ( p = 0 ; p <= 6 ; p++ )
544 #define WHICH_RUN 0
545 /* in following code, note assumptions on order of traversal,
546 contiguity of points, and rectangularity of partitions */
547 /** js, je **/
548 for ( j=0, cnt=0 ; j < domain_info[*d_p].len_n ; j++ )
550 if ( j+1 < domain_info[d].js2[p][WHICH_RUN]-*jdif_p )
552 js[j+*maxrun_p*p]=domain_info[d].js2[p][WHICH_RUN] ;
553 je[j+*maxrun_p*p]=-9999999 ;
555 else if ( j+1 > domain_info[d].je2[p][WHICH_RUN]-*jdif_p )
557 js[j+*maxrun_p*p]=9999999 ;
558 je[j+*maxrun_p*p]=domain_info[d].je2[p][WHICH_RUN] ;
560 else
562 js[j+*maxrun_p*p]=domain_info[d].js2[p][WHICH_RUN] + cnt ;
563 je[j+*maxrun_p*p]=domain_info[d].js2[p][WHICH_RUN] + cnt ; /* yes -> js2 */
564 cnt++ ;
567 /** is, ie **/
568 for ( i=0, cnt=0 ; i < domain_info[*d_p].len_m ; i++ )
570 if ( i+1 < domain_info[d].is[p][WHICH_RUN]-*idif_p )
572 is[i+*maxrun_p*p]=domain_info[d].is[p][WHICH_RUN] ;
573 ie[i+*maxrun_p*p]=-9999999 ;
575 else if ( i+1 > domain_info[d].ie[p][WHICH_RUN]-*idif_p )
577 is[i+*maxrun_p*p]=9999999 ;
578 ie[i+*maxrun_p*p]=domain_info[d].ie[p][WHICH_RUN] ;
580 else
582 is[i+*maxrun_p*p]=domain_info[d].is[p][WHICH_RUN] + cnt ;
583 ie[i+*maxrun_p*p]=domain_info[d].is[p][WHICH_RUN] + cnt ; /* yes -> is */
584 cnt++ ;
590 RSL_REG_PATCHINFO_MN ( d_p ,
591 sp1 , ep1 , sp2 , ep2 , sp3 , ep3 )
592 int_p d_p ;
593 int_p sp1 , ep1 , sp2 , ep2 , sp3 , ep3 ;
595 int d, i, j, k ;
596 d = *d_p ;
597 RSL_TEST_ERR( d < 0 || d >= RSL_MAXDOMAINS, "rsl_get_run_info: bad domain" ) ;
598 *sp1 = -1 ; *ep1 = -1 ;
599 *sp2 = -1 ; *ep2 = -1 ;
600 for ( j = 0 ; j < domain_info[d].len_n ; j++ )
602 for ( i = 0 ; i < domain_info[d].len_m ; i++ )
604 if ( rsl_c_comp2phys_proc(domain_info[d].domain[INDEX_2(j,i,domain_info[d].len_m)].P)==rsl_myproc)
606 if ( *sp1 < 0 ) *sp1 = i + 1 ;
607 *ep1 = i + 1 ;
608 if ( *sp2 < 0 ) *sp2 = j + 1 ;
609 *ep2 = j + 1 ;
613 *sp3 = 1 ;
614 *ep3 = domain_info[d].len_z ;
617 RSL_REG_PATCHINFO_MZ ( d_p ,
618 sp1 , ep1 , sp2 , ep2 , sp3 , ep3 )
619 int_p d_p ;
620 int_p sp1 , ep1 , sp2 , ep2 , sp3 , ep3 ;
622 int d, i, j, k ;
623 d = *d_p ;
624 RSL_TEST_ERR( d < 0 || d >= RSL_MAXDOMAINS, "rsl_get_run_info: bad domain" ) ;
625 *sp1 = -1 ; *ep1 = -1 ;
626 *sp3 = -1 ; *ep3 = -1 ;
627 for ( k = 0 ; k < domain_info[d].len_z ; k++ )
629 for ( i = 0 ; i < domain_info[d].len_m ; i++ )
631 if ( rsl_c_comp2phys_proc(domain_info[d].domain_mz[INDEX_2(k,i,domain_info[d].len_m)].P)==rsl_myproc)
633 if ( *sp1 < 0 ) *sp1 = i + 1 ;
634 *ep1 = i + 1 ;
635 if ( *sp3 < 0 ) *sp3 = k + 1 ;
636 *ep3 = k + 1 ;
640 *sp2 = 1 ;
641 *ep2 = domain_info[d].len_n ;
644 RSL_REG_PATCHINFO_NZ ( d_p ,
645 sp1 , ep1 , sp2 , ep2 , sp3 , ep3 )
646 int_p d_p ;
647 int_p sp1 , ep1 , sp2 , ep2 , sp3 , ep3 ;
649 int d, i, j, k ;
650 d = *d_p ;
651 RSL_TEST_ERR( d < 0 || d >= RSL_MAXDOMAINS, "rsl_get_run_info: bad domain" ) ;
652 *sp2 = -1 ; *ep2 = -1 ;
653 *sp3 = -1 ; *ep3 = -1 ;
654 for ( k = 0 ; k < domain_info[d].len_z ; k++ )
656 for ( j = 0 ; j < domain_info[d].len_n ; j++ )
658 if ( rsl_c_comp2phys_proc(domain_info[d].domain_nz[INDEX_2(k,j,domain_info[d].len_n)].P)==rsl_myproc)
660 if ( *sp2 < 0 ) *sp2 = j + 1 ;
661 *ep2 = j + 1 ;
662 if ( *sp3 < 0 ) *sp3 = k + 1 ;
663 *ep3 = k + 1 ;
667 *sp1 = 1 ;
668 *ep1 = domain_info[d].len_m ;
671 RSL_GET_GLEN ( d_p , mlen_p , nlen_p , zlen_p )
672 int_p d_p, mlen_p, nlen_p, zlen_p ;
674 rsl_domain_info_t *dinfo ;
675 int d ;
677 d = *d_p ;
678 RSL_TEST_ERR( d < 0 || d >= RSL_MAXDOMAINS,
679 "rsl_get_get_glen: bad domain") ;
680 RSL_TEST_ERR( domain_info[d].valid != RSL_VALID,
681 "rsl_get_glen: invalid domain") ;
683 dinfo = &(domain_info[d]) ;
684 *mlen_p = dinfo->len_m ;
685 *nlen_p = dinfo->len_n ;
686 *zlen_p = dinfo->len_z ;
687 return(0) ;