/usr/include/deal.II/lac/trilinos_sparsity_pattern.h is in libdeal.ii-dev 6.3.1-1.1.
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 | //---------------------------------------------------------------------------
// $Id: trilinos_sparsity_pattern.h 21128 2010-05-14 13:34:33Z kronbichler $
// Version: $Name$
//
// Copyright (C) 2008, 2009, 2010 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
//---------------------------------------------------------------------------
#ifndef __deal2__trilinos_sparsity_pattern_h
#define __deal2__trilinos_sparsity_pattern_h
#include <base/config.h>
#ifdef DEAL_II_USE_TRILINOS
# include <base/subscriptor.h>
# include <base/index_set.h>
# include <lac/exceptions.h>
# include <vector>
# include <cmath>
# include <memory>
# include <base/std_cxx1x/shared_ptr.h>
# include <boost/scoped_ptr.hpp>
# include <Epetra_FECrsGraph.h>
# include <Epetra_Map.h>
# ifdef DEAL_II_COMPILER_SUPPORTS_MPI
# include <Epetra_MpiComm.h>
# include "mpi.h"
# else
# include "Epetra_SerialComm.h"
# endif
DEAL_II_NAMESPACE_OPEN
// forward declarations
class SparsityPattern;
class CompressedSparsityPattern;
class CompressedSetSparsityPattern;
class CompressedSimpleSparsityPattern;
namespace TrilinosWrappers
{
// forward declarations
class SparsityPattern;
namespace SparsityPatternIterators
{
/**
* STL conforming iterator. This class acts as an iterator walking
* over the elements of Trilinos sparsity pattern.
*
* @ingroup TrilinosWrappers
* @author Martin Kronbichler, Wolfgang Bangerth, 2008
*/
class const_iterator
{
private:
/**
* Accessor class for iterators
*/
class Accessor
{
public:
/**
* Constructor. Since we use
* accessors only for read
* access, a const matrix
* pointer is sufficient.
*/
Accessor (const SparsityPattern *sparsity_pattern,
const unsigned int row,
const unsigned int index);
/**
* Row number of the element
* represented by this object.
*/
unsigned int row() const;
/**
* Index in row of the element
* represented by this object.
*/
unsigned int index() const;
/**
* Column number of the element
* represented by this object.
*/
unsigned int column() const;
/**
* Exception
*/
DeclException0 (ExcBeyondEndOfSparsityPattern);
/**
* Exception
*/
DeclException3 (ExcAccessToNonlocalRow,
int, int, int,
<< "You tried to access row " << arg1
<< " of a distributed sparsity pattern, "
<< " but only rows " << arg2 << " through " << arg3
<< " are stored locally and can be accessed.");
private:
/**
* The matrix accessed.
*/
mutable SparsityPattern *sparsity_pattern;
/**
* Current row number.
*/
unsigned int a_row;
/**
* Current index in row.
*/
unsigned int a_index;
/**
* Cache where we store the
* column indices of the
* present row. This is
* necessary, since Trilinos
* makes access to the elements
* of its matrices rather hard,
* and it is much more
* efficient to copy all column
* entries of a row once when
* we enter it than repeatedly
* asking Trilinos for
* individual ones. This also
* makes some sense since it is
* likely that we will access
* them sequentially anyway.
*
* In order to make copying of
* iterators/accessor of
* acceptable performance, we
* keep a shared pointer to
* these entries so that more
* than one accessor can access
* this data if necessary.
*/
std_cxx1x::shared_ptr<const std::vector<unsigned int> > colnum_cache;
/**
* Discard the old row caches
* (they may still be used by
* other accessors) and
* generate new ones for the
* row pointed to presently by
* this accessor.
*/
void visit_present_row ();
/**
* Make enclosing class a
* friend.
*/
friend class const_iterator;
};
public:
/**
* Constructor. Create an
* iterator into the matrix @p
* matrix for the given row and
* the index within it.
*/
const_iterator (const SparsityPattern *sparsity_pattern,
const unsigned int row,
const unsigned int index);
/**
* Prefix increment.
*/
const_iterator& operator++ ();
/**
* Postfix increment.
*/
const_iterator operator++ (int);
/**
* Dereferencing operator.
*/
const Accessor& operator* () const;
/**
* Dereferencing operator.
*/
const Accessor* operator-> () const;
/**
* Comparison. True, if both
* iterators point to the same
* matrix position.
*/
bool operator == (const const_iterator&) const;
/**
* Inverse of <tt>==</tt>.
*/
bool operator != (const const_iterator&) const;
/**
* Comparison operator. Result
* is true if either the first
* row number is smaller or if
* the row numbers are equal
* and the first index is
* smaller.
*/
bool operator < (const const_iterator&) const;
/**
* Exception
*/
DeclException2 (ExcInvalidIndexWithinRow,
int, int,
<< "Attempt to access element " << arg2
<< " of row " << arg1
<< " which doesn't have that many elements.");
private:
/**
* Store an object of the
* accessor class.
*/
Accessor accessor;
friend class TrilinosWrappers::SparsityPattern;
};
}
/**
* This class implements a wrapper class to use the Trilinos distributed
* sparsity pattern class Epetra_FECrsGraph. This class is designed to be
* used for construction of %parallel Trilinos matrices. The functionality of
* this class is modeled after the existing sparsity pattern classes, with
* the difference that this class can work fully in %parallel according to a
* partitioning of the sparsity pattern rows.
*
* This class has many similarities to the compressed sparsity pattern
* classes of deal.II (i.e., the classes CompressedSparsityPattern,
* CompressedSetSparsityPattern, and CompressedSimpleSparsityPattern), since
* it can dynamically add elements to the pattern without any memory being
* previously reserved for it. However, it also has a method
* SparsityPattern::compress(), that finalizes the pattern and enables its
* use with Trilinos sparse matrices.
*
* @ingroup TrilinosWrappers
* @ingroup Sparsity
* @author Martin Kronbichler, 2008
*/
class SparsityPattern : public Subscriptor
{
public:
/**
* Declare a typedef for the
* iterator class.
*/
typedef SparsityPatternIterators::const_iterator const_iterator;
/**
* @name Basic constructors and initalization.
*/
//@{
/**
* Default constructor. Generates an
* empty (zero-size) sparsity
* pattern.
*/
SparsityPattern ();
/**
* Generate a sparsity pattern that is
* completely stored locally, having
* $m$ rows and $n$ columns. The
* resulting matrix will be completely
* stored locally, too.
*
* It is possible to specify the
* number of columns entries per row
* using the optional @p
* n_entries_per_row
* argument. However, this value does
* not need to be accurate or even
* given at all, since one does
* usually not have this kind of
* information before building the
* sparsity pattern (the usual case
* when the function
* DoFTools::make_sparsity_pattern()
* is called). The entries are
* allocated dynamically in a similar
* manner as for the deal.II
* CompressedSparsityPattern
* classes. However, a good estimate
* will reduce the setup time of the
* sparsity pattern.
*/
SparsityPattern (const unsigned int m,
const unsigned int n,
const unsigned int n_entries_per_row = 0);
/**
* Generate a sparsity pattern that is
* completely stored locally, having
* $m$ rows and $n$ columns. The
* resulting matrix will be completely
* stored locally, too.
*
* The vector
* <tt>n_entries_per_row</tt>
* specifies the number of entries in
* each row (an information usually
* not available, though).
*/
SparsityPattern (const unsigned int m,
const unsigned int n,
const std::vector<unsigned int> &n_entries_per_row);
/**
* Copy constructor. Sets the calling
* sparsity pattern to be the same as
* the input sparsity pattern.
*/
SparsityPattern (const SparsityPattern &input_sparsity_pattern);
/**
* Destructor. Made virtual so that
* one can use pointers to this
* class.
*/
virtual ~SparsityPattern ();
/**
* Initialize a sparsity pattern that
* is completely stored locally,
* having $m$ rows and $n$
* columns. The resulting matrix will
* be completely stored locally.
*
* The number of columns entries per
* row is specified as the maximum
* number of entries argument. This
* does not need to be an accurate
* number since the entries are
* allocated dynamically in a similar
* manner as for the deal.II
* CompressedSparsityPattern classes,
* but a good estimate will reduce
* the setup time of the sparsity
* pattern.
*/
void
reinit (const unsigned int m,
const unsigned int n,
const unsigned int n_entries_per_row = 0);
/**
* Initialize a sparsity pattern that
* is completely stored locally,
* having $m$ rows and $n$ columns. The
* resulting matrix will be
* completely stored locally.
*
* The vector
* <tt>n_entries_per_row</tt>
* specifies the number of entries in
* each row.
*/
void
reinit (const unsigned int m,
const unsigned int n,
const std::vector<unsigned int> &n_entries_per_row);
/**
* Copy function. Sets the calling
* sparsity pattern to be the same as
* the input sparsity pattern.
*/
void
copy_from (const SparsityPattern &input_sparsity_pattern);
/**
* Copy function from one of the
* deal.II sparsity patterns. If used
* in parallel, this function uses an
* ad-hoc partitioning of the rows
* and columns.
*/
template<typename SparsityType>
void
copy_from (const SparsityType &nontrilinos_sparsity_pattern);
/**
* Copy operator. This operation is
* only allowed for empty objects, to
* avoid potentially very costly
* operations automatically
* synthesized by the compiler. Use
* copy_from() instead if you know
* that you really want to copy a
* sparsity pattern with non-trivial
* content.
*/
SparsityPattern & operator = (const SparsityPattern &input_sparsity_pattern);
/**
* Release all memory and return to a
* state just like after having
* called the default constructor.
*
* This is a collective operation
* that needs to be called on all
* processors in order to avoid a
* dead lock.
*/
void clear ();
/**
* In analogy to our own
* SparsityPattern class, this
* function compresses the sparsity
* pattern and allows the resulting
* pattern to be used for actually
* generating a (Trilinos-based)
* matrix. This function also
* exchanges non-local data that
* might have accumulated during the
* addition of new elements. This
* function must therefore be called
* once the structure is fixed. This
* is a collective operation, i.e.,
* it needs to be run on all
* processors when used in parallel.
*/
void compress ();
//@}
/**
* @name Constructors and initialization using an Epetra_Map description
*/
//@{
/**
* Constructor for a square sparsity
* pattern using an Epetra_map for
* the description of the %parallel
* partitioning. Moreover, the number
* of nonzero entries in the rows of
* the sparsity pattern can be
* specified. Note that this number
* does not need to be exact, and it
* is allowed that the actual
* sparsity structure has more
* nonzero entries than specified in
* the constructor (the usual case
* when the function
* DoFTools::make_sparsity_pattern()
* is called). However it is still
* advantageous to provide good
* estimates here since a good value
* will avoid repeated allocation of
* memory, which considerably
* increases the performance when
* creating the sparsity pattern.
*/
SparsityPattern (const Epetra_Map ¶llel_partitioning,
const unsigned int n_entries_per_row = 0);
/**
* Same as before, but now use the
* exact number of nonzeros in each m
* row. Since we know the number of
* elements in the sparsity pattern
* exactly in this case, we can
* already allocate the right amount
* of memory, which makes the
* creation process by the respective
* SparsityPattern::reinit call
* considerably faster. However, this
* is a rather unusual situation,
* since knowing the number of
* entries in each row is usually
* connected to knowing the indices
* of nonzero entries, which the
* sparsity pattern is designed to
* describe.
*/
SparsityPattern (const Epetra_Map ¶llel_partitioning,
const std::vector<unsigned int> &n_entries_per_row);
/**
* This constructor is similar to the
* one above, but it now takes two
* different Epetra maps for rows and
* columns. This interface is meant to
* be used for generating rectangular
* sparsity pattern, where one map
* describes the %parallel partitioning
* of the dofs associated with the
* sparsity pattern rows and the other
* one of the sparsity pattern
* columns. Note that there is no real
* parallelism along the columns
* – the processor that owns a
* certain row always owns all the
* column elements, no matter how far
* they might be spread out. The second
* Epetra_Map is only used to specify
* the number of columns and for
* specifying the correct domain space
* when performing matrix-vector
* products with vectors based on the
* same column map.
*
* The number of columns entries per
* row is specified as the maximum
* number of entries argument.
*/
SparsityPattern (const Epetra_Map &row_parallel_partitioning,
const Epetra_Map &col_parallel_partitioning,
const unsigned int n_entries_per_row = 0);
/**
* This constructor is similar to the
* one above, but it now takes two
* different Epetra maps for rows and
* columns. This interface is meant to
* be used for generating rectangular
* matrices, where one map specifies
* the %parallel distribution of rows
* and the second one specifies the
* distribution of degrees of freedom
* associated with matrix columns. This
* second map is however not used for
* the distribution of the columns
* themselves – rather, all
* column elements of a row are stored
* on the same processor. The vector
* <tt>n_entries_per_row</tt> specifies
* the number of entries in each row of
* the newly generated matrix.
*/
SparsityPattern (const Epetra_Map &row_parallel_partitioning,
const Epetra_Map &col_parallel_partitioning,
const std::vector<unsigned int> &n_entries_per_row);
/**
* Reinitialization function for
* generating a square sparsity pattern
* using an Epetra_Map for the
* description of the %parallel
* partitioning and the number of
* nonzero entries in the rows of the
* sparsity pattern. Note that this
* number does not need to be exact,
* and it is even allowed that the
* actual sparsity structure has more
* nonzero entries than specified in
* the constructor. However it is still
* advantageous to provide good
* estimates here since this will
* considerably increase the
* performance when creating the
* sparsity pattern.
*
* This function does not create any
* entries by itself, but provides
* the correct data structures that
* can be used by the respective
* add() function.
*/
void
reinit (const Epetra_Map ¶llel_partitioning,
const unsigned int n_entries_per_row = 0);
/**
* Same as before, but now use the
* exact number of nonzeros in each m
* row. Since we know the number of
* elements in the sparsity pattern
* exactly in this case, we can
* already allocate the right amount
* of memory, which makes process of
* adding entries to the sparsity
* pattern considerably
* faster. However, this is a rather
* unusual situation, since knowing
* the number of entries in each row
* is usually connected to knowing
* the indices of nonzero entries,
* which the sparsity pattern is
* designed to describe.
*/
void
reinit (const Epetra_Map ¶llel_partitioning,
const std::vector<unsigned int> &n_entries_per_row);
/**
* This reinit function is similar to
* the one above, but it now takes
* two different Epetra maps for rows
* and columns. This interface is
* meant to be used for generating
* rectangular sparsity pattern,
* where one map describes the
* %parallel partitioning of the dofs
* associated with the sparsity
* pattern rows and the other one of
* the sparsity pattern columns. Note
* that there is no real parallelism
* along the columns – the
* processor that owns a certain row
* always owns all the column
* elements, no matter how far they
* might be spread out. The second
* Epetra_Map is only used to specify
* the number of columns and for
* internal arragements when doing
* matrix-vector products with
* vectors based on that column map.
*
* The number of columns entries per
* row is specified by the argument
* <tt>n_entries_per_row</tt>.
*/
void
reinit (const Epetra_Map &row_parallel_partitioning,
const Epetra_Map &col_parallel_partitioning,
const unsigned int n_entries_per_row = 0);
/**
* This reinit function is similar to
* the one above, but it now takes
* two different Epetra maps for rows
* and columns. This interface is
* meant to be used for generating
* rectangular matrices, where one
* map specifies the %parallel
* distribution of rows and the
* second one specifies the
* distribution of degrees of freedom
* associated with matrix
* columns. This second map is
* however not used for the
* distribution of the columns
* themselves – rather, all
* column elements of a row are
* stored on the same processor. The
* vector <tt>n_entries_per_row</tt>
* specifies the number of entries in
* each row of the newly generated
* matrix.
*/
void
reinit (const Epetra_Map &row_parallel_partitioning,
const Epetra_Map &col_parallel_partitioning,
const std::vector<unsigned int> &n_entries_per_row);
/**
* Reinit function. Takes one of the
* deal.II sparsity patterns and a
* %parallel partitioning of the rows
* and columns for initializing the
* current Trilinos sparsity
* pattern. The optional argument @p
* exchange_data can be used for
* reinitialization with a sparsity
* pattern that is not fully
* constructed. This feature is only
* implemented for input sparsity
* patterns of type
* CompressedSimpleSparsityPattern.
*/
template<typename SparsityType>
void
reinit (const Epetra_Map &row_parallel_partitioning,
const Epetra_Map &col_parallel_partitioning,
const SparsityType &nontrilinos_sparsity_pattern,
const bool exchange_data = false);
/**
* Reinit function. Takes one of the
* deal.II sparsity patterns and a
* %parallel partitioning of the rows
* and columns for initializing the
* current Trilinos sparsity
* pattern. The optional argument @p
* exchange_data can be used for
* reinitialization with a sparsity
* pattern that is not fully
* constructed. This feature is only
* implemented for input sparsity
* patterns of type
* CompressedSimpleSparsityPattern.
*/
template<typename SparsityType>
void
reinit (const Epetra_Map ¶llel_partitioning,
const SparsityType &nontrilinos_sparsity_pattern,
const bool exchange_data = false);
//@}
/**
* @name Constructors and initialization using an IndexSet description
*/
//@{
/**
* Constructor for a square sparsity
* pattern using an IndexSet and an
* MPI communicator for the
* description of the %parallel
* partitioning. Moreover, the number
* of nonzero entries in the rows of
* the sparsity pattern can be
* specified. Note that this number
* does not need to be exact, and it
* is even allowed that the actual
* sparsity structure has more
* nonzero entries than specified in
* the constructor. However it is
* still advantageous to provide good
* estimates here since a good value
* will avoid repeated allocation of
* memory, which considerably
* increases the performance when
* creating the sparsity pattern.
*/
SparsityPattern (const IndexSet ¶llel_partitioning,
const MPI_Comm &communicator = MPI_COMM_WORLD,
const unsigned int n_entries_per_row = 0);
/**
* Same as before, but now use the
* exact number of nonzeros in each m
* row. Since we know the number of
* elements in the sparsity pattern
* exactly in this case, we can
* already allocate the right amount
* of memory, which makes the
* creation process by the respective
* SparsityPattern::reinit call
* considerably faster. However, this
* is a rather unusual situation,
* since knowing the number of
* entries in each row is usually
* connected to knowing the indices
* of nonzero entries, which the
* sparsity pattern is designed to
* describe.
*/
SparsityPattern (const IndexSet ¶llel_partitioning,
const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row);
/**
* This constructor is similar to the
* one above, but it now takes two
* different index sets to describe the
* %parallel partitioning of rows and
* columns. This interface is meant to
* be used for generating rectangular
* sparsity pattern. Note that there is
* no real parallelism along the
* columns – the processor that
* owns a certain row always owns all
* the column elements, no matter how
* far they might be spread out. The
* second Epetra_Map is only used to
* specify the number of columns and
* for internal arragements when doing
* matrix-vector products with vectors
* based on that column map.
*
* The number of columns entries per
* row is specified as the maximum
* number of entries argument.
*/
SparsityPattern (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator = MPI_COMM_WORLD,
const unsigned int n_entries_per_row = 0);
/**
* This constructor is similar to the
* one above, but it now takes two
* different index sets for rows and
* columns. This interface is meant to
* be used for generating rectangular
* matrices, where one map specifies
* the %parallel distribution of rows
* and the second one specifies the
* distribution of degrees of freedom
* associated with matrix columns. This
* second map is however not used for
* the distribution of the columns
* themselves – rather, all
* column elements of a row are stored
* on the same processor. The vector
* <tt>n_entries_per_row</tt> specifies
* the number of entries in each row of
* the newly generated matrix.
*/
SparsityPattern (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row);
/**
* Reinitialization function for
* generating a square sparsity
* pattern using an IndexSet and an
* MPI communicator for the
* description of the %parallel
* partitioning and the number of
* nonzero entries in the rows of the
* sparsity pattern. Note that this
* number does not need to be exact,
* and it is even allowed that the
* actual sparsity structure has more
* nonzero entries than specified in
* the constructor. However it is
* still advantageous to provide good
* estimates here since this will
* considerably increase the
* performance when creating the
* sparsity pattern.
*
* This function does not create any
* entries by itself, but provides
* the correct data structures that
* can be used by the respective
* add() function.
*/
void
reinit (const IndexSet ¶llel_partitioning,
const MPI_Comm &communicator = MPI_COMM_WORLD,
const unsigned int n_entries_per_row = 0);
/**
* Same as before, but now use the
* exact number of nonzeros in each m
* row. Since we know the number of
* elements in the sparsity pattern
* exactly in this case, we can
* already allocate the right amount
* of memory, which makes process of
* adding entries to the sparsity
* pattern considerably
* faster. However, this is a rather
* unusual situation, since knowing
* the number of entries in each row
* is usually connected to knowing
* the indices of nonzero entries,
* which the sparsity pattern is
* designed to describe.
*/
void
reinit (const IndexSet ¶llel_partitioning,
const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row);
/**
* This reinit function is similar to
* the one above, but it now takes
* two different index sets for rows
* and columns. This interface is
* meant to be used for generating
* rectangular sparsity pattern,
* where one index set describes the
* %parallel partitioning of the dofs
* associated with the sparsity
* pattern rows and the other one of
* the sparsity pattern columns. Note
* that there is no real parallelism
* along the columns – the
* processor that owns a certain row
* always owns all the column
* elements, no matter how far they
* might be spread out. The second
* IndexSet is only used to specify
* the number of columns and for
* internal arragements when doing
* matrix-vector products with
* vectors based on an EpetraMap
* based on that IndexSet.
*
* The number of columns entries per
* row is specified by the argument
* <tt>n_entries_per_row</tt>.
*/
void
reinit (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator = MPI_COMM_WORLD,
const unsigned int n_entries_per_row = 0);
/**
* Same as before, but now using a
* vector <tt>n_entries_per_row</tt>
* for specifying the number of
* entries in each row of the
* sparsity pattern.
*/
void
reinit (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row);
/**
* Reinit function. Takes one of the
* deal.II sparsity patterns and the
* %parallel partitioning of the rows
* and columns specified by two index
* sets and a %parallel communicator
* for initializing the current
* Trilinos sparsity pattern. The
* optional argument @p exchange_data
* can be used for reinitialization
* with a sparsity pattern that is
* not fully constructed. This
* feature is only implemented for
* input sparsity patterns of type
* CompressedSimpleSparsityPattern.
*/
template<typename SparsityType>
void
reinit (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const SparsityType &nontrilinos_sparsity_pattern,
const MPI_Comm &communicator = MPI_COMM_WORLD,
const bool exchange_data = false);
/**
* Reinit function. Takes one of the
* deal.II sparsity patterns and a
* %parallel partitioning of the rows
* and columns for initializing the
* current Trilinos sparsity
* pattern. The optional argument @p
* exchange_data can be used for
* reinitialization with a sparsity
* pattern that is not fully
* constructed. This feature is only
* implemented for input sparsity
* patterns of type
* CompressedSimpleSparsityPattern.
*/
template<typename SparsityType>
void
reinit (const IndexSet ¶llel_partitioning,
const SparsityType &nontrilinos_sparsity_pattern,
const MPI_Comm &communicator = MPI_COMM_WORLD,
const bool exchange_data = false);
//@}
/**
* @name Information on the sparsity pattern
*/
//@{
/**
* Returns the state of the sparsity
* pattern, i.e., whether compress()
* needs to be called after an
* operation requiring data
* exchange.
*/
bool is_compressed () const;
/**
* Gives the maximum number of
* entries per row on the current
* processor.
*/
unsigned int max_entries_per_row () const;
/**
* Return the number of rows in this
* sparsity pattern.
*/
unsigned int n_rows () const;
/**
* Return the number of columns in
* this sparsity pattern.
*/
unsigned int n_cols () const;
/**
* Return the local dimension of the
* sparsity pattern, i.e. the number
* of rows stored on the present MPI
* process. In the sequential case,
* this number is the same as
* n_rows(), but for parallel
* matrices it may be smaller.
*
* To figure out which elements
* exactly are stored locally,
* use local_range().
*/
unsigned int local_size () const;
/**
* Return a pair of indices
* indicating which rows of this
* sparsity pattern are stored
* locally. The first number is the
* index of the first row stored, the
* second the index of the one past
* the last one that is stored
* locally. If this is a sequential
* matrix, then the result will be
* the pair (0,n_rows()), otherwise
* it will be a pair (i,i+n), where
* <tt>n=local_size()</tt>.
*/
std::pair<unsigned int, unsigned int>
local_range () const;
/**
* Return whether @p index is
* in the local range or not,
* see also local_range().
*/
bool in_local_range (const unsigned int index) const;
/**
* Return the number of nonzero
* elements of this sparsity pattern.
*/
unsigned int n_nonzero_elements () const;
/**
* Number of entries in a
* specific row.
*/
unsigned int row_length (const unsigned int row) const;
/**
* Compute the bandwidth of the
* matrix represented by this
* structure. The bandwidth is the
* maximum of $|i-j|$ for which the
* index pair $(i,j)$ represents a
* nonzero entry of the
* matrix. Consequently, the maximum
* bandwidth a $n\times m$ matrix can
* have is $\max\{n-1,m-1\}$.
*/
unsigned int bandwidth () const;
/**
* Return whether the object is
* empty. It is empty if no memory is
* allocated, which is the same as
* when both dimensions are zero.
*/
bool empty () const;
/**
* Return whether the index
* (<i>i,j</i>) exists in the
* sparsity pattern (i.e., it may be
* non-zero) or not.
*/
bool exists (const unsigned int i,
const unsigned int j) const;
/**
* Determine an estimate for the
* memory consumption (in bytes)
* of this object. Currently not
* implemented for this class.
*/
unsigned int memory_consumption () const;
//@}
/**
* @name Adding entries
*/
//@{
/**
* Add the element (<i>i,j</i>) to
* the sparsity pattern.
*/
void add (const unsigned int i,
const unsigned int j);
/**
* Add several elements in one row to
* the sparsity pattern.
*/
template <typename ForwardIterator>
void add_entries (const unsigned int row,
ForwardIterator begin,
ForwardIterator end,
const bool indices_are_sorted = false);
//@}
/**
* @name Access of underlying Trilinos data
*/
//@{
/**
* Return a const reference to the
* underlying Trilinos
* Epetra_CrsGraph data that stores
* the sparsity pattern.
*/
const Epetra_CrsGraph & trilinos_sparsity_pattern () const;
/**
* Return a const reference to the
* underlying Trilinos Epetra_Map
* that sets the parallel
* partitioning of the domain space
* of this sparsity pattern, i.e.,
* the partitioning of the vectors
* matrices based on this sparsity
* pattern are multiplied with.
*/
const Epetra_Map & domain_partitioner () const;
/**
* Return a const reference to the
* underlying Trilinos Epetra_Map
* that sets the partitioning of the
* range space of this sparsity
* pattern, i.e., the partitioning of
* the vectors that are result from
* matrix-vector products.
*/
const Epetra_Map & range_partitioner () const;
/**
* Return a const reference to the
* underlying Trilinos Epetra_Map
* that sets the partitioning of the
* sparsity pattern rows. Equal to
* the partitioning of the range.
*/
const Epetra_Map & row_partitioner () const;
/**
* Return a const reference to the
* underlying Trilinos Epetra_Map
* that sets the partitioning of the
* sparsity pattern columns. This is
* in general not equal to the
* partitioner Epetra_Map for the
* domain because of overlap in the
* matrix.
*/
const Epetra_Map & col_partitioner () const;
/**
* Return a const reference to
* the communicator used for
* this object.
*/
const Epetra_Comm & trilinos_communicator () const;
//@}
/**
* @name Iterators
*/
//@{
/**
* STL-like iterator with the
* first entry.
*/
const_iterator begin () const;
/**
* Final iterator.
*/
const_iterator end () const;
/**
* STL-like iterator with the
* first entry of row @p r.
*
* Note that if the given row
* is empty, i.e. does not
* contain any nonzero entries,
* then the iterator returned
* by this function equals
* <tt>end(r)</tt>. Note also
* that the iterator may not be
* dereferencable in that case.
*/
const_iterator begin (const unsigned int r) const;
/**
* Final iterator of row
* <tt>r</tt>. It points to the
* first element past the end
* of line @p r, or past the
* end of the entire sparsity
* pattern.
*
* Note that the end iterator
* is not necessarily
* dereferencable. This is in
* particular the case if it is
* the end iterator for the
* last row of a matrix.
*/
const_iterator end (const unsigned int r) const;
//@}
/**
* @name Input/Output
*/
//@{
/**
* Abstract Trilinos object
* that helps view in ASCII
* other Trilinos
* objects. Currently this
* function is not
* implemented. TODO: Not
* implemented.
*/
void write_ascii ();
/**
* Print (the locally owned part of)
* the sparsity pattern to the given
* stream, using the format
* <tt>(line,col)</tt>. The optional
* flag outputs the sparsity pattern
* in Trilinos style, where even the
* according processor number is
* printed to the stream, as well as
* a summary before actually writing
* the entries.
*/
void print (std::ostream &out,
const bool write_extended_trilinos_info = false) const;
/**
* Print the sparsity of the matrix
* in a format that <tt>gnuplot</tt>
* understands and which can be used
* to plot the sparsity pattern in a
* graphical way. The format consists
* of pairs <tt>i j</tt> of nonzero
* elements, each representing one
* entry of this matrix, one per line
* of the output file. Indices are
* counted from zero on, as
* usual. Since sparsity patterns are
* printed in the same way as
* matrices are displayed, we print
* the negative of the column index,
* which means that the
* <tt>(0,0)</tt> element is in the
* top left rather than in the bottom
* left corner.
*
* Print the sparsity pattern in
* gnuplot by setting the data style
* to dots or points and use the
* <tt>plot</tt> command.
*/
void print_gnuplot (std::ostream &out) const;
//@}
/** @addtogroup Exceptions
* @{ */
/**
* Exception
*/
DeclException1 (ExcTrilinosError,
int,
<< "An error with error number " << arg1
<< " occured while calling a Trilinos function");
/**
* Exception
*/
DeclException2 (ExcInvalidIndex,
int, int,
<< "The entry with index <" << arg1 << ',' << arg2
<< "> does not exist.");
/**
* Exception
*/
DeclException0 (ExcSourceEqualsDestination);
/**
* Exception
*/
DeclException4 (ExcAccessToNonLocalElement,
int, int, int, int,
<< "You tried to access element (" << arg1
<< "/" << arg2 << ")"
<< " of a distributed matrix, but only rows "
<< arg3 << " through " << arg4
<< " are stored locally and can be accessed.");
/**
* Exception
*/
DeclException2 (ExcAccessToNonPresentElement,
int, int,
<< "You tried to access element (" << arg1
<< "/" << arg2 << ")"
<< " of a sparse matrix, but it appears to not"
<< " exist in the Trilinos sparsity pattern.");
//@}
private:
/**
* Pointer to the user-supplied
* Epetra Trilinos mapping of
* the matrix columns that
* assigns parts of the matrix
* to the individual processes.
*/
std_cxx1x::shared_ptr<Epetra_Map> column_space_map;
/**
* A boolean variable to hold
* information on whether the
* vector is compressed or not.
*/
bool compressed;
/**
* A sparsity pattern object in
* Trilinos to be used for finite
* element based problems which
* allows for adding non-local
* elements to the pattern.
*/
std_cxx1x::shared_ptr<Epetra_FECrsGraph> graph;
friend class SparsityPatternIterators::const_iterator;
friend class SparsityPatternIterators::const_iterator::Accessor;
};
// -------------------------- inline and template functions ----------------------
#ifndef DOXYGEN
namespace SparsityPatternIterators
{
inline
const_iterator::Accessor::
Accessor (const SparsityPattern *sp,
const unsigned int row,
const unsigned int index)
:
sparsity_pattern(const_cast<SparsityPattern*>(sp)),
a_row(row),
a_index(index)
{
visit_present_row ();
}
inline
unsigned int
const_iterator::Accessor::row() const
{
Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
return a_row;
}
inline
unsigned int
const_iterator::Accessor::column() const
{
Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
return (*colnum_cache)[a_index];
}
inline
unsigned int
const_iterator::Accessor::index() const
{
Assert (a_row < sparsity_pattern->n_rows(), ExcBeyondEndOfSparsityPattern());
return a_index;
}
inline
const_iterator::
const_iterator(const SparsityPattern *sp,
const unsigned int row,
const unsigned int index)
:
accessor(sp, row, index)
{}
inline
const_iterator &
const_iterator::operator++ ()
{
Assert (accessor.a_row < accessor.sparsity_pattern->n_rows(),
ExcIteratorPastEnd());
++accessor.a_index;
// If at end of line: do one
// step, then cycle until we
// find a row with a nonzero
// number of entries.
if (accessor.a_index >= accessor.colnum_cache->size())
{
accessor.a_index = 0;
++accessor.a_row;
while ((accessor.a_row < accessor.sparsity_pattern->n_rows())
&&
(accessor.sparsity_pattern->row_length(accessor.a_row) == 0))
++accessor.a_row;
accessor.visit_present_row();
}
return *this;
}
inline
const_iterator
const_iterator::operator++ (int)
{
const const_iterator old_state = *this;
++(*this);
return old_state;
}
inline
const const_iterator::Accessor &
const_iterator::operator* () const
{
return accessor;
}
inline
const const_iterator::Accessor *
const_iterator::operator-> () const
{
return &accessor;
}
inline
bool
const_iterator::
operator == (const const_iterator& other) const
{
return (accessor.a_row == other.accessor.a_row &&
accessor.a_index == other.accessor.a_index);
}
inline
bool
const_iterator::
operator != (const const_iterator& other) const
{
return ! (*this == other);
}
inline
bool
const_iterator::
operator < (const const_iterator& other) const
{
return (accessor.row() < other.accessor.row() ||
(accessor.row() == other.accessor.row() &&
accessor.index() < other.accessor.index()));
}
}
inline
SparsityPattern::const_iterator
SparsityPattern::begin() const
{
return const_iterator(this, 0, 0);
}
inline
SparsityPattern::const_iterator
SparsityPattern::end() const
{
return const_iterator(this, n_rows(), 0);
}
inline
SparsityPattern::const_iterator
SparsityPattern::begin(const unsigned int r) const
{
Assert (r < n_rows(), ExcIndexRange(r, 0, n_rows()));
if (row_length(r) > 0)
return const_iterator(this, r, 0);
else
return end (r);
}
inline
SparsityPattern::const_iterator
SparsityPattern::end(const unsigned int r) const
{
Assert (r < n_rows(), ExcIndexRange(r, 0, n_rows()));
// place the iterator on the first entry
// past this line, or at the end of the
// matrix
for (unsigned int i=r+1; i<n_rows(); ++i)
if (row_length(i) > 0)
return const_iterator(this, i, 0);
// if there is no such line, then take the
// end iterator of the matrix
return end();
}
inline
bool
SparsityPattern::in_local_range (const unsigned int index) const
{
int begin, end;
begin = graph->RowMap().MinMyGID();
end = graph->RowMap().MaxMyGID()+1;
return ((index >= static_cast<unsigned int>(begin)) &&
(index < static_cast<unsigned int>(end)));
}
inline
bool
SparsityPattern::is_compressed () const
{
return compressed;
}
inline
bool
SparsityPattern::empty () const
{
return ((n_rows() == 0) && (n_cols() == 0));
}
inline
void
SparsityPattern::add (const unsigned int i,
const unsigned int j)
{
add_entries (i, &j, &j+1);
}
template <typename ForwardIterator>
inline
void
SparsityPattern::add_entries (const unsigned int row,
ForwardIterator begin,
ForwardIterator end,
const bool /*indices_are_sorted*/)
{
if (begin == end)
return;
int * col_index_ptr = (int*)(&*begin);
const int n_cols = static_cast<int>(end - begin);
compressed = false;
const int ierr = graph->InsertGlobalIndices (1, (int*)&row,
n_cols, col_index_ptr);
AssertThrow (ierr >= 0, ExcTrilinosError(ierr));
}
inline
const Epetra_CrsGraph &
SparsityPattern::trilinos_sparsity_pattern () const
{
return static_cast<const Epetra_CrsGraph&>(*graph);
}
inline
const Epetra_Map &
SparsityPattern::domain_partitioner () const
{
return static_cast<const Epetra_Map&>(graph->DomainMap());
}
inline
const Epetra_Map &
SparsityPattern::range_partitioner () const
{
return static_cast<const Epetra_Map&>(graph->RangeMap());
}
inline
const Epetra_Map &
SparsityPattern::row_partitioner () const
{
return static_cast<const Epetra_Map&>(graph->RowMap());
}
inline
const Epetra_Map &
SparsityPattern::col_partitioner () const
{
return static_cast<const Epetra_Map&>(graph->ColMap());
}
inline
const Epetra_Comm &
SparsityPattern::trilinos_communicator () const
{
return graph->RangeMap().Comm();
}
inline
SparsityPattern::SparsityPattern (const IndexSet ¶llel_partitioning,
const MPI_Comm &communicator,
const unsigned int n_entries_per_row)
:
compressed (false)
{
Epetra_Map map = parallel_partitioning.make_trilinos_map (communicator,
false);
reinit (map, map, n_entries_per_row);
}
inline
SparsityPattern::SparsityPattern (const IndexSet ¶llel_partitioning,
const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row)
:
compressed (false)
{
Epetra_Map map = parallel_partitioning.make_trilinos_map (communicator,
false);
reinit (map, map, n_entries_per_row);
}
inline
SparsityPattern::SparsityPattern (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator,
const unsigned int n_entries_per_row)
:
compressed (false)
{
Epetra_Map row_map =
row_parallel_partitioning.make_trilinos_map (communicator, false);
Epetra_Map col_map =
col_parallel_partitioning.make_trilinos_map (communicator, false);
reinit (row_map, col_map, n_entries_per_row);
}
inline
SparsityPattern::
SparsityPattern (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row)
:
compressed (false)
{
Epetra_Map row_map =
row_parallel_partitioning.make_trilinos_map (communicator, false);
Epetra_Map col_map =
col_parallel_partitioning.make_trilinos_map (communicator, false);
reinit (row_map, col_map, n_entries_per_row);
}
inline
void
SparsityPattern::reinit (const IndexSet ¶llel_partitioning,
const MPI_Comm &communicator,
const unsigned int n_entries_per_row)
{
Epetra_Map map = parallel_partitioning.make_trilinos_map (communicator,
false);
reinit (map, map, n_entries_per_row);
}
inline
void SparsityPattern::reinit (const IndexSet ¶llel_partitioning,
const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row)
{
Epetra_Map map = parallel_partitioning.make_trilinos_map (communicator,
false);
reinit (map, map, n_entries_per_row);
}
inline
void SparsityPattern::reinit (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator,
const unsigned int n_entries_per_row)
{
Epetra_Map row_map =
row_parallel_partitioning.make_trilinos_map (communicator, false);
Epetra_Map col_map =
col_parallel_partitioning.make_trilinos_map (communicator, false);
reinit (row_map, col_map, n_entries_per_row);
}
inline
void
SparsityPattern::reinit (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const MPI_Comm &communicator,
const std::vector<unsigned int> &n_entries_per_row)
{
Epetra_Map row_map =
row_parallel_partitioning.make_trilinos_map (communicator, false);
Epetra_Map col_map =
col_parallel_partitioning.make_trilinos_map (communicator, false);
reinit (row_map, col_map, n_entries_per_row);
}
template<typename SparsityType>
inline
void
SparsityPattern::reinit (const IndexSet &row_parallel_partitioning,
const IndexSet &col_parallel_partitioning,
const SparsityType &nontrilinos_sparsity_pattern,
const MPI_Comm &communicator,
const bool exchange_data)
{
Epetra_Map row_map =
row_parallel_partitioning.make_trilinos_map (communicator, false);
Epetra_Map col_map =
col_parallel_partitioning.make_trilinos_map (communicator, false);
reinit (row_map, col_map, nontrilinos_sparsity_pattern, exchange_data);
}
template<typename SparsityType>
inline
void
SparsityPattern::reinit (const IndexSet ¶llel_partitioning,
const SparsityType &nontrilinos_sparsity_pattern,
const MPI_Comm &communicator,
const bool exchange_data)
{
Epetra_Map map = parallel_partitioning.make_trilinos_map (communicator,
false);
reinit (map, map, nontrilinos_sparsity_pattern, exchange_data);
}
#endif // DOXYGEN
}
DEAL_II_NAMESPACE_CLOSE
#endif // DEAL_II_USE_TRILINOS
/*-------------------- trilinos_sparsity_pattern.h --------------------*/
#endif
/*-------------------- trilinos_sparsity_pattern.h --------------------*/
|