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