xref: /petsc/src/ksp/pc/impls/tfs/tfs.h (revision e0c929782f653733b5b44051f7bcff439f1f56d2)
1 
2 #if !defined(__TFS_H)
3 #define __TFS_H
4 
5 /**********************************const.h*************************************
6 
7 Author: Henry M. Tufo III
8 
9 e-mail: hmt@cs.brown.edu
10 
11 snail-mail:
12 Division of Applied Mathematics
13 Brown University
14 Providence, RI 02912
15 
16 Last Modification:
17 6.21.97
18 ***********************************const.h************************************/
19 
20 /**********************************const.h*************************************
21 File Description:
22 -----------------
23 
24 ***********************************const.h************************************/
25 #include "petsc.h"
26 #include "petscsys.h"
27 #if defined(PETSC_HAVE_STDLIB_H)
28 #include <stdlib.h>
29 #endif
30 #if defined(PETSC_HAVE_MALLOC_H)
31 #include <malloc.h>
32 #endif
33 #include "petscblaslapack.h"
34 #include <limits.h>
35 #include <float.h>
36 
37 #define X          0
38 #define Y          1
39 #define Z          2
40 #define XY         3
41 #define XZ         4
42 #define YZ         5
43 
44 
45 #define THRESH          0.2
46 #define N_HALF          4096
47 #define PRIV_BUF_SZ     45
48 
49 /*4096 8192 32768 65536 1048576 */
50 #define MAX_MSG_BUF     32768
51 
52 #define FULL          2
53 #define PARTIAL       1
54 #define NONE          0
55 
56 #define BYTE		8
57 #define BIT_0		0x1
58 #define BIT_1		0x2
59 #define BIT_2		0x4
60 #define BIT_3		0x8
61 #define BIT_4		0x10
62 #define BIT_5		0x20
63 #define BIT_6		0x40
64 #define BIT_7		0x80
65 #define TOP_BIT         INT_MIN
66 #define ALL_ONES        -1
67 
68 #define FALSE		0
69 #define TRUE		1
70 
71 #define C		0
72 
73 
74 #define MAX_VEC		1674
75 #define FORMAT		30
76 #define MAX_COL_LEN    	100
77 #define MAX_LINE	FORMAT*MAX_COL_LEN
78 #define   DELIM         " \n \t"
79 #define LINE		12
80 #define C_LINE		80
81 
82 #define REAL_MAX	DBL_MAX
83 #define REAL_MIN	DBL_MIN
84 
85 #define   UT            5               /* dump upper 1/2 */
86 #define   LT            6               /* dump lower 1/2 */
87 #define   SYMM          8               /* we assume symm and dump upper 1/2 */
88 #define   NON_SYMM      9
89 
90 #define   ROW          10
91 #define   COL          11
92 
93 #define EPS   1.0e-14
94 #define EPS2  1.0e-07
95 
96 
97 #define MPI   1
98 #define NX    2
99 
100 
101 #define LOG2(x)		(PetscScalar)log((double)x)/log(2)
102 #define SWAP(a,b)       temp=(a); (a)=(b); (b)=temp;
103 #define P_SWAP(a,b)     ptr=(a); (a)=(b); (b)=ptr;
104 
105 #define MAX_FABS(x,y)   ((double)fabs(x)>(double)fabs(y)) ? ((PetscScalar)x) : ((PetscScalar)y)
106 #define MIN_FABS(x,y)   ((double)fabs(x)<(double)fabs(y)) ? ((PetscScalar)x) : ((PetscScalar)y)
107 
108 /* specer's existence ... can be done w/MAX_ABS */
109 #define EXISTS(x,y)     ((x)==0.0) ? (y) : (x)
110 
111 #define MULT_NEG_ONE(a) (a) *= -1;
112 #define NEG(a)          (a) |= BIT_31;
113 #define POS(a)          (a) &= INT_MAX;
114 
115 
116 
117 
118 /**********************************types.h*************************************
119 
120 Author: Henry M. Tufo III
121 
122 e-mail: hmt@cs.brown.edu
123 
124 snail-mail:
125 Division of Applied Mathematics
126 Brown University
127 Providence, RI 02912
128 
129 Last Modification:
130 6.21.97
131 ***********************************types.h************************************/
132 
133 /**********************************types.h*************************************
134 File Description:
135 -----------------
136 
137 ***********************************types.h************************************/
138 typedef PetscErrorCode (*vfp)(void*,void*,int,...);
139 typedef PetscErrorCode (*rbfp)(PetscScalar *, PetscScalar *, int len);
140 #define vbfp MPI_User_function *
141 typedef int (*bfp)(void*, void *, int *len, MPI_Datatype *dt);
142 
143 /***********************************comm.h*************************************
144 
145 Author: Henry M. Tufo III
146 
147 e-mail: hmt@cs.brown.edu
148 
149 snail-mail:
150 Division of Applied Mathematics
151 Brown University
152 Providence, RI 02912
153 
154 Last Modification:
155 6.21.97
156 ***********************************comm.h*************************************/
157 
158 /***********************************comm.h*************************************
159 File Description:
160 -----------------
161 
162 ***********************************comm.h*************************************/
163 
164 /***********************************comm.h*************************************
165 Function:
166 
167 Input :
168 Output:
169 Return:
170 Description:
171 Usage:
172 ***********************************comm.h*************************************/
173 extern PetscMPIInt my_id;
174 extern PetscMPIInt num_nodes;
175 extern PetscMPIInt floor_num_nodes;
176 extern PetscMPIInt i_log2_num_nodes;
177 
178 extern PetscErrorCode giop(int *vals, int *work, int n, int *oprs);
179 extern PetscErrorCode grop(PetscScalar *vals, PetscScalar *work, int n, int *oprs);
180 extern PetscErrorCode gfop(void *vals, void *wk, int n, vbfp fp, MPI_Datatype dt, int comm_type);
181 extern PetscErrorCode comm_init(void);
182 extern PetscErrorCode giop_hc(int *vals, int *work, int n, int *oprs, int dim);
183 extern PetscErrorCode grop_hc(PetscScalar *vals, PetscScalar *work, int n, int *oprs, int dim);
184 extern PetscErrorCode grop_hc_vvl(PetscScalar *vals, PetscScalar *work, int *n, int *oprs, int dim);
185 extern PetscErrorCode ssgl_radd(PetscScalar *vals, PetscScalar *work, int level, int *segs);
186 
187 #define MSGTAG0 101
188 #define MSGTAG1 1001
189 #define MSGTAG2 76207
190 #define MSGTAG3 100001
191 #define MSGTAG4 163841
192 #define MSGTAG5 249439
193 #define MSGTAG6 10000001
194 
195 
196 /**********************************error.h*************************************
197 
198 Author: Henry M. Tufo III
199 
200 e-mail: hmt@cs.brown.edu
201 
202 snail-mail:
203 Division of Applied Mathematics
204 Brown University
205 Providence, RI 02912
206 
207 Last Modification:
208 6.21.97
209 **********************************error.h*************************************/
210 
211 /**********************************error.h*************************************
212 File Description:
213 -----------------
214 
215 **********************************error.h*************************************/
216 
217 /**********************************error.h*************************************
218 Function: error_msg_fatal()
219 
220 Input : formatted string and arguments.
221 Output: conversion printed to stdout.
222 Return: na.
223 Description: prints error message and terminates program.
224 Usage: error_msg_fatal("this is my %d'st test",test_num)
225 **********************************error.h*************************************/
226 extern PetscErrorCode error_msg_fatal(const char msg[], ...);
227 
228 
229 
230 /**********************************error.h*************************************
231 Function: error_msg_warning()
232 
233 Input : formatted string and arguments.
234 Output: conversion printed to stdout.
235 Return: na.
236 Description: prints error message.
237 Usage: error_msg_warning("this is my %d'st test",test_num)
238 **********************************error.h*************************************/
239 extern PetscErrorCode error_msg_warning(const char msg[], ...);
240 
241 /*$Id: vector.c,v 1.228 2001/03/23 23:21:22 balay Exp $*/
242 /**********************************ivec.h**************************************
243 
244 Author: Henry M. Tufo III
245 
246 e-mail: hmt@cs.brown.edu
247 
248 snail-mail:
249 Division of Applied Mathematics
250 Brown University
251 Providence, RI 02912
252 
253 Last Modification:
254 6.21.97
255 ***********************************ivec.h*************************************/
256 
257 /**********************************ivec.h**************************************
258 File Description:
259 -----------------
260 
261 ***********************************ivec.h*************************************/
262 
263 #define SORT_REAL		1
264 #define SORT_INTEGER	        0
265 #define SORT_INT_PTR	        2
266 
267 
268 #define NON_UNIFORM     0
269 #define GL_MAX          1
270 #define GL_MIN          2
271 #define GL_MULT         3
272 #define GL_ADD          4
273 #define GL_B_XOR        5
274 #define GL_B_OR         6
275 #define GL_B_AND        7
276 #define GL_L_XOR        8
277 #define GL_L_OR         9
278 #define GL_L_AND        10
279 #define GL_MAX_ABS      11
280 #define GL_MIN_ABS      12
281 #define GL_EXISTS       13
282 
283 
284 
285 /**********************************ivec.h**************************************
286 Function:
287 
288 Input :
289 Output:
290 Return:
291 Description:
292 Usage:
293 ***********************************ivec.h*************************************/
294 extern PetscErrorCode ivec_dump(int *v, int n, int tag, int tag2, char * s);
295 extern PetscErrorCode ivec_lb_ub(int *arg1, int n, int *lb, int *ub);
296 extern int *ivec_copy(int *arg1, int *arg2, int n);
297 
298 extern PetscErrorCode ivec_comp(int *arg1, int n);
299 
300 extern int ivec_reduce_and(int *arg1, int n);
301 extern int ivec_reduce_or(int *arg1, int n);
302 
303 extern PetscErrorCode ivec_zero(int *arg1, int n);
304 extern PetscErrorCode ivec_pos_one(int *arg1, int n);
305 extern PetscErrorCode ivec_neg_one(int *arg1, int n);
306 extern PetscErrorCode ivec_set(int *arg1, int arg2, int n);
307 extern int ivec_cmp(int *arg1, int *arg2, int n);
308 
309 extern int ivec_lb(int *work, int n);
310 extern int ivec_ub(int *work, int n);
311 extern int ivec_sum(int *arg1, int n);
312 extern int ivec_u_sum(unsigned *arg1, int n);
313 extern int ivec_prod(int *arg1, int n);
314 
315 extern vfp ivec_fct_addr(int type);
316 
317 extern PetscErrorCode ivec_non_uniform(int *arg1, int *arg2, int n, int *arg3);
318 extern PetscErrorCode ivec_max(int *arg1, int *arg2, int n);
319 extern PetscErrorCode ivec_min(int *arg1, int *arg2, int n);
320 extern PetscErrorCode ivec_mult(int *arg1, int *arg2, int n);
321 extern PetscErrorCode ivec_add(int *arg1, int *arg2, int n);
322 extern PetscErrorCode ivec_xor(int *arg1, int *arg2, int n);
323 extern PetscErrorCode ivec_or(int *arg1, int *arg2, int len);
324 extern PetscErrorCode ivec_and(int *arg1, int *arg2, int len);
325 extern PetscErrorCode ivec_lxor(int *arg1, int *arg2, int n);
326 extern PetscErrorCode ivec_lor(int *arg1, int *arg2, int len);
327 extern PetscErrorCode ivec_land(int *arg1, int *arg2, int len);
328 
329 extern PetscErrorCode ivec_or3 (int *arg1, int *arg2, int *arg3, int len);
330 extern PetscErrorCode ivec_and3(int *arg1, int *arg2, int *arg3, int n);
331 
332 extern int ivec_split_buf(int *buf1, int **buf2, int size);
333 
334 
335 extern PetscErrorCode ivec_sort_companion(int *ar, int *ar2, int size);
336 extern PetscErrorCode ivec_sort(int *ar, int size);
337 extern PetscErrorCode SMI_sort(void *ar1, void *ar2, int size, int type);
338 extern int ivec_binary_search(int item, int *list, int n);
339 extern int ivec_linear_search(int item, int *list, int n);
340 
341 extern PetscErrorCode ivec_c_index(int *arg1, int n);
342 extern PetscErrorCode ivec_sort_companion_hack(int *ar, int **ar2, int size);
343 
344 
345 extern PetscErrorCode rvec_dump(PetscScalar *v, int n, int tag, int tag2, char * s);
346 extern PetscErrorCode rvec_zero(PetscScalar *arg1, int n);
347 extern PetscErrorCode rvec_one(PetscScalar *arg1, int n);
348 extern PetscErrorCode rvec_neg_one(PetscScalar *arg1, int n);
349 extern PetscErrorCode rvec_set(PetscScalar *arg1, PetscScalar arg2, int n);
350 extern PetscErrorCode rvec_copy(PetscScalar *arg1, PetscScalar *arg2, int n);
351 extern PetscErrorCode rvec_lb_ub(PetscScalar *arg1, int n, PetscScalar *lb, PetscScalar *ub);
352 extern PetscErrorCode rvec_scale(PetscScalar *arg1, PetscScalar arg2, int n);
353 
354 extern vfp rvec_fct_addr(int type);
355 extern PetscErrorCode rvec_add(PetscScalar *arg1, PetscScalar *arg2, int n);
356 extern PetscErrorCode rvec_mult(PetscScalar *arg1, PetscScalar *arg2, int n);
357 extern PetscErrorCode rvec_max(PetscScalar *arg1, PetscScalar *arg2, int n);
358 extern PetscErrorCode rvec_max_abs(PetscScalar *arg1, PetscScalar *arg2, int n);
359 extern PetscErrorCode rvec_min(PetscScalar *arg1, PetscScalar *arg2, int n);
360 extern PetscErrorCode rvec_min_abs(PetscScalar *arg1, PetscScalar *arg2, int n);
361 extern PetscErrorCode vec_exists(PetscScalar *arg1, PetscScalar *arg2, int n);
362 
363 
364 extern PetscErrorCode rvec_sort(PetscScalar *ar, int size);
365 extern PetscErrorCode rvec_sort_companion(PetscScalar *ar, int *ar2, int size);
366 
367 extern PetscScalar rvec_dot(PetscScalar *arg1, PetscScalar *arg2, int n);
368 
369 extern PetscErrorCode rvec_axpy(PetscScalar *arg1, PetscScalar *arg2, PetscScalar scale, int n);
370 
371 extern int  rvec_binary_search(PetscScalar item, PetscScalar *list, int rh);
372 
373 
374 /**********************************queue.h*************************************
375 
376 Author: Henry M. Tufo III
377 
378 e-mail: hmt@cs.brown.edu
379 
380 snail-mail:
381 Division of Applied Mathematics
382 Brown University
383 Providence, RI 02912
384 
385 Last Modification:
386 6.21.97
387 **********************************queue.h*************************************/
388 
389 /**********************************queue.h*************************************
390 File Description:
391 -----------------
392   This file provides an interface to a simple queue abstraction.
393 **********************************queue.h*************************************/
394 
395 /**********************************queue.h*************************************
396 Type: queue_ADT
397 ---------------
398   This line defines the abstract queue type as a pointer to
399   its concrete counterpart.  Clients have no access to the
400   underlying representation.
401 **********************************queue.h*************************************/
402 typedef struct queue_CDT *queue_ADT;
403 
404 
405 
406 /**********************************queue.h*************************************
407 Function: new_queue()
408 
409 Input : na
410 Output: na
411 Return: pointer to ADT.
412 Description: This function allocates and returns an empty queue.
413 Usage: queue = new_queue();
414 **********************************queue.h*************************************/
415 extern queue_ADT new_queue(void);
416 
417 
418 
419 /**********************************queue.h*************************************
420 Function: free_queue()
421 
422 Input : pointer to ADT.
423 Output: na
424 Return: na
425 Description: This function frees the storage associated with queue but not any
426 pointer contained w/in.
427 Usage: free_queue(queue);
428 **********************************queue.h*************************************/
429 extern PetscErrorCode free_queue(queue_ADT queue);
430 
431 
432 
433 /**********************************queue.h*************************************
434 Function: enqueue()
435 
436 Input : pointer to ADT and pointer to object
437 Output: na
438 Return: na
439 Description: This function adds obj to the end of the queue.
440 Usage: enqueue(queue, obj);
441 **********************************queue.h*************************************/
442 extern PetscErrorCode enqueue(queue_ADT queue, void *obj);
443 
444 
445 
446 /**********************************queue.h*************************************
447 Function: dequeue()
448 
449 Input : pointer to ADT
450 Output: na
451 Return: void * to element
452 Description: This function removes the data value at the head of the queue
453 and returns it to the client.  dequeueing an empty queue is an error
454 Usage: obj = dequeue(queue);
455 **********************************queue.h*************************************/
456 extern PetscErrorCode *dequeue(queue_ADT queue);
457 
458 
459 
460 /**********************************queue.h*************************************
461 Function: len_queue()
462 
463 Input : pointer to ADT
464 Output: na
465 Return: integer number of elements
466 Description: This function returns the number of elements in the queue.
467 Usage: n = len_queue(queue);
468 **********************************queue.h*************************************/
469 EXTERN int len_queue(queue_ADT queue);
470 
471 
472 
473 /*$Id: vector.c,v 1.228 2001/03/23 23:21:22 balay Exp $*/
474 /***********************************gs.h***************************************
475 
476 Author: Henry M. Tufo III
477 
478 e-mail: hmt@cs.brown.edu
479 
480 snail-mail:
481 Division of Applied Mathematics
482 Brown University
483 Providence, RI 02912
484 
485 Last Modification:
486 6.21.97
487 ************************************gs.h**************************************/
488 
489 /***********************************gs.h***************************************
490 File Description:
491 -----------------
492 
493 ************************************gs.h**************************************/
494 
495 /***********************************gs.h***************************************
496 Type: gs_ADT
497 ------------
498 
499 ************************************gs.h**************************************/
500 
501 typedef struct gather_scatter_id *gs_ADT;
502 typedef PetscErrorCode (*Rbfp)(PetscScalar *, PetscScalar *, int len);
503 
504 /***********************************gs.h***************************************
505 Function:
506 
507 Input :
508 Output:
509 Return:
510 Description:
511 Usage:
512 ************************************gs.h**************************************/
513 extern gs_ADT gs_init(int *elms, int nel, int level);
514 extern PetscErrorCode   gs_gop(gs_ADT gs_handle, PetscScalar *vals, const char *op);
515 extern PetscErrorCode   gs_gop_vec(gs_ADT gs_handle, PetscScalar *vals, const char *op, int step);
516 extern PetscErrorCode   gs_gop_binary(gs_ADT gs, PetscScalar *vals, Rbfp fct);
517 extern PetscErrorCode   gs_gop_hc(gs_ADT gs_handle, PetscScalar *vals, const char *op, int dim);
518 extern PetscErrorCode   gs_free(gs_ADT gs_handle);
519 extern PetscErrorCode   gs_init_msg_buf_sz(int buf_size);
520 extern PetscErrorCode   gs_init_vec_sz(int size);
521 
522 
523 
524 /*************************************xxt.h************************************
525 Module Name: xxt
526 Module Info: need xxt.{c,h} gs.{c,h} comm.{c,h} ivec.{c,h} error.{c,h}
527 
528 author:  Henry M. Tufo III
529 e-mail:  hmt@asci.uchicago.edu
530 contact:
531 +--------------------------------+--------------------------------+
532 |MCS Division - Building 221     |Department of Computer Science  |
533 |Argonne National Laboratory     |Ryerson 152                     |
534 |9700 S. Cass Avenue             |The University of Chicago       |
535 |Argonne, IL  60439              |Chicago, IL  60637              |
536 |(630) 252-5354/5986 ph/fx       |(773) 702-6019/8487 ph/fx       |
537 +--------------------------------+--------------------------------+
538 
539 Last Modification: 3.20.01
540 **************************************xxt.h***********************************/
541 
542 /*************************************xxt.h************************************
543 File Description:
544 **************************************xxt.h***********************************/
545 
546 /*************************************xxt.h************************************
547 Notes on Usage:
548 **************************************xxt.h***********************************/
549 
550 
551 typedef struct xxt_CDT *xxt_ADT;
552 
553 
554 /*************************************xxt.h************************************
555 Function: XXT_new()
556 
557 Input :
558 Output:
559 Return: ADT ptr or NULL upon failure.
560 Description: This function allocates and returns an xxt handle
561 Usage: xxt_handle = xxt_new();
562 **************************************xxt.h***********************************/
563 extern xxt_ADT XXT_new(void);
564 
565 
566 /*************************************xxt.h************************************
567 Function: XXT_free()
568 
569 Input : pointer to ADT.
570 Output:
571 Return:
572 Description: This function frees the storage associated with an xxt handle
573 Usage: XXT_free(xxt_handle);
574 **************************************xxt.h***********************************/
575 EXTERN int XXT_free(xxt_ADT xxt_handle);
576 
577 
578 /*************************************xxt.h************************************
579 Function: XXT_factor
580 
581 Input : ADT ptr,  and pointer to object
582 Output:
583 Return: 0 on failure, 1 on success
584 Description: This function sets the xxt solver
585 
586 xxt assumptions: given n rows of global coarse matrix (E_loc) where
587    o global dofs N = sum_p(n), p=0,P-1
588    (i.e. row dist. with no dof replication)
589    (5.21.00 will handle dif replication case)
590    o m is the number of columns in E_loc (m>=n)
591    o local2global holds global number of column i (i=0,...,m-1)
592    o local2global holds global number of row    i (i=0,...,n-1)
593    o mylocmatvec performs E_loc . x_loc where x_loc is an vector of
594    length m in 1-1 correspondence with local2global
595    (note that gs package takes care of communication).
596    (note do not zero out upper m-n entries!)
597    o mylocmatvec(void *grid_data, double *in, double *out)
598 
599 ML beliefs/usage: move this to to ML_XXT_factor routine
600    o my_ml holds address of ML struct associated w/E_loc, grid_data, grid_tag
601    o grid_tag, grid_data, my_ml used in
602       ML_Set_CSolve(my_ml, grid_tag, grid_data, ML_Do_CoarseDirect);
603    o grid_data used in
604       A_matvec(grid_data,v,u);
605 
606 Usage:
607 **************************************xxt.h***********************************/
608 extern int XXT_factor(xxt_ADT xxt_handle,   /* prev. allocated xxt  handle */
609                       int *local2global,    /* global column mapping       */
610 		      int n,                /* local num rows              */
611 		      int m,                /* local num cols              */
612 		      void *mylocmatvec,    /* b_loc=A_local.x_loc         */
613 		      void *grid_data       /* grid data for matvec        */
614 		      );
615 
616 
617 /*************************************xxt.h************************************
618 Function: XXT_solve
619 
620 Input : ADT ptr, b (rhs)
621 Output: x (soln)
622 Return:
623 Description: This function performs x = E^-1.b
624 Usage:
625 XXT_solve(xxt_handle, double *x, double *b)
626 XXT_solve(xxt_handle, double *x, NULL)
627 assumes x has been initialized to be b
628 **************************************xxt.h***********************************/
629 extern int XXT_solve(xxt_ADT xxt_handle, double *x, double *b);
630 
631 
632 /*************************************xxt.h************************************
633 Function: XXT_stats
634 
635 Input : handle
636 Output:
637 Return:
638 Description:
639 factor stats
640 **************************************xxt.h***********************************/
641 extern int XXT_stats(xxt_ADT xxt_handle);
642 
643 
644 /*************************************xxt.h************************************
645 Function: XXT_sp_1()
646 
647 Input : pointer to ADT
648 Output:
649 Return:
650 Description: sets xxt parameter 1 in xxt_handle
651 Usage: implement later
652 
653 void XXT_sp_1(xxt_handle,parameter 1 value)
654 **************************************xxt.h***********************************/
655 
656 
657 /*************************************xyt.h************************************
658 Module Name: xyt
659 Module Info: need xyt.{c,h} gs.{c,h} comm.{c,h} ivec.{c,h} error.{c,h}
660 
661 author:  Henry M. Tufo III
662 e-mail:  hmt@asci.uchicago.edu
663 contact:
664 +--------------------------------+--------------------------------+
665 |MCS Division - Building 221     |Department of Computer Science  |
666 |Argonne National Laboratory     |Ryerson 152                     |
667 |9700 S. Cass Avenue             |The University of Chicago       |
668 |Argonne, IL  60439              |Chicago, IL  60637              |
669 |(630) 252-5354/5986 ph/fx       |(773) 702-6019/8487 ph/fx       |
670 +--------------------------------+--------------------------------+
671 
672 Last Modification: 3.20.01
673 **************************************xyt.h***********************************/
674 
675 /*************************************xyt.h************************************
676 File Description:
677 **************************************xyt.h***********************************/
678 
679 /*************************************xyt.h************************************
680 Notes on Usage:
681 **************************************xyt.h***********************************/
682 
683 
684 
685 typedef struct xyt_CDT *xyt_ADT;
686 
687 
688 /*************************************xyt.h************************************
689 Function: XYT_new()
690 
691 Input :
692 Output:
693 Return: ADT ptr or NULL upon failure.
694 Description: This function allocates and returns an xyt handle
695 Usage: xyt_handle = xyt_new();
696 **************************************xyt.h***********************************/
697 extern xyt_ADT XYT_new(void);
698 
699 
700 /*************************************xyt.h************************************
701 Function: XYT_free()
702 
703 Input : pointer to ADT.
704 Output:
705 Return:
706 Description: This function frees the storage associated with an xyt handle
707 Usage: XYT_free(xyt_handle);
708 **************************************xyt.h***********************************/
709 EXTERN int XYT_free(xyt_ADT xyt_handle);
710 
711 
712 /*************************************xyt.h************************************
713 Function: XYT_factor
714 
715 Input : ADT ptr,  and pointer to object
716 Output:
717 Return: 0 on failure, 1 on success
718 Description: This function sets the xyt solver
719 
720 xyt assumptions: given n rows of global coarse matrix (E_loc) where
721    o global dofs N = sum_p(n), p=0,P-1
722    (i.e. row dist. with no dof replication)
723    (5.21.00 will handle dif replication case)
724    o m is the number of columns in E_loc (m>=n)
725    o local2global holds global number of column i (i=0,...,m-1)
726    o local2global holds global number of row    i (i=0,...,n-1)
727    o mylocmatvec performs E_loc . x_loc where x_loc is an vector of
728    length m in 1-1 correspondence with local2global
729    (note that gs package takes care of communication).
730    (note do not zero out upper m-n entries!)
731    o mylocmatvec(void *grid_data, double *in, double *out)
732 
733 ML beliefs/usage: move this to to ML_XYT_factor routine
734    o my_ml holds address of ML struct associated w/E_loc, grid_data, grid_tag
735    o grid_tag, grid_data, my_ml used in
736       ML_Set_CSolve(my_ml, grid_tag, grid_data, ML_Do_CoarseDirect);
737    o grid_data used in
738       A_matvec(grid_data,v,u);
739 
740 Usage:
741 **************************************xyt.h***********************************/
742 extern int XYT_factor(xyt_ADT xyt_handle,   /* prev. allocated xyt  handle */
743                       int *local2global,    /* global column mapping       */
744 		      int n,                /* local num rows              */
745 		      int m,                /* local num cols              */
746 		      void *mylocmatvec,    /* b_loc=A_local.x_loc         */
747 		      void *grid_data       /* grid data for matvec        */
748 		      );
749 
750 
751 /*************************************xyt.h************************************
752 Function: XYT_solve
753 
754 Input : ADT ptr, b (rhs)
755 Output: x (soln)
756 Return:
757 Description: This function performs x = E^-1.b
758 Usage: XYT_solve(xyt_handle, double *x, double *b)
759 **************************************xyt.h***********************************/
760 extern int XYT_solve(xyt_ADT xyt_handle, double *x, double *b);
761 
762 
763 /*************************************xyt.h************************************
764 Function: XYT_stats
765 
766 Input : handle
767 Output:
768 Return:
769 Description:
770 factor stats
771 **************************************xyt.h***********************************/
772 extern int XYT_stats(xyt_ADT xyt_handle);
773 
774 
775 /*************************************xyt.h************************************
776 Function: XYT_sp_1()
777 
778 Input : pointer to ADT
779 Output:
780 Return:
781 Description: sets xyt parameter 1 in xyt_handle
782 Usage: implement later
783 
784 PetscErrorCode XYT_sp_1(xyt_handle,parameter 1 value)
785 **************************************xyt.h***********************************/
786 
787 /********************************bit_mask.h************************************
788 
789 Author: Henry M. Tufo III
790 
791 e-mail: hmt@cs.brown.edu
792 
793 snail-mail:
794 Division of Applied Mathematics
795 Brown University
796 Providence, RI 02912
797 
798 Last Modification:
799 11.21.97
800 *********************************bit_mask.h***********************************/
801 
802 /********************************bit_mask.h************************************
803 File Description:
804 -----------------
805 
806 *********************************bit_mask.h***********************************/
807 
808 
809 /********************************bit_mask.h************************************
810 Function:
811 
812 Input :
813 Output:
814 Return:
815 Description:
816 Usage:
817 *********************************bit_mask.h***********************************/
818 extern int div_ceil(int numin, int denom);
819 extern PetscErrorCode set_bit_mask(int *bm, int len, int val);
820 extern int len_bit_mask(int num_items);
821 extern int ct_bits(char *ptr, int n);
822 extern PetscErrorCode bm_to_proc(char *ptr, int p_mask, int *msg_list);
823 extern int len_buf(int item_size, int num_items);
824 
825 #endif
826 
827