66 int main (
int argc,
char **argv)
69 MPI_Init(&argc, &argv);
92 List.
set(
"int parameter", 10);
93 List.
set(
"double parameter", 10.0);
94 List.
set(
"std::string parameter",
"std::string");
102 std::vector<std::string> Content;
103 Content.push_back(
"This is an example of description");
104 Content.push_back(
"The description is as long as desired,");
105 Content.push_back(
"just put it in a std::vector of strings.");
107 XMLWriter.
Create(
"MyProblem");
108 XMLWriter.
Write(
"Author",
"myself and others");
109 XMLWriter.
Write(
"Date",
"May 2006");
110 XMLWriter.
Write(
"MyMap", Map);
111 XMLWriter.
Write(
"MyMatrix", Matrix);
112 XMLWriter.
Write(
"MyLHS", x);
113 XMLWriter.
Write(
"MyRHS", b);
114 XMLWriter.
Write(
"MyContent", Content);
115 XMLWriter.
Write(
"MyParameters", List);
129 std::vector<std::string> Author;
130 std::vector<std::string> Date;
131 std::vector<std::string> MyContent;
133 XMLReader.
Read(
"Author", Author);
134 XMLReader.
Read(
"Date", Date);
135 XMLReader.
Read(
"MyMap", MyMap);
136 XMLReader.
Read(
"MyMatrix", MyMatrix);
137 XMLReader.
Read(
"MyLHS", MyLHS);
138 XMLReader.
Read(
"MyRHS", MyRHS);
139 XMLReader.
Read(
"MyContent", MyContent);
140 XMLReader.
Read(
"MyParameters", MyParameters);
143 std::cout << *MyMatrix;
146 if (Comm.
MyPID() == 0)
148 int Msize = (int) MyContent.size();
149 for (
int i = 0; i < Msize; ++i)
150 std::cout << MyContent[i] << std::endl;
152 std::cout << MyParameters;
153 std::cout <<
"Author = " << Author[0] << std::endl;
154 std::cout <<
"Date = " << Date[0] << std::endl;
166 return(EXIT_SUCCESS);
class XMLWriter: A class for writing Trilinos objects to XML files.
void Read(const std::string &Label, Epetra_Map *&Map)
Reads the Epetra_Map stored with label Label.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual int InsertGlobalValues(int GlobalRow, int NumEntries, const double *Values, const int *Indices)
int FillComplete(bool OptimizeDataStorage=true)
int main(int argc, char **argv)
int NumMyElements() const
void Create(const std::string &Label)
Creates the file, giving Label to the whole object.
void Close()
Closes the file. No Write operations can follow.
void Write(const std::string &Label, const Epetra_Map &Map)
Writes an Epetra_Map using label Label.
class XMLReader: A class for reading Epetra objects stored in XML files.