/usr/lib/python2.7/dist-packages/dolfin/cpp/function.py is in python-dolfin 2016.2.0-2.
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 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (3, 0, 0):
new_instancemethod = lambda func, inst, cls: _function.SWIG_PyInstanceMethod_New(func)
else:
from new import instancemethod as new_instancemethod
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
import importlib
pkg = __name__.rpartition('.')[0]
mname = '.'.join((pkg, '_function')).lstrip('.')
try:
return importlib.import_module(mname)
except ImportError:
return importlib.import_module('_function')
_function = swig_import_helper()
del swig_import_helper
elif _swig_python_version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_function', [dirname(__file__)])
except ImportError:
import _function
return _function
if fp is not None:
try:
_mod = imp.load_module('_function', fp, pathname, description)
finally:
fp.close()
return _mod
_function = swig_import_helper()
del swig_import_helper
else:
import _function
del _swig_python_version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
try:
import builtins as __builtin__
except ImportError:
import __builtin__
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
object.__setattr__(self, name, value)
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr(self, class_type, name):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
def _swig_setattr_nondynamic_method(set):
def set_attr(self, name, value):
if (name == "thisown"):
return self.this.own(value)
if hasattr(self, name) or (name == "this"):
set(self, name, value)
else:
raise AttributeError("You cannot add attributes to %s" % self)
return set_attr
try:
import weakref
weakref_proxy = weakref.proxy
except __builtin__.Exception:
weakref_proxy = lambda x: x
SHARED_PTR_DISOWN = _function.SHARED_PTR_DISOWN
def _attach_base_to_numpy_array(obj, owner):
return _function._attach_base_to_numpy_array(obj, owner)
_attach_base_to_numpy_array = _function._attach_base_to_numpy_array
def dolfin_swigversion():
return _function.dolfin_swigversion()
dolfin_swigversion = _function.dolfin_swigversion
def dolfin_pythonversion():
return _function.dolfin_pythonversion()
dolfin_pythonversion = _function.dolfin_pythonversion
tmp = hex(dolfin_swigversion())
__swigversion__ = "%d.%d.%d"%(tuple(map(int, [tmp[-5], tmp[-3], tmp[-2:]])))
tmp = hex(dolfin_pythonversion())
__pythonversion__ = "%d.%d.%d"%(tuple(map(lambda x: int(x,16), [tmp[2], tmp[3:5], tmp[5:7]])))
del tmp, dolfin_pythonversion, dolfin_swigversion
def has_petsc4py():
return _function.has_petsc4py()
has_petsc4py = _function.has_petsc4py
def has_slepc4py():
return _function.has_slepc4py()
has_slepc4py = _function.has_slepc4py
UFC_VERSION_MAJOR = _function.UFC_VERSION_MAJOR
UFC_VERSION_MINOR = _function.UFC_VERSION_MINOR
UFC_VERSION_MAINTENANCE = _function.UFC_VERSION_MAINTENANCE
UFC_VERSION_RELEASE = _function.UFC_VERSION_RELEASE
ufc_shape_interval = _function.ufc_shape_interval
ufc_shape_triangle = _function.ufc_shape_triangle
ufc_shape_quadrilateral = _function.ufc_shape_quadrilateral
ufc_shape_tetrahedron = _function.ufc_shape_tetrahedron
ufc_shape_hexahedron = _function.ufc_shape_hexahedron
class ufc_cell(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_destroy__ = _function.delete_ufc_cell
cell_shape = _swig_property(_function.ufc_cell_cell_shape_get, _function.ufc_cell_cell_shape_set)
topological_dimension = _swig_property(_function.ufc_cell_topological_dimension_get, _function.ufc_cell_topological_dimension_set)
geometric_dimension = _swig_property(_function.ufc_cell_geometric_dimension_get, _function.ufc_cell_geometric_dimension_set)
index = _swig_property(_function.ufc_cell_index_get, _function.ufc_cell_index_set)
local_facet = _swig_property(_function.ufc_cell_local_facet_get, _function.ufc_cell_local_facet_set)
mesh_identifier = _swig_property(_function.ufc_cell_mesh_identifier_get, _function.ufc_cell_mesh_identifier_set)
ufc_cell_swigregister = _function.ufc_cell_swigregister
ufc_cell_swigregister(ufc_cell)
cvar = _function.cvar
UFC_VERSION = cvar.UFC_VERSION
class ufc_function(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _function.delete_ufc_function
ufc_function_swigregister = _function.ufc_function_swigregister
ufc_function_swigregister(ufc_function)
class ufc_finite_element(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _function.delete_ufc_finite_element
ufc_finite_element_swigregister = _function.ufc_finite_element_swigregister
ufc_finite_element_swigregister(ufc_finite_element)
class ufc_dofmap(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _function.delete_ufc_dofmap
ufc_dofmap_swigregister = _function.ufc_dofmap_swigregister
ufc_dofmap_swigregister(ufc_dofmap)
class ufc_coordinate_mapping(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _function.delete_ufc_coordinate_mapping
ufc_coordinate_mapping_swigregister = _function.ufc_coordinate_mapping_swigregister
ufc_coordinate_mapping_swigregister(ufc_coordinate_mapping)
class ufc_form(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _function.delete_ufc_form
ufc_form_swigregister = _function.ufc_form_swigregister
ufc_form_swigregister(ufc_form)
def make_ufc_finite_element(*args):
return _function.make_ufc_finite_element(*args)
make_ufc_finite_element = _function.make_ufc_finite_element
def make_ufc_dofmap(*args):
return _function.make_ufc_dofmap(*args)
make_ufc_dofmap = _function.make_ufc_dofmap
def make_ufc_coordinate_mapping(*args):
return _function.make_ufc_coordinate_mapping(*args)
make_ufc_coordinate_mapping = _function.make_ufc_coordinate_mapping
def make_ufc_form(*args):
return _function.make_ufc_form(*args)
make_ufc_form = _function.make_ufc_form
import common
class HierarchicalMesh(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, arg2):
_function.HierarchicalMesh_swiginit(self, _function.new_HierarchicalMesh(arg2))
__swig_destroy__ = _function.delete_HierarchicalMesh
HierarchicalMesh.depth = new_instancemethod(_function.HierarchicalMesh_depth, None, HierarchicalMesh)
HierarchicalMesh.has_parent = new_instancemethod(_function.HierarchicalMesh_has_parent, None, HierarchicalMesh)
HierarchicalMesh.has_child = new_instancemethod(_function.HierarchicalMesh_has_child, None, HierarchicalMesh)
HierarchicalMesh._parent = new_instancemethod(_function.HierarchicalMesh__parent, None, HierarchicalMesh)
HierarchicalMesh._child = new_instancemethod(_function.HierarchicalMesh__child, None, HierarchicalMesh)
HierarchicalMesh._root_node = new_instancemethod(_function.HierarchicalMesh__root_node, None, HierarchicalMesh)
HierarchicalMesh._leaf_node = new_instancemethod(_function.HierarchicalMesh__leaf_node, None, HierarchicalMesh)
HierarchicalMesh.set_parent = new_instancemethod(_function.HierarchicalMesh_set_parent, None, HierarchicalMesh)
HierarchicalMesh.clear_child = new_instancemethod(_function.HierarchicalMesh_clear_child, None, HierarchicalMesh)
HierarchicalMesh.set_child = new_instancemethod(_function.HierarchicalMesh_set_child, None, HierarchicalMesh)
HierarchicalMesh._debug = new_instancemethod(_function.HierarchicalMesh__debug, None, HierarchicalMesh)
HierarchicalMesh_swigregister = _function.HierarchicalMesh_swigregister
HierarchicalMesh_swigregister(HierarchicalMesh)
import mesh
import la
class HierarchicalFunctionSpace(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, arg2):
_function.HierarchicalFunctionSpace_swiginit(self, _function.new_HierarchicalFunctionSpace(arg2))
__swig_destroy__ = _function.delete_HierarchicalFunctionSpace
HierarchicalFunctionSpace.depth = new_instancemethod(_function.HierarchicalFunctionSpace_depth, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace.has_parent = new_instancemethod(_function.HierarchicalFunctionSpace_has_parent, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace.has_child = new_instancemethod(_function.HierarchicalFunctionSpace_has_child, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace._parent = new_instancemethod(_function.HierarchicalFunctionSpace__parent, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace._child = new_instancemethod(_function.HierarchicalFunctionSpace__child, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace._root_node = new_instancemethod(_function.HierarchicalFunctionSpace__root_node, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace._leaf_node = new_instancemethod(_function.HierarchicalFunctionSpace__leaf_node, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace.set_parent = new_instancemethod(_function.HierarchicalFunctionSpace_set_parent, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace.clear_child = new_instancemethod(_function.HierarchicalFunctionSpace_clear_child, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace.set_child = new_instancemethod(_function.HierarchicalFunctionSpace_set_child, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace._debug = new_instancemethod(_function.HierarchicalFunctionSpace__debug, None, HierarchicalFunctionSpace)
HierarchicalFunctionSpace_swigregister = _function.HierarchicalFunctionSpace_swigregister
HierarchicalFunctionSpace_swigregister(HierarchicalFunctionSpace)
class HierarchicalFunction(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, arg2):
_function.HierarchicalFunction_swiginit(self, _function.new_HierarchicalFunction(arg2))
__swig_destroy__ = _function.delete_HierarchicalFunction
HierarchicalFunction.depth = new_instancemethod(_function.HierarchicalFunction_depth, None, HierarchicalFunction)
HierarchicalFunction.has_parent = new_instancemethod(_function.HierarchicalFunction_has_parent, None, HierarchicalFunction)
HierarchicalFunction.has_child = new_instancemethod(_function.HierarchicalFunction_has_child, None, HierarchicalFunction)
HierarchicalFunction._parent = new_instancemethod(_function.HierarchicalFunction__parent, None, HierarchicalFunction)
HierarchicalFunction._child = new_instancemethod(_function.HierarchicalFunction__child, None, HierarchicalFunction)
HierarchicalFunction._root_node = new_instancemethod(_function.HierarchicalFunction__root_node, None, HierarchicalFunction)
HierarchicalFunction._leaf_node = new_instancemethod(_function.HierarchicalFunction__leaf_node, None, HierarchicalFunction)
HierarchicalFunction.set_parent = new_instancemethod(_function.HierarchicalFunction_set_parent, None, HierarchicalFunction)
HierarchicalFunction.clear_child = new_instancemethod(_function.HierarchicalFunction_clear_child, None, HierarchicalFunction)
HierarchicalFunction.set_child = new_instancemethod(_function.HierarchicalFunction_set_child, None, HierarchicalFunction)
HierarchicalFunction._debug = new_instancemethod(_function.HierarchicalFunction__debug, None, HierarchicalFunction)
HierarchicalFunction_swigregister = _function.HierarchicalFunction_swigregister
HierarchicalFunction_swigregister(HierarchicalFunction)
class GenericFunction(ufc_function, common.Variable):
"""
This is a common base class for functions. Functions can be
evaluated at a given point and they can be restricted to a given
cell in a finite element mesh. This functionality is implemented
by sub-classes that implement the eval() and restrict() functions.
DOLFIN provides two implementations of the GenericFunction
interface in the form of the classes Function and Expression.
Sub-classes may optionally implement the update() function that
will be called prior to restriction when running in parallel.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _function.delete_GenericFunction
def value_rank(self):
"""
Return value rank
"""
return _function.GenericFunction_value_rank(self)
def value_dimension(self, i):
"""
Return value dimension for given axis
"""
return _function.GenericFunction_value_dimension(self, i)
def eval_cell(self, values, x, cell):
"""
**Overloaded versions**
* eval\ (values, x, cell)
Evaluate at given point in given cell
* eval\ (values, x)
Evaluate at given point
"""
return _function.GenericFunction_eval_cell(self, values, x, cell)
def eval(self, values, x):
"""
**Overloaded versions**
* eval\ (values, x, cell)
Evaluate at given point in given cell
* eval\ (values, x)
Evaluate at given point
"""
return _function.GenericFunction_eval(self, values, x)
def restrict(self, w, element, dolfin_cell, coordinate_dofs, ufc_cell):
"""
Restrict function to local cell (compute expansion coefficients w)
"""
return _function.GenericFunction_restrict(self, w, element, dolfin_cell, coordinate_dofs, ufc_cell)
def compute_vertex_values(self, mesh):
"""
Compute values at all mesh vertices
"""
return _function.GenericFunction_compute_vertex_values(self, mesh)
def update(self):
"""
Update off-process ghost coefficients
"""
return _function.GenericFunction_update(self)
def value_size(self):
"""
Evaluation at given point
Return value size (product of value dimensions)
"""
return _function.GenericFunction_value_size(self)
GenericFunction.value_rank = new_instancemethod(_function.GenericFunction_value_rank, None, GenericFunction)
GenericFunction.value_dimension = new_instancemethod(_function.GenericFunction_value_dimension, None, GenericFunction)
GenericFunction.eval_cell = new_instancemethod(_function.GenericFunction_eval_cell, None, GenericFunction)
GenericFunction.eval = new_instancemethod(_function.GenericFunction_eval, None, GenericFunction)
GenericFunction.restrict = new_instancemethod(_function.GenericFunction_restrict, None, GenericFunction)
GenericFunction.compute_vertex_values = new_instancemethod(_function.GenericFunction_compute_vertex_values, None, GenericFunction)
GenericFunction.update = new_instancemethod(_function.GenericFunction_update, None, GenericFunction)
GenericFunction.value_size = new_instancemethod(_function.GenericFunction_value_size, None, GenericFunction)
GenericFunction._function_space = new_instancemethod(_function.GenericFunction__function_space, None, GenericFunction)
GenericFunction_swigregister = _function.GenericFunction_swigregister
GenericFunction_swigregister(GenericFunction)
class Expression(GenericFunction):
"""
This class represents a user-defined expression. Expressions can
be used as coefficients in variational forms or interpolated
into finite element spaces.
An expression is defined by overloading the eval() method. Users
may choose to overload either a simple version of eval(), in the
case of expressions only depending on the coordinate x, or an
optional version for expressions depending on x and mesh data
like cell indices or facet normals.
The geometric dimension (the size of x) and the value rank and
dimensions of an expression must supplied as arguments to the
constructor.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* Expression\ ()
Create scalar expression.
* Expression\ (dim)
Create vector-valued expression with given dimension.
*Arguments*
dim (int)
Dimension of the vector-valued expression.
* Expression\ (dim0, dim1)
Create matrix-valued expression with given dimensions.
*Arguments*
dim0 (int)
Dimension (rows).
dim1 (int)
Dimension (columns).
* Expression\ (value_shape)
Create tensor-valued expression with given shape.
*Arguments*
value_shape (numpy.array(int))
Shape of expression.
* Expression\ (expression)
Copy constructor
*Arguments*
expression (:py:class:`Expression`)
Object to be copied.
"""
if self.__class__ == Expression:
_self = None
else:
_self = self
_function.Expression_swiginit(self, _function.new_Expression(_self, *args))
__swig_destroy__ = _function.delete_Expression
def eval_cell(self, values, x, cell):
"""
**Overloaded versions**
* eval\ (values, x, cell)
Note: The reimplementation of eval is needed for the Python interface.
Evaluate at given point in given cell.
*Arguments*
values (numpy.array(float))
The values at the point.
x (numpy.array(float))
The coordinates of the point.
cell (ufc::cell)
The cell which contains the given point.
* eval\ (values, x)
Evaluate at given point.
*Arguments*
values (numpy.array(float))
The values at the point.
x (numpy.array(float))
The coordinates of the point.
"""
return _function.Expression_eval_cell(self, values, x, cell)
def eval(self, values, x):
"""
**Overloaded versions**
* eval\ (values, x, cell)
Note: The reimplementation of eval is needed for the Python interface.
Evaluate at given point in given cell.
*Arguments*
values (numpy.array(float))
The values at the point.
x (numpy.array(float))
The coordinates of the point.
cell (ufc::cell)
The cell which contains the given point.
* eval\ (values, x)
Evaluate at given point.
*Arguments*
values (numpy.array(float))
The values at the point.
x (numpy.array(float))
The coordinates of the point.
"""
return _function.Expression_eval(self, values, x)
def __disown__(self):
self.this.disown()
_function.disown_Expression(self)
return weakref_proxy(self)
Expression.eval_cell = new_instancemethod(_function.Expression_eval_cell, None, Expression)
Expression.eval = new_instancemethod(_function.Expression_eval, None, Expression)
Expression_swigregister = _function.Expression_swigregister
Expression_swigregister(Expression)
class FunctionAXPY(object):
"""
This class represents a linear combination of functions. It is
mostly used as an intermediate class for operations such as u =
3*u0 + 4*u1; where the rhs generates an FunctionAXPY.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
Direction_ADD_ADD = _function.FunctionAXPY_Direction_ADD_ADD
Direction_SUB_ADD = _function.FunctionAXPY_Direction_SUB_ADD
Direction_ADD_SUB = _function.FunctionAXPY_Direction_ADD_SUB
Direction_SUB_SUB = _function.FunctionAXPY_Direction_SUB_SUB
def __init__(self, *args):
"""
**Overloaded versions**
* FunctionAXPY\ (func, scalar)
Constructor
* FunctionAXPY\ (axpy, scalar)
Constructor
* FunctionAXPY\ (func0, func1, direction)
Constructor
* FunctionAXPY\ (axpy, func, direction)
Constructor
* FunctionAXPY\ (axpy0, axpy1, direction)
Constructor
* FunctionAXPY\ (pairs)
Constructor
* FunctionAXPY\ (axpy)
Copy constructor
"""
_function.FunctionAXPY_swiginit(self, _function.new_FunctionAXPY(*args))
__swig_destroy__ = _function.delete_FunctionAXPY
def __add__(self, *args):
"""
**Overloaded versions**
* operator+\ (func)
Addition operator
* operator+\ (axpy)
Addition operator
"""
return _function.FunctionAXPY___add__(self, *args)
def __sub__(self, *args):
"""
**Overloaded versions**
* operator-\ (func)
Subtraction operator
* operator-\ (axpy)
Subtraction operator
"""
return _function.FunctionAXPY___sub__(self, *args)
def __mul__(self, scale):
"""
Scale operator
"""
return _function.FunctionAXPY___mul__(self, scale)
def __div__(self, scale):
"""
Scale operator
"""
return _function.FunctionAXPY___div__(self, scale)
def pairs(self):
"""
Return the scalar and Function pairs
"""
return _function.FunctionAXPY_pairs(self)
__truediv__ = __div__
FunctionAXPY.__add__ = new_instancemethod(_function.FunctionAXPY___add__, None, FunctionAXPY)
FunctionAXPY.__sub__ = new_instancemethod(_function.FunctionAXPY___sub__, None, FunctionAXPY)
FunctionAXPY.__mul__ = new_instancemethod(_function.FunctionAXPY___mul__, None, FunctionAXPY)
FunctionAXPY.__div__ = new_instancemethod(_function.FunctionAXPY___div__, None, FunctionAXPY)
FunctionAXPY.pairs = new_instancemethod(_function.FunctionAXPY_pairs, None, FunctionAXPY)
FunctionAXPY_swigregister = _function.FunctionAXPY_swigregister
FunctionAXPY_swigregister(FunctionAXPY)
class Function(GenericFunction, HierarchicalFunction):
"""
This class represents a function :math:`u_h` in a finite
element function space :math:`V_h`, given by
.. math::
u_h = \sum_{i=1}^{n} U_i \phi_i
where :math:`\{\phi_i\}_{i=1}^{n}` is a basis for :math:`V_h`,
and :math:`U` is a vector of expansion coefficients for :math:`u_h`.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* Function\ (V)
Create function on given function space (shared data)
*Arguments*
V (:py:class:`FunctionSpace`)
The function space.
* Function\ (V, x)
Create function on given function space with a given vector
(shared data)
*Warning: This constructor is intended for internal library use only*
*Arguments*
V (:py:class:`FunctionSpace`)
The function space.
x (:py:class:`GenericVector`)
The vector.
* Function\ (V, filename)
Create function from vector of dofs stored to file (shared data)
*Arguments*
V (:py:class:`FunctionSpace`)
The function space.
filename_dofdata (str)
The name of the file containing the dofmap data.
* Function\ (v)
Copy constructor
*Arguments*
v (:py:class:`Function`)
The object to be copied.
* Function\ (v, i)
Sub-function constructor with shallow copy of vector (used in Python
interface)
*Arguments*
v (:py:class:`Function`)
The function to be copied.
i (int)
Index of subfunction.
"""
_function.Function_swiginit(self, _function.new_Function(*args))
__swig_destroy__ = _function.delete_Function
def _assign(self, *args):
"""
**Overloaded versions**
* operator=\ (v)
Assignment from function
*Arguments*
v (:py:class:`Function`)
Another function.
* operator=\ (v)
Assignment from expression using interpolation
*Arguments*
v (:py:class:`Expression`)
The expression.
* operator=\ (axpy)
Assignment from linear combination of function
*Arguments*
v (:py:class:`FunctionAXPY`)
A linear combination of other Functions
"""
return _function.Function__assign(self, *args)
def sub(self, i):
"""
Extract subfunction
*Arguments*
i (int)
Index of subfunction.
*Returns*
:py:class:`Function`
The subfunction.
"""
return _function.Function_sub(self, i)
def __add__(self, *args):
"""
**Overloaded versions**
* operator+\ (other)
Add operator with other function
*Returns*
:py:class:`FunctionAXPY`
Return a linear combination of Functions
* operator+\ (axpy)
Add operator with other linear combination of functions
*Returns*
:py:class:`FunctionAXPY`
Return a linear combination of Functions
"""
return _function.Function___add__(self, *args)
def __sub__(self, *args):
"""
**Overloaded versions**
* operator-\ (other)
Subtraction operator with other function
*Returns*
:py:class:`FunctionAXPY`
Return a linear combination of Functions
* operator-\ (axpy)
Subtraction operator with other linear combination of functions
*Returns*
:py:class:`FunctionAXPY`
Return a linear combination of Functions
"""
return _function.Function___sub__(self, *args)
def __mul__(self, scalar):
"""
Scale operator
*Returns*
:py:class:`FunctionAXPY`
Return a linear combination of Functions
"""
return _function.Function___mul__(self, scalar)
def __div__(self, scalar):
"""
Scale operator
*Returns*
:py:class:`FunctionAXPY`
Return a linear combination of Functions
"""
return _function.Function___div__(self, scalar)
def vector(self, *args):
"""
**Overloaded versions**
* vector\ ()
Return vector of expansion coefficients (non-const version)
*Returns*
:py:class:`GenericVector`
The vector of expansion coefficients.
* vector\ ()
Return vector of expansion coefficients (const version)
*Returns*
:py:class:`GenericVector`
The vector of expansion coefficients (const).
"""
return _function.Function_vector(self, *args)
def _in(self, V):
"""
Check if function is a member of the given function space
*Arguments*
V (:py:class:`FunctionSpace`)
The function space.
*Returns*
bool
True if the function is in the function space.
"""
return _function.Function__in(self, V)
def geometric_dimension(self):
"""
Return geometric dimension
*Returns*
int
The geometric dimension.
"""
return _function.Function_geometric_dimension(self)
def eval(self, *args):
"""
**Overloaded versions**
* eval\ (values, x)
Evaluate function at given coordinates
*Arguments*
values (numpy.array(float))
The values.
x (numpy.array(float))
The coordinates.
* eval\ (values, x, dolfin_cell, ufc_cell)
Evaluate function at given coordinates in given cell
*Arguments*
values (numpy.array(float))
The values.
x (numpy.array(float))
The coordinates.
dolfin_cell (:py:class:`Cell`)
The cell.
ufc_cell (ufc::cell)
The ufc::cell.
* eval\ (values, x, cell)
Evaluate at given point in given cell
*Arguments*
values (numpy.array(float))
The values at the point.
x (numpy.array(float))
The coordinates of the point.
cell (ufc::cell)
The cell which contains the given point.
"""
return _function.Function_eval(self, *args)
def interpolate(self, v):
"""
Interpolate function (on possibly non-matching meshes)
*Arguments*
v (:py:class:`GenericFunction`)
The function to be interpolated.
"""
return _function.Function_interpolate(self, v)
def extrapolate(self, v):
"""
Extrapolate function (from a possibly lower-degree function space)
*Arguments*
v (:py:class:`Function`)
The function to be extrapolated.
"""
return _function.Function_extrapolate(self, v)
def compute_vertex_values(self, *args):
"""
**Overloaded versions**
* compute_vertex_values\ (vertex_values, mesh)
Compute values at all mesh vertices
*Arguments*
vertex_values (numpy.array(float))
The values at all vertices.
mesh (:py:class:`Mesh`)
The mesh.
* compute_vertex_values\ (vertex_values)
Compute values at all mesh vertices
*Arguments*
vertex_values (numpy.array(float))
The values at all vertices.
"""
return _function.Function_compute_vertex_values(self, *args)
def set_allow_extrapolation(self, allow_extrapolation):
"""
Allow extrapolation when evaluating the Function
*Arguments*
allow_extrapolation (bool)
Whether or not permit extrapolation.
"""
return _function.Function_set_allow_extrapolation(self, allow_extrapolation)
def get_allow_extrapolation(self):
"""
Check if extrapolation is permitted when evaluating the Function
*Returns*
bool
True if extrapolation is permitted, otherwise false
"""
return _function.Function_get_allow_extrapolation(self)
def function_space(self):
"Return the FunctionSpace"
from dolfin.functions.functionspace import FunctionSpace
return FunctionSpace(self._function_space())
def copy(self, deepcopy=False):
"""
Return a copy of itself
*Arguments*
deepcopy (bool)
If false (default) the dof vector is shared.
*Returns*
_Function_
The Function
"""
from dolfin.functions.function import Function
if deepcopy:
return Function(self.function_space(), self.vector().copy())
return Function(self.function_space(), self.vector())
def leaf_node(self):
"Return the finest Function in hierarchy"
from dolfin.functions.function import Function
return Function(HierarchicalFunction._leaf_node(self))
def root_node(self):
"Return the coarsest Function in hierarchy"
from dolfin.functions.function import Function
return Function(HierarchicalFunction._root_node(self))
def child(self):
"Return the child Function in the hierarchy"
from dolfin.functions.function import Function
return Function(HierarchicalFunction._child(self))
def parent(self):
"Return the parent Function in the hierarchy"
from dolfin.functions.function import Function
return Function(HierarchicalFunction._parent(self))
Function._assign = new_instancemethod(_function.Function__assign, None, Function)
Function.sub = new_instancemethod(_function.Function_sub, None, Function)
Function.__add__ = new_instancemethod(_function.Function___add__, None, Function)
Function.__sub__ = new_instancemethod(_function.Function___sub__, None, Function)
Function.__mul__ = new_instancemethod(_function.Function___mul__, None, Function)
Function.__div__ = new_instancemethod(_function.Function___div__, None, Function)
Function.vector = new_instancemethod(_function.Function_vector, None, Function)
Function._in = new_instancemethod(_function.Function__in, None, Function)
Function.geometric_dimension = new_instancemethod(_function.Function_geometric_dimension, None, Function)
Function.eval = new_instancemethod(_function.Function_eval, None, Function)
Function.interpolate = new_instancemethod(_function.Function_interpolate, None, Function)
Function.extrapolate = new_instancemethod(_function.Function_extrapolate, None, Function)
Function.compute_vertex_values = new_instancemethod(_function.Function_compute_vertex_values, None, Function)
Function.set_allow_extrapolation = new_instancemethod(_function.Function_set_allow_extrapolation, None, Function)
Function.get_allow_extrapolation = new_instancemethod(_function.Function_get_allow_extrapolation, None, Function)
Function_swigregister = _function.Function_swigregister
Function_swigregister(Function)
class FunctionSpace(common.Variable, HierarchicalFunctionSpace):
"""
This class represents a finite element function space defined by
a mesh, a finite element, and a local-to-global mapping of the
degrees of freedom (dofmap).
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* FunctionSpace\ (mesh, element, dofmap)
Create function space for given mesh, element and dofmap
(shared data)
*Arguments*
mesh (:py:class:`Mesh`)
The mesh.
element (:py:class:`FiniteElement`)
The element.
dofmap (:py:class:`GenericDofMap`)
The dofmap.
* FunctionSpace\ (mesh)
Create empty function space for later initialization. This
constructor is intended for use by any sub-classes which need
to construct objects before the initialisation of the base
class. Data can be attached to the base class using
FunctionSpace::attach(...).
*Arguments*
mesh (:py:class:`Mesh`)
The mesh.
* FunctionSpace\ (V)
Copy constructor
*Arguments*
V (:py:class:`FunctionSpace`)
The object to be copied.
"""
_function.FunctionSpace_swiginit(self, _function.new_FunctionSpace(*args))
__swig_destroy__ = _function.delete_FunctionSpace
def assign(self, V):
"""
Assignment operator
*Arguments*
V (:py:class:`FunctionSpace`)
Another function space.
"""
return _function.FunctionSpace_assign(self, V)
def __eq__(self, V):
"""
Equality operator
*Arguments*
V (:py:class:`FunctionSpace`)
Another function space.
"""
return _function.FunctionSpace___eq__(self, V)
def __ne__(self, V):
"""
Inequality operator
*Arguments*
V (:py:class:`FunctionSpace`)
Another function space.
"""
return _function.FunctionSpace___ne__(self, V)
def mesh(self):
"""
Return mesh
*Returns*
:py:class:`Mesh`
The mesh.
"""
return _function.FunctionSpace_mesh(self)
def element(self):
"""
Return finite element
*Returns*
:py:class:`FiniteElement`
The finite element.
"""
return _function.FunctionSpace_element(self)
def dofmap(self):
"""
Return dofmap
*Returns*
:py:class:`GenericDofMap`
The dofmap.
"""
return _function.FunctionSpace_dofmap(self)
def dim(self):
"""
Return dimension of function space
*Returns*
int
The dimension of the function space.
"""
return _function.FunctionSpace_dim(self)
def interpolate(self, expansion_coefficients, v):
"""
Interpolate function v into function space, returning the
vector of expansion coefficients
*Arguments*
expansion_coefficients (:py:class:`GenericVector`)
The expansion coefficients.
v (:py:class:`GenericFunction`)
The function to be interpolated.
"""
return _function.FunctionSpace_interpolate(self, expansion_coefficients, v)
def sub(self, *args):
"""
**Overloaded versions**
* sub\ (component)
Extract subspace for component
*Arguments*
component (int)
Index of the subspace.
*Returns*
:py:class:`FunctionSpace`
The subspace.
* sub\ (component)
Extract subspace for component
*Arguments*
component (numpy.array(int))
The component.
*Returns*
:py:class:`FunctionSpace`
The subspace.
"""
return _function.FunctionSpace_sub(self, *args)
def extract_sub_space(self, component):
"""
Extract subspace for component
*Arguments*
component (numpy.array(int))
The component.
*Returns*
:py:class:`FunctionSpace`
The subspace.
"""
return _function.FunctionSpace_extract_sub_space(self, component)
def contains(self, V):
"""
Check whether V is subspace of this, or this itself
*Arguments*
V (:py:class:`FunctionSpace`)
The space to be tested for inclusion.
*Returns*
bool
True if V is contained or equal to this.
"""
return _function.FunctionSpace_contains(self, V)
def collapse(self):
"""
**Overloaded versions**
* collapse\ ()
Collapse a subspace and return a new function space
*Returns*
:py:class:`FunctionSpace`
The new function space.
* collapse\ (collapsed_dofs)
Collapse a subspace and return a new function space and a map
from new to old dofs
*Arguments*
collapsed_dofs (std::unordered_map<std::size_t, std::size_t>)
The map from new to old dofs.
*Returns*
:py:class:`FunctionSpace`
The new function space.
"""
return _function.FunctionSpace_collapse(self)
def has_cell(self, cell):
"""
Check if function space has given cell
*Arguments*
cell (:py:class:`Cell`)
The cell.
*Returns*
bool
True if the function space has the given cell.
"""
return _function.FunctionSpace_has_cell(self, cell)
def has_element(self, element):
"""
Check if function space has given element
*Arguments*
element (:py:class:`FiniteElement`)
The finite element.
*Returns*
bool
True if the function space has the given element.
"""
return _function.FunctionSpace_has_element(self, element)
def component(self):
"""
Return component w.r.t. to root superspace, i.e.
W.sub(1).sub(0) == [1, 0].
*Returns*
numpy.array(int)
The component (w.r.t to root superspace).
"""
return _function.FunctionSpace_component(self)
def tabulate_dof_coordinates(self):
"""
Tabulate the coordinates of all dofs on this process. This
function is typically used by preconditioners that require the
spatial coordinates of dofs, for example for re-partitioning or
nullspace computations.
*Arguments*
mesh (:py:class:`Mesh`)
The mesh.
*Returns*
numpy.array(float)
The dof coordinates (x0, y0, x1, y1, . . .)
"""
return _function.FunctionSpace_tabulate_dof_coordinates(self)
def set_x(self, x, value, component):
"""
Set dof entries in vector to value*x[i], where [x][i] is the
coordinate of the dof spatial coordinate. Parallel layout of
vector must be consistent with dof map range This function is
typically used to construct the null space of a matrix
operator, e.g. rigid body rotations.
*Arguments*
vector (:py:class:`GenericVector`)
The vector to set.
value (float)
The value to multiply to coordinate by.
component (int)
The coordinate index.
mesh (:py:class:`Mesh`)
The mesh.
"""
return _function.FunctionSpace_set_x(self, x, value, component)
def print_dofmap(self):
"""
Print dofmap (useful for debugging)
"""
return _function.FunctionSpace_print_dofmap(self)
def __contains__(self,u):
"Check whether a function is in the FunctionSpace"
if isinstance(u, Function):
return u._in(self)
return False
def leaf_node(self):
"Return the finest FunctionSpace in hierarchy"
from dolfin.functions.functionspace import FunctionSpace
return FunctionSpace(HierarchicalFunctionSpace._leaf_node(self))
def root_node(self):
"Return the coarsest FunctionSpace in hierarchy"
from dolfin.functions.functionspace import FunctionSpace
return FunctionSpace(HierarchicalFunctionSpace._root_node(self))
def child(self):
"Return the child FunctionSpace in the hierarchy"
from dolfin.functions.functionspace import FunctionSpace
return FunctionSpace(HierarchicalFunctionSpace._child(self))
def parent(self):
"Return the parent FunctionSpace in the hierarchy"
from dolfin.functions.functionspace import FunctionSpace
return FunctionSpace(HierarchicalFunctionSpace._parent(self))
FunctionSpace.assign = new_instancemethod(_function.FunctionSpace_assign, None, FunctionSpace)
FunctionSpace.__eq__ = new_instancemethod(_function.FunctionSpace___eq__, None, FunctionSpace)
FunctionSpace.__ne__ = new_instancemethod(_function.FunctionSpace___ne__, None, FunctionSpace)
FunctionSpace.mesh = new_instancemethod(_function.FunctionSpace_mesh, None, FunctionSpace)
FunctionSpace.element = new_instancemethod(_function.FunctionSpace_element, None, FunctionSpace)
FunctionSpace.dofmap = new_instancemethod(_function.FunctionSpace_dofmap, None, FunctionSpace)
FunctionSpace.dim = new_instancemethod(_function.FunctionSpace_dim, None, FunctionSpace)
FunctionSpace.interpolate = new_instancemethod(_function.FunctionSpace_interpolate, None, FunctionSpace)
FunctionSpace.sub = new_instancemethod(_function.FunctionSpace_sub, None, FunctionSpace)
FunctionSpace.extract_sub_space = new_instancemethod(_function.FunctionSpace_extract_sub_space, None, FunctionSpace)
FunctionSpace.contains = new_instancemethod(_function.FunctionSpace_contains, None, FunctionSpace)
FunctionSpace.collapse = new_instancemethod(_function.FunctionSpace_collapse, None, FunctionSpace)
FunctionSpace.has_cell = new_instancemethod(_function.FunctionSpace_has_cell, None, FunctionSpace)
FunctionSpace.has_element = new_instancemethod(_function.FunctionSpace_has_element, None, FunctionSpace)
FunctionSpace.component = new_instancemethod(_function.FunctionSpace_component, None, FunctionSpace)
FunctionSpace.tabulate_dof_coordinates = new_instancemethod(_function.FunctionSpace_tabulate_dof_coordinates, None, FunctionSpace)
FunctionSpace.set_x = new_instancemethod(_function.FunctionSpace_set_x, None, FunctionSpace)
FunctionSpace.print_dofmap = new_instancemethod(_function.FunctionSpace_print_dofmap, None, FunctionSpace)
FunctionSpace_swigregister = _function.FunctionSpace_swigregister
FunctionSpace_swigregister(FunctionSpace)
class Constant(Expression):
"""
This class represents a constant-valued expression.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* Constant\ (value)
Create scalar constant
*Arguments*
value (float)
The scalar to create a Constant object from.
*Example*
.. note::
No example code available for this function.
* Constant\ (value0, value1)
Create vector constant (dim = 2)
*Arguments*
value0 (float)
The first vector element.
value1 (float)
The second vector element.
*Example*
.. note::
No example code available for this function.
* Constant\ (value0, value1, value2)
Create vector constant (dim = 3)
*Arguments*
value0 (float)
The first vector element.
value1 (float)
The second vector element.
value2 (float)
The third vector element.
*Example*
.. note::
No example code available for this function.
* Constant\ (values)
Create vector-valued constant
*Arguments*
values (numpy.array(float))
Values to create a vector-valued constant from.
* Constant\ (value_shape, values)
Create tensor-valued constant for flattened array of values
*Arguments*
value_shape (numpy.array(int))
Shape of tensor.
values (numpy.array(float))
Values to create tensor-valued constant from.
* Constant\ (constant)
Copy constructor
*Arguments*
constant (:py:class:`Constant`)
Object to be copied.
"""
_function.Constant_swiginit(self, _function.new_Constant(*args))
__swig_destroy__ = _function.delete_Constant
def assign(self, *args):
"""
**Overloaded versions**
* operator=\ (constant)
Assignment operator
*Arguments*
constant (:py:class:`Constant`)
Another constant.
* operator=\ (constant)
Assignment operator
*Arguments*
constant (float)
Another constant.
"""
return _function.Constant_assign(self, *args)
def __float__(self):
"""
Cast to double (for scalar constants)
*Returns*
float
The scalar value.
"""
return _function.Constant___float__(self)
def values(self):
"""
Return copy of this Constant's current values
*Returns*
numpy.array(float)
The vector of scalar values of the constant.
"""
return _function.Constant_values(self)
Constant.assign = new_instancemethod(_function.Constant_assign, None, Constant)
Constant.__float__ = new_instancemethod(_function.Constant___float__, None, Constant)
Constant.values = new_instancemethod(_function.Constant_values, None, Constant)
Constant_swigregister = _function.Constant_swigregister
Constant_swigregister(Constant)
class MeshCoordinates(Expression):
"""
This Function represents the mesh coordinates on a given mesh.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, mesh):
"""
Constructor
"""
_function.MeshCoordinates_swiginit(self, _function.new_MeshCoordinates(mesh))
__swig_destroy__ = _function.delete_MeshCoordinates
MeshCoordinates_swigregister = _function.MeshCoordinates_swigregister
MeshCoordinates_swigregister(MeshCoordinates)
class FacetArea(Expression):
"""
This function represents the area/length of a cell facet on a
given mesh.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, mesh):
"""
Constructor
"""
_function.FacetArea_swiginit(self, _function.new_FacetArea(mesh))
__swig_destroy__ = _function.delete_FacetArea
FacetArea_swigregister = _function.FacetArea_swigregister
FacetArea_swigregister(FacetArea)
class SpecialFacetFunction(Expression):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* SpecialFacetFunction\ (f_e)
Create (scalar-valued) SpecialFacetFunction
*Arguments*
f_e (list of :py:class:`Function`)
Separate _Function_s for each facet
* SpecialFacetFunction\ (f_e, dim)
Create (vector-valued) SpecialFacetFunction
*Arguments*
f_e (list of :py:class:`Function`)
Separate _Function_s for each facet
dim (int)
The value-dimension of the Functions
* SpecialFacetFunction\ (f_e, value_shape)
Create (tensor-valued) SpecialFacetFunction
*Arguments*
f_e (list of :py:class:`Function`)
Separate _Function_s for each facet
value_shape (numpy.array(int))
The values-shape of the Functions
"""
_function.SpecialFacetFunction_swiginit(self, _function.new_SpecialFacetFunction(*args))
def _sub(self, i):
"""
Extract sub-function i
*Arguments*
i (int)
component
*Returns*
:py:class:`Function`
"""
return _function.SpecialFacetFunction__sub(self, i)
__swig_destroy__ = _function.delete_SpecialFacetFunction
SpecialFacetFunction._sub = new_instancemethod(_function.SpecialFacetFunction__sub, None, SpecialFacetFunction)
SpecialFacetFunction_swigregister = _function.SpecialFacetFunction_swigregister
SpecialFacetFunction_swigregister(SpecialFacetFunction)
class MultiMeshFunction(common.Variable):
"""
This class represents a function on a cut and composite finite
element function space (MultiMesh) defined on one or more possibly
intersecting meshes.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* MultiMeshFunction\ ()
Constructor
* MultiMeshFunction\ (V)
Create MultiMesh function on given MultiMesh function space
*Arguments*
V (:py:class:`MultiMeshFunctionSpace`)
The MultiMesh function space.
* MultiMeshFunction\ (V, x)
Create MultiMesh function on given MultiMesh function space with a given vector
(shared data)
*Warning: This constructor is intended for internal library use only*
*Arguments*
V (:py:class:`MultiMeshFunctionSpace`)
The multimesh function space.
x (:py:class:`GenericVector`)
The vector.
"""
_function.MultiMeshFunction_swiginit(self, _function.new_MultiMeshFunction(*args))
__swig_destroy__ = _function.delete_MultiMeshFunction
def part(self, i):
"""
Return function (part) number i
*Returns*
:py:class:`Function`
Function (part) number i
"""
return _function.MultiMeshFunction_part(self, i)
def vector(self, *args):
"""
**Overloaded versions**
* vector\ ()
Return vector of expansion coefficients (non-const version)
*Returns*
:py:class:`GenericVector`
The vector of expansion coefficients.
* vector\ ()
Return vector of expansion coefficients (const version)
*Returns*
:py:class:`GenericVector`
The vector of expansion coefficients (const).
"""
return _function.MultiMeshFunction_vector(self, *args)
def function_space(self):
"""
Return shared pointer to multi mesh function space
*Returns*
:py:class:`MultiMeshFunctionSpace`
Return the shared pointer.
"""
return _function.MultiMeshFunction_function_space(self)
def copy(self, deepcopy=False):
"""
Return a copy of itself
*Arguments*
deepcopy (bool)
If false (default) the dof vector is shared.
*Returns*
_MultiMeshFunction_
The MultiMeshFunction
"""
from dolfin.functions.multimeshfunction import MultiMeshFunction
if deepcopy:
return MultiMeshFunction(self.function_space(), self.vector().copy())
return MultiMeshFunction(self.function_space(), self.vector())
MultiMeshFunction.part = new_instancemethod(_function.MultiMeshFunction_part, None, MultiMeshFunction)
MultiMeshFunction.vector = new_instancemethod(_function.MultiMeshFunction_vector, None, MultiMeshFunction)
MultiMeshFunction.function_space = new_instancemethod(_function.MultiMeshFunction_function_space, None, MultiMeshFunction)
MultiMeshFunction_swigregister = _function.MultiMeshFunction_swigregister
MultiMeshFunction_swigregister(MultiMeshFunction)
class MultiMeshFunctionSpace(common.Variable):
"""
This class represents a function space on a multimesh. It may
may be created from a set of standard function spaces by
repeatedly calling add(), followed by a call to build(). Note
that a multimesh function space is not useful and its data
structures are empty until build() has been called.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, multimesh):
"""
Create multimesh function space on multimesh (shared pointer version)
"""
_function.MultiMeshFunctionSpace_swiginit(self, _function.new_MultiMeshFunctionSpace(multimesh))
__swig_destroy__ = _function.delete_MultiMeshFunctionSpace
def dim(self):
"""
Return dimension of the multimesh function space
*Returns*
int
The dimension of the multimesh function space.
"""
return _function.MultiMeshFunctionSpace_dim(self)
def multimesh(self):
"""
Return multimesh
*Returns*
:py:class:`MultiMesh`
The multimesh.
"""
return _function.MultiMeshFunctionSpace_multimesh(self)
def dofmap(self):
"""
Return multimesh dofmap
*Returns*
:py:class:`MultiMeshDofMap`
The dofmap.
"""
return _function.MultiMeshFunctionSpace_dofmap(self)
def num_parts(self):
"""
Return the number of function spaces (parts) of the multimesh function space
*Returns*
int
The number of function spaces (parts) of the multimesh function space.
"""
return _function.MultiMeshFunctionSpace_num_parts(self)
def part(self, i):
"""
Return function space (part) number i
*Arguments*
i (int)
The part number
*Returns*
:py:class:`FunctionSpace`
Function space (part) number i
"""
return _function.MultiMeshFunctionSpace_part(self, i)
def view(self, i):
"""
Return view of multimesh function space for part number i.
This function differs from the part() function in that it does
not return the original function space for a part, but rather
a view of the common multimesh function space (dofs global to
the collection of parts).
*Arguments*
i (int)
The part number
*Returns*
:py:class:`FunctionSpace`
Function space (part) number i
"""
return _function.MultiMeshFunctionSpace_view(self, i)
def add(self, function_space):
"""
Add function space
*Arguments*
function_space (:py:class:`FunctionSpace`)
The function space.
"""
return _function.MultiMeshFunctionSpace_add(self, function_space)
def build(self, *args):
"""
**Overloaded versions**
* build\ ()
Build multimesh function space
* build\ (offsets)
Build multimesh function space. This function uses offsets
computed from the full function spaces on each part.
"""
return _function.MultiMeshFunctionSpace_build(self, *args)
MultiMeshFunctionSpace.dim = new_instancemethod(_function.MultiMeshFunctionSpace_dim, None, MultiMeshFunctionSpace)
MultiMeshFunctionSpace.multimesh = new_instancemethod(_function.MultiMeshFunctionSpace_multimesh, None, MultiMeshFunctionSpace)
MultiMeshFunctionSpace.dofmap = new_instancemethod(_function.MultiMeshFunctionSpace_dofmap, None, MultiMeshFunctionSpace)
MultiMeshFunctionSpace.num_parts = new_instancemethod(_function.MultiMeshFunctionSpace_num_parts, None, MultiMeshFunctionSpace)
MultiMeshFunctionSpace.part = new_instancemethod(_function.MultiMeshFunctionSpace_part, None, MultiMeshFunctionSpace)
MultiMeshFunctionSpace.view = new_instancemethod(_function.MultiMeshFunctionSpace_view, None, MultiMeshFunctionSpace)
MultiMeshFunctionSpace.add = new_instancemethod(_function.MultiMeshFunctionSpace_add, None, MultiMeshFunctionSpace)
MultiMeshFunctionSpace.build = new_instancemethod(_function.MultiMeshFunctionSpace_build, None, MultiMeshFunctionSpace)
MultiMeshFunctionSpace_swigregister = _function.MultiMeshFunctionSpace_swigregister
MultiMeshFunctionSpace_swigregister(MultiMeshFunctionSpace)
class MultiMeshSubSpace(MultiMeshFunctionSpace):
"""
This class represents a subspace (component) of a multimesh
function space.
The subspace is specified by an array of indices. For example,
the array [3, 0, 2] specifies subspace 2 of subspace 0 of
subspace 3.
A typical example is the function space W = V x P for Stokes.
Here, V = W[0] is the subspace for the velocity component and
P = W[1] is the subspace for the pressure component. Furthermore,
W[0][0] = V[0] is the first component of the velocity space etc.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* MultiMeshSubSpace\ (V, component)
Create subspace for given component (one level)
* MultiMeshSubSpace\ (V, component, sub_component)
Create subspace for given component (two levels)
* MultiMeshSubSpace\ (V, component)
Create subspace for given component (n levels)
"""
_function.MultiMeshSubSpace_swiginit(self, _function.new_MultiMeshSubSpace(*args))
__swig_destroy__ = _function.delete_MultiMeshSubSpace
MultiMeshSubSpace_swigregister = _function.MultiMeshSubSpace_swigregister
MultiMeshSubSpace_swigregister(MultiMeshSubSpace)
class FunctionAssigner(object):
"""
This class facilitate assignments between Function and sub
Functions. It builds and caches maps between compatible
dofs. These maps are used in the assignment methods which
perform the actual assignment. Optionally can a MeshFunction be
passed together with a label, facilitating FunctionAssignment
over sub domains.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* FunctionAssigner\ (receiving_space, assigning_space)
Create a FunctionAssigner between functions residing in the
same type of FunctionSpace. One or both functions can be sub
functions.
*Arguments*
receiving_space (:py:class:`FunctionSpace`)
The function space of the receiving function
assigning_space (:py:class:`FunctionSpace`)
The function space of the assigning function
* FunctionAssigner\ (receiving_spaces, assigning_space)
Create a FunctionAssigner between one mixed function
(assigning) and several functions (receiving). The number of
receiving functions must sum up to the number of sub functions
in the assigning mixed function. The sub spaces of the
assigning mixed space must be of the same type ans size as the
receiving spaces.
*Arguments*
receiving_spaces (list of :py:class:`FunctionSpace`)
The receiving function spaces
assigning_space (:py:class:`FunctionSpace`)
The assigning function space
* FunctionAssigner\ (receiving_space, assigning_spaces)
Create a FunctionAssigner between several functions
(assigning) and one mixed function (receiving). The number of
sub functions in the assigning mixed function must sum up to
the number of receiving functions. The sub spaces of the
receiving mixed space must be of the same type ans size as the
assigning spaces.
*Arguments*
receiving_space (:py:class:`FunctionSpace`)
The receiving function space
assigning_spaces (std::vector<std::shared_ptr<:py:class:`FunctionSpace`> >)
The assigning function spaces
"""
_function.FunctionAssigner_swiginit(self, _function.new_FunctionAssigner(*args))
def assign(self, *args):
"""
**Overloaded versions**
* assign\ (receiving_func, assigning_func)
Assign one function to another
*Arguments*
receiving_func (:py:class:`Function`)
The receiving function
assigning_func (:py:class:`Function`)
The assigning function
* assign\ (receiving_func, assigning_funcs)
Assign several functions to sub functions of a mixed receiving
function
*Arguments*
receiving_func (:py:class:`Function`)
The receiving mixed function
assigning_funcs (std::vector<std::shared_ptr<:py:class:`Function`> >)
The assigning functions
* assign\ (receiving_funcs, assigning_func)
Assign sub functions of a single mixed function to single
receiving functions
*Arguments*
receiving_funcs (std::vector<std::shared_ptr<:py:class:`Function`> >)
The receiving functions
assigning_func (:py:class:`Function`)
The assigning mixed function
"""
return _function.FunctionAssigner_assign(self, *args)
__swig_destroy__ = _function.delete_FunctionAssigner
def num_assigning_functions(self):
"""
Return the number of assigning functions
"""
return _function.FunctionAssigner_num_assigning_functions(self)
def num_receiving_functions(self):
"""
Return the number of receiving functions
"""
return _function.FunctionAssigner_num_receiving_functions(self)
FunctionAssigner.assign = new_instancemethod(_function.FunctionAssigner_assign, None, FunctionAssigner)
FunctionAssigner.num_assigning_functions = new_instancemethod(_function.FunctionAssigner_num_assigning_functions, None, FunctionAssigner)
FunctionAssigner.num_receiving_functions = new_instancemethod(_function.FunctionAssigner_num_receiving_functions, None, FunctionAssigner)
FunctionAssigner_swigregister = _function.FunctionAssigner_swigregister
FunctionAssigner_swigregister(FunctionAssigner)
def assign(*args):
"""
**Overloaded versions**
* assign\ (receiving_func, assigning_func)
Assign one function to another. The functions must reside in the
same type of FunctionSpace. One or both functions can be sub
functions.
*Arguments*
receiving_func (:py:class:`Function`)
The receiving function
assigning_func (:py:class:`Function`)
The assigning function
* assign\ (receiving_func, assigning_funcs)
Assign several functions to sub functions of a mixed receiving
function. The number of receiving functions must sum up to the
number of sub functions in the assigning mixed function. The sub
spaces of the assigning mixed space must be of the same type ans
size as the receiving spaces.
* assign\ (receiving_funcs, assigning_func)
Assign sub functions of a single mixed function to single
receiving functions. The number of sub functions in the
assigning mixed function must sum up to the number of receiving
functions. The sub spaces of the receiving mixed space must be
of the same type ans size as the assigning spaces.
"""
return _function.assign(*args)
class LagrangeInterpolator(object):
"""
This class interpolates efficiently from a GenericFunction to a
Lagrange Function
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def interpolate(*args):
"""
**Overloaded versions**
* interpolate\ (u, u0)
Interpolate Expression
*Arguments*
u (:py:class:`Function`)
The resulting Function
u0 (:py:class:`Expression`)
The Expression to be interpolated.
* interpolate\ (u, u0)
Interpolate function (on possibly non-matching meshes)
*Arguments*
u (:py:class:`Function`)
The resulting Function
u0 (:py:class:`Function`)
The Function to be interpolated.
"""
return _function.LagrangeInterpolator_interpolate(*args)
interpolate = staticmethod(interpolate)
def __init__(self):
_function.LagrangeInterpolator_swiginit(self, _function.new_LagrangeInterpolator())
__swig_destroy__ = _function.delete_LagrangeInterpolator
LagrangeInterpolator_swigregister = _function.LagrangeInterpolator_swigregister
LagrangeInterpolator_swigregister(LagrangeInterpolator)
def LagrangeInterpolator_interpolate(*args):
"""
**Overloaded versions**
* interpolate\ (u, u0)
Interpolate Expression
*Arguments*
u (:py:class:`Function`)
The resulting Function
u0 (:py:class:`Expression`)
The Expression to be interpolated.
* interpolate\ (u, u0)
Interpolate function (on possibly non-matching meshes)
*Arguments*
u (:py:class:`Function`)
The resulting Function
u0 (:py:class:`Function`)
The Function to be interpolated.
"""
return _function.LagrangeInterpolator_interpolate(*args)
def ipow(a, n):
"""
Return a to the power n.
NOTE: Overflow is not checked!
"""
return _function.ipow(a, n)
def rand():
"""
Return a random number, uniformly distributed between [0.0, 1.0)
"""
return _function.rand()
def seed(s):
"""
Seed random number generator
"""
return _function.seed(s)
def near(x, x0, eps=3.0e-16):
"""
Check whether x is close to x0 (to within DOLFIN_EPS)
"""
return _function.near(x, x0, eps)
def between(x, range):
"""
Check whether x is between x0 and x1 (inclusive, to within DOLFIN_EPS)
"""
return _function.between(x, range)
class Lagrange(common.Variable):
"""
Lagrange polynomial (basis) with given degree q determined by
n = q + 1 nodal points.
Example: q = 1 (n = 2)
Lagrange p(1);
p.set(0, 0.0);
p.set(1, 1.0);
It is the callers responsibility that the points are distinct.
This creates a Lagrange polynomial (actually two Lagrange
polynomials):
p(0,x) = 1 - x (one at x = 0, zero at x = 1)
p(1,x) = x (zero at x = 0, one at x = 1)
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* Lagrange\ (q)
Constructor
* Lagrange\ (p)
Copy constructor
"""
_function.Lagrange_swiginit(self, _function.new_Lagrange(*args))
def set(self, i, x):
"""
Specify point
"""
return _function.Lagrange_set(self, i, x)
def size(self):
"""
Return number of points
"""
return _function.Lagrange_size(self)
def degree(self):
"""
Return degree
"""
return _function.Lagrange_degree(self)
def point(self, i):
"""
Return point
"""
return _function.Lagrange_point(self, i)
def eval(self, i, x):
"""
Return value of polynomial i at given point x
"""
return _function.Lagrange_eval(self, i, x)
def ddx(self, i, x):
"""
Return derivate of polynomial i at given point x
"""
return _function.Lagrange_ddx(self, i, x)
def dqdx(self, i):
"""
Return derivative q (a constant) of polynomial
"""
return _function.Lagrange_dqdx(self, i)
__swig_destroy__ = _function.delete_Lagrange
Lagrange.set = new_instancemethod(_function.Lagrange_set, None, Lagrange)
Lagrange.size = new_instancemethod(_function.Lagrange_size, None, Lagrange)
Lagrange.degree = new_instancemethod(_function.Lagrange_degree, None, Lagrange)
Lagrange.point = new_instancemethod(_function.Lagrange_point, None, Lagrange)
Lagrange.__call__ = new_instancemethod(_function.Lagrange___call__, None, Lagrange)
Lagrange.eval = new_instancemethod(_function.Lagrange_eval, None, Lagrange)
Lagrange.ddx = new_instancemethod(_function.Lagrange_ddx, None, Lagrange)
Lagrange.dqdx = new_instancemethod(_function.Lagrange_dqdx, None, Lagrange)
Lagrange_swigregister = _function.Lagrange_swigregister
Lagrange_swigregister(Lagrange)
class Legendre(object):
"""
Interface for computing Legendre polynomials via Boost.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def eval(n, x):
"""
Evaluate polynomial of order n at point x
"""
return _function.Legendre_eval(n, x)
eval = staticmethod(eval)
def ddx(n, x):
"""
Evaluate first derivative of polynomial of order n at point x
"""
return _function.Legendre_ddx(n, x)
ddx = staticmethod(ddx)
def d2dx(n, x):
"""
Evaluate second derivative of polynomial of order n at point x
"""
return _function.Legendre_d2dx(n, x)
d2dx = staticmethod(d2dx)
def __init__(self):
_function.Legendre_swiginit(self, _function.new_Legendre())
__swig_destroy__ = _function.delete_Legendre
Legendre_swigregister = _function.Legendre_swigregister
Legendre_swigregister(Legendre)
def Legendre_eval(n, x):
"""
Evaluate polynomial of order n at point x
"""
return _function.Legendre_eval(n, x)
def Legendre_ddx(n, x):
"""
Evaluate first derivative of polynomial of order n at point x
"""
return _function.Legendre_ddx(n, x)
def Legendre_d2dx(n, x):
"""
Evaluate second derivative of polynomial of order n at point x
"""
return _function.Legendre_d2dx(n, x)
class ALE(object):
"""
This class provides functionality useful for implementation of
ALE (Arbitrary Lagrangian-Eulerian) methods, in particular
moving the boundary vertices of a mesh and then interpolating
the new coordinates for the interior vertices accordingly.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def move(*args):
"""
**Overloaded versions**
* move\ (mesh, new_boundary)
Move coordinates of mesh according to new boundary coordinates.
Works only for affine meshes.
*Arguments*
mesh (:py:class:`Mesh`)
The affine mesh to move.
boundary (:py:class:`BoundaryMesh`)
An affine mesh containing just the boundary cells.
*Returns*
MeshDisplacement
Displacement encapsulated in Expression subclass
MeshDisplacement.
* move\ (mesh0, mesh1)
*Arguments*
mesh0 (:py:class:`Mesh`)
The affine mesh to move.
mesh1 (:py:class:`Mesh`)
The affine mesh to be fit.
*Returns*
MeshDisplacement
Displacement encapsulated in Expression subclass
* move\ (mesh, displacement)
Move coordinates of mesh according to displacement function.
This works only for affine meshes.
NOTE: This cannot be implemented for higher-order geometries
as there is no way of constructing function space for
position unless supplied as an argument.
*Arguments*
mesh (:py:class:`Mesh`)
The affine mesh to move.
displacement (:py:class:`GenericFunction`)
A vectorial generic function.
* move\ (mesh, displacement)
Move coordinates of mesh according to displacement function.
*Arguments*
mesh (:py:class:`Mesh`)
The mesh to move.
displacement (:py:class:`Function`)
A vectorial Lagrange function of matching degree.
"""
return _function.ALE_move(*args)
move = staticmethod(move)
def __init__(self):
_function.ALE_swiginit(self, _function.new_ALE())
__swig_destroy__ = _function.delete_ALE
ALE_swigregister = _function.ALE_swigregister
ALE_swigregister(ALE)
def ALE_move(*args):
"""
**Overloaded versions**
* move\ (mesh, new_boundary)
Move coordinates of mesh according to new boundary coordinates.
Works only for affine meshes.
*Arguments*
mesh (:py:class:`Mesh`)
The affine mesh to move.
boundary (:py:class:`BoundaryMesh`)
An affine mesh containing just the boundary cells.
*Returns*
MeshDisplacement
Displacement encapsulated in Expression subclass
MeshDisplacement.
* move\ (mesh0, mesh1)
*Arguments*
mesh0 (:py:class:`Mesh`)
The affine mesh to move.
mesh1 (:py:class:`Mesh`)
The affine mesh to be fit.
*Returns*
MeshDisplacement
Displacement encapsulated in Expression subclass
* move\ (mesh, displacement)
Move coordinates of mesh according to displacement function.
This works only for affine meshes.
NOTE: This cannot be implemented for higher-order geometries
as there is no way of constructing function space for
position unless supplied as an argument.
*Arguments*
mesh (:py:class:`Mesh`)
The affine mesh to move.
displacement (:py:class:`GenericFunction`)
A vectorial generic function.
* move\ (mesh, displacement)
Move coordinates of mesh according to displacement function.
*Arguments*
mesh (:py:class:`Mesh`)
The mesh to move.
displacement (:py:class:`Function`)
A vectorial Lagrange function of matching degree.
"""
return _function.ALE_move(*args)
class MeshDisplacement(Expression):
"""
This class encapsulates the CG1 representation of the
displacement of a mesh as an Expression. This is particularly
useful for the displacement returned by mesh smoothers which can
subsequently be used in evaluating forms. The value rank is 1
and the value shape is equal to the geometric dimension of the
mesh.
"""
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
__repr__ = _swig_repr
def __init__(self, *args):
"""
**Overloaded versions**
* MeshDisplacement\ (mesh)
Create MeshDisplacement of given mesh
*Arguments*
mesh (:py:class:`Mesh`)
Mesh to be displacement defined on.
* MeshDisplacement\ (mesh_displacement)
Copy constructor
*Arguments*
mesh_displacement (:py:class:`MeshDisplacement`)
Object to be copied.
"""
_function.MeshDisplacement_swiginit(self, _function.new_MeshDisplacement(*args))
__swig_destroy__ = _function.delete_MeshDisplacement
def sub(self, *args):
"""
**Overloaded versions**
* operator[]\ (i)
Extract subfunction
In python available as MeshDisplacement.sub(i)
*Arguments*
i (int)
Index of subfunction.
* operator[]\ (i)
Extract subfunction. Const version
*Arguments*
i (int)
Index of subfunction.
"""
return _function.MeshDisplacement_sub(self, *args)
MeshDisplacement.sub = new_instancemethod(_function.MeshDisplacement_sub, None, MeshDisplacement)
MeshDisplacement_swigregister = _function.MeshDisplacement_swigregister
MeshDisplacement_swigregister(MeshDisplacement)
|