/usr/include/alberta/alberta.h is in libalberta-dev 3.0.1-1+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 | /*******************************************************************************
* ALBERTA: an Adaptive multi Level finite element toolbox using
* Bisectioning refinement and Error control by Residual
* Techniques for scientific Applications
*
* file: alberta.h
*
* description: public header file of the ALBERTA package
*
*******************************************************************************
*
* authors: Alfred Schmidt
* Zentrum fuer Technomathematik
* Fachbereich 3 Mathematik/Informatik
* Universitaet Bremen
* Bibliothekstr. 2
* D-28359 Bremen, Germany
*
* Kunibert G. Siebert
* Institut fuer Mathematik
* Universitaet Augsburg
* Universitaetsstr. 14
* D-86159 Augsburg, Germany
*
* Daniel Koester
* Institut fuer Mathematik
* Universitaet Augsburg
* Universitaetsstr. 14
* D-86159 Augsburg, Germany
*
* Claus-Justus Heine
* Abteilung fuer Angewandte Mathematik
* Universitaet Freiburg
* Hermann-Herder-Strasse 10
* 79104 Freiburg, Germany
*
* http://www.alberta-fem.de
*
* (c) by A. Schmidt and K.G. Siebert (1996-2005),
* D. Koester (2002-2005),
* C.-J. Heine (2002-2009).
*
******************************************************************************/
/*******************************************************************************
* Header-File for ALBERTA utilities
******************************************************************************/
#ifndef _ALBERTA_H_
#define _ALBERTA_H_
#include <alberta/alberta_util.h>
#ifdef __cplusplus
extern "C" {
#elif 0
} /* some editors try to indent because of the brace above */
#endif
/* The version string used for disk-IO. Note the space after the
* version number, the version number is expected to be of the forn
* "X.Y " or "X.YZ". The IO version must not necessarily relate to the
* version of the library.
*/
#define ALBERTA_MAGIC "ALBERTA: Version "
#define ALBERTA_VERSION ALBERTA_MAGIC"2.3 "
/*******************************************************************************
* Definition of the space dimension and of parameters depending on the
* space dimension:
*
* DIM_OF_WORLD: space dimension
*
* The ?D-suffix signals different simplex dimensions (formerly ==DIM).
******************************************************************************/
#ifndef DIM_OF_WORLD
# error DIM_OF_WORLD UNDEFINED
#endif
#ifndef ALBERTA_DEBUG
/* #warning is a GNU extension, and there is no way to get at compiler
* switches like -Werror form here, so do NOT use it.
*/
/* # warning ALBERTA_DEBUG WAS NOT DEFINED! DEFAULTING TO 0. */
# define ALBERTA_DEBUG 0
#endif
/* meshes of at most this dimension are supported. This macro can
* be use to lay-out static arrays.
*/
#define DIM_LIMIT 3
/* The master dimension limit, meshes of higher dimension are not
* supported.
*/
#define DIM_MAX MIN(DIM_OF_WORLD, DIM_LIMIT)
/* Various constants for dimension dependent geometrical quantities
*
* A note about the terminology: caused by historic reasons the
* terminology for simplexes is of naive nature: 1d and 2d simplexes
* do not have faces (unluckily). Instead, 1d simplexes have vertices
* and 2d simplexes have edges. Of course, 3d simplexes also have
* vertices and edges, but: those are _very_ different from 1d and 2d
* vertices and edges.
*
* The best solution would be to reserve the name "face" for a
* co-dimension one face-simplex. Unluckily, there does not seem to be
* consense about this. Therefore, the naive ALBERTA notion of "face"
* is maintained, but supplemented by the notion of a "wall", which
* denotes a co-dimension one (1) face-simplex. Whenever the notation
* "wall" is used somewhere in ALBERTA then it denotes stuff
* concerning co-dimension 1 simplexes (i.e. "faces"). Like WALL_QUAD,
* EL_INFO->wall_bound, wall-transformation (for periodic boundaries)
* etc.
*
* In my opionion this is a FIXME. "face" should be used everywhere to
* denote a co-dimension 1 face-simplex. In German "Face" means "Seite".
*
* cH.
*/
#define N_VERTICES(DIM) ((DIM)+1)
#define N_EDGES(DIM) ((DIM)*((DIM)+1)/2)
#define N_WALLS(DIM) ((DIM)+1) /* number of codim 1 subsimplexes */
#define N_FACES(DIM) (((DIM) == 3) * N_WALLS(DIM))
#define N_NEIGH(DIM) (((DIM) != 0) * N_WALLS(DIM))
#define N_LAMBDA(DIM) N_VERTICES(DIM)
#define DIM_FAC(DIM) ((DIM) < 2 ? 1 : (DIM) == 2 ? 2 : 6)
#define VERTEX_OF_EDGE(DIM, EDGE) \
((DIM) == 1 \
? vertex_of_edge_1d[(EDGE)] \
: ((DIM == 2) \
? vertex_of_edge_2d[(EDGE)] \
: vertex_of_edge_3d[(EDGE)]))
#define VERTEX_OF_WALL(DIM, WALL) \
((DIM) == 1 \
? vertex_of_wall_1d[(WALL)] \
: ((DIM == 2) \
? vertex_of_wall_2d[(WALL)] \
: vertex_of_wall_3d[(WALL)]))
#define N_VERTICES_0D N_VERTICES(0)
#define N_EDGES_0D N_EDGES(0)
#define N_FACES_0D N_FACES(0)
#define N_NEIGH_0D N_NEIGH(0)
#define N_WALLS_0D N_WALLS(0)
#define N_LAMBDA_0D N_LAMBDA(0)
#define DIM_FAC_0D DIM_FAC(0)
#define VERTEX_OF_EDGE_0D NULL
#define VERTEX_OF_WALL_0D NULL
#define N_VERTICES_1D N_VERTICES(1)
#define N_EDGES_1D N_EDGES(1)
#define N_FACES_1D N_FACES(1)
#define N_NEIGH_1D N_NEIGH(1)
#define N_WALLS_1D N_WALLS(1)
#define N_LAMBDA_1D N_LAMBDA(1)
#define DIM_FAC_1D DIM_FAC(1)
#define VERTEX_OF_EDGE_1D(E) VERTEX_OF_EDGE(1, E)
#define VERTEX_OF_WALL_1D(W) VERTEX_OF_WALL(1, W)
#define N_VERTICES_2D N_VERTICES(2)
#define N_EDGES_2D N_EDGES(2)
#define N_FACES_2D N_FACES(2)
#define N_NEIGH_2D N_NEIGH(2)
#define N_WALLS_2D N_WALLS(2)
#define N_LAMBDA_2D N_LAMBDA(2)
#define DIM_FAC_2D DIM_FAC(2)
#define VERTEX_OF_EDGE_2D(E) VERTEX_OF_EDGE(2, E)
#define VERTEX_OF_WALL_2D(W) VERTEX_OF_WALL(2, W)
#define N_VERTICES_3D N_VERTICES(3)
#define N_EDGES_3D N_EDGES(3)
#define N_FACES_3D N_FACES(3)
#define N_NEIGH_3D N_NEIGH(3)
#define N_WALLS_3D N_WALLS(3)
#define N_LAMBDA_3D N_LAMBDA(3)
#define DIM_FAC_3D DIM_FAC(3)
#define VERTEX_OF_EDGE_3D(E) VETEX_OF_EDGE(3, E)
#define VERTEX_OF_WALL_3D(W) VERTEX_OF_WALL(3, W)
/* The maximal number for a given DIM_OF_WORLD.
*/
#define N_LAMBDA_MAX N_VERTICES(DIM_MAX)
#define N_VERTICES_MAX N_VERTICES(DIM_MAX)
#define N_EDGES_MAX N_EDGES(DIM_MAX)
#define N_FACES_MAX N_FACES(DIM_MAX)
#define N_NEIGH_MAX N_NEIGH(DIM_MAX)
#define N_WALLS_MAX N_WALLS(DIM_MAX)
#define DIM_FAC_MAX DIM_FAC(DIM_MAX)
/* The maximal number which can possibly occur within ALBERTA. These
* macros can be used to layout static arrays. Of course, DIM_LIMIT is
* hard-wired to 3, and that will not change.
*/
#define N_LAMBDA_LIMIT N_VERTICES(DIM_LIMIT)
#define N_VERTICES_LIMIT N_VERTICES(DIM_LIMIT)
#define N_EDGES_LIMIT N_EDGES(DIM_LIMIT)
#define N_FACES_LIMIT N_FACES(DIM_LIMIT)
#define N_NEIGH_LIMIT N_NEIGH(DIM_LIMIT)
#define N_WALLS_LIMIT N_WALLS(DIM_LIMIT)
#define DIM_FAC_LIMIT DIM_FAC(DIM_LIMIT)
/* As N_LAMBDA depends on DIM_MAX, we provide some convenience
* macros for initializing arrays etc.
*/
#if DIM_MAX == 0
# define INIT_BARY_0D(a) { 1.0 }
# define INIT_BARY_1D(a, b) { 1.0 }
# define INIT_BARY_2D(a, b, c) { 1.0 }
# define INIT_BARY_3D(a, b, c, d) { 1.0 }
# define INIT_BARY_MAX(a, b, c, d) INIT_BARY_0D(a)
#elif DIM_MAX == 1
# define INIT_BARY_0D(a) { (a), 0.0 }
# define INIT_BARY_1D(a, b) { (a), (b) }
# define INIT_BARY_2D(a, b, c) { (a), (b) }
# define INIT_BARY_3D(a, b, c, d) { (a), (b) }
# define INIT_BARY_MAX(a, b, c, d) INIT_BARY_1D(a, b)
#elif DIM_MAX == 2
# define INIT_BARY_0D(a) { (a), 0.0, 0.0 }
# define INIT_BARY_1D(a, b) { (a), (b), 0.0 }
# define INIT_BARY_2D(a, b, c) { (a), (b), (c) }
# define INIT_BARY_3D(a, b, c, d) { (a), (b), (c) }
# define INIT_BARY_MAX(a, b, c, d) INIT_BARY_2D(a, b, c)
#elif DIM_MAX == 3
# define INIT_BARY_0D(a) { (a), 0.0, 0.0, 0.0 }
# define INIT_BARY_1D(a, b) { (a), (b), 0.0, 0.0 }
# define INIT_BARY_2D(a, b, c) { (a), (b), (c), 0.0 }
# define INIT_BARY_3D(a, b, c, d) { (a), (b), (c), (d) }
# define INIT_BARY_MAX(a, b, c, d) INIT_BARY_3D(a, b, c, d)
#else
# error Unsupported DIM_MAX
#endif
/* Various matrix and vector types. Please use them as apropriate.
*
* A famous fortune reading (grin):
*
* The primary purpose of the DATA statement is to give names to
* constants; instead of referring to pi as 3.141592653589793 at every
* appearance, the variable PI can be given that value with a DATA
* statement and used instead of the longer form of the constant.
* This also simplifies modifying the program, should the value of pi
* change.
*
* -- FORTRAN manual for Xerox Computers
*
*/
typedef REAL REAL_B[N_LAMBDA_MAX];
typedef REAL_B REAL_BB[N_LAMBDA_MAX];
typedef REAL REAL_D[DIM_OF_WORLD];
typedef REAL_D REAL_DD[DIM_OF_WORLD];
typedef REAL_D REAL_BD[N_LAMBDA_MAX];
typedef REAL_BD REAL_BBD[N_LAMBDA_MAX];
typedef REAL_DD REAL_DDD[DIM_OF_WORLD];
typedef REAL_DD REAL_BDD[N_LAMBDA_MAX];
typedef REAL_BDD REAL_BBDD[N_LAMBDA_MAX];
typedef REAL_B REAL_DB[DIM_OF_WORLD];
typedef REAL_BB REAL_DBB[DIM_OF_WORLD];
typedef REAL_BB REAL_BBB[N_LAMBDA_MAX];
typedef REAL_BBB REAL_BBBB[N_LAMBDA_MAX];
typedef REAL_BBB REAL_DBBB[DIM_OF_WORLD];
typedef REAL_BBBB REAL_DBBBB[DIM_OF_WORLD];
typedef REAL_DB REAL_BDB[N_LAMBDA_MAX];
typedef REAL_DBB REAL_BDBB[N_LAMBDA_MAX];
/******************************************************************************/
/* The maximum number of quadrature points and local basis functions
* for each dimension. Useful to define C99 variable size arrays.
* Note that those fields are intentionlly are NOT labeled "const", it
* is possible to generate quadrature formulas of arbitrary degree
* using "get_product_quad(). The INIT_ELEMENT() frame-work provides
* means to introduce quadratures with per-element initialization,
* etc. An application may install new quadrature rules using
* "register_quadrature()" or "add_quadrature()". Similar thing hold
* for basis functions.
*/
extern int n_quad_points_max[];
extern int n_bas_fcts_max[];
/*******************************************************************************
* access to element index via element or element_info structure
******************************************************************************/
#if ALBERTA_DEBUG
#define INDEX(el) ((el) ? (el)->index : -1)
#else
#define INDEX(el) -1
#endif
/*******************************************************************************
* access to leaf data (only for leaf elements)
******************************************************************************/
#define IS_LEAF_EL(el) (!(el)->child[0])
#define LEAF_DATA(el) ((void *)(el)->child[1])
/*******************************************************************************
* boundary types
******************************************************************************/
#define INTERIOR 0
#define DIRICHLET 1
#define NEUMANN -1
#define IS_NEUMANN(bound) ((bound) <= NEUMANN)
#define IS_DIRICHLET(bound) ((bound) >= DIRICHLET)
#define IS_INTERIOR(bound) ((bound) == 0)
/*******************************************************************************
* node types (indices in n_dof[] vectors, e.g.)
******************************************************************************/
/* Be careful: in 1D we have only VERTEX and CENTER nodes (although
* that violates the usual geometric meaning of VERTEX/EDGE/FACE:
* looking at the 2d/3d code one really would expect 1d CENTER DOFs to
* be 1d EDGE DOFs, but this is not the case).
*
* So:
*
* 1d: VERTEX and CENTER, EL_INFO->wall_bound refers to VERTEX boundary type
* 2d: VERTEX and CENTER and EDGE, EL_INFO->wall_bound refers to EDGEs
* 3d: FACE comes into play, EL_INFO->wall_bound refers to FACEs
*/
enum node_types {
VERTEX = 0,
CENTER,
EDGE,
FACE,
N_NODE_TYPES
};
/*******************************************************************************
* basic types of the grid
******************************************************************************/
typedef signed int DOF;
typedef enum node_types NODE_TYPES;
#define N_BNDRY_TYPES 256
typedef U_CHAR BNDRY_TYPE;
typedef BITS_256 BNDRY_FLAGS;
typedef struct el EL;
typedef struct macro_el MACRO_EL;
typedef struct el_info EL_INFO;
typedef struct el_geom_cache EL_GEOM_CACHE;
typedef struct rc_list_el RC_LIST_EL;
typedef struct mesh MESH;
typedef struct parametric PARAMETRIC;
typedef struct traverse_stack TRAVERSE_STACK;
typedef struct adapt_stat ADAPT_STAT;
typedef struct adapt_instat ADAPT_INSTAT;
#ifndef DOF_ADMIN_DEF
typedef struct dof_admin DOF_ADMIN;
typedef struct dof_int_vec DOF_INT_VEC;
typedef struct dof_dof_vec DOF_DOF_VEC;
typedef struct dof_uchar_vec DOF_UCHAR_VEC;
typedef struct dof_schar_vec DOF_SCHAR_VEC;
typedef struct dof_real_vec DOF_REAL_VEC;
typedef struct dof_real_d_vec DOF_REAL_D_VEC;
typedef struct dof_real_dd_vec DOF_REAL_DD_VEC;
typedef struct dof_ptr_vec DOF_PTR_VEC;
typedef struct dof_real_vec_d DOF_REAL_VEC_D;
typedef struct dof_matrix DOF_MATRIX;
typedef struct matrix_row MATRIX_ROW;
typedef struct matrix_row_real MATRIX_ROW_REAL;
typedef struct matrix_row_real_d MATRIX_ROW_REAL_D;
typedef struct matrix_row_real_dd MATRIX_ROW_REAL_DD;
#endif
typedef struct el_matrix EL_MATRIX;
typedef struct el_int_vec EL_INT_VEC;
typedef struct el_dof_vec EL_DOF_VEC;
typedef struct el_uchar_vec EL_UCHAR_VEC;
typedef struct el_schar_vec EL_SCHAR_VEC;
typedef struct el_bndry_vec EL_BNDRY_VEC;
typedef struct el_ptr_vec EL_PTR_VEC;
typedef struct el_real_vec EL_REAL_VEC;
typedef struct el_real_dd_vec EL_REAL_DD_VEC;
typedef struct el_real_d_vec EL_REAL_D_VEC;
typedef struct el_real_vec_d EL_REAL_VEC_D;
typedef struct bas_fcts BAS_FCTS;
typedef struct fe_space FE_SPACE;
typedef struct quadrature QUAD;
typedef struct quadrature QUADRATURE;
typedef struct quad_fast QUAD_FAST;
typedef struct quad_el_cache QUAD_EL_CACHE;
typedef struct wall_quadrature WALL_QUAD;
typedef struct wall_quad_fast WALL_QUAD_FAST;
typedef struct macro_data MACRO_DATA;
typedef struct node_projection NODE_PROJ;
typedef struct node_projection NODE_PROJECTION;
typedef struct aff_trafo AFF_TRAFO;
typedef struct dof_comp_hook DOF_COMP_HOOK;
typedef REAL (*LOC_FCT_AT_QP)(const EL_INFO *el_info,
const QUAD *quad, int iq,
void *ud);
typedef const REAL *(*LOC_FCT_D_AT_QP)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad, int iq,
void *ud);
typedef const REAL *(*GRD_LOC_FCT_AT_QP)(REAL_D res,
const EL_INFO *el_info,
const REAL_BD Lambda,
const QUAD *quad, int iq,
void *ud);
typedef const REAL_D *(*GRD_LOC_FCT_D_AT_QP)(REAL_DD res,
const EL_INFO *el_info,
const REAL_BD Lambda,
const QUAD *quad, int iq,
void *ud);
typedef REAL (*FCT_AT_X)(const REAL_D x);
typedef const REAL *(*GRD_FCT_AT_X)(const REAL_D x, REAL_D result);
typedef const REAL_D *(*D2_FCT_AT_X)(const REAL_D x, REAL_DD result);
typedef const REAL *(*FCT_D_AT_X)(const REAL_D x, REAL_D result);
typedef const REAL_D *(*GRD_FCT_D_AT_X)(const REAL_D x, REAL_DD result);
typedef const REAL_DD *(*D2_FCT_D_AT_X)(const REAL_D x, REAL_DDD result);
/*******************************************************************************
* Macro for calling STRUCT->init_element() routines, per element
* initializers for (at least) QUAD, BAS_FCTS, QUAD_FAST, WALL_QUAD,
* WALL_QUAD_FAST
******************************************************************************/
/* INIT_ELEMENT(el_info, object)
*
* The following convention holds:
*
* a) This macro evaluates to INIT_EL_TAG_DFLT when no
* element-initializer is present.
*
* b) An init_element() method MUST allow a NULL pointer for the
* el_info argument. If called with el_info == NULL the
* init_element() method must restore its default behaviour. The
* "default case" is what the implementation defines as default;
* for performance reasons the default case should be the one which
* applies to the majority of mesh elements.
*
* c) The return value of the init_element() method must be
* INIT_EL_TAG_DFLT for the default case.
*
* d) The return value of the init_element() method must be
* INIT_EL_TAG_NULL for the NULL case, meaning, e.g., the number of
* basis functions is 0, or the number of quadrature points is
* zero. The application can assume that in the NULL case the
* structure does not contain any real data.
*
* e) In all other cases the return value is a tag which is used to
* efficiently cache values of intermediate computations, e.g. the
* values of basis functions at quadrature points. This tag should
* be locally unique, meaning that consecutive invocations of
* init_element() should return different tags for different
* simplexes. This can be used for optimizations: if the tag
* returned by an init_element() routine does not change, then the
* calling function may assume that the underlying object has not
* changed.
*/
enum {
INIT_EL_TAG_NONE = 0, /* invalid tag */
INIT_EL_TAG_DFLT = 1, /* default case */
INIT_EL_TAG_NULL = 2 /* something is 0, e.g. no quad-points, basis
* functions are identically zero and so on.
*/
};
typedef unsigned int INIT_EL_TAG;
typedef INIT_EL_TAG (*INIT_ELEMENT_FCT)(const EL_INFO *el_info, void *thisptr);
/* Tag context. */
typedef struct init_el_tag_ctx {
INIT_EL_TAG tag;
unsigned int cnt;
} INIT_EL_TAG_CTX;
#define INIT_EL_TAG_CTX_INIT(ctx) \
{ \
(ctx)->tag = INIT_EL_TAG_DFLT; \
(ctx)->cnt = 0; \
}
/* Generate a new unique tag != NULL & DFLT */
#define INIT_EL_TAG_CTX_UNIQ(ctx) \
{ \
(ctx)->tag = INIT_EL_TAG_NULL + (++((ctx)->cnt)); \
if ((ctx)->tag == INIT_EL_TAG_NONE) { \
(ctx)->cnt = 1; \
(ctx)->tag = INIT_EL_TAG_NULL + 1; \
} \
}
#define INIT_EL_TAG_CTX_NULL(ctx) (ctx)->tag = INIT_EL_TAG_NULL
#define INIT_EL_TAG_CTX_DFLT(ctx) (ctx)->tag = INIT_EL_TAG_DFLT
#define INIT_EL_TAG_CTX_TAG(ctx) (ctx)->tag
#define INIT_ELEMENT_METHOD(obj) (obj)->init_element
#define INIT_ELEMENT_FLAGS(obj) (obj)->fill_flags
#define INIT_ELEMENT_DEFUN(obj, init_el, flags) \
{ \
INIT_ELEMENT_METHOD(obj) = init_el; \
INIT_ELEMENT_FLAGS(obj) = (flags); \
INIT_EL_TAG_CTX_INIT(&(obj)->tag_ctx); \
}
#define INIT_OBJECT(object) (void)INIT_ELEMENT(NULL, object)
#define INIT_ELEMENT_DECL \
INIT_ELEMENT_FCT init_element; \
FLAGS fill_flags; \
INIT_EL_TAG_CTX tag_ctx
#define INIT_ELEMENT_INITIALIZER(init_el, flags) \
(init_el), (flags), { INIT_EL_TAG_DFLT, 0 }
#define INIT_ELEMENT(el_info, object) \
(INIT_ELEMENT_NEEDED(object) \
? INIT_ELEMENT_METHOD(object)(el_info, (void *)object) : INIT_EL_TAG_DFLT)
#define INIT_ELEMENT_NEEDED(object) (INIT_ELEMENT_METHOD(object) != NULL)
#define INIT_ELEMENT_SETUP(el_info, object, tagvar, null_action, chg_action) \
{ \
INIT_EL_TAG AI_init_el_tag; \
\
AI_init_el_tag = INIT_ELEMENT(el_info, object); \
if (AI_init_el_tag == (INIT_EL_TAG)INIT_EL_TAG_NULL) { \
(tagvar) = INIT_EL_TAG_NULL; \
null_action; \
} else if (AI_init_el_tag != (tagvar)) { \
(tagvar) = AI_init_el_tag; \
chg_action; \
} \
}
/* Initialization of single items of DOF-chain */
#define INIT_OBJECT_SINGLE(object) (void)INIT_ELEMENT_SINGLE(NULL, object)
#define INIT_ELEMENT_SINGLE(el_info, object) \
(INIT_ELEMENT_NEEDED((object)->unchained) \
? INIT_ELEMENT_METHOD((object)->unchained)(el_info, (void *)object) \
: INIT_EL_TAG_DFLT)
/*******************************************************************************
* node projection descriptor:
*
* a function pointer which calculates the projected location of a
* new vertex resulting from refinement.
*
******************************************************************************/
struct node_projection
{
void (*func)(REAL_D old_coord, const EL_INFO *eli, const REAL_B lambda);
};
/*******************************************************************************
* The geometric connectivity of periodic meshes is described by wall-
* transformations, affine isometries which map the current mesh to its
* periodic neighbour accross the wall of an element.
* The transformation operates as usual: Mx + t
******************************************************************************/
struct aff_trafo
{
REAL_DD M;
REAL_D t;
};
/*******************************************************************************
* one single element (triangle) of the grid:
*******************************************************************************
*
* position of the nodes in 1d:
*
* 0 _____ 1 or 0 _____ 1
* 2
*
* child[0] child[1]
* refinement: 0 _____ 1 0 ___ 1 0 ___ 1
* 2 2
*
*******************************************************************************
*
* position of the nodes in 2d
* 2 2 2 2
* /\ or /\ or /\ or /\
* / \ 4/ \ 3 / \ 4/ \ 3
* / \ / \ / 3 \ / 6 \
* 0/______\1 0/______\1 0/______\1 0/______\1
* 5 5
*
* refinement: 2 child[0] 0 1 child[1]
* /\ /| |\
* 4/ \ 3 --> 5/ |4 3| \ 5
* / 6 \ /6 | |6 \
* 0/______\1 1/___| |___\0
* 5 3 2 2 4
*
*******************************************************************************
*
* 3d refinement: vertex numbering after (Baensch +) Kossaczky
*
* edges:
* E0: between V0, V1
* E1: between V0, V2
* E2: between V0, V3
* E3: between V1, V2
* E4: between V1, V3
* E5: between V2, V3
*
* Always edge 0 (between vertices 0 and 1) is bisected.
*
* V1
* -+
* ****- ||
* E0 ****-- | |
* ****-- | | E3
* ****-- | |
* ****-- | |
* V0 +. . . . . . . . . . . . . . | . . . |
* --- (E1) | + V2
* --- | /
* --- |E4 /
* --- | /
* E2 --- | / E5
* --- | /
* --- | /
* ---|/
* +
* V3
*
*******************************************************************************
* child: pointers to the two children of the element
* if (child[0]==NULL) element is a leaf of the
* tree
* dof: vector of pointers to dof vectors :-)
* new_coord: in case of curved boundary, coords of ref.edge midpoint
* index: global element index (only for test purposes)
* mark: element is a leaf:
* mark == 0 do not refine/coarsen
* mark > 0 refine (mark times)
* mark < 0 may be coarsened (mark times)
******************************************************************************/
struct el
{
EL *child[2];
DOF **dof;
S_CHAR mark;
REAL *new_coord;
#if ALBERTA_DEBUG
int index;
#endif
};
/*******************************************************************************
* child_vertex_3d[el_type][child][i] =
* parent's local vertex index of new vertex i
* 4 stands for the newly generated vertex
*******************************************************************************
* child_edge_3d[el_type][child][i] =
* parent's local edge index of new edge i
* new edge 2 is half of old edge 0,
* new edges 4,5 are really new edges, and value is different:
* child_edge_3d[][][4,5] = index of same edge in other child
*******************************************************************************
* vertex_of_edge_?d[edge][i], i = 1,2 are the two vertices of edge
******************************************************************************/
/* The numbering of the vertices of all sub-simplices is given by the
* following fields.
*
* Note that we favour a lexicographical ordering of wall (face)
* indices in favour of a cyclic ordering in 3d, while we use a cyclic
* ordering in 2d.
*
* Note that all arrays contain "excess" element; this way it is
* possible to avoid modulo calculus just to keep the array index in
* range, i.e. it is legal to index like follows:
*
* w_3d = 3;
* v_2d = 2;
* for (w = 0; w < N_WALLS_3D; w++) {
* for (v = 0; v < N_VERTICES_2D; v++) {
* DO SOMETHING WITH vertex_of_wall_3d[w_3d + w][v_2d+v]
* }
* }
*/
static const int vertex_of_edge_1d[N_EDGES_1D][2*N_VERTICES_1D-1] = {
{0, 1, 0}
};
static const int vertex_of_wall_1d[2*N_WALLS_1D-1][N_VERTICES_0D] = {
{ 1 }, { 0 }, { 1 }
};
static const int vertex_of_edge_2d[2*N_EDGES_2D-1][2*N_VERTICES_1D-1] = {
{1, 2, 1}, {2, 0, 2}, {0, 1, 0}, {1, 2, 1}, {2, 0, 2}
};
#define vertex_of_wall_2d vertex_of_edge_2d
static const int vertex_of_edge_3d[N_EDGES_3D][2*N_VERTICES_1D-1] = {
{0, 1, 0}, {0, 2, 0}, {0, 3, 0}, {1, 2, 1}, {1, 3, 1}, {2, 3, 2}
};
static const int vertex_of_wall_3d[2*N_WALLS_3D-1][2*N_VERTICES_2D-1] = {
{1, 2, 3, 1, 2}, {0, 2, 3, 0, 2}, {0, 1, 3, 0, 1}, {0, 1, 2, 0, 1},
{1, 2, 3, 1, 2}, {0, 2, 3, 0, 2}, {0, 1, 3, 0, 1},
};
/*******************************************************************************
* edge_of_vertices_3d[i][j]: gives the local index of edge with vertices i, j
******************************************************************************/
static const int edge_of_vertices_3d[N_VERTICES_3D][N_VERTICES_3D] = {
{-1, 0, 1, 2 },
{ 0, -1, 3, 4 },
{ 1, 3, -1, 5 },
{ 2, 4, 5, -1 }
};
/*******************************************************************************
* face_of_edge_3d[e][0/1]: gives the local number of the two adjacent faces
******************************************************************************/
static const int face_of_edge_3d[N_EDGES_3D][2] = {
{ 2, 3 }, { 1, 3 }, { 1, 2 }, { 0, 3 }, { 0, 2 }, { 0, 1 }
};
/* defined in element_Xd.c: permuted ordering of wall vertices to be
* able to match quadrature points of neighbouring elements on the
* separating wall.
*
* wall_orientation[_rel]_Xd() returns an index into those arrays.
*/
extern
const int sorted_wall_vertices_1d[N_WALLS_1D][DIM_FAC_1D][2*N_VERTICES_0D-1];
extern
const int sorted_wall_vertices_2d[N_WALLS_2D][DIM_FAC_2D][2*N_VERTICES_1D-1];
extern
const int sorted_wall_vertices_3d[N_WALLS_3D][DIM_FAC_3D][2*N_VERTICES_2D-1];
/*******************************************************************************
* PARAMETRIC structure, entry in MESH structure
* description of parametric meshes and elements
******************************************************************************/
/*
* The values to pass as "flags" argument to
* use_lagrange_parametric(..., flags)
*/
typedef enum param_strategy {
PARAM_ALL = 0, /* all elements are to be parametric */
PARAM_CURVED_CHILDS = 1, /* bisection along {\lambda_0 = \lambda_1} */
PARAM_STRAIGHT_CHILDS = 2 /* bisection along straight lines/planes */
} PARAM_STRATEGY;
#define PARAM_STRATEGY_MASK \
(PARAM_ALL|PARAM_CURVED_CHILDS|PARAM_STRAIGHT_CHILDS)
#define PARAM_PERIODIC_COORDS 0x04 /* The coordinates themselves are
* periodic, normally parametric
* coordinates of a periodic mesh
* are _NOT_ periodic.
*/
/* General hook-structure for parametric
* meshes. use_lagrange_parametric() populates this struture for the
* standard conforming iso-parametric geometry approximations.
*/
struct parametric
{
const char *name; /* textual description analogous to BAS_FCTS. */
/* true: some elements may be non-parametric */
bool not_all;
/* true: standard routines coord_to_world, etc. may be used to get
* data about the reference triangulation. Set to "false" by
* default.
*/
bool use_reference_mesh;
/* init_element(el_info, param) == false : non-parametric element,
* init_element(el_info, param) == true : parametric element.
*
* NOTE: If PARAMETRIC::init_element(el_info, ...) returns false,
* then it is supposed to fill el_info->coord with the current
* element's coordinate information despite the fact the "el_info"
* is _CONST_. This way the normal per-element functions can be used
* (e.g. el_det(), el_grd_lambda() etc.) instead of the parametric
* ones. This simplifies the program flow (and source code) for
* partially parametric meshes a _LOT_.
*/
bool (*init_element)(const EL_INFO *el_info, const PARAMETRIC *parametric);
void (*vertex_coords)(EL_INFO *info);
void (*coord_to_world)(const EL_INFO *info, const QUAD *quad,
int n, const REAL_B lambda[], REAL_D *world);
/* Be careful with this function, for some world coordinates there
* are no barycentric coordinates. Works best if world is not too
* far away from our simplex. */
void (*world_to_coord)(const EL_INFO *info, int N,
const REAL_D world[],
REAL_B lambda[], int k[]);
void (*det)(const EL_INFO *info, const QUAD *quad,
int n, const REAL_B lambda[], REAL dets[]);
void (*grd_lambda)(const EL_INFO *info, const QUAD *quad,
int n, const REAL_B lambda[],
REAL_BD Lambda[], REAL_BDD DLambda[], REAL dets[]);
void (*grd_world)(const EL_INFO *info, const QUAD *quad,
int n, const REAL_B lambda[],
REAL_BD grd_Xtr[], REAL_BDB D2_Xtr[], REAL_BDBB D3_Xtr[]);
void (*wall_normal)(const EL_INFO *el_info, int wall,
const QUAD *wall_quad,
int n, const REAL_B lambda[],
REAL_D nu[], REAL_DB grd_nu[], REAL_DBB D2_nu[],
REAL dets[]);
/* inherit_parametric is used by get_submesh(), unchain_parametric()
* is used by unchain_submesh(). Can be left out if the sub-mesh
* feature is not used.
*/
void (*inherit_parametric)(MESH *slave);
void (*unchain_parametric)(MESH *slave);
void *data; /* private data for specific implementations */
};
/*******************************************************************************
* EL_GEOM_CACHE structure; geometric information for non-parametric
* meshes which is not generated during mesh-traversal, but needed in
* several places. Data like det, Lambda, wall-normals, wall-det.
* Access to this cache _MUST_ go through fill_el_geom_cache(). See
* also fill_quad_el_cache(el_info), especially for parametric meshes.
******************************************************************************/
struct el_geom_cache
{
EL *current_el;
FLAGS fill_flag;
REAL det;
REAL_BD Lambda;
int orientation[N_WALLS_MAX][2];
int rel_orientation[N_WALLS_MAX];
REAL wall_det[N_WALLS_MAX];
REAL_D wall_normal[N_WALLS_MAX];
};
#define FILL_EL_DET (1 << 0)
#define FILL_EL_LAMBDA (1 << 1)
#define FILL_EL_WALL_SHIFT(wall) (2 + 4*(wall))
#define FILL_EL_WALL_MASK(wall) (0x7 << FILL_EL_WALL_SHIFT(wall))
#define FILL_EL_WALL_DET(wall) (1 << (FILL_EL_WALL_SHIFT(wall)+0))
#define FILL_EL_WALL_NORMAL(wall) (1 << (FILL_EL_WALL_SHIFT(wall)+1))
#define FILL_EL_WALL_ORIENTATION(wall) (1 << (FILL_EL_WALL_SHIFT(wall)+2))
#define FILL_EL_WALL_REL_ORIENTATION(wall) (1 << (FILL_EL_WALL_SHIFT(wall)+3))
#define FILL_EL_WALL_DETS \
(FILL_EL_WALL_DET(0)|FILL_EL_WALL_DET(1)| \
FILL_EL_WALL_DET(2)|FILL_EL_WALL_DET(3))
#define FILL_EL_WALL_NORMALS \
(FILL_EL_WALL_NORMAL(0)|FILL_EL_WALL_NORMAL(1)| \
FILL_EL_WALL_NORMAL(2)|FILL_EL_WALL_NORMAL(3))
#define FILL_EL_WALL_ORIENTATIONS \
(FILL_EL_WALL_ORIENTATION(0)|FILL_EL_WALL_ORIENTATION(1)| \
FILL_EL_WALL_ORIENTATION(2)|FILL_EL_WALL_ORIENTATION(3))
#define FILL_EL_WALL_REL_ORIENTATIONS \
(FILL_EL_WALL_REL_ORIENTATION(0)|FILL_EL_WALL_REL_ORIENTATION(1)| \
FILL_EL_WALL_REL_ORIENTATION(2)|FILL_EL_WALL_REL_ORIENTATION(3))
static inline const EL_GEOM_CACHE *
fill_el_geom_cache(const EL_INFO *el_info, FLAGS fill_flag);
/*******************************************************************************
* additional information to elements during hierarchy traversal
*******************************************************************************
*
* mesh: pointer to the mesh structure
* coord: world coordinates of the vertices. For curved
* parametric meshes the corresponding information is
* filled by the function hooks in the PARAMETRIC
* structur.
* macro_el: pointer to the macro-element we belong to.
* el: node in the mesh-tree.
* parent: pointer to an EL_INFO structure describing the parent of this
* element in the mesh tree.
* fill_flag: copy of the fill-flags used to generate the EL_INFO
* structure.
* level: the depth in the mesh-tree, level 0 means root-level (i.e.
* an element of the macro triangulation).
*
* macro_wall: Mapping of the boundary facets of the element to
* the boundary facets of the containing macro
* element. macro_wall[w] == -1 means that the
* boundary facet number "w" is located in the
* interior of the containing macro-element, i.e.
* EL_INFO::macro_el.
*
* wall_bound: Boundary type of the co-dim 1 facets (all
* dimensions). Boundary types range from 0 (interior
* faces) to 255. Boundary types are just markers
* without interpretation, used to group boundary
* facets which share common properties. Needs
* FILL_BOUND. Boundary types can also be access via
* the EL_INFO::macro_wall[] component which is filled
* all the time. There is also a support function
* wall_bound() for this purpose.
* vertex_bound: Boundary type of the vertices. This is a bit-field:
* bit N is set if any of the co-dim 1 facets the
* vertex belongs to has boundary-type N. Needs FILL_BOUND.
* edge_bound: Boundary type of the edges (only 3d). Also a bit field,
* obtained in the same manner as vertex_bound. Needs
* FILL_BOUND.
*
* active_projection: node projection function for the new vertex
* which would result from a refinement of the current
* element. Needs FILL_PROJECTION.
*
* neigh: pointer to the adjacent elements NULL-pointer for a
* part of the boundary. Needs FILL_NEIGH.
* opp_coord: world coordinates of opposite vertices. Needs
* FILL_NEIGH|FILL_COORD.
* opp_vertex: local indices of opposite vertices. Needs FILL_NEIGH.
*
* el_type: type of the element, 0, 1, or 2. Only meaningful in 3d.
* orientation: orientation of the tetrahedron relative to the macro
* element. This is only set for 3d, otherwise it is fixed
* at 0. For DIM == 3 this gives the orientation
* w.r.t. to the standard co-ordinate frame, for higher
* dimenstion "absolute" orientation makes no sense; so
* "orientation" will be 1 for all macro elements, regard-
* less of their actual relative orientations.
*
* el_geom_cache: A cache to store derived quantities which are not
* computed during mesh-traversal, but are derived
* from the co-ordinate information. Access to the
* cache _must_ go through fill_el_geom_cache(). This
* stuff needs -- of course -- the FILL_COORDS
* fill-flag.
*
******************************************************************************/
struct el_info
{
MESH *mesh;
REAL_D coord[N_VERTICES_MAX];
const MACRO_EL *macro_el;
EL *el;
const EL_INFO *parent;
FLAGS fill_flag;
int level;
S_CHAR macro_wall[N_WALLS_MAX];
BNDRY_TYPE wall_bound[N_WALLS_MAX];
BNDRY_FLAGS vertex_bound[N_VERTICES_MAX];
BNDRY_FLAGS edge_bound[N_EDGES_MAX];
#if DIM_MAX > 1
BNDRY_TYPE face_bound[MAX(1, N_FACES_MAX)];
#endif
const NODE_PROJ *active_projection;
EL *neigh[N_NEIGH_MAX];
S_CHAR opp_vertex[N_NEIGH_MAX];
REAL_D opp_coord[N_NEIGH_MAX];
U_CHAR el_type;
S_CHAR orientation;
struct master_info {
EL *el;
int opp_vertex;
REAL_D opp_coord;
U_CHAR el_type;
S_CHAR orientation;
} master, mst_neigh;
EL_GEOM_CACHE el_geom_cache;
};
/* Some "standard" bit-field operations, meant to hide the
* N_BNDRY_TYPES argument.
*/
#define BNDRY_FLAGS_INIT(flags) bitfield_zap((flags), N_BNDRY_TYPES)
#define BNDRY_FLAGS_ALL(flags) bitfield_fill((flags), N_BNDRY_TYPES)
#define BNDRY_FLAGS_CPY(to, from) bitfield_cpy((to), (from), N_BNDRY_TYPES)
#define BNDRY_FLAGS_AND(to, from) bitfield_and((to), (from), N_BNDRY_TYPES)
#define BNDRY_FLAGS_OR(to, from) bitfield_or((to), (from), N_BNDRY_TYPES)
#define BNDRY_FLAGS_XOR(to, from) bitfield_xor((to), (from), N_BNDRY_TYPES)
#define BNDRY_FLAGS_CMP(a, b) bitfield_cmp((a), (b), N_BNDRY_TYPES)
/* bit 0 flags boundary segments, if not set we are in the interior */
#define BNDRY_FLAGS_IS_INTERIOR(mask) (!bitfield_tst((mask), 0))
/* Set bit 0 to mark this as a boundary bit-mask. */
#define BNDRY_FLAGS_MARK_BNDRY(flags) bitfield_set((flags), INTERIOR)
/* Return TRUE if SEGMENT has BIT set _and_ BIT != 0. */
#define BNDRY_FLAGS_IS_AT_BNDRY(segment, bit) \
((bit) && bitfield_tst((segment), (bit)))
/* Set a bit in the boundary-type mask. The precise meaning of BIT:
*
* BIT == 0: clear the boundary mask (meaning: interior node)
* BIT > 0: set bit BIT and also bit 0 (meaning: boundary node)
*/
#define BNDRY_FLAGS_SET(flags, bit) \
if ((bit) != INTERIOR) { \
bitfield_set((flags), INTERIOR); \
bitfield_set((flags), (bit)); \
} else { \
BNDRY_FLAGS_INIT(flags); \
}
/* return TRUE if SEGMENT and MASK have non-zero overlap */
#define BNDRY_FLAGS_IS_PARTOF(segment, mask) \
bitfield_andp((segment), (mask), 1 /* offset */, N_BNDRY_TYPES)
/* FindFirstBoundaryBit, return INTERIOR for interior nodes, otherwise the
* number of the first bit set in MASK.
*/
#define BNDRY_FLAGS_FFBB(mask) bitfield_ffs(mask, 1 /* offset */, N_BNDRY_TYPES)
/*******************************************************************************
* RC_LIST_EL structure to describe a refinement/coarsening patch.
* el_info: contains information about the patch element. This is not
* a pointer since EL_INFO structures are often overwritten
* during mesh traversal.
* no: index of the patch element in the patch.
* flags: see the RCLE_... defines below for a description.
* neigh: neighbours to the right/left in the orientation of the
* edge, or NULL pointer for a boundary face. (dim == 3 only)
* opp_vertex: the opposite vertex of neigh[0/1]. (dim == 3 only)
******************************************************************************/
struct rc_list_el
{
EL_INFO el_info;
int no;
FLAGS flags;
RC_LIST_EL *neigh[2];
int opp_vertex[2];
};
/* Valid settings for RC_LIST_EL->flags. The "PERIODIC" flags can be
* exploited in refine_interpol/coarse_restrict routines.
*/
#define RCLE_NONE 0x0 /* just nothing special */
#define RCLE_COARSE_EDGE_COMPAT (1 << 0) /* set if the coarsening edge
* of the patch element is
* the coarsening edge of the
* patch. Only for internal
* use.
*/
/*******************************************************************************
* flags, which information should be present in the EL_INFO structure
******************************************************************************/
#define FILL_NOTHING 0x0000L
#define FILL_COORDS 0x0001L
#define FILL_BOUND 0x0002L
#define FILL_NEIGH 0x0004L
#define FILL_OPP_COORDS 0x0008L
#define FILL_ORIENTATION 0x0010L
#define FILL_PROJECTION 0x0020L
#define FILL_MACRO_WALLS 0x0040L
#define FILL_WALL_MAP FILL_MACRO_WALLS
#define FILL_NON_PERIODIC 0x0080L
#define FILL_MASTER_INFO 0x0100L
#define FILL_MASTER_NEIGH 0x0200L
#define FILL_ANY \
(FILL_COORDS|FILL_BOUND|FILL_NEIGH|FILL_OPP_COORDS| \
FILL_ORIENTATION|FILL_PROJECTION|FILL_MACRO_WALLS| \
FILL_NON_PERIODIC|FILL_MASTER_INFO|FILL_MASTER_NEIGH)
/*******************************************************************************
* flags for mesh traversal
******************************************************************************/
#define CALL_EVERY_EL_PREORDER 0x010000L
#define CALL_EVERY_EL_INORDER 0x020000L
#define CALL_EVERY_EL_POSTORDER 0x040000L
#define CALL_LEAF_EL 0x080000L
#define CALL_LEAF_EL_LEVEL 0x100000L
#define CALL_EL_LEVEL 0x200000L
#define CALL_MG_LEVEL 0x400000L /* used in multigrid methods */
#define TEST_FLAG(flags, el_info) \
TEST_EXIT(!((((el_info)->fill_flag)^(flags)) & (flags)), \
"flag "#flags" not set\n")
#if ALBERTA_DEBUG==1
# define DEBUG_TEST_FLAG(flags, el_info) \
if((((el_info)->fill_flag)^(flags)) & (flags)) \
print_error_funcname(funcName, __FILE__, __LINE__), \
print_error_msg_exit("flag "#flags" not set\n")
#else
# define DEBUG_TEST_FLAG(flags, el_info) do { funcName = funcName; } while (0)
#endif
/*******************************************************************************
* one single element of the macro triangulation:
*******************************************************************************
* el: pointer to the element data of the macro element
* coord: world coordinates of the nodes on the macro element
* wall_bound: Boundary type of the co-dim 1 facets (all
* dimensions). Boundary types range from 0 (interior
* faces) to 127. Boundary types are just a markers
* without interpretation, used to group boundary
* facets which share common properties.
* vertex_bound: Boundary type of the vertices. This is a bit-field:
* bit N is set if any of the co-dim 1 facets the
* vertex belongs to has boundary-type N.
* edge_bound: Boundary type of the edges (only 3d). Also a bit field,
* obtained in the same manner as vertex_bound.
* projection: possible node projection functions for all nodes [0]
* or for specific edges or faces (dim > 1), which will
* override entry [0].
* index: unique global index of macro element
* neigh: pointer to the adjacent macro elements
* NULL-pointer for a part of the boundary
* opp_vertex: local index of opposite vertex w.r.t. neighbour numbering
* neigh_vertices: local indices of common vertices of the periodic
* neighbour, this component is set only for the virtual
* neighbours on periodic meshes.
* neigh_vertices[wall][loc_idx] is the local vertex number
* on the neighbour the vertex with local number
* (wall + 1 + loc_idx) % N_VERTICES(MESH_DIM) on this
* element is mapped to.
* wall_trafo: only for periodic meshes: the affine transformation which
* maps the mesh across the corresponding wall to the
* neighbour facet. The wall transformation must be
* affine isometries.
* np_vertex_bound: boundary type of the vertices when treating a periodic
* mesh as non-periodic
* np_edge_bound: like np_vertex_bound
* el_type: type of corresponding element.
* orientation: orientation of corresponding element, used in 3d.
*
******************************************************************************/
struct macro_el
{
EL *el;
REAL_D *coord[N_VERTICES_MAX];
BNDRY_TYPE wall_bound[N_WALLS_MAX];
BNDRY_FLAGS vertex_bound[N_VERTICES_MAX];
#if DIM_MAX > 1
BNDRY_FLAGS edge_bound[N_EDGES_MAX];
#endif
#if DIM_MAX > 2
BNDRY_TYPE face_bound[N_FACES_MAX];
#endif
NODE_PROJ *projection[N_NEIGH_MAX + 1];
int index;
MACRO_EL *neigh[N_NEIGH_MAX];
S_CHAR opp_vertex[N_NEIGH_MAX];
S_CHAR neigh_vertices[N_NEIGH_MAX][N_VERTICES(DIM_MAX-1)];
AFF_TRAFO *wall_trafo[N_NEIGH_MAX];
BNDRY_FLAGS np_vertex_bound[N_VERTICES_MAX];
#if DIM_MAX > 1
BNDRY_FLAGS np_edge_bound[N_EDGES_MAX];
#endif
S_CHAR orientation;
U_CHAR el_type;
/* The chain to the master macro element if we belong to a trace-mesh */
struct {
MACRO_EL *macro_el;
S_CHAR opp_vertex;
BNDRY_FLAGS vertex_bound[MAX(1, N_VERTICES(DIM_MAX-1))];
BNDRY_FLAGS np_vertex_bound[MAX(1, N_VERTICES(DIM_MAX-1))];
#if DIM_MAX > 1
BNDRY_FLAGS edge_bound[N_EDGES(MAX(1, DIM_MAX-1))];
BNDRY_FLAGS np_edge_bound[N_EDGES(MAX(1, DIM_MAX-1))];
#endif
} master;
};
/* Some support functions to access boundary-facet related data only
* stored on the macro-element level.
*/
static inline BNDRY_TYPE wall_bound(const EL_INFO *el_info, int wall)
{
int mwall = el_info->macro_wall[wall];
if (mwall < 0) {
return INTERIOR;
}
if ((el_info->fill_flag & FILL_NON_PERIODIC)) {
return el_info->macro_el->wall_bound[mwall];
}
if (el_info->macro_el->neigh_vertices[mwall][0] < 0) {
return el_info->macro_el->wall_bound[mwall];
} else {
return INTERIOR;
}
}
static inline const AFF_TRAFO *wall_trafo(const EL_INFO *el_info, int wall)
{
int mwall;
if ((el_info->fill_flag & FILL_NON_PERIODIC)) {
return NULL;
}
mwall = el_info->macro_wall[wall];
return mwall < 0 ? NULL : el_info->macro_el->wall_trafo[mwall];
}
static inline const NODE_PROJ *wall_proj(const EL_INFO *el_info, int wall)
{
if (wall < 0) {
return el_info->macro_el->projection[0];
} else {
int mwall = el_info->macro_wall[wall];
return el_info->macro_el->projection[mwall+1];
}
}
/*******************************************************************************
* index based storage of macro triangulations
******************************************************************************/
struct macro_data
{
int dim; /* dimension of the elements */
int n_total_vertices;
int n_macro_elements;
REAL_D *coords; /* Length will be n_total_vertices */
int *mel_vertices; /* mel_vertices[i*N_VERTICES(dim)+j]:
* global index of jth vertex of element i
*/
int *neigh; /* neigh[i*N_NEIGH(dim)+j]:
* neighbour j of element i or -1 at boundaries
*/
int *opp_vertex; /* opp_vertex[i*N_NEIGH(dim)+j]: if set (need not
* be) the local vertex number w.r.t. the neighbour
* of the vertex opposit the separating wall.
*/
BNDRY_TYPE *boundary; /* boundary[i*N_NEIGH(dim)+j]:
* boundary type of jth co-dim 1 facet of element i
*
* WARNING: In 1D the local index corresponds
* to vertex 1 & vice versa! (Consistent with
* macro_data.neigh)
*/
U_CHAR *el_type; /* el_type[i]: type of element i only used in 3d! */
int (*wall_vtx_trafos)[N_VERTICES(DIM_MAX-1)][2]; /* the wall trafos */
/* Wall transformations are in terms of mappings between
* vertices. i-th wall trafo: global vertex number
* wall_vtx_trafos[i][v][0] maps to wall_vtx_trafos[i][v][1], v loops
* through the local vertex number of the respective wall.
*/
int n_wall_vtx_trafos;/* for periodic meshes: number of
* combinatorical wall trafos.
*/
int *el_wall_vtx_trafos;
/* el_wall_vtx_trafos[i*N_WALLS(dim)+j] number of the wall
* transformation of the j-th wall for the i-th element. > 0:
* #wall_trafo+1. < 0: inverse of -(#wall_trafo+1)
*/
AFF_TRAFO *wall_trafos; /* The group generators of the space group
* defining the periodic structure of the
* mesh.
*/
int n_wall_trafos;
int *el_wall_trafos; /* N = el_wall_trafos[i*N_NEIGH(dim)+j]:
*
* number of the wall transformation mapping to
* the neighbouring fundamental domain across
* the given wall.
*
* If negative: inverse of generator -N-1
* If positive: generator +N-1
*/
#if ALBERTA_DEBUG
char **mel_comment; /* for debugging */
#endif
};
#ifndef DOF_ADMIN_DEF
# define DOF_ADMIN_DEF
/*******************************************************************************
* dof handling
******************************************************************************/
/* presumably the largest native integer type */
# define DOF_FREE_UNIT_TYPE long
typedef unsigned DOF_FREE_UNIT_TYPE DOF_FREE_UNIT;
# define DOF_FREE_SIZE ((int)(8*sizeof(DOF_FREE_UNIT)))
# define DOF_UNIT_ALL_FREE (~0UL)
extern const DOF_FREE_UNIT dof_free_bit[DOF_FREE_SIZE]; /* in dof_admin.c */
# define DOF_UNUSED (-1) /* el->dof[][] == DOF_UNUSED, mark unused DOFs */
# define FOR_ALL_DOFS(admin, todo) \
if ((admin)->hole_count == 0) { \
int dof; \
\
for (dof = 0; dof < (admin)->used_count; dof++) { \
todo; \
} \
} else { \
DOF_FREE_UNIT _dfu, *_dof_free = (admin)->dof_free; \
int _i, _ibit, dof=0; \
int _n= ((admin)->size_used + DOF_FREE_SIZE-1) / DOF_FREE_SIZE; \
\
for (_i = 0; _i < _n; _i++) { \
if ((_dfu = _dof_free[_i])) { \
if (_dfu == DOF_UNIT_ALL_FREE) { \
dof += DOF_FREE_SIZE; \
} else { \
for (_ibit = 0; \
_ibit < DOF_FREE_SIZE; \
_ibit++, dof++, _dfu >>= 1) { \
if ((_dfu & 1) == 0) { \
todo; \
} \
} \
} \
} else { \
for (_ibit = 0; _ibit < DOF_FREE_SIZE; _ibit++, dof++) { \
todo; \
} \
} \
} \
}
# define FOR_ALL_FREE_DOFS(admin, todo) \
if ((admin)->hole_count == 0) { \
int dof; \
for (dof = (admin)->used_count; dof < (admin)->size; dof++) { \
todo; \
} \
} else { \
DOF_FREE_UNIT _dfu, *_dof_free = (admin)->dof_free; \
int _i, _ibit, dof=0; \
int _n= ((admin)->size + DOF_FREE_SIZE-1) / DOF_FREE_SIZE; \
\
for (_i = 0; _i < _n; _i++) { \
if ((_dfu = _dof_free[_i])) { \
if (_dfu == DOF_UNIT_ALL_FREE) { \
for (_ibit = 0 ; _ibit < DOF_FREE_SIZE; _ibit++, dof++) { \
todo; \
} \
} else { \
for (_ibit = 0; \
_ibit < DOF_FREE_SIZE; \
_ibit++, dof++, _dfu >>= 1) { \
if ((_dfu & 1) != 0) { \
todo; \
} \
} \
} \
} else { \
dof += DOF_FREE_SIZE; \
} \
} \
}
/* Stop if dof >= size_used */
# define FOR_ALL_USED_FREE_DOFS(admin, todo) \
FOR_ALL_FREE_DOFS(admin, \
if (dof >= admin->size_used) { \
break; \
} \
todo)
/* Possible values for DOF_ADMIN->flags */
# define ADM_FLAGS_DFLT 0 /* nothing special */
# define ADM_PRESERVE_COARSE_DOFS (1 << 0) /* preserve non-leaf DOFs */
# define ADM_PERIODIC (1 << 1) /* periodic ADMIN on a
* periodic mesh
*/
#define ADM_FLAGS_MASK (ADM_PRESERVE_COARSE_DOFS | ADM_PERIODIC)
struct dof_admin
{
MESH *mesh;
const char *name;
DOF_FREE_UNIT *dof_free; /* flag bit vector */
unsigned int dof_free_size;/* flag bit vector size */
unsigned int first_hole; /* index of first non-zero dof_free entry */
FLAGS flags;
DOF size; /* allocated size of dof_list vector */
DOF used_count; /* number of used dof indices */
DOF hole_count; /* number of FREED dof indices (NOT size-used)*/
DOF size_used; /* > max. index of a used entry */
int n_dof[N_NODE_TYPES]; /* dofs from THIS dof_admin */
int n0_dof[N_NODE_TYPES]; /* start of THIS admin's DOFs in the mesh. */
/****************************************************************************/
DOF_INT_VEC *dof_int_vec; /* linked list of int vectors */
DOF_DOF_VEC *dof_dof_vec; /* linked list of dof vectors */
DOF_DOF_VEC *int_dof_vec; /* linked list of dof vectors */
DOF_UCHAR_VEC *dof_uchar_vec; /* linked list of u_char vectors */
DOF_SCHAR_VEC *dof_schar_vec; /* linked list of s_char vectors */
DOF_REAL_VEC *dof_real_vec; /* linked list of real vectors */
DOF_REAL_D_VEC *dof_real_d_vec; /* linked list of real_d vectors */
DOF_REAL_DD_VEC *dof_real_dd_vec; /* linked list of real_d vectors */
DOF_PTR_VEC *dof_ptr_vec; /* linked list of void * vectors */
DOF_MATRIX *dof_matrix; /* linked list of matrices */
DBL_LIST_NODE compress_hooks; /* linked list of custom compress
* handlers.
*/
/*******************************************************************************
* pointer for administration; don't touch!
******************************************************************************/
void *mem_info;
};
/* DOF_COMP_HOOK is a linked list rooted in
* DOF_ADMIN->compress_hooks. The user may install arbitrary many
* custom compress-handlers via add_dof_compress_hook(),
* del_dof_compress_hook().
*/
struct dof_comp_hook
{
DBL_LIST_NODE node; /* our link to the compress_hooks list */
void (*handler)(DOF first, DOF last, const DOF *new_dof, void *app_data);
void *application_data;
};
/*******************************************************************************
* dof vector structures
*******************************************************************************
* next: pointer to next structure containing vector of same type
* fe_space: pointer to fe_space structure
* refine_interpol: dof interpolation during refinement
* coarse_restrict: restriction of linear functionals evaluated on a finer
* grid and stored in dof vector to the coarser grid
* during coarsening
* or dof interpolation during coarsening
* size: allocated size of vector
* vec[]: vector entries (entry is used if dof index is used)
******************************************************************************/
#define UCHAR_name uchar
#define uchar_VECNAME SCHAR
#define SCHAR_name schar
#define schar_VECNAME SCHAR
#define INT_name int
#define int_VECNAME INT
#define DOF_name dof
#define dof_VECNAME INT
#define PTR_name ptr
#define ptr_VECNAME PTR
#define REAL_name real
#define real_VECNAME REAL
#define REAL_D_name real_d
#define real_d_VECNAME REAL_D
#define REAL_DD_name real_dd
#define real_dd_VECNAME REAL_DD
#define BNDRY_name bndry
#define bndry_VECNAME BNDRY
# define DECL_DOF_VEC(VECNAME, vectype) \
struct CPP_CONCAT3(dof_, VECNAME##_name, _vec) \
{ \
DOF_##VECNAME##_VEC *next; \
const FE_SPACE *fe_space; \
\
const char *name; \
\
DOF size; \
int reserved; \
\
vectype *vec; \
\
void (*refine_interpol)(DOF_##VECNAME##_VEC *, RC_LIST_EL *, int n); \
void (*coarse_restrict)(DOF_##VECNAME##_VEC *, RC_LIST_EL *, int n); \
void *user_data; \
\
DBL_LIST_NODE chain; \
const DOF_##VECNAME##_VEC *unchained; \
\
EL_##VECNAME##_VEC *vec_loc; \
\
void *mem_info; /*pointer for administration; don't touch! */ \
}; \
typedef vectype VECNAME##_VEC_TYPE
DECL_DOF_VEC(INT, int);
DECL_DOF_VEC(DOF, DOF);
DECL_DOF_VEC(UCHAR, U_CHAR);
DECL_DOF_VEC(SCHAR, S_CHAR);
DECL_DOF_VEC(PTR, void *);
DECL_DOF_VEC(REAL, REAL);
DECL_DOF_VEC(REAL_D, REAL_D);
DECL_DOF_VEC(REAL_DD, REAL_DD);
/* A finite element function/coefficient vector for DIM_OF_WORLD
* problems. If the basis-functions are vector-valued themselves, then
* the vector is actually REAL-valued (stride == 1), otherwise REAL_D
* valued (stride == DIM_OF_WORLD).
*
* So: if stride == 1, then this is actually a DOF_REAL_VEC, if stride ==
* DIM_OF_WORLD, then this is actually a DOF_REAL_D_VEC.
*/
struct dof_real_vec_d
{
DOF_REAL_VEC_D *next;
const FE_SPACE *fe_space;
const char *name;
DOF size;
int stride; /* either 1 or DIM_OF_WORLD */
REAL *vec;
void (*refine_interpol)(DOF_REAL_VEC_D *, RC_LIST_EL *, int n);
void (*coarse_restrict)(DOF_REAL_VEC_D *, RC_LIST_EL *, int n);
void *user_data;
DBL_LIST_NODE chain;
const DOF_REAL_VEC_D *unchained;
EL_REAL_VEC_D *vec_loc;
void *mem_info; /*pointer for administration; don't touch! */
};
typedef REAL REAL_VEC_D_TYPE; /* needed?? */
/*******************************************************************************
* sparse matrix with one row for each dof,
* entries are either REAL or REAL_DD
*******************************************************************************
* next: pointer to next matrix (linked list in MESH)
* matrix_row[]: pointers to row structures (or NULL if row index is unused)
* size: currently allocated size of matrix_row[]
******************************************************************************/
/* "flag" values for "type" component */
typedef enum matent_type {
MATENT_NONE = -1,
MATENT_REAL = 0,
MATENT_REAL_D = 1,
MATENT_REAL_DD = 2
} MATENT_TYPE;
static const size_t matent_size[4] = {
0, sizeof(REAL), sizeof(REAL_D), sizeof(REAL_DD)
};
# define MATENT_SIZE(type) matent_size[(type)+1]
struct dof_matrix
{
DOF_MATRIX *next;
const FE_SPACE *row_fe_space;
const FE_SPACE *col_fe_space;
const char *name;
MATRIX_ROW **matrix_row; /* lists of matrix entries */
DOF size; /* size of vector matrix_row */
MATENT_TYPE type; /* type of matrix entries. */
size_t n_entries; /* total number of entries in the
* matrix, updated by
* add_element_matrix(), set to 0 by
* clear_dof_matrix().
*/
bool is_diagonal;
union {
DOF_REAL_VEC *real;
DOF_REAL_D_VEC *real_d;
DOF_REAL_DD_VEC *real_dd;
} diagonal; /* The diagonal entries, if is_diagonal == true */
DOF_INT_VEC *diag_cols; /* The column indices of the diagonal entries */
union {
DOF_REAL_VEC *real;
DOF_REAL_D_VEC *real_d;
DOF_REAL_DD_VEC *real_dd;
} inv_diag; /* a cache for the diagonal entries, may be NULL. */
BNDRY_FLAGS dirichlet_bndry; /* bndry-type bit-mask for
* Dirichlet-boundary conditions built
* into the matrix
*/
void (*refine_interpol)(DOF_MATRIX *, RC_LIST_EL *, int n);
void (*coarse_restrict)(DOF_MATRIX *, RC_LIST_EL *, int n);
/* The list pointers for the block-matrix structure to support
* direct sums of fe-spaces.
*/
DBL_LIST_NODE row_chain;
DBL_LIST_NODE col_chain;
const DOF_MATRIX *unchained;
void *mem_info;
};
/*******************************************************************************
* row structure for sparse matrix, with either REAL or REAL_DD entries.
*******************************************************************************
* next: pointer to next structure containing entries of same row
* col[]: column indices of entries (if >= 0; else unused)
* entry[]: matrix entries
******************************************************************************/
# define ROW_LENGTH 9
/* The actual size of this structure is determined by the type of the
* matrix entries. The correct length is allocated in
* get_matrix_row().
*/
# define SIZEOF_MATRIX_ROW(type) \
(sizeof(MATRIX_ROW) - sizeof(REAL_DD) + ROW_LENGTH*sizeof(type))
struct matrix_row
{
MATRIX_ROW *next;
MATENT_TYPE type;
DOF col[ROW_LENGTH]; /* column indices */
union {
REAL real[1];
REAL_D real_d[1];
REAL_DD real_dd[1];
} entry;
};
struct matrix_row_real
{
MATRIX_ROW_REAL *next;
MATENT_TYPE type;
DOF col[ROW_LENGTH]; /* column indices */
REAL entry[ROW_LENGTH]; /* matrix entries */
};
struct matrix_row_real_d
{
MATRIX_ROW_REAL_D *next;
MATENT_TYPE type;
DOF col[ROW_LENGTH]; /* column indices */
REAL_D entry[ROW_LENGTH]; /* matrix entries */
};
struct matrix_row_real_dd
{
MATRIX_ROW_REAL_DD *next;
MATENT_TYPE type;
DOF col[ROW_LENGTH]; /* column indices */
REAL_DD entry[ROW_LENGTH]; /* matrix entries */
};
# define ENTRY_USED(col) ((col) >= 0)
# define ENTRY_NOT_USED(col) ((col) < 0)
# define UNUSED_ENTRY -1
# define NO_MORE_ENTRIES -2
# ifndef __CBLAS_H__
typedef enum { NoTranspose,
Transpose,
ConjugateTranspose } MatrixTranspose;
# endif
/* In C++ we would call this construct an iterator ... */
# define FOR_ALL_MAT_COLS(type, matrow, what) \
{ \
MATRIX_ROW_##type *row; \
int col_idx; \
DOF col_dof; \
\
for (row = (MATRIX_ROW_##type *)(matrow); row; row = row->next) { \
for (col_idx = 0; col_idx < ROW_LENGTH; col_idx++) { \
col_dof = row->col[col_idx]; \
if (ENTRY_USED(col_dof)) { \
what; \
} else if (col_dof == NO_MORE_ENTRIES) { \
break; \
} \
} \
if (col_dof == NO_MORE_ENTRIES) { \
break; \
} \
} \
}
#endif /* DOF_ADMIN_DEF */
typedef struct el_vec_head
{
int n_components;
int n_components_max;
DBL_LIST_NODE chain;
int reserved;
} EL_VEC_HEAD;
#define DECL_DOF_EL_VEC(VECNAME, vectype) \
struct CPP_CONCAT3(el_,VECNAME##_name, _vec) \
{ \
int n_components; \
int n_components_max; \
DBL_LIST_NODE chain; \
int reserved; \
vectype vec[1]; \
}; \
typedef vectype EL_##VECNAME##_VEC_TYPE
DECL_DOF_EL_VEC(INT, int);
DECL_DOF_EL_VEC(DOF, DOF);
DECL_DOF_EL_VEC(UCHAR, U_CHAR);
DECL_DOF_EL_VEC(SCHAR, S_CHAR);
DECL_DOF_EL_VEC(BNDRY, BNDRY_FLAGS);
DECL_DOF_EL_VEC(PTR, void *);
DECL_DOF_EL_VEC(REAL, REAL);
DECL_DOF_EL_VEC(REAL_D, REAL_D);
DECL_DOF_EL_VEC(REAL_DD, REAL_DD);
struct el_real_vec_d
{
int n_components;
int n_components_max;
DBL_LIST_NODE chain;
int stride; /* either 1 or DIM_OF_WORLD */
REAL vec[1];
};
typedef REAL EL_REAL_VEC_D_TYPE;
#undef DECL_DOF_EL_VEC
/*******************************************************************************
* Here comes the MESH (giving access to the whole triangulation)
******************************************************************************/
struct mesh
{
const char *name;
int dim;
int n_vertices;
int n_elements;
int n_hier_elements;
int n_edges; /* Only used for dim > 1 */
int n_faces; /* Only used for dim == 3 */
int max_edge_neigh; /* Only used for dim == 3 */
bool is_periodic; /* true if it is possible to define periodic*/
int per_n_vertices; /* DOF_ADMINS on this mesh. The per_n_... */
int per_n_edges; /* entries count the number of quantities on*/
int per_n_faces; /* the periodic mesh (i.e. n_faces counts */
/* periodic faces twice, n_per_faces not). */
AFF_TRAFO *const*wall_trafos;
int n_wall_trafos;
int n_macro_el;
MACRO_EL *macro_els;
REAL_D bbox[2]; /* bounding box for the mesh */
REAL_D diam; /* bbox[1] - bbox[0] */
PARAMETRIC *parametric;
DOF_ADMIN **dof_admin;
int n_dof_admin;
int n_dof_el; /* sum of all dofs from all admins */
int n_dof[N_NODE_TYPES]; /* sum of vertex/edge/... dofs from
* all admins
*/
int n_node_el; /* number of used nodes on each element */
int node[N_NODE_TYPES]; /* index of first vertex/edge/... node*/
unsigned int cookie; /* changed on each refine/coarsen. Use
* this to check consistency of meshes
* and DOF vectors when reading from
* files.
*/
int trace_id; /* if this is a trace-mesh (aka sub-mesh)
* then this is a unique id identifying
* it among all the other trace-meshes
* chained to the parent mesh.
*/
void *mem_info; /* pointer for administration; don't touch! */
};
/*******************************************************************************
* data structure for basis function representation
******************************************************************************/
typedef REAL
(*BAS_FCT)(const REAL_B lambda, const BAS_FCTS *thisptr);
typedef const REAL *
(*GRD_BAS_FCT)(const REAL_B lambda, const BAS_FCTS *thisptr);
typedef const REAL_B *
(*D2_BAS_FCT)(const REAL_B lambda, const BAS_FCTS *thisptr);
typedef const REAL_BB *
(*D3_BAS_FCT)(const REAL_B lambda, const BAS_FCTS *thisptr);
typedef const REAL_BBB *
(*D4_BAS_FCT)(const REAL_B lambda, const BAS_FCTS *thisptr);
typedef const REAL *
(*BAS_FCT_D)(const REAL_B lambda, const BAS_FCTS *thisptr);
typedef const REAL_B *
(*GRD_BAS_FCT_D)(const REAL_B lambda, const BAS_FCTS *thisptr);
typedef const REAL_BB *
(*D2_BAS_FCT_D)(const REAL_B lambda, const BAS_FCTS *thisptr);
typedef void (*REF_INTER_FCT)(DOF_REAL_VEC *, RC_LIST_EL *, int);
typedef void (*REF_INTER_D_FCT)(DOF_REAL_D_VEC *, RC_LIST_EL *, int);
typedef void (*REF_INTER_FCT_D)(DOF_REAL_VEC_D *, RC_LIST_EL *, int);
#define PHI(bfcts, i, lambda) (bfcts)->phi[i](lambda, bfcts)
#define GRD_PHI(bfcts, i, lambda) (bfcts)->grd_phi[i](lambda, bfcts)
#define D2_PHI(bfcts, i, lambda) (bfcts)->D2_phi[i](lambda, bfcts)
#define D3_PHI(bfcts, i, lambda) (bfcts)->D3_phi[i](lambda, bfcts)
#define D4_PHI(bfcts, i, lambda) (bfcts)->D4_phi[i](lambda, bfcts)
#define PHI_D(bfcts, i, lambda) (bfcts)->phi_d[i](lambda, bfcts)
#define GRD_PHI_D(bfcts, i, lambda) (bfcts)->grd_phi_d[i](lambda, bfcts)
#define D2_PHI_D(bfcts, i, lambda) (bfcts)->D2_phi_d[i](lambda, bfcts)
#define GET_DOF_INDICES(bfcts, el, admin, dof) \
(bfcts)->get_dof_indices(dof, el, admin, bfcts)
#define INTERPOL(bfcts, coeff, el_info, wall, n, indices, f, ud) \
(bfcts)->interpol(coeff, el_info, wall, n, indices, f, ud, bfcts)
#define INTERPOL_D(bfcts, coeff, el_info, wall, n, indices, f, ud) \
(bfcts)->interpol_d(coeff, el_info, wall, n, indices, f, ud, bfcts)
#define INTERPOL_DOW(bfcts, coeff, el_info, wall, n, indices, f, ud) \
(bfcts)->interpol_dow(coeff, el_info, wall, n, indices, f, ud, bfcts)
#define GET_BOUND(bfcts, el_info, bound) \
(bfcts)->get_bound(bound, el_info, bfcts)
struct bas_fcts
{
const char *name; /* textual description */
int dim; /* dimension of the corresponding mesh. */
int rdim; /* dimension of the range, 1 or DIM_OF_WORLD */
int n_bas_fcts; /* nu_mber of basisfunctions on one el */
int n_bas_fcts_max;/* max. number in presence of init_element() */
int degree; /* maximal degree of the basis functions,
* may vary on a per-element basis if
* init_element() is != NULL.
*/
int n_dof[N_NODE_TYPES]; /* dofs from these bas_fcts */
int trace_admin; /* If >= 0, then the basis function set
* needs a DOF_ADMIN living on a trace
* mesh with id TRACE_ADMIN.
*/
/************** link to next set of bfcts in a direct sum *******************/
DBL_LIST_NODE chain;
/* A pointer to the unchained version. It simply points back to the
* same structure if this is an unchained basis-function
* structure.
*/
const BAS_FCTS *unchained;
/*************** per-element initializer (maybe NULL) ***********************/
INIT_ELEMENT_DECL;
/*************** the basis functions themselves ***********************/
const BAS_FCT *phi;
const GRD_BAS_FCT *grd_phi;
const D2_BAS_FCT *D2_phi;
const D3_BAS_FCT *D3_phi; /* Optional, implemented for Lagrange bfcts. */
const D4_BAS_FCT *D4_phi; /* Optional, implemented for Lagrange bfcts. */
/* Vector valued basis functions are always factored as phi[i]() *
* phi_d[i](). If phi_d[i]() is piece-wise constant, then
* dir_pw_const should be true. The directions are never cached in
* QUAD_FAST, only the scalar factor.
*/
const BAS_FCT_D *phi_d;
const GRD_BAS_FCT_D *grd_phi_d;
const D2_BAS_FCT_D *D2_phi_d;
bool dir_pw_const; /* Direction is p.w. constant on the reference element. */
/*************** the trace space on the wall (e.g. Mini-element) ************/
const BAS_FCTS *trace_bas_fcts; /* The trace space */
/* The local DOF mapping for the trace spaces,
* < 3d:
* [0][0][wall][slave local dof] == master local dof,
* 3d:
* [type > 0][orient < 0][wall][slave local dof] == master local dof.
*/
const int *trace_dof_map[2][2][N_WALLS_MAX];
/* This obscure component can vary from wall to wall in the presence
* of an INIT_ELEMENT() method. It is _always_ equal to
* trace_bas_fcts->n_bas_fcts ... BUT ONLY after the respective
* element initializer has been called for trace_bas_fcts on the
* trace mesh. If an INIT_ELEMENT() method is present then it _MUST_
* initialize trace_dof_map _AND_ n_trace_bas_fcts. Of course, in 3D
* only the components corresponding to type and orientation of the
* current EL_INFO object have to be taken care of by the
* INIT_ELEMENT() method.
*/
int n_trace_bas_fcts[N_WALLS_MAX];
/*************** interconnection to DOF_ADMIN and mesh ********************/
const EL_DOF_VEC *(*get_dof_indices)(DOF *result,
const EL *, const DOF_ADMIN *,
const BAS_FCTS *thisptr);
const EL_BNDRY_VEC *(*get_bound)(BNDRY_FLAGS *bndry_bits,
const EL_INFO *eli,
const BAS_FCTS *thisptr);
/*************** entries must be set for interpolation ********************/
void (*interpol)(EL_REAL_VEC *coeff,
const EL_INFO *el_info, int wall,
int n, const int *indices,
LOC_FCT_AT_QP f, void *ud,
const BAS_FCTS *thisptr);
void (*interpol_d)(EL_REAL_D_VEC *coeff,
const EL_INFO *el_info, int wall,
int n, const int *indices,
LOC_FCT_D_AT_QP f, void *ud,
const BAS_FCTS *thisptr);
void (*interpol_dow)(EL_REAL_VEC_D *coeff,
const EL_INFO *el_info, int wall,
int n, const int *indices,
LOC_FCT_D_AT_QP f, void *ud,
const BAS_FCTS *thisptr);
/******************** optional entries ***********************************/
const EL_INT_VEC *(*get_int_vec)(int result[],
const EL *, const DOF_INT_VEC *);
const EL_REAL_VEC *(*get_real_vec)(REAL result[],
const EL *, const DOF_REAL_VEC *);
const EL_REAL_D_VEC *(*get_real_d_vec)(REAL_D result[],
const EL *, const DOF_REAL_D_VEC *);
const EL_REAL_VEC_D *(*get_real_vec_d)(REAL result[],
const EL *, const DOF_REAL_VEC_D *);
const EL_UCHAR_VEC *(*get_uchar_vec)(U_CHAR result[],
const EL *, const DOF_UCHAR_VEC *);
const EL_SCHAR_VEC *(*get_schar_vec)(S_CHAR result[],
const EL *, const DOF_SCHAR_VEC *);
const EL_PTR_VEC *(*get_ptr_vec)(void *result[],
const EL *, const DOF_PTR_VEC *);
const EL_REAL_DD_VEC *(*get_real_dd_vec)(REAL_DD result[],
const EL *, const DOF_REAL_DD_VEC *);
void (*real_refine_inter)(DOF_REAL_VEC *, RC_LIST_EL *, int);
void (*real_coarse_inter)(DOF_REAL_VEC *, RC_LIST_EL *, int);
void (*real_coarse_restr)(DOF_REAL_VEC *, RC_LIST_EL *, int);
void (*real_d_refine_inter)(DOF_REAL_D_VEC *, RC_LIST_EL *, int);
void (*real_d_coarse_inter)(DOF_REAL_D_VEC *, RC_LIST_EL *, int);
void (*real_d_coarse_restr)(DOF_REAL_D_VEC *, RC_LIST_EL *, int);
void (*real_refine_inter_d)(DOF_REAL_VEC_D *, RC_LIST_EL *, int);
void (*real_coarse_inter_d)(DOF_REAL_VEC_D *, RC_LIST_EL *, int);
void (*real_coarse_restr_d)(DOF_REAL_VEC_D *, RC_LIST_EL *, int);
void *ext_data; /* Implementation dependent extra data */
};
/* Barycentric coordinates of Lagrange nodes. */
#define LAGRANGE_NODES(bfcts) \
((const REAL_B *)(*(void **)(bfcts)->ext_data))
/******************************************************************************
* FE spaces are a triple of DOFs and BAS_FCTs on a MESH
*
* Fe-Spaces may be vector-valued, if either the basis functions are
* vector-valued, or on request. rdim codes the dimension of the
* range-space, it may be either 1 or DIM_OF_WORLD, so it is rather a
* flag-value. Scalar fe-space should in principle not be attached to
* DOF_REAL_D_VECs (but can be).
*
* Fe-spaces may be chained to constitute the Cartesian product space
* of a couple of distinct fe-spaces, e.g. to form the Cartesian
* product of some "trivially" vector valued fe-space with another
* space spanned by "really" vector-valued basis functions, e.g. to
* add edge respectively face bubbles.
*
*****************************************************************************/
struct fe_space
{
const char *name;
const DOF_ADMIN *admin;
const BAS_FCTS *bas_fcts;
MESH *mesh;
int rdim;
int ref_cnt;
DBL_LIST_NODE chain;
const FE_SPACE *unchained;
};
/* How to check whether two FE_SPACE objects are essentially the same */
#define FE_SPACE_EQ_P(fe1, fe2) \
((fe1) == (fe2) || \
((fe1)->admin == (fe2)->admin && \
(fe1)->bas_fcts == (fe2)->bas_fcts && \
(fe1)->mesh == (fe2)->mesh && \
(fe1)->rdim == (fe2)->rdim))
static inline bool fe_space_is_eq(const FE_SPACE *fe1, const FE_SPACE *fe2)
{
return FE_SPACE_EQ_P(fe1, fe2);
}
/*******************************************************************************
* data structures for numerical integration
******************************************************************************/
struct quadrature
{
const char *name;
int degree;
int dim; /* barycentric coords have (dim+1) components */
int codim; /* the co-dimension */
int subsplx; /* co-dim 1: face number, co-dim 2: edge number */
int n_points;
int n_points_max; /* max. number in presence of INIT_ELEMENT() */
const REAL_B *lambda;
const REAL *w;
void *metadata; /* for internally kept per element caches etc. */
INIT_ELEMENT_DECL;
};
/*******************************************************************************
* per-element quadrature cache for co-ordinates, det, Lambda, DLambda
* uch a cache structure is associated with each quadrature and can be
* filled by fill_quad_el_cache(el_info, quad, fill_flag). The cache
* is incremental, repeated calls will fill in data as needed.
******************************************************************************/
struct quad_el_cache
{
EL *current_el;
FLAGS fill_flag;
REAL_D *world;
struct {
REAL *det;
REAL_BD *Lambda;
REAL_BDD *DLambda;
REAL_BD *grd_world;
REAL_BDB *D2_world;
REAL_BDBB *D3_world;
REAL *wall_det; /* for co-dim 1 */
REAL_D *wall_normal; /* for co-dim 1 */
REAL_DB *grd_normal; /* for co-dim 1 */
REAL_DBB *D2_normal; /* for co-dim 1 */
} param;
};
#define FILL_EL_QUAD_WORLD 0x0001
#define FILL_EL_QUAD_DET 0x0002
#define FILL_EL_QUAD_LAMBDA 0x0004
#define FILL_EL_QUAD_DLAMBDA 0x0008
#define FILL_EL_QUAD_GRD_WORLD 0x0010
#define FILL_EL_QUAD_D2_WORLD 0x0020
#define FILL_EL_QUAD_D3_WORLD 0x0040
#define FILL_EL_QUAD_WALL_DET 0x0100
#define FILL_EL_QUAD_WALL_NORMAL 0x0200
#define FILL_EL_QUAD_GRD_NORMAL 0x0400
#define FILL_EL_QUAD_D2_NORMAL 0x0800
static inline const QUAD_EL_CACHE *fill_quad_el_cache(const EL_INFO *el_info,
const QUAD *quad,
FLAGS fill);
/*******************************************************************************
* data structure with precomputed values of basis functions at
* quadrature nodes on the standard element
******************************************************************************/
#define INIT_PHI 0x01
#define INIT_GRD_PHI 0x02
#define INIT_D2_PHI 0x04
#define INIT_D3_PHI 0x08
#define INIT_D4_PHI 0x10
#define INIT_TANGENTIAL 0x80 /* derivatives are tangential, for co-dim 1
* quadratures.
*/
struct quad_fast
{
const QUAD *quad;
const BAS_FCTS *bas_fcts;
FLAGS init_flag;
int dim;
int n_points;
int n_bas_fcts;
int n_points_max;
int n_bas_fcts_max;
const REAL *w; /* shallow copy of quad->w */
const REAL (*const*phi); /* [qp][bf] */
const REAL_B (*const*grd_phi);
const REAL_BB (*const*D2_phi);
const REAL_BBB (*const*D3_phi);
const REAL_BBBB (*const*D4_phi);
/* For vector valued basis functions with a p.w. constant
* directional derivative we cache that direction and make it
* available for applications. The component is initialized by the
* INIT_ELEMENT() method.
*
* So: phi_d[i] gives the value of the directional factor for the
* i-th basis function. If (!bas_fcts->dir_pw_const), then phi_d is
* NULL.
*/
const REAL_D *phi_d;
/* chain to next structure, if bas_fcts->chain is non-empty */
DBL_LIST_NODE chain;
/* a clone of this structure, but as single item. */
const QUAD_FAST *unchained;
INIT_ELEMENT_DECL;
void *internal;
};
/*******************************************************************************
* data structure for adaptive methods
******************************************************************************/
typedef enum adaptation_strategy {
NoStrategy = 0,
GlobalRefinement = 1,
GR = GlobalRefinement,
MinimumStrategy = 2,
MS = MinimumStrategy,
EqualDistributionStrategy = 3,
ES = EqualDistributionStrategy,
GuaranteedErrorReductionStrategy = 4,
GERS = GuaranteedErrorReductionStrategy
} ADAPTATION_STRATEGY;
struct adapt_stat
{
const char *name;
REAL tolerance;
REAL p; /* power in estimator norm */
int max_iteration;
int info;
REAL (*estimate)(MESH *mesh, ADAPT_STAT *adapt);
REAL (*get_el_est)(EL *el); /* local error estimate */
REAL (*get_el_estc)(EL *el); /* local coarsening error estimate*/
U_CHAR (*marking)(MESH *mesh, ADAPT_STAT *adapt);
void *est_info; /* estimator parameters */
REAL err_sum, err_max; /* sum and max of el_est */
void (*build_before_refine)(MESH *mesh, U_CHAR flag);
void (*build_before_coarsen)(MESH *mesh, U_CHAR flag);
void (*build_after_coarsen)(MESH *mesh, U_CHAR flag);
void (*solve)(MESH *mesh);
int refine_bisections;
bool coarsen_allowed; /* 0 : 1 */
int coarse_bisections;
FLAGS adaptation_fill_flags; /* Fill-flags used during adaptation */
ADAPTATION_STRATEGY strategy; /* 1=GR, 2=MS, 3=ES, 4=GERS */
REAL MS_gamma, MS_gamma_c; /* maximum strategy */
REAL ES_theta, ES_theta_c; /* equidistribution strategy */
REAL GERS_theta_star, GERS_nu, GERS_theta_c; /* willy's strategy */
};
struct adapt_instat
{
const char *name;
ADAPT_STAT adapt_initial[1];
ADAPT_STAT adapt_space[1];
REAL time;
REAL start_time, end_time;
REAL timestep;
void (*init_timestep)(MESH *mesh, ADAPT_INSTAT *adapt);
void (*set_time)(MESH *mesh, ADAPT_INSTAT *adapt);
void (*one_timestep)(MESH *mesh, ADAPT_INSTAT *adapt);
REAL (*get_time_est)(MESH *mesh, ADAPT_INSTAT *adapt);
void (*close_timestep)(MESH *mesh, ADAPT_INSTAT *adapt);
int strategy;
int max_iteration;
REAL tolerance;
REAL rel_initial_error;
REAL rel_space_error;
REAL rel_time_error;
REAL time_theta_1;
REAL time_theta_2;
REAL time_delta_1;
REAL time_delta_2;
int info;
};
#define MESH_REFINED 1
#define MESH_COARSENED 2
typedef enum norm
{
NO_NORM = 0, /* uninitialized */
H1_NORM = 1, /* H1-half-norm */
L2_NORM = 2, /* L2-norm */
L2H1_NORM = H1_NORM|L2_NORM /* full H1-norm */
} NORM;
/*******************************************************************************
* data structures for matrix and vector update
******************************************************************************/
struct el_matrix
{
MATENT_TYPE type;
int n_row, n_col;
int n_row_max, n_col_max;
union {
REAL *const*real;
REAL_D *const*real_d;
REAL_DD *const*real_dd;
} data;
DBL_LIST_NODE row_chain;
DBL_LIST_NODE col_chain;
};
typedef const EL_MATRIX *
(*EL_MATRIX_FCT)(const EL_INFO *el_info, void *fill_info);
typedef struct el_matrix_info EL_MATRIX_INFO;
struct el_matrix_info
{
const FE_SPACE *row_fe_space;
const FE_SPACE *col_fe_space;
MATENT_TYPE krn_blk_type;
BNDRY_FLAGS dirichlet_bndry;
REAL factor;
EL_MATRIX_FCT el_matrix_fct;
void *fill_info;
const EL_MATRIX_FCT *neigh_el_mat_fcts;
void *neigh_fill_info;
FLAGS fill_flag;
};
typedef const EL_REAL_VEC *
(*EL_VEC_FCT)(const EL_INFO *el_info, void *fill_info);
typedef struct el_vec_info EL_VEC_INFO;
struct el_vec_info
{
const FE_SPACE *fe_space;
BNDRY_FLAGS dirichlet_bndry;
REAL factor;
EL_VEC_FCT el_vec_fct;
void *fill_info;
FLAGS fill_flag;
};
typedef const EL_REAL_D_VEC *
(*EL_VEC_D_FCT)(const EL_INFO *el_info, void *fill_info);
typedef struct el_vec_d_info EL_VEC_D_INFO;
struct el_vec_d_info
{
const FE_SPACE *fe_space;
BNDRY_FLAGS dirichlet_bndry;
REAL factor;
EL_VEC_D_FCT el_vec_fct;
void *fill_info;
FLAGS fill_flag;
};
typedef const EL_REAL_VEC_D *
(*EL_VEC_FCT_D)(const EL_INFO *el_info, void *fill_info);
typedef struct el_vec_info_d EL_VEC_INFO_D;
struct el_vec_info_d
{
const FE_SPACE *fe_space;
BNDRY_FLAGS dirichlet_bndry;
REAL factor;
EL_VEC_FCT_D el_vec_fct;
void *fill_info;
FLAGS fill_flag;
};
/*******************************************************************************
* a matrix of quadratures to use for each block of a block-operator
* acting on a direct sum of FE-space.
******************************************************************************/
typedef struct quad_tensor
{
const QUAD *quad; /* the quadrature rules to use for this block */
DBL_LIST_NODE row_chain; /* cyclic list link for one row */
DBL_LIST_NODE col_chain; /* cyclic list link for one column */
DBL_LIST_NODE dep_chain; /* cyclic list link for the third index */
} QUAD_TENSOR;
typedef struct wall_quad_tensor
{
const WALL_QUAD *quad; /* the quadrature rule to use for this block */
DBL_LIST_NODE row_chain; /* cyclic list link for one row */
DBL_LIST_NODE col_chain; /* cyclic list link for on e column */
DBL_LIST_NODE dep_chain; /* cyclic list link for the third index */
} WALL_QUAD_TENSOR;
/*******************************************************************************
* data structure about the differential operator for matrix assemblage
******************************************************************************/
typedef struct operator_info OPERATOR_INFO;
struct operator_info
{
const FE_SPACE *row_fe_space; /* range fe-space */
const FE_SPACE *col_fe_space; /* domain fe-space */
const QUAD *quad[3];
const QUAD_TENSOR *quad_tensor[3];
bool (*init_element)(const EL_INFO *el_info, const QUAD *quad[3], void *apd);
union {
const REAL_B *(*real)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_BD *(*real_d)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_BDD *(*real_dd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
} LALt;
MATENT_TYPE LALt_type; /* MATENT_REAL, _REAL_D or _REAL_DD */
bool LALt_pw_const;
bool LALt_symmetric;
int LALt_degree; /* quadrature degree of the LALt() kernel */
union {
const REAL *(*real)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_D *(*real_d)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_DD *(*real_dd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_DDD *(*real_ddd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
} Lb0;
bool Lb0_pw_const;
union {
const REAL *(*real)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_D *(*real_d)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_DD *(*real_dd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_DDD *(*real_ddd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
} Lb1;
bool Lb1_pw_const;
MATENT_TYPE Lb_type; /* MATENT_REAL, _REAL_D or _REAL_DD */
bool Lb0_Lb1_anti_symmetric;
int Lb_degree; /* quadrature degree for the Lb0() & Lb1() kernel */
const EL_REAL_VEC_D *(*advection_field)(const EL_INFO *el_info, void *apd);
const FE_SPACE *adv_fe_space;
union {
REAL (*real)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL *(*real_d)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_D *(*real_dd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
} c;
bool c_pw_const;
MATENT_TYPE c_type; /* MATENT_REAL, _REAL_D or _REAL_DD */
int c_degree; /* quadrature degree for the c()-kernel */
BNDRY_FLAGS dirichlet_bndry; /* bndry-type bit-mask for
* Dirichlet-boundary conditions
* built into the matrix
*/
FLAGS fill_flag;
void *user_data; /* application data, passed to init_element */
};
typedef struct bndry_operator_info BNDRY_OPERATOR_INFO;
struct bndry_operator_info
{
const FE_SPACE *row_fe_space;
const FE_SPACE *col_fe_space;
const WALL_QUAD *quad[3];
const WALL_QUAD_TENSOR *quad_tensor[3];
bool (*init_element)(const EL_INFO *el_info, int wall,
const WALL_QUAD *quad[3], void *ud);
union {
const REAL_B *(*real)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_BD *(*real_d)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_BDD *(*real_dd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
} LALt;
MATENT_TYPE LALt_type; /* MATENT_REAL, _REAL_D or _REAL_DD */
bool LALt_pw_const;
bool LALt_symmetric;
int LALt_degree; /* quad-deg for the LALt() kernel */
union {
const REAL *(*real)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_D *(*real_d)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_DD *(*real_dd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_DDD *(*real_ddd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
} Lb0;
bool Lb0_pw_const;
union {
const REAL *(*real)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_D *(*real_d)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_DD *(*real_dd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_DDD *(*real_ddd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
} Lb1;
bool Lb1_pw_const;
MATENT_TYPE Lb_type; /* MATENT_REAL, _REAL_D or _REAL_DD */
bool Lb0_Lb1_anti_symmetric;
int Lb_degree; /* quad-deg for the Lb0() and Lb1() kernel */
/* The following two entries are not used yet. */
const EL_REAL_VEC_D *(*advection_field)(const EL_INFO *el_info, void *apd);
const FE_SPACE *adv_fe_space;
union {
REAL (*real)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL *(*real_d)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const REAL_D *(*real_dd)(const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
} c;
bool c_pw_const;
MATENT_TYPE c_type; /* MATENT_REAL, _REAL_D or _REAL_DD */
int c_degree; /* quad-deg of the c() kernel */
/* boundary segment(s) we belong to; if
* BNDRY_FLAGS_IS_INTERIOR(bndry_type), then the operator is invoked
* on all interior faces, e.g. to implement a DG-method.
*/
BNDRY_FLAGS bndry_type;
bool discontinuous; /* assemble jumps w.r.t. the neighbour */
bool tangential; /* use tangential gradients */
FLAGS fill_flag;
void *user_data;
};
/*******************************************************************************
*
* A structure describing the "closure" of an differential operator by
* Dirichlet, Neumann or Robin boundary conditions.
*
* Note that the quadrature passed to neumann() and robin() is a
* co-dim 1 quadrature, so quad->subsplx is the number of the boundary
* face, and el_info->wall_bound[quad->subsplx] contains the boundary
* classification.
*
******************************************************************************/
typedef struct bndry_cond_info BNDRY_COND_INFO;
struct bndry_cond_info
{
const FE_SPACE *fe_space;
REAL (*dirichlet)(const EL_INFO *el_info,
const REAL_B lambda,
BNDRY_FLAGS bndry,
void *apd);
BNDRY_FLAGS dirichlet_bndry;
REAL (*neumann)(const EL_INFO *el_info, const QUAD *quad, int iq, void *apd);
const WALL_QUAD *neumann_quad;
BNDRY_FLAGS neumann_bndry;
REAL (*robin)(const EL_INFO *el_info, const QUAD *quad, int iq, void *apd);
const WALL_QUAD *robin_quad;
REAL robin_const; /* if robin == NULL, use this constant value */
BNDRY_FLAGS robin_bndry;
S_CHAR (*bndry_type)(const BNDRY_FLAGS bndry_bits);
void *user_data;
};
typedef struct bndry_cond_info_d BNDRY_COND_INFO_D;
struct bndry_cond_info_d
{
const FE_SPACE *fe_space;
const REAL *(*dirichlet)(REAL_D result,
const EL_INFO *el_info,
const REAL_B lambda,
void *apd);
BNDRY_FLAGS dirichlet_bndry;
const REAL *(*neumann)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const WALL_QUAD *neumann_quad;
BNDRY_FLAGS neumann_bound;
const REAL *(*robin)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad, int iq, void *apd);
const WALL_QUAD *robin_quad;
REAL_D robin_const; /* if robin == NULL, use this constant value */
BNDRY_FLAGS robin_bound;
S_CHAR (*bndry_type)(const BNDRY_FLAGS bndry_bits);
void *user_data;
};
/*******************************************************************************
* calculate element stiffness matrices by preevaluated integrals
* over the the reference element. In this notation, "PSI" means the
* row-space, i.e. the space of test-functions, "PHI" means the
* column-space, i.e. the space of ansatz functions.
*
* The special tri-linear caches Q001, Q010 and Q100 are meant to
* support assembling tri-linear forms, e.g. for material
* derivatives. The caches are present, but currently there is not
* further support for tri-linear forms inside ALBERTA. The "1"
* denotes which of the three factors is differentiated.
******************************************************************************/
typedef struct q11_psi_phi Q11_PSI_PHI;
typedef struct q01_psi_phi Q01_PSI_PHI;
typedef struct q10_psi_phi Q10_PSI_PHI;
typedef struct q00_psi_phi Q00_PSI_PHI;
typedef struct q001_eta_psi_phi Q001_ETA_PSI_PHI;
typedef struct q010_eta_psi_phi Q010_ETA_PSI_PHI;
typedef struct q100_eta_psi_phi Q100_ETA_PSI_PHI;
/* for i = 0 ... n_psi-1
* for j = 0 ... n_phi-1
* for m = 0 ... n_entries[i][j]
*
* Then we have: values[m][i][j] is the product of
* (\nabla\psi_i)_{k[i][j][m]} with (\nabla\phi_j)_{l[i][j][m]}
*
* end for
* end for
* end for
*
* Products yielding zero are left out.
*/
typedef struct q11_psi_phi_cache
{
int n_psi;
int n_phi;
const int *const*n_entries;
const REAL *const*const*values;
const int *const*const*k;
const int *const*const*l;
} Q11_PSI_PHI_CACHE;
struct q11_psi_phi
{
const BAS_FCTS *psi;
const BAS_FCTS *phi;
const QUAD *quad;
const Q11_PSI_PHI_CACHE *cache;
INIT_ELEMENT_DECL;
};
/* for i = 0 ... n_psi-1
* for j = 0 ... n_phi-1
* for m = 0 ... n_entries[i][j]
*
* Then we have: values[m][i][j] is the product of
* \psi_i with (\nabla\phi_j)_{l[i][j][m]}
*
* end for
* end for
* end for
*
* Products yielding zero are left out.
*/
typedef struct q01_psi_phi_cache
{
int n_psi;
int n_phi;
const int *const*n_entries;
const REAL *const*const*values;
const int *const*const*l;
} Q01_PSI_PHI_CACHE;
struct q01_psi_phi
{
const BAS_FCTS *psi;
const BAS_FCTS *phi;
const QUAD *quad;
const Q01_PSI_PHI_CACHE *cache;
INIT_ELEMENT_DECL;
};
/* for i = 0 ... n_psi-1
* for j = 0 ... n_phi-1
* for m = 0 ... n_entries[i][j]
*
* Then we have: values[m][i][j] is the product of
* (\nabla\psi_i)_{k[i][j][m]} with \phi_j
*
* end for
* end for
* end for
*
* Products yielding zero are left out.
*/
typedef struct q10_psi_phi_cache
{
int n_psi;
int n_phi;
const int *const*n_entries;
const REAL *const*const*values;
const int *const*const*k;
} Q10_PSI_PHI_CACHE;
struct q10_psi_phi
{
const BAS_FCTS *psi;
const BAS_FCTS *phi;
const QUAD *quad;
const Q10_PSI_PHI_CACHE *cache;
INIT_ELEMENT_DECL;
};
typedef struct q00_psi_phi_cache
{
int n_psi;
int n_phi;
const REAL *const*values;
} Q00_PSI_PHI_CACHE;
struct q00_psi_phi
{
const BAS_FCTS *psi;
const BAS_FCTS *phi;
const QUAD *quad;
const Q00_PSI_PHI_CACHE *cache;
INIT_ELEMENT_DECL;
};
/* for i = 0 ... n_psi-1
* for j = 0 ... n_phi-1
* for k = 0 ... n_eta-1
* for m = 0 ... n_entries[i][j][k]
*
* Then we have: values[m][i][j][k] is the product of
* \psi_i, \phi_j with (\nabla\eta_k)_{l[i][j][k][m]}
* end for
* end for
* end for
* end for
*
* Products yielding zero are left out. The analogue holds for the 010
* and 100 structures, where the position of the "1" marks which
* factor is differentitated.
*/
typedef struct q001_eta_psi_phi_cache
{
int n_eta;
int n_psi;
int n_phi;
const int *const*const*n_entries;
const REAL *const*const*const*values;
const int *const*const*const*l;
} Q001_ETA_PSI_PHI_CACHE;
struct q001_eta_psi_phi
{
const BAS_FCTS *eta;
const BAS_FCTS *psi;
const BAS_FCTS *phi;
const QUAD *quad;
const Q001_ETA_PSI_PHI_CACHE *cache;
INIT_ELEMENT_DECL;
};
typedef struct q010_eta_psi_phi_cache
{
int n_eta;
int n_psi;
int n_phi;
const int *const*const*n_entries;
const REAL *const*const*const*values;
const int *const*const*const*l;
} Q010_ETA_PSI_PHI_CACHE;
struct q010_eta_psi_phi
{
const BAS_FCTS *eta;
const BAS_FCTS *psi;
const BAS_FCTS *phi;
const QUAD *quad;
const Q010_ETA_PSI_PHI_CACHE *cache;
INIT_ELEMENT_DECL;
};
typedef struct q100_eta_psi_phi_cache
{
int n_eta;
int n_psi;
int n_phi;
const int *const*const*n_entries;
const REAL *const*const*const*values;
const int *const*const*const*l;
} Q100_ETA_PSI_PHI_CACHE;
struct q100_eta_psi_phi
{
const BAS_FCTS *eta;
const BAS_FCTS *psi;
const BAS_FCTS *phi;
const QUAD *quad;
const Q100_ETA_PSI_PHI_CACHE *cache;
INIT_ELEMENT_DECL;
};
/******************************************************************************/
/* Data for assembling a theta splitting scheme. */
typedef struct el_sys_info_instat EL_SYS_INFO_INSTAT;
struct el_sys_info_instat
{
const FE_SPACE *row_fe_space;
const FE_SPACE *col_fe_space;
INIT_EL_TAG (*el_update_fct)(const EL_INFO *el_info,
REAL tau, REAL theta,
EL_SYS_INFO_INSTAT *thisptr);
EL_MATRIX *el_matrix;
EL_REAL_VEC *el_load;
const EL_MATRIX *el_stiff;
const EL_MATRIX *el_mass;
const EL_REAL_VEC *u_h_loc;
FLAGS fill_flag;
BNDRY_FLAGS dirichlet_bndry; /* bndry-type bit-mask for
* Dirichlet-boundary conditions
* built into the matrix
*/
MATENT_TYPE krn_blk_type; /* MATENT_REAL for scalar problems */
};
typedef struct el_sys_info_dow_instat EL_SYS_INFO_DOW_INSTAT;
struct el_sys_info_dow_instat
{
const FE_SPACE *row_fe_space;
const FE_SPACE *col_fe_space;
INIT_EL_TAG (*el_update_fct)(const EL_INFO *el_info,
REAL tau, REAL theta,
EL_SYS_INFO_DOW_INSTAT *thisptr);
EL_MATRIX *el_matrix;
EL_REAL_VEC_D *el_load;
const EL_MATRIX *el_stiff;
const EL_MATRIX *el_mass;
const EL_REAL_VEC_D *u_h_loc;
FLAGS fill_flag;
BNDRY_FLAGS dirichlet_bndry; /* bndry-type bit-mask for
* Dirichlet-boundary conditions
* built into the matrix
*/
MATENT_TYPE krn_blk_type;
};
typedef struct el_sys_info_d_instat EL_SYS_INFO_D_INSTAT;
struct el_sys_info_d_instat
{
const FE_SPACE *row_fe_space;
const FE_SPACE *col_fe_space;
INIT_EL_TAG (*el_update_fct)(const EL_INFO *el_info,
REAL tau, REAL theta,
EL_SYS_INFO_D_INSTAT *thisptr);
EL_MATRIX *el_matrix;
EL_REAL_D_VEC *el_load;
const EL_MATRIX *el_stiff;
const EL_MATRIX *el_mass;
const EL_REAL_D_VEC *u_h_loc;
FLAGS fill_flag;
BNDRY_FLAGS dirichlet_bndry; /* bndry-type bit-mask for
* Dirichlet-boundary conditions
* built into the matrix
*/
MATENT_TYPE krn_blk_type;
};
/*******************************************************************************
* preconditioner types.
******************************************************************************/
typedef enum {
PreconEnd = -1, /* Terminator for variable argument precon functions */
PreconRepeat = PreconEnd,
NoPrecon = 0,
DiagPrecon = 1,
HBPrecon = 2,
BPXPrecon = 3,
SSORPrecon = 4, /* omega == 1, n_iter = 1 */
__SSORPrecon = 5, /* SSOR, but with variable omega and n_iter */
ILUkPrecon = 6, /* combinatorical ILU(k) */
BlkDiagPrecon = 512,
BlkSSORPrecon = 513,
} OEM_PRECON;
#define N_BLOCK_PRECON_MAX 10
/*******************************************************************************
* A data structure which can be use to define more complex
* preconditioners. The purpose of this structure is to avoid defining
* functions with an endless number of arguments. This
* "parameter-transport-structure" can be passed to
* init_precon_from_type(), instead of calling init_oem_precon().
*
* The general idea is:
*
* type -- one of the preconditoner types defined above.
*
* param -- if the preconditioner defined by "type" needs additional
* parameters, then the corresponding section in the "param"
* component has to be filled.
*
* Examples (using a C99-compliant C-compiler):
*
* type == __SSORPrecon:
*
* PRECON_TYPE prec = {
* __SSORPrecon,
* { .__SSOR = { 1.5, 2 } }
* };
*
* type == BlkDiagPrecon, the FE-space is a direct sum of 3
* components, e.g. the Crouzeix-Raviart-Mansfield Stokes
* discretisation in 3d (Lagrange-2 + face-bubble + wall-bubbles):
*
* PRECON_TYPE = {
* BlkDiagPrecon,
* { .BlkDiag = {
* { __SSORPrecon, { 1.0, 1 } },
* { DiagPrecon },
* { DIagPrecon }, }
* }
* }
*
*
******************************************************************************/
/* Helper struct for BlkPrecon parameters */
struct __precon_type {
OEM_PRECON type;
union {
struct {
REAL omega;
int n_iter;
} __SSOR;
struct {
int level;
} ILUk;
} param;
};
typedef struct precon_type
{
OEM_PRECON type;
union {
struct {
REAL omega;
int n_iter;
} __SSOR;
struct {
int level;
} ILUk;
struct {
struct __precon_type precon[N_BLOCK_PRECON_MAX];
} BlkDiag;
struct {
struct __precon_type precon[N_BLOCK_PRECON_MAX];
REAL omega;
int n_iter;
} BlkSSOR;
} param;
} PRECON_TYPE;
/*******************************************************************************
* The precon "class".
*
* precon_data: Opaque data pointer.
*
* init_precon(): Has to be called after the operator has changed,
* e.g. to update the inverse of the diagonal after the
* matrix has changed.
*
* exit_precon(): Destroys the preconditioner, include the precon
* structure itself.
*
* precon(): The preconditioner itself.
*
******************************************************************************/
typedef struct precon PRECON;
struct precon
{
void *precon_data;
bool (*init_precon)(void *precon_data);
void (*precon)(void *precon_data, int n, REAL *vec);
void (*exit_precon)(void *precon_data);
};
extern const PRECON *get_diag_precon(const DOF_MATRIX *A,
const DOF_SCHAR_VEC *bound);
extern const PRECON *get_HB_precon(const DOF_MATRIX *matrix,
const DOF_SCHAR_VEC *bound,
int info);
extern const PRECON *get_BPX_precon(const DOF_MATRIX *matrix,
const DOF_SCHAR_VEC *bound,
int info);
extern const PRECON *get_SSOR_precon(const DOF_MATRIX *A,
const DOF_SCHAR_VEC *bound,
REAL omega,
int n_iter);
extern const PRECON *get_ILUk_precon(const DOF_MATRIX *A,
const DOF_SCHAR_VEC *mask,
int ilu_level, int info);
/*******************************************************************************
* abstract multigrid
******************************************************************************/
typedef struct multi_grid_info MULTI_GRID_INFO;
struct multi_grid_info
{
REAL tolerance; /* tol. for resid */
REAL exact_tolerance; /* tol. for exact_solver */
int cycle; /* 1=V-cycle, 2=W-cycle */
int n_pre_smooth, n_in_smooth; /* no of smoothing loops */
int n_post_smooth; /* no of smoothing loops */
int mg_levels; /* current no. of levels */
int exact_level; /* level for exact_solver */
int max_iter; /* max. no of MG iter's */
int info;
int (*init_multi_grid)(MULTI_GRID_INFO *mg_info);
void (*pre_smooth)(MULTI_GRID_INFO *mg_info, int level, int n);
void (*in_smooth)(MULTI_GRID_INFO *mg_info, int level, int n);
void (*post_smooth)(MULTI_GRID_INFO *mg_info, int level, int n);
void (*mg_restrict)(MULTI_GRID_INFO *mg_info, int level);
void (*mg_prolongate)(MULTI_GRID_INFO *mg_info, int level);
void (*exact_solver)(MULTI_GRID_INFO *mg_info, int level);
REAL (*mg_resid)(MULTI_GRID_INFO *mg_info, int level);
void (*exit_multi_grid)(MULTI_GRID_INFO *mg_info);
void *data; /* application dep. data */
};
int MG(MULTI_GRID_INFO *mg_info);
/*******************************************************************************
* concrete multigrid
******************************************************************************/
typedef struct mg_s_info MG_S_INFO;
struct mg_s_info
{
MULTI_GRID_INFO *mg_info; /* abstract MG info */
const FE_SPACE *fe_space;
const DOF_ADMIN *vertex_admin;
DOF_MATRIX *mat;
const DOF_REAL_VEC *f;
DOF_REAL_VEC *u;
const DOF_SCHAR_VEC *bound;
int smoother, exact_solver;
REAL smooth_omega, exact_omega;
int size; /* current size of vectors*/
DOF_MATRIX **matrix; /* one for each level */
REAL **f_h; /* one for each level */
REAL **u_h; /* one for each level */
REAL **r_h; /* one for each level */
int *dofs_per_level; /* count dofs per level */
int sort_size; /* size of sort vectors */
DOF *sort_dof; /* dofs in order of levels*/
DOF *(dof_parent[2]); /* (for linear elements) */
U_CHAR *dof_level;
S_CHAR *sort_bound; /* sorted bound */
int sort_invers_size; /* size of inv. sort list */
int *sort_dof_invers; /* inverse sort list */
};
/*******************************************************************************
* sort_dof[ sorted dof ] = unsorted dof
* sort_dof_invers[ unsorted dof ] = sorted dof
******************************************************************************/
/* file MG_s1.c DOF_sort routines *********************************************/
void MG_s_setup_levels(MG_S_INFO *mg_s_info);
void MG_s_setup_mat_b(MG_S_INFO *mg_s_info,
DOF_MATRIX *mat, const DOF_SCHAR_VEC *bound);
void MG_s_dof_copy_to_sparse(MG_S_INFO *mg_s_info,
const DOF_REAL_VEC *x, REAL *y);
void MG_s_dof_copy_from_sparse(MG_S_INFO *mg_s_info,
const REAL *x, DOF_REAL_VEC *y);
void MG_s_reset_mat(MG_S_INFO *mg_s_info);
void MG_s_sort_mat(MG_S_INFO *mg_s_info);
void MG_s_free_mem(MG_S_INFO *mg_s_info);
/* file MG_s2.c: DOF_sort independent routines ********************************/
void MG_s_restrict_mg_matrices(MG_S_INFO *mg_s_info);
void MG_s_restrict(MULTI_GRID_INFO *mg_info, int mg_level);
void MG_s_prolongate(MULTI_GRID_INFO *mg_info, int mg_level);
REAL MG_s_resid(MULTI_GRID_INFO *mg_info, int mg_level);
void MG_s_smoother(MULTI_GRID_INFO *mg_info, int mg_level, int n);
void MG_s_exact_solver(MULTI_GRID_INFO *mg_info, int mg_level);
void MG_s_gemv(MG_S_INFO *mg_s_info, int mg_level, MatrixTranspose transpose,
REAL alpha, DOF_MATRIX *a, REAL *x, REAL beta, REAL *y);
/* file MG_s.c: ***************************************************************/
int mg_s(DOF_MATRIX *matrix, DOF_REAL_VEC *u, const DOF_REAL_VEC *f,
const DOF_SCHAR_VEC *bound,
REAL tol, int max_iter, int info, char *prefix);
MG_S_INFO *mg_s_init(DOF_MATRIX *matrix, const DOF_SCHAR_VEC *bound,
int info, char *prefix);
int mg_s_solve(MG_S_INFO *mg_s_info,
DOF_REAL_VEC *u, const DOF_REAL_VEC *f, REAL tol, int max_iter);
void mg_s_exit(MG_S_INFO *mg_s_info);
/*******************************************************************************
* Graphic output Definitions
******************************************************************************/
typedef void * GRAPH_WINDOW;
typedef float GRAPH_RGBCOLOR[3];
/** flags used by graph_mesh(): ****/
#define GRAPH_MESH_BOUNDARY 1
#define GRAPH_MESH_ELEMENT_MARK 2
#define GRAPH_MESH_VERTEX_DOF 4
#define GRAPH_MESH_ELEMENT_INDEX 8
/*******************************************************************************
* very useful macro definitons
******************************************************************************/
#define GET_MESH(dim, name, macro_data, init_node_proj, init_wall_trafo) \
check_and_get_mesh((dim), DIM_OF_WORLD, ALBERTA_DEBUG, \
ALBERTA_VERSION, (name), (macro_data), \
(init_node_proj), (init_wall_trafo))
#define GET_DOF_VEC(ptr, dof_vec) \
{ \
DEBUG_TEST_EXIT((dof_vec) && (dof_vec)->vec, \
"%s == NULL\n", (dof_vec) ? NAME(dof_vec) : #dof_vec); \
(ptr) = (dof_vec)->vec; \
}
/*******************************************************************************
* defined in graphXO.c
******************************************************************************/
extern const GRAPH_RGBCOLOR rgb_black;
extern const GRAPH_RGBCOLOR rgb_white;
extern const GRAPH_RGBCOLOR rgb_red;
extern const GRAPH_RGBCOLOR rgb_green;
extern const GRAPH_RGBCOLOR rgb_blue;
extern const GRAPH_RGBCOLOR rgb_yellow;
extern const GRAPH_RGBCOLOR rgb_magenta;
extern const GRAPH_RGBCOLOR rgb_cyan;
extern const GRAPH_RGBCOLOR rgb_grey50;
extern const GRAPH_RGBCOLOR rgb_albert;
extern const GRAPH_RGBCOLOR rgb_alberta;
/*******************************************************************************
* used in wall_quad
******************************************************************************/
/* A collection of quadrature rules for the integration over walls
* (3d: faces, 2d: edges) of a simplex.
*
* Each of the quadrature rules WALL_QUAD::quad[wall] may have its
* own INIT_ELEMENT method.
*
* INIT_ELEMENT(el_info, WALL_QUAD) may or may not be called: it is
* legal to only call INIT_ELEMENT(el_info, WALL_QUAD::quad[wall)
* individually.
*
* If INIT_ELEMENT(el_info, WALL_QUAD) is called, then it has to
* initialize all quadrature rules for all walls, so the sub-ordinate
* initializers need not be called in this case.
*/
struct wall_quadrature
{
const char *name;
int degree;
int dim;
int n_points_max;
QUAD quad[N_WALLS_MAX];
INIT_ELEMENT_DECL;
void *metadata;
};
/* Convenience structure for WALL_QUAD: its is legal to call
*
* get_quad_fast(bas_fcts, WALL_QUAD::quad[wall], ...)
*
* individually, however
*
* get_wall_quad_fast()
*
* does this in a single run.
*
* If INIT_ELEMENT(el_info, WALL_QUAD_FAST) is called, then the
* sub-ordinate initializers
* INIT_ELEMENT(el_info,WALL_QUAD_FAST::quad_fast[wall]) need not be
* called.
*/
struct wall_quad_fast
{
const WALL_QUAD *wall_quad;
const BAS_FCTS *bas_fcts;
FLAGS init_flag;
const QUAD_FAST *quad_fast[N_WALLS_MAX];
INIT_ELEMENT_DECL;
};
/* initialize the meta-data for the given WALL_QUAD, no need to call
* this if the WALL_QUAD has been aquired by get_wall_quad(), only
* needed for externally defined extension quadrature rules.
*/
extern void register_wall_quadrature(WALL_QUAD *wall_quad);
/* Return a suitable quadrature for integrating over the given wall
* (neigh number), but the barycentric co-ordinates of QUAD->lambda
* are relative to the neighbour element.
*/
extern const QUAD *get_neigh_quad(const EL_INFO *el_info,
const WALL_QUAD *wall_quad,
int neigh);
/* Return a suitable QUAD_FAST structure for integrating over the
* given wall, but relative to the neighbour element. If the returned
* QUAD_FAST object has a per-element initializer, then it must be
* called with an EL_INFO structure for the neighbour element.
*
* It is also legal to just call
*
* get_quad_fast(bas_fcts, get_neigh_quad(el_info, wall_quad, neigh), ...)
*
* but get_neigh_quad_fast() is slightly more efficient.
*/
const QUAD_FAST *get_neigh_quad_fast(const EL_INFO *el_info,
const WALL_QUAD_FAST *wqfast,
int neigh);
/*******************************************************************************
* functions supplied by ALBERTA
******************************************************************************/
/*** file coarsen.c *******************************************************/
extern U_CHAR coarsen(MESH *mesh, FLAGS fill_flags);
extern U_CHAR global_coarsen(MESH *mesh, int no, FLAGS fill_flags);
extern int get_max_level(MESH *mesh);
/*** file dof_admin.c *****************************************************/
extern void free_dof_index(DOF_ADMIN *admin, int dof);
extern DOF get_dof_index(DOF_ADMIN *admin);
extern void enlarge_dof_lists(DOF_ADMIN *admin, int minsize);
extern const DOF_ADMIN *get_vertex_admin(MESH *mesh, FLAGS flags);
extern void test_dof_matrix(DOF_MATRIX *matrix);
extern void dof_matrix_set_diagonal(DOF_MATRIX *matrix, bool diag);
extern void dof_matrix_try_diagonal(DOF_MATRIX *matrix);
extern void add_element_matrix(DOF_MATRIX *matrix,
REAL factor,
const EL_MATRIX *el_matrix,
MatrixTranspose transpose,
const EL_DOF_VEC *row_dof,
const EL_DOF_VEC *col_dof,
const EL_SCHAR_VEC *bound);
extern void add_element_vec(DOF_REAL_VEC *drv, REAL factor,
const EL_REAL_VEC *el_vec,
const EL_DOF_VEC *dof,
const EL_SCHAR_VEC *bound);
extern void add_element_d_vec(DOF_REAL_D_VEC *drdv, REAL factor,
const EL_REAL_D_VEC *el_vec,
const EL_DOF_VEC *dof,
const EL_SCHAR_VEC *bound);
extern void add_element_vec_dow(DOF_REAL_VEC_D *drdv, REAL factor,
const EL_REAL_VEC_D *el_vec,
const EL_DOF_VEC *dof,
const EL_SCHAR_VEC *bound);
extern void update_matrix(DOF_MATRIX *dof_matrix,
const EL_MATRIX_INFO *minfo,
MatrixTranspose transpose);
void update_real_vec(DOF_REAL_VEC *drv, const EL_VEC_INFO *vec_info);
void update_real_d_vec(DOF_REAL_D_VEC *drdv, const EL_VEC_D_INFO *vecd_info);
void update_real_vec_dow(DOF_REAL_VEC_D *drdv, const EL_VEC_INFO_D *vecd_info);
extern void dof_compress(MESH *mesh);
extern void add_dof_compress_hook(const DOF_ADMIN *admin, DOF_COMP_HOOK *hook);
extern void del_dof_compress_hook(DOF_COMP_HOOK *hook);
extern void clear_dof_matrix(DOF_MATRIX *matrix);
extern void print_dof_matrix(const DOF_MATRIX *matrix);
extern void print_dof_real_vec(const DOF_REAL_VEC *drv);
extern void print_dof_real_d_vec(const DOF_REAL_D_VEC *drdv);
extern void print_dof_real_dd_vec(const DOF_REAL_DD_VEC *drdv);
extern void print_dof_real_vec_dow(const DOF_REAL_VEC_D *drvd);
extern void print_real_vec_maple(REAL *vector, int size, const char *vec_name);
extern void print_dof_real_vec_maple(const DOF_REAL_VEC *drv,
const char *vec_name);
extern void print_dof_real_d_vec_maple(const DOF_REAL_D_VEC *drdv,
const char *vec_name);
extern void print_dof_real_vec_dow_maple(const DOF_REAL_VEC_D *drvd,
const char *vec_name);
extern void print_dof_matrix_maple(const DOF_MATRIX *matrix,
const char *matrix_name);
extern void fprint_real_vec_maple(FILE *fp,
REAL *vector, int size, const char *vec_name);
extern void fprint_dof_real_vec_maple(FILE *fp,
const DOF_REAL_VEC *drv,
const char *vec_name);
extern void fprint_dof_real_d_vec_maple(FILE *fp,
const DOF_REAL_D_VEC *drdv,
const char *vec_name);
extern void fprint_dof_real_vec_dow_maple(FILE *fp,
const DOF_REAL_VEC_D *drvd,
const char *vec_name);
extern void fprint_dof_matrix_maple(FILE *fp,
const DOF_MATRIX *matrix,
const char *matrix_name);
extern void file_print_real_vec_maple(const char *file_name, const char *mode,
REAL *vector, int size,
const char *vec_name);
extern void file_print_dof_real_vec_maple(const char *file_name,
const char *mode,
const DOF_REAL_VEC *drv,
const char *vec_name);
extern void file_print_dof_real_d_vec_maple(const char *file_name,
const char *mode,
const DOF_REAL_D_VEC *drdv,
const char *vec_name);
extern void file_print_dof_real_vec_dow_maple(const char *file_name,
const char *mode,
const DOF_REAL_VEC_D *drvd,
const char *vec_name);
extern void file_print_dof_matrix_maple(const char *file_name,
const char *mode,
const DOF_MATRIX *matrix,
const char *matrix_name);
extern void print_dof_ptr_vec(const DOF_PTR_VEC *dpv);
extern void print_dof_int_vec(const DOF_INT_VEC *div);
extern void print_dof_uchar_vec(const DOF_UCHAR_VEC *div);
extern void print_dof_schar_vec(const DOF_SCHAR_VEC *div);
/* BLAS 1 */
extern REAL dof_nrm2(const DOF_REAL_VEC *x);
extern REAL dof_asum(const DOF_REAL_VEC *x);
extern void dof_set(REAL alpha, DOF_REAL_VEC *x);
extern void dof_scal(REAL alpha, DOF_REAL_VEC *x);
extern REAL dof_dot(const DOF_REAL_VEC *x, const DOF_REAL_VEC *y);
extern void dof_copy(const DOF_REAL_VEC *x, DOF_REAL_VEC *y);
extern void dof_axpy(REAL alpha, const DOF_REAL_VEC *x, DOF_REAL_VEC *y);
/* some non BLAS */
extern void dof_xpay(REAL alpha, const DOF_REAL_VEC *x, DOF_REAL_VEC *y);
extern REAL dof_min(const DOF_REAL_VEC *x);
extern REAL dof_max(const DOF_REAL_VEC *x);
/* BLAS 2 */
extern void dof_gemv(MatrixTranspose transpose, REAL alpha,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC *x,
REAL beta, DOF_REAL_VEC *y);
extern void dof_mv(MatrixTranspose transpose,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC *x, DOF_REAL_VEC *y);
/* now the same for REAL_D */
extern void dof_axpy_d(REAL alpha, const DOF_REAL_D_VEC *x, DOF_REAL_D_VEC *y);
extern void dof_copy_d(const DOF_REAL_D_VEC *x, DOF_REAL_D_VEC *y);
extern REAL dof_dot_d(const DOF_REAL_D_VEC *x, const DOF_REAL_D_VEC *y);
extern REAL dof_nrm2_d(const DOF_REAL_D_VEC *x);
extern REAL dof_asum_d(const DOF_REAL_D_VEC *x);
extern void dof_scal_d(REAL alpha, DOF_REAL_D_VEC *x);
extern void dof_set_d(REAL alpha, DOF_REAL_D_VEC *x);
extern void dof_xpay_d(REAL alpha, const DOF_REAL_D_VEC *x, DOF_REAL_D_VEC *y);
extern REAL dof_min_d(const DOF_REAL_D_VEC *x);
extern REAL dof_max_d(const DOF_REAL_D_VEC *x);
extern void
dof_axpy_dow(REAL alpha, const DOF_REAL_VEC_D *x, DOF_REAL_VEC_D *y);
extern void dof_copy_dow(const DOF_REAL_VEC_D *x, DOF_REAL_VEC_D *y);
extern REAL dof_dot_dow(const DOF_REAL_VEC_D *x, const DOF_REAL_VEC_D *y);
extern REAL dof_nrm2_dow(const DOF_REAL_VEC_D *x);
extern REAL dof_asum_dow(const DOF_REAL_VEC_D *x);
extern void dof_scal_dow(REAL alpha, DOF_REAL_VEC_D *x);
extern void dof_set_dow(REAL alpha, DOF_REAL_VEC_D *x);
extern void
dof_xpay_dow(REAL alpha, const DOF_REAL_VEC_D *x, DOF_REAL_VEC_D *y);
extern REAL dof_min_dow(const DOF_REAL_VEC_D *x);
extern REAL dof_max_dow(const DOF_REAL_VEC_D *x);
/* BLAS 2 for REAL_D */
extern void dof_gemv_d(MatrixTranspose transpose, REAL alpha,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_D_VEC *x,
REAL beta, DOF_REAL_D_VEC *y);
extern void dof_gemv_rdr(MatrixTranspose transpose, REAL alpha,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC *x,
REAL beta, DOF_REAL_D_VEC *y);
extern void dof_gemv_rrd(MatrixTranspose transpose, REAL alpha,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_D_VEC *x,
REAL beta, DOF_REAL_VEC *y);
extern void dof_mv_d(MatrixTranspose transpose,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_D_VEC *x, DOF_REAL_D_VEC *y);
extern void dof_mv_rdr(MatrixTranspose transpose,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC *x,
DOF_REAL_D_VEC *y);
extern void dof_mv_rrd(MatrixTranspose transpose,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_D_VEC *x,
DOF_REAL_VEC *y);
extern void dof_gemv_dow(MatrixTranspose transpose, REAL alpha,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC_D *x,
REAL beta, DOF_REAL_VEC_D *y);
extern void dof_gemv_dow_scl(MatrixTranspose transpose, REAL alpha,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC *x,
REAL beta, DOF_REAL_VEC_D *y);
extern void dof_gemv_scl_dow(MatrixTranspose transpose, REAL alpha,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC_D *x,
REAL beta, DOF_REAL_VEC *y);
extern void dof_mv_dow(MatrixTranspose transpose,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC_D *x, DOF_REAL_VEC_D *y);
extern void dof_mv_dow_scl(MatrixTranspose transpose,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC *x,
DOF_REAL_VEC_D *y);
extern void dof_mv_scl_dow(MatrixTranspose transpose,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *mask,
const DOF_REAL_VEC_D *x,
DOF_REAL_VEC *y);
/* copy operation for DOF_MATRIXes */
extern void dof_matrix_copy(DOF_MATRIX *dst, const DOF_MATRIX *src);
/* low-level administration routines, use with caution */
extern void add_dof_matrix_to_admin(DOF_MATRIX *, DOF_ADMIN *);
extern void add_dof_int_vec_to_admin(DOF_INT_VEC *, DOF_ADMIN *);
extern void add_int_dof_vec_to_admin(DOF_DOF_VEC *, DOF_ADMIN *);
extern void add_dof_dof_vec_to_admin(DOF_DOF_VEC *, DOF_ADMIN *);
extern void add_dof_uchar_vec_to_admin(DOF_UCHAR_VEC *, DOF_ADMIN *);
extern void add_dof_schar_vec_to_admin(DOF_SCHAR_VEC *, DOF_ADMIN *);
extern void add_dof_real_vec_to_admin(DOF_REAL_VEC *, DOF_ADMIN *);
extern void add_dof_real_d_vec_to_admin(DOF_REAL_D_VEC *, DOF_ADMIN *);
extern void add_dof_real_dd_vec_to_admin(DOF_REAL_DD_VEC *, DOF_ADMIN *);
extern void add_dof_ptr_vec_to_admin(DOF_PTR_VEC *, DOF_ADMIN *);
extern void remove_dof_matrix_from_admin(DOF_MATRIX *);
extern void remove_dof_int_vec_from_admin(DOF_INT_VEC *);
extern void remove_dof_dof_vec_from_admin(DOF_DOF_VEC *);
extern void remove_int_dof_vec_from_admin(DOF_DOF_VEC *);
extern void remove_dof_uchar_vec_from_admin(DOF_UCHAR_VEC *);
extern void remove_dof_schar_vec_from_admin(DOF_SCHAR_VEC *);
extern void remove_dof_real_vec_from_admin(DOF_REAL_VEC *);
extern void remove_dof_real_vec_from_admin(DOF_REAL_VEC *);
extern void remove_dof_real_d_vec_from_admin(DOF_REAL_D_VEC *);
extern void remove_dof_real_dd_vec_from_admin(DOF_REAL_DD_VEC *);
extern void remove_dof_ptr_vec_from_admin(DOF_PTR_VEC *);
/*** file wall_quad.c *****************************************************/
extern const WALL_QUAD *wall_quad_from_quad(const QUAD *quad);
extern const WALL_QUAD *get_wall_quad(int dim, int degree);
extern const WALL_QUAD_FAST *
get_wall_quad_fast(const BAS_FCTS *, const WALL_QUAD *, FLAGS init_flag);
extern const QUAD *get_neigh_quad(const EL_INFO *el_info,
const WALL_QUAD *wall_quad,
int wall);
extern const QUAD_FAST *get_neigh_quad_fast(const EL_INFO *el_info,
const WALL_QUAD_FAST *bndry_qfast,
int wall);
/*** file macro.c *********************************************************/
extern void macro_test(MACRO_DATA *data, const char *new_filename);
extern MACRO_DATA *read_macro(const char *name);
extern MACRO_DATA *read_macro_bin(const char *name);
extern MACRO_DATA *read_macro_xdr(const char *name);
extern bool write_macro(MESH *mesh, const char *name);
extern bool write_macro_bin(MESH *mesh, const char *name);
extern bool write_macro_xdr(MESH *mesh, const char *name);
extern bool write_macro_data(MACRO_DATA *data, const char *name);
extern bool write_macro_data_bin(MACRO_DATA *data, const char *name);
extern bool write_macro_data_xdr(MACRO_DATA *data, const char *name);
extern MACRO_DATA *alloc_macro_data(int dim, int nv, int ne);
extern void free_macro_data(MACRO_DATA *data);
extern void compute_neigh_fast(MACRO_DATA *data);
extern void default_boundary(MACRO_DATA *data, U_CHAR type, bool overwrite);
extern MACRO_DATA *mesh2macro_data(MESH *mesh);
extern void
macro_data2mesh(MESH *mesh, const MACRO_DATA *data,
NODE_PROJECTION *(*n_proj)(MESH *,MACRO_EL *,int),
AFF_TRAFO *(*init_wall_trafos)(MESH *, MACRO_EL *, int wall));
/*** file memory.c ********************************************************/
extern MESH *
check_and_get_mesh(int dim, int dow, int neigh,
const char *version, const char *name,
const MACRO_DATA *macro_data,
NODE_PROJ *(*init_node_proj)(MESH *, MACRO_EL *, int),
AFF_TRAFO *(*init_wall_trafo)(MESH *, MACRO_EL *, int wall));
extern void free_dof_admin(DOF_ADMIN *admin, MESH *mesh);
extern void free_int_dof_vec(DOF_DOF_VEC *vec);
extern void free_dof_int_vec(DOF_INT_VEC *vec);
extern void free_dof_dof_vec(DOF_DOF_VEC *vec);
extern void free_dof_matrix(DOF_MATRIX *mat);
extern void free_dof_real_vec(DOF_REAL_VEC *vec);
extern void free_dof_real_d_vec(DOF_REAL_D_VEC *vec);
extern void free_dof_real_dd_vec(DOF_REAL_DD_VEC *vec);
extern void free_dof_real_vec_d(DOF_REAL_VEC_D *vec);
extern void free_dof_schar_vec(DOF_SCHAR_VEC *vec);
extern void free_dof_uchar_vec(DOF_UCHAR_VEC *vec);
extern void free_dof_ptr_vec(DOF_PTR_VEC *vec);
extern void free_fe_space(const FE_SPACE *fe_space);
extern void free_real_d(MESH *mesh, REAL *ptr);
extern void free_matrix_row(const FE_SPACE *, MATRIX_ROW *);
extern void free_real_matrix_row(const FE_SPACE *, MATRIX_ROW_REAL *);
extern void free_real_d_matrix_row(const FE_SPACE *, MATRIX_ROW_REAL_D *);
extern void free_real_dd_matrix_row(const FE_SPACE *, MATRIX_ROW_REAL_DD *);
extern void free_element(EL *el, MESH *mesh);
extern void free_rc_list(MESH *mesh, RC_LIST_EL *list); /* only for 3D */
extern void free_mesh(MESH *);
extern void free_dof(DOF *dof, MESH *mesh, int position, FLAGS flags);
extern DOF *get_dof(MESH *mesh, int position);
extern DOF *get_periodic_dof(MESH *mesh, int position,
const DOF *twin);
extern const FE_SPACE *copy_fe_space(const FE_SPACE *fe_space);
extern const FE_SPACE *clone_fe_space(const FE_SPACE *fe_space, int rdim);
extern const FE_SPACE *get_fe_space(MESH *mesh,
const char *name,
const BAS_FCTS *bas_fcts,
int rdim,
FLAGS adm_flags);
extern const FE_SPACE *get_dof_space(MESH *mesh, const char *name,
const int ndof[N_NODE_TYPES],
FLAGS adm_flags);
extern DOF_INT_VEC *get_dof_int_vec(const char *name, const FE_SPACE *);
extern DOF_DOF_VEC *get_int_dof_vec(const char *name, const FE_SPACE *);
extern DOF_DOF_VEC *get_dof_dof_vec(const char *name, const FE_SPACE *);
extern DOF_MATRIX *get_dof_matrix(const char *name,
const FE_SPACE *row_fe_space,
const FE_SPACE *col_fe_space);
extern DOF_REAL_VEC *get_dof_real_vec(const char *name, const FE_SPACE *);
extern DOF_REAL_D_VEC *get_dof_real_d_vec(const char *name, const FE_SPACE *);
extern DOF_REAL_DD_VEC *get_dof_real_dd_vec(const char *name, const FE_SPACE *);
extern DOF_REAL_VEC_D *get_dof_real_vec_d(const char *name, const FE_SPACE *);
extern DOF_SCHAR_VEC *get_dof_schar_vec(const char *name, const FE_SPACE *);
extern DOF_UCHAR_VEC *get_dof_uchar_vec(const char *name, const FE_SPACE *);
extern DOF_PTR_VEC *get_dof_ptr_vec(const char *name, const FE_SPACE *);
extern REAL *get_real_d(MESH *mesh);
extern MATRIX_ROW *get_matrix_row(const FE_SPACE *, MATENT_TYPE type);
extern EL *get_element(MESH *mesh);
extern RC_LIST_EL *get_rc_list(MESH *mesh); /* only for 3D */
extern size_t init_leaf_data(MESH *mesh, size_t size,
void (*refine_leaf_data)(EL *parent,
EL *child[2]),
void (*coarsen_leaf_data)(EL *parent,
EL *child[2]));
extern EL_MATRIX *get_el_matrix(const FE_SPACE *row_fe_space,
const FE_SPACE *col_fe_space,
MATENT_TYPE op_type);
extern void free_el_matrix(EL_MATRIX *el_mat);
extern void print_el_matrix(const EL_MATRIX *el_mat);
extern EL_INT_VEC *get_el_int_vec(const BAS_FCTS *bas_fcts);
extern void free_el_int_vec(EL_INT_VEC *el_vec);
extern EL_DOF_VEC *get_el_dof_vec(const BAS_FCTS *bas_fcts);
extern void free_el_dof_vec(EL_DOF_VEC *el_vec);
extern EL_UCHAR_VEC *get_el_uchar_vec(const BAS_FCTS *bas_fcts);
extern void free_el_uchar_vec(EL_UCHAR_VEC *el_vec);
extern EL_SCHAR_VEC *get_el_schar_vec(const BAS_FCTS *bas_fcts);
extern void free_el_schar_vec(EL_SCHAR_VEC *el_vec);
extern EL_BNDRY_VEC *get_el_bndry_vec(const BAS_FCTS *bas_fcts);
extern void free_el_bndry_vec(EL_BNDRY_VEC *el_vec);
extern EL_PTR_VEC *get_el_ptr_vec(const BAS_FCTS *bas_fcts);
extern void free_el_ptr_vec(EL_PTR_VEC *el_vec);
extern EL_REAL_VEC *get_el_real_vec(const BAS_FCTS *bas_fcts);
extern void free_el_real_vec(EL_REAL_VEC *el_vec);
extern EL_REAL_D_VEC *get_el_real_d_vec(const BAS_FCTS *bas_fcts);
extern void free_el_real_d_vec(EL_REAL_D_VEC *el_vec);
extern EL_REAL_DD_VEC *get_el_real_dd_vec(const BAS_FCTS *bas_fcts);
extern void free_el_real_dd_vec(EL_REAL_DD_VEC *el_vec);
extern EL_REAL_VEC_D *get_el_real_vec_d(const BAS_FCTS *bas_fcts);
extern void free_el_real_vec_d(EL_REAL_VEC_D *el_vec);
/*** file submesh.c ********************************************************/
extern MESH *get_submesh(MESH *master, const char *name,
bool (*binding_method)(MESH *master, MACRO_EL *el,
int wall, void *data),
void *data);
extern MESH *get_bndry_submesh(MESH *master, const char *name);
extern MESH *read_bndry_submesh_xdr(MESH *master, const char *slave_filename);
extern MESH *get_bndry_submesh_by_type(MESH *master, const char *name,
BNDRY_TYPE type);
extern MESH *read_bndry_submesh_by_type_xdr(MESH *master,
const char *slave_filename,
BNDRY_TYPE type);
extern MESH *get_bndry_submesh_by_segment(MESH *master,
const char *name,
const BNDRY_FLAGS segment);
extern MESH *read_bndry_submesh_by_segment(MESH *master,
const char *slave_filename,
const BNDRY_FLAGS segment);
extern MESH *read_bndry_submesh_by_segment_xdr(MESH *master,
const char *slave_filename,
const BNDRY_FLAGS segment);
extern
MESH *lookup_submesh_by_binding(MESH *master,
bool (*binding_method)(MESH *master,
MACRO_EL *el, int wall,
void *data),
void *data);
extern
MESH *lookup_bndry_submesh_by_type(MESH *master, BNDRY_TYPE type);
extern
MESH *lookup_bndry_submesh_by_segment(MESH *master, const BNDRY_FLAGS segment);
extern
MESH *lookup_bndry_submesh(MESH *master);
extern void unchain_submesh(MESH *slave);
extern void bind_submesh(MESH *master,
MESH *slave,
bool (*binding_method)(MESH *master, MACRO_EL *el,
int wall, void *data),
void *data);
extern MESH *read_submesh(MESH *master,
const char *slave_filename,
bool (*binding_method)(MESH *master, MACRO_EL *el,
int wall, void *data),
void *data);
extern MESH *read_submesh_xdr(MESH *master,
const char *slave_filename,
bool (*binding_method)(MESH *master, MACRO_EL *el,
int wall, void *data),
void *data);
extern MESH *lookup_submesh_by_id(MESH *mesh, int id);
extern MESH *lookup_submesh_by_name(MESH *mesh, const char *name);
extern void get_slave_dof_mapping(const FE_SPACE *m_fe_space,
DOF_INT_VEC *s_map);
extern MESH *get_master(MESH *slave);
extern const EL_DOF_VEC *get_master_dof_indices(EL_DOF_VEC *result,
const EL_INFO *s_el_info,
const FE_SPACE *m_fe_space);
extern const EL_BNDRY_VEC *get_master_bound(EL_BNDRY_VEC *result,
const EL_INFO *s_el_info,
const BAS_FCTS *m_bas_fcts);
extern void
fill_master_el_info(EL_INFO *mst_el_info,
const EL_INFO *slv_el_info, FLAGS fill_flags);
extern const EL *get_slave_el(const EL *el, int wall, MESH *trace_mesh);
extern void fill_slave_el_info(EL_INFO *slv_el_info,
const EL_INFO *el_info, int wall,
MESH *trace_mesh);
void trace_to_bulk_coords_2d(REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info);
void trace_to_bulk_coords_1d(REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info);
void trace_to_bulk_coords_0d(REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info);
void bulk_to_trace_coords_2d(REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info);
void bulk_to_trace_coords_1d(REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info);
void bulk_to_trace_coords_0d(REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info);
static inline
void trace_to_bulk_coords(REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info)
{
FUNCNAME("trace_to_bulk_coords");
switch (el_info->mesh->dim) {
case 2: trace_to_bulk_coords_2d(result, lambda, el_info); break;
case 1: trace_to_bulk_coords_1d(result, lambda, el_info); break;
case 0: trace_to_bulk_coords_0d(result, lambda, el_info); break;
default:
ERROR_EXIT("Illegal dimension: %d\n", el_info->mesh->dim);
break;
}
}
static inline
void trace_to_bulk_coords_dim(int dim,
REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info)
{
FUNCNAME("trace_to_bulk_coords_dim");
switch (dim) {
case 2: trace_to_bulk_coords_2d(result, lambda, el_info); break;
case 1: trace_to_bulk_coords_1d(result, lambda, el_info); break;
case 0: trace_to_bulk_coords_0d(result, lambda, el_info); break;
default:
ERROR_EXIT("Illegal dimension: %d\n", el_info->mesh->dim);
break;
}
}
static inline
void bulk_to_trace_coords(REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info)
{
FUNCNAME("bulk_to_trace_coords");
switch (el_info->mesh->dim) {
case 2: bulk_to_trace_coords_2d(result, lambda, el_info); break;
case 1: bulk_to_trace_coords_1d(result, lambda, el_info); break;
case 0: bulk_to_trace_coords_0d(result, lambda, el_info); break;
default:
ERROR_EXIT("Illegal dimension: %d\n", el_info->mesh->dim);
break;
}
}
static inline
void bulk_to_trace_coords_dim(int dim,
REAL_B result,
const REAL_B lambda,
const EL_INFO *el_info)
{
FUNCNAME("bulk_to_trace_coords_dim");
switch (dim) {
case 2: bulk_to_trace_coords_2d(result, lambda, el_info); break;
case 1: bulk_to_trace_coords_1d(result, lambda, el_info); break;
case 0: bulk_to_trace_coords_0d(result, lambda, el_info); break;
default:
ERROR_EXIT("Illegal dimension: %d\n", el_info->mesh->dim);
break;
}
}
#define TRACE_DOF_VEC_PROTO(TYPE, typename) \
extern void trace_##typename##_vec(DOF_##TYPE##_VEC *svec, \
const DOF_##TYPE##_VEC *mvec)
TRACE_DOF_VEC_PROTO(REAL, dof_real);
TRACE_DOF_VEC_PROTO(REAL_D, dof_real_d);
TRACE_DOF_VEC_PROTO(INT, dof_int);
TRACE_DOF_VEC_PROTO(DOF, dof_dof);
TRACE_DOF_VEC_PROTO(DOF, int_dof);
TRACE_DOF_VEC_PROTO(UCHAR, dof_uchar);
TRACE_DOF_VEC_PROTO(SCHAR, dof_schar);
TRACE_DOF_VEC_PROTO(PTR, dof_ptr);
extern
void trace_dof_real_vec_d(DOF_REAL_VEC_D *svec, const DOF_REAL_VEC_D *mvec);
extern void update_master_matrix(DOF_MATRIX *m_dof_matrix,
const EL_MATRIX_INFO *s_minfo,
MatrixTranspose transpose);
extern void update_master_real_vec(DOF_REAL_VEC *m_drv,
const EL_VEC_INFO *s_vec_info);
extern void update_master_real_d_vec(DOF_REAL_D_VEC *m_drdv,
const EL_VEC_D_INFO *s_vecd_info);
/*** file level.c ********************************************************/
extern REAL level_element_det_2d(const REAL_D coord[]);
extern void level_coord_to_world_2d(const REAL_D coord[],
const REAL_B lambda,
REAL_D world);
extern void level_coord_to_el_coord_2d(const REAL_B v_lambda[],
const REAL_B lambda,
REAL_B el_lambda);
extern REAL level_element_det_3d(const REAL_D coord[]);
extern void level_coord_to_world_3d(const REAL_D coord[],
const REAL_B lambda,
REAL_D world);
extern void level_coord_to_el_coord_3d(const REAL_B v_lambda[],
const REAL_B lambda,
REAL_B el_lambda);
extern int find_level(MESH *mesh, FLAGS fill_flag, const DOF_REAL_VEC *Level,
REAL value,
int (*init)(const EL_INFO *el_info,
REAL v[],
int N, int wall, const REAL_B lambda[]),
void (*cal)(const EL_INFO *el_info,
REAL v[],
int i,
int wall, const REAL_B lambda[],
const REAL_D coord[]));
extern void set_element_mark(MESH *mesh, FLAGS fill_flag, S_CHAR mark);
/*** file numint.c ********************************************************/
const QUAD *get_quadrature(int dim, int degree);
void register_quadrature(QUAD *quad);
bool new_quadrature(const QUAD *quad);
const QUAD *get_product_quad(const QUAD *quad);
const QUAD *get_lumping_quadrature(int dim);
static inline const QUAD_EL_CACHE *fill_quad_el_cache(const EL_INFO *el_info,
const QUAD *quad,
FLAGS need);
void print_quadrature(const QUAD *quad);
void check_quadrature(const QUAD *quad);
REAL integrate_std_simp(const QUAD *quad, REAL (*f)(const REAL_B lambda));
static inline
const REAL *f_at_qp(REAL quad_vec[],
const QUAD *quad, REAL (*f)(const REAL_B lambda));
static inline
const REAL_D *f_d_at_qp(REAL_D quad_vec[],
const QUAD *quad,
const REAL *(*f)(const REAL_B lambda));
static inline
const REAL_D *grd_f_at_qp(REAL_D quad_vec[],
const QUAD *quad,
const REAL *(*grd_f)(const REAL_B lambda));
static inline
const REAL_DD *grd_f_d_at_qp(REAL_DD quad_vec[],
const QUAD *quad,
const REAL_D *(*grd_f)(const REAL_B lambda));
static inline
const REAL *fx_at_qp(REAL quad_vec[],
const EL_INFO *el_info,
const QUAD *quad, FCT_AT_X f);
static inline
const REAL_D *fx_d_at_qp(REAL_D quad_vec[],
const EL_INFO *el_info,
const QUAD *quad,
FCT_D_AT_X f);
static inline
const REAL_D *grd_fx_at_qp(REAL_D quad_vec[],
const EL_INFO *el_info,
const QUAD *quad,
GRD_FCT_AT_X grd_f);
static inline
const REAL_DD *grd_fx_d_at_qp(REAL_DD quad_vec[],
const EL_INFO *el_info,
const QUAD *quad,
GRD_FCT_D_AT_X grd_f);
static inline
const REAL *f_loc_at_qp(REAL quad_vec[],
const EL_INFO *el_info, const QUAD *quad,
LOC_FCT_AT_QP f_at_qp, void *ud);
static inline
const REAL_D *f_loc_d_at_qp(REAL_D quad_vec[],
const EL_INFO *el_info, const QUAD *quad,
LOC_FCT_D_AT_QP f_at_qp, void *ud);
static inline
const REAL_D *grd_f_loc_at_qp(REAL_D quad_vec[],
const EL_INFO *el_info, const QUAD *quad,
const REAL_BD Lambda,
GRD_LOC_FCT_AT_QP grd_f_at_qp, void *ud);
static inline
const REAL_DD *grd_f_loc_d_at_qp(REAL_DD quad_vec[],
const EL_INFO *el_info, const QUAD *quad,
const REAL_BD Lambda,
GRD_LOC_FCT_D_AT_QP grd_f_at_qp, void *ud);
static inline
const REAL_D *
param_grd_f_loc_at_qp(REAL_D quad_vec[],
const EL_INFO *el_info,
const QUAD *quad, const REAL_BD Lambda[],
GRD_LOC_FCT_AT_QP grd_f_at_qp, void *ud);
static inline
const REAL_DD *
param_grd_f_loc_d_at_qp(REAL_DD quad_vec[],
const EL_INFO *el_info,
const QUAD *quad, const REAL_BD Lambda[],
GRD_LOC_FCT_D_AT_QP grd_f_at_qp, void *ud);
const QUAD_FAST *get_quad_fast(const BAS_FCTS *, const QUAD *, FLAGS init_flag);
const REAL_D *const*get_quad_fast_phi_dow(const QUAD_FAST *cache);
const REAL_DB *const*get_quad_fast_grd_phi_dow(const QUAD_FAST *cache);
const REAL_DBB *const*get_quad_fast_D2_phi_dow(const QUAD_FAST *cache);
/*** file refine.c ********************************************************/
extern U_CHAR refine(MESH *mesh, FLAGS fill_flags);
extern U_CHAR global_refine(MESH *mesh, int mark, FLAGS fill_flags);
/******************************************************************************/
/*** file adapt.c *********************************************************/
extern void adapt_method_stat(MESH *mesh, ADAPT_STAT *adapt);
extern void adapt_method_instat(MESH *mesh, ADAPT_INSTAT *adapt);
extern int marking(MESH *mesh, ADAPT_STAT *adapt);
extern ADAPT_INSTAT *get_adapt_instat(int dim, const char *name,
const char *prefix,
int info, ADAPT_INSTAT *adapt_instat);
extern ADAPT_STAT *get_adapt_stat(int dim, const char *name,
const char *prefix,
int info, ADAPT_STAT *adapt_stat);
/*** file quad_cache.c ******************************************************/
extern const Q00_PSI_PHI *get_q00_psi_phi(const BAS_FCTS *psi,
const BAS_FCTS *phi,
const QUAD *quad);
extern const Q01_PSI_PHI *get_q01_psi_phi(const BAS_FCTS *psi,
const BAS_FCTS *phi,
const QUAD *quad);
extern const Q10_PSI_PHI *get_q10_psi_phi(const BAS_FCTS *psi,
const BAS_FCTS *phi,
const QUAD *quad);
extern const Q11_PSI_PHI *get_q11_psi_phi(const BAS_FCTS *psi,
const BAS_FCTS *phi,
const QUAD *quad);
extern const Q001_ETA_PSI_PHI *get_q001_eta_psi_phi(const BAS_FCTS *eta,
const BAS_FCTS *psi,
const BAS_FCTS *phi,
const QUAD *quad);
extern const Q010_ETA_PSI_PHI *get_q010_eta_psi_phi(const BAS_FCTS *eta,
const BAS_FCTS *psi,
const BAS_FCTS *phi,
const QUAD *quad);
extern const Q100_ETA_PSI_PHI *get_q100_eta_psi_phi(const BAS_FCTS *eta,
const BAS_FCTS *psi,
const BAS_FCTS *phi,
const QUAD *quad);
/*** file assemble.c ******************************************************/
extern const EL_MATRIX_INFO *fill_matrix_info(const OPERATOR_INFO *,
EL_MATRIX_INFO *res);
extern const EL_MATRIX_INFO *fill_matrix_info_ext(EL_MATRIX_INFO *res,
const OPERATOR_INFO *,
const BNDRY_OPERATOR_INFO *,
...);
extern const QUAD_TENSOR *get_quad_matrix(const FE_SPACE *row_fe_space,
const FE_SPACE *col_fe_space,
int krn_degree,
int n_derivatives);
extern const QUAD_TENSOR *get_quad_tensor(const FE_SPACE *row_fe_space,
const FE_SPACE *col_fe_space,
const FE_SPACE *depth_fe_space,
int krn_degree,
int n_derivatives);
extern void free_quad_tensor(const QUAD_TENSOR *qtensor);
/*** file assemble-instat.c ***********************************************/
extern EL_SYS_INFO_INSTAT *
fill_sys_info_instat(const OPERATOR_INFO *stiff_info,
const OPERATOR_INFO *mass_info,
const DOF_REAL_VEC *u_h);
extern EL_SYS_INFO_DOW_INSTAT *
fill_sys_info_instat_dow(const OPERATOR_INFO *stiff_info,
const OPERATOR_INFO *mass_info,
const DOF_REAL_VEC_D *u_h);
static inline EL_SYS_INFO_D_INSTAT *
fill_sys_info_instat_d(const OPERATOR_INFO *stiff_info,
const OPERATOR_INFO *mass_info,
const DOF_REAL_D_VEC *u_h)
{
return (EL_SYS_INFO_D_INSTAT *)
fill_sys_info_instat_dow(
stiff_info, mass_info, (const DOF_REAL_VEC_D *)u_h);
}
extern void free_sys_info_instat(EL_SYS_INFO_INSTAT *elsii);
extern void free_sys_info_d_instat(EL_SYS_INFO_D_INSTAT *elsii);
extern void update_system_instat(DOF_MATRIX *dof_matrix,
DOF_REAL_VEC *f_h,
REAL tau,
REAL theta,
EL_SYS_INFO_INSTAT *elsii);
extern void update_system_instat_dow(DOF_MATRIX *dof_matrix,
DOF_REAL_VEC_D *f_h,
REAL tau,
REAL theta,
EL_SYS_INFO_DOW_INSTAT *elsii);
static inline
void update_system_instat_d(DOF_MATRIX *dof_matrix,
DOF_REAL_D_VEC *f_h,
REAL tau,
REAL theta,
EL_SYS_INFO_D_INSTAT *elsii)
{
update_system_instat_dow(dof_matrix, (DOF_REAL_VEC_D *)f_h, tau, theta,
(EL_SYS_INFO_DOW_INSTAT *)elsii);
}
/*** file bas_fct.c *******************************************************/
extern const BAS_FCTS *get_bas_fcts(int dim, const char *name);
extern const BAS_FCTS *get_discontinuous_lagrange(int dim, int degree);
extern const BAS_FCTS *get_lagrange(int dim, int degree);
extern const BAS_FCTS *get_disc_ortho_poly(int dim, int degree);
extern const BAS_FCTS *new_bas_fcts(const BAS_FCTS * bas_fcts);
extern BAS_FCTS *chain_bas_fcts(const BAS_FCTS *head, BAS_FCTS *tail);
typedef const BAS_FCTS *
(*BAS_FCTS_INIT_FCT)(int dim, int dow, const char *name);
extern void add_bas_fcts_plugin(BAS_FCTS_INIT_FCT init_fct);
extern const EL_INT_VEC *
default_get_int_vec(int rvec[], const EL *el, const DOF_INT_VEC *vec);
extern const EL_REAL_VEC *
default_get_real_vec(REAL rvec[], const EL *el, const DOF_REAL_VEC *vec);
extern const EL_REAL_D_VEC *
default_get_real_d_vec(REAL_D rvec[],
const EL *el, const DOF_REAL_D_VEC *vec);
extern const EL_REAL_DD_VEC *
default_get_real_dd_vec(REAL_DD rvec[],
const EL *el, const DOF_REAL_DD_VEC *vec);
extern const EL_REAL_VEC_D *
default_get_real_vec_d(REAL rvec[],
const EL *el, const DOF_REAL_VEC_D *vec);
extern const EL_UCHAR_VEC *
default_get_uchar_vec(U_CHAR rvec[],
const EL *el, const DOF_UCHAR_VEC *vec);
extern const EL_SCHAR_VEC *
default_get_schar_vec(S_CHAR rvec[],
const EL *el, const DOF_SCHAR_VEC *vec);
extern const EL_PTR_VEC *
default_get_ptr_vec(void *rvec[],
const EL *el, const DOF_PTR_VEC *vec);
/*** file check.c *********************************************************/
extern void check_mesh(MESH *mesh);
/*** file element.c *******************************************************/
/* These routines are partially available as _?d-versions to avoid looking
* up the dimension. This should be a small efficiency bonus.
*/
extern void
fill_neigh_el_info(EL_INFO *neigh_info,
const EL_INFO *el_info, int wall, int rel_perm);
static inline const EL_GEOM_CACHE *
fill_el_geom_cache(const EL_INFO *el_info, FLAGS fill_flag);
#if 0
/* implemented as inline-functions further below */
extern int wall_orientation(int dim, const EL *el, int wall);
extern int world_to_coord(const EL_INFO *el_info, const REAL *,
REAL_B);
extern const REAL *coord_to_world(const EL_INFO *, const REAL_B, REAL_D);
extern REAL el_det(const EL_INFO *el_info);
extern REAL el_volume(const EL_INFO *el_info);
extern REAL el_grd_lambda(const EL_INFO *el_info,
REAL_BD grd_lam);
#endif /* inlines further below */
/* Dimension dependent routines, 0d, just dummies in most cases. */
extern int wall_orientation_0d(const EL *el, int wall);
extern int wall_rel_orientation_0d(const EL *el, const EL *neigh,
int wall, int ov);
extern int world_to_coord_0d(const EL_INFO *el_info, const REAL *, REAL_B);
extern const REAL *coord_to_world_0d(const EL_INFO *, const REAL_B, REAL_D);
extern REAL el_det_0d(const EL_INFO *);
extern REAL el_volume_0d(const EL_INFO *el_info);
extern REAL el_grd_lambda_0d(const EL_INFO *el_info,
REAL_BD grd_lam);
extern REAL get_wall_normal_0d(const EL_INFO *el_info, int wall, REAL *normal);
/* Dimension dependent routines, 1d */
extern int wall_orientation_1d(const EL *el, int wall);
extern int wall_rel_orientation_1d(const EL *el, const EL *neigh,
int wall, int ov);
extern int world_to_coord_1d(const EL_INFO *el_info, const REAL *,
REAL_B);
extern const REAL *coord_to_world_1d(const EL_INFO *, const REAL_B, REAL_D);
extern REAL el_det_1d(const EL_INFO *);
extern REAL el_volume_1d(const EL_INFO *el_info);
extern REAL el_grd_lambda_1d(const EL_INFO *,
REAL_BD grd_lam);
extern REAL get_wall_normal_1d(const EL_INFO *el_info, int wall, REAL *normal);
#if DIM_MAX > 1
/* Dimension dependent routines, 2d */
extern int wall_orientation_2d(const EL *el, int wall);
extern int wall_rel_orientation_2d(const EL *el, const EL *neigh,
int wall, int ov);
extern int world_to_coord_2d(const EL_INFO *el_info, const REAL *,
REAL_B);
extern const REAL *coord_to_world_2d(const EL_INFO *, const REAL_B, REAL_D);
extern REAL el_det_2d(const EL_INFO *);
extern REAL el_volume_2d(const EL_INFO *el_info);
extern REAL el_grd_lambda_2d(const EL_INFO *,
REAL_BD grd_lam);
extern REAL get_wall_normal_2d(const EL_INFO *el_info, int wall, REAL *normal);
#if DIM_MAX > 2
/* Dimension dependent routines, 3d */
extern int wall_orientation_3d(const EL *el, int wall);
extern int wall_rel_orientation_3d(const EL *el, const EL *neigh,
int wall, int oppv);
extern int world_to_coord_3d(const EL_INFO *el_info, const REAL *, REAL_B);
extern const REAL *coord_to_world_3d(const EL_INFO *, const REAL_B, REAL_D);
extern REAL el_det_3d(const EL_INFO *);
extern REAL el_volume_3d(const EL_INFO *el_info);
extern REAL el_grd_lambda_3d(const EL_INFO *,
REAL_BD grd_lam);
extern REAL get_wall_normal_3d(const EL_INFO *el_info, int wall, REAL *normal);
#endif
#endif
/* Below we provide wrapper functions which distinguish the dimension
* dependent routines by the co-dimension rather than by the dimension
* of the underlying mesh. We start by defining a preprocessor macro
* which spares us some typing and especially typos.
*
* In addition, we provide wrapper functions which decide by looking
* at el_info->mesh->dim what to do.
*
*/
#if DIM_OF_WORLD == 1
# define ALBERTA_CODIM_WRAPPER(dim, ret, name, suf, argtypes, argnames) \
static inline ret name##suf argtypes \
{ \
FUNCNAME(#name); \
\
switch (dim) { \
case 0: return name##_0d argnames; \
case 1: return name##_1d argnames; \
default: \
ERROR_EXIT("Illegal dim!\n"); \
return (ret)0; /* shut-off a compiler warning */ \
} \
} \
struct _AI_semicolon_dummy
# define ALBERTA_CODIM_ALIAS(ret, name, argtypes, argnames) \
static inline ret name##_0cd argtypes { return name##_1d argnames; } \
static inline ret name##_1cd argtypes { return name##_0d argnames; } \
struct _AI_semicolon_dummy
/* Variants which start at DOW == 2 and thus are empty here */
# define ALBERTA_CODIM_ALIAS_2(ret, name, argtypes, argnames) \
struct _AI_semicolon_dummy
# define ALBERTA_VOID_CODIM_ALIAS_2(name, argtypes, argnames) \
struct _AI_semicolon_dummy
#elif DIM_OF_WORLD == 2
# define ALBERTA_CODIM_WRAPPER(dim, ret, name, suf, argtypes, argnames) \
static inline ret name##suf argtypes \
{ \
FUNCNAME(#name); \
\
switch (dim) { \
case 0: return name##_0d argnames; \
case 1: return name##_1d argnames; \
case 2: return name##_2d argnames; \
default: \
ERROR_EXIT("Illegal dim!\n"); \
return (ret)0L; /* shut-off a compiler warning */ \
} \
} \
struct _AI_semicolon_dummy
# define ALBERTA_CODIM_ALIAS(ret, name, argtypes, argnames) \
static inline ret name##_0cd argtypes { return name##_2d argnames; } \
static inline ret name##_1cd argtypes { return name##_1d argnames; } \
static inline ret name##_2cd argtypes { return name##_0d argnames; } \
struct _AI_semicolon_dummy
/* Variants which start at DOW == 2 */
# define ALBERTA_CODIM_ALIAS_2(ret, name, argtypes, argnames) \
static inline ret name##_0cd argtypes { return name##_2d argnames; } \
struct _AI_semicolon_dummy
# define ALBERTA_VOID_CODIM_ALIAS_2(name, argtypes, argnames) \
static inline void name##_0cd argtypes { name##_2d argnames; } \
struct _AI_semicolon_dummy
#elif DIM_OF_WORLD == 3
# define ALBERTA_CODIM_WRAPPER(dim, ret, name, suf, argtypes, argnames) \
static inline ret name##suf argtypes \
{ \
FUNCNAME(#name); \
\
switch (dim) { \
case 0: return name##_0d argnames; \
case 1: return name##_1d argnames; \
case 2: return name##_2d argnames; \
case 3: return name##_3d argnames; \
default: \
ERROR_EXIT("Illegal dim!\n"); \
return (ret)0L; /* shut-off a compiler warning */ \
} \
} \
struct _AI_semicolon_dummy
# define ALBERTA_CODIM_ALIAS(ret, name, argtypes, argnames) \
static inline ret name##_0cd argtypes { return name##_3d argnames; } \
static inline ret name##_1cd argtypes { return name##_2d argnames; } \
static inline ret name##_2cd argtypes { return name##_1d argnames; } \
static inline ret name##_3cd argtypes { return name##_0d argnames; } \
struct _AI_semicolon_dummy
/* Variants which start at DOW == 2 */
# define ALBERTA_CODIM_ALIAS_2(ret, name, argtypes, argnames) \
static inline ret name##_0cd argtypes { return name##_3d argnames; } \
static inline ret name##_1cd argtypes { return name##_2d argnames; } \
struct _AI_semicolon_dummy
# define ALBERTA_VOID_CODIM_ALIAS_2(name, argtypes, argnames) \
static inline void name##_0cd argtypes { name##_3d argnames; } \
static inline void name##_1cd argtypes { name##_2d argnames; } \
struct _AI_semicolon_dummy
#elif DIM_OF_WORLD > 3
# define ALBERTA_CODIM_WRAPPER(dim, ret, name, suf, argtypes, argnames) \
static inline ret name##suf argtypes \
{ \
FUNCNAME(#name); \
\
switch (dim) { \
case 0: return name##_0d argnames; \
case 1: return name##_1d argnames; \
case 2: return name##_2d argnames; \
case 3: return name##_3d argnames; \
default: \
ERROR_EXIT("Illegal dim!\n"); \
return (ret)0L; /* shut-off a compiler warning */ \
} \
} \
struct _AI_semicolon_dummy
# define ALBERTA_CODIM_ALIAS(ret, name, argtypes, argnames) \
struct _AI_semicolon_dummy
# define ALBERTA_CODIM_ALIAS_2(ret, name, argtypes, argnames) \
struct _AI_semicolon_dummy
# define ALBERTA_VOID_CODIM_ALIAS_2(name, argtypes, argnames) \
struct _AI_semicolon_dummy
#endif
/* ..._Xcd() alias definitions */
ALBERTA_CODIM_ALIAS(int, world_to_coord,
(const EL_INFO *el_info,
const REAL *xy,
REAL_B lambda),
(el_info, xy, lambda));
ALBERTA_CODIM_ALIAS(const REAL *, coord_to_world,
(const EL_INFO *el_info, const REAL_B l, REAL_D w),
(el_info, l, w));
ALBERTA_CODIM_ALIAS(REAL, el_volume, (const EL_INFO *el_info), (el_info));
ALBERTA_CODIM_ALIAS(REAL, el_det, (const EL_INFO *el_info), (el_info));
ALBERTA_CODIM_ALIAS(REAL, el_grd_lambda,
(const EL_INFO *el_info,
REAL_BD grd_lam),
(el_info, grd_lam));
ALBERTA_CODIM_ALIAS(REAL, get_wall_normal,
(const EL_INFO *el_info, int i0, REAL *normal),
(el_info, i0, normal));
ALBERTA_CODIM_ALIAS(int, wall_orientation,
(const EL *el, int wall),
(el, wall));
ALBERTA_CODIM_ALIAS(int, wall_rel_orientation,
(const EL *el, const EL *neigh, int wall, int oppv),
(el, neigh, wall, oppv));
static const int sorted_wall_vertices_0d[1][1][1] = {{{ 0 }}}; /* dummy */
ALBERTA_CODIM_ALIAS(const int *, sorted_wall_vertices,
(int wall, int permno),
[wall][permno]);
static const int vertex_of_wall_0d[1][1] = {{ 0 }}; /* dummy */
ALBERTA_CODIM_ALIAS(const int *, vertex_of_wall,
(int wall),
[wall]);
static const int vertex_of_edge_0d[1][1] = {{ 0 }}; /* dummy */
ALBERTA_CODIM_ALIAS(const int *, vertex_of_edge,
(int edge),
[edge]);
/* Wrappers which look at el_info->mesh->dim */
ALBERTA_CODIM_WRAPPER(el_info->mesh->dim,
int, world_to_coord, /**/,
(const EL_INFO *el_info, const REAL *x, REAL_B lambda),
(el_info, x, lambda));
ALBERTA_CODIM_WRAPPER(el_info->mesh->dim,
const REAL *, coord_to_world, /**/,
(const EL_INFO *el_info, const REAL_B lambda, REAL_D x),
(el_info, lambda, x));
ALBERTA_CODIM_WRAPPER(el_info->mesh->dim,
REAL, el_volume, /**/,
(const EL_INFO *el_info), (el_info));
ALBERTA_CODIM_WRAPPER(el_info->mesh->dim,
REAL, el_det, /**/,
(const EL_INFO *el_info), (el_info));
ALBERTA_CODIM_WRAPPER(el_info->mesh->dim,
REAL, el_grd_lambda, /**/,
(const EL_INFO *el_info,
REAL_BD grd_lam),
(el_info, grd_lam));
ALBERTA_CODIM_WRAPPER(el_info->mesh->dim,
REAL, get_wall_normal, /**/,
(const EL_INFO *el_info, int wall, REAL *normal),
(el_info, wall, normal));
/* Wrappers with addtional "dim" as argument */
ALBERTA_CODIM_WRAPPER(dim, int, wall_orientation, /**/,
(int dim, const EL *el, int wall),
(el, wall));
ALBERTA_CODIM_WRAPPER(dim, int, wall_rel_orientation, /**/,
(int dim,
const EL *el, const EL *neigh, int wall, int oppv),
(el, neigh, wall, oppv));
ALBERTA_CODIM_WRAPPER(dim, const int *, sorted_wall_vertices, /**/,
(int dim, int wall, int permno), [wall][permno]);
ALBERTA_CODIM_WRAPPER(dim, const int *, vertex_of_wall, /**/,
(int dim, int wall), [wall]);
ALBERTA_CODIM_WRAPPER(dim, const int *, vertex_of_edge, /**/,
(int dim, int edge), [edge]);
ALBERTA_CODIM_WRAPPER(dim, int, world_to_coord, _dim,
(int dim,
const EL_INFO *el_info, const REAL *x, REAL_B lambda),
(el_info, x, lambda));
ALBERTA_CODIM_WRAPPER(dim, const REAL *, coord_to_world, _dim,
(int dim,
const EL_INFO *el_info, const REAL_B lambda, REAL_D x),
(el_info, lambda, x));
ALBERTA_CODIM_WRAPPER(dim, REAL, el_volume, _dim,
(int dim, const EL_INFO *el_info), (el_info));
ALBERTA_CODIM_WRAPPER(dim, REAL, el_det, _dim,
(int dim, const EL_INFO *el_info), (el_info));
ALBERTA_CODIM_WRAPPER(dim, REAL, el_grd_lambda, _dim,
(int dim, const EL_INFO *el_info, REAL_BD grd_lam),
(el_info, grd_lam));
ALBERTA_CODIM_WRAPPER(dim, REAL, get_wall_normal, _dim,
(int dim, const EL_INFO *el_info, int wall, REAL *normal),
(el_info, wall, normal));
/* Some special wrapper functions, used for some stuff defined in
* level.c
*/
ALBERTA_CODIM_ALIAS_2(REAL, level_element_det, (const REAL_D coord[]), (coord));
ALBERTA_VOID_CODIM_ALIAS_2(level_coord_to_world,
(const REAL_D coord[],
const REAL_B lambda,
REAL_D world),
(coord, lambda, world));
ALBERTA_VOID_CODIM_ALIAS_2(level_coord_to_el_coord,
(const REAL_B v_lambda[],
const REAL_B lambda,
REAL_B el_lambda),
(v_lambda, lambda, el_lambda));
/*** file estimator{_dowb}.c **********************************************/
/* The values accepted by the f_flags arguments of ellipt_est() &
* friends.
*/
#define INIT_UH 1
#define INIT_GRD_UH 2
/*
{
const void *est_handle;
REAL est_el;
const EL_GEOM_CACHE *elgc;
est_handle = estimator_init(...);
TRAVERSE_FIRST(mesh, -1, fill_flag) {
est_el = element_est(el_info, est_handle);
#if needed
uh = element_est_uh(est_handle);
grd_uh = element_est_grd_uh(est_handle);
el_gc = fill_el_geom_cache(el_info, FILL_EL_DET);
est_el += el_gc->det * additional_stuff(el_cache,...);
#endif
element_est_finish(est_el, est_handle);
} TRAVERSE_NEXT();
estimate = estimator_finish(..., est_handle)
}
*/
extern const void *ellipt_est_init(const DOF_REAL_VEC *uh,
ADAPT_STAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
const QUAD *quad,
const WALL_QUAD *wall_quad,
NORM norm,
REAL C[3],
const REAL_DD A,
const BNDRY_FLAGS dirichlet_bndry,
REAL (*f)(const EL_INFO *el_info,
const QUAD *quad,
int qp,
REAL uh_qp,
const REAL_D grd_uh_gp),
FLAGS f_flags,
REAL (*gn)(const EL_INFO *el_info,
const QUAD *quad,
int qp,
REAL uh_qp,
const REAL_D normal),
FLAGS gn_flags);
extern const void *heat_est_init(const DOF_REAL_VEC *uh,
const DOF_REAL_VEC *uh_old,
ADAPT_INSTAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
const QUAD *quad,
const WALL_QUAD *wall_quad,
REAL C[4],
const REAL_DD A,
const BNDRY_FLAGS dirichlet_bndry,
REAL (*f)(const EL_INFO *el_info,
const QUAD *quad,
int qp,
REAL uh_qp,
const REAL_D grd_uh_gp,
REAL time),
FLAGS f_flags,
REAL (*gn)(const EL_INFO *el_info,
const QUAD *quad,
int qp,
REAL uh_qp,
const REAL_D normal,
REAL time),
FLAGS gn_flags);
extern REAL element_est(const EL_INFO *el_info, const void *est_handle);
extern void element_est_finish(const EL_INFO *el_info,
REAL est_el, const void *est_handle);
extern REAL ellipt_est_finish(ADAPT_STAT *adapt, const void *est_handle);
extern REAL heat_est_finish(ADAPT_INSTAT *adapt, const void *est_handle);
extern const REAL *element_est_uh(const void *est_handle);
extern const REAL_D *element_est_grd_uh(const void *est_handle);
extern const EL_REAL_VEC *element_est_uh_loc(const void *est_handle);
extern const EL_REAL_VEC *element_est_uh_old_loc(const void *est_handle);
extern REAL ellipt_est(const DOF_REAL_VEC *uh,
ADAPT_STAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
int quad_degree,
NORM norm,
REAL C[3],
const REAL_DD A,
const BNDRY_FLAGS dirichlet_bndry,
REAL (*f)(const EL_INFO *el_info,
const QUAD *quad,
int qp,
REAL uh_qp,
const REAL_D grd_uh_gp),
FLAGS f_flags,
REAL (*gn)(const EL_INFO *el_info,
const QUAD *quad,
int qp,
REAL uh_qp,
const REAL_D normal),
FLAGS gn_flags);
extern REAL heat_est(const DOF_REAL_VEC *uh,
const DOF_REAL_VEC *uh_old,
ADAPT_INSTAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
int quad_degree,
REAL C[4],
const REAL_DD A,
const BNDRY_FLAGS dirichlet_bndry,
REAL (*f)(const EL_INFO *el_info,
const QUAD *quad,
int qp,
REAL uh_qp,
const REAL_D grd_uh_gp,
REAL time),
FLAGS f_flags,
REAL (*gn)(const EL_INFO *el_info,
const QUAD *quad,
int qp,
REAL uh_qp,
const REAL_D normal,
REAL time),
FLAGS gn_flags);
/*** file estimator_dowb.c **************************************************/
extern const void *ellipt_est_dow_init(const DOF_REAL_VEC_D *uh,
ADAPT_STAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
const QUAD *quad,
const WALL_QUAD *wall_quad,
NORM norm,
REAL C[3],
const void *A,
MATENT_TYPE A_type,
MATENT_TYPE A_blocktype,
bool sym_grad,
const BNDRY_FLAGS dirichlet_bndry,
const REAL *(*f)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_DD grd_uh_gp),
FLAGS f_flags,
const REAL *(*gn)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_D normal),
FLAGS gn_flags);
extern const void *heat_est_dow_init(const DOF_REAL_VEC_D *uh,
const DOF_REAL_VEC_D *uh_old,
ADAPT_INSTAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
const QUAD *quad,
const WALL_QUAD *wall_quad,
REAL C[4],
const void *A,
MATENT_TYPE A_type,
MATENT_TYPE A_blocktype,
bool sym_grad,
const BNDRY_FLAGS dirichlet_bndry,
const REAL *(*f)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_DD grd_uh_gp,
REAL time),
FLAGS f_flags,
const REAL *(*gn)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_D normal,
REAL time),
FLAGS gn_flags);
extern REAL element_est_dow(const EL_INFO *el_info, const void *est_handle);
extern void element_est_dow_finish(const EL_INFO *el_info,
REAL est_el, const void *est_handle);
extern REAL ellipt_est_dow_finish(ADAPT_STAT *adapt, const void *est_handle);
extern REAL heat_est_dow_finish(ADAPT_INSTAT *adapt, const void *est_handle);
extern const REAL_D *element_est_uh_dow(const void *est_handle);
extern const REAL_DD *element_est_grd_uh_dow(const void *est_handle);
extern const EL_REAL_VEC_D *element_est_uh_loc_dow(const void *est_handle);
extern const EL_REAL_VEC_D *element_est_uh_old_loc_dow(const void *est_handle);
extern REAL ellipt_est_dow(const DOF_REAL_VEC_D *uh,
ADAPT_STAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
int quad_degree,
NORM norm,
REAL C[3],
const void *A,
MATENT_TYPE A_type,
MATENT_TYPE A_blocktype,
bool sym_grad,
const BNDRY_FLAGS dirichlet_bndry,
const REAL *(*f)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_DD grd_uh_gp),
FLAGS f_flags,
const REAL *(*gn)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_D normal),
FLAGS gn_flags);
extern REAL heat_est_dow(const DOF_REAL_VEC_D *uh,
const DOF_REAL_VEC_D *uh_old,
ADAPT_INSTAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
int quad_degree,
REAL C[4],
const void *A,
MATENT_TYPE A_type,
MATENT_TYPE A_blocktype,
bool sym_grad,
const BNDRY_FLAGS dirichlet_bndry,
const REAL *(*f)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_DD grd_uh_gp,
REAL time),
FLAGS f_flags,
const REAL *(*gn)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_D normal,
REAL time),
FLAGS gn_flags);
/* DOF_REAL_D_VEC versions */
static inline
const void *ellipt_est_d_init(const DOF_REAL_D_VEC *uh,
ADAPT_STAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
const QUAD *quad,
const WALL_QUAD *wall_quad,
NORM norm,
REAL C[3],
const void *A,
MATENT_TYPE A_type,
MATENT_TYPE A_blocktype,
bool sym_grad,
const BNDRY_FLAGS dirichlet_bndry,
const REAL *(*f)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_DD grd_uh_gp),
FLAGS f_flags,
const REAL *(*gn)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_D normal),
FLAGS gn_flags)
{
return ellipt_est_dow_init(
(const DOF_REAL_VEC_D *)uh,
adapt, rw_est, rw_estc, quad, wall_quad, norm, C, A, A_type, A_blocktype,
sym_grad, dirichlet_bndry, f, f_flags, gn, gn_flags);
}
static inline
REAL ellipt_est_d(const DOF_REAL_D_VEC *uh,
ADAPT_STAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
int quad_degree,
NORM norm,
REAL C[3],
const void *A,
MATENT_TYPE A_type,
MATENT_TYPE A_blocktype,
bool sym_grad,
const BNDRY_FLAGS dirichlet_bndry,
const REAL *(*f)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_DD grd_uh_gp),
FLAGS f_flags,
const REAL *(*gn)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_D normal),
FLAGS gn_flags)
{
return ellipt_est_dow(
(const DOF_REAL_VEC_D *)uh,
adapt, rw_est, rw_estc, quad_degree, norm, C, A, A_type, A_blocktype,
sym_grad, dirichlet_bndry, f, f_flags, gn, gn_flags);
}
static inline
const void *heat_est_d_init(const DOF_REAL_D_VEC *uh,
const DOF_REAL_D_VEC *uh_old,
ADAPT_INSTAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
const QUAD *quad,
const WALL_QUAD *wall_quad,
REAL C[4],
const void *A,
MATENT_TYPE A_type,
MATENT_TYPE A_blocktype,
bool sym_grad,
const BNDRY_FLAGS dirichlet_bndry,
const REAL *(*f)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_DD grd_uh_gp,
REAL time),
FLAGS f_flags,
const REAL *(*gn)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_D normal,
REAL time),
FLAGS gn_flags)
{
return heat_est_dow_init(
(const DOF_REAL_VEC_D *)uh, (const DOF_REAL_VEC_D *)uh_old,
adapt, rw_est, rw_estc, quad, wall_quad, C, A, A_type, A_blocktype,
sym_grad, dirichlet_bndry, f, f_flags, gn, gn_flags);
}
static inline
REAL heat_est_d(const DOF_REAL_D_VEC *uh,
const DOF_REAL_D_VEC *uh_old,
ADAPT_INSTAT *adapt,
REAL *(*rw_est)(EL *),
REAL *(*rw_estc)(EL *),
int quad_degree,
REAL C[4],
const void *A,
MATENT_TYPE A_type,
MATENT_TYPE A_blocktype,
bool sym_grad,
const BNDRY_FLAGS dirichlet_bndry,
const REAL *(*f)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_DD grd_uh_gp,
REAL time),
FLAGS f_flags,
const REAL *(*gn)(REAL_D result,
const EL_INFO *el_info,
const QUAD *quad,
int qp,
const REAL_D uh_qp,
const REAL_D normal,
REAL time),
FLAGS gn_flags)
{
return heat_est_dow(
(const DOF_REAL_VEC_D *)uh, (const DOF_REAL_VEC_D *)uh_old,
adapt, rw_est, rw_estc, quad_degree, C, A, A_type, A_blocktype,
sym_grad, dirichlet_bndry, f, f_flags, gn, gn_flags);
}
static inline
REAL element_est_d(const EL_INFO *el_info, const void *est_handle)
{
return element_est_dow(el_info, est_handle);
}
static inline
void element_est_d_finish(const EL_INFO *el_info,
REAL est_el, const void *est_handle)
{
element_est_dow_finish(el_info, est_el, est_handle);
}
static inline
REAL ellipt_est_d_finish(ADAPT_STAT *adapt, const void *est_handle)
{
return ellipt_est_dow_finish(adapt, est_handle);
}
static inline
REAL heat_est_d_finish(ADAPT_INSTAT *adapt, const void *est_handle)
{
return heat_est_dow_finish(adapt, est_handle);
}
static inline
const REAL_D *element_est_uh_d(const void *est_handle)
{
return element_est_uh_dow(est_handle);
}
static inline
const REAL_DD *element_est_grd_uh_d(const void *est_handle) {
return element_est_grd_uh_dow(est_handle);
}
static inline
const EL_REAL_D_VEC *element_est_uh_loc_d(const void *est_handle)
{
return (const EL_REAL_D_VEC *)element_est_uh_loc_dow(est_handle);
}
static inline
const EL_REAL_D_VEC *element_est_uh_old_loc_d(const void *est_handle)
{
return (const EL_REAL_D_VEC *)element_est_uh_old_loc_dow(est_handle);
}
/*** file error.c *********************************************************/
REAL max_err_at_qp(FCT_AT_X u, const DOF_REAL_VEC *, const QUAD *);
REAL max_err_dow_at_qp(FCT_D_AT_X u, const DOF_REAL_VEC_D *, const QUAD *);
REAL max_err_at_vert(FCT_AT_X f, const DOF_REAL_VEC *);
REAL max_err_dow_at_vert(FCT_D_AT_X u, const DOF_REAL_VEC_D *uh);
REAL L2_err(FCT_AT_X u, const DOF_REAL_VEC *uh,
const QUAD *quad,
bool rel_err, bool mean_value_adjust,
REAL *(*rw_err_el)(EL *el), REAL *max_l2_err2);
REAL L2_err_dow(FCT_D_AT_X u, const DOF_REAL_VEC_D *uh,
const QUAD *quad,
bool rel_err, bool mean_value_adjust,
REAL *(*rw_err_el)(EL *el), REAL *max_l2_err2);
REAL L2_err_weighted(FCT_AT_X weight, FCT_AT_X u, const DOF_REAL_VEC *uh,
const QUAD *quad,
bool rel_err, bool mean_value_adjust,
REAL *(*rw_err_el)(EL *el), REAL *max_l2_err2);
REAL L2_err_dow_weighted(FCT_AT_X wieght, FCT_D_AT_X u,
const DOF_REAL_VEC_D *uh,
const QUAD *quad,
bool rel_err, bool mean_value_adjust,
REAL *(*rw_err_el)(EL *el), REAL *max_l2_err2);
REAL H1_err(GRD_FCT_AT_X grd_u, const DOF_REAL_VEC *u_h,
const QUAD *quad, bool rel_err,
REAL *(*rw_err_el)(EL *el), REAL *max_h1_err2);
REAL H1_err_dow(GRD_FCT_D_AT_X grd_u, const DOF_REAL_VEC_D *uh,
const QUAD *quad, bool rel_err,
REAL *(*rw_err_esl)(EL *el), REAL *max_h1_err2);
REAL deform_err(GRD_FCT_D_AT_X grd_u, const DOF_REAL_VEC_D *uh,
const QUAD *quad,
bool rel_err, REAL *(*rw_err_el)(EL *), REAL *max_el_err2);
REAL H1_err_weighted(FCT_AT_X weight, GRD_FCT_AT_X grd_u,
const DOF_REAL_VEC *u_h,
const QUAD *quad, bool rel_err,
REAL *(*rw_err_el)(EL *el), REAL *max_h1_err2);
REAL H1_err_dow_weighted(FCT_AT_X weight, GRD_FCT_D_AT_X grd_u,
const DOF_REAL_VEC_D *uh,
const QUAD *quad, bool rel_err,
REAL *(*rw_err_esl)(EL *el), REAL *max_h1_err2);
REAL deform_err_weighted(FCT_AT_X weight, GRD_FCT_D_AT_X grd_u,
const DOF_REAL_VEC_D *uh,
const QUAD *quad,
bool rel_err, REAL *(*rw_err_el)(EL *),
REAL *max_el_err2);
REAL max_err_at_qp_loc(LOC_FCT_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC *uh, const QUAD *quad);
REAL max_err_dow_at_qp_loc(LOC_FCT_D_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC_D *uh, const QUAD *quad);
REAL max_err_at_vert_loc(LOC_FCT_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC *uh);
REAL max_err_dow_at_vert_loc(LOC_FCT_D_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC_D *uh);
REAL L2_err_loc(LOC_FCT_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC *uh,
const QUAD *quad,
bool rel_err, bool mean_value_adjust,
REAL *(*rw_err_el)(EL *el), REAL *max_l2_err2);
REAL H1_err_loc(GRD_LOC_FCT_AT_QP grd_u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC *uh,
const QUAD *quad, bool rel_err, REAL *(*rw_err_el)(EL *),
REAL *max_h1_err2);
REAL L2_err_loc_dow(LOC_FCT_D_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC_D *uh,
const QUAD *quad,
bool rel_err, bool mean_value_adjust,
REAL *(*rw_err_el)(EL *el), REAL *max_l2_err2);
REAL H1_err_loc_dow(GRD_LOC_FCT_D_AT_QP grd_u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC_D *uh, const QUAD *quad,
bool rel_err,
REAL *(*rw_err_el)(EL *), REAL *max_h1_err2);
REAL deform_err_loc(GRD_LOC_FCT_D_AT_QP grd_u_loc, void *ud, FLAGS fill_flag,
const DOF_REAL_VEC_D *uh, const QUAD *quad,
bool rel_err,
REAL *(*rw_err_el)(EL *), REAL *max_el_err2);
/* DOF_REAL_D_VEC versions */
static inline
REAL max_err_d_at_qp(FCT_D_AT_X u, const DOF_REAL_D_VEC *uh, const QUAD *quad)
{
return max_err_dow_at_qp(u, (const DOF_REAL_VEC_D *)uh, quad);
}
static inline
REAL max_err_d_at_vert(FCT_D_AT_X u, const DOF_REAL_D_VEC *uh)
{
return max_err_dow_at_vert(u, (const DOF_REAL_VEC_D *)uh);
}
static inline
REAL L2_err_d(FCT_D_AT_X u, const DOF_REAL_D_VEC *uh,
const QUAD *quad,
bool rel_err, bool mean_value_adjust,
REAL *(*rw_err_el)(EL *el), REAL *max_l2_err2)
{
return L2_err_dow(u, (const DOF_REAL_VEC_D *)uh,
quad, rel_err, mean_value_adjust, rw_err_el, max_l2_err2);
}
static inline
REAL H1_err_d(GRD_FCT_D_AT_X grd_u, const DOF_REAL_D_VEC *uh,
const QUAD *quad, bool rel_err,
REAL *(*rw_err_el)(EL *el), REAL *max_h1_err2)
{
return H1_err_dow(grd_u, (const DOF_REAL_VEC_D *)uh,
quad, rel_err, rw_err_el, max_h1_err2);
}
static inline
REAL max_err_d_at_qp_loc(LOC_FCT_D_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_D_VEC *uh, const QUAD *quad)
{
return max_err_dow_at_qp_loc(u_at_qp, ud, fill_flag,
(const DOF_REAL_VEC_D *)uh, quad);
}
static inline
REAL max_err_d_at_vert_loc(LOC_FCT_D_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_D_VEC *uh)
{
return max_err_dow_at_vert_loc(u_at_qp, ud, fill_flag,
(const DOF_REAL_VEC_D *)uh);
}
static inline
REAL L2_err_loc_d(LOC_FCT_D_AT_QP u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_D_VEC *uh,
const QUAD *quad,
bool rel_err, bool mean_value_adjust,
REAL *(*rw_err_el)(EL *el), REAL *max_l2_err2)
{
return L2_err_loc_dow(u_at_qp, ud, fill_flag,
(const DOF_REAL_VEC_D *)uh,
quad,
rel_err, mean_value_adjust, rw_err_el, max_l2_err2);
}
static inline
REAL H1_err_loc_d(GRD_LOC_FCT_D_AT_QP grd_u_at_qp, void *ud, FLAGS fill_flag,
const DOF_REAL_D_VEC *uh, const QUAD *quad,
bool rel_err,
REAL *(*rw_err_el)(EL *), REAL *max_h1_err2)
{
return H1_err_loc_dow(grd_u_at_qp, ud, fill_flag,
(const DOF_REAL_VEC_D *)uh,
quad, rel_err, rw_err_el, max_h1_err2);
}
/*** file eval.c **********************************************************/
/* evaluation routines are defined as inline functions in the file evaluate.h */
REAL H1_norm_uh(const QUAD *quad, const DOF_REAL_VEC *u_h);
REAL L2_norm_uh(const QUAD *quad, const DOF_REAL_VEC *u_h);
REAL L8_uh_at_qp(REAL *minp, REAL *maxp,
const QUAD *quad, const DOF_REAL_VEC *u_h);
REAL H1_norm_uh_dow(const QUAD *quad, const DOF_REAL_VEC_D *u_h);
REAL L2_norm_uh_dow(const QUAD *quad, const DOF_REAL_VEC_D *u_h);
REAL L8_uh_at_qp_dow(REAL *minp, REAL *maxp,
const QUAD *quad, const DOF_REAL_VEC_D *u_h);
static inline REAL L2_norm_uh_d(const QUAD *quad, const DOF_REAL_D_VEC *u_h)
{
return L2_norm_uh_dow(quad, (const DOF_REAL_VEC_D *)u_h);
}
static inline REAL L8_uh_at_qp_d(REAL *minp, REAL *maxp,
const QUAD *quad, const DOF_REAL_D_VEC *u_h)
{
return L8_uh_at_qp_dow(minp, maxp, quad, (const DOF_REAL_VEC_D *)u_h);
}
static inline REAL H1_norm_uh_d(const QUAD *quad, const DOF_REAL_D_VEC *u_h)
{
return H1_norm_uh_dow(quad, (const DOF_REAL_VEC_D *)u_h);
}
void interpol(FCT_AT_X fct, DOF_REAL_VEC *u_h);
void interpol_dow(FCT_D_AT_X fct, DOF_REAL_VEC_D *uh);
void interpol_loc(DOF_REAL_VEC *vec,
LOC_FCT_AT_QP fct_at_qp, void *app_data,
FLAGS fill_flags);
void interpol_loc_dow(DOF_REAL_VEC_D *vec,
LOC_FCT_D_AT_QP fct_at_qp, void *app_data,
FLAGS fill_flags);
static inline
void interpol_d(FCT_D_AT_X f, DOF_REAL_D_VEC *u_h)
{
interpol_dow(f, (DOF_REAL_VEC_D *)u_h);
}
static inline
void interpol_loc_d(DOF_REAL_D_VEC *vec,
LOC_FCT_D_AT_QP fct_at_qp, void *app_data,
FLAGS fill_flags)
{
interpol_loc_dow((DOF_REAL_VEC_D *)vec, fct_at_qp, app_data, fill_flags);
}
/*** file graphXO.c *******************************************************/
GRAPH_WINDOW graph_open_window(const char *title, const char *geometry,
REAL *world, MESH *mesh);
void graph_close_window(GRAPH_WINDOW win);
void graph_clear_window(GRAPH_WINDOW win, const GRAPH_RGBCOLOR c);
void graph_mesh(GRAPH_WINDOW win, MESH *mesh, const GRAPH_RGBCOLOR c,
FLAGS flag);
void graph_drv(GRAPH_WINDOW win, const DOF_REAL_VEC *uh,
REAL min, REAL max, int refine);
void graph_drv_d(GRAPH_WINDOW win, const DOF_REAL_D_VEC *uh,
REAL min, REAL max, int refine);
void graph_el_est(GRAPH_WINDOW win, MESH *mesh, REAL (*get_el_est)(EL *el),
REAL min, REAL max);
void graph_point(GRAPH_WINDOW, const REAL [2], const GRAPH_RGBCOLOR, float);
void graph_points(GRAPH_WINDOW win, int np, REAL (*p)[2],
const GRAPH_RGBCOLOR c, float ps);
void graph_line(GRAPH_WINDOW, const REAL [2], const REAL [2],
const GRAPH_RGBCOLOR, float);
void graph_fvalues_2d(GRAPH_WINDOW win, MESH *mesh,
REAL(*fct)(const EL_INFO *el_info, const REAL *lambda),
FLAGS flags, REAL min, REAL max, int refine);
void graph_level_2d(GRAPH_WINDOW win, const DOF_REAL_VEC *v, REAL level,
const GRAPH_RGBCOLOR c, int refine);
void graph_levels_2d(GRAPH_WINDOW win, const DOF_REAL_VEC *v,
int n, REAL const *levels, const GRAPH_RGBCOLOR *color,
int refine);
void graph_level_d_2d(GRAPH_WINDOW, const DOF_REAL_D_VEC *,
REAL, const GRAPH_RGBCOLOR, int);
void graph_levels_d_2d(GRAPH_WINDOW, const DOF_REAL_D_VEC *,
int, const REAL *, const GRAPH_RGBCOLOR *, int);
/* multigrid level display routines: */
void graph_mesh_mg_2d(GRAPH_WINDOW win, MESH *mesh, const GRAPH_RGBCOLOR c,
FLAGS flags, int mg_level);
void graph_values_mg_2d(GRAPH_WINDOW win, const DOF_REAL_VEC *v,
REAL min, REAL max, int refine,
int mg_level, const FE_SPACE *fe_space,
const int *sort_dof_invers);
/*** file l2scp.c *********************************************************/
void L2scp_fct_bas(FCT_AT_X f, const QUAD *quad, DOF_REAL_VEC *fh);
void L2scp_fct_bas_dow(FCT_D_AT_X, const QUAD *quad, DOF_REAL_VEC_D *fhd);
void L2scp_fct_bas_loc(DOF_REAL_VEC *fh,
LOC_FCT_AT_QP f_at_qp, void *fct_data, FLAGS fill_flag,
const QUAD *quad);
void L2scp_fct_bas_loc_dow(DOF_REAL_VEC_D *fh,
LOC_FCT_D_AT_QP f_at_qp, void *ud, FLAGS fill_flag,
const QUAD *quad);
void H1scp_fct_bas(GRD_FCT_AT_X f, const QUAD *quad, DOF_REAL_VEC *fh);
void H1scp_fct_bas_dow(GRD_FCT_D_AT_X f, const QUAD *quad, DOF_REAL_VEC_D *fh);
void H1scp_fct_bas_loc(DOF_REAL_VEC *fh,
GRD_LOC_FCT_AT_QP f, void *fd, FLAGS fill_flag,
const QUAD *quad);
void H1scp_fct_bas_loc_dow(DOF_REAL_VEC_D *fh,
GRD_LOC_FCT_D_AT_QP f, void *fd, FLAGS fill_flag,
const QUAD *quad);
bool bndry_L2scp_fct_bas(DOF_REAL_VEC *fh,
REAL (*f)(const REAL_D x, const REAL_D normal),
const BNDRY_FLAGS bndry_seg,
const WALL_QUAD *quad);
bool bndry_L2scp_fct_bas_loc(DOF_REAL_VEC *fh,
LOC_FCT_AT_QP f_at_qp, void *ud, FLAGS fill_flag,
const BNDRY_FLAGS bndry_seg,
const WALL_QUAD *quad);
bool bndry_L2scp_fct_bas_dow(DOF_REAL_VEC_D *fh,
const REAL *(*f)(const REAL_D x,
const REAL_D normal,
REAL_D result),
const BNDRY_FLAGS bndry_seg,
const WALL_QUAD *quad);
bool bndry_L2scp_fct_bas_loc_dow(DOF_REAL_VEC_D *fh,
LOC_FCT_D_AT_QP f_at_qp, void *ud,
FLAGS fill_flag,
const BNDRY_FLAGS bndry_seg,
const WALL_QUAD *quad);
void trace_L2scp_fct_bas(DOF_REAL_VEC *fh, FCT_AT_X f,
MESH *trace_mesh, const QUAD *quad);
void trace_L2scp_fct_bas_loc(DOF_REAL_VEC *fh,
LOC_FCT_AT_QP f, void *fd, FLAGS fill_flag,
MESH *trace_mesh,
const QUAD *quad);
void trace_L2scp_fct_bas_dow(DOF_REAL_VEC_D *fh,
FCT_D_AT_X f,
MESH *trace_mesh,
const QUAD *quad);
void trace_L2scp_fct_bas_loc_dow(DOF_REAL_VEC_D *fh,
LOC_FCT_D_AT_QP f, void *fd, FLAGS fill_flag,
MESH *trace_mesh,
const QUAD *quad);
bool bndry_H1scp_fct_bas(DOF_REAL_VEC *fh,
const REAL *(*f)(REAL_D result,
const REAL_D x, const REAL_D normal),
const BNDRY_FLAGS scp_segment,
const WALL_QUAD *quad);
bool bndry_H1scp_fct_bas_loc(DOF_REAL_VEC *fh,
GRD_LOC_FCT_AT_QP f, void *fd, FLAGS fill_flag,
const BNDRY_FLAGS scp_segment,
const WALL_QUAD *quad);
bool bndry_H1scp_fct_bas_dow(DOF_REAL_VEC_D *fh,
const REAL_D *(*f)(REAL_DD result,
const REAL_D x,
const REAL_D normal),
const BNDRY_FLAGS bndry_seg,
const WALL_QUAD *quad);
bool bndry_H1scp_fct_bas_loc_dow(DOF_REAL_VEC_D *fh,
GRD_LOC_FCT_D_AT_QP f_loc,
void *fd, FLAGS fill_flag,
const BNDRY_FLAGS bndry_seg,
const WALL_QUAD *quad);
extern bool
dirichlet_bound(DOF_REAL_VEC *fh, DOF_REAL_VEC *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
REAL (*g)(const REAL_D));
extern bool
dirichlet_bound_dow(DOF_REAL_VEC_D *fh, DOF_REAL_VEC_D *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
const REAL *(*g)(const REAL_D, REAL_D));
extern bool
dirichlet_bound_loc(DOF_REAL_VEC *fh,
DOF_REAL_VEC *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
LOC_FCT_AT_QP g_at_qp, void *ud, FLAGS fill_flags);
extern bool
dirichlet_bound_loc_dow(DOF_REAL_VEC_D *fh, DOF_REAL_VEC_D *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
LOC_FCT_D_AT_QP g_at_qp, void *ud, FLAGS fill_flags);
REAL mean_value(MESH *mesh,
REAL (*f)(const REAL_D),
const DOF_REAL_VEC *fh, const QUAD *quad);
const REAL *mean_value_dow(MESH *mesh,
FCT_D_AT_X f,
const DOF_REAL_VEC_D *fh,
const QUAD *quad,
REAL_D mean);
REAL mean_value_loc(MESH *mesh,
LOC_FCT_AT_QP f_at_qp, void *ud, FLAGS fill_flags,
const DOF_REAL_VEC *fh, const QUAD *quad);
const REAL *mean_value_loc_dow(REAL_D mean,
MESH *mesh,
LOC_FCT_D_AT_QP f_at_qp,
void *ud, FLAGS fill_flag,
const DOF_REAL_VEC_D *fh,
const QUAD *quad);
void robin_bound_matrix_info(EL_MATRIX_INFO *robin_info,
const FE_SPACE *row_fe_space,
const FE_SPACE *col_fe_space,
const BNDRY_FLAGS robin_segment,
REAL alpha_r,
const WALL_QUAD *wall_quad,
REAL exponent);
void robin_bound(DOF_MATRIX *matrix,
const BNDRY_FLAGS robin_seg,
REAL alpha_r,
const WALL_QUAD *wall_quad,
REAL exponent);
bool boundary_conditions(DOF_MATRIX *matrix,
DOF_REAL_VEC *fh,
DOF_REAL_VEC *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
REAL (*g)(const REAL_D x),
REAL (*gn)(const REAL_D x, const REAL_D normal),
REAL alpha_r,
const WALL_QUAD *wall_quad);
bool boundary_conditions_loc(DOF_MATRIX *matrix,
DOF_REAL_VEC *fh,
DOF_REAL_VEC *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
LOC_FCT_AT_QP g_at_qp,
LOC_FCT_AT_QP gn_at_qp,
void *app_data, FLAGS fill_flags,
REAL alpha_r,
const WALL_QUAD *wall_quad);
bool boundary_conditions_dow(DOF_MATRIX *matrix,
DOF_REAL_VEC_D *fh,
DOF_REAL_VEC_D *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
const REAL *(*g)(const REAL_D x, REAL_D res),
const REAL *(*gn)(const REAL_D x,
const REAL_D normal,
REAL_D res),
REAL alpha_r,
const WALL_QUAD *wall_quad);
bool boundary_conditions_loc_dow(DOF_MATRIX *matrix,
DOF_REAL_VEC_D *fh,
DOF_REAL_VEC_D *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
LOC_FCT_D_AT_QP g_at_qp,
LOC_FCT_D_AT_QP gn_at_qp,
void *app_data, FLAGS fill_flags,
REAL alpha_r,
const WALL_QUAD *wall_quad);
/* ... _d versions */
static inline
void L2scp_fct_bas_d(FCT_D_AT_X fct, const QUAD *quad, DOF_REAL_D_VEC *fhd)
{
L2scp_fct_bas_dow(fct, quad, (DOF_REAL_VEC_D *)fhd);
}
static inline
void L2scp_fct_bas_loc_d(DOF_REAL_D_VEC *fh,
LOC_FCT_D_AT_QP f_at_qp, void *fd, FLAGS fill_flag,
const QUAD *quad)
{
L2scp_fct_bas_loc_dow((DOF_REAL_VEC_D *)fh, f_at_qp, fd, fill_flag, quad);
}
static inline
void H1scp_fct_bas_d(GRD_FCT_D_AT_X f, const QUAD *quad, DOF_REAL_D_VEC *fh)
{
H1scp_fct_bas_dow(f, quad, (DOF_REAL_VEC_D *)fh);
}
static inline
void H1scp_fct_bas_loc_d(DOF_REAL_D_VEC *fh,
GRD_LOC_FCT_D_AT_QP f, void *fd, FLAGS fill_flag,
const QUAD *quad)
{
H1scp_fct_bas_loc_dow((DOF_REAL_VEC_D *)fh, f, fd, fill_flag, quad);
}
static inline
bool bndry_L2scp_fct_bas_d(DOF_REAL_D_VEC *fh,
const REAL *(*f)(const REAL_D x,
const REAL_D normal,
REAL_D result),
const BNDRY_FLAGS bndry_seg,
const WALL_QUAD *quad)
{
return bndry_L2scp_fct_bas_dow((DOF_REAL_VEC_D *)fh, f, bndry_seg, quad);
}
static inline
bool bndry_L2scp_fct_bas_loc_d(DOF_REAL_D_VEC *fh,
LOC_FCT_D_AT_QP f_at_qp, void *fd,
FLAGS fill_flag,
const BNDRY_FLAGS bndry_seg,
const WALL_QUAD *quad)
{
return bndry_L2scp_fct_bas_loc_dow((DOF_REAL_VEC_D *)fh,
f_at_qp, fd, fill_flag, bndry_seg, quad);
}
static inline
bool dirichlet_bound_d(DOF_REAL_D_VEC *fh, DOF_REAL_D_VEC *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
const REAL *(*g)(const REAL_D, REAL_D))
{
return dirichlet_bound_dow((DOF_REAL_VEC_D *)fh, (DOF_REAL_VEC_D *)uh,
bound, dirichlet_segment, g);
}
static inline
bool dirichlet_bound_loc_d(DOF_REAL_D_VEC *fh, DOF_REAL_D_VEC *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
LOC_FCT_D_AT_QP g_at_qp, void *gd, FLAGS fill_flags)
{
return dirichlet_bound_loc_dow((DOF_REAL_VEC_D *)fh, (DOF_REAL_VEC_D *)uh,
bound, dirichlet_segment,
g_at_qp, gd, fill_flags);
}
static inline
const REAL *mean_value_d(MESH *mesh,
FCT_D_AT_X f,
const DOF_REAL_D_VEC *fh,
const QUAD *quad,
REAL_D mean)
{
return mean_value_dow(mesh, f, (const DOF_REAL_VEC_D *)fh, quad, mean);
}
static inline
const REAL *mean_value_loc_d(REAL_D mean,
MESH *mesh,
LOC_FCT_D_AT_QP f_at_qp, void *fd, FLAGS fill_flag,
const DOF_REAL_D_VEC *fh,
const QUAD *quad)
{
return mean_value_loc_dow(
mean, mesh, f_at_qp, fd, fill_flag, (const DOF_REAL_VEC_D *)fh, quad);
}
static inline
bool boundary_conditions_d(DOF_MATRIX *matrix,
DOF_REAL_D_VEC *fh,
DOF_REAL_D_VEC *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
const REAL *(*g)(const REAL_D x, REAL_D res),
const REAL *(*gn)(const REAL_D x,
const REAL_D normal,
REAL_D res),
REAL alpha_r,
const WALL_QUAD *wall_quad)
{
return boundary_conditions_dow(matrix,
(DOF_REAL_VEC_D *)fh, (DOF_REAL_VEC_D *)uh,
bound, dirichlet_segment, g, gn, alpha_r,
wall_quad);
}
static inline
bool boundary_conditions_loc_d(DOF_MATRIX *matrix,
DOF_REAL_D_VEC *fh,
DOF_REAL_D_VEC *uh,
DOF_SCHAR_VEC *bound,
const BNDRY_FLAGS dirichlet_segment,
LOC_FCT_D_AT_QP g_at_qp,
LOC_FCT_D_AT_QP gn_at_qp,
void *gdata, FLAGS fill_flags,
REAL alpha_r,
const WALL_QUAD *wall_quad)
{
return boundary_conditions_loc_dow(matrix,
(DOF_REAL_VEC_D *)fh, (DOF_REAL_VEC_D *)uh,
bound, dirichlet_segment,
g_at_qp, gn_at_qp, gdata, fill_flags,
alpha_r, wall_quad);
}
/* file oem_solve.c *******************************************************/
extern OEM_MV_FCT get_oem_solver(OEM_SOLVER solver);
extern OEM_DATA *init_oem_solve(const DOF_MATRIX *A,
const DOF_SCHAR_VEC *bound,
REAL tol, const PRECON *precon,
int restart, int max_iter, int info);
extern const PRECON *init_oem_precon(const DOF_MATRIX *A,
const DOF_SCHAR_VEC *mask,
int info, OEM_PRECON precon,
... /* ssor_omega, ssor_n_iter etc. */);
extern const PRECON *vinit_oem_precon(const DOF_MATRIX *A,
const DOF_SCHAR_VEC *mask,
int info, OEM_PRECON,
va_list ap);
const PRECON *init_precon_from_type(const DOF_MATRIX *A,
const DOF_SCHAR_VEC *mask,
int info,
const PRECON_TYPE *prec_type);
extern void release_oem_solve(const OEM_DATA *oem);
extern int oem_mat_vec(void *ud, int dim, const REAL *x, REAL *y);
extern OEM_MV_FCT
init_oem_mat_vec(void **datap,
MatrixTranspose transpose, const DOF_MATRIX *A,
const DOF_SCHAR_VEC *bound);
extern void exit_oem_mat_vec(void *);
extern int call_oem_solve_s(const OEM_DATA *oem, OEM_SOLVER solver,
const DOF_REAL_VEC *f, DOF_REAL_VEC *u);
extern int
oem_solve_s(const DOF_MATRIX *A, const DOF_SCHAR_VEC *bound,
const DOF_REAL_VEC *f, DOF_REAL_VEC *u, OEM_SOLVER solver,
REAL tol, const PRECON *precon,
int restart, int max_iter, int info);
extern int call_oem_solve_dow(const OEM_DATA *oem, OEM_SOLVER solver,
const DOF_REAL_VEC_D *f, DOF_REAL_VEC_D *u);
extern int
oem_solve_dow(const DOF_MATRIX *A, const DOF_SCHAR_VEC *bound,
const DOF_REAL_VEC_D *f, DOF_REAL_VEC_D *u, OEM_SOLVER solver,
REAL tol, const PRECON *precon,
int restart, int max_iter, int info);
static inline
int call_oem_solve_d(const OEM_DATA *oem, OEM_SOLVER solver,
const DOF_REAL_D_VEC *f, DOF_REAL_D_VEC *u)
{
return call_oem_solve_dow(oem, solver,
(const DOF_REAL_VEC_D *)f, (DOF_REAL_VEC_D *)u);
}
static inline
int oem_solve_d(const DOF_MATRIX *A, const DOF_SCHAR_VEC *bound,
const DOF_REAL_D_VEC *f, DOF_REAL_D_VEC *u, OEM_SOLVER solver,
REAL tol, const PRECON *precon,
int restart, int max_iter, int info)
{
return oem_solve_dow(A, bound,
(const DOF_REAL_VEC_D *)f, (DOF_REAL_VEC_D *)u, solver,
tol, precon, restart, max_iter, info);
}
/* file oem_sp_solve.c ******************************************************/
typedef struct sp_constraint
{
const DOF_MATRIX *B, *Bt;
const DOF_SCHAR_VEC *bound;
OEM_MV_FCT project;
void *project_data; /* possibly "OEM_DATA *" */
OEM_MV_FCT precon;
void *precon_data; /* possibly "OEM_DATA *" */
REAL proj_factor, prec_factor;
} SP_CONSTRAINT;
SP_CONSTRAINT *init_sp_constraint(const DOF_MATRIX *B,
const DOF_MATRIX *Bt,
const DOF_SCHAR_VEC *bound,
REAL tol, int info,
const DOF_MATRIX *Yproj,
OEM_SOLVER Yproj_solver,
int Yproj_max_iter, const PRECON *Yproj_prec,
const DOF_MATRIX *Yprec,
OEM_SOLVER Yprec_solver,
int Yprec_max_iter, const PRECON *Yprec_prec,
REAL Yproj_frac, REAL Yprec_frac);
void release_sp_constraint(SP_CONSTRAINT *constr);
int oem_sp_schur_solve(OEM_SOLVER sp_solver,
REAL sp_tol, int sp_max_iter, int sp_info,
OEM_MV_FCT principal_inverse,
OEM_DATA *principal_data,
const DOF_REAL_VEC_D *f,
DOF_REAL_VEC_D *u,
SP_CONSTRAINT *constraint,
const DOF_REAL_VEC *g,
DOF_REAL_VEC *p,
...);
int oem_sp_solve_dow_scl(OEM_SOLVER sp_solver,
REAL sp_tol, REAL tol_incr,
int sp_max_iter, int sp_info,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *bound,
OEM_SOLVER A_solver,
int A_max_iter, const PRECON *A_precon,
DOF_MATRIX *B,
DOF_MATRIX *Bt,
DOF_MATRIX *Yproj,
OEM_SOLVER Yproj_solver,
int Yproj_max_iter, const PRECON *Yproj_precon,
DOF_MATRIX *Yprec,
OEM_SOLVER Yprec_solver,
int Yprec_max_iter, const PRECON *Yprec_precon,
REAL Yproj_frac, REAL Ypre_frac,
const DOF_REAL_VEC_D *f,
const DOF_REAL_VEC *g,
DOF_REAL_VEC_D *x,
DOF_REAL_VEC *y);
REAL sp_dirichlet_bound_dow_scl(MatrixTranspose transpose,
const DOF_MATRIX *Bt,
const DOF_SCHAR_VEC *bound,
const DOF_REAL_VEC_D *u_h,
DOF_REAL_VEC *g_h);
REAL sp_flux_adjust_dow_scl(MatrixTranspose transpose,
const DOF_MATRIX *Bt,
const DOF_SCHAR_VEC *bound,
const DOF_REAL_VEC_D *u_h,
DOF_REAL_VEC *g_h,
REAL initial_flux,
bool do_adjust);
static inline
int oem_sp_solve_ds(
OEM_SOLVER sp_solver,
REAL sp_tol, REAL tol_incr,
int sp_max_iter, int sp_info,
const DOF_MATRIX *A, const DOF_SCHAR_VEC *bound,
OEM_SOLVER A_solver, int A_max_iter, const PRECON *A_prec,
DOF_MATRIX *B,
DOF_MATRIX *Bt,
DOF_MATRIX *Yproj,
OEM_SOLVER Yproj_solver, int Yproj_max_iter, const PRECON *Yproj_prec,
DOF_MATRIX *Yprec,
OEM_SOLVER Yprec_solver, int Yprec_max_iter, const PRECON *Yprec_prec,
REAL Yproj_frac, REAL Yprec_frac,
const DOF_REAL_D_VEC *f,
const DOF_REAL_VEC *g,
DOF_REAL_D_VEC *x,
DOF_REAL_VEC *y)
{
return oem_sp_solve_dow_scl(sp_solver, sp_tol, tol_incr, sp_max_iter, sp_info,
A, bound, A_solver, A_max_iter, A_prec,
B, Bt,
Yproj, Yproj_solver, Yproj_max_iter, Yproj_prec,
Yprec, Yprec_solver, Yprec_max_iter, Yprec_prec,
Yproj_frac, Yprec_frac,
(const DOF_REAL_VEC_D *)f, g,
(DOF_REAL_VEC_D *)x, y);
}
static inline
REAL sp_dirichlet_bound_ds(MatrixTranspose transpose,
const DOF_MATRIX *Bt,
const DOF_SCHAR_VEC *bound,
const DOF_REAL_D_VEC *u_h,
DOF_REAL_VEC *g_h)
{
return sp_dirichlet_bound_dow_scl(transpose, Bt, bound,
(const DOF_REAL_VEC_D *)u_h, g_h);
}
/* file parametric.c ********************************************************/
void use_lagrange_parametric(MESH *mesh, int degree,
NODE_PROJ *n_proj,
FLAGS flags);
DOF_REAL_D_VEC *get_lagrange_coords(MESH *mesh);
DOF_PTR_VEC *get_lagrange_edge_projections(MESH *mesh);
typedef enum param_copy_direction {
COPY_FROM_MESH = false,
COPY_TO_MESH = true
} PARAM_COPY_DIRECTION;
void copy_lagrange_coords(MESH *mesh, DOF_REAL_D_VEC *coords, bool tomesh);
/*-- file sor.c *************************************************************/
int sor_d(DOF_MATRIX *a, const DOF_REAL_D_VEC *f, const DOF_SCHAR_VEC *b,
DOF_REAL_D_VEC *u, REAL omega, REAL tol, int max_iter, int info);
int sor_s(DOF_MATRIX *a, const DOF_REAL_VEC *f, const DOF_SCHAR_VEC *b,
DOF_REAL_VEC *u, REAL omega, REAL tol, int max_iter, int info);
/*** file ssor.c ************************************************************/
int ssor_d(DOF_MATRIX *a, const DOF_REAL_D_VEC *f, const DOF_SCHAR_VEC *b,
DOF_REAL_D_VEC *u, REAL omega, REAL tol, int max_iter, int info);
int ssor_s(DOF_MATRIX *a, const DOF_REAL_VEC *f, const DOF_SCHAR_VEC *b,
DOF_REAL_VEC *u, REAL omega, REAL tol, int max_iter, int info);
/*** file traverse_r.c *****************************************************/
extern void mesh_traverse(MESH *mesh, int level, FLAGS fill_flag,
void (*el_fct)(const EL_INFO *, void *data),
void *data);
extern void fill_macro_info(MESH *mesh, const MACRO_EL *mel, EL_INFO *elinfo);
extern void fill_elinfo(int ichild, FLAGS mask,
const EL_INFO *parent_info, EL_INFO *elinfo);
/*** file traverse_nr.c *****************************************************/
extern TRAVERSE_STACK *get_traverse_stack(void);
extern void free_traverse_stack(TRAVERSE_STACK *stack);
extern const EL_INFO *traverse_first(TRAVERSE_STACK *stack,
MESH *mesh, int level, FLAGS fill_flag);
extern const EL_INFO *traverse_next(TRAVERSE_STACK *stack, const EL_INFO *);
extern const EL_INFO *traverse_neighbour(TRAVERSE_STACK *stack, const EL_INFO *,
int neighbour);
extern const EL_INFO *traverse_parent(const TRAVERSE_STACK *stack,
const EL_INFO *child);
extern const EL_INFO *subtree_traverse_first(TRAVERSE_STACK *stack,
const EL_INFO *local_root,
int level, FLAGS fill_flag);
void clear_traverse_mark(TRAVERSE_STACK *stack);
#define TRAVERSE_FIRST(mesh, level, fill_flag) \
{ \
TRAVERSE_STACK *stack = get_traverse_stack(); \
const EL_INFO *el_info; \
if ((el_info = traverse_first(stack, (mesh), (level), (fill_flag)))) do
#define TRAVERSE_NEXT(/**/) \
while ((el_info = traverse_next(stack, el_info))); \
free_traverse_stack(stack); \
}
/* Compatibility */
#define TRAVERSE_START(mesh, level, fill_flag) \
TRAVERSE_FIRST(mesh, level, fill_flag)
#define TRAVERSE_STOP(/**/) TRAVERSE_NEXT()
#define TRAVERSE_NEIGHBOUR(el_info, neighbour) \
traverse_neighbour(stack, el_info, neighbour)
/* file trav_xy.c ***********************************************************/
extern int find_el_at_pt(MESH *mesh, const REAL_D xy,
EL_INFO **el_info_p, FLAGS flag, REAL_B bary,
const MACRO_EL *start_mel,
const REAL_D xy0, REAL *sp);
/*** file read_mesh.c ******************************************************/
extern MESH *
read_mesh(const char *fn, REAL *timeptr,
NODE_PROJ *(*n_proj)(MESH *, MACRO_EL *, int),
MESH *master);
DOF_REAL_VEC *read_dof_real_vec(const char *, MESH *, FE_SPACE *);
DOF_REAL_D_VEC *read_dof_real_d_vec(const char *, MESH *, FE_SPACE *);
DOF_REAL_VEC_D *read_dof_real_vec_d(const char *, MESH *, FE_SPACE *);
DOF_INT_VEC *read_dof_int_vec(const char *, MESH *, FE_SPACE *);
DOF_SCHAR_VEC *read_dof_schar_vec(const char *, MESH *, FE_SPACE *);
DOF_UCHAR_VEC *read_dof_uchar_vec(const char *, MESH *, FE_SPACE *);
extern MESH *
fread_mesh(FILE *fp, REAL *timeptr,
NODE_PROJ *(*n_proj)(MESH *, MACRO_EL *, int),
MESH *master);
DOF_REAL_VEC *fread_dof_real_vec(FILE *fp, MESH *, FE_SPACE *);
DOF_REAL_D_VEC *fread_dof_real_d_vec(FILE *fp, MESH *, FE_SPACE *);
DOF_REAL_VEC_D *fread_dof_real_vec_d(FILE *fp, MESH *, FE_SPACE *);
DOF_INT_VEC *fread_dof_int_vec(FILE *fp, MESH *, FE_SPACE *);
DOF_SCHAR_VEC *fread_dof_schar_vec(FILE *fp, MESH *, FE_SPACE *);
DOF_UCHAR_VEC *fread_dof_uchar_vec(FILE *fp, MESH *, FE_SPACE *);
extern MESH *
read_mesh_xdr(const char *file, REAL *timeptr,
NODE_PROJ *(*)(MESH *, MACRO_EL *, int),
MESH *master);
DOF_REAL_VEC *read_dof_real_vec_xdr(const char *, MESH *, FE_SPACE *);
DOF_REAL_D_VEC *read_dof_real_d_vec_xdr(const char *, MESH *, FE_SPACE *);
DOF_REAL_VEC_D *read_dof_real_vec_d_xdr(const char *, MESH *, FE_SPACE *);
DOF_INT_VEC *read_dof_int_vec_xdr(const char *, MESH *, FE_SPACE *);
DOF_SCHAR_VEC *read_dof_schar_vec_xdr(const char *, MESH *, FE_SPACE *);
DOF_UCHAR_VEC *read_dof_uchar_vec_xdr(const char *, MESH *, FE_SPACE *);
extern MESH *
fread_mesh_xdr(FILE *fp, REAL *timeptr,
NODE_PROJ *(*)(MESH *, MACRO_EL *, int),
MESH *master);
DOF_REAL_VEC *fread_dof_real_vec_xdr(FILE *fp, MESH *, FE_SPACE *);
DOF_REAL_D_VEC *fread_dof_real_d_vec_xdr(FILE *fp, MESH *, FE_SPACE *);
DOF_REAL_VEC_D *fread_dof_real_vec_d_xdr(FILE *fp, MESH *, FE_SPACE *);
DOF_INT_VEC *fread_dof_int_vec_xdr(FILE *fp, MESH *, FE_SPACE *);
DOF_SCHAR_VEC *fread_dof_schar_vec_xdr(FILE *fp, MESH *, FE_SPACE *);
DOF_UCHAR_VEC *fread_dof_uchar_vec_xdr(FILE *fp, MESH *, FE_SPACE *);
#if 0
/* IFF format (multiple objects in one file) */
/* FORM
length
AFEM
MESH
length
data
AVEC
length
data
AVEC
length
data
where AVEC is one of DRV DRDV DUCV DSCV DINV
*/
#define IFF_TAG_ALBERTA "AFEM"
#define IFF_TAG_MESH "MESH"
#define IFF_TAG_REAL_VEC "DRV "
#define IFF_TAG_REAL_D_VEC "DRDV"
#define IFF_TAG_INT_VEC "DINV"
#define IFF_TAG_UCHAR_VEC "DUCV"
#define IFF_TAG_SCHAR_VEC "DSCV"
static inline bool is_iff_tag(const char tag1[4], const char tag2[4])
{
return memcmp(tag1, tag2, 4) == 0;
}
/* fread_iff() just read in the tag and the size, afterwards the
* normal read_xdr() routines can be used to suck in the following
* data, depending on what TAG contains.
*/
bool fread_iff(FILE *fp, char tag[4], unsigned int *size);
FILE *read_iff(const char *filename, char tag[4], unsigned int *size);
#endif
/*** file write_mesh.c *****************************************************/
bool write_mesh(MESH *, const char *, REAL);
bool write_dof_real_vec(const DOF_REAL_VEC *, const char *);
bool write_dof_real_vec_d(const DOF_REAL_VEC_D *, const char *);
bool write_dof_real_d_vec(const DOF_REAL_D_VEC *, const char *);
bool write_dof_int_vec(const DOF_INT_VEC *, const char *);
bool write_dof_schar_vec(const DOF_SCHAR_VEC *, const char *);
bool write_dof_uchar_vec(const DOF_UCHAR_VEC *, const char *);
bool fwrite_mesh(MESH *, FILE *fp, REAL);
bool fwrite_dof_real_vec(const DOF_REAL_VEC *, FILE *fp);
bool fwrite_dof_real_d_vec(const DOF_REAL_D_VEC *, FILE *fp);
bool fwrite_dof_int_vec(const DOF_INT_VEC *, FILE *fp);
bool fwrite_dof_schar_vec(const DOF_SCHAR_VEC *, FILE *fp);
bool fwrite_dof_uchar_vec(const DOF_UCHAR_VEC *, FILE *fp);
bool write_mesh_xdr(MESH *, const char *, REAL);
bool write_dof_real_vec_xdr(const DOF_REAL_VEC *, const char *);
bool write_dof_real_vec_d_xdr(const DOF_REAL_VEC_D *, const char *);
bool write_dof_real_d_vec_xdr(const DOF_REAL_D_VEC *, const char *);
bool write_dof_int_vec_xdr(const DOF_INT_VEC *, const char *);
bool write_dof_schar_vec_xdr(const DOF_SCHAR_VEC *, const char *);
bool write_dof_uchar_vec_xdr(const DOF_UCHAR_VEC *, const char *);
bool fwrite_mesh_xdr(MESH *, FILE *fp, REAL time);
bool fwrite_dof_real_vec_xdr(const DOF_REAL_VEC *, FILE *fp);
bool fwrite_dof_real_vec_d_xdr(const DOF_REAL_VEC_D *, FILE *fp);
bool fwrite_dof_real_d_vec_xdr(const DOF_REAL_D_VEC *, FILE *fp);
bool fwrite_dof_int_vec_xdr(const DOF_INT_VEC *, FILE *fp);
bool fwrite_dof_schar_vec_xdr(const DOF_SCHAR_VEC *, FILE *fp);
bool fwrite_dof_uchar_vec_xdr(const DOF_UCHAR_VEC *, FILE *fp);
bool write_dof_matrix_pbm(const DOF_MATRIX *matrix, const char *filename);
bool fwrite_dof_matrix_pbm(const DOF_MATRIX *matrix, FILE *file);
/* Writing of IFF-files, writing requires file-positioning support. */
#if 0
bool fwrite_iff(FILE *fp);
bool fterm_iff(FILE *fp);
FILE *fopen_iff(const char *filename, bool append);
bool fclose_iff(FILE *fp);
bool fwrite_mesh_iff(MESH *mesh, REAL time, FILE *fp);
bool fwrite_dof_real_vec_iff(const DOF_REAL_VEC *v, FILE *fp);
bool fwrite_dof_real_d_vec_iff(const DOF_REAL_D_VEC *v, FILE *fp);
bool fwrite_dof_int_vec_iff(const DOF_INT_VEC *v, FILE *fp);
bool fwrite_dof_schar_vec_iff(const DOF_SCHAR_VEC *v, FILE *fp);
bool fwrite_dof_uchar_vec_iff(const DOF_UCHAR_VEC *v, FILE *fp);
#endif
/*** file write_mesh_gmv.c *************************************************/
bool write_mesh_gmv(MESH *mesh, const char *file_name, bool write_ascii,
bool use_refined_grid,
const int n_drv,
DOF_REAL_VEC **drv_ptr,
const int n_drdv,
DOF_REAL_VEC_D **drv_dow_ptr,
DOF_REAL_VEC_D *velocity,
REAL sim_time);
bool write_dof_vec_gmv(MESH *mesh,
const char *mesh_file,
const char *file_name, bool write_ascii,
bool use_refined_grid,
const int n_drv,
DOF_REAL_VEC **drv_ptr,
const int n_drdv,
DOF_REAL_VEC_D **drv_dow_ptr,
DOF_REAL_VEC_D *velocity,
REAL sim_time);
/*-- file write_mesh_ps.c ***************************************************/
void write_mesh_ps(MESH *mesh, const char *filename, const char *title,
const REAL x[2], const REAL y[2], bool keepaspect,
bool draw_bound);
/*******************************************************************************
* interface for Lagrange elements for the gltools
* file gltools.c
******************************************************************************/
typedef void* GLTOOLS_WINDOW;
GLTOOLS_WINDOW open_gltools_window(const char *, const char *, const REAL *,
MESH *, int);
void close_gltools_window(GLTOOLS_WINDOW);
extern int gltools_get_next_dialog(void);
extern void gltools_set_next_dialog(int dialog);
extern void gltools_est(GLTOOLS_WINDOW, MESH *,
REAL (*rw_est)(EL *el), REAL min, REAL max, REAL time);
extern void gltools_disp_mesh(GLTOOLS_WINDOW, MESH *,
bool mark, const DOF_REAL_VEC_D *, REAL time);
extern void gltools_mesh(GLTOOLS_WINDOW win, MESH *, bool mark, REAL time);
extern void gltools_disp_drv(GLTOOLS_WINDOW, const DOF_REAL_VEC *,
REAL min, REAL max, const DOF_REAL_VEC_D *,
REAL time);
extern void gltools_drv(GLTOOLS_WINDOW, const DOF_REAL_VEC *,
REAL min, REAL max, REAL time);
extern void gltools_disp_drv_d(GLTOOLS_WINDOW, const DOF_REAL_VEC_D *,
REAL min, REAL max, const DOF_REAL_VEC_D *,
REAL time);
extern void gltools_drv_d(GLTOOLS_WINDOW, const DOF_REAL_VEC_D *,
REAL min, REAL max, REAL time);
extern void gltools_disp_vec(GLTOOLS_WINDOW, const DOF_REAL_VEC_D *,
REAL min, REAL max, const DOF_REAL_VEC_D *,
REAL time);
extern void gltools_vec(GLTOOLS_WINDOW, const DOF_REAL_VEC_D *,
REAL min, REAL max, REAL time);
/*******************************************************************************
* interface for Lagrange elements for the dxtools
* file dxtools.c
******************************************************************************/
typedef struct dxtools_window DXTOOLS_WINDOW;
extern DXTOOLS_WINDOW *open_dxtools_window(const char *title,
const char *geometry);
extern void close_dxtools_window(DXTOOLS_WINDOW *win);
extern void dxtools_mesh(DXTOOLS_WINDOW *win, MESH *mesh);
extern void dxtools_drv(DXTOOLS_WINDOW *win, const DOF_REAL_VEC *u);
extern void dxtools_drdv(DXTOOLS_WINDOW *win, const DOF_REAL_D_VEC *u);
#ifdef __cplusplus
} /* extern "C" */
#endif
/*******************************************************************************
*
* A couple of header files containing inline functions for various purposes
*
******************************************************************************/
#include "alberta_inlines.h" /* DIM_OF_WORLD blas */
#include "dof_chains.h" /* support for chains of objects */
#include "el_vec.h" /* element vectors and matrices */
#include "evaluate.h" /* evaluation of finite element functions */
#endif /* !_ALBERTA_H_ */
|