Tpetra Matrix/Vector Services Version of the Day
Public Member Functions
Tpetra::MatrixMarket::CoordDataReader< Callback, Ordinal, Scalar, isComplex > Class Template Reference

Coordinate-format sparse matrix data reader. More...

#include <MatrixMarket_CoordDataReader.hpp>

Inheritance diagram for Tpetra::MatrixMarket::CoordDataReader< Callback, Ordinal, Scalar, isComplex >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~CoordDataReader ()
 Virtual destructor for safety and happy compilers.
bool readLine (const std::string &theLine, Ordinal &rowIndex, Ordinal &colIndex, Scalar &value, const size_t lineNumber, const bool tolerant)
 Read in the data from a single line of the input stream.
void setAdder (const RCP< Callback > &adder)
 Set the Adder object.
std::pair< bool, std::vector
< size_t > > 
read (std::istream &in, const size_t startingLineNumber, const bool tolerant, const bool debug=false)
 Read in all the data from the given input stream.
std::pair< Tuple< Ordinal, 3 >
, bool > 
readDimensions (std::istream &in, size_t &lineNumber, const bool tolerant=false)
 Read (numRows, numCols, numNonzeros).

Detailed Description

template<class Callback, class Ordinal, class Scalar, bool isComplex = ScalarTraits<Scalar>::isComplex>
class Tpetra::MatrixMarket::CoordDataReader< Callback, Ordinal, Scalar, isComplex >

Coordinate-format sparse matrix data reader.

This class completes the implementation of CoordDataReaderBase. There are two concrete specializations: one for real-valued data, and the other for complex-valued data.

Definition at line 371 of file MatrixMarket_CoordDataReader.hpp.


Constructor & Destructor Documentation

template<class Callback , class Ordinal , class Scalar , bool isComplex = ScalarTraits<Scalar>::isComplex>
virtual Tpetra::MatrixMarket::CoordDataReader< Callback, Ordinal, Scalar, isComplex >::~CoordDataReader ( ) [virtual]

Virtual destructor for safety and happy compilers.


Member Function Documentation

template<class Callback , class Ordinal , class Scalar , bool isComplex = ScalarTraits<Scalar>::isComplex>
bool Tpetra::MatrixMarket::CoordDataReader< Callback, Ordinal, Scalar, isComplex >::readLine ( const std::string &  theLine,
Ordinal &  rowIndex,
Ordinal &  colIndex,
Scalar &  value,
const size_t  lineNumber,
const bool  tolerant 
) [virtual]

Read in the data from a single line of the input stream.

This method has a different implementation, depending on whether Scalar is complex or not.

Implements Tpetra::MatrixMarket::CoordDataReaderBase< Callback, Ordinal, Scalar, isComplex >.

template<class Callback, class Ordinal, class Scalar, bool isComplex = ScalarTraits<Scalar>::isComplex>
void Tpetra::MatrixMarket::CoordDataReaderBase< Callback, Ordinal, Scalar, isComplex >::setAdder ( const RCP< Callback > &  adder) [inline, inherited]

Set the Adder object.

Please don't call this after calling read() or readLine(). The right time to call this is right after calling the no-argument constructor, if it's not possible to supply an Adder object before calling readDimensions().

Definition at line 94 of file MatrixMarket_CoordDataReader.hpp.

template<class Callback, class Ordinal, class Scalar, bool isComplex = ScalarTraits<Scalar>::isComplex>
std::pair<bool, std::vector<size_t> > Tpetra::MatrixMarket::CoordDataReaderBase< Callback, Ordinal, Scalar, isComplex >::read ( std::istream &  in,
const size_t  startingLineNumber,
const bool  tolerant,
const bool  debug = false 
) [inline, inherited]

Read in all the data from the given input stream.

Parameters:
in[in/out] The input stream from which to read
startingLineNumber[in] The line number of the file from which we begin reading. (This is used for informative error output, if an error is detected in the file.)
tolerant[in] If true, parse tolerantly. The resulting read-in data may be incorrect, but the parser won't throw an exception if it can just let bad data through and continue.
debug[in] If true, print verbose debugging output.

Definition at line 127 of file MatrixMarket_CoordDataReader.hpp.

template<class Callback, class Ordinal, class Scalar, bool isComplex = ScalarTraits<Scalar>::isComplex>
std::pair<Tuple<Ordinal, 3>, bool> Tpetra::MatrixMarket::CoordDataReaderBase< Callback, Ordinal, Scalar, isComplex >::readDimensions ( std::istream &  in,
size_t &  lineNumber,
const bool  tolerant = false 
) [inline, inherited]

Read (numRows, numCols, numNonzeros).

Read one line from the given input stream, and parse it into the number of rows, the number of columns, and the number of nonzeros in the sparse matrix. We assume that those data are in whitespace-delimited format and are read from a Matrix Market - format file.

Parameters:
in[in/out] The input stream from which to attempt to read one line.
lineNumberThe starting line number from which we begin reading from the input stream. Used for diagnostic error output.
tolerant[in] Whether to read "tolerantly" (setting defaults and returning whether we were successful) or "intolerantly" (throwing an exception on any deviation from the expected format).
Returns:
((numRows, numCols, numNonzeros), success). In tolerant mode, success may be false, meaning that the read-in triple may not be valid.

Definition at line 202 of file MatrixMarket_CoordDataReader.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines