48 #ifndef PACKAGES_XPETRA_SUP_UTILS_XPETRA_IO_HPP_ 49 #define PACKAGES_XPETRA_SUP_UTILS_XPETRA_IO_HPP_ 53 #ifdef HAVE_XPETRA_EPETRA 55 # include "Epetra_MpiComm.h" 59 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 60 #include <EpetraExt_MatrixMatrix.h> 61 #include <EpetraExt_RowMatrixOut.h> 62 #include <EpetraExt_MultiVectorOut.h> 63 #include <EpetraExt_CrsMatrixIn.h> 64 #include <EpetraExt_MultiVectorIn.h> 65 #include <EpetraExt_BlockMapIn.h> 68 #include <EpetraExt_BlockMapOut.h> 71 #ifdef HAVE_XPETRA_TPETRA 72 #include <MatrixMarket_Tpetra.hpp> 73 #include <Tpetra_RowMatrixTransposer.hpp> 74 #include <TpetraExt_MatrixMatrix.hpp> 80 #ifdef HAVE_XPETRA_EPETRA 99 #ifdef HAVE_XPETRA_EPETRA 101 template<
class SC,
class LO,
class GO,
class NO>
102 RCP<Xpetra::CrsMatrixWrap<SC,LO,GO,NO> >
105 "Convert_Epetra_CrsMatrix_ToXpetra_CrsMatrixWrap cannot be used with Scalar != double, LocalOrdinal != int, GlobalOrdinal != int");
106 return Teuchos::null;
129 template <
class Scalar,
130 class LocalOrdinal = int,
131 class GlobalOrdinal = LocalOrdinal,
136 #undef XPETRA_IO_SHORT 141 #ifdef HAVE_XPETRA_EPETRA 158 if (xeMap == Teuchos::null)
159 throw Exceptions::BadCast(
"Utils::Map2EpetraMap : Cast from Xpetra::Map to Xpetra::EpetraMap failed");
160 return xeMap->getEpetra_Map();
165 #ifdef HAVE_XPETRA_TPETRA 187 if (tmp_TMap == Teuchos::null)
188 throw Exceptions::BadCast(
"Utils::Map2TpetraMap : Cast from Xpetra::Map to Xpetra::TpetraMap failed");
189 return tmp_TMap->getTpetra_Map();
199 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 201 if (tmp_EMap != Teuchos::null) {
202 int rv = EpetraExt::BlockMapToMatrixMarketFile(fileName.c_str(), tmp_EMap->getEpetra_Map());
207 #endif // HAVE_XPETRA_EPETRAEXT 209 #ifdef HAVE_XPETRA_TPETRA 212 if (tmp_TMap != Teuchos::null) {
214 Tpetra::MatrixMarket::Writer<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >::writeMapFile(fileName, *TMap);
217 #endif // HAVE_XPETRA_TPETRA 225 std::string mapfile =
"map_" + fileName;
229 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 231 if (tmp_EVec != Teuchos::null) {
232 int rv = EpetraExt::MultiVectorToMatrixMarketFile(fileName.c_str(), *(tmp_EVec->getEpetra_MultiVector()));
237 #endif // HAVE_XPETRA_EPETRA 239 #ifdef HAVE_XPETRA_TPETRA 242 if (tmp_TVec != Teuchos::null) {
244 Tpetra::MatrixMarket::Writer<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >::writeDenseFile(fileName, TVec);
247 #endif // HAVE_XPETRA_TPETRA 249 throw Exceptions::BadCast(
"Could not cast to EpetraMultiVector or TpetraMultiVector in multivector writing");
265 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 267 if (tmp_ECrsMtx != Teuchos::null) {
269 int rv = EpetraExt::RowMatrixToMatrixMarketFile(fileName.c_str(), *A);
276 #ifdef HAVE_XPETRA_TPETRA 279 if (tmp_TCrsMtx != Teuchos::null) {
281 Tpetra::MatrixMarket::Writer<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >::writeSparseFile(fileName, A);
284 #endif // HAVE_XPETRA_TPETRA 286 throw Exceptions::BadCast(
"Could not cast to EpetraCrsMatrix or TpetraCrsMatrix in matrix writing");
291 if (binary ==
false) {
294 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 295 Epetra_CrsMatrix *eA;
297 int rv = EpetraExt::MatrixMarketFileToCrsMatrix(fileName.c_str(), *epcomm, eA);
304 Convert_Epetra_CrsMatrix_ToXpetra_CrsMatrixWrap<Scalar, LocalOrdinal, GlobalOrdinal, Node>(tmpA);
310 #ifdef HAVE_XPETRA_TPETRA 311 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> sparse_matrix_type;
313 typedef Tpetra::MatrixMarket::Reader<sparse_matrix_type> reader_type;
318 bool callFillComplete =
true;
338 std::ifstream ifs(fileName.c_str(), std::ios::binary);
341 ifs.read(reinterpret_cast<char*>(&m),
sizeof(m));
342 ifs.read(reinterpret_cast<char*>(&n),
sizeof(n));
343 ifs.read(reinterpret_cast<char*>(&nnz),
sizeof(nnz));
345 int myRank = comm->getRank();
357 for (
int i = 0; i < m; i++) {
359 ifs.read(reinterpret_cast<char*>(&row),
sizeof(row));
360 ifs.read(reinterpret_cast<char*>(&rownnz),
sizeof(rownnz));
363 for (
int j = 0; j < rownnz; j++) {
365 ifs.read(reinterpret_cast<char*>(&index),
sizeof(index));
366 inds[j] = Teuchos::as<GlobalOrdinal>(index);
368 for (
int j = 0; j < rownnz; j++) {
370 ifs.read(reinterpret_cast<char*>(&value),
sizeof(value));
371 vals[j] = Teuchos::as<SC>(value);
373 A->insertGlobalValues(row, inds, vals);
377 A->fillComplete(domainMap, rangeMap);
382 return Teuchos::null;
392 Read(
const std::string& filename,
397 const bool callFillComplete =
true,
398 const bool binary =
false,
399 const bool tolerant =
false,
400 const bool debug =
false) {
407 if (binary ==
false) {
409 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 410 Epetra_CrsMatrix *eA;
416 if (colMap.is_null()) {
417 rv = EpetraExt::MatrixMarketFileToCrsMatrix(filename.c_str(), epetraRowMap, epetraRangeMap, epetraDomainMap, eA);
421 rv = EpetraExt::MatrixMarketFileToCrsMatrix(filename.c_str(), epetraRowMap, epetraColMap, epetraRangeMap, epetraDomainMap, eA);
429 Convert_Epetra_CrsMatrix_ToXpetra_CrsMatrixWrap<Scalar, LocalOrdinal, GlobalOrdinal, Node>(tmpA);
436 #ifdef HAVE_XPETRA_TPETRA 437 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> sparse_matrix_type;
438 typedef Tpetra::MatrixMarket::Reader<sparse_matrix_type> reader_type;
439 typedef Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> map_type;
446 RCP<sparse_matrix_type> tA = reader_type::readSparseFile(filename, tpetraRowMap, tpetraColMap, tpetraDomainMap, tpetraRangeMap,
447 callFillComplete, tolerant, debug);
464 std::ifstream ifs(filename.c_str(), std::ios::binary);
467 ifs.read(reinterpret_cast<char*>(&m),
sizeof(m));
468 ifs.read(reinterpret_cast<char*>(&n),
sizeof(n));
469 ifs.read(reinterpret_cast<char*>(&nnz),
sizeof(nnz));
480 for (
int i = 0; i < m; i++) {
482 ifs.read(reinterpret_cast<char*>(&row),
sizeof(row));
483 ifs.read(reinterpret_cast<char*>(&rownnz),
sizeof(rownnz));
486 for (
int j = 0; j < rownnz; j++) {
488 ifs.read(reinterpret_cast<char*>(&index),
sizeof(index));
489 inds[j] = colElements[Teuchos::as<LocalOrdinal>(index)];
491 for (
int j = 0; j < rownnz; j++) {
493 ifs.read(reinterpret_cast<char*>(&value),
sizeof(value));
494 vals[j] = Teuchos::as<SC>(value);
496 A->insertGlobalValues(rowElements[row], inds, vals);
498 A->fillComplete(domainMap, rangeMap);
502 return Teuchos::null;
514 #ifdef HAVE_XPETRA_TPETRA 515 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> sparse_matrix_type;
516 typedef Tpetra::MatrixMarket::Reader<sparse_matrix_type> reader_type;
517 typedef Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> map_type;
518 typedef Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> multivector_type;
531 return Teuchos::null;
538 #ifdef HAVE_XPETRA_TPETRA 539 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> sparse_matrix_type;
540 typedef Tpetra::MatrixMarket::Reader<sparse_matrix_type> reader_type;
556 return Teuchos::null;
564 #ifdef HAVE_XPETRA_EPETRA 574 template <
class Scalar>
581 #ifdef HAVE_XPETRA_EPETRA 586 if (xeMap == Teuchos::null)
587 throw Exceptions::BadCast(
"IO::Map2EpetraMap : Cast from Xpetra::Map to Xpetra::EpetraMap failed");
588 return xeMap->getEpetra_Map();
593 #ifdef HAVE_XPETRA_TPETRA 598 if (tmp_TMap == Teuchos::null)
599 throw Exceptions::BadCast(
"IO::Map2TpetraMap : Cast from Xpetra::Map to Xpetra::TpetraMap failed");
600 return tmp_TMap->getTpetra_Map();
610 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 612 if (tmp_EMap != Teuchos::null) {
613 int rv = EpetraExt::BlockMapToMatrixMarketFile(fileName.c_str(), tmp_EMap->getEpetra_Map());
618 #endif // HAVE_XPETRA_EPETRA 620 #ifdef HAVE_XPETRA_TPETRA 621 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 622 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 627 if (tmp_TMap != Teuchos::null) {
629 Tpetra::MatrixMarket::Writer<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >::writeMapFile(fileName, *TMap);
633 #endif // HAVE_XPETRA_TPETRA 639 std::string mapfile =
"map_" + fileName;
643 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 645 if (tmp_EVec != Teuchos::null) {
646 int rv = EpetraExt::MultiVectorToMatrixMarketFile(fileName.c_str(), *(tmp_EVec->getEpetra_MultiVector()));
651 #endif // HAVE_XPETRA_EPETRAEXT 653 #ifdef HAVE_XPETRA_TPETRA 654 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 655 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 660 if (tmp_TVec != Teuchos::null) {
662 Tpetra::MatrixMarket::Writer<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >::writeDenseFile(fileName, TVec);
666 #endif // HAVE_XPETRA_TPETRA 668 throw Exceptions::BadCast(
"Could not cast to EpetraMultiVector or TpetraMultiVector in multivector writing");
685 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 687 if (tmp_ECrsMtx != Teuchos::null) {
689 int rv = EpetraExt::RowMatrixToMatrixMarketFile(fileName.c_str(), *A);
694 #endif // endif HAVE_XPETRA_EPETRA 696 #ifdef HAVE_XPETRA_TPETRA 697 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 698 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 703 if (tmp_TCrsMtx != Teuchos::null) {
705 Tpetra::MatrixMarket::Writer<Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >::writeSparseFile(fileName, A);
709 #endif // HAVE_XPETRA_TPETRA 711 throw Exceptions::BadCast(
"Could not cast to EpetraCrsMatrix or TpetraCrsMatrix in matrix writing");
716 if (binary ==
false) {
719 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 720 Epetra_CrsMatrix *eA;
722 int rv = EpetraExt::MatrixMarketFileToCrsMatrix(fileName.c_str(), *epcomm, eA);
729 Convert_Epetra_CrsMatrix_ToXpetra_CrsMatrixWrap<Scalar, LocalOrdinal, GlobalOrdinal, Node>(tmpA);
735 #ifdef HAVE_XPETRA_TPETRA 736 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 737 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 740 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> sparse_matrix_type;
742 typedef Tpetra::MatrixMarket::Reader<sparse_matrix_type> reader_type;
747 bool callFillComplete =
true;
768 std::ifstream ifs(fileName.c_str(), std::ios::binary);
771 ifs.read(reinterpret_cast<char*>(&m),
sizeof(m));
772 ifs.read(reinterpret_cast<char*>(&n),
sizeof(n));
773 ifs.read(reinterpret_cast<char*>(&nnz),
sizeof(nnz));
775 int myRank = comm->getRank();
777 GlobalOrdinal indexBase = 0;
787 for (
int i = 0; i < m; i++) {
789 ifs.read(reinterpret_cast<char*>(&row),
sizeof(row));
790 ifs.read(reinterpret_cast<char*>(&rownnz),
sizeof(rownnz));
793 for (
int j = 0; j < rownnz; j++) {
795 ifs.read(reinterpret_cast<char*>(&index),
sizeof(index));
796 inds[j] = Teuchos::as<GlobalOrdinal>(index);
798 for (
int j = 0; j < rownnz; j++) {
800 ifs.read(reinterpret_cast<char*>(&value),
sizeof(value));
801 vals[j] = Teuchos::as<Scalar>(value);
803 A->insertGlobalValues(row, inds, vals);
807 A->fillComplete(domainMap, rangeMap);
812 return Teuchos::null;
826 const bool callFillComplete =
true,
827 const bool binary =
false,
828 const bool tolerant =
false,
829 const bool debug =
false) {
836 if (binary ==
false) {
838 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 839 Epetra_CrsMatrix *eA;
845 if (colMap.is_null()) {
846 rv = EpetraExt::MatrixMarketFileToCrsMatrix(filename.c_str(), epetraRowMap, epetraRangeMap, epetraDomainMap, eA);
850 rv = EpetraExt::MatrixMarketFileToCrsMatrix(filename.c_str(), epetraRowMap, epetraColMap, epetraRangeMap, epetraDomainMap, eA);
858 Convert_Epetra_CrsMatrix_ToXpetra_CrsMatrixWrap<Scalar, LocalOrdinal, GlobalOrdinal, Node>(tmpA);
865 #ifdef HAVE_XPETRA_TPETRA 866 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 867 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 870 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> sparse_matrix_type;
871 typedef Tpetra::MatrixMarket::Reader<sparse_matrix_type> reader_type;
872 typedef Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> map_type;
879 RCP<sparse_matrix_type> tA = reader_type::readSparseFile(filename, tpetraRowMap, tpetraColMap, tpetraDomainMap, tpetraRangeMap,
880 callFillComplete, tolerant, debug);
898 std::ifstream ifs(filename.c_str(), std::ios::binary);
901 ifs.read(reinterpret_cast<char*>(&m),
sizeof(m));
902 ifs.read(reinterpret_cast<char*>(&n),
sizeof(n));
903 ifs.read(reinterpret_cast<char*>(&nnz),
sizeof(nnz));
914 for (
int i = 0; i < m; i++) {
916 ifs.read(reinterpret_cast<char*>(&row),
sizeof(row));
917 ifs.read(reinterpret_cast<char*>(&rownnz),
sizeof(rownnz));
920 for (
int j = 0; j < rownnz; j++) {
922 ifs.read(reinterpret_cast<char*>(&index),
sizeof(index));
923 inds[j] = colElements[Teuchos::as<LocalOrdinal>(index)];
925 for (
int j = 0; j < rownnz; j++) {
927 ifs.read(reinterpret_cast<char*>(&value),
sizeof(value));
928 vals[j] = Teuchos::as<Scalar>(value);
930 A->insertGlobalValues(rowElements[row], inds, vals);
932 A->fillComplete(domainMap, rangeMap);
936 return Teuchos::null;
947 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 948 Epetra_MultiVector * MV;
949 EpetraExt::MatrixMarketFileToMultiVector(fileName.c_str(),
toEpetra(map), MV);
950 return Xpetra::toXpetra<int,Node>(
rcp(MV));
955 #ifdef HAVE_XPETRA_TPETRA 956 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 957 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 960 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> sparse_matrix_type;
961 typedef Tpetra::MatrixMarket::Reader<sparse_matrix_type> reader_type;
962 typedef Tpetra::Map<LocalOrdinal, GlobalOrdinal, Node> map_type;
963 typedef Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> multivector_type;
977 return Teuchos::null;
986 #if defined(HAVE_XPETRA_EPETRA) && defined(HAVE_XPETRA_EPETRAEXT) 988 int rv = EpetraExt::MatrixMarketFileToMap(fileName.c_str(), *(
Xpetra::toEpetra(comm)), eMap);
993 return Xpetra::toXpetra<int,Node>(*eMap1);
998 #ifdef HAVE_XPETRA_TPETRA 999 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \ 1000 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT)))) 1003 typedef Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> sparse_matrix_type;
1004 typedef Tpetra::MatrixMarket::Reader<sparse_matrix_type> reader_type;
1021 return Teuchos::null;
1027 #endif // HAVE_XPETRA_EPETRA 1032 #define XPETRA_IO_SHORT static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=Xpetra::GloballyDistributed, const Teuchos::RCP< Node > &node=defaultArgNode())
Map constructor with Xpetra-defined contiguous uniform distribution.
static Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Read(const std::string &filename, const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > rowMap, RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > colMap=Teuchos::null, const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > domainMap=Teuchos::null, const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > rangeMap=Teuchos::null, const bool callFillComplete=true, const bool binary=false, const bool tolerant=false, const bool debug=false)
Read matrix from file in Matrix Market or binary format.
RCP< CrsMatrix > getCrsMatrix() const
static Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Read(const std::string &filename, const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > rowMap, RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > colMap=Teuchos::null, const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > domainMap=Teuchos::null, const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > rangeMap=Teuchos::null, const bool callFillComplete=true, const bool binary=false, const bool tolerant=false, const bool debug=false)
Read matrix from file in Matrix Market or binary format.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static void Write(const std::string &fileName, const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &M)
Read/Write methods.
static void Write(const std::string &fileName, const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op)
Save matrix to file in Matrix Market format.
Exception throws to report errors in the internal logical of the program.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
static const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > Map2TpetraMap(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map)
Helper utility to pull out the underlying Tpetra objects from an Xpetra object.
static const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > Map2TpetraMap(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map)
Helper utility to pull out the underlying Tpetra objects from an Xpetra object.
virtual const RCP< const Map > & getColMap() const
Returns the Map that describes the column distribution in this matrix. This might be null until fillC...
Exception indicating invalid cast attempted.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
static RCP< const Map > ReadMap(const std::string &fileName, Xpetra::UnderlyingLib lib, const RCP< const Teuchos::Comm< int > > &comm)
static Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Read(const std::string &fileName, Xpetra::UnderlyingLib lib, const RCP< const Teuchos::Comm< int > > &comm, bool binary=false)
Read matrix from file in Matrix Market or binary format.
static RCP< MultiVector > ReadMultiVector(const std::string &fileName, const RCP< const Map > &map)
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const =0
The Map describing the parallel distribution of this object.
void resize(size_type new_size, const value_type &x=value_type())
static RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > ReadMultiVector(const std::string &fileName, const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
RCP< Xpetra::CrsMatrixWrap< SC, LO, GO, NO > > Convert_Epetra_CrsMatrix_ToXpetra_CrsMatrixWrap(RCP< Epetra_CrsMatrix > &epAB)
static Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Read(const std::string &fileName, Xpetra::UnderlyingLib lib, const RCP< const Teuchos::Comm< int > > &comm, bool binary=false)
Read matrix from file in Matrix Market or binary format.
static const Epetra_Map & Map2EpetraMap(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map)
Helper utility to pull out the underlying Epetra objects from an Xpetra object.
Concrete implementation of Xpetra::Matrix.
virtual Teuchos::RCP< const Map > getRangeMap() const =0
The Map associated with the range of this operator, which must be compatible with Y...
static RCP< Matrix > Build(const RCP< const Map > &rowMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying the number of non-zeros for all rows.
virtual const RCP< const Map > & getRowMap() const
Returns the Map that describes the row distribution in this matrix.
static RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > ReadMap(const std::string &fileName, Xpetra::UnderlyingLib lib, const RCP< const Teuchos::Comm< int > > &comm)
static const Epetra_Map & Map2EpetraMap(const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &map)
Helper utility to pull out the underlying Epetra objects from an Xpetra object.
static void Write(const std::string &fileName, const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op)
Save matrix to file in Matrix Market format.
Xpetra utility class containing IO routines to read/write vectors, matrices etc...
static void Write(const std::string &fileName, const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &M)
Read/Write methods.
static void Write(const std::string &fileName, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec)
Save vector to file in Matrix Market format.
static void Write(const std::string &fileName, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec)
Save vector to file in Matrix Market format.
virtual Teuchos::RCP< const Map > getDomainMap() const =0
The Map associated with the domain of this operator, which must be compatible with X...
Xpetra-specific matrix class.
std::string toString(const T &t)