EpetraExt Package Browser (Single Doxygen Collection)  Development
Private Attributes | List of all members
EpetraExt::XMLReader Class Reference

class XMLReader: A class for reading Epetra objects stored in XML files. More...

#include <EpetraExt_XMLReader.h>

Private Attributes

bool IsOpen_
 If true, then the file has been successfully opened. More...
 
const Epetra_CommComm_
 Communicator object. More...
 
Teuchos::RCP< Teuchos::XMLObjectfileXML_
 parsed XML object. More...
 
 XMLReader (const Epetra_Comm &Comm, const std::string &FileName)
 ctor More...
 
 ~XMLReader ()
 dtor More...
 
void Read (const std::string &Label, Epetra_Map *&Map)
 Reads the Epetra_Map stored with label Label. More...
 
void Read64 (const std::string &Label, Epetra_Map *&Map)
 Reads the Epetra_Map stored with label Label. Long Long version. More...
 
void Read (const std::string &Label, Epetra_CrsGraph *&Graph)
 Reads the Epetra_CrsGraph stored with label Label. More...
 
void Read64 (const std::string &Label, Epetra_CrsGraph *&Graph)
 Reads the Epetra_CrsGraph stored with label Label. Long Long version. More...
 
void Read (const std::string &Label, Epetra_CrsMatrix *&Matrix)
 Reads the Epetra_CrsMatrix stored with label Label. More...
 
void Read64 (const std::string &Label, Epetra_CrsMatrix *&Matrix)
 Reads the Epetra_CrsMatrix stored with label Label. Long Long version. More...
 
void Read (const std::string &Label, Epetra_MultiVector *&MultiVector)
 Reads the Epetra_MultiVector stored with label Label. More...
 
void Read64 (const std::string &Label, Epetra_MultiVector *&MultiVector)
 Reads the Epetra_MultiVector stored with label Label. Long Long version. More...
 
void Read (const std::string &Label, std::vector< std::string > &Content)
 Reads a std::vector of strings with label Label. More...
 
void Read (const std::string &Label, Teuchos::ParameterList &List)
 Reads the Teuchos::ParameterList stored with label Label. More...
 

Detailed Description

class XMLReader: A class for reading Epetra objects stored in XML files.

Class EpetraExt::XMLReader allows to read several Trilinos objects stored in XML files. The XML data format is specified in the documentation of class EpetraExt::XMLWriter, which also contains a MATLAB script. A typical usage of this class is reported in file epetraext/example/inout/XML_IO.cpp.

This class requires Teuchos to be configured with the option –enable-teuchos-expat.

Reading objects from a file requires the following steps. First, we define an XMLReader object,

EpetraExt::XMLReader XMLReader(Comm, "data.xml");

Then, we define a set of pointers,

Epetra_Map* MyMap;
Epetra_CrsMatrix* MyMatrix;
std::vector<std::string> Author;
std::vector<std::string> Date;
std::vector<std::string> MyContent;

Reading simply goes as follows:

XMLReader.Read("Author", Author);
XMLReader.Read("Date", Date);
XMLReader.Read("MyMap", MyMap);
XMLReader.Read("MyMatrix", MyMatrix);
XMLReader.Read("MyLHS", MyLHS);
XMLReader.Read("MyRHS", MyRHS);
XMLReader.Read("MyContent", MyContent);
XMLReader.Read("MyParameters", MyParameters);

In distributed environments, Epetra_MultiVector, Epetra_CrsGraph and Epetra_CrsMatrix objects have a linear distribution. Epetra_Map objects can be read only when using the same number of processors used for writing.

Warning
All the created objects must be deleted from the user using delete.
Author
Marzio Sala, D-INFK/ETHZ
Date
Last updated on 10-May-06.

Definition at line 112 of file EpetraExt_XMLReader.h.

Constructor & Destructor Documentation

◆ XMLReader()

EpetraExt::XMLReader::XMLReader ( const Epetra_Comm Comm,
const std::string &  FileName 
)

ctor

Definition at line 96 of file EpetraExt_XMLReader.cpp.

◆ ~XMLReader()

EpetraExt::XMLReader::~XMLReader ( )
inline

dtor

Definition at line 120 of file EpetraExt_XMLReader.h.

Member Function Documentation

◆ Read() [1/6]

void EpetraExt::XMLReader::Read ( const std::string &  Label,
Epetra_Map *&  Map 
)

Reads the Epetra_Map stored with label Label.

Definition at line 462 of file EpetraExt_XMLReader.cpp.

◆ Read64() [1/4]

void EpetraExt::XMLReader::Read64 ( const std::string &  Label,
Epetra_Map *&  Map 
)

Reads the Epetra_Map stored with label Label. Long Long version.

Definition at line 530 of file EpetraExt_XMLReader.cpp.

◆ Read() [2/6]

void EpetraExt::XMLReader::Read ( const std::string &  Label,
Epetra_CrsGraph *&  Graph 
)

Reads the Epetra_CrsGraph stored with label Label.

Definition at line 113 of file EpetraExt_XMLReader.cpp.

◆ Read64() [2/4]

void EpetraExt::XMLReader::Read64 ( const std::string &  Label,
Epetra_CrsGraph *&  Graph 
)

Reads the Epetra_CrsGraph stored with label Label. Long Long version.

Definition at line 162 of file EpetraExt_XMLReader.cpp.

◆ Read() [3/6]

void EpetraExt::XMLReader::Read ( const std::string &  Label,
Epetra_CrsMatrix *&  Matrix 
)

Reads the Epetra_CrsMatrix stored with label Label.

Definition at line 226 of file EpetraExt_XMLReader.cpp.

◆ Read64() [3/4]

void EpetraExt::XMLReader::Read64 ( const std::string &  Label,
Epetra_CrsMatrix *&  Matrix 
)

Reads the Epetra_CrsMatrix stored with label Label. Long Long version.

Definition at line 278 of file EpetraExt_XMLReader.cpp.

◆ Read() [4/6]

void EpetraExt::XMLReader::Read ( const std::string &  Label,
Epetra_MultiVector *&  MultiVector 
)

Reads the Epetra_MultiVector stored with label Label.

Definition at line 344 of file EpetraExt_XMLReader.cpp.

◆ Read64() [4/4]

void EpetraExt::XMLReader::Read64 ( const std::string &  Label,
Epetra_MultiVector *&  MultiVector 
)

Reads the Epetra_MultiVector stored with label Label. Long Long version.

Definition at line 403 of file EpetraExt_XMLReader.cpp.

◆ Read() [5/6]

void EpetraExt::XMLReader::Read ( const std::string &  Label,
std::vector< std::string > &  Content 
)

Reads a std::vector of strings with label Label.

Definition at line 609 of file EpetraExt_XMLReader.cpp.

◆ Read() [6/6]

void EpetraExt::XMLReader::Read ( const std::string &  Label,
Teuchos::ParameterList List 
)

Reads the Teuchos::ParameterList stored with label Label.

Definition at line 636 of file EpetraExt_XMLReader.cpp.

Member Data Documentation

◆ IsOpen_

bool EpetraExt::XMLReader::IsOpen_
private

If true, then the file has been successfully opened.

Definition at line 174 of file EpetraExt_XMLReader.h.

◆ Comm_

const Epetra_Comm& EpetraExt::XMLReader::Comm_
private

Communicator object.

Definition at line 176 of file EpetraExt_XMLReader.h.

◆ fileXML_

Teuchos::RCP<Teuchos::XMLObject> EpetraExt::XMLReader::fileXML_
private

parsed XML object.

Definition at line 178 of file EpetraExt_XMLReader.h.


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