00001 /************************************************************************ 00002 File sih_lapack.h - internal information for the interface with the lapack 00003 linear solver for dense matrices 00004 00005 Contains: 00006 - constants 00007 - data types 00008 - global variables (for the whole module) 00009 - function headers: 00010 sir_direct_module_introduce - to return the direct solver name 00011 sir_direct_init - to create a new iterative solver, read its control 00012 parameters and initialize its data structure 00013 sir_direct_create - to create and initialize solver data structure 00014 sir_direct_solve - to solve the system for a given data 00015 sir_direct_free - to free memory for stiffness and preconditioner matrices 00016 sir_direct_destroy - to destroy a solver instance and make room for next solvers 00017 00018 auxiliary: 00019 sir_direct_select_solver - to return the pointer to a given solver 00020 sir_direct_assemble_stiff_mat - to assemble entries to the global stiffness matrix 00021 and the global load vector using the provided local 00022 stiffness matrix and load vector 00023 sir_direct_init - to create a new iterative solver, read its control 00024 parameters and initialize its data structure 00025 sir_direct_create - to create and initialize solver data structure 00026 sir_direct_solve - to solve the system for a given data 00027 sir_direct_free - to free memory for stiffness and preconditioner matrices 00028 sir_direct_destroy - to destroy a solver instance and make room for next solvers 00029 00030 ------------------------------ 00031 History: 00032 02.2002 - Krzysztof Banas, initial version 00033 *************************************************************************/ 00034 00035 #ifndef _sih_lapack_ 00036 #define _sih_lapack_ 00037 00038 00039 /*** DATA TYPES ***/ 00040 00041 /* dof structure with data useful for creating flexible interfaces*/ 00042 /* between FEM code and different solvers */ 00043 typedef struct{ 00044 int dof_ent_type; /* type of the associated FEM code (mesh) entity */ 00045 int dof_ent_id; /* ID of the associated FEM code (mesh) entity */ 00046 int nr_int_ent; /* number of integration entities providing SMs and LVs*/ 00047 int l_int_ent_index[SIC_MAX_INT_PER_DOF]; 00048 /* list of integration entities providing SMs and LVs*/ 00049 int nrdofs; /* number of DOFs */ 00050 int posglob; /* position in a global stiffness matrix */ 00051 int nrneig; /* number of neighboring DOF structures */ 00052 int l_neig[SIC_MAX_DOF_STR_NGB]; /* list of neighboring DOF structures */ 00053 } sit_direct_dof_struct; 00054 00055 00056 /* solver data for dense LAPACK procedures */ 00057 typedef struct { 00058 00059 int problem_id; /* ID of the problem associated with the solver */ 00060 int nr_int_ent; /* number of integration entities - entities that */ 00061 /* provide solver with stiffness matrices and load vectors*/ 00062 int nr_dof_ent; /* number of dof entities - mesh entities with which */ 00063 /* degrees of freedom are associated */ 00064 int nrdofs_glob; /* the global number of degrees of freedom */ 00065 int max_dofs_int_ent; /* maximal number of dofs per integration entity, i.e. */ 00066 /* maximal size of the local stiffness matrix */ 00067 00068 /* arrays for assembling local stiffness matrices into global stiffness matrix*/ 00069 int* l_int_ent_type; /*list of types of entities providing local SMs and LVs */ 00070 int* l_int_ent_id; /* list of ID's of entities providing local SMs and LVs */ 00071 00072 sit_direct_dof_struct *l_dof_struct; /* list of dof structures with data useful for */ 00073 /* creating flexible interfaces between FEM code*/ 00074 /* and different solvers */ 00075 00076 /* for each possible type of dof entity - its corresponding dof structure */ 00077 int* l_dof_vert_to_struct; 00078 int* l_dof_edge_to_struct; 00079 int* l_dof_face_to_struct; 00080 int* l_dof_elem_to_struct; 00081 /* dimensions of the above arrays */ 00082 int max_dof_vert_id; 00083 int max_dof_edge_id; 00084 int max_dof_face_id; 00085 int max_dof_elem_id; 00086 00087 double *stiff_mat; /* the global stiffness matrix */ 00088 double *rhs_vect; /* the global right hand side vector */ 00089 double *sol_vect; /* the global solution vector */ 00090 int *aux_vect; /* auxiliary vector for pivoting information */ 00091 00092 00093 } sit_direct_solver; 00094 00095 00096 /*** GLOBAL VARIABLES (for the solver module only) ***/ 00097 00098 extern int siv_direct_nr_solvers; /* the number of solvers in the problem */ 00099 extern int siv_direct_cur_solver_id; /* ID of the current solver */ 00100 extern sit_direct_solver siv_direct_solvers[SIC_MAX_NUM_SOLV]; /* array of solvers */ 00101 00102 00103 /*** INTERFACE ROUTINES ***/ 00104 00108 extern int sir_direct_module_introduce( 00110 char* Solver_name 00111 ); 00112 00117 extern int sir_direct_init( 00118 int Parallel, 00120 char* Filename 00121 ); 00122 00123 00127 extern int sir_direct_create( 00128 int Solver_id, 00129 int Problem_id 00130 ); 00131 00132 00136 extern int sir_direct_solve( 00137 int Solver_id, 00138 int Comp_type, 00141 int Monitor 00146 ); 00147 00148 00152 extern int sir_direct_free( 00153 int Solver_id 00154 ); 00155 00156 00160 extern int sir_direct_destroy( 00161 int Solver_id 00162 ); 00163 00164 00165 /*** AUXILIARY LOCAL PROCEDURES ***/ 00166 00170 extern sit_direct_solver* sir_direct_select_solver(/*returns: pointer to solver*/ 00171 int Solver_id /* in: solver identification */ 00172 ); 00173 00174 00180 extern int sir_direct_assemble_stiff_mat( 00181 /* returns: >=0 - success code, <0 - error code */ 00182 int Solver_id, /* in: solver ID (used to identify the subproblem) */ 00183 int Comp_type, /* in: indicator for the scope of computations: */ 00184 /* SIC_SOLVE - solve the system */ 00185 /* SIC_RESOLVE - resolve for the new rhs vector */ 00186 int Nr_dof_bl, /* in: number of global dof blocks */ 00187 /* associated with the local stiffness matrix */ 00188 int* L_bl_nrdofs, /* in: list of dof blocks' nr dofs */ 00189 int* L_bl_posglob, /* in: list of blocks' global positions */ 00190 double* Stiff_mat, /* in: stiffness matrix stored columnwise */ 00191 double* Rhs_vect, /* in: rhs vector */ 00192 char* Rewr_dofs /* in: flag to rewrite or sum up entries */ 00193 /* 'T' - true, rewrite entries when assembling */ 00194 /* 'F' - false, sum up entries when assembling */ 00195 ); 00196 00201 extern int sir_direct_init( 00202 int Parallel, 00204 char* Filename 00205 ); 00206 00207 00211 extern int sir_direct_create( 00212 int Solver_id, 00213 int Problem_id 00214 ); 00215 00216 00220 extern int sir_direct_solve( 00221 int Solver_id, 00222 int Comp_type, 00225 int Monitor 00230 ); 00231 00232 00236 extern int sir_direct_free( 00237 int Solver_id 00238 ); 00239 00240 00244 extern int sir_direct_destroy( 00245 int Solver_id 00246 ); 00247 00248 #endif 00249
1.6.1