/usr/include/_hypre_struct_mv.h is in libhypre-dev 2.4.0b-7.
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 | /*BHEADER**********************************************************************
* Copyright (c) 2008, Lawrence Livermore National Security, LLC.
* Produced at the Lawrence Livermore National Laboratory.
* This file is part of HYPRE. See file COPYRIGHT for details.
*
* HYPRE is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License (as published by the Free
* Software Foundation) version 2.1 dated February 1999.
*
* $Revision: 2.11 $
***********************************************************************EHEADER*/
#include "_hypre_utilities.h"
#include "HYPRE_struct_mv.h"
#ifndef hypre_STRUCT_MV_HEADER
#define hypre_STRUCT_MV_HEADER
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************
*
* Header info for the Box structures
*
*****************************************************************************/
#ifndef hypre_BOX_HEADER
#define hypre_BOX_HEADER
/*--------------------------------------------------------------------------
* hypre_Index:
* This is used to define indices in index space, or dimension
* sizes of boxes.
*
* The spatial dimensions x, y, and z may be specified by the
* integers 0, 1, and 2, respectively (see the hypre_IndexD macro below).
* This simplifies the code in the hypre_Box class by reducing code
* replication.
*--------------------------------------------------------------------------*/
typedef int hypre_Index[3];
typedef int *hypre_IndexRef;
/*--------------------------------------------------------------------------
* hypre_Box:
*--------------------------------------------------------------------------*/
typedef struct hypre_Box_struct
{
hypre_Index imin; /* min bounding indices */
hypre_Index imax; /* max bounding indices */
} hypre_Box;
/*--------------------------------------------------------------------------
* hypre_BoxArray:
* An array of boxes.
*--------------------------------------------------------------------------*/
typedef struct hypre_BoxArray_struct
{
hypre_Box *boxes; /* Array of boxes */
int size; /* Size of box array */
int alloc_size; /* Size of currently alloced space */
} hypre_BoxArray;
#define hypre_BoxArrayExcess 10
/*--------------------------------------------------------------------------
* hypre_BoxArrayArray:
* An array of box arrays.
*--------------------------------------------------------------------------*/
typedef struct hypre_BoxArrayArray_struct
{
hypre_BoxArray **box_arrays; /* Array of pointers to box arrays */
int size; /* Size of box array array */
} hypre_BoxArrayArray;
/*--------------------------------------------------------------------------
* Accessor macros: hypre_Index
*--------------------------------------------------------------------------*/
#define hypre_IndexD(index, d) (index[d])
#define hypre_IndexX(index) hypre_IndexD(index, 0)
#define hypre_IndexY(index) hypre_IndexD(index, 1)
#define hypre_IndexZ(index) hypre_IndexD(index, 2)
/*--------------------------------------------------------------------------
* Member functions: hypre_Index
*--------------------------------------------------------------------------*/
#define hypre_SetIndex(index, ix, iy, iz) \
( hypre_IndexX(index) = ix,\
hypre_IndexY(index) = iy,\
hypre_IndexZ(index) = iz )
#define hypre_ClearIndex(index) hypre_SetIndex(index, 0, 0, 0)
#define hypre_IndexZero(index)\
(hypre_IndexX(index) == 0 && hypre_IndexY(index) == 0 \
&& hypre_IndexZ(index) == 0)
#define hypre_IndexGTESize(index, size) \
(hypre_IndexX(index) >= size && hypre_IndexY(index) >= size \
&& hypre_IndexZ(index) >= size)
#define hypre_CopyIndex(index1, index2) \
( hypre_IndexX(index2) = hypre_IndexX(index1),\
hypre_IndexY(index2) = hypre_IndexY(index1),\
hypre_IndexZ(index2) = hypre_IndexZ(index1) )
#define hypre_CopyToCleanIndex(in_index, ndim, out_index) \
{\
int d;\
for (d = 0; d < ndim; d++)\
{\
hypre_IndexD(out_index, d) = hypre_IndexD(in_index, d);\
}\
for (d = ndim; d < 3; d++)\
{\
hypre_IndexD(out_index, d) = 0;\
}\
}
/*--------------------------------------------------------------------------
* Accessor macros: hypre_Box
*--------------------------------------------------------------------------*/
#define hypre_BoxIMin(box) ((box) -> imin)
#define hypre_BoxIMax(box) ((box) -> imax)
#define hypre_AddIndex(index1, index2, index3) \
( hypre_IndexX(index3) = hypre_IndexX(index2) + hypre_IndexX(index1),\
hypre_IndexY(index3) = hypre_IndexY(index2) + hypre_IndexY(index1),\
hypre_IndexZ(index3) = hypre_IndexZ(index2) + hypre_IndexZ(index1) )
#define hypre_SubtractIndex(index1, index2, index3) \
( hypre_IndexX(index3) = hypre_IndexX(index1) - hypre_IndexX(index2),\
hypre_IndexY(index3) = hypre_IndexY(index1) - hypre_IndexY(index2),\
hypre_IndexZ(index3) = hypre_IndexZ(index1) - hypre_IndexZ(index2) )
#define hypre_BoxIMinD(box, d) (hypre_IndexD(hypre_BoxIMin(box), d))
#define hypre_BoxIMaxD(box, d) (hypre_IndexD(hypre_BoxIMax(box), d))
#define hypre_BoxSizeD(box, d) \
hypre_max(0, (hypre_BoxIMaxD(box, d) - hypre_BoxIMinD(box, d) + 1))
#define hypre_BoxIMinX(box) hypre_BoxIMinD(box, 0)
#define hypre_BoxIMinY(box) hypre_BoxIMinD(box, 1)
#define hypre_BoxIMinZ(box) hypre_BoxIMinD(box, 2)
#define hypre_BoxIMaxX(box) hypre_BoxIMaxD(box, 0)
#define hypre_BoxIMaxY(box) hypre_BoxIMaxD(box, 1)
#define hypre_BoxIMaxZ(box) hypre_BoxIMaxD(box, 2)
#define hypre_BoxSizeX(box) hypre_BoxSizeD(box, 0)
#define hypre_BoxSizeY(box) hypre_BoxSizeD(box, 1)
#define hypre_BoxSizeZ(box) hypre_BoxSizeD(box, 2)
#define hypre_BoxEqualP( box1, box2 ) (\
hypre_BoxIMinX(box1)==hypre_BoxIMinX(box2) &&\
hypre_BoxIMaxX(box1)==hypre_BoxIMaxX(box2) &&\
hypre_BoxIMinY(box1)==hypre_BoxIMinY(box2) &&\
hypre_BoxIMaxY(box1)==hypre_BoxIMaxY(box2) &&\
hypre_BoxIMinZ(box1)==hypre_BoxIMinZ(box2) &&\
hypre_BoxIMaxZ(box1)==hypre_BoxIMaxZ(box2) )
#define hypre_IndexInBoxP( index, box ) (\
hypre_IndexX(index)>=hypre_BoxIMinX(box) &&\
hypre_IndexX(index)<=hypre_BoxIMaxX(box) &&\
hypre_IndexY(index)>=hypre_BoxIMinY(box) &&\
hypre_IndexY(index)<=hypre_BoxIMaxY(box) &&\
hypre_IndexZ(index)>=hypre_BoxIMinZ(box) &&\
hypre_IndexZ(index)<=hypre_BoxIMaxZ(box) )
#define hypre_IndexDInBoxP( index, d, box ) (\
hypre_IndexD(index, d)>=hypre_BoxIMinD(box, d) &&\
hypre_IndexD(index, d)<=hypre_BoxIMaxD(box, d) )
#define hypre_CopyBox(box1, box2) \
( hypre_CopyIndex(hypre_BoxIMin(box1), hypre_BoxIMin(box2)),\
hypre_CopyIndex(hypre_BoxIMax(box1), hypre_BoxIMax(box2)) )
#define hypre_BoxVolume(box) \
(hypre_BoxSizeX(box) * hypre_BoxSizeY(box) * hypre_BoxSizeZ(box))
#define hypre_BoxShiftPos(box, shift) \
{\
hypre_BoxIMinX(box) += hypre_IndexX(shift);\
hypre_BoxIMinY(box) += hypre_IndexY(shift);\
hypre_BoxIMinZ(box) += hypre_IndexZ(shift);\
hypre_BoxIMaxX(box) += hypre_IndexX(shift);\
hypre_BoxIMaxY(box) += hypre_IndexY(shift);\
hypre_BoxIMaxZ(box) += hypre_IndexZ(shift);\
}
#define hypre_BoxShiftNeg(box, shift) \
{\
hypre_BoxIMinX(box) -= hypre_IndexX(shift);\
hypre_BoxIMinY(box) -= hypre_IndexY(shift);\
hypre_BoxIMinZ(box) -= hypre_IndexZ(shift);\
hypre_BoxIMaxX(box) -= hypre_IndexX(shift);\
hypre_BoxIMaxY(box) -= hypre_IndexY(shift);\
hypre_BoxIMaxZ(box) -= hypre_IndexZ(shift);\
}
#define hypre_BoxIndexRank(box, index) \
((hypre_IndexX(index) - hypre_BoxIMinX(box)) + \
((hypre_IndexY(index) - hypre_BoxIMinY(box)) + \
((hypre_IndexZ(index) - hypre_BoxIMinZ(box)) * \
hypre_BoxSizeY(box))) * \
hypre_BoxSizeX(box))
/* The first hypre_CCBoxIndexRank is better style because it keeps
its similarity to the variable coefficient hypre_BoxIndexRank.
The second one sometimes avoids compiler warnings...*/
#define hypre_CCBoxIndexRank(box, index) 0
#define hypre_CCBoxIndexRank_noargs() 0
#define hypre_BoxOffsetDistance(box, index) \
(hypre_IndexX(index) + \
(hypre_IndexY(index) + \
(hypre_IndexZ(index) * \
hypre_BoxSizeY(box))) * \
hypre_BoxSizeX(box))
#define hypre_CCBoxOffsetDistance(box, index) 0
/*--------------------------------------------------------------------------
* Accessor macros: hypre_BoxArray
*--------------------------------------------------------------------------*/
#define hypre_BoxArrayBoxes(box_array) ((box_array) -> boxes)
#define hypre_BoxArrayBox(box_array, i) &((box_array) -> boxes[(i)])
#define hypre_BoxArraySize(box_array) ((box_array) -> size)
#define hypre_BoxArrayAllocSize(box_array) ((box_array) -> alloc_size)
/*--------------------------------------------------------------------------
* Accessor macros: hypre_BoxArrayArray
*--------------------------------------------------------------------------*/
#define hypre_BoxArrayArrayBoxArrays(box_array_array) \
((box_array_array) -> box_arrays)
#define hypre_BoxArrayArrayBoxArray(box_array_array, i) \
((box_array_array) -> box_arrays[(i)])
#define hypre_BoxArrayArraySize(box_array_array) \
((box_array_array) -> size)
/*--------------------------------------------------------------------------
* Looping macros:
*--------------------------------------------------------------------------*/
#define hypre_ForBoxI(i, box_array) \
for (i = 0; i < hypre_BoxArraySize(box_array); i++)
#define hypre_ForBoxArrayI(i, box_array_array) \
for (i = 0; i < hypre_BoxArrayArraySize(box_array_array); i++)
/*--------------------------------------------------------------------------
* BoxLoop macros:
*
* NOTE: PThreads version of BoxLoop looping macros are in `box_pthreads.h'.
*
*--------------------------------------------------------------------------*/
#ifndef HYPRE_USE_PTHREADS
#define hypre_BoxLoopDeclareS(dbox, stride, sx, sy, sz) \
int sx = (hypre_IndexX(stride));\
int sy = (hypre_IndexY(stride)*hypre_BoxSizeX(dbox));\
int sz = (hypre_IndexZ(stride)*\
hypre_BoxSizeX(dbox)*hypre_BoxSizeY(dbox))
#define hypre_BoxLoopDeclareN(loop_size) \
int hypre__nx = hypre_IndexX(loop_size);\
int hypre__ny = hypre_IndexY(loop_size);\
int hypre__nz = hypre_IndexZ(loop_size);\
int hypre__mx = hypre__nx;\
int hypre__my = hypre__ny;\
int hypre__mz = hypre__nz;\
int hypre__dir, hypre__max;\
int hypre__div, hypre__mod;\
int hypre__block, hypre__num_blocks;\
hypre__dir = 0;\
hypre__max = hypre__nx;\
if (hypre__ny > hypre__max)\
{\
hypre__dir = 1;\
hypre__max = hypre__ny;\
}\
if (hypre__nz > hypre__max)\
{\
hypre__dir = 2;\
hypre__max = hypre__nz;\
}\
hypre__num_blocks = hypre_NumThreads();\
if (hypre__max < hypre__num_blocks)\
{\
hypre__num_blocks = hypre__max;\
}\
if (hypre__num_blocks > 0)\
{\
hypre__div = hypre__max / hypre__num_blocks;\
hypre__mod = hypre__max % hypre__num_blocks;\
}
#define hypre_BoxLoopSet(i, j, k) \
i = 0;\
j = 0;\
k = 0;\
hypre__nx = hypre__mx;\
hypre__ny = hypre__my;\
hypre__nz = hypre__mz;\
if (hypre__num_blocks > 1)\
{\
if (hypre__dir == 0)\
{\
i = hypre__block * hypre__div + hypre_min(hypre__mod, hypre__block);\
hypre__nx = hypre__div + ((hypre__mod > hypre__block) ? 1 : 0);\
}\
else if (hypre__dir == 1)\
{\
j = hypre__block * hypre__div + hypre_min(hypre__mod, hypre__block);\
hypre__ny = hypre__div + ((hypre__mod > hypre__block) ? 1 : 0);\
}\
else if (hypre__dir == 2)\
{\
k = hypre__block * hypre__div + hypre_min(hypre__mod, hypre__block);\
hypre__nz = hypre__div + ((hypre__mod > hypre__block) ? 1 : 0);\
}\
}
#define hypre_BoxLoopGetIndex( index, base, i, j, k )\
hypre_SetIndex( index, i+hypre_IndexX(base),\
j+hypre_IndexY(base), k+hypre_IndexZ(base) )
/*-----------------------------------*/
#define hypre_BoxLoop0Begin(loop_size)\
{\
hypre_BoxLoopDeclareN(loop_size);
#define hypre_BoxLoop0For(i, j, k)\
for (hypre__block = 0; hypre__block < hypre__num_blocks; hypre__block++)\
{\
hypre_BoxLoopSet(i, j, k);\
for (k = 0; k < hypre__nz; k++)\
{\
for (j = 0; j < hypre__ny; j++)\
{\
for (i = 0; i < hypre__nx; i++)\
{
#define hypre_BoxLoop0End()\
}\
}\
}\
}\
}
/*-----------------------------------*/
#define hypre_BoxLoop1Begin(loop_size,\
dbox1, start1, stride1, i1)\
{\
int hypre__i1start = hypre_BoxIndexRank(dbox1, start1);\
hypre_BoxLoopDeclareS(dbox1, stride1, hypre__sx1, hypre__sy1, hypre__sz1);\
hypre_BoxLoopDeclareN(loop_size);
#define hypre_BoxLoop1For(i, j, k, i1)\
for (hypre__block = 0; hypre__block < hypre__num_blocks; hypre__block++)\
{\
hypre_BoxLoopSet(i, j, k);\
i1 = hypre__i1start + i*hypre__sx1 + j*hypre__sy1 + k*hypre__sz1;\
for (k = 0; k < hypre__nz; k++)\
{\
for (j = 0; j < hypre__ny; j++)\
{\
for (i = 0; i < hypre__nx; i++)\
{
#define hypre_BoxLoop1End(i1)\
i1 += hypre__sx1;\
}\
i1 += hypre__sy1 - hypre__nx*hypre__sx1;\
}\
i1 += hypre__sz1 - hypre__ny*hypre__sy1;\
}\
}\
}
/*-----------------------------------*/
#define hypre_BoxLoop2Begin(loop_size,\
dbox1, start1, stride1, i1,\
dbox2, start2, stride2, i2)\
{\
int hypre__i1start = hypre_BoxIndexRank(dbox1, start1);\
int hypre__i2start = hypre_BoxIndexRank(dbox2, start2);\
hypre_BoxLoopDeclareS(dbox1, stride1, hypre__sx1, hypre__sy1, hypre__sz1);\
hypre_BoxLoopDeclareS(dbox2, stride2, hypre__sx2, hypre__sy2, hypre__sz2);\
hypre_BoxLoopDeclareN(loop_size);
#define hypre_BoxLoop2For(i, j, k, i1, i2)\
for (hypre__block = 0; hypre__block < hypre__num_blocks; hypre__block++)\
{\
hypre_BoxLoopSet(i, j, k);\
i1 = hypre__i1start + i*hypre__sx1 + j*hypre__sy1 + k*hypre__sz1;\
i2 = hypre__i2start + i*hypre__sx2 + j*hypre__sy2 + k*hypre__sz2;\
for (k = 0; k < hypre__nz; k++)\
{\
for (j = 0; j < hypre__ny; j++)\
{\
for (i = 0; i < hypre__nx; i++)\
{
#define hypre_BoxLoop2End(i1, i2)\
i1 += hypre__sx1;\
i2 += hypre__sx2;\
}\
i1 += hypre__sy1 - hypre__nx*hypre__sx1;\
i2 += hypre__sy2 - hypre__nx*hypre__sx2;\
}\
i1 += hypre__sz1 - hypre__ny*hypre__sy1;\
i2 += hypre__sz2 - hypre__ny*hypre__sy2;\
}\
}\
}
/* incomplete BoxLoop2 macros leave out the inner loop so it can be hand-coded */
#define hypre_BoxLoop2For_INC(i, j, k, i1, i2)\
for (hypre__block = 0; hypre__block < hypre__num_blocks; hypre__block++)\
{\
hypre_BoxLoopSet(i, j, k);\
i1 = hypre__i1start + i*hypre__sx1 + j*hypre__sy1 + k*hypre__sz1;\
i2 = hypre__i2start + i*hypre__sx2 + j*hypre__sy2 + k*hypre__sz2;\
for (k = 0; k < hypre__nz; k++)\
{\
for (j = 0; j < hypre__ny; j++)\
{
#define hypre_BoxLoop2End_INC(i1, i2)\
i1 += hypre__sy1 - hypre__nx*hypre__sx1;\
i2 += hypre__sy2 - hypre__nx*hypre__sx2;\
}\
i1 += hypre__sz1 - hypre__ny*hypre__sy1;\
i2 += hypre__sz2 - hypre__ny*hypre__sy2;\
}\
}\
}
/* BoxLoop2 macros, but only for when all strides are equal. To improve
runtime, only one index is computed in the innermost loop, the internal
index i.
Since only the internal index, i, is updated in the innermost loop, you
can't reference i1, i2 inside the innermost loop. To get the effect of i1, i2
you have to use a macro (see below) to do pointer aliasing. It works because
you know that i has the same stride as i1, i2.
This macro set invokes the user-defined macro hypre_UserOutsideInnerLoop inside
the outer loops, just before the innermost loop. The user can define this macro
for pointer aliasing.
It's safer to redefine hypre_UserOutsideInnerLoop to do nothing afterwards.
The Begin_OneStride macro isn't really needed, the Begin macro does the same
thing, but without ensuring that the strides are the same.
*/
#define hypre_UserOutsideInnerLoop
#define hypre_BoxLoop2Begin_OneStride(loop_size, stride1,\
dbox1, start1, i1,\
dbox2, start2, i2)\
{\
int hypre__i1start = hypre_BoxIndexRank(dbox1, start1);\
int hypre__i2start = hypre_BoxIndexRank(dbox2, start2);\
hypre_BoxLoopDeclareS(dbox1, stride1, hypre__sx1, hypre__sy1, hypre__sz1);\
hypre_BoxLoopDeclareS(dbox2, stride1, hypre__sx2, hypre__sy2, hypre__sz2);\
hypre_BoxLoopDeclareN(loop_size);
#define hypre_BoxLoop2For_OneStride(i, j, k, i1, i2)\
for (hypre__block = 0; hypre__block < hypre__num_blocks; hypre__block++)\
{\
hypre_BoxLoopSet(i, j, k);\
i1 = hypre__i1start + i*hypre__sx1 + j*hypre__sy1 + k*hypre__sz1;\
i2 = hypre__i2start + i*hypre__sx2 + j*hypre__sy2 + k*hypre__sz2;\
for (k = 0; k < hypre__nz; k++)\
{\
for (j = 0; j < hypre__ny; j++)\
{\
hypre_UserOutsideInnerLoop;\
for ( i=0; i<hypre__nx*hypre__sx1; i+=hypre__sx1 )\
{
#define hypre_BoxLoop2End_OneStride(i1, i2)\
}\
i1 += hypre__sy1;\
i2 += hypre__sy2;\
}\
i1 += hypre__sz1 - hypre__ny*hypre__sy1;\
i2 += hypre__sz2 - hypre__ny*hypre__sy2;\
}\
}\
}
/*-----------------------------------*/
#define hypre_BoxLoop3Begin(loop_size,\
dbox1, start1, stride1, i1,\
dbox2, start2, stride2, i2,\
dbox3, start3, stride3, i3)\
{\
int hypre__i1start = hypre_BoxIndexRank(dbox1, start1);\
int hypre__i2start = hypre_BoxIndexRank(dbox2, start2);\
int hypre__i3start = hypre_BoxIndexRank(dbox3, start3);\
hypre_BoxLoopDeclareS(dbox1, stride1, hypre__sx1, hypre__sy1, hypre__sz1);\
hypre_BoxLoopDeclareS(dbox2, stride2, hypre__sx2, hypre__sy2, hypre__sz2);\
hypre_BoxLoopDeclareS(dbox3, stride3, hypre__sx3, hypre__sy3, hypre__sz3);\
hypre_BoxLoopDeclareN(loop_size);
#define hypre_BoxLoop3For(i, j, k, i1, i2, i3)\
for (hypre__block = 0; hypre__block < hypre__num_blocks; hypre__block++)\
{\
hypre_BoxLoopSet(i, j, k);\
i1 = hypre__i1start + i*hypre__sx1 + j*hypre__sy1 + k*hypre__sz1;\
i2 = hypre__i2start + i*hypre__sx2 + j*hypre__sy2 + k*hypre__sz2;\
i3 = hypre__i3start + i*hypre__sx3 + j*hypre__sy3 + k*hypre__sz3;\
for (k = 0; k < hypre__nz; k++)\
{\
for (j = 0; j < hypre__ny; j++)\
{\
for (i = 0; i < hypre__nx; i++)\
{
#define hypre_BoxLoop3End(i1, i2, i3)\
i1 += hypre__sx1;\
i2 += hypre__sx2;\
i3 += hypre__sx3;\
}\
i1 += hypre__sy1 - hypre__nx*hypre__sx1;\
i2 += hypre__sy2 - hypre__nx*hypre__sx2;\
i3 += hypre__sy3 - hypre__nx*hypre__sx3;\
}\
i1 += hypre__sz1 - hypre__ny*hypre__sy1;\
i2 += hypre__sz2 - hypre__ny*hypre__sy2;\
i3 += hypre__sz3 - hypre__ny*hypre__sy3;\
}\
}\
}
/*-----------------------------------*/
#define hypre_BoxLoop4Begin(loop_size,\
dbox1, start1, stride1, i1,\
dbox2, start2, stride2, i2,\
dbox3, start3, stride3, i3,\
dbox4, start4, stride4, i4)\
{\
int hypre__i1start = hypre_BoxIndexRank(dbox1, start1);\
int hypre__i2start = hypre_BoxIndexRank(dbox2, start2);\
int hypre__i3start = hypre_BoxIndexRank(dbox3, start3);\
int hypre__i4start = hypre_BoxIndexRank(dbox4, start4);\
hypre_BoxLoopDeclareS(dbox1, stride1, hypre__sx1, hypre__sy1, hypre__sz1);\
hypre_BoxLoopDeclareS(dbox2, stride2, hypre__sx2, hypre__sy2, hypre__sz2);\
hypre_BoxLoopDeclareS(dbox3, stride3, hypre__sx3, hypre__sy3, hypre__sz3);\
hypre_BoxLoopDeclareS(dbox4, stride4, hypre__sx4, hypre__sy4, hypre__sz4);\
hypre_BoxLoopDeclareN(loop_size);
#define hypre_BoxLoop4For(i, j, k, i1, i2, i3, i4)\
for (hypre__block = 0; hypre__block < hypre__num_blocks; hypre__block++)\
{\
hypre_BoxLoopSet(i, j, k);\
i1 = hypre__i1start + i*hypre__sx1 + j*hypre__sy1 + k*hypre__sz1;\
i2 = hypre__i2start + i*hypre__sx2 + j*hypre__sy2 + k*hypre__sz2;\
i3 = hypre__i3start + i*hypre__sx3 + j*hypre__sy3 + k*hypre__sz3;\
i4 = hypre__i4start + i*hypre__sx4 + j*hypre__sy4 + k*hypre__sz4;\
for (k = 0; k < hypre__nz; k++)\
{\
for (j = 0; j < hypre__ny; j++)\
{\
for (i = 0; i < hypre__nx; i++)\
{
#define hypre_BoxLoop4End(i1, i2, i3, i4)\
i1 += hypre__sx1;\
i2 += hypre__sx2;\
i3 += hypre__sx3;\
i4 += hypre__sx4;\
}\
i1 += hypre__sy1 - hypre__nx*hypre__sx1;\
i2 += hypre__sy2 - hypre__nx*hypre__sx2;\
i3 += hypre__sy3 - hypre__nx*hypre__sx3;\
i4 += hypre__sy4 - hypre__nx*hypre__sx4;\
}\
i1 += hypre__sz1 - hypre__ny*hypre__sy1;\
i2 += hypre__sz2 - hypre__ny*hypre__sy2;\
i3 += hypre__sz3 - hypre__ny*hypre__sy3;\
i4 += hypre__sz4 - hypre__ny*hypre__sy4;\
}\
}\
}
/*-----------------------------------*/
#endif /* ifndef HYPRE_USE_PTHREADS */
#endif
/******************************************************************************
*
* Header info for the Box structures
*
*****************************************************************************/
#ifdef HYPRE_USE_PTHREADS
#ifndef hypre_BOX_PTHREADS_HEADER
#define hypre_BOX_PTHREADS_HEADER
#include <pthread.h>
#include "threading.h"
extern volatile int hypre_thread_counter;
extern int iteration_counter;
/*--------------------------------------------------------------------------
* Threaded Looping macros:
*--------------------------------------------------------------------------*/
#ifndef CHUNK_GOAL
#define CHUNK_GOAL (hypre_NumThreads*1)
#endif
#ifndef MIN_VOL
#define MIN_VOL 125
#endif
#ifndef MAX_VOL
#define MAX_VOL 64000
#endif
#define hypre_BoxLoopDeclare(loop_size, data_box, stride, iinc, jinc, kinc) \
int iinc = (hypre_IndexX(stride));\
int jinc = (hypre_IndexY(stride)*hypre_BoxSizeX(data_box) -\
hypre_IndexX(loop_size)*hypre_IndexX(stride));\
int kinc = (hypre_IndexZ(stride)*\
hypre_BoxSizeX(data_box)*hypre_BoxSizeY(data_box) -\
hypre_IndexY(loop_size)*\
hypre_IndexY(stride)*hypre_BoxSizeX(data_box))
#define vol_cbrt(vol) (int) pow((double)(vol), 1. / 3.)
#define hypre_ThreadLoopBegin(local_counter, init_val, stop_val, tl_index,\
tl_mtx, tl_body)\
for (local_counter = ifetchadd(&tl_index, &tl_mtx) + init_val;\
local_counter < stop_val;\
local_counter = ifetchadd(&tl_index, &tl_mtx) + init_val)\
{\
tl_body;
#define hypre_ThreadLoop(tl_index,\
tl_count, tl_release, tl_mtx)\
if (pthread_equal(initial_thread, pthread_self()) == 0)\
{\
pthread_mutex_lock(&tl_mtx);\
tl_count++;\
if (tl_count < hypre_NumThreads)\
{\
pthread_mutex_unlock(&tl_mtx);\
while (!tl_release);\
pthread_mutex_lock(&tl_mtx);\
tl_count--;\
pthread_mutex_unlock(&tl_mtx);\
while (tl_release);\
}\
else\
{\
tl_count--;\
tl_index = 0;\
pthread_mutex_unlock(&tl_mtx);\
tl_release = 1;\
while (tl_count);\
tl_release = 0;\
}\
}\
else\
tl_index = 0
#define hypre_ThreadLoopOld(local_counter, init_val, stop_val, tl_index,\
tl_count, tl_release, tl_mtx, tl_body)\
{\
for (local_counter = ifetchadd(&tl_index, &tl_mtx) + init_val;\
local_counter < stop_val;\
local_counter = ifetchadd(&tl_index, &tl_mtx) + init_val)\
{\
tl_body;\
}\
if (pthread_equal(initial_thread, pthread_self()) == 0)\
{\
pthread_mutex_lock(&tl_mtx);\
tl_count++;\
if (tl_count < hypre_NumThreads)\
{\
pthread_mutex_unlock(&tl_mtx);\
while (!tl_release);\
pthread_mutex_lock(&tl_mtx);\
tl_count--;\
pthread_mutex_unlock(&tl_mtx);\
while (tl_release);\
}\
else\
{\
tl_count--;\
tl_index = 0;\
pthread_mutex_unlock(&tl_mtx);\
tl_release = 1;\
while (tl_count);\
tl_release = 0;\
}\
}\
else\
tl_index = 0;\
}
#define hypre_ChunkLoopExternalSetup(hypre__nx, hypre__ny, hypre__nz)\
int target_vol, target_area, target_len;\
int cbrt_tar_vol, sqrt_tar_area;\
int edge_divisor;\
int znumchunk, ynumchunk, xnumchunk;\
int hypre__cz, hypre__cy, hypre__cx;\
int numchunks;\
int clfreq[3], clreset[3];\
int clstart[3];\
int clfinish[3];\
int chunkcount;\
target_vol = hypre_min(hypre_max((hypre__nx * hypre__ny * hypre__nz) / CHUNK_GOAL,\
MIN_VOL), MAX_VOL);\
cbrt_tar_vol = (int) (pow ((double)target_vol, 1./3.));\
edge_divisor = hypre__nz / cbrt_tar_vol + !!(hypre__nz % cbrt_tar_vol);\
hypre__cz = hypre__nz / edge_divisor + !!(hypre__nz % edge_divisor);\
znumchunk = hypre__nz / hypre__cz + !!(hypre__nz % hypre__cz);\
target_area = target_vol / hypre__cz;\
sqrt_tar_area = (int) (sqrt((double)target_area));\
edge_divisor = hypre__ny / sqrt_tar_area + !!(hypre__ny % sqrt_tar_area);\
hypre__cy = hypre__ny / edge_divisor + !!(hypre__ny % edge_divisor);\
ynumchunk = hypre__ny / hypre__cy + !!(hypre__ny % hypre__cy);\
target_len = target_area / hypre__cy;\
edge_divisor = hypre__nx / target_len + !!(hypre__nx % target_len);\
hypre__cx = hypre__nx / edge_divisor + !!(hypre__nx % edge_divisor);\
xnumchunk = hypre__nx / hypre__cx + !!(hypre__nx % hypre__cx);\
numchunks = znumchunk * ynumchunk * xnumchunk;\
clfreq[0] = 1;\
clreset[0] = xnumchunk;\
clfreq[1] = clreset[0];\
clreset[1] = ynumchunk * xnumchunk;\
clfreq[2] = clreset[1];\
clreset[2] = znumchunk * ynumchunk * xnumchunk
#define hypre_ChunkLoopInternalSetup(clstart, clfinish, clreset, clfreq,\
hypre__nx, hypre__ny, hypre__nz,\
hypre__cx, hypre__cy, hypre__cz,\
chunkcount)\
clstart[0] = ((chunkcount % clreset[0]) / clfreq[0]) * hypre__cx;\
if (clstart[0] < hypre__nx - hypre__cx)\
clfinish[0] = clstart[0] + hypre__cx;\
else\
clfinish[0] = hypre__nx;\
clstart[1] = ((chunkcount % clreset[1]) / clfreq[1]) * hypre__cy;\
if (clstart[1] < hypre__ny - hypre__cy)\
clfinish[1] = clstart[1] + hypre__cy;\
else\
clfinish[1] = hypre__ny;\
clstart[2] = ((chunkcount % clreset[2]) / clfreq[2]) * hypre__cz;\
if (clstart[2] < hypre__nz - hypre__cz)\
clfinish[2] = clstart[2] + hypre__cz;\
else\
clfinish[2] = hypre__nz
#define hypre_BoxLoop0Begin(loop_size)\
{\
int hypre__nx = hypre_IndexX(loop_size);\
int hypre__ny = hypre_IndexY(loop_size);\
int hypre__nz = hypre_IndexZ(loop_size);\
if (hypre__nx && hypre__ny && hypre__nz )\
{\
hypre_ChunkLoopExternalSetup(hypre__nx, hypre__ny, hypre__nz);\
hypre_ThreadLoopBegin(chunkcount, 0, numchunks, iteration_counter,\
hypre_mutex_boxloops,\
hypre_ChunkLoopInternalSetup(clstart, clfinish, clreset, clfreq,\
hypre__nx, hypre__ny, hypre__nz,\
hypre__cx, hypre__cy, hypre__cz,\
chunkcount));
#define hypre_BoxLoop0For(i, j, k)\
for (k = clstart[2]; k < clfinish[2]; k++ )\
{\
for (j = clstart[1]; j < clfinish[1]; j++ )\
{\
for (i = clstart[0]; i < clfinish[0]; i++ )\
{
#define hypre_BoxLoop0End() }}}hypre_ThreadLoop(iteration_counter,\
hypre_thread_counter, hypre_thread_release,\
hypre_mutex_boxloops);}}}
#define hypre_BoxLoop1Begin(loop_size,\
data_box1, start1, stride1, i1)\
{\
hypre_BoxLoopDeclare(loop_size, data_box1, stride1,\
hypre__iinc1, hypre__jinc1, hypre__kinc1);\
int hypre__nx = hypre_IndexX(loop_size);\
int hypre__ny = hypre_IndexY(loop_size);\
int hypre__nz = hypre_IndexZ(loop_size);\
int orig_i1 = hypre_BoxIndexRank(data_box1, start1);\
if (hypre__nx && hypre__ny && hypre__nz )\
{\
hypre_ChunkLoopExternalSetup(hypre__nx, hypre__ny, hypre__nz);\
hypre_ThreadLoopBegin(chunkcount, 0, numchunks, iteration_counter,\
hypre_mutex_boxloops,\
hypre_ChunkLoopInternalSetup(clstart, clfinish, clreset, clfreq,\
hypre__nx, hypre__ny, hypre__nz,\
hypre__cx, hypre__cy, hypre__cz,\
chunkcount));
#define hypre_BoxLoop1For(i, j, k, i1)\
for (k = clstart[2]; k < clfinish[2]; k++)\
{\
for (j = clstart[1]; j < clfinish[1]; j++)\
{\
for (i = clstart[0]; i < clfinish[0]; i++)\
{\
i1 = orig_i1 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc1 +\
(j + hypre__ny*k)*hypre__jinc1 + k*hypre__kinc1;
#define hypre_BoxLoop1End(i1) }}}hypre_ThreadLoop(iteration_counter,\
hypre_thread_counter, hypre_thread_release,\
hypre_mutex_boxloops);}}}
#define hypre_BoxLoop2Begin(loop_size,\
data_box1, start1, stride1, i1,\
data_box2, start2, stride2, i2)\
{\
hypre_BoxLoopDeclare(loop_size, data_box1, stride1,\
hypre__iinc1, hypre__jinc1, hypre__kinc1);\
hypre_BoxLoopDeclare(loop_size, data_box2, stride2,\
hypre__iinc2, hypre__jinc2, hypre__kinc2);\
int hypre__nx = hypre_IndexX(loop_size);\
int hypre__ny = hypre_IndexY(loop_size);\
int hypre__nz = hypre_IndexZ(loop_size);\
int orig_i1 = hypre_BoxIndexRank(data_box1, start1);\
int orig_i2 = hypre_BoxIndexRank(data_box2, start2);\
if (hypre__nx && hypre__ny && hypre__nz )\
{\
hypre_ChunkLoopExternalSetup(hypre__nx, hypre__ny, hypre__nz);\
hypre_ThreadLoopBegin(chunkcount, 0, numchunks, iteration_counter,\
hypre_mutex_boxloops,\
hypre_ChunkLoopInternalSetup(clstart, clfinish, clreset, clfreq,\
hypre__nx, hypre__ny, hypre__nz,\
hypre__cx, hypre__cy, hypre__cz,\
chunkcount))
#define hypre_BoxLoop2For(i, j, k, i1, i2)\
for (k = clstart[2]; k < clfinish[2]; k++)\
{\
for (j = clstart[1]; j < clfinish[1]; j++)\
{\
for (i = clstart[0]; i < clfinish[0]; i++)\
{\
i1 = orig_i1 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc1 +\
(j + hypre__ny*k)*hypre__jinc1 + k*hypre__kinc1;\
i2 = orig_i2 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc2 +\
(j + hypre__ny*k)*hypre__jinc2 + k*hypre__kinc2;
#define hypre_BoxLoop2End(i1, i2) }}}hypre_ThreadLoop(iteration_counter,\
hypre_thread_counter, hypre_thread_release,\
hypre_mutex_boxloops);}}}
#define hypre_BoxLoop3Begin(loop_size,\
data_box1, start1, stride1, i1,\
data_box2, start2, stride2, i2,\
data_box3, start3, stride3, i3)\
{\
hypre_BoxLoopDeclare(loop_size, data_box1, stride1,\
hypre__iinc1, hypre__jinc1, hypre__kinc1);\
hypre_BoxLoopDeclare(loop_size, data_box2, stride2,\
hypre__iinc2, hypre__jinc2, hypre__kinc2);\
hypre_BoxLoopDeclare(loop_size, data_box3, stride3,\
hypre__iinc3, hypre__jinc3, hypre__kinc3);\
int hypre__nx = hypre_IndexX(loop_size);\
int hypre__ny = hypre_IndexY(loop_size);\
int hypre__nz = hypre_IndexZ(loop_size);\
int orig_i1 = hypre_BoxIndexRank(data_box1, start1);\
int orig_i2 = hypre_BoxIndexRank(data_box2, start2);\
int orig_i3 = hypre_BoxIndexRank(data_box3, start3);\
if (hypre__nx && hypre__ny && hypre__nz )\
{\
hypre_ChunkLoopExternalSetup(hypre__nx, hypre__ny, hypre__nz);\
hypre_ThreadLoopBegin(chunkcount, 0, numchunks, iteration_counter,\
hypre_mutex_boxloops,\
hypre_ChunkLoopInternalSetup(clstart, clfinish, clreset, clfreq,\
hypre__nx, hypre__ny, hypre__nz,\
hypre__cx, hypre__cy, hypre__cz,\
chunkcount))
#define hypre_BoxLoop3For(i, j, k, i1, i2, i3)\
for (k = clstart[2]; k < clfinish[2]; k++)\
{\
for (j = clstart[1]; j < clfinish[1]; j++)\
{\
for (i = clstart[0]; i < clfinish[0]; i++)\
{\
i1 = orig_i1 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc1 +\
(j + hypre__ny*k)*hypre__jinc1 + k*hypre__kinc1;\
i2 = orig_i2 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc2 +\
(j + hypre__ny*k)*hypre__jinc2 + k*hypre__kinc2;\
i3 = orig_i3 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc3 +\
(j + hypre__ny*k)*hypre__jinc3 + k*hypre__kinc3;\
#define hypre_BoxLoop3End(i1, i2, i3) }}}hypre_ThreadLoop(iteration_counter,\
hypre_thread_counter, hypre_thread_release,\
hypre_mutex_boxloops);}}}
#define hypre_BoxLoop4Begin(loop_size,\
data_box1, start1, stride1, i1,\
data_box2, start2, stride2, i2,\
data_box3, start3, stride3, i3,\
data_box4, start4, stride4, i4)\
{\
hypre_BoxLoopDeclare(loop_size, data_box1, stride1,\
hypre__iinc1, hypre__jinc1, hypre__kinc1);\
hypre_BoxLoopDeclare(loop_size, data_box2, stride2,\
hypre__iinc2, hypre__jinc2, hypre__kinc2);\
hypre_BoxLoopDeclare(loop_size, data_box3, stride3,\
hypre__iinc3, hypre__jinc3, hypre__kinc3);\
hypre_BoxLoopDeclare(loop_size, data_box4, stride4,\
hypre__iinc4, hypre__jinc4, hypre__kinc4);\
int hypre__nx = hypre_IndexX(loop_size);\
int hypre__ny = hypre_IndexY(loop_size);\
int hypre__nz = hypre_IndexZ(loop_size);\
int orig_i1 = hypre_BoxIndexRank(data_box1, start1);\
int orig_i2 = hypre_BoxIndexRank(data_box2, start2);\
int orig_i3 = hypre_BoxIndexRank(data_box3, start3);\
int orig_i4 = hypre_BoxIndexRank(data_box4, start4);\
if (hypre__nx && hypre__ny && hypre__nz )\
{\
hypre_ChunkLoopExternalSetup(hypre__nx, hypre__ny, hypre__nz);\
hypre_ThreadLoopBegin(chunkcount, 0, numchunks, iteration_counter,\
hypre_mutex_boxloops,\
hypre_ChunkLoopInternalSetup(clstart, clfinish, clreset, clfreq,\
hypre__nx, hypre__ny, hypre__nz,\
hypre__cx, hypre__cy, hypre__cz,\
chunkcount))
#define hypre_BoxLoop4For(i, j, k, i1, i2, i3, i4)\
for (k = clstart[2]; k < clfinish[2]; k++)\
{\
for (j = clstart[1]; j < clfinish[1]; j++)\
{\
for (i = clstart[0]; i < clfinish[0]; i++)\
{\
i1 = orig_i1 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc1 +\
(j + hypre__ny*k)*hypre__jinc1 + k*hypre__kinc1;\
i2 = orig_i2 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc2 +\
(j + hypre__ny*k)*hypre__jinc2 + k*hypre__kinc2;\
i3 = orig_i3 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc3 +\
(j + hypre__ny*k)*hypre__jinc3 + k*hypre__kinc3;\
i4 = orig_i4 +\
(i + hypre__nx*j + hypre__nx*hypre__ny*k)*hypre__iinc4 +\
(j + hypre__ny*k)*hypre__jinc4 + k*hypre__kinc4;\
#define hypre_BoxLoop4End(i1, i2, i3, i4) }}}hypre_ThreadLoop(iteration_counter,\
hypre_thread_counter, hypre_thread_release,\
hypre_mutex_boxloops);}}}
#endif
#endif
/******************************************************************************
*
* Header info for the struct assumed partition
*
*****************************************************************************/
#ifndef hypre_ASSUMED_PART_HEADER
#define hypre_ASSUMED_PART_HEADER
/* to prevent overflow */
#define hypre_doubleBoxVolume(box) \
((double) hypre_BoxSizeX(box) * (double) hypre_BoxSizeY(box) * (double) hypre_BoxSizeZ(box))
typedef struct
{
/* the entries will be the same for all procs */
hypre_BoxArray *regions;
int num_regions;
int *proc_partitions;
hypre_Index *divisions;
/* these entries are specific to each proc */
hypre_BoxArray *my_partition;
hypre_BoxArray *my_partition_boxes;
int *my_partition_proc_ids;
int *my_partition_boxnums;
int my_partition_ids_size;
int my_partition_ids_alloc;
int my_partition_num_distinct_procs;
} hypre_StructAssumedPart;
/*Accessor macros */
#define hypre_StructAssumedPartRegions(apart) ((apart)->regions)
#define hypre_StructAssumedPartNumRegions(apart) ((apart)->num_regions)
#define hypre_StructAssumedPartDivisions(apart) ((apart)->divisions)
#define hypre_StructAssumedPartDivision(apart, i) ((apart)->divisions[i])
#define hypre_StructAssumedPartProcPartitions(apart) ((apart)->proc_partitions)
#define hypre_StructAssumedPartProcPartition(apart, i) ((apart)->proc_partitions[i])
#define hypre_StructAssumedPartMyPartition(apart) ((apart)->my_partition)
#define hypre_StructAssumedPartMyPartitionBoxes(apart) ((apart)->my_partition_boxes)
#define hypre_StructAssumedPartMyPartitionProcIds(apart) ((apart)->my_partition_proc_ids)
#define hypre_StructAssumedPartMyPartitionIdsSize(apart) ((apart)->my_partition_ids_size)
#define hypre_StructAssumedPartMyPartitionIdsAlloc(apart) ((apart)->my_partition_ids_alloc)
#define hypre_StructAssumedPartMyPartitionNumDistinctProcs(apart) ((apart)->my_partition_num_distinct_procs)
#define hypre_StructAssumedPartMyPartitionBoxnums(apart) ((apart)->my_partition_boxnums)
#define hypre_StructAssumedPartMyPartitionProcId(apart, i) ((apart)->my_partition_proc_ids[i])
#define hypre_StructAssumedPartMyPartitionBoxnum(apart, i) ((apart)->my_partition_boxnums[i])
#endif
#ifndef hypre_BOX_MANAGER_HEADER
#define hypre_BOX_MANAGER_HEADER
/*---------------------------------------------------------------------------
*
* Box Manager: organizes arbitrary information in a spatial way
*
*----------------------------------------------------------------------------*/
typedef struct hypre_BoxManEntry_struct
{
hypre_Index imin; /*extents of box */
hypre_Index imax;
int proc; /*this is a two-part unique id: (proc, id) */
int id;
int num_ghost[6];
void *info;
struct hypre_BoxManEntry_struct *next;
} hypre_BoxManEntry;
/*-----------------------------------------------------------------------------*/
typedef struct
{
MPI_Comm comm;
int max_nentries; /* storage in entries allocated to this
amount */
int is_gather_called; /* boolean to indicate whether GatherEntries
function has been called (prior to
assemble) - may not want this (can tell
by the size of gather_regions array) */
hypre_BoxArray *gather_regions; /*this is where we collect boxes input
by calls to BoxManGatherEntries - to be
gathered in the assemble. These are then
deleted after the assemble */
int all_global_known; /* Boolean to say that every
processor already has all
of the global data for
this manager (this could be
acessed by a coarsening routine,
for example) */
int is_entries_sort; /* Boolean to say that entries were
added in sorted order (id, proc)
(this could be
acessed by a coarsening routine,
for example) */
int entry_info_size; /* in bytes, the (max) size of the info
object for the entries */
int is_assembled; /* flag to indicate if the box manager has been
assembled (use to control whether or not
functions can be used prior to assemble)*/
/* storing the entries */
int nentries; /* number of entries stored */
hypre_BoxManEntry *entries; /* These are the actual box manager entries - these
are sorted by (proc, id) at the end of the assemble)*/
int *procs_sort; /* the sorted procs corresponding to entries */
int *ids_sort; /* sorted ids corresponding to the entries */
int num_procs_sort; /* number of distinct procs in *entries */
int *procs_sort_offsets; /* offsets for procs into the
*entry_sort array */
int first_local; /* position of local infomation in entries*/
int local_proc_offset; /*position of local information in offsets */
/* here is the table that organizes the entries spatially (by index)*/
hypre_BoxManEntry **index_table; /* this points into 'entries' array
and corresponds to the index arays*/
int *indexes[3]; /* here we have the x,y,z indexes (ordered)
for the imin and imax
of each box in the entries array*/
int size[3]; /* how many indexes we have in each direction
- x,y,z */
int last_index[3]; /* the last index used in the indexes map */
int num_my_entries; /* number of entries with proc_id = myid */
int *my_ids; /* an array of ids corresponding to my entries */
hypre_BoxManEntry **my_entries; /* points into *entries that are mine & corresponds to
my_ids array. This is destroyed in the assemble */
hypre_StructAssumedPart *assumed_partition; /* the assumed partition object - for now this is only
used during the assemble (where it is created)*/
int dim; /* problem dimension (known in the grid) */
hypre_Box *bounding_box; /* bounding box - from associated grid */
/* ghost stuff - leave for now */
int num_ghost[6];
} hypre_BoxManager;
/*--------------------------------------------------------------------------
* Accessor macros: hypre_BoxMan
*--------------------------------------------------------------------------*/
#define hypre_BoxManComm(manager) ((manager) -> comm)
#define hypre_BoxManMaxNEntries(manager) ((manager) -> max_nentries)
#define hypre_BoxManIsGatherCalled(manager) ((manager) -> is_gather_called)
#define hypre_BoxManIsEntriesSort(manager) ((manager) -> is_entries_sort)
#define hypre_BoxManGatherRegions(manager) ((manager) -> gather_regions)
#define hypre_BoxManAllGlobalKnown(manager) ((manager) -> all_global_known)
#define hypre_BoxManEntryInfoSize(manager) ((manager) -> entry_info_size)
#define hypre_BoxManNEntries(manager) ((manager) -> nentries)
#define hypre_BoxManEntries(manager) ((manager) -> entries)
#define hypre_BoxManIsAssembled(manager) ((manager) -> is_assembled)
#define hypre_BoxManProcsSort(manager) ((manager) -> procs_sort)
#define hypre_BoxManIdsSort(manager) ((manager) -> ids_sort)
#define hypre_BoxManNumProcsSort(manager) ((manager) -> num_procs_sort)
#define hypre_BoxManProcsSortOffsets(manager) ((manager) -> procs_sort_offsets)
#define hypre_BoxManLocalProcOffset(manager) ((manager) -> local_proc_offset)
#define hypre_BoxManFirstLocal(manager) ((manager) -> first_local)
#define hypre_BoxManIndexTable(manager) ((manager) -> index_table)
#define hypre_BoxManIndexes(manager) ((manager) -> indexes)
#define hypre_BoxManSize(manager) ((manager) -> size)
#define hypre_BoxManLastIndex(manager) ((manager) -> last_index)
#define hypre_BoxManNumMyEntries(manager) ((manager) -> num_my_entries)
#define hypre_BoxManMyIds(manager) ((manager) -> my_ids)
#define hypre_BoxManMyEntries(manager) ((manager) -> my_entries)
#define hypre_BoxManAssumedPartition(manager) ((manager) -> assumed_partition)
#define hypre_BoxManDim(manager) ((manager) -> dim)
#define hypre_BoxManBoundingBox(manager) ((manager) -> bounding_box)
#define hypre_BoxManNumGhost(manager) ((manager) -> num_ghost)
#define hypre_BoxManIndexesD(manager, d) hypre_BoxManIndexes(manager)[d]
#define hypre_BoxManSizeD(manager, d) hypre_BoxManSize(manager)[d]
#define hypre_BoxManLastIndexD(manager, d) hypre_BoxManLastIndex(manager)[d]
#define hypre_BoxManIndexTableEntry(manager, i, j, k) \
hypre_BoxManIndexTable(manager)[((k*hypre_BoxManSizeD(manager, 1) + j)*\
hypre_BoxManSizeD(manager, 0) + i)]
/*--------------------------------------------------------------------------
* Accessor macros: hypre_BoxManEntry
*--------------------------------------------------------------------------*/
#define hypre_BoxManEntryIMin(entry) ((entry) -> imin)
#define hypre_BoxManEntryIMax(entry) ((entry) -> imax)
#define hypre_BoxManEntryProc(entry) ((entry) -> proc)
#define hypre_BoxManEntryId(entry) ((entry) -> id)
#define hypre_BoxManEntryInfo(entry) ((entry) -> info)
#define hypre_BoxManEntryNumGhost(entry) ((entry) -> num_ghost)
#define hypre_BoxManEntryNext(entry) ((entry) -> next)
/*--------------------------------------------------------------------------
* Info objects
*--------------------------------------------------------------------------*/
typedef struct
{
int type;
int proc;
int offset;
int box;
int ghoffset;
} hypre_BoxManInfoDefault;
#define hypre_BoxManInfoDType(info) ((info) -> type)
#define hypre_BoxManInfoDProc(info) ((info) -> proc)
#define hypre_BoxManInfoDOffset(info) ((info) -> offset)
#define hypre_BoxManInfoDBox(info) ((info) -> box)
#define hypre_BoxManInfoDGhoffset(info) ((info) -> ghoffset)
#endif
/******************************************************************************
*
* Header info for the hypre_StructGrid structures
*
*****************************************************************************/
#ifndef hypre_STRUCT_GRID_HEADER
#define hypre_STRUCT_GRID_HEADER
/*--------------------------------------------------------------------------
* hypre_StructGrid:
*--------------------------------------------------------------------------*/
typedef struct hypre_StructGrid_struct
{
MPI_Comm comm;
int dim; /* Number of grid dimensions */
hypre_BoxArray *boxes; /* Array of boxes in this process */
int *ids; /* Unique IDs for boxes */
hypre_Index max_distance; /* Neighborhood size - in each dimension*/
hypre_Box *bounding_box; /* Bounding box around grid */
int local_size; /* Number of grid points locally */
int global_size; /* Total number of grid points */
hypre_Index periodic; /* Indicates if grid is periodic */
int num_periods; /* number of box set periods */
hypre_Index *pshifts; /* shifts of periodicity */
int ref_count;
int ghlocal_size; /* Number of vars in box including ghosts */
int num_ghost[6]; /* ghost layer size for each box */
hypre_BoxManager *box_man;
} hypre_StructGrid;
/*--------------------------------------------------------------------------
* Accessor macros: hypre_StructGrid
*--------------------------------------------------------------------------*/
#define hypre_StructGridComm(grid) ((grid) -> comm)
#define hypre_StructGridDim(grid) ((grid) -> dim)
#define hypre_StructGridBoxes(grid) ((grid) -> boxes)
#define hypre_StructGridIDs(grid) ((grid) -> ids)
#define hypre_StructGridMaxDistance(grid) ((grid) -> max_distance)
#define hypre_StructGridBoundingBox(grid) ((grid) -> bounding_box)
#define hypre_StructGridLocalSize(grid) ((grid) -> local_size)
#define hypre_StructGridGlobalSize(grid) ((grid) -> global_size)
#define hypre_StructGridPeriodic(grid) ((grid) -> periodic)
#define hypre_StructGridNumPeriods(grid) ((grid) -> num_periods)
#define hypre_StructGridPShifts(grid) ((grid) -> pshifts)
#define hypre_StructGridPShift(grid, i) ((grid) -> pshifts[i])
#define hypre_StructGridRefCount(grid) ((grid) -> ref_count)
#define hypre_StructGridGhlocalSize(grid) ((grid) -> ghlocal_size)
#define hypre_StructGridNumGhost(grid) ((grid) -> num_ghost)
#define hypre_StructGridBoxMan(grid) ((grid) -> box_man)
#define hypre_StructGridBox(grid, i) \
(hypre_BoxArrayBox(hypre_StructGridBoxes(grid), i))
#define hypre_StructGridNumBoxes(grid) \
(hypre_BoxArraySize(hypre_StructGridBoxes(grid)))
#define hypre_StructGridIDPeriod(grid) \
hypre_BoxNeighborsIDPeriod(hypre_StructGridNeighbors(grid))
/*--------------------------------------------------------------------------
* Looping macros:
*--------------------------------------------------------------------------*/
#define hypre_ForStructGridBoxI(i, grid) \
hypre_ForBoxI(i, hypre_StructGridBoxes(grid))
#endif
/******************************************************************************
*
* Header info for hypre_StructStencil data structures
*
*****************************************************************************/
#ifndef hypre_STRUCT_STENCIL_HEADER
#define hypre_STRUCT_STENCIL_HEADER
/*--------------------------------------------------------------------------
* hypre_StructStencil
*--------------------------------------------------------------------------*/
typedef struct hypre_StructStencil_struct
{
hypre_Index *shape; /* Description of a stencil's shape */
int size; /* Number of stencil coefficients */
int max_offset;
int dim; /* Number of dimensions */
int ref_count;
} hypre_StructStencil;
/*--------------------------------------------------------------------------
* Accessor functions for the hypre_StructStencil structure
*--------------------------------------------------------------------------*/
#define hypre_StructStencilShape(stencil) ((stencil) -> shape)
#define hypre_StructStencilSize(stencil) ((stencil) -> size)
#define hypre_StructStencilMaxOffset(stencil) ((stencil) -> max_offset)
#define hypre_StructStencilDim(stencil) ((stencil) -> dim)
#define hypre_StructStencilRefCount(stencil) ((stencil) -> ref_count)
#define hypre_StructStencilElement(stencil, i) \
hypre_StructStencilShape(stencil)[i]
#endif
#ifndef hypre_COMMUNICATION_HEADER
#define hypre_COMMUNICATION_HEADER
/*--------------------------------------------------------------------------
* hypre_CommInfo:
*
* For "reverse" communication, the following are not needed (may be NULL)
* send_rboxnums, send_rboxes, send_transforms
*
* For "forward" communication, the following are not needed (may be NULL)
* recv_rboxnums, recv_rboxes, recv_transforms
*
*--------------------------------------------------------------------------*/
typedef struct hypre_CommInfo_struct
{
hypre_BoxArrayArray *send_boxes;
hypre_Index send_stride;
int **send_processes;
int **send_rboxnums;
hypre_BoxArrayArray *send_rboxes; /* send_boxes, some with periodic shift */
hypre_BoxArrayArray *recv_boxes;
hypre_Index recv_stride;
int **recv_processes;
int **recv_rboxnums;
hypre_BoxArrayArray *recv_rboxes; /* recv_boxes, some with periodic shift */
int num_transforms; /* may be 0 = identity transform */
hypre_Index *coords; /* may be NULL = identity transform */
hypre_Index *dirs; /* may be NULL = identity transform */
int **send_transforms; /* may be NULL = identity transform */
int **recv_transforms; /* may be NULL = identity transform */
int boxes_match; /* true (>0) if each send box has a
* matching box on the recv processor */
} hypre_CommInfo;
/*--------------------------------------------------------------------------
* hypre_CommEntryType:
*--------------------------------------------------------------------------*/
typedef struct hypre_CommEntryType_struct
{
int offset; /* offset for the data */
int dim; /* dimension of the communication */
int length_array[3]; /* 4th dimension has length 'num_values' */
int stride_array[4];
int *order; /* order of 4th dimension values */
} hypre_CommEntryType;
/*--------------------------------------------------------------------------
* hypre_CommType:
*--------------------------------------------------------------------------*/
typedef struct hypre_CommType_struct
{
int proc;
int bufsize; /* message buffer size (in doubles) */
int num_entries;
hypre_CommEntryType *entries;
/* this is only needed until first send buffer prefix is packed */
int *rem_boxnums; /* entry remote box numbers */
hypre_Box *rem_boxes; /* entry remote boxes */
} hypre_CommType;
/*--------------------------------------------------------------------------
* hypre_CommPkg:
* Structure containing information for doing communications
*--------------------------------------------------------------------------*/
typedef struct hypre_CommPkg_struct
{
MPI_Comm comm;
int first_comm; /* is this the first communication? */
int num_values;
hypre_Index send_stride;
hypre_Index recv_stride;
int send_bufsize; /* total send buffer size (in doubles) */
int recv_bufsize; /* total recv buffer size (in doubles) */
int num_sends;
int num_recvs;
hypre_CommType *send_types;
hypre_CommType *recv_types;
hypre_CommType *copy_from_type;
hypre_CommType *copy_to_type;
int num_orders;
int **orders; /* num_orders x num_values */
int *recv_data_offsets; /* offsets into recv data (by box) */
hypre_BoxArray *recv_data_space; /* recv data dimensions (by box) */
hypre_Index identity_coord;
hypre_Index identity_dir;
int *identity_order;
} hypre_CommPkg;
/*--------------------------------------------------------------------------
* CommHandle:
*--------------------------------------------------------------------------*/
typedef struct hypre_CommHandle_struct
{
hypre_CommPkg *comm_pkg;
double *send_data;
double *recv_data;
int num_requests;
MPI_Request *requests;
MPI_Status *status;
double **send_buffers;
double **recv_buffers;
/* set = 0, add = 1 */
int action;
} hypre_CommHandle;
/*--------------------------------------------------------------------------
* Accessor macros: hypre_CommInto
*--------------------------------------------------------------------------*/
#define hypre_CommInfoSendBoxes(info) (info -> send_boxes)
#define hypre_CommInfoSendStride(info) (info -> send_stride)
#define hypre_CommInfoSendProcesses(info) (info -> send_processes)
#define hypre_CommInfoSendRBoxnums(info) (info -> send_rboxnums)
#define hypre_CommInfoSendRBoxes(info) (info -> send_rboxes)
#define hypre_CommInfoRecvBoxes(info) (info -> recv_boxes)
#define hypre_CommInfoRecvStride(info) (info -> recv_stride)
#define hypre_CommInfoRecvProcesses(info) (info -> recv_processes)
#define hypre_CommInfoRecvRBoxnums(info) (info -> recv_rboxnums)
#define hypre_CommInfoRecvRBoxes(info) (info -> recv_rboxes)
#define hypre_CommInfoNumTransforms(info) (info -> num_transforms)
#define hypre_CommInfoCoords(info) (info -> coords)
#define hypre_CommInfoDirs(info) (info -> dirs)
#define hypre_CommInfoSendTransforms(info) (info -> send_transforms)
#define hypre_CommInfoRecvTransforms(info) (info -> recv_transforms)
#define hypre_CommInfoBoxesMatch(info) (info -> boxes_match)
/*--------------------------------------------------------------------------
* Accessor macros: hypre_CommEntryType
*--------------------------------------------------------------------------*/
#define hypre_CommEntryTypeOffset(entry) (entry -> offset)
#define hypre_CommEntryTypeDim(entry) (entry -> dim)
#define hypre_CommEntryTypeLengthArray(entry) (entry -> length_array)
#define hypre_CommEntryTypeStrideArray(entry) (entry -> stride_array)
#define hypre_CommEntryTypeOrder(entry) (entry -> order)
/*--------------------------------------------------------------------------
* Accessor macros: hypre_CommType
*--------------------------------------------------------------------------*/
#define hypre_CommTypeProc(type) (type -> proc)
#define hypre_CommTypeBufsize(type) (type -> bufsize)
#define hypre_CommTypeNumEntries(type) (type -> num_entries)
#define hypre_CommTypeEntries(type) (type -> entries)
#define hypre_CommTypeEntry(type, i) &(type -> entries[i])
#define hypre_CommTypeRemBoxnums(type) (type -> rem_boxnums)
#define hypre_CommTypeRemBoxnum(type, i) (type -> rem_boxnums[i])
#define hypre_CommTypeRemBoxes(type) (type -> rem_boxes)
#define hypre_CommTypeRemBox(type, i) &(type -> rem_boxes[i])
/*--------------------------------------------------------------------------
* Accessor macros: hypre_CommPkg
*--------------------------------------------------------------------------*/
#define hypre_CommPkgComm(comm_pkg) (comm_pkg -> comm)
#define hypre_CommPkgFirstComm(comm_pkg) (comm_pkg -> first_comm)
#define hypre_CommPkgNumValues(comm_pkg) (comm_pkg -> num_values)
#define hypre_CommPkgSendStride(comm_pkg) (comm_pkg -> send_stride)
#define hypre_CommPkgRecvStride(comm_pkg) (comm_pkg -> recv_stride)
#define hypre_CommPkgSendBufsize(comm_pkg) (comm_pkg -> send_bufsize)
#define hypre_CommPkgRecvBufsize(comm_pkg) (comm_pkg -> recv_bufsize)
#define hypre_CommPkgNumSends(comm_pkg) (comm_pkg -> num_sends)
#define hypre_CommPkgNumRecvs(comm_pkg) (comm_pkg -> num_recvs)
#define hypre_CommPkgSendTypes(comm_pkg) (comm_pkg -> send_types)
#define hypre_CommPkgSendType(comm_pkg, i) &(comm_pkg -> send_types[i])
#define hypre_CommPkgRecvTypes(comm_pkg) (comm_pkg -> recv_types)
#define hypre_CommPkgRecvType(comm_pkg, i) &(comm_pkg -> recv_types[i])
#define hypre_CommPkgCopyFromType(comm_pkg) (comm_pkg -> copy_from_type)
#define hypre_CommPkgCopyToType(comm_pkg) (comm_pkg -> copy_to_type)
#define hypre_CommPkgNumOrders(comm_pkg) (comm_pkg -> num_orders)
#define hypre_CommPkgOrders(comm_pkg) (comm_pkg -> orders)
#define hypre_CommPkgRecvDataOffsets(comm_pkg) (comm_pkg -> recv_data_offsets)
#define hypre_CommPkgRecvDataSpace(comm_pkg) (comm_pkg -> recv_data_space)
#define hypre_CommPkgIdentityCoord(comm_pkg) (comm_pkg -> identity_coord)
#define hypre_CommPkgIdentityDir(comm_pkg) (comm_pkg -> identity_dir)
#define hypre_CommPkgIdentityOrder(comm_pkg) (comm_pkg -> identity_order)
/*--------------------------------------------------------------------------
* Accessor macros: hypre_CommHandle
*--------------------------------------------------------------------------*/
#define hypre_CommHandleCommPkg(comm_handle) (comm_handle -> comm_pkg)
#define hypre_CommHandleSendData(comm_handle) (comm_handle -> send_data)
#define hypre_CommHandleRecvData(comm_handle) (comm_handle -> recv_data)
#define hypre_CommHandleNumRequests(comm_handle) (comm_handle -> num_requests)
#define hypre_CommHandleRequests(comm_handle) (comm_handle -> requests)
#define hypre_CommHandleStatus(comm_handle) (comm_handle -> status)
#define hypre_CommHandleSendBuffers(comm_handle) (comm_handle -> send_buffers)
#define hypre_CommHandleRecvBuffers(comm_handle) (comm_handle -> recv_buffers)
#define hypre_CommHandleAction(comm_handle) (comm_handle -> action)
#endif
/******************************************************************************
*
* Header info for computation
*
*****************************************************************************/
#ifndef hypre_COMPUTATION_HEADER
#define hypre_COMPUTATION_HEADER
/*--------------------------------------------------------------------------
* hypre_ComputeInfo:
*--------------------------------------------------------------------------*/
typedef struct hypre_ComputeInfo_struct
{
hypre_CommInfo *comm_info;
hypre_BoxArrayArray *indt_boxes;
hypre_BoxArrayArray *dept_boxes;
hypre_Index stride;
} hypre_ComputeInfo;
/*--------------------------------------------------------------------------
* hypre_ComputePkg:
* Structure containing information for doing computations.
*--------------------------------------------------------------------------*/
typedef struct hypre_ComputePkg_struct
{
hypre_CommPkg *comm_pkg;
hypre_BoxArrayArray *indt_boxes;
hypre_BoxArrayArray *dept_boxes;
hypre_Index stride;
hypre_StructGrid *grid;
hypre_BoxArray *data_space;
int num_values;
} hypre_ComputePkg;
/*--------------------------------------------------------------------------
* Accessor macros: hypre_ComputeInfo
*--------------------------------------------------------------------------*/
#define hypre_ComputeInfoCommInfo(info) (info -> comm_info)
#define hypre_ComputeInfoIndtBoxes(info) (info -> indt_boxes)
#define hypre_ComputeInfoDeptBoxes(info) (info -> dept_boxes)
#define hypre_ComputeInfoStride(info) (info -> stride)
/*--------------------------------------------------------------------------
* Accessor macros: hypre_ComputePkg
*--------------------------------------------------------------------------*/
#define hypre_ComputePkgCommPkg(compute_pkg) (compute_pkg -> comm_pkg)
#define hypre_ComputePkgIndtBoxes(compute_pkg) (compute_pkg -> indt_boxes)
#define hypre_ComputePkgDeptBoxes(compute_pkg) (compute_pkg -> dept_boxes)
#define hypre_ComputePkgStride(compute_pkg) (compute_pkg -> stride)
#define hypre_ComputePkgGrid(compute_pkg) (compute_pkg -> grid)
#define hypre_ComputePkgDataSpace(compute_pkg) (compute_pkg -> data_space)
#define hypre_ComputePkgNumValues(compute_pkg) (compute_pkg -> num_values)
#endif
/******************************************************************************
*
* Header info for the hypre_StructMatrix structures
*
*****************************************************************************/
#ifndef hypre_STRUCT_MATRIX_HEADER
#define hypre_STRUCT_MATRIX_HEADER
#include <assert.h>
/*--------------------------------------------------------------------------
* hypre_StructMatrix:
*--------------------------------------------------------------------------*/
typedef struct hypre_StructMatrix_struct
{
MPI_Comm comm;
hypre_StructGrid *grid;
hypre_StructStencil *user_stencil;
hypre_StructStencil *stencil;
int num_values; /* Number of "stored" coefficients */
hypre_BoxArray *data_space;
double *data; /* Pointer to matrix data */
int data_alloced; /* Boolean used for freeing data */
int data_size; /* Size of matrix data */
int **data_indices; /* num-boxes by stencil-size array
of indices into the data array.
data_indices[b][s] is the starting
index of matrix data corresponding
to box b and stencil coefficient s */
int constant_coefficient; /* normally 0; set to 1 for
constant coefficient matrices
or 2 for constant coefficient
with variable diagonal */
int symmetric; /* Is the matrix symmetric */
int *symm_elements;/* Which elements are "symmetric" */
int num_ghost[6]; /* Num ghost layers in each direction */
int global_size; /* Total number of nonzero coeffs */
hypre_CommPkg *comm_pkg; /* Info on how to update ghost data */
int ref_count;
} hypre_StructMatrix;
/*--------------------------------------------------------------------------
* Accessor macros: hypre_StructMatrix
*--------------------------------------------------------------------------*/
#define hypre_StructMatrixComm(matrix) ((matrix) -> comm)
#define hypre_StructMatrixGrid(matrix) ((matrix) -> grid)
#define hypre_StructMatrixUserStencil(matrix) ((matrix) -> user_stencil)
#define hypre_StructMatrixStencil(matrix) ((matrix) -> stencil)
#define hypre_StructMatrixNumValues(matrix) ((matrix) -> num_values)
#define hypre_StructMatrixDataSpace(matrix) ((matrix) -> data_space)
#define hypre_StructMatrixData(matrix) ((matrix) -> data)
#define hypre_StructMatrixDataAlloced(matrix) ((matrix) -> data_alloced)
#define hypre_StructMatrixDataSize(matrix) ((matrix) -> data_size)
#define hypre_StructMatrixDataIndices(matrix) ((matrix) -> data_indices)
#define hypre_StructMatrixConstantCoefficient(matrix) ((matrix) -> constant_coefficient)
#define hypre_StructMatrixSymmetric(matrix) ((matrix) -> symmetric)
#define hypre_StructMatrixSymmElements(matrix) ((matrix) -> symm_elements)
#define hypre_StructMatrixNumGhost(matrix) ((matrix) -> num_ghost)
#define hypre_StructMatrixGlobalSize(matrix) ((matrix) -> global_size)
#define hypre_StructMatrixCommPkg(matrix) ((matrix) -> comm_pkg)
#define hypre_StructMatrixRefCount(matrix) ((matrix) -> ref_count)
#define hypre_StructMatrixBox(matrix, b) \
hypre_BoxArrayBox(hypre_StructMatrixDataSpace(matrix), b)
#define hypre_StructMatrixBoxData(matrix, b, s) \
(hypre_StructMatrixData(matrix) + hypre_StructMatrixDataIndices(matrix)[b][s])
#define hypre_StructMatrixBoxDataValue(matrix, b, s, index) \
(hypre_StructMatrixBoxData(matrix, b, s) + \
hypre_BoxIndexRank(hypre_StructMatrixBox(matrix, b), index))
#define hypre_CCStructMatrixBoxDataValue(matrix, b, s, index) \
(hypre_StructMatrixBoxData(matrix, b, s) + \
hypre_CCBoxIndexRank(hypre_StructMatrixBox(matrix, b), index))
#endif
/******************************************************************************
*
* Header info for the hypre_StructVector structures
*
*****************************************************************************/
#ifndef hypre_STRUCT_VECTOR_HEADER
#define hypre_STRUCT_VECTOR_HEADER
/*--------------------------------------------------------------------------
* hypre_StructVector:
*--------------------------------------------------------------------------*/
typedef struct hypre_StructVector_struct
{
MPI_Comm comm;
hypre_StructGrid *grid;
hypre_BoxArray *data_space;
double *data; /* Pointer to vector data */
int data_alloced; /* Boolean used for freeing data */
int data_size; /* Size of vector data */
int *data_indices; /* num-boxes array of indices into
the data array. data_indices[b]
is the starting index of vector
data corresponding to box b. */
int num_ghost[6]; /* Num ghost layers in each direction */
int global_size; /* Total number coefficients */
int ref_count;
} hypre_StructVector;
/*--------------------------------------------------------------------------
* Accessor macros: hypre_StructVector
*--------------------------------------------------------------------------*/
#define hypre_StructVectorComm(vector) ((vector) -> comm)
#define hypre_StructVectorGrid(vector) ((vector) -> grid)
#define hypre_StructVectorDataSpace(vector) ((vector) -> data_space)
#define hypre_StructVectorData(vector) ((vector) -> data)
#define hypre_StructVectorDataAlloced(vector) ((vector) -> data_alloced)
#define hypre_StructVectorDataSize(vector) ((vector) -> data_size)
#define hypre_StructVectorDataIndices(vector) ((vector) -> data_indices)
#define hypre_StructVectorNumGhost(vector) ((vector) -> num_ghost)
#define hypre_StructVectorGlobalSize(vector) ((vector) -> global_size)
#define hypre_StructVectorRefCount(vector) ((vector) -> ref_count)
#define hypre_StructVectorBox(vector, b) \
hypre_BoxArrayBox(hypre_StructVectorDataSpace(vector), b)
#define hypre_StructVectorBoxData(vector, b) \
(hypre_StructVectorData(vector) + hypre_StructVectorDataIndices(vector)[b])
#define hypre_StructVectorBoxDataValue(vector, b, index) \
(hypre_StructVectorBoxData(vector, b) + \
hypre_BoxIndexRank(hypre_StructVectorBox(vector, b), index))
#endif
/* assumed_part.c */
int hypre_APSubdivideRegion ( hypre_Box *region , int dim , int level , hypre_BoxArray *box_array , int *num_new_boxes );
int hypre_APFindMyBoxesInRegions ( hypre_BoxArray *region_array , hypre_BoxArray *my_box_array , int **p_count_array , double **p_vol_array );
int hypre_APGetAllBoxesInRegions ( hypre_BoxArray *region_array , hypre_BoxArray *my_box_array , int **p_count_array , double **p_vol_array , MPI_Comm comm );
int hypre_APShrinkRegions ( hypre_BoxArray *region_array , hypre_BoxArray *my_box_array , MPI_Comm comm );
int hypre_APPruneRegions ( hypre_BoxArray *region_array , int **p_count_array , double **p_vol_array );
int hypre_APRefineRegionsByVol ( hypre_BoxArray *region_array , double *vol_array , int max_regions , double gamma , int dim , int *return_code , MPI_Comm comm );
int hypre_StructAssumedPartitionCreate ( int dim , hypre_Box *bounding_box , double global_boxes_size , int global_num_boxes , hypre_BoxArray *local_boxes , int *local_boxnums , int max_regions , int max_refinements , double gamma , MPI_Comm comm , hypre_StructAssumedPart **p_assumed_partition );
int hypre_StructAssumedPartitionDestroy ( hypre_StructAssumedPart *assumed_part );
int hypre_APFillResponseStructAssumedPart ( void *p_recv_contact_buf , int contact_size , int contact_proc , void *ro , MPI_Comm comm , void **p_send_response_buf , int *response_message_size );
int hypre_StructAssumedPartitionGetRegionsFromProc ( hypre_StructAssumedPart *assumed_part , int proc_id , hypre_BoxArray *assumed_regions );
int hypre_StructAssumedPartitionGetProcsFromBox ( hypre_StructAssumedPart *assumed_part , hypre_Box *box , int *num_proc_array , int *size_alloc_proc_array , int **p_proc_array );
/* box_algebra.c */
int hypre_IntersectBoxes ( hypre_Box *box1 , hypre_Box *box2 , hypre_Box *ibox );
int hypre_SubtractBoxes ( hypre_Box *box1 , hypre_Box *box2 , hypre_BoxArray *box_array );
int hypre_SubtractBoxArrays ( hypre_BoxArray *box_array1 , hypre_BoxArray *box_array2 , hypre_BoxArray *tmp_box_array );
int hypre_SubtractBoxArraysExceptBoxes ( hypre_BoxArray *box_array1 , hypre_BoxArray *box_array2 , hypre_BoxArray *tmp_box_array , hypre_Box *boxa , hypre_Box *boxb );
int hypre_UnionBoxes ( hypre_BoxArray *boxes );
int hypre_MinUnionBoxes ( hypre_BoxArray *boxes );
/* box_alloc.c */
int hypre_BoxInitializeMemory ( const int at_a_time );
int hypre_BoxFinalizeMemory ( void );
hypre_Box *hypre_BoxAlloc ( void );
int hypre_BoxFree ( hypre_Box *box );
/* box_boundary.c */
int hypre_BoxArraySubtractAdjacentBoxArray ( hypre_BoxArray *boxes1 , hypre_BoxArray *boxes2 , hypre_Box *box , int thick );
int hypre_BoxArraySubtractAdjacentBoxArrayD ( hypre_BoxArray *boxes1 , hypre_BoxArray *boxes2 , hypre_Box *box , int ds , int thick );
int hypre_BoxBoundaryDNT ( hypre_Box *box , hypre_BoxArray *neighbor_boxes , hypre_BoxArray *boundary , int ds , int thick );
int hypre_BoxBoundaryNT ( hypre_Box *box , hypre_BoxArray *neighbor_boxes , hypre_BoxArray *boundary , int *thickness );
int hypre_BoxBoundaryG ( hypre_Box *box , hypre_StructGrid *g , hypre_BoxArray *boundary );
int hypre_BoxBoundaryDG ( hypre_Box *box , hypre_StructGrid *g , hypre_BoxArray *boundarym , hypre_BoxArray *boundaryp , int d );
/* box.c */
hypre_Box *hypre_BoxCreate ( void );
int hypre_BoxSetExtents ( hypre_Box *box , hypre_Index imin , hypre_Index imax );
hypre_BoxArray *hypre_BoxArrayCreate ( int size );
int hypre_BoxArraySetSize ( hypre_BoxArray *box_array , int size );
hypre_BoxArrayArray *hypre_BoxArrayArrayCreate ( int size );
int hypre_BoxDestroy ( hypre_Box *box );
int hypre_BoxArrayDestroy ( hypre_BoxArray *box_array );
int hypre_BoxArrayArrayDestroy ( hypre_BoxArrayArray *box_array_array );
hypre_Box *hypre_BoxDuplicate ( hypre_Box *box );
hypre_BoxArray *hypre_BoxArrayDuplicate ( hypre_BoxArray *box_array );
hypre_BoxArrayArray *hypre_BoxArrayArrayDuplicate ( hypre_BoxArrayArray *box_array_array );
int hypre_AppendBox ( hypre_Box *box , hypre_BoxArray *box_array );
int hypre_DeleteBox ( hypre_BoxArray *box_array , int index );
int hypre_AppendBoxArray ( hypre_BoxArray *box_array_0 , hypre_BoxArray *box_array_1 );
int hypre_BoxGetSize ( hypre_Box *box , hypre_Index size );
int hypre_BoxGetStrideSize ( hypre_Box *box , hypre_Index stride , hypre_Index size );
int hypre_BoxGetStrideVolume ( hypre_Box *box , hypre_Index stride , int *volume_ptr );
int hypre_BoxExpand ( hypre_Box *box , int *numexp );
int hypre_DeleteMultipleBoxes ( hypre_BoxArray *box_array , int *indices , int num );
int hypre_MaxIndexPosition ( hypre_Index index , int *position );
int hypre_MinIndexPosition ( hypre_Index index , int *position );
int hypre_BoxExpandConstant ( hypre_Box *box , int expand );
int hypre_BoxExpandConstantDim ( hypre_Box *box , int *expand );
/* box_manager.c */
int hypre_BoxManEntrySetInfo ( hypre_BoxManEntry *entry , void *info );
int hypre_BoxManEntryGetInfo ( hypre_BoxManEntry *entry , void **info_ptr );
int hypre_BoxManEntryGetExtents ( hypre_BoxManEntry *entry , hypre_Index imin , hypre_Index imax );
int hypre_BoxManEntryCopy ( hypre_BoxManEntry *fromentry , hypre_BoxManEntry *toentry );
int hypre_BoxManSetAllGlobalKnown ( hypre_BoxManager *manager , int known );
int hypre_BoxManGetAllGlobalKnown ( hypre_BoxManager *manager , int *known );
int hypre_BoxManSetIsEntriesSort ( hypre_BoxManager *manager , int is_sort );
int hypre_BoxManGetIsEntriesSort ( hypre_BoxManager *manager , int *is_sort );
int hypre_BoxManGetAssumedPartition ( hypre_BoxManager *manager , hypre_StructAssumedPart **assumed_partition );
int hypre_BoxManSetAssumedPartition ( hypre_BoxManager *manager , hypre_StructAssumedPart *assumed_partition );
int hypre_BoxManDeleteMultipleEntries ( hypre_BoxManager *manager , int *indices , int num );
int hypre_BoxManCreate ( int max_nentries , int info_size , int dim , hypre_Box *bounding_box , MPI_Comm comm , hypre_BoxManager **manager_ptr );
int hypre_BoxManIncSize ( hypre_BoxManager *manager , int inc_size );
int hypre_BoxManDestroy ( hypre_BoxManager *manager );
int hypre_BoxManAddEntry ( hypre_BoxManager *manager , hypre_Index imin , hypre_Index imax , int proc_id , int box_id , void *info );
int hypre_BoxManGetEntry ( hypre_BoxManager *manager , int proc , int id , hypre_BoxManEntry **entry_ptr );
int hypre_BoxManGetAllEntries ( hypre_BoxManager *manager , int *num_entries , hypre_BoxManEntry **entries );
int hypre_BoxManGetAllEntriesBoxes ( hypre_BoxManager *manager , hypre_BoxArray *boxes );
int hypre_BoxManGetAllEntriesBoxesProc ( hypre_BoxManager *manager , hypre_BoxArray *boxes , int *procs );
int hypre_BoxManGatherEntries ( hypre_BoxManager *manager , hypre_Index imin , hypre_Index imax );
int hypre_BoxManAssemble ( hypre_BoxManager *manager );
int hypre_BoxManIntersect ( hypre_BoxManager *manager , hypre_Index ilower , hypre_Index iupper , hypre_BoxManEntry ***entries_ptr , int *nentries_ptr );
int hypre_BoxManSetNumGhost ( hypre_BoxManager *manager , int *num_ghost );
int hypre_FillResponseBoxManAssemble1 ( void *p_recv_contact_buf , int contact_size , int contact_proc , void *ro , MPI_Comm comm , void **p_send_response_buf , int *response_message_size );
int hypre_FillResponseBoxManAssemble2 ( void *p_recv_contact_buf , int contact_size , int contact_proc , void *ro , MPI_Comm comm , void **p_send_response_buf , int *response_message_size );
void hypre_entryqsort2 ( int *v , hypre_BoxManEntry **ent , int left , int right );
void hypre_entryswap2 ( int *v , hypre_BoxManEntry **ent , int i , int j );
/* communication_info.c */
int hypre_CommInfoCreate ( hypre_BoxArrayArray *send_boxes , hypre_BoxArrayArray *recv_boxes , int **send_procs , int **recv_procs , int **send_rboxnums , int **recv_rboxnums , hypre_BoxArrayArray *send_rboxes , hypre_BoxArrayArray *recv_rboxes , int boxes_match , hypre_CommInfo **comm_info_ptr );
int hypre_CommInfoSetTransforms ( hypre_CommInfo *comm_info , int num_transforms , hypre_Index *coords , hypre_Index *dirs , int **send_transforms , int **recv_transforms );
int hypre_CommInfoGetTransforms ( hypre_CommInfo *comm_info , int *num_transforms , hypre_Index **coords , hypre_Index **dirs );
int hypre_CommInfoProjectSend ( hypre_CommInfo *comm_info , hypre_Index index , hypre_Index stride );
int hypre_CommInfoProjectRecv ( hypre_CommInfo *comm_info , hypre_Index index , hypre_Index stride );
int hypre_CommInfoDestroy ( hypre_CommInfo *comm_info );
int hypre_CreateCommInfoFromStencil ( hypre_StructGrid *grid , hypre_StructStencil *stencil , hypre_CommInfo **comm_info_ptr );
int hypre_CreateCommInfoFromNumGhost ( hypre_StructGrid *grid , int *num_ghost , hypre_CommInfo **comm_info_ptr );
int hypre_CreateCommInfoFromGrids ( hypre_StructGrid *from_grid , hypre_StructGrid *to_grid , hypre_CommInfo **comm_info_ptr );
/* computation.c */
int hypre_ComputeInfoCreate ( hypre_CommInfo *comm_info , hypre_BoxArrayArray *indt_boxes , hypre_BoxArrayArray *dept_boxes , hypre_ComputeInfo **compute_info_ptr );
int hypre_ComputeInfoProjectSend ( hypre_ComputeInfo *compute_info , hypre_Index index , hypre_Index stride );
int hypre_ComputeInfoProjectRecv ( hypre_ComputeInfo *compute_info , hypre_Index index , hypre_Index stride );
int hypre_ComputeInfoProjectComp ( hypre_ComputeInfo *compute_info , hypre_Index index , hypre_Index stride );
int hypre_ComputeInfoDestroy ( hypre_ComputeInfo *compute_info );
int hypre_CreateComputeInfo ( hypre_StructGrid *grid , hypre_StructStencil *stencil , hypre_ComputeInfo **compute_info_ptr );
int hypre_ComputePkgCreate ( hypre_ComputeInfo *compute_info , hypre_BoxArray *data_space , int num_values , hypre_StructGrid *grid , hypre_ComputePkg **compute_pkg_ptr );
int hypre_ComputePkgDestroy ( hypre_ComputePkg *compute_pkg );
int hypre_InitializeIndtComputations ( hypre_ComputePkg *compute_pkg , double *data , hypre_CommHandle **comm_handle_ptr );
int hypre_FinalizeIndtComputations ( hypre_CommHandle *comm_handle );
/* grow.c */
hypre_BoxArray *hypre_GrowBoxByStencil ( hypre_Box *box , hypre_StructStencil *stencil , int transpose );
hypre_BoxArrayArray *hypre_GrowBoxArrayByStencil ( hypre_BoxArray *box_array , hypre_StructStencil *stencil , int transpose );
/* HYPRE_struct_grid.c */
int HYPRE_StructGridCreate ( MPI_Comm comm , int dim , HYPRE_StructGrid *grid );
int HYPRE_StructGridDestroy ( HYPRE_StructGrid grid );
int HYPRE_StructGridSetExtents ( HYPRE_StructGrid grid , int *ilower , int *iupper );
int HYPRE_StructGridSetPeriodic ( HYPRE_StructGrid grid , int *periodic );
int HYPRE_StructGridAssemble ( HYPRE_StructGrid grid );
int HYPRE_StructGridSetNumGhost ( HYPRE_StructGrid grid , int *num_ghost );
/* HYPRE_struct_matrix.c */
int HYPRE_StructMatrixCreate ( MPI_Comm comm , HYPRE_StructGrid grid , HYPRE_StructStencil stencil , HYPRE_StructMatrix *matrix );
int HYPRE_StructMatrixDestroy ( HYPRE_StructMatrix matrix );
int HYPRE_StructMatrixInitialize ( HYPRE_StructMatrix matrix );
int HYPRE_StructMatrixSetValues ( HYPRE_StructMatrix matrix , int *grid_index , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixGetValues ( HYPRE_StructMatrix matrix , int *grid_index , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixSetBoxValues ( HYPRE_StructMatrix matrix , int *ilower , int *iupper , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixGetBoxValues ( HYPRE_StructMatrix matrix , int *ilower , int *iupper , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixSetConstantValues ( HYPRE_StructMatrix matrix , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixAddToValues ( HYPRE_StructMatrix matrix , int *grid_index , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixAddToBoxValues ( HYPRE_StructMatrix matrix , int *ilower , int *iupper , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixAddToConstantValues ( HYPRE_StructMatrix matrix , int num_stencil_indices , int *stencil_indices , double *values );
int HYPRE_StructMatrixAssemble ( HYPRE_StructMatrix matrix );
int HYPRE_StructMatrixSetNumGhost ( HYPRE_StructMatrix matrix , int *num_ghost );
int HYPRE_StructMatrixGetGrid ( HYPRE_StructMatrix matrix , HYPRE_StructGrid *grid );
int HYPRE_StructMatrixSetSymmetric ( HYPRE_StructMatrix matrix , int symmetric );
int HYPRE_StructMatrixSetConstantEntries ( HYPRE_StructMatrix matrix , int nentries , int *entries );
int HYPRE_StructMatrixPrint ( const char *filename , HYPRE_StructMatrix matrix , int all );
int HYPRE_StructMatrixMatvec ( double alpha , HYPRE_StructMatrix A , HYPRE_StructVector x , double beta , HYPRE_StructVector y );
/* HYPRE_struct_stencil.c */
int HYPRE_StructStencilCreate ( int dim , int size , HYPRE_StructStencil *stencil );
int HYPRE_StructStencilSetElement ( HYPRE_StructStencil stencil , int element_index , int *offset );
int HYPRE_StructStencilDestroy ( HYPRE_StructStencil stencil );
/* HYPRE_struct_vector.c */
int HYPRE_StructVectorCreate ( MPI_Comm comm , HYPRE_StructGrid grid , HYPRE_StructVector *vector );
int HYPRE_StructVectorDestroy ( HYPRE_StructVector struct_vector );
int HYPRE_StructVectorInitialize ( HYPRE_StructVector vector );
int HYPRE_StructVectorSetValues ( HYPRE_StructVector vector , int *grid_index , double values );
int HYPRE_StructVectorSetBoxValues ( HYPRE_StructVector vector , int *ilower , int *iupper , double *values );
int HYPRE_StructVectorAddToValues ( HYPRE_StructVector vector , int *grid_index , double values );
int HYPRE_StructVectorAddToBoxValues ( HYPRE_StructVector vector , int *ilower , int *iupper , double *values );
int HYPRE_StructVectorScaleValues ( HYPRE_StructVector vector , double factor );
int HYPRE_StructVectorGetValues ( HYPRE_StructVector vector , int *grid_index , double *values );
int HYPRE_StructVectorGetBoxValues ( HYPRE_StructVector vector , int *ilower , int *iupper , double *values );
int HYPRE_StructVectorAssemble ( HYPRE_StructVector vector );
int HYPRE_StructVectorPrint ( const char *filename , HYPRE_StructVector vector , int all );
int HYPRE_StructVectorSetNumGhost ( HYPRE_StructVector vector , int *num_ghost );
int HYPRE_StructVectorCopy ( HYPRE_StructVector x , HYPRE_StructVector y );
int HYPRE_StructVectorSetConstantValues ( HYPRE_StructVector vector , double values );
int HYPRE_StructVectorGetMigrateCommPkg ( HYPRE_StructVector from_vector , HYPRE_StructVector to_vector , HYPRE_CommPkg *comm_pkg );
int HYPRE_StructVectorMigrate ( HYPRE_CommPkg comm_pkg , HYPRE_StructVector from_vector , HYPRE_StructVector to_vector );
int HYPRE_CommPkgDestroy ( HYPRE_CommPkg comm_pkg );
/* project.c */
int hypre_ProjectBox ( hypre_Box *box , hypre_Index index , hypre_Index stride );
int hypre_ProjectBoxArray ( hypre_BoxArray *box_array , hypre_Index index , hypre_Index stride );
int hypre_ProjectBoxArrayArray ( hypre_BoxArrayArray *box_array_array , hypre_Index index , hypre_Index stride );
/* struct_axpy.c */
int hypre_StructAxpy ( double alpha , hypre_StructVector *x , hypre_StructVector *y );
/* struct_communication.c */
int hypre_CommPkgCreate ( hypre_CommInfo *comm_info , hypre_BoxArray *send_data_space , hypre_BoxArray *recv_data_space , int num_values , int **orders , int reverse , MPI_Comm comm , hypre_CommPkg **comm_pkg_ptr );
int hypre_CommTypeSetEntries ( hypre_CommType *comm_type , int *boxnums , hypre_Box *boxes , hypre_Index stride , hypre_Index coord , hypre_Index dir , int *order , hypre_BoxArray *data_space , int *data_offsets );
int hypre_CommTypeSetEntry ( hypre_Box *box , hypre_Index stride , hypre_Index coord , hypre_Index dir , int *order , hypre_Box *data_box , int data_box_offset , hypre_CommEntryType *comm_entry );
int hypre_InitializeCommunication ( hypre_CommPkg *comm_pkg , double *send_data , double *recv_data , int action , int tag , hypre_CommHandle **comm_handle_ptr );
int hypre_FinalizeCommunication ( hypre_CommHandle *comm_handle );
int hypre_ExchangeLocalData ( hypre_CommPkg *comm_pkg , double *send_data , double *recv_data , int action );
int hypre_CommPkgDestroy ( hypre_CommPkg *comm_pkg );
/* struct_copy.c */
int hypre_StructCopy ( hypre_StructVector *x , hypre_StructVector *y );
int hypre_StructPartialCopy ( hypre_StructVector *x , hypre_StructVector *y , hypre_BoxArrayArray *array_boxes );
/* struct_grid.c */
int hypre_StructGridCreate ( MPI_Comm comm , int dim , hypre_StructGrid **grid_ptr );
int hypre_StructGridRef ( hypre_StructGrid *grid , hypre_StructGrid **grid_ref );
int hypre_StructGridDestroy ( hypre_StructGrid *grid );
int hypre_StructGridSetPeriodic ( hypre_StructGrid *grid , hypre_Index periodic );
int hypre_StructGridSetExtents ( hypre_StructGrid *grid , hypre_Index ilower , hypre_Index iupper );
int hypre_StructGridSetBoxes ( hypre_StructGrid *grid , hypre_BoxArray *boxes );
int hypre_StructGridSetBoundingBox ( hypre_StructGrid *grid , hypre_Box *new_bb );
int hypre_StructGridSetIDs ( hypre_StructGrid *grid , int *ids );
int hypre_StructGridSetBoxManager ( hypre_StructGrid *grid , hypre_BoxManager *boxman );
int hypre_StructGridSetMaxDistance ( hypre_StructGrid *grid , hypre_Index dist );
int hypre_StructGridAssemble ( hypre_StructGrid *grid );
int hypre_GatherAllBoxes ( MPI_Comm comm , hypre_BoxArray *boxes , hypre_BoxArray **all_boxes_ptr , int **all_procs_ptr , int *first_local_ptr );
int hypre_ComputeBoxnums ( hypre_BoxArray *boxes , int *procs , int **boxnums_ptr );
int hypre_StructGridPrint ( FILE *file , hypre_StructGrid *grid );
int hypre_StructGridRead ( MPI_Comm comm , FILE *file , hypre_StructGrid **grid_ptr );
int hypre_StructGridSetNumGhost ( hypre_StructGrid *grid , int *num_ghost );
/* struct_innerprod.c */
double hypre_StructInnerProd ( hypre_StructVector *x , hypre_StructVector *y );
/* struct_io.c */
int hypre_PrintBoxArrayData ( FILE *file , hypre_BoxArray *box_array , hypre_BoxArray *data_space , int num_values , double *data );
int hypre_PrintCCVDBoxArrayData ( FILE *file , hypre_BoxArray *box_array , hypre_BoxArray *data_space , int num_values , int center_rank , int stencil_size , int *symm_elements , double *data );
int hypre_PrintCCBoxArrayData ( FILE *file , hypre_BoxArray *box_array , hypre_BoxArray *data_space , int num_values , double *data );
int hypre_ReadBoxArrayData ( FILE *file , hypre_BoxArray *box_array , hypre_BoxArray *data_space , int num_values , double *data );
int hypre_ReadBoxArrayData_CC ( FILE *file , hypre_BoxArray *box_array , hypre_BoxArray *data_space , int stencil_size , int real_stencil_size , int constant_coefficient , double *data );
/* struct_matrix.c */
double *hypre_StructMatrixExtractPointerByIndex ( hypre_StructMatrix *matrix , int b , hypre_Index index );
hypre_StructMatrix *hypre_StructMatrixCreate ( MPI_Comm comm , hypre_StructGrid *grid , hypre_StructStencil *user_stencil );
hypre_StructMatrix *hypre_StructMatrixRef ( hypre_StructMatrix *matrix );
int hypre_StructMatrixDestroy ( hypre_StructMatrix *matrix );
int hypre_StructMatrixInitializeShell ( hypre_StructMatrix *matrix );
int hypre_StructMatrixInitializeData ( hypre_StructMatrix *matrix , double *data );
int hypre_StructMatrixInitialize ( hypre_StructMatrix *matrix );
int hypre_StructMatrixSetValues ( hypre_StructMatrix *matrix , hypre_Index grid_index , int num_stencil_indices , int *stencil_indices , double *values , int action , int boxnum , int outside );
int hypre_StructMatrixSetBoxValues ( hypre_StructMatrix *matrix , hypre_Box *set_box , hypre_Box *value_box , int num_stencil_indices , int *stencil_indices , double *values , int action , int boxnum , int outside );
int hypre_StructMatrixSetConstantValues ( hypre_StructMatrix *matrix , int num_stencil_indices , int *stencil_indices , double *values , int action );
int hypre_StructMatrixClearValues ( hypre_StructMatrix *matrix , hypre_Index grid_index , int num_stencil_indices , int *stencil_indices , int boxnum , int outside );
int hypre_StructMatrixClearBoxValues ( hypre_StructMatrix *matrix , hypre_Box *clear_box , int num_stencil_indices , int *stencil_indices , int boxnum , int outside );
int hypre_StructMatrixAssemble ( hypre_StructMatrix *matrix );
int hypre_StructMatrixSetNumGhost ( hypre_StructMatrix *matrix , int *num_ghost );
int hypre_StructMatrixSetConstantCoefficient ( hypre_StructMatrix *matrix , int constant_coefficient );
int hypre_StructMatrixSetConstantEntries ( hypre_StructMatrix *matrix , int nentries , int *entries );
int hypre_StructMatrixClearGhostValues ( hypre_StructMatrix *matrix );
int hypre_StructMatrixPrint ( const char *filename , hypre_StructMatrix *matrix , int all );
int hypre_StructMatrixMigrate ( hypre_StructMatrix *from_matrix , hypre_StructMatrix *to_matrix );
hypre_StructMatrix *hypre_StructMatrixRead ( MPI_Comm comm , const char *filename , int *num_ghost );
/* struct_matrix_mask.c */
hypre_StructMatrix *hypre_StructMatrixCreateMask ( hypre_StructMatrix *matrix , int num_stencil_indices , int *stencil_indices );
/* struct_matvec.c */
void *hypre_StructMatvecCreate ( void );
int hypre_StructMatvecSetup ( void *matvec_vdata , hypre_StructMatrix *A , hypre_StructVector *x );
int hypre_StructMatvecCompute ( void *matvec_vdata , double alpha , hypre_StructMatrix *A , hypre_StructVector *x , double beta , hypre_StructVector *y );
int hypre_StructMatvecCC0 ( double alpha , hypre_StructMatrix *A , hypre_StructVector *x , hypre_StructVector *y , hypre_BoxArrayArray *compute_box_aa , hypre_IndexRef stride );
int hypre_StructMatvecCC1 ( double alpha , hypre_StructMatrix *A , hypre_StructVector *x , hypre_StructVector *y , hypre_BoxArrayArray *compute_box_aa , hypre_IndexRef stride );
int hypre_StructMatvecCC2 ( double alpha , hypre_StructMatrix *A , hypre_StructVector *x , hypre_StructVector *y , hypre_BoxArrayArray *compute_box_aa , hypre_IndexRef stride );
int hypre_StructMatvecDestroy ( void *matvec_vdata );
int hypre_StructMatvec ( double alpha , hypre_StructMatrix *A , hypre_StructVector *x , double beta , hypre_StructVector *y );
/* struct_overlap_innerprod.c */
double hypre_StructOverlapInnerProd ( hypre_StructVector *x , hypre_StructVector *y );
/* struct_scale.c */
int hypre_StructScale ( double alpha , hypre_StructVector *y );
/* struct_stencil.c */
hypre_StructStencil *hypre_StructStencilCreate ( int dim , int size , hypre_Index *shape );
hypre_StructStencil *hypre_StructStencilRef ( hypre_StructStencil *stencil );
int hypre_StructStencilDestroy ( hypre_StructStencil *stencil );
int hypre_StructStencilElementRank ( hypre_StructStencil *stencil , hypre_Index stencil_element );
int hypre_StructStencilSymmetrize ( hypre_StructStencil *stencil , hypre_StructStencil **symm_stencil_ptr , int **symm_elements_ptr );
/* struct_vector.c */
hypre_StructVector *hypre_StructVectorCreate ( MPI_Comm comm , hypre_StructGrid *grid );
hypre_StructVector *hypre_StructVectorRef ( hypre_StructVector *vector );
int hypre_StructVectorDestroy ( hypre_StructVector *vector );
int hypre_StructVectorInitializeShell ( hypre_StructVector *vector );
int hypre_StructVectorInitializeData ( hypre_StructVector *vector , double *data );
int hypre_StructVectorInitialize ( hypre_StructVector *vector );
int hypre_StructVectorSetValues ( hypre_StructVector *vector , hypre_Index grid_index , double *values , int action , int boxnum , int outside );
int hypre_StructVectorSetBoxValues ( hypre_StructVector *vector , hypre_Box *set_box , hypre_Box *value_box , double *values , int action , int boxnum , int outside );
int hypre_StructVectorClearValues ( hypre_StructVector *vector , hypre_Index grid_index , int boxnum , int outside );
int hypre_StructVectorClearBoxValues ( hypre_StructVector *vector , hypre_Box *clear_box , int boxnum , int outside );
int hypre_StructVectorSetNumGhost ( hypre_StructVector *vector , int *num_ghost );
int hypre_StructVectorAssemble ( hypre_StructVector *vector );
int hypre_StructVectorCopy ( hypre_StructVector *x , hypre_StructVector *y );
int hypre_StructVectorSetConstantValues ( hypre_StructVector *vector , double values );
int hypre_StructVectorSetFunctionValues ( hypre_StructVector *vector , double (*fcn )());
int hypre_StructVectorClearGhostValues ( hypre_StructVector *vector );
int hypre_StructVectorClearBoundGhostValues ( hypre_StructVector *vector );
int hypre_StructVectorScaleValues ( hypre_StructVector *vector , double factor );
int hypre_StructVectorClearAllValues ( hypre_StructVector *vector );
hypre_CommPkg *hypre_StructVectorGetMigrateCommPkg ( hypre_StructVector *from_vector , hypre_StructVector *to_vector );
int hypre_StructVectorMigrate ( hypre_CommPkg *comm_pkg , hypre_StructVector *from_vector , hypre_StructVector *to_vector );
int hypre_StructVectorPrint ( const char *filename , hypre_StructVector *vector , int all );
hypre_StructVector *hypre_StructVectorRead ( MPI_Comm comm , const char *filename , int *num_ghost );
int hypre_StructVectorMaxValue ( hypre_StructVector *vector , double *max_value , int *max_index , hypre_Index max_xyz_index );
#ifdef __cplusplus
}
#endif
#endif
|