1 // GetDP - Copyright (C) 1997-2021 P. Dular and C. Geuzaine, University of Liege 2 // 3 // See the LICENSE.txt file for license information. Please report all 4 // issues on https://gitlab.onelab.info/getdp/getdp/issues. 5 6 #ifndef GEO_ENTITY_H 7 #define GEO_ENTITY_H 8 9 /* Incidence Matrices : Den (EdgesXNodes), Dfe (FacetsXEdges) */ 10 /* Xp stands for 'expanded' (used in discrete operators) */ 11 12 /* ------------------------------------------------------------------------ 13 POINT 14 15 v 16 | 17 | 18 -----1-----u 19 | 20 | 21 22 ------------------------------------------------------------------------ */ 23 24 static int NbrNodes_Point = 1 ; 25 static int NbrEdges_Point = 0 ; 26 static int NbrFacets_Point = 0 ; 27 28 static double Nodes_Point [][3] 29 = { {0., 0., 0.} } ; 30 31 /* ------------------------------------------------------------------------ 32 LINE edge 1: nodes 1 -> 2 33 34 v 35 | 36 | 37 --1-----2--u 38 | 39 | 40 41 ------------------------------------------------------------------------ */ 42 43 static int NbrNodes_Line = 2 ; 44 static int NbrEdges_Line = 1 ; 45 static int NbrFacets_Line = 0 ; 46 47 static double Nodes_Line [][3] 48 = { {-1., 0., 0.} , {1., 0., 0.,} } ; 49 50 static int Den_Line [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 51 = { { 1, -2, 0} } ; 52 53 static int Den_Line_Xp [] 54 = { -1, 1 } ; 55 56 57 /* ------------------------------------------------------------------------ 58 LINE_2 edge 1: nodes 1 -> 2 59 60 v 61 | 62 | 63 --1--3--2--u 64 | 65 | 66 67 ------------------------------------------------------------------------ */ 68 69 static int NbrNodes_Line_2 = 3 ; 70 71 static double Nodes_Line_2 [][3] 72 = { {-1., 0., 0.} , {1., 0., 0.,} , {0., 0., 0.,} } ; 73 74 /* ------------------------------------------------------------------------ 75 TRIANGLE edge 1: nodes 1 -> 2 76 v 2: 1 -> 3 77 | 3: 2 -> 3 78 | 79 3 facet 1: edges 1 -2 3 nodes 1 2 3 80 |\ 81 | \ 82 |__\___u 83 1 2 84 ------------------------------------------------------------------------ */ 85 86 static int NbrNodes_Triangle = 3 ; 87 static int NbrEdges_Triangle = 3 ; 88 static int NbrFacets_Triangle = 1 ; 89 90 static double Nodes_Triangle [][3] 91 = { {0., 0., 0.} , {1., 0., 0.} , {0., 1., 0.} } ; 92 93 static int Den_Triangle [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 94 = { { 1, -2, 0}, { 1, -3, 0}, { 2, -3, 0} } ; 95 96 static int Den_Triangle_Xp [] 97 = { -1, 1, 0, 98 -1, 0, 1, 99 0,-1, 1 } ; 100 101 static int Dfe_Triangle [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 102 = { { 1, 3, -2, 0} } ; 103 104 static int Dfe_Triangle_Xp [] 105 = { 1,-1, 1 } ; 106 107 108 static int Dfn_Triangle [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 109 = { { 1, 2, 3, 0} } ; 110 111 /* ------------------------------------------------------------------------ 112 TRIANGLE_2 edge 1: nodes 1 -> 2 113 v 2: 1 -> 3 114 | 3: 2 -> 3 115 | 116 3 facet 1: edges 1 -2 3 nodes 1 2 3 117 |\ 118 6 5 119 |__\___u 120 1 4 2 121 ------------------------------------------------------------------------ */ 122 123 static int NbrNodes_Triangle_2 = 6 ; 124 125 static double Nodes_Triangle_2 [][3] 126 = { {0., 0., 0.} , {1., 0., 0.} , {0., 1., 0.} , 127 {0.5, 0., 0.} , {0.5, 0.5, 0.} , {0., 0.5, 0.} } ; 128 129 /* ------------------------------------------------------------------------ 130 QUADRANGLE edge 1: nodes 1 -> 2 131 v 2: 1 -> 4 132 | 3: 2 -> 3 133 4--|--3 4: 3 -> 4 134 | | | 135 -----------u facet 1: edges 1 -2 3 4 nodes 1 2 3 4 136 | | | 137 1--|--2 138 | 139 ------------------------------------------------------------------------ */ 140 141 static int NbrNodes_Quadrangle = 4 ; 142 static int NbrEdges_Quadrangle = 4 ; 143 static int NbrFacets_Quadrangle = 1 ; 144 145 static double Nodes_Quadrangle [][3] 146 = { {-1., -1., 0.} , {1., -1., 0.} , 147 { 1., 1., 0.} , {-1., 1., 0.} } ; 148 149 static int Den_Quadrangle [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 150 = { { 1, -2, 0}, { 1, -4, 0}, { 2, -3, 0}, { 3, -4, 0} } ; 151 152 static int Den_Quadrangle_Xp [] 153 = { -1, 1, 0, 0, 154 -1, 0, 0, 1, 155 0,-1, 1, 0, 156 0, 0,-1, 1 } ; 157 158 static int Dfe_Quadrangle [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 159 = { { 1, 3, 4, -2, 0} } ; 160 161 static int Dfe_Quadrangle_Xp [] 162 = { 1,-1, 1, 1 } ; 163 164 165 static int Dfn_Quadrangle [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 166 = { { 1, 2, 3, 4, 0} } ; 167 168 /* ------------------------------------------------------------------------ 169 QUADRANGLE_2 edge 1: nodes 1 -> 2 170 v 2: 1 -> 4 171 | 3: 2 -> 3 172 4--7--3 4: 3 -> 4 173 | | | 174 --8--9--6--u facet 1: edges 1 -2 3 4 nodes 1 2 3 4 175 | | | 176 1--5--2 177 | 178 ------------------------------------------------------------------------ */ 179 180 static int NbrNodes_Quadrangle_2 = 9 ; 181 182 static double Nodes_Quadrangle_2 [][3] 183 = { {-1., -1., 0.} , { 1.,-1., 0.} , 184 { 1., 1., 0.} , {-1., 1., 0.} , 185 { 0., -1., 0.} , { 1., 0., 0.} , 186 { 0., 1., 0.} , {-1., 0., 0.} , 187 { 0., 0., 0.} 188 } ; 189 190 /* ------------------------------------------------------------------------ 191 QUADRANGLE_2_8N edge 1: nodes 1 -> 3 192 v 2: 1 -> 7 193 | 3: 3 -> 5 194 7--6--5 4: 5 -> 7 195 | | | 196 --8-----4--u facet 1: edges 1 -3 5 7 nodes 1 3 5 7 197 | | | 198 1--2--3 199 | 200 ------------------------------------------------------------------------ */ 201 202 static int NbrNodes_Quadrangle_2_8N = 8 ; 203 204 static double Nodes_Quadrangle_2_8N [][3] 205 = { {-1., -1., 0.} , { 1.,-1., 0.} , 206 { 1., 1., 0.} , {-1., 1., 0.} , 207 { 0., -1., 0.} , { 1., 0., 0.} , 208 { 0., 1., 0.} , {-1., 0., 0.} , 209 } ; 210 211 /* ------------------------------------------------------------------------ 212 TETRAHEDRON edge 1: nodes 1 -> 2 213 v 2: 1 -> 3 214 | 3: 1 -> 4 215 | 4: 2 -> 3 216 | 5: 2 -> 4 217 3 6: 3 -> 4 218 |\ 219 | \ facet 1: edges 1 -3 5 nodes 1 2 4 220 |__\2_____u 2: -1 2 -4 1 3 2 221 1\ / 3: -2 3 -6 1 4 3 222 \4 4: 4 -5 6 2 3 4 223 \ 224 w 225 ------------------------------------------------------------------------ */ 226 227 static int NbrNodes_Tetrahedron = 4 ; 228 static int NbrEdges_Tetrahedron = 6 ; 229 static int NbrFacets_Tetrahedron = 4 ; 230 231 static double Nodes_Tetrahedron [][3] 232 = { {0., 0., 0.} , {1., 0., 0.}, 233 {0., 1., 0.} , {0., 0., 1.} } ; 234 235 static int Den_Tetrahedron [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 236 = { { 1, -2, 0}, { 1, -3, 0}, { 1, -4, 0}, 237 { 2, -3, 0}, { 2, -4, 0}, { 3, -4, 0} } ; 238 239 static int Den_Tetrahedron_Xp [] 240 = { -1, 1, 0, 0, 241 -1, 0, 1, 0, 242 -1, 0, 0, 1, 243 0,-1, 1, 0, 244 0,-1, 0, 1, 245 0, 0,-1, 1 } ; 246 247 static int Dfe_Tetrahedron [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 248 = { { 1, -3, 5, 0}, { -1, 2, -4, 0}, 249 { -2, 3, -6, 0}, { 4, -5, 6, 0} } ; 250 251 static int Dfe_Tetrahedron_Xp [] 252 = { 1, 0,-1, 0, 1, 0, 253 -1, 1, 0,-1, 0, 0, 254 0,-1, 1, 0, 0,-1, 255 0, 0, 0, 1,-1, 1 } ; 256 257 static int Dfn_Tetrahedron [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 258 = { { 1, 2, 4, 0}, { 1, 3, 2, 0}, 259 { 1, 4, 3, 0}, { 2, 3, 4, 0} } ; 260 261 /* ------------------------------------------------------------------------ * 262 TETRAHEDRON_2 edge 1: nodes 1 -> 2 263 3 2: 1 -> 3 264 ,/|`\ 3: 1 -> 4 265 ,/ | `\ 4: 2 -> 3 266 ,7 '. `6 5: 2 -> 4 267 ,/ 9 `\ 6: 3 -> 4 268 ,/ | `\ 269 1--------5--'.--------2 facet 1: edges 1 -3 5 nodes 1 2 4 270 `\. | ,/ 2: -1 2 -4 1 3 2 271 `\. | ,10 3: -2 3 -6 1 4 3 272 `8. '. ,/ 4: 4 -5 6 2 3 4 273 `\. |/ 274 `4 275 ------------------------------------------------------------------------ */ 276 277 static int NbrNodes_Tetrahedron_2 = 10 ; 278 279 static double Nodes_Tetrahedron_2 [][3] 280 = { {0., 0., 0.}, {1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}, 281 {0.5, 0., 0.}, {0.5, 0.5, 0.}, {0., 0.5, 0.}, 282 {0., 0., 0.5}, {0., 0.5, 0.5}, {0.5, 0., 0.5} } ; 283 284 /* ------------------------------------------------------------------------ 285 HEXAHEDRON edge 1: nodes 1 -> 2 286 v 2: 1 -> 4 287 | 3: 1 -> 5 288 | 4: 2 -> 3 289 4----|--3 5: 2 -> 6 290 |\ | |\ 6: 3 -> 4 291 | 8-------7 7: 3 -> 7 292 | | ----|---u 8: 4 -> 8 293 1-|---\-2 | 9: 5 -> 6 294 \| \ \| 10: 5 -> 8 295 5-----\-6 11: 6 -> 7 296 \ 12: 7 -> 8 297 w 298 facet 1: edges 1 -3 5 -9 nodes 1 2 6 5 299 2: -1 2 -4 -6 1 4 3 2 300 3: -2 3 -8 10 1 5 8 4 301 4: 4 -5 7 -11 2 3 7 6 302 5: 6 -7 8 -12 3 4 8 7 303 6: 9 -10 11 12 5 6 7 8 304 305 ------------------------------------------------------------------------ */ 306 307 static int NbrNodes_Hexahedron = 8 ; 308 static int NbrEdges_Hexahedron = 12 ; 309 static int NbrFacets_Hexahedron = 6 ; 310 311 static double Nodes_Hexahedron [][3] 312 = { {-1., -1., -1.} , {1., -1., -1.} , 313 { 1., 1., -1.} , {-1., 1., -1.} , 314 {-1., -1., 1.} , {1., -1., 1.} , 315 { 1., 1., 1.} , {-1., 1., 1.} } ; 316 317 static int Den_Hexahedron [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 318 = { { 1, -2, 0}, { 1, -4, 0}, { 1, -5, 0}, 319 { 2, -3, 0}, { 2, -6, 0}, { 3, -4, 0}, 320 { 3, -7, 0}, { 4, -8, 0}, { 5, -6, 0}, 321 { 5, -8, 0}, { 6, -7, 0}, { 7, -8, 0} } ; 322 323 static int Den_Hexahedron_Xp [] 324 = { -1, 1, 0, 0, 0, 0, 0, 0, 325 -1, 0, 0, 1, 0, 0, 0, 0, 326 -1, 0, 0, 0, 1, 0, 0, 0, 327 0,-1, 1, 0, 0, 0, 0, 0, 328 0,-1, 0, 0, 0, 1, 0, 0, 329 0, 0,-1, 1, 0, 0, 0, 0, 330 0, 0,-1, 0, 0, 0, 1, 0, 331 0, 0, 0,-1, 0, 0, 0, 1, 332 0, 0, 0, 0,-1, 1, 0, 0, 333 0, 0, 0, 0,-1, 0, 0, 1, 334 0, 0, 0, 0, 0,-1, 1, 0, 335 0, 0, 0, 0, 0, 0,-1, 1 }; 336 337 static int Dfe_Hexahedron [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 338 = { { 1, -3, 5, -9, 0}, {-1, 2, -4, -6, 0}, {-2, 3, -8, 10, 0}, 339 { 4, -5, 7, -11, 0}, { 6, -7, 8, -12, 0}, { 9, -10, 11, 12, 0} } ; 340 341 static int Dfe_Hexahedron_Xp [] 342 = { 1, 0,-1, 0, 1, 0, 0, 0,-1, 0, 0, 0, 343 -1, 1, 0,-1, 0,-1, 0, 0, 0, 0, 0, 0, 344 0,-1, 1, 0, 0, 0, 0,-1, 0, 1, 0, 0, 345 0, 0, 0, 1,-1, 0, 1, 0, 0, 0,-1, 0, 346 0, 0, 0, 0, 0, 1,-1, 1, 0, 0, 0,-1, 347 0, 0, 0, 0, 0, 0, 0, 0, 1,-1, 1, 1 }; 348 349 static int Dfn_Hexahedron [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 350 = { { 1, 2, 6, 5, 0}, { 1, 4, 3, 2, 0}, { 1, 5, 8, 4, 0}, 351 { 2, 3, 7, 6, 0}, { 3, 4, 8, 7, 0}, { 5, 6, 7, 8, 0} } ; 352 353 /* ------------------------------------------------------------------------ 354 PRISM edge 1: nodes 1 -> 2 355 v 2: 1 -> 3 356 3 | 3: 1 -> 4 357 |\| 4: 2 -> 3 358 | | 5: 2 -> 5 359 1_|2 6: 3 -> 6 360 \| 6 7: 4 -> 5 361 |_|_\___u 8: 4 -> 6 362 \| \ 9: 5 -> 6 363 4 __5 364 \ facet 1: edges 1 -3 5 -7 nodes 1 2 5 4 365 \ 2: -1 2 -4 1 3 2 366 w 3: -2 3 -6 8 1 4 6 3 367 4: 4 -5 6 -9 2 3 6 5 368 5: 7 -8 9 4 5 6 369 370 ------------------------------------------------------------------------ */ 371 372 static int NbrNodes_Prism = 6 ; 373 static int NbrEdges_Prism = 9 ; 374 static int NbrFacets_Prism = 5 ; 375 376 static double Nodes_Prism [][3] 377 = { {0., 0., -1.} , {1., 0., -1.} , {0., 1., -1.} , 378 {0., 0., 1.} , {1., 0., 1.} , {0., 1., 1.} } ; 379 380 static int Den_Prism [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 381 = { { 1, -2, 0}, { 1, -3, 0}, { 1, -4, 0}, 382 { 2, -3, 0}, { 2, -5, 0}, { 3, -6, 0}, 383 { 4, -5, 0}, { 4, -6, 0}, { 5, -6, 0} } ; 384 385 static int Den_Prism_Xp [] 386 = { -1, 1, 0, 0, 0, 0, 387 -1, 0, 1, 0, 0, 0, 388 -1, 0, 0, 1, 0, 0, 389 0,-1, 1, 0, 0, 0, 390 0,-1, 0, 0, 1, 0, 391 0, 0,-1, 0, 0, 1, 392 0, 0, 0,-1, 1, 0, 393 0, 0, 0,-1, 0, 1, 394 0, 0, 0, 0,-1, 1 }; 395 396 static int Dfe_Prism [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 397 = { { 1, -3, 5, -7, 0}, { -1, 2, -4, 0}, { -2, 3, -6, 8, 0}, 398 { 4, -5, 6, -9, 0}, { 7, -8, 9, 0} } ; 399 400 static int Dfe_Prism_Xp [] 401 = { 1, 0,-1, 0, 1, 0,-1, 0, 0, 402 -1, 1, 0,-1, 0, 0, 0, 0, 0, 403 0,-1, 1, 0, 0,-1, 0, 1, 0, 404 0, 0, 0, 1,-1, 1, 0, 0,-1, 405 0, 0, 0, 0, 0, 0, 1,-1, 1 }; 406 407 408 static int Dfn_Prism [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 409 = { { 1, 2, 5, 4, 0}, { 1, 3, 2, 0}, { 1, 4, 6, 3, 0}, 410 { 2, 3, 6, 5, 0}, { 4, 5, 6, 0} } ; 411 412 /* ------------------------------------------------------------------------ 413 PYRAMID edge 1: nodes 1 -> 2 414 v 2: 1 -> 4 415 | 3: 1 -> 5 416 | 4: 2 -> 3 417 4---|---3 5: 2 -> 5 418 | \ | /| 6: 3 -> 4 419 | \ -/-|---u 7: 3 -> 5 420 | / 5\ | 8: 4 -> 5 421 1/----\-2 422 \ facet 1: edges 1 5 -3 nodes 1 2 5 423 \ 2: 2 -6 -4 -1 1 4 3 2 424 w 3: 3 -8 -2 1 5 4 425 4: 4 7 -5 2 3 5 426 5: 6 8 -7 3 4 5 427 428 ------------------------------------------------------------------------ */ 429 430 static int NbrNodes_Pyramid = 5 ; 431 static int NbrEdges_Pyramid = 8 ; 432 static int NbrFacets_Pyramid = 5 ; 433 434 static double Nodes_Pyramid [][3] 435 = { {-1., -1., 0.} , { 1., -1., 0.} , 436 { 1., 1., 0.} , {-1., 1., 0.} , 437 { 0., 0., 1.} } ; 438 439 static int Den_Pyramid [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 440 = { { 1, -2, 0}, { 1, -4, 0}, { 1, -5, 0}, { 2, -3, 0}, 441 { 2, -5, 0}, { 3, -4, 0}, { 3, -5, 0}, { 4, -5, 0} } ; 442 443 static int Den_Pyramid_Xp [] 444 = { -1, 1, 0, 0, 0, 445 -1, 0, 0, 1, 0, 446 -1, 0, 0, 0, 1, 447 0,-1, 1, 0, 0, 448 0,-1, 0, 0, 1, 449 0, 0,-1, 1, 0, 450 0, 0,-1, 0, 1, 451 0, 0, 0,-1, 1 }; 452 453 static int Dfe_Pyramid [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 454 = { { 1, 5, -3, 0}, { 2, -6, -4, -1, 0}, { 3, -8, -2, 0}, 455 { 4, 7, -5, 0}, { 6, 8, -7, 0} } ; 456 457 static int Dfe_Pyramid_Xp [] 458 = { 1, 0,-1, 0, 1, 0, 0, 0, 459 -1, 1, 0,-1, 0,-1, 0, 0, 460 0,-1, 1, 0, 0, 0, 0,-1, 461 0, 0, 0, 1,-1, 0, 1, 0, 462 0, 0, 0, 0, 0, 1,-1, 1 }; 463 464 static int Dfn_Pyramid [] [NBR_MAX_SUBENTITIES_IN_ELEMENT] 465 = { { 1, 2, 5, 0}, { 1, 4, 3, 2, 0}, { 1, 5, 4, 0}, 466 { 2, 3, 5, 0}, { 3, 4, 5, 0} } ; 467 468 469 #endif 470