Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal > Class Template Reference

Tool for debugging the syntax of a Matrix Market file containing a sparse matrix. More...

#include <Teuchos_MatrixMarket_Raw_Checker.hpp>

Public Member Functions

 Checker (const bool echo, const bool tolerant, const bool debug)
 Constructor that takes Boolean parameters. More...
 
 Checker ()
 Constructor that sets default Boolean parameters. More...
 
 Checker (const RCP< ParameterList > &params)
 Constructor that takes a ParameterList of parameters. More...
 
void setParameters (const RCP< ParameterList > &params)
 Set parameters from the given ParameterList. More...
 
RCP< const ParameterListgetValidParameters () const
 
bool readFile (const Teuchos::Comm< int > &comm, const std::string &filename)
 Read the sparse matrix from the given file. More...
 
bool read (const Teuchos::Comm< int > &comm, const RCP< std::istream > &in)
 Read the sparse matrix from the given input stream. More...
 

Private Member Functions

RCP< const
Teuchos::MatrixMarket::Banner
readBanner (std::istream &in, size_t &lineNumber)
 Read in the Banner line from the given input stream. More...
 
std::pair< bool, std::string > readOnRank0 (std::istream &in)
 Read the sparse matrix on MPI Rank 0. More...
 
void reportBadness (std::ostream &out, const std::pair< bool, std::vector< size_t > > &results)
 To be called only on MPI Rank 0. More...
 

Private Attributes

bool echo_
 Whether to echo the sparse matrix to stdout after reading it. More...
 
bool tolerant_
 Whether to parse the Matrix Market file tolerantly. More...
 
bool debug_
 Whether to print debugging output to stderr. More...
 

Detailed Description

template<class Scalar, class Ordinal>
class Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >

Tool for debugging the syntax of a Matrix Market file containing a sparse matrix.

Template Parameters
ScalarThe type of entries of the sparse matrix.
OrdinalThe type of indices of the sparse matrix.

This class is useful for checking the integrity of a Matrix Market sparse matrix file and printing its contents. For reading a sparse matrix from a Matrix Market file into raw compressed sparse row (CSR) arrays on a single (MPI) process, use the Reader class. For reading in a Tpetra::CrsMatrix, use the Tpetra::MatrixMarket::Reader class.

Definition at line 36 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

Constructor & Destructor Documentation

template<class Scalar , class Ordinal >
Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::Checker ( const bool  echo,
const bool  tolerant,
const bool  debug 
)
inline

Constructor that takes Boolean parameters.

Parameters
echo[in] Whether to echo the sparse matrix to stdout on MPI Process 0, after reading the sparse matrix.
tolerant[in] Whether to parse the Matrix Market files tolerantly.
debug[in] Whether to print debugging output to stderr. This will happen on all MPI processes, so it could be a lot of output.

Definition at line 47 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::Checker ( )
inline

Constructor that sets default Boolean parameters.

Definition at line 52 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::Checker ( const RCP< ParameterList > &  params)
inline

Constructor that takes a ParameterList of parameters.

Parameters (all of them have type bool, all default to false):

  • "Echo to stdout": Whether to echo the sparse matrix to stdout on MPI Process 0, after reading the sparse matrix.
  • "Parse tolerantly": Whether to parse Matrix Market files tolerantly.
  • "Debug mode" Whether to print debugging output to stderr. This will happen on all MPI processes, so it could be a lot of output.

Definition at line 66 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

Member Function Documentation

template<class Scalar , class Ordinal >
void Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::setParameters ( const RCP< ParameterList > &  params)
inline

Set parameters from the given ParameterList.

See constructor documentation for the accepted parameters.

Definition at line 76 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
RCP<const ParameterList> Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::getValidParameters ( ) const
inline

Definition at line 96 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
bool Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::readFile ( const Teuchos::Comm< int > &  comm,
const std::string &  filename 
)
inline

Read the sparse matrix from the given file.

This is a collective operation. Only MPI Process 0 opens the file and reads data from it, but all ranks participate and wait for the final result.

Note
This whole "raw" reader is meant for debugging and diagnostics of syntax errors in the Matrix Market file; it's not performance-oriented. That's why we do all the broadcasts of and checks for "success".

Definition at line 126 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
bool Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::read ( const Teuchos::Comm< int > &  comm,
const RCP< std::istream > &  in 
)
inline

Read the sparse matrix from the given input stream.

This is a collective operation. Only MPI Process 0 reads from the given input stream, but all MPI processes participate and wait for the final result.

Note
This whole "raw" reader is meant for debugging and diagnostics of syntax errors in the Matrix Market file; it's not performance-oriented. That's why we do all the broadcasts of and checks for "success".

Definition at line 176 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
RCP<const Teuchos::MatrixMarket::Banner> Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::readBanner ( std::istream &  in,
size_t &  lineNumber 
)
inlineprivate

Read in the Banner line from the given input stream.

Warning
Only call this method on MPI Process 0.
Parameters
in[in/out] Input stream from which to read the Banner line. This must be valid on the calling process.
lineNumber[in/out] On input: Current line number of the input stream. On output: if any line(s) were successfully read from the input stream, this is incremented by the number of line(s) read. (This includes comment lines.)
Returns
The Matrix Market file's Banner line (never null).

Definition at line 270 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
std::pair<bool, std::string> Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::readOnRank0 ( std::istream &  in)
inlineprivate

Read the sparse matrix on MPI Rank 0.

Warning
To be called only on MPI Rank 0.
Parameters
in[in/out] The input stream from which to read. This must be valid on the calling process.
Returns
First value: Whether reading was successful. If false, the second value is the error message.

Definition at line 333 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
void Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::reportBadness ( std::ostream &  out,
const std::pair< bool, std::vector< size_t > > &  results 
)
inlineprivate

To be called only on MPI Rank 0.

Definition at line 477 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

Member Data Documentation

template<class Scalar , class Ordinal >
bool Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::echo_
private

Whether to echo the sparse matrix to stdout after reading it.

Definition at line 249 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
bool Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::tolerant_
private

Whether to parse the Matrix Market file tolerantly.

Definition at line 251 of file Teuchos_MatrixMarket_Raw_Checker.hpp.

template<class Scalar , class Ordinal >
bool Teuchos::MatrixMarket::Raw::Checker< Scalar, Ordinal >::debug_
private

Whether to print debugging output to stderr.

Definition at line 253 of file Teuchos_MatrixMarket_Raw_Checker.hpp.


The documentation for this class was generated from the following file: