/usr/include/trilinos/Xpetra_TpetraCrsMatrix.hpp is in libtrilinos-xpetra-dev 12.10.1-3.
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 | // @HEADER
//
// ***********************************************************************
//
// Xpetra: A linear algebra interface package
// Copyright 2012 Sandia Corporation
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the Corporation nor the names of the
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Questions? Contact
// Jonathan Hu (jhu@sandia.gov)
// Andrey Prokopenko (aprokop@sandia.gov)
// Ray Tuminaro (rstumin@sandia.gov)
//
// ***********************************************************************
//
// @HEADER
#ifndef XPETRA_TPETRACRSMATRIX_HPP
#define XPETRA_TPETRACRSMATRIX_HPP
/* this file is automatically generated - do not edit (see scripts/tpetra.py) */
// FIXME (mfh 03 Sep 2014) The above is probably not true anymore.
// Furthermore, I don't think anyone maintains the scripts.
// Feel free to correct this comment if I'm wrong.
#include "Xpetra_TpetraConfigDefs.hpp"
#include "Tpetra_CrsMatrix.hpp"
#include "Xpetra_CrsMatrix.hpp"
#include "Xpetra_TpetraMap.hpp"
#include "Xpetra_TpetraMultiVector.hpp"
#include "Xpetra_TpetraVector.hpp"
#include "Xpetra_TpetraCrsGraph.hpp"
//#include "Xpetra_TpetraRowMatrix.hpp"
#include "Xpetra_Exceptions.hpp"
namespace Xpetra {
// TODO: move that elsewhere
// template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
// const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> toTpetraCrsMatrix(const Xpetra::DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &);
//
template<class Scalar = CrsMatrix<>::scalar_type,
class LocalOrdinal =
typename CrsMatrix<Scalar>::local_ordinal_type,
class GlobalOrdinal =
typename CrsMatrix<Scalar, LocalOrdinal>::global_ordinal_type,
class Node =
typename CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>
class TpetraCrsMatrix
: public CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> //, public TpetraRowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
{
// The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
typedef TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> TpetraCrsMatrixClass;
typedef TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TpetraVectorClass;
typedef TpetraImport<LocalOrdinal,GlobalOrdinal,Node> TpetraImportClass;
typedef TpetraExport<LocalOrdinal,GlobalOrdinal,Node> TpetraExportClass;
// The following typedefs are used by the Kokkos interface
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
typedef typename Xpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type local_matrix_type;
#endif
#endif
public:
//! @name Constructor/Destructor Methods
//@{
//! Constructor specifying fixed number of entries for each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
: mtx_ (Teuchos::rcp (new Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> (toTpetra(rowMap), maxNumEntriesPerRow, toTpetra(pftype), params))) { }
//! Constructor specifying (possibly different) number of entries in each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
: mtx_(Teuchos::rcp(new Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> (toTpetra(rowMap), NumEntriesPerRowToAlloc, toTpetra(pftype), params))) { }
//! Constructor specifying column Map and fixed number of entries for each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
: mtx_(Teuchos::rcp(new Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), maxNumEntriesPerRow, toTpetra(pftype), params))) { }
//! Constructor specifying column Map and number of entries in each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
: mtx_(Teuchos::rcp(new Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >(toTpetra(rowMap), toTpetra(colMap), NumEntriesPerRowToAlloc, toTpetra(pftype), params))) { }
//! Constructor specifying a previously constructed graph.
TpetraCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
: mtx_(Teuchos::rcp(new Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >(toTpetra(graph), params))) { }
//! Constructor for a fused import
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Import<LocalOrdinal,GlobalOrdinal,Node> & importer,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
{
typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsMatrix;
XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, *sourceMatrix, tSourceMatrix, "Xpetra::TpetraCrsMatrix constructor only accepts Xpetra::TpetraCrsMatrix as the input argument.");//TODO: remove and use toTpetra()
RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSourceMatrix.getTpetra_CrsMatrix();
RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ? toTpetra(domainMap) : Teuchos::null;
RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ? toTpetra(rangeMap) : Teuchos::null;
mtx_=Tpetra::importAndFillCompleteCrsMatrix<MyTpetraCrsMatrix>(tSourceMatrix.getTpetra_CrsMatrix(),toTpetra(importer),myDomainMap,myRangeMap,params);
bool restrictComm=false;
if(!params.is_null()) restrictComm = params->get("Restrict Communicator",restrictComm);
if(restrictComm && mtx_->getRowMap().is_null()) mtx_=Teuchos::null;
}
//! Constructor for a fused export
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Export<LocalOrdinal,GlobalOrdinal,Node> & exporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
{
typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsMatrix;
XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, *sourceMatrix, tSourceMatrix, "Xpetra::TpetraCrsMatrix constructor only accepts Xpetra::TpetraCrsMatrix as the input argument.");//TODO: remove and use toTpetra()
RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSourceMatrix.getTpetra_CrsMatrix();
RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ? toTpetra(domainMap) : Teuchos::null;
RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ? toTpetra(rangeMap) : Teuchos::null;
mtx_=Tpetra::exportAndFillCompleteCrsMatrix<MyTpetraCrsMatrix>(tSourceMatrix.getTpetra_CrsMatrix(),toTpetra(exporter),myDomainMap,myRangeMap,params);
}
//! Constructor for a fused import
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Import<LocalOrdinal,GlobalOrdinal,Node> & RowImporter,
const Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > DomainImporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
const Teuchos::RCP<Teuchos::ParameterList>& params)
{
typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsMatrix;
XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, *sourceMatrix, tSourceMatrix, "Xpetra::TpetraCrsMatrix constructor only accepts Xpetra::TpetraCrsMatrix as the input argument.");//TODO: remove and use toTpetra()
RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSourceMatrix.getTpetra_CrsMatrix();
RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ? toTpetra(domainMap) : Teuchos::null;
RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ? toTpetra(rangeMap) : Teuchos::null;
mtx_=Tpetra::importAndFillCompleteCrsMatrix<MyTpetraCrsMatrix>(tSourceMatrix.getTpetra_CrsMatrix(),toTpetra(RowImporter),toTpetra(*DomainImporter),myDomainMap,myRangeMap,params);
bool restrictComm=false;
if(!params.is_null()) restrictComm = params->get("Restrict Communicator",restrictComm);
if(restrictComm && mtx_->getRowMap().is_null()) mtx_=Teuchos::null;
}
//! Constructor for a fused export
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Export<LocalOrdinal,GlobalOrdinal,Node> & RowExporter,
const Teuchos::RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > DomainExporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
const Teuchos::RCP<Teuchos::ParameterList>& params)
{
typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsMatrix;
XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, *sourceMatrix, tSourceMatrix, "Xpetra::TpetraCrsMatrix constructor only accepts Xpetra::TpetraCrsMatrix as the input argument.");//TODO: remove and use toTpetra()
RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSourceMatrix.getTpetra_CrsMatrix();
RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ? toTpetra(domainMap) : Teuchos::null;
RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ? toTpetra(rangeMap) : Teuchos::null;
mtx_=Tpetra::exportAndFillCompleteCrsMatrix<MyTpetraCrsMatrix>(tSourceMatrix.getTpetra_CrsMatrix(),toTpetra(RowExporter),toTpetra(*DomainExporter),myDomainMap,myRangeMap,params);
}
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
/// \brief Constructor specifying column Map and a local matrix,
/// which the resulting CrsMatrix views.
///
/// Unlike most other CrsMatrix constructors, successful
/// completion of this constructor will result in a fill-complete
/// matrix.
///
/// \param rowMap [in] Distribution of rows of the matrix.
///
/// \param colMap [in] Distribution of columns of the matrix.
///
/// \param lclMatrix [in] A local CrsMatrix containing all local
/// matrix values as well as a local graph. The graph's local
/// row indices must come from the specified row Map, and its
/// local column indices must come from the specified column
/// Map.
///
/// \param params [in/out] Optional list of parameters. If not
/// null, any missing parameters will be filled in with their
/// default values.
TpetraCrsMatrix (const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
const local_matrix_type& lclMatrix,
const Teuchos::RCP<Teuchos::ParameterList>& params = null)
: mtx_(Teuchos::rcp(new Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), lclMatrix, params))) { }
#endif
#endif
//! Destructor.
virtual ~TpetraCrsMatrix() { }
//@}
//! @name Insertion/Removal Methods
//@{
//! Insert matrix entries, using global IDs.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals) { XPETRA_MONITOR("TpetraCrsMatrix::insertGlobalValues"); mtx_->insertGlobalValues(globalRow, cols, vals); }
//! Insert matrix entries, using local IDs.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals) { XPETRA_MONITOR("TpetraCrsMatrix::insertLocalValues"); mtx_->insertLocalValues(localRow, cols, vals); }
//! Replace matrix entries, using global IDs.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals) { XPETRA_MONITOR("TpetraCrsMatrix::replaceGlobalValues"); mtx_->replaceGlobalValues(globalRow, cols, vals); }
//! Replace matrix entries, using local IDs.
void
replaceLocalValues (LocalOrdinal localRow,
const ArrayView<const LocalOrdinal> &cols,
const ArrayView<const Scalar> &vals)
{
XPETRA_MONITOR("TpetraCrsMatrix::replaceLocalValues");
typedef typename ArrayView<const LocalOrdinal>::size_type size_type;
const LocalOrdinal numValid =
mtx_->replaceLocalValues (localRow, cols, vals);
TEUCHOS_TEST_FOR_EXCEPTION(
static_cast<size_type> (numValid) != cols.size (), std::runtime_error,
"replaceLocalValues returned " << numValid << " != cols.size() = " <<
cols.size () << ".");
}
//! Set all matrix entries equal to scalarThis.
void setAllToScalar(const Scalar &alpha) { XPETRA_MONITOR("TpetraCrsMatrix::setAllToScalar"); mtx_->setAllToScalar(alpha); }
//! Scale the current values of a matrix, this = alpha*this.
void scale(const Scalar &alpha) { XPETRA_MONITOR("TpetraCrsMatrix::scale"); mtx_->scale(alpha); }
//! Allocates and returns ArrayRCPs of the Crs arrays --- This is an Xpetra-only routine.
//** \warning This is an expert-only routine and should not be called from user code. */
void allocateAllValues(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind, ArrayRCP<Scalar> & values)
{ XPETRA_MONITOR("TpetraCrsMatrix::allocateAllValues"); rowptr.resize(getNodeNumRows()+1); colind.resize(numNonZeros); values.resize(numNonZeros);}
//! Sets the 1D pointer arrays of the graph.
void setAllValues(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind, const ArrayRCP<Scalar> & values)
{ XPETRA_MONITOR("TpetraCrsMatrix::setAllValues"); mtx_->setAllValues(rowptr,colind,values); }
//! Gets the 1D pointer arrays of the graph.
void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values) const
{ XPETRA_MONITOR("TpetraCrsMatrix::getAllValues"); mtx_->getAllValues(rowptr,colind,values); }
//@}
//! @name Transformational Methods
//@{
//!
void resumeFill(const RCP< ParameterList > ¶ms=null) { XPETRA_MONITOR("TpetraCrsMatrix::resumeFill"); mtx_->resumeFill(params); }
//! Signal that data entry is complete, specifying domain and range maps.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=null) { XPETRA_MONITOR("TpetraCrsMatrix::fillComplete"); mtx_->fillComplete(toTpetra(domainMap), toTpetra(rangeMap), params); }
//! Signal that data entry is complete.
void fillComplete(const RCP< ParameterList > ¶ms=null) { XPETRA_MONITOR("TpetraCrsMatrix::fillComplete"); mtx_->fillComplete(params); }
//! Replaces the current domainMap and importer with the user-specified objects.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >& newDomainMap, Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > & newImporter) {
XPETRA_MONITOR("TpetraCrsMatrix::replaceDomainMapAndImporter");
XPETRA_DYNAMIC_CAST( const TpetraImportClass , *newImporter, tImporter, "Xpetra::TpetraCrsMatrix::replaceDomainMapAndImporter only accepts Xpetra::TpetraImport.");
RCP<const Tpetra::Import<LocalOrdinal,GlobalOrdinal,Node> > myImport = tImporter.getTpetra_Import();
mtx_->replaceDomainMapAndImporter( toTpetra(newDomainMap),myImport);
}
//! Expert static fill complete
void expertStaticFillComplete(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & domainMap,
const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & rangeMap,
const RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > &importer=Teuchos::null,
const RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > &exporter=Teuchos::null,
const RCP<ParameterList> ¶ms=Teuchos::null) {
XPETRA_MONITOR("TpetraCrsMatrix::expertStaticFillComplete");
RCP<const Tpetra::Import<LocalOrdinal,GlobalOrdinal,Node> > myImport;
RCP<const Tpetra::Export<LocalOrdinal,GlobalOrdinal,Node> > myExport;
if(importer!=Teuchos::null) {
XPETRA_DYNAMIC_CAST( const TpetraImportClass , *importer, tImporter, "Xpetra::TpetraCrsMatrix::expertStaticFillComplete only accepts Xpetra::TpetraImport.");
myImport = tImporter.getTpetra_Import();
}
if(exporter!=Teuchos::null) {
XPETRA_DYNAMIC_CAST( const TpetraExportClass , *exporter, tExporter, "Xpetra::TpetraCrsMatrix::expertStaticFillComplete only accepts Xpetra::TpetraExport.");
myExport = tExporter.getTpetra_Export();
}
mtx_->expertStaticFillComplete(toTpetra(domainMap),toTpetra(rangeMap),myImport,myExport,params);
}
//@}
//! @name Methods implementing RowMatrix
//@{
//! Returns the Map that describes the row distribution in this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { XPETRA_MONITOR("TpetraCrsMatrix::getRowMap"); return toXpetra(mtx_->getRowMap()); }
//! Returns the Map that describes the column distribution in this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { XPETRA_MONITOR("TpetraCrsMatrix::getColMap"); return toXpetra(mtx_->getColMap()); }
//! Returns the CrsGraph associated with this matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const { XPETRA_MONITOR("TpetraCrsMatrix::getCrsGraph"); return toXpetra(mtx_->getCrsGraph()); }
//! Number of global elements in the row map of this matrix.
global_size_t getGlobalNumRows() const { XPETRA_MONITOR("TpetraCrsMatrix::getGlobalNumRows"); return mtx_->getGlobalNumRows(); }
//! Number of global columns in the matrix.
global_size_t getGlobalNumCols() const { XPETRA_MONITOR("TpetraCrsMatrix::getGlobalNumCols"); return mtx_->getGlobalNumCols(); }
//! Returns the number of matrix rows owned on the calling node.
size_t getNodeNumRows() const { XPETRA_MONITOR("TpetraCrsMatrix::getNodeNumRows"); return mtx_->getNodeNumRows(); }
//! Returns the number of columns connected to the locally owned rows of this matrix.
size_t getNodeNumCols() const { XPETRA_MONITOR("TpetraCrsMatrix::getNodeNumCols"); return mtx_->getNodeNumCols(); }
//! Returns the global number of entries in this matrix.
global_size_t getGlobalNumEntries() const { XPETRA_MONITOR("TpetraCrsMatrix::getGlobalNumEntries"); return mtx_->getGlobalNumEntries(); }
//! Returns the local number of entries in this matrix.
size_t getNodeNumEntries() const { XPETRA_MONITOR("TpetraCrsMatrix::getNodeNumEntries"); return mtx_->getNodeNumEntries(); }
//! Returns the current number of entries on this node in the specified local row.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("TpetraCrsMatrix::getNumEntriesInLocalRow"); return mtx_->getNumEntriesInLocalRow(localRow); }
//! Returns the number of global diagonal entries, based on global row/column index comparisons.
global_size_t getGlobalNumDiags() const { XPETRA_MONITOR("TpetraCrsMatrix::getGlobalNumDiags"); return mtx_->getGlobalNumDiags(); }
//! Returns the number of local diagonal entries, based on global row/column index comparisons.
size_t getNodeNumDiags() const { XPETRA_MONITOR("TpetraCrsMatrix::getNodeNumDiags"); return mtx_->getNodeNumDiags(); }
//! Returns the maximum number of entries across all rows/columns on all nodes.
size_t getGlobalMaxNumRowEntries() const { XPETRA_MONITOR("TpetraCrsMatrix::getGlobalMaxNumRowEntries"); return mtx_->getGlobalMaxNumRowEntries(); }
//! Returns the maximum number of entries across all rows/columns on this node.
size_t getNodeMaxNumRowEntries() const { XPETRA_MONITOR("TpetraCrsMatrix::getNodeMaxNumRowEntries"); return mtx_->getNodeMaxNumRowEntries(); }
//! If matrix indices are in the local range, this function returns true. Otherwise, this function returns false.
bool isLocallyIndexed() const { XPETRA_MONITOR("TpetraCrsMatrix::isLocallyIndexed"); return mtx_->isLocallyIndexed(); }
//! If matrix indices are in the global range, this function returns true. Otherwise, this function returns false.
bool isGloballyIndexed() const { XPETRA_MONITOR("TpetraCrsMatrix::isGloballyIndexed"); return mtx_->isGloballyIndexed(); }
//! Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
bool isFillComplete() const { XPETRA_MONITOR("TpetraCrsMatrix::isFillComplete"); return mtx_->isFillComplete(); }
//! Returns true if the matrix is in edit mode.
bool isFillActive() const { XPETRA_MONITOR("TpetraCrsMatrix::isFillActive"); return mtx_->isFillActive(); }
//! Returns the Frobenius norm of the matrix.
typename ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const { XPETRA_MONITOR("TpetraCrsMatrix::getFrobeniusNorm"); return mtx_->getFrobeniusNorm(); }
//! Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
bool supportsRowViews() const { XPETRA_MONITOR("TpetraCrsMatrix::supportsRowViews"); return mtx_->supportsRowViews(); }
//! Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calling routine.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const { XPETRA_MONITOR("TpetraCrsMatrix::getLocalRowCopy"); mtx_->getLocalRowCopy(LocalRow, Indices, Values, NumEntries); }
//! Extract a const, non-persisting view of global indices in a specified row of the matrix.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const { XPETRA_MONITOR("TpetraCrsMatrix::getGlobalRowView"); mtx_->getGlobalRowView(GlobalRow, indices, values); }
//! Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const { XPETRA_MONITOR("TpetraCrsMatrix::getGlobalRowCopy"); mtx_->getGlobalRowCopy(GlobalRow, indices, values, numEntries); }
//! Extract a const, non-persisting view of local indices in a specified row of the matrix.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const { XPETRA_MONITOR("TpetraCrsMatrix::getLocalRowView"); mtx_->getLocalRowView(LocalRow, indices, values); }
//@}
//! @name Methods implementing Operator
//@{
//! Computes the sparse matrix-multivector multiplication.
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const { XPETRA_MONITOR("TpetraCrsMatrix::apply"); mtx_->apply(toTpetra(X), toTpetra(Y), mode, alpha, beta); }
//! Returns the Map associated with the domain of this operator. This will be null until fillComplete() is called.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { XPETRA_MONITOR("TpetraCrsMatrix::getDomainMap"); return toXpetra(mtx_->getDomainMap()); }
//!
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { XPETRA_MONITOR("TpetraCrsMatrix::getRangeMap"); return toXpetra(mtx_->getRangeMap()); }
//@}
//! @name Overridden from Teuchos::Describable
//@{
//! A simple one-line description of this object.
std::string description() const { XPETRA_MONITOR("TpetraCrsMatrix::description"); return mtx_->description(); }
//! Print the object with some verbosity level to an FancyOStream object.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { XPETRA_MONITOR("TpetraCrsMatrix::describe"); mtx_->describe(out, verbLevel); }
//@}
//! Deep copy constructor
TpetraCrsMatrix(const TpetraCrsMatrix& matrix)
: mtx_ (matrix.mtx_->template clone<Node> (matrix.mtx_->getNode ())) {}
//! Get a copy of the diagonal entries owned by this node, with local row idices.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const {
XPETRA_MONITOR("TpetraCrsMatrix::getLocalDiagCopy");
XPETRA_DYNAMIC_CAST(TpetraVectorClass, diag, tDiag, "Xpetra::TpetraCrsMatrix.getLocalDiagCopy() only accept Xpetra::TpetraVector as input arguments.");
mtx_->getLocalDiagCopy(*tDiag.getTpetra_Vector());
// mtx_->getLocalDiagCopy(toTpetra(diag));
}
//! Get offsets of the diagonal entries in the matrix.
void getLocalDiagOffsets(Teuchos::ArrayRCP<size_t> &offsets) const {
XPETRA_MONITOR("TpetraCrsMatrix::getLocalDiagOffsets");
mtx_->getLocalDiagOffsets(offsets);
}
//! Get a copy of the diagonal entries owned by this node, with local row indices.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView<const size_t> &offsets) const {
XPETRA_MONITOR("TpetraCrsMatrix::getLocalDiagCopy");
//XPETRA_DYNAMIC_CAST(TpetraVectorClass, diag, tDiag, "Xpetra::TpetraCrsMatrix.getLocalDiagCopy() only accept Xpetra::TpetraVector as input arguments.");
//mtx_->getLocalDiagCopy(*tDiag.getTpetra_Vector(), offsets);
mtx_->getLocalDiagCopy(*(toTpetra(diag)), offsets);
}
//! Left scale operator with given vector values
void leftScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) {
XPETRA_MONITOR("TpetraCrsMatrix::leftScale");
mtx_->leftScale(*(toTpetra(x)));
}
//! Right scale operator with given vector values
void rightScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) {
XPETRA_MONITOR("TpetraCrsMatrix::rightScale");
mtx_->rightScale(*(toTpetra(x)));
}
//! Implements DistObject interface
//{@
//! Access function for the Tpetra::Map this DistObject was constructed with.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("TpetraCrsMatrix::getMap"); return rcp( new TpetraMap< LocalOrdinal, GlobalOrdinal, Node >(mtx_->getMap()) ); }
//! Import.
void doImport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &source,
const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM) {
XPETRA_MONITOR("TpetraCrsMatrix::doImport");
XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, source, tSource, "Xpetra::TpetraCrsMatrix::doImport only accept Xpetra::TpetraCrsMatrix as input arguments.");//TODO: remove and use toTpetra()
RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsMatrix();
//mtx_->doImport(toTpetraCrsMatrix(source), *tImporter.getTpetra_Import(), toTpetra(CM));
mtx_->doImport(*v, toTpetra(importer), toTpetra(CM));
}
//! Export.
void doExport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &dest,
const Import< LocalOrdinal, GlobalOrdinal, Node >& importer, CombineMode CM) {
XPETRA_MONITOR("TpetraCrsMatrix::doExport");
XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, dest, tDest, "Xpetra::TpetraCrsMatrix::doImport only accept Xpetra::TpetraCrsMatrix as input arguments.");//TODO: remove and use toTpetra()
RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsMatrix();
mtx_->doExport(*v, toTpetra(importer), toTpetra(CM));
}
//! Import (using an Exporter).
void doImport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &source,
const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) {
XPETRA_MONITOR("TpetraCrsMatrix::doImport");
XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, source, tSource, "Xpetra::TpetraCrsMatrix::doImport only accept Xpetra::TpetraCrsMatrix as input arguments.");//TODO: remove and use toTpetra()
RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsMatrix();
mtx_->doImport(*v, toTpetra(exporter), toTpetra(CM));
}
//! Export (using an Importer).
void doExport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &dest,
const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) {
XPETRA_MONITOR("TpetraCrsMatrix::doExport");
XPETRA_DYNAMIC_CAST(const TpetraCrsMatrixClass, dest, tDest, "Xpetra::TpetraCrsMatrix::doImport only accept Xpetra::TpetraCrsMatrix as input arguments.");//TODO: remove and use toTpetra()
RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsMatrix();
mtx_->doExport(*v, toTpetra(exporter), toTpetra(CM));
}
void removeEmptyProcessesInPlace (const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& newMap) {
XPETRA_MONITOR("TpetraCrsMatrix::removeEmptyProcessesInPlace");
mtx_->removeEmptyProcessesInPlace(toTpetra(newMap));
}
// @}
template<class Node2>
RCP<CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
clone (const RCP<Node2> &node2) const
{
return RCP<CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> > (new TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> (mtx_->clone (node2)));
}
//! @name Xpetra specific
//@{
//! Does this have an underlying matrix
bool hasMatrix() const {
return ! mtx_.is_null ();
}
//! TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object
TpetraCrsMatrix(const Teuchos::RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &mtx) : mtx_(mtx) { }
//! Get the underlying Tpetra matrix
RCP<const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsMatrix() const { return mtx_; }
//! Get the underlying Tpetra matrix
RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsMatrixNonConst() const { return mtx_; } //TODO: remove
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
/// \brief Access the local Kokkos::CrsMatrix data
local_matrix_type getLocalMatrix () const {
if(isFillComplete() == false)
throw std::runtime_error("Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
return getTpetra_CrsMatrixNonConst()->getLocalMatrix();
}
#endif
#endif
//@}
private:
RCP< Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > mtx_;
}; // TpetraCrsMatrix class
#ifdef HAVE_XPETRA_EPETRA
#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
(!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
// specialization of TpetraCrsMatrix for GO=LO=int
template<class Scalar>
class TpetraCrsMatrix<Scalar,int,int,EpetraNode>
: public CrsMatrix<Scalar,int,int,EpetraNode> //, public TpetraRowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
{
typedef int LocalOrdinal;
typedef int GlobalOrdinal;
typedef EpetraNode Node;
// The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
typedef TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> TpetraCrsMatrixClass;
typedef TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TpetraVectorClass;
typedef TpetraImport<LocalOrdinal,GlobalOrdinal,Node> TpetraImportClass;
typedef TpetraExport<LocalOrdinal,GlobalOrdinal,Node> TpetraExportClass;
// The following typedefs are used by the Kokkos interface
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
typedef typename Xpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type local_matrix_type;
#endif
#endif
public:
//! @name Constructor/Destructor Methods
//@{
//! Constructor specifying fixed number of entries for each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor specifying (possibly different) number of entries in each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor specifying column Map and fixed number of entries for each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor specifying column Map and number of entries in each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor specifying a previously constructed graph.
TpetraCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor for a fused import
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Import<LocalOrdinal,GlobalOrdinal,Node> & importer,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor for a fused export
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Export<LocalOrdinal,GlobalOrdinal,Node> & exporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor for a fused import
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Import<LocalOrdinal,GlobalOrdinal,Node> & RowImporter,
const Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > DomainImporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
const Teuchos::RCP<Teuchos::ParameterList>& params)
{
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Constructor for a fused export
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Export<LocalOrdinal,GlobalOrdinal,Node> & RowExporter,
const Teuchos::RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > DomainExporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
const Teuchos::RCP<Teuchos::ParameterList>& params)
{
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
/// \brief Constructor specifying column Map and a local matrix,
/// which the resulting CrsMatrix views.
///
/// Unlike most other CrsMatrix constructors, successful
/// completion of this constructor will result in a fill-complete
/// matrix.
///
/// \param rowMap [in] Distribution of rows of the matrix.
///
/// \param colMap [in] Distribution of columns of the matrix.
///
/// \param lclMatrix [in] A local CrsMatrix containing all local
/// matrix values as well as a local graph. The graph's local
/// row indices must come from the specified row Map, and its
/// local column indices must come from the specified column
/// Map.
///
/// \param params [in/out] Optional list of parameters. If not
/// null, any missing parameters will be filled in with their
/// default values.
TpetraCrsMatrix (const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
const local_matrix_type& lclMatrix,
const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , "TpetraCrsMatrix<int,int>", "int", typeid(EpetraNode).name() );
}
#endif
#endif
//! Destructor.
virtual ~TpetraCrsMatrix() { }
//@}
//! @name Insertion/Removal Methods
//@{
//! Insert matrix entries, using global IDs.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals) { }
//! Insert matrix entries, using local IDs.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals) { }
//! Replace matrix entries, using global IDs.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals) { }
//! Replace matrix entries, using local IDs.
void
replaceLocalValues (LocalOrdinal localRow,
const ArrayView<const LocalOrdinal> &cols,
const ArrayView<const Scalar> &vals)
{ }
//! Set all matrix entries equal to scalarThis.
void setAllToScalar(const Scalar &alpha) { }
//! Scale the current values of a matrix, this = alpha*this.
void scale(const Scalar &alpha) { }
//! Allocates and returns ArrayRCPs of the Crs arrays --- This is an Xpetra-only routine.
//** \warning This is an expert-only routine and should not be called from user code. */
void allocateAllValues(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind, ArrayRCP<Scalar> & values) { }
//! Sets the 1D pointer arrays of the graph.
void setAllValues(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind, const ArrayRCP<Scalar> & values) { }
//! Gets the 1D pointer arrays of the graph.
void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values) const { }
//@}
//! @name Transformational Methods
//@{
//!
void resumeFill(const RCP< ParameterList > ¶ms=null) { }
//! Signal that data entry is complete, specifying domain and range maps.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=null) { }
//! Signal that data entry is complete.
void fillComplete(const RCP< ParameterList > ¶ms=null) { }
//! Replaces the current domainMap and importer with the user-specified objects.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >& newDomainMap, Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > & newImporter) { }
//! Expert static fill complete
void expertStaticFillComplete(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & domainMap,
const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & rangeMap,
const RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > &importer=Teuchos::null,
const RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > &exporter=Teuchos::null,
const RCP<ParameterList> ¶ms=Teuchos::null) { }
//@}
//! @name Methods implementing RowMatrix
//@{
//! Returns the Map that describes the row distribution in this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { return Teuchos::null; }
//! Returns the Map that describes the column distribution in this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { return Teuchos::null; }
//! Returns the CrsGraph associated with this matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const { return Teuchos::null; }
//! Number of global elements in the row map of this matrix.
global_size_t getGlobalNumRows() const { return 0; }
//! Number of global columns in the matrix.
global_size_t getGlobalNumCols() const { return 0; }
//! Returns the number of matrix rows owned on the calling node.
size_t getNodeNumRows() const { return 0; }
//! Returns the number of columns connected to the locally owned rows of this matrix.
size_t getNodeNumCols() const { return 0; }
//! Returns the global number of entries in this matrix.
global_size_t getGlobalNumEntries() const { return 0; }
//! Returns the local number of entries in this matrix.
size_t getNodeNumEntries() const { return 0; }
//! Returns the current number of entries on this node in the specified local row.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
//! Returns the number of global diagonal entries, based on global row/column index comparisons.
global_size_t getGlobalNumDiags() const { return 0; }
//! Returns the number of local diagonal entries, based on global row/column index comparisons.
size_t getNodeNumDiags() const { return 0; }
//! Returns the maximum number of entries across all rows/columns on all nodes.
size_t getGlobalMaxNumRowEntries() const { return 0; }
//! Returns the maximum number of entries across all rows/columns on this node.
size_t getNodeMaxNumRowEntries() const { return 0; }
//! If matrix indices are in the local range, this function returns true. Otherwise, this function returns false.
bool isLocallyIndexed() const { return false; }
//! If matrix indices are in the global range, this function returns true. Otherwise, this function returns false.
bool isGloballyIndexed() const { return false; }
//! Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
bool isFillComplete() const { return false; }
//! Returns true if the matrix is in edit mode.
bool isFillActive() const { return false; }
//! Returns the Frobenius norm of the matrix.
typename ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const { return ScalarTraits< Scalar >::magnitude(ScalarTraits< Scalar >::zero()); }
//! Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
bool supportsRowViews() const { return false; }
//! Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calling routine.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const { }
//! Extract a const, non-persisting view of global indices in a specified row of the matrix.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const { }
//! Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const { }
//! Extract a const, non-persisting view of local indices in a specified row of the matrix.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const { }
//@}
//! @name Methods implementing Operator
//@{
//! Computes the sparse matrix-multivector multiplication.
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const { }
//! Returns the Map associated with the domain of this operator. This will be null until fillComplete() is called.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { return Teuchos::null; }
//!
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { return Teuchos::null; }
//@}
//! @name Overridden from Teuchos::Describable
//@{
//! A simple one-line description of this object.
std::string description() const { return std::string(""); }
//! Print the object with some verbosity level to an FancyOStream object.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
//@}
//! Deep copy constructor
TpetraCrsMatrix(const TpetraCrsMatrix& matrix) {}
//! Get a copy of the diagonal entries owned by this node, with local row idices.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const { }
//! Get offsets of the diagonal entries in the matrix.
void getLocalDiagOffsets(Teuchos::ArrayRCP<size_t> &offsets) const { }
//! Get a copy of the diagonal entries owned by this node, with local row indices.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView<const size_t> &offsets) const { }
//! Left scale operator with given vector values
void leftScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) { }
//! Right scale operator with given vector values
void rightScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) { }
//! Implements DistObject interface
//{@
//! Access function for the Tpetra::Map this DistObject was constructed with.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { return Teuchos::null; }
//! Import.
void doImport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &source,
const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM) { }
//! Export.
void doExport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &dest,
const Import< LocalOrdinal, GlobalOrdinal, Node >& importer, CombineMode CM) { }
//! Import (using an Exporter).
void doImport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &source,
const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) { }
//! Export (using an Importer).
void doExport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &dest,
const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) { }
void removeEmptyProcessesInPlace (const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& newMap) { }
// @}
template<class Node2>
RCP<CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
clone (const RCP<Node2> &node2) const { return Teuchos::null; }
//! @name Xpetra specific
//@{
//! Does this have an underlying matrix
bool hasMatrix() const { return false; }
//! TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object
TpetraCrsMatrix(const Teuchos::RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &mtx) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,int,int,EpetraNode>).name(), "int", typeid(EpetraNode).name() );
}
//! Get the underlying Tpetra matrix
RCP<const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsMatrix() const { return Teuchos::null; }
//! Get the underlying Tpetra matrix
RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsMatrixNonConst() const { return Teuchos::null; } //TODO: remove
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
/// \brief Access the local Kokkos::CrsMatrix data
local_matrix_type getLocalMatrix () const {
if(isFillComplete() == false)
throw std::runtime_error("Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
local_matrix_type ret;
return ret;
}
#endif
#endif
//@}
}; // TpetraCrsMatrix class (specialization for GO=int, NO=EpetraNode)
#endif
#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
(!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
// specialization of TpetraCrsMatrix for GO=long long, NO=EpetraNode
template<class Scalar>
class TpetraCrsMatrix<Scalar,int,long long,EpetraNode>
: public CrsMatrix<Scalar,int,long long,EpetraNode> //, public TpetraRowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>
{
typedef int LocalOrdinal;
typedef long long GlobalOrdinal;
typedef EpetraNode Node;
// The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
typedef TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> TpetraCrsMatrixClass;
typedef TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TpetraVectorClass;
typedef TpetraImport<LocalOrdinal,GlobalOrdinal,Node> TpetraImportClass;
typedef TpetraExport<LocalOrdinal,GlobalOrdinal,Node> TpetraExportClass;
// The following typedefs are used by the Kokkos interface
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
typedef typename Xpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type local_matrix_type;
#endif
#endif
public:
//! @name Constructor/Destructor Methods
//@{
//! Constructor specifying fixed number of entries for each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor specifying (possibly different) number of entries in each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor specifying column Map and fixed number of entries for each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor specifying column Map and number of entries in each row.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor specifying a previously constructed graph.
TpetraCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor for a fused import
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Import<LocalOrdinal,GlobalOrdinal,Node> & importer,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor for a fused export
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Export<LocalOrdinal,GlobalOrdinal,Node> & exporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor for a fused import
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Import<LocalOrdinal,GlobalOrdinal,Node> & RowImporter,
const Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > DomainImporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
const Teuchos::RCP<Teuchos::ParameterList>& params)
{
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Constructor for a fused export
TpetraCrsMatrix(const Teuchos::RCP<const CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
const Export<LocalOrdinal,GlobalOrdinal,Node> & RowExporter,
const Teuchos::RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > DomainExporter,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
const Teuchos::RCP<Teuchos::ParameterList>& params)
{
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
/// \brief Constructor specifying column Map and a local matrix,
/// which the resulting CrsMatrix views.
///
/// Unlike most other CrsMatrix constructors, successful
/// completion of this constructor will result in a fill-complete
/// matrix.
///
/// \param rowMap [in] Distribution of rows of the matrix.
///
/// \param colMap [in] Distribution of columns of the matrix.
///
/// \param lclMatrix [in] A local CrsMatrix containing all local
/// matrix values as well as a local graph. The graph's local
/// row indices must come from the specified row Map, and its
/// local column indices must come from the specified column
/// Map.
///
/// \param params [in/out] Optional list of parameters. If not
/// null, any missing parameters will be filled in with their
/// default values.
TpetraCrsMatrix (const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
const local_matrix_type& lclMatrix,
const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
#endif
#endif
//! Destructor.
virtual ~TpetraCrsMatrix() { }
//@}
//! @name Insertion/Removal Methods
//@{
//! Insert matrix entries, using global IDs.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals) { }
//! Insert matrix entries, using local IDs.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals) { }
//! Replace matrix entries, using global IDs.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals) { }
//! Replace matrix entries, using local IDs.
void
replaceLocalValues (LocalOrdinal localRow,
const ArrayView<const LocalOrdinal> &cols,
const ArrayView<const Scalar> &vals)
{ }
//! Set all matrix entries equal to scalarThis.
void setAllToScalar(const Scalar &alpha) { }
//! Scale the current values of a matrix, this = alpha*this.
void scale(const Scalar &alpha) { }
//! Allocates and returns ArrayRCPs of the Crs arrays --- This is an Xpetra-only routine.
//** \warning This is an expert-only routine and should not be called from user code. */
void allocateAllValues(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind, ArrayRCP<Scalar> & values) { }
//! Sets the 1D pointer arrays of the graph.
void setAllValues(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind, const ArrayRCP<Scalar> & values) { }
//! Gets the 1D pointer arrays of the graph.
void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values) const { }
//@}
//! @name Transformational Methods
//@{
//!
void resumeFill(const RCP< ParameterList > ¶ms=null) { }
//! Signal that data entry is complete, specifying domain and range maps.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=null) { }
//! Signal that data entry is complete.
void fillComplete(const RCP< ParameterList > ¶ms=null) { }
//! Replaces the current domainMap and importer with the user-specified objects.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >& newDomainMap, Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > & newImporter) { }
//! Expert static fill complete
void expertStaticFillComplete(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & domainMap,
const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & rangeMap,
const RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > &importer=Teuchos::null,
const RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > &exporter=Teuchos::null,
const RCP<ParameterList> ¶ms=Teuchos::null) { }
//@}
//! @name Methods implementing RowMatrix
//@{
//! Returns the Map that describes the row distribution in this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { return Teuchos::null; }
//! Returns the Map that describes the column distribution in this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { return Teuchos::null; }
//! Returns the CrsGraph associated with this matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const { return Teuchos::null; }
//! Number of global elements in the row map of this matrix.
global_size_t getGlobalNumRows() const { return 0; }
//! Number of global columns in the matrix.
global_size_t getGlobalNumCols() const { return 0; }
//! Returns the number of matrix rows owned on the calling node.
size_t getNodeNumRows() const { return 0; }
//! Returns the number of columns connected to the locally owned rows of this matrix.
size_t getNodeNumCols() const { return 0; }
//! Returns the global number of entries in this matrix.
global_size_t getGlobalNumEntries() const { return 0; }
//! Returns the local number of entries in this matrix.
size_t getNodeNumEntries() const { return 0; }
//! Returns the current number of entries on this node in the specified local row.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
//! Returns the number of global diagonal entries, based on global row/column index comparisons.
global_size_t getGlobalNumDiags() const { return 0; }
//! Returns the number of local diagonal entries, based on global row/column index comparisons.
size_t getNodeNumDiags() const { return 0; }
//! Returns the maximum number of entries across all rows/columns on all nodes.
size_t getGlobalMaxNumRowEntries() const { return 0; }
//! Returns the maximum number of entries across all rows/columns on this node.
size_t getNodeMaxNumRowEntries() const { return 0; }
//! If matrix indices are in the local range, this function returns true. Otherwise, this function returns false.
bool isLocallyIndexed() const { return false; }
//! If matrix indices are in the global range, this function returns true. Otherwise, this function returns false.
bool isGloballyIndexed() const { return false; }
//! Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
bool isFillComplete() const { return false; }
//! Returns true if the matrix is in edit mode.
bool isFillActive() const { return false; }
//! Returns the Frobenius norm of the matrix.
typename ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const { return ScalarTraits< Scalar >::magnitude(ScalarTraits< Scalar >::zero()); }
//! Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
bool supportsRowViews() const { return false; }
//! Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calling routine.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const { }
//! Extract a const, non-persisting view of global indices in a specified row of the matrix.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const { }
//! Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const { }
//! Extract a const, non-persisting view of local indices in a specified row of the matrix.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const { }
//@}
//! @name Methods implementing Operator
//@{
//! Computes the sparse matrix-multivector multiplication.
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const { }
//! Returns the Map associated with the domain of this operator. This will be null until fillComplete() is called.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { return Teuchos::null; }
//!
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { return Teuchos::null; }
//@}
//! @name Overridden from Teuchos::Describable
//@{
//! A simple one-line description of this object.
std::string description() const { return std::string(""); }
//! Print the object with some verbosity level to an FancyOStream object.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
//@}
//! Deep copy constructor
TpetraCrsMatrix(const TpetraCrsMatrix& matrix) {}
//! Get a copy of the diagonal entries owned by this node, with local row idices.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const { }
//! Get offsets of the diagonal entries in the matrix.
void getLocalDiagOffsets(Teuchos::ArrayRCP<size_t> &offsets) const { }
//! Get a copy of the diagonal entries owned by this node, with local row indices.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView<const size_t> &offsets) const { }
//! Left scale operator with given vector values
void leftScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) { }
//! Right scale operator with given vector values
void rightScale (const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x) { }
//! Implements DistObject interface
//{@
//! Access function for the Tpetra::Map this DistObject was constructed with.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { return Teuchos::null; }
//! Import.
void doImport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &source,
const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM) { }
//! Export.
void doExport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &dest,
const Import< LocalOrdinal, GlobalOrdinal, Node >& importer, CombineMode CM) { }
//! Import (using an Exporter).
void doImport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &source,
const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) { }
//! Export (using an Importer).
void doExport(const DistObject<char, LocalOrdinal, GlobalOrdinal, Node> &dest,
const Export< LocalOrdinal, GlobalOrdinal, Node >& exporter, CombineMode CM) { }
void removeEmptyProcessesInPlace (const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& newMap) { }
// @}
template<class Node2>
RCP<CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node2> >
clone (const RCP<Node2> &node2) const { return Teuchos::null; }
//! @name Xpetra specific
//@{
//! Does this have an underlying matrix
bool hasMatrix() const { return false; }
//! TpetraCrsMatrix constructor to wrap a Tpetra::CrsMatrix object
TpetraCrsMatrix(const Teuchos::RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &mtx) {
XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name() , typeid(TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,EpetraNode>).name(), "long long", typeid(EpetraNode).name() );
}
//! Get the underlying Tpetra matrix
RCP<const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsMatrix() const { return Teuchos::null; }
//! Get the underlying Tpetra matrix
RCP<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsMatrixNonConst() const { return Teuchos::null; } //TODO: remove
#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
#ifdef HAVE_XPETRA_TPETRA
/// \brief Access the local Kokkos::CrsMatrix data
local_matrix_type getLocalMatrix () const {
if(isFillComplete() == false)
throw std::runtime_error("Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
local_matrix_type ret;
return ret;
}
#endif
#endif
//@}
}; // TpetraCrsMatrix class (specialization for GO=long long, NO=EpetraNode)
#endif
#endif // HAVE_XPETRA_EPETRA
} // Xpetra namespace
#define XPETRA_TPETRACRSMATRIX_SHORT
#endif // XPETRA_TPETRACRSMATRIX_HPP
|