az_aztec.h
来自「并行解法器,功能强大」· C头文件 代码 · 共 1,445 行 · 第 1/5 页
H
1,445 行
/*==================================================================== * ------------------------ * | CVS File Information | * ------------------------ * * $RCSfile: az_aztec.h,v $ * * $Author: tuminaro $ * * $Date: 2000/06/02 16:46:55 $ * * $Revision: 1.79 $ * * $Name: $ *====================================================================*//******************************************************************************* * Copyright 1995, Sandia Corporation. The United States Government retains a * * nonexclusive license in this software as prescribed in AL 88-1 and AL 91-7. * * Export of this program may require a license from the United States * * Government. * ******************************************************************************//* * Include file for inclusion in any routine which will call the solver * library. Contains necessary constants and prototypes. * * Author: Scott A. Hutchinson, SNL * John N. Shadid, SNL * Ray S. Tuminaro, SNL */#ifndef __AZTECH__#ifdef AZ_MPI#include <mpi.h>#define MPI_AZRequest MPI_Request#define MPI_AZComm MPI_Comm#else#define MPI_AZRequest int#define MPI_AZComm int #endif/* Set variable to indicate that this file has already been included */#define __AZTECH__/*structure definitions*/struct AZ_MATRIX_STRUCT { /* Used to represent matrices. In particular, two structures are */ /* passed into AZ_iterate: */ /* AZ_iterate(..., AZ_MATRIX *Amat, AZ_MATRIX *Precond, ...) */ /* corresponding to matrix-vector products and preconditioners. */ /* */ /* For matrix-vector products, a subroutine Amat.'user_function'*/ /* can be supplied. 'Amat' is be passed to this routine and thus*/ /* relevant data can be placed in this structure. If a matrix- */ /* vector product is not supplied, either an MSR or VBR matrix */ /* must be used by specifying the arrays bindx,indx,rpntr,cpntr,*/ /* bpntr, and val. In this case, Aztec supplies the matrix- */ /* vector product. */ /* */ /* NOTE: Fortran users never explicitly see this structure but */ /* instead pass matrix-vector product and preconditioning */ /* information through parameters which Aztec copies to this */ /* structure. */ int matrix_type; /* Indicates whether the matrix is MSR, */ /* VBR, or user-supplied. */ /* */ int N_local, /* Number of local and ghost unknowns */ N_ghost; /* */ /* */ int mat_create_called;/* =1 indicates that AZ_matrix_create() */ /* was invoked. */ int must_free_data_org;/* =1 indicates that data_org was created */ /* via the matrix_free set functions and */ /* needs to be freed during destroy oper. */ /* */ int *rpntr,*cpntr,/* arrays to support MSR & VBR formats */ *bpntr,*bindx;/* */ int *indx; /* */ double *val; /* */ int *data_org; /* array to support matvec communication */ /* *//* Begin Aztec 2.1 mheroux mod */ int N_update; /* Number of nodes updated on this proc */ /* */ int *update; /* array containing global indices map */ /* */ int has_global_indices; /* true/false for say bindx has global */ /* *//* End Aztec 2.1 mheroux mod */ void (*matvec)(double *, /* function ptr to user-defined routine */ double *, struct AZ_MATRIX_STRUCT *, int *); /*********************************************************************//*********************************************************************/ int (*getrow)(int columns[], double values[], int row_lengths[], struct AZ_MATRIX_STRUCT *Amat, int N_requested, int requested_rows[], int allocated_space); /* function ptr to user-defined routine *//* Get some matrix rows ( requested_rows[0 ... N_requested_rows-1] ) *//* from the user's matrix and return this information in *//* 'row_lengths, columns, values'. If there is not enough space to *//* complete this operation, return 0. Otherwise, return 1. *//* *//* Parameters *//* ========== *//* data On input, points to user's data containing *//* matrix values. *//* N_requested_rows On input, number of rows for which nonzero are *//* to be returned. *//* requested_rows On input, requested_rows[0...N_requested_rows-1] *//* give the row indices of the rows for which *//* nonzero values are returned. *//* row_lengths On output, row_lengths[i] is the number of *//* nonzeros in the row 'requested_rows[i]' *//* ( 0 <= i < N_requested_rows). NOTE: this *//* array is of size 'N_requested_rows'. *//* columns,values On output, columns[k] and values[k] contains the *//* column number and value of a matrix nonzero where*//* all the nonzeros for requested_rows[0] appear *//* first followed by the nonzeros for *//* requested_rows[1], etc. NOTE: these arrays are *//* of size 'allocated_space'. *//* allocated_space On input, indicates the space available in *//* 'columns' and 'values' for storing nonzeros. If *//* more space is needed, return 0. *//*********************************************************************//*********************************************************************/ int (*user_comm)(double *, struct AZ_MATRIX_STRUCT *); /* user communication routine before */ /* doing matvecs. Only used when doing */ /* matrix-free. */ double matrix_norm; /* norm of the matrix A used in the case */ /* of least square preconditioning if the */ /* matrix A is of type AZ_USER_MATRIX */ /* */ /* */ int **aux_ival; /* integer, double precision, function, */ double **aux_dval; /* generic, and matrix pointers at the */ void *aux_ptr; /* product routine: 'matvec()'. */ void *matvec_data; void *getrow_data; struct AZ_MATRIX_STRUCT **aux_matrix; int N_nz, max_per_row, /* Total number of nonzeros, maximum */ largest_band; /* nonzeros per row, and bandwidth. */ /* ONLY used for matrix-free */};struct grid_level { int N; struct AZ_MATRIX_STRUCT *transfer_to_prev_grid; struct AZ_MATRIX_STRUCT *transfer_to_next_grid; struct AZ_MATRIX_STRUCT *discretization_op; struct AZ_PREC_STRUCT *smoother1; struct AZ_PREC_STRUCT *smoother2; void *mesh; };struct AZ_PREC_STRUCT { /* Used to represent preconditioners. In particular, */ /* two structures are */ /* passed into AZ_iterate: */ /* AZ_iterate(..., AZ_MATRIX *Amat, AZ_PRECOND *Precond, ...) */ /* corresponding to matrix and preconditioner descriptions. */ /* */ /* For matrix-vector products, a subroutine Amat.'matvec'*/ /* can be supplied. 'Amat' is be passed to this routine and thus*/ /* relevant data can be placed in this structure. If a matrix- */ /* vector product is not supplied, either an MSR or VBR matrix */ /* must be used by specifying the arrays bindx,indx,rpntr,cpntr,*/ /* bpntr, and val. In this case, Aztec supplies the matrix- */ /* vector product as well as a number of preconditioners. */ /* */ /* Likewise, a preconditioner can be supplied via the routine */ /* 'Precond.prec_function'. In this case options[AZ_precond] */ /* must be set to "AZ_user_precond". Otherwise */ /* options[AZ_precond] must be set to one of the preconditioners*/ /* supplied by Aztec and the matrix must be a MSR or VBR format */ /* The matrix used as preconditionner is descibed in a AZ_MATRIX*/ /* structure which could be either the same as Amat */ /* (precond.Pmat = Amat) or a different matrix described */ /* by the arrays bindx,indx,rpntr,cpntr, bpntr, and val. */ /* */ /* NOTE: Fortran users never explicitly see these structures but*/ /* instead pass matrix and preconditioning information through */ /* parameters which Aztec copies to this structure. */ /* */ struct AZ_MATRIX_STRUCT *Pmat; /* matrix used by the precondtioner */ /* when not using multilevel stuff */ /* */ int prec_create_called;/* =1 indicates that AZ_precond_create() */ /* was invoked. */ void (*prec_function)(double *, /* function ptr to user-defined */ int *, int *, double *,/* preconditioning routine */ struct AZ_MATRIX_STRUCT *, struct AZ_PREC_STRUCT *); int *options; /* used to determine preconditioner */ double *params; /* when options[AZ_precond] is set */ struct AZ_PREC_STRUCT *next_prec; /* to AZ_multilevel. The series of */ /* preconditioners is done in a */ /* multiplicative fashion. */ struct context *context; struct grid_level grid_levels[10]; /* multilevel stuff */ void *ml_ptr; /* MLDIFF */ double timing[2]; /* preconditioner timing array */ void *precond_data; char *print_string;}; typedef struct AZ_MATRIX_STRUCT AZ_MATRIX;typedef struct AZ_PREC_STRUCT AZ_PRECOND;struct AZ_CONVERGE_STRUCT { double r0_norm, A_norm, b_norm; int total_N; int not_initialized; struct AZ_SCALING *scaling;}; struct aztec_choices { int *options; double *params;};struct context { /* This structure is used to */ int *iu, *iflag, *ha, *ipvt; /* hold variables specific to */ int *dblock, *space_holder; /* the preconditioner */ int extra_fact_nz_per_row; int N_large_int_arrays, N_large_dbl_arrays; int N_nz_factors,N_nz_matrix, N_blk_rows, max_row; double *pivot; struct AZ_MATRIX_STRUCT *A_overlapped; struct aztec_choices *aztec_choices; double *x_pad, *ext_vals, *x_reord; int *padded_data_org, *map, *inv_ordering; int N, N_unpadded, N_nz, N_nz_allocated; char *tag; int *proc_config; int Pmat_computed; /* indicates that the has */ /* been called at least once */ /* before with this context. *//* Begin Aztec 2.1 mheroux mod */ void *precon;/* End Aztec 2.1 mheroux mod */}; /*****************************************************************************//*****************************************************************************//*****************************************************************************/struct AZ_SCALING { /* Left and right matrices to to scale */ /* the problem */ int action; double A_norm; int mat_name; int scaling_opt;};/*****************************************************************************//*****************************************************************************//*****************************************************************************/struct grid { /* used to define a grid. Still under */ /* construction */ int *element_vertex_lists; int *Nvertices_per_element; int Nelements; int Nvertices;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?