00001 #ifndef LAH_AMG_INTERFACE_H 00002 #define LAH_AMG_INTERFACE_H 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 /*--------------------------------------------------------- 00009 lar_allocate_SM_and_LV - to allocate space for stiffness matrix and load vector 00010 ---------------------------------------------------------*/ 00011 extern int lar_allocate_SM_and_LV_petsc( // returns: matrix index in itv_matrices array 00012 int Max_SM_size, /* maximal size of element stiffness matrix */ 00013 int Nrblocks, /* in: number of DOF blocks */ 00014 int Nrdof_glob, /* in: total number of DOFs */ 00015 int* Nrdofbl, /* in: list of numbers of dofs in a block */ 00016 int* Posglob, /* in: list of global numbers of first dof */ 00017 int* Nroffbl, /* in: list of numbers of off diagonal blocks */ 00018 // if Nroffbl[iblock]<=0 - iblock is a ghost block with no rows associated 00019 int** L_offbl /* in: list of lists of off diagonal blocks */ 00020 ); 00021 00022 extern int lar_initialize_SM_and_LV_petsc(int Matrix_id, int Comp_type); 00023 00024 extern double lar_get_storage_petsc(int Matrix_id); 00025 00026 /*------------------------------------------------------------ 00027 lar_assemble_SM_and_LV - to assemble entries to the global stiffness matrix 00028 and the global load vector using the provided local 00029 stiffness matrix and load vector 00030 ------------------------------------------------------------*/ 00031 extern int lar_assemble_SM_and_LV_petsc( 00032 /* returns: >=0 - success code, <0 - error code */ 00033 int Matrix_id, /* in: matrix ID */ 00034 int Comp_type, /* in: indicator for the scope of computations: */ 00035 /* ITC_SOLVE - solve the system */ 00036 /* ITC_RESOLVE - resolve for the new rhs vector */ 00037 int Nr_dof_bl, /* in: number of global dof blocks */ 00038 /* associated with the local stiffness matrix */ 00039 int* L_bl_id, /* in: list of dof blocks' IDs */ 00040 int* L_bl_nrdof, /* in: list of blocks' numbers of dof */ 00041 double* Stiff_mat, /* in: stiffness matrix stored columnwise */ 00042 double* Rhs_vect, /* in: rhs vector */ 00043 char* Rewr_dofs /* in: flag to rewrite or sum up entries */ 00044 /* 'T' - true, rewrite entries when assembling */ 00045 /* 'F' - false, sum up entries when assembling */ 00046 ); 00047 00048 extern int lar_allocate_preconditioner_petsc(int Matrix_id); 00049 00050 extern int lar_fill_preconditioner_petsc(int Matrix_id); 00051 00052 extern int lar_free_preconditioner_petsc(int Matrix_id); 00053 00054 extern int lar_free_SM_and_LV_petsc(int Matrix_id); 00055 00056 extern void lar_compute_residual_petsc(int Matrix_id, int Use_rhs, int Ini_zero, int Ndof, double* X, double* B, double* V); 00057 00058 extern void lar_perform_BJ_or_GS_iterations_petsc( 00059 int Matrix_id, /* in: matrix ID */ 00060 int Use_rhs, /* in: 0 - no rhs, 1 - with rhs */ 00061 int Ini_zero, /* in: flag for zero initial guess */ 00062 int Nr_prec, /* in: number of preconditioner iterations */ 00063 int Ndof, /* in: number of unknowns (components of v*) */ 00064 double* V, /* in,out: vector of unknowns updated */ 00065 /* during the loop over subdomains */ 00066 double* B /* in: the rhs vector, if NULL take rhs */ 00067 /* from block data structure */ 00068 ); 00069 00070 extern void lar_perform_rhsub_petsc(int Matrix_id, int Ndof, double* V, double* B); 00071 00072 extern int lar_block_print_matrix_petsc(int Matrix_id); 00073 00074 #ifdef __cplusplus 00075 } 00076 #endif 00077 00078 #endif