00001 /************************************************************************ 00002 File sih_mkb.h - internal information for the interface module 00003 between the iterative block based Krylow solver and the finite element 00004 code (the module forms part of the fem code): definition of parameters, 00005 data types, global variables and external functions) 00006 00007 00008 Contains declarations of data types, constants and global variables 00009 00010 ------------------------------ 00011 History: 00012 02.2002 - Krzysztof Banas, initial version 00013 *************************************************************************/ 00014 00015 #ifndef _sih_mkb_ 00016 #define _sih_mkb_ 00017 00018 #include "sih_intf.h" 00019 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 /*** CONSTANTS ***/ 00025 #define SIC_MAX_NUM_LEV 20 00026 00027 #define SIC_PDEG_COARSE_HIGH -4 00028 #define SIC_PDEG_COARSE_LOW -3 00029 #define SIC_PDEG_COARSE_HIGH_ALL -2 00030 #define SIC_PDEG_COARSE_LOW_ALL -1 00031 #define SIC_PDEG_FINEST -10 00032 00033 #define SIC_STD_APPROX 1 00034 #define SIC_DG_APPROX 2 00035 00036 00037 // other constants in include/sih_intf.h 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 block_id; /* ID for solver - used for renumbering */ 00050 int nrdofs; /* number of DOFs */ 00051 int posglob; /* position in a global load vector (and stiffness matrix) */ 00052 int nrneig; /* number of neighboring DOF structures */ 00053 //* Two lists of neighbours - the order on lists may be different !!! */ 00054 int l_neig[SIC_MAX_DOF_STR_NGB]; /* list of neighboring DOF structures */ 00055 int l_neig_bl[SIC_MAX_DOF_STR_NGB]; /* list of IDs for solver (block IDs) */ 00056 } sit_dof_struct; 00057 00058 00059 /* solver data structure for a single level */ 00060 typedef struct { 00061 00062 int nr_int_ent; /* number of integration entities - entities that */ 00063 /* provide solver with stiffness matrices and load vectors*/ 00064 int nr_dof_ent; /* number of dof entities - mesh entities with which */ 00065 /* degrees of freedom are associated */ 00066 int nr_dof_ent_internal ; /* number of internal (not ghost i.e. overlap dof entities) */ 00067 /* for which stiffness matrix rows are assembled and processed */ 00068 int pdeg_coarse; /* degree of approximation for coarse levels */ 00069 int nrdofs_glob; /* the global number of degrees of freedom */ 00070 int nrdofs_internal; /* the number of degrees of freedom for internal DOF entities */ 00071 int block_size; /* for stiffness matrices with constant block_size */ 00072 /* !!! makes block.nrdofs and block.posglob obsolete !!! */ 00073 int max_dofs_int_ent; /* maximal number of dofs per integration entity, i.e. */ 00074 /* maximal size of the local stiffness matrix */ 00075 int max_dofs_dof_ent; /* maximal number of dofs per dof entity */ 00076 00077 /* arrays for assembling local stiffness matrices into global stiffness matrix*/ 00078 int* l_int_ent_type; /*list of types of entities providing local SMs and LVs */ 00079 int* l_int_ent_id; /* list of ID's of entities providing local SMs and LVs */ 00080 //int* l_int_ent_nr_dofs; the size of SM - to be switched on when necessary 00081 00082 /* data for element coloring - to enable concurrent assembly */ 00083 int nr_colors_elems; /* elements and faces have the same l_int_ent_... arrays but ... */ 00084 int nr_colors_faces; /* ... elements and faces have different l_color_... arrays!!! */ 00085 int* l_color_index_elems; /* CRS-like indices in permuted l_int_ent_.. */ 00086 int* l_color_index_faces; /* for subsequent colors */ 00087 00088 // data for assembly tables: for each local SM (stiffness matrix) 00089 // the positions in the global SM of first entries associated with all matrix blocks 00090 // in local SM are stored (each matrix block corresponds to a pair of DOF entities, 00091 // i.e. a pair of DOF structures, i.e. - in the current implementation - a pair of 00092 // DOF blocks) 00093 // 1. assembly data is stored in a consecutive way for all integration entities, 00094 // according to the order in l_int_ent_... lists) 00095 // 2. positions in the global SM depend on the storage format, for each format 00096 // different tables can be used (as the first implementation the CRS 00097 // format is used - it can be further used for other formats) 00098 int nr_asse_blocks_all_int_ent; // the length of the assembly_table 00099 int* asse_pos_first_dof_int_ent; // position of the first entry in the assembly_table 00100 // associated with a given int_ent 00101 // integration routines return stiffness matrices with the associated lists of 00102 // DOF_entities - for each pair of DOF entities a single SM block is created 00103 // for each SM block its position in sparse storage arrays of the solver 00104 // (like CRS or BCRS) is stored 00105 // (since DOF entities can have more than one associated DOF the whole storage scheme 00106 // is based on the notions of entities-structures-blocks, not single DOFs!!!) 00107 int* assembly_table; // 00108 00109 int nr_dof_blocks_all_int_ent; // the sum of the numbers of DOF entities for all 00110 // integration entities, i.e. the length of the local_to_global table 00111 int* pos_first_dof_int_ent; // position of the first entry in the local to global table 00112 // associated with a given int_ent (usually index*nr_dof_blocks) 00113 int* local_to_global; // associates the position on local (element) lists with 00114 // block IDs - block_id is the index for: 00115 int* global_to_posglob; // for a given block the position of its first DOF in dof vectors 00116 // (in the CRS manner the difference of two subsequent entries specifies 00117 // the number of dofs) - useful for dof blocks with different sizes 00118 // the pair local_to_global[dof_local] + global_to_posglob[local_to_global[dof_local]] 00119 // can be used to create l_bl_posglob and l_bl_nrdofs in assembly !!! 00120 // when the number of dofs is constant for each block: 00121 // posglob_first_dof[iblock] = block_id * block_size 00122 00123 double* dofs_vector_current; 00124 double* dofs_vector_prev_iter; 00125 double* dofs_vector_prev_step; 00126 double* geo_dofs_vector; 00127 00128 sit_dof_struct *l_dof_struct; /* list of dof structures with data useful for */ 00129 /* creating flexible interfaces between FEM code*/ 00130 /* and different solvers */ 00131 00132 /* for each possible type of dof entity - its corresponding dof structure */ 00133 int* l_dof_vert_to_struct; 00134 int* l_dof_edge_to_struct; 00135 int* l_dof_face_to_struct; 00136 int* l_dof_elem_to_struct; 00137 00138 /* for each possible type of dof entity in mixed - its corresponding dof structure */ 00139 int* l_dof_mixed_vert_to_struct; 00140 int* l_dof_mixed_edge_to_struct; 00141 int* l_dof_mixed_face_to_struct; 00142 int* l_dof_mixed_elem_to_struct; 00143 00144 /* dimensions of the above arrays */ 00145 int max_dof_vert_id; 00146 int max_dof_edge_id; 00147 int max_dof_face_id; 00148 int max_dof_elem_id; 00149 00150 /* dimensions of the above arrays for mixed */ 00151 int max_dof_mixed_vert_id; 00152 int max_dof_mixed_edge_id; 00153 int max_dof_mixed_face_id; 00154 int max_dof_mixed_elem_id; 00155 00156 } sit_levels; 00157 00158 /* definition of sit_solvers - data type for multi-level iterative solver */ 00159 typedef struct { 00160 int solver_id; /* solver_id */ 00161 int problem_id; /* ID of the problem associated with the solver */ 00162 int solver_type; /* linear equations solver: */ 00163 /* 0 - direct solver */ 00164 /* 1 - GMRES */ 00165 /* 2 - multi-level GMRES */ 00166 /* 99 - MKB_CORE_NS_SUPG_SOLVER */ 00167 int storage_type; 00168 int parallel; /* parameter specifying sequential (SIC_SEQUENTIAL) */ 00169 /* or parallel (SIC_PARALLEL) execution */ 00170 int nr_levels; /* number of levels in multi-level GMRES */ 00171 int cur_level; /* current level number in multi-level GMRES */ 00172 sit_levels level[SIC_MAX_NUM_LEV]; /* array of solver data structures */ 00173 /* corresponding to different levels */ 00174 int monitoring_level; 00175 } sit_solvers; 00176 00177 /*** GLOBAL VARIABLES (for the solver module only) ***/ 00178 00179 extern int siv_nr_solvers; /* the number of solvers in the problem */ 00180 extern int siv_cur_solver_id; /* ID of the current solver */ 00181 extern sit_solvers siv_solver[SIC_MAX_NUM_SOLV]; /* array of solvers */ 00182 00183 #ifdef __cplusplus 00184 } 00185 #endif 00186 00187 00188 #endif 00189