00001 /************************************************************************ 00002 File sih_intf.h - interface with the linear solver module of the code. 00003 00004 Contains declarations of constants and interface routines: 00005 sir_module_introduce - to return the solver name 00006 sir_solve_lin_sys - to perform the five steps below in one call 00007 sir_init - to create a new solver instance and read its control parameters 00008 sir_create - to create and initialize solver data structure 00009 sir_solve - to solve the system for a given data 00010 sir_assemble_local_stiff_mat_with_table - to assemble an element stiffness matrix 00011 to the global SM using assembly table 00012 sir_assemble_local_stiff_mat - to assemble an element stiffness matrix 00013 to the global SM 00014 sir_free - to free memory for a given solver instance 00015 sir_destroy - to destroy a solver instance 00016 00017 sir_direct_solve_lin_sys - to solve the system of linear equations 00018 using a direct solver for the current 00019 setting of parameters (with initialization and finalization phases) 00020 00021 ------------------------------ 00022 History: 00023 02.2002 - Krzysztof Banas, initial version 00024 *************************************************************************/ 00025 00026 #ifndef _sih_intf_ 00027 #define _sih_intf_ 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00038 /*** CONSTANTS ***/ 00039 00041 #define SIC_SEQUENTIAL 0 00042 #define SIC_PARALLEL 1 00043 00045 #define SIC_SOLVE 0 00046 #define SIC_RESOLVE 1 00048 #define SIC_SOLVER_ASSEMBLE 0 00049 #define SIC_PROBLEM_ASSEMBLE 1 00050 00052 #define SIC_PRINT_NOT 0 00053 #define SIC_PRINT_ERRORS 1 00054 #define SIC_PRINT_INFO 2 00055 #define SIC_PRINT_ALLINFO 3 00057 #define SIC_MAX_NUM_SOLV 10 00058 #define SIC_MAX_DOF_PER_INT 70 /*maximal number of dof_ent (blocks) per int_ent*/ 00059 // 15 - tetra, 21 - prism, 27 - brick, but all without constrained approximation 00060 // 40 - testing (working for linear approximation with constraints) (does not work for constraint quadratic approximation [too small table])... 00061 // 54 - working for linear approximation with constraints (does not work for constraint quadratic approximation [too small table])... 00062 // 70 - working 00063 #define SIC_MAX_INT_PER_DOF 100 /*maximal number of int_ent per dof_ent (block)*/ 00064 #define SIC_MAX_DOF_STR_NGB 296 00065 // 200 does not work for constraint quadratic approximation [too small list]) 00066 // 296 - working 00067 00068 #define SIC_LIST_END_MARK -1 00070 /*** INTERFACE ROUTINES ***/ 00071 00075 extern int sir_module_introduce( 00077 char* Solver_name 00078 ); 00079 00084 extern int sir_solve_lin_sys( 00085 int Problem_id, 00086 int Solver_type, /* type of solver: 0 - direct, >0 - iterative (passed to mkb_core) */ 00087 int Parallel, 00089 int Nr_levels, // maximal number of levels for multigrid 00090 char* Filename, 00091 int Max_iter, 00092 int Error_type, 00093 double Error_tolerance, 00094 int Monitoring_level 00095 ); 00096 00097 00102 extern int sir_init( 00103 int Solver_type, /* type of solver: 0 - direct, >0 - iterative (passed to mkb_core) */ 00104 int Parallel, 00106 int Nr_levels, // maximal number of levels for multigrid 00107 char* Filename, 00108 int Max_iter, 00109 int Error_type, 00110 double Error_tolerance, 00111 int Monitoring_level 00112 ); 00113 00114 00118 extern int sir_create( 00119 int Solver_id, 00120 int Problem_id 00121 ); 00122 00123 00127 extern int sir_solve( 00128 int Solver_id, 00129 int Comp_type, 00132 int Ini_guess, 00134 int Monitor, 00139 int* Nr_iter, 00141 double* Conv_meas, 00143 double *Conv_rate 00144 ); 00145 00146 00150 extern int sir_free( 00151 int Solver_id 00152 ); 00153 00154 00158 extern int sir_destroy( 00159 int Solver_id 00160 ); 00161 00162 00163 00169 extern int sir_direct_solve_lin_sys( /*returns: >=0-success code, <0-error code*/ 00170 int Problem_id, 00171 int Parallel, 00173 char* Filename 00174 ); 00175 00176 00181 int sir_assemble_local_stiff_mat_with_table( 00183 int Solver_id, 00184 int Level_id, 00185 int Comp_type, /* in: indicator what was computed: */ 00186 //extern const int PDC_NO_COMP ; /* do not compute stiff matrix and rhs vector */ 00187 //extern const int PDC_COMP_SM ; /* compute entries to stiff matrix only */ 00188 //extern const int PDC_COMP_RHS ; /* compute entries to rhs vector only */ 00189 //extern const int PDC_COMP_BOTH; /* compute entries for sm and rhsv */ 00190 int Nr_dof_ent, /* in: number of global dof blocks */ 00191 /* associated with the local stiffness matrix */ 00192 int* Assembly_table_int_ent, /* part of the global assembly table */ 00193 int* Local_to_global_int_ent, /* part of the global local_to_global table */ 00194 double* Stiff_mat, 00195 double* Rhs_vect, 00196 char* Rewr_dofs 00199 ); 00200 00205 int sir_assemble_local_stiff_mat( 00207 int Solver_id, 00208 int Level_id, 00209 int Comp_type, /* in: indicator what was computed: */ 00210 //extern const int PDC_NO_COMP ; /* do not compute stiff matrix and rhs vector */ 00211 //extern const int PDC_COMP_SM ; /* compute entries to stiff matrix only */ 00212 //extern const int PDC_COMP_RHS ; /* compute entries to rhs vector only */ 00213 //extern const int PDC_COMP_BOTH; /* compute entries for sm and rhsv */ 00214 int Nr_dof_ent, /* in: number of global dof blocks */ 00215 /* associated with the local stiffness matrix */ 00216 int* L_dof_ent_type, /* in: list of dof blocks' IDs */ 00217 int* L_dof_ent_id, /* in: list of dof blocks' IDs */ 00218 int* L_dof_ent_nrdofs, /* in: list of blocks' numbers of dof */ 00219 double* Stiff_mat, 00220 double* Rhs_vect, 00221 char* Rewr_dofs 00224 ); 00225 // end of group 00227 00228 00229 #ifdef __cplusplus 00230 } 00231 #endif 00232 00233 #endif