10#ifndef PACKAGES_XPETRA_SUP_UTILS_XPETRA_IO_HPP_
11#define PACKAGES_XPETRA_SUP_UTILS_XPETRA_IO_HPP_
17#include <Tpetra_RowMatrixTransposer.hpp>
18#include <TpetraExt_MatrixMatrix.hpp>
19#include <Xpetra_TpetraMultiVector.hpp>
20#include <Xpetra_TpetraCrsGraph.hpp>
21#include <Xpetra_TpetraCrsMatrix.hpp>
22#include <Xpetra_TpetraBlockCrsMatrix.hpp>
25#include "Xpetra_Matrix.hpp"
26#include "Xpetra_MatrixMatrix.hpp"
27#include "Xpetra_Helpers.hpp"
29#include "Xpetra_CrsMatrixWrap.hpp"
30#include "Xpetra_BlockedCrsMatrix.hpp"
32#include "Xpetra_Map.hpp"
33#include "Xpetra_StridedMap.hpp"
34#include "Xpetra_StridedMapFactory.hpp"
35#include "Xpetra_MapExtractor.hpp"
36#include "Xpetra_MatrixFactory.hpp"
39#include <Teuchos_MatrixMarket_Raw_Writer.hpp>
40#include <Teuchos_MatrixMarket_Raw_Reader.hpp>
49template <
class Scalar,
50 class LocalOrdinal = int,
51 class GlobalOrdinal = LocalOrdinal,
52 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
127 Read(
const std::string& filename,
132 const bool callFillComplete =
true,
133 const bool binary =
false,
134 const bool tolerant =
false,
135 const bool debug =
false);
150 const bool callFillComplete =
true,
151 const bool binary =
false,
152 const bool tolerant =
false,
153 const bool debug =
false);
159 const bool binary =
false);
164 const bool binary =
false);
169 const bool binary =
false);
188 static std::string
toString(
const T& what);
193#define XPETRA_IO_SHORT
Xpetra utility class containing IO routines to read/write vectors, matrices etc...
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< const Map > ReadMap(const std::string &fileName, Xpetra::UnderlyingLib lib, const RCP< const Teuchos::Comm< int > > &comm, const bool binary=false)
static RCP< MultiVector > ReadMultiVector(const std::string &fileName, const RCP< const Map > &map, const bool binary=false)
Read a MultiVector from file in Matrix Matrix or binary format.
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 void Write(const std::string &fileName, const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > &M)
Read/Write methods.
static RCP< const Xpetra::BlockedCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > ReadBlockedCrsMatrix(const std::string &fileName, Xpetra::UnderlyingLib lib, const RCP< const Teuchos::Comm< int > > &comm)
Read block matrix from one file per block in Matrix Market format.
static Teuchos::RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > ReadLocal(const std::string &filename, const RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > rowMap, RCP< const Xpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > colMap, 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 local files in Matrix Market or binary format.
static void WriteBlockedCrsMatrix(const std::string &fileName, const Xpetra::BlockedCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op, const bool &writeAllMaps=false)
Save block matrix to one file per block in Matrix Market format.
static void WriteGOMV(const std::string &fileName, const Xpetra::MultiVector< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &vec)
Save multivector with Scalar=GlobalOrdinal to file in Matrix Market format.
static void WriteLocal(const std::string &fileName, const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Op)
Save local parts of matrix to files in Matrix Market format.
static RCP< Xpetra::MultiVector< LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node > > ReadMultiVectorLO(const std::string &fileName, const RCP< const Map > &map, const bool binary=false)
Read a MultiVector with Scalar=LocalOrdinal from file in Matrix Matrix or binary format.
static void WriteLOMV(const std::string &fileName, const Xpetra::MultiVector< LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &vec)
Save multivector with Scalar=LocalOrdinal to file in Matrix Market format.
static std::string toString(const T &what)
Little helper function to convert non-string types to strings.
Xpetra-specific matrix class.