00001 #if !defined ( __SIFTOP__ ) 00002 #define __SIFTOP__ 00003 00004 #include <stdio.h> 00005 #include "galias.h" 00006 #include "iotools.h" 00007 #include "gtopology.h" 00008 00009 enum outmodetype {omt_parameters=0, omt_tangent=1, omt_normal=2, omt_boundary_entities=3, 00010 omt_associated_elements=4, omt_neighbourhood=5, omt_el_iso_type=6, 00011 omt_nat_order_nod=7, omt_sec_clasif_nod=8}; 00012 00013 00014 /// overloaded postfix operator for enum type gtypel 00015 const gtypel operator ++(gtypel &a, int); 00016 00017 00018 00019 struct sedges; 00020 struct sfaces; 00021 00022 00023 00024 /** 00025 This structure groups information about node like coordinates and property number 00026 00027 Created by Tomas Koudelka, 2001 00028 */ 00029 struct snode 00030 { 00031 double x; ///< x coordinate of node 00032 double y; ///< y coordinate of node 00033 double z; ///< z coordinate of node 00034 long nprop; ///< number of assigned properties 00035 entityp *entid; ///< entity types 00036 long *prop; ///< property numbers of given entities 00037 00038 snode(); 00039 ~snode(); 00040 void alloc(long num_prop); ///< allocation of node 00041 void add_prop(entityp ent, long propid); ///< adds one new property 00042 long searchprop(long aprop, gentity ent, long nid, sedges *edg, sfaces *sfc); ///< searches node for given property 00043 }; 00044 00045 00046 00047 /** 00048 This structure groups information about element like node numbers, property number and type of element 00049 00050 Created by Tomas Koudelka, 2001 00051 */ 00052 struct selement 00053 { 00054 long *nodes; ///< pointer to array with element node numbers 00055 long nne; ///< number of nodes on element 00056 gtypel type; ///< geometric type of element 00057 long ned; ///< number of edges 00058 long *nned; ///< number of nodes on particular edges 00059 long tnned; ///< total number of nodes on all edges 00060 long **edgenod; ///< array with indices of nodes on particular edges - edgnod[i][j] gives j-th index of node on i-th edge 00061 long *propedg; ///< property numbers of each edge 00062 long nsurf; ///< number of surfaces 00063 long *propsurf; ///< property numbers of surfaces 00064 long *nnsurf; ///< number of nodes on particular surfaces 00065 long tnnsurf; ///< total number of nodes on all surfaces 00066 long **surfnod; ///< array with indices of nodes on particular surfaces - surfnod[i][j] gives index of j-th node on i-th surface 00067 long prop; ///< property number of element 00068 00069 selement(); 00070 ~selement(); 00071 00072 /// allocation of memory for nodes 00073 long alloc(long alloc_bp); 00074 00075 /// searches for property aprop of the given entity ent in element property arrays 00076 long searchprop(long aprop, gentity ent, snode *tnodes, long eid, sedges *edg, sfaces *sfc, long *&entid, long &nentid); 00077 /// searches for property aprop of the given entity ent in the element nodes 00078 long searchnodprop(long aprop, gentity ent, snode *tnodes, sedges *edg, sfaces *sfc, long *propent); 00079 long compare_edg(long *nod, long n); 00080 long compare_surf(long *nod, long n); 00081 }; 00082 00083 00084 00085 /** 00086 This structure groups information about one edge like node numbers and property number 00087 00088 Created by Tomas Koudelka, 08.2011 00089 */ 00090 struct sedge 00091 { 00092 long n1; ///< the first node number of the edge 00093 long n2; ///< the second node number of the edge 00094 long prop; ///< property number of the given edge 00095 00096 sedge(); 00097 ~sedge(); 00098 long read(XFILE *in); ///< method reads the edge data from the file 00099 void print(FILE *out, long *lnn); ///< method prints the edge data to the file 00100 long cordomtest(long *lnn); ///< method tests whetehr the edge is contained in the given subdomain 00101 00102 }; 00103 00104 00105 00106 /** 00107 This structure handles list of edges 00108 00109 Created by Tomas Koudelka, 08.2011 00110 */ 00111 struct sedges 00112 { 00113 long nedg; ///< number of edges 00114 sedge *edges; ///< array of edges 00115 long nprop; ///< number of different properties for all faces 00116 long *proplist; ///< array of particular property numbers (its size is nprop) 00117 00118 /// arrays of node numbers for particular edge properties (prop_list_nod[i][j] = j-th node of edge with property proplist[i] 00119 long **prop_list_nod; 00120 00121 /// arrays of number of nodes for particular edge properties (prop_list_nod_num[i] = number of nodes with edge property proplist[i] i.e. length of prop_list_nod[i]) 00122 long *prop_list_nod_num; 00123 00124 /// arrays of element numbers for particular edge properties (prop_list_elem[i][j] = j-th element of edge with property proplist[i]) 00125 long **prop_list_elem; 00126 00127 /// arrays of number of elements for particular edge properties (prop_list_elem_num[i] = number of elements with edge property proplist[i] i.e. length of prop_list_elem[i]) 00128 long *prop_list_elem_num; 00129 00130 /// arrays of element edge id for particular edge properties and elements (prop_list_elem_edgid[i][j][k] = k-th edge id of j-th element with edge property proplist[i]) 00131 long ***prop_list_elem_edgid; 00132 00133 /// arrays of number of element edges with particular edge properties for particular elements (prop_list_elem_edgid_num[i][j] = number of edges of j-th element with edge property proplist[i] i.e. length of prop_list_elem_edgid[i][j])) 00134 long **prop_list_elem_edgid_num; 00135 00136 sedges(); 00137 sedges(long ned); ///< initializes to array of edges with size ned 00138 ~sedges(); 00139 00140 void read(XFILE *in); ///< method reads the data about edges from the file 00141 void print(FILE *out, long *lnn); ///< method prints the data about edges to the file 00142 long search_list_newprop(long prop, long *propid, long n); ///< tests prop whether it is contained in the array propid 00143 void gen_list_edg(long nn, long ne, selement *elemss, long *nadjelnod, long **adjelnod); ///< method generates the lists of nodes and elements for particular properties of the edges 00144 void gen_list_node(long nn); ///< method generates the lists of nodes for particular properties of the edges 00145 void gen_list_elem(long ne, selement *elems, long *nadjelnod, long **adjelnod); ///< method generates the lists elements for particular properties of the edges 00146 }; 00147 00148 00149 00150 /** 00151 This structure groups information about one face like node numbers and property number 00152 00153 Created by Tomas Koudelka, 08.2011 00154 */ 00155 struct sface 00156 { 00157 long nnod; ///< number of nodes that define the given face 00158 long *nodes; ///< array of node numbers defining the face 00159 long prop; ///< property number of the given face 00160 00161 sface(); 00162 sface(long n); ///< initializes to array of nodes with size n 00163 ~sface(); 00164 00165 long read(XFILE *in); ///< method reads the edge data from the file 00166 void print(FILE *out, long *lnn); ///< method prints the edge data to the file 00167 long cordomtest(long *lnn); ///< method tests whetehr the edge is contained in the given subdomain 00168 }; 00169 00170 00171 00172 /** 00173 This structure handles list of faces 00174 00175 Created by Tomas Koudelka, 08.2011 00176 */ 00177 struct sfaces 00178 { 00179 long nfcs; ///< number of faces 00180 sface *faces; ///< array of faces 00181 long nprop; ///< number of different properties for all faces 00182 long *proplist; ///< array of particular property numbers (its size is nprop) 00183 /// arrays of node numbers for particular surface properties (prop_list_nod[i][j] = j-th node of surface with property proplist[i] 00184 long **prop_list_nod; 00185 00186 /// arrays of number of nodes for particular surface properties (prop_list_nod_num[i] = number of nodes with surface property proplist[i] i.e. length of prop_list_nod[i]) 00187 long *prop_list_nod_num; 00188 00189 /// arrays of element numbers for particular surface properties (prop_list_elem[i][j] = j-th element of surface with property proplist[i]) 00190 long **prop_list_elem; 00191 00192 /// arrays of number of elements for particular surface properties (prop_list_elem_num[i] = number of elements with surface property proplist[i] i.e. length of prop_list_elem[i]) 00193 long *prop_list_elem_num; 00194 00195 /// arrays of element surface id for particular surface properties and elements (prop_list_elem_sfid[i][j][k] = k-th surface id of j-th element with surface property proplist[i]) 00196 long ***prop_list_elem_sfid; 00197 00198 /// arrays of number of element surfaces with particular surface properties for particular elements (prop_list_elem_sfid_num[i][j] = number of surfaces of j-th element with surface property proplist[i] i.e. length of prop_list_elem_sfid[i][j]) 00199 long **prop_list_elem_sfid_num; 00200 00201 sfaces(); 00202 sfaces(long n); ///< initializes to array of faces with size nfc 00203 ~sfaces(); 00204 00205 void read(XFILE *in); ///< method reads the data about surfaces from the file 00206 void print(FILE *out, long *lnn); ///< method prints the data about surfaces to the file 00207 long search_list_newprop(long prop, long *propid, long n); ///< the function tests whether the given property number is new comparing to the array of existing property numbers 00208 void gen_list_surf(long nn, long ne, selement *elems, long *nadjelnod, long **adjelnod); ///< method generates the lists of properties, nodes and elements for particular properties of the faces 00209 // void gen_list_surf(long nn, long ne, selement *elems); ///< method generates the lists of properties, nodes and elements for particular properties of the faces 00210 void gen_list_node(long nn); ///< method generates the lists of nodes for particular properties of the faces 00211 void gen_list_elem(long ne, selement *elems, long *nadjelnod, long **adjelnod); ///< method generates the lists elements for particular properties of the faces 00212 // void gen_list_elem(long ne, selement *elems); ///< method generates the lists elements for particular properties of the faces 00213 }; 00214 00215 00216 00217 /** 00218 This class stores all information about topology of given problem but only 00219 for auxiliary purposes in preprocessors especially. 00220 00221 Created by Tomas Koudelka, 2001 00222 */ 00223 class siftop 00224 { 00225 public: 00226 siftop (void); 00227 ~siftop (void); 00228 00229 /// method reads topology in JKTK format from file 00230 long read(XFILE *in, long rgnn, long rebp); 00231 00232 /// method imports topology in T3D format 00233 void import_t3d(XFILE *in, long paral); 00234 00235 /// method imports section of nodes from file in T3D format 00236 long import_t3d_nodes (XFILE *in, long paral, long *outmode); 00237 00238 /// method imports section of elements from file in T3D format 00239 long import_t3d_elements (XFILE *in, long *outmode); 00240 00241 /// method imports topology in GiD format 00242 void import_gid(XFILE *in); 00243 00244 /// method copies topological data to gtopology structure 00245 void exporttop (gtopology *top); 00246 00247 /// method exports topology to a text file in JKTK format 00248 void print (FILE *out); 00249 00250 /// prints nodes with the shift indices 00251 void shift_print_nodes (FILE *out,long shift); 00252 00253 /// print elements with the shift indices 00254 void shift_print_elements (FILE *out,long shiftnn,long shiftne); 00255 00256 /// method exports siftop mesh in GiD format to a text file 00257 void export_gid_mesh(FILE *out, long idn1=1, long ide1=1); 00258 00259 /// method writes nodes in GiD format to a text file 00260 void write_gid_nodes(FILE *out, long idn1=1); 00261 00262 /// method writes one element in GiD format to a text file 00263 void write_gid_element(FILE *out, long i, long idn1=1, long ide1=1); 00264 00265 /// method generates lists of adjacent elements to nodes 00266 void gen_adjelnod(void); 00267 00268 /// method gets ndof of nodes with property prop of entity ent 00269 long get_ndofn(long prop, gentity ent, long *ndofn, long *setnodes); 00270 00271 /// returns nodes laying on the entities ent with property prop 00272 long get_propent_nodes(long prop, gentity ent, long *setnodes); 00273 00274 // function reorders mesh from t3d format into sifel format (3D) 00275 void t3d2sifelformat(); 00276 00277 selement *elements; ///< pointer to array with elements 00278 snode *nodes; ///< pointer to array with nodes 00279 sedges *edges; ///< pointer to structure with additional edges 00280 sfaces *surfaces; ///< pointer to structure with additional faces 00281 long nn; ///< number of nodes 00282 long ne; ///< number of elements 00283 long npet[all_element_types-1]; ///< number of particular element types (used for t3d format) 00284 long degree; ///< degree of approximation polynom of the elements (used for t3d format) 00285 long *gnn; ///< pointer to array with global node numbers. This is support for paralell computing 00286 long *nadjelnod;///< pointer to array of number of adjacent elements to nodes (nadjelnod[i] = number of adjacent elements of i-th node) 00287 long **adjelnod; ///< array of pointers to arrays of adjacent elements id to particular nodes (adjelnod[i][j] = id o j-th adjacent element to i-th node) 00288 00289 // parameters for BOSS preconditioners 00290 /// type of mesh description 00291 long meshtype; 00292 /// number of subdomains/aggregates 00293 long nsd; 00294 /// number of nodes on subdomains/aggregates 00295 long *nnsd; 00296 }; 00297 00298 #endif