75 int main (
int argc,
char **argv)
78 MPI_Init(&argc, &argv);
84 if (Comm.
MyPID() == 0)
86 cout <<
"Converter from MatrixMarket files to HDF5 files" << endl;
87 cout <<
"For notes on the usage, execute" << endl;
88 cout <<
" ./HDF5Converter.exe --help" << endl;
95 string MapFileName =
"not-set";
96 string XFileName =
"not-set";
97 string BFileName =
"not-set";
98 string MatrixFileName =
"not-set";
99 string HDF5FileName =
"myfile.f5";
100 string MapHDF5Name =
"map";
101 string XHDF5Name =
"X";
102 string BHDF5Name =
"B";
103 string MatrixHDF5Name =
"matrix";
105 CLP.
setOption(
"in-map", &MapFileName,
"map file name");
106 CLP.
setOption(
"in-matrix", &MatrixFileName,
"matrix file name");
107 CLP.
setOption(
"in-x", &XFileName,
"x vector file name");
108 CLP.
setOption(
"in-b", &BFileName,
"b vector file name");
109 CLP.
setOption(
"output", &HDF5FileName,
"name of HDF5 file");
110 CLP.
setOption(
"out-map", &MapHDF5Name,
"map name in HDF5 file");
111 CLP.
setOption(
"out-matrix", &MatrixHDF5Name,
"matrix name in HDF5 file");
112 CLP.
setOption(
"out-x", &XHDF5Name,
"x vector name in HDF5 file");
113 CLP.
setOption(
"out-b", &BHDF5Name,
"b vector name in HDF5 file");
116 CLP.
parse(argc,argv);
123 if (MapFileName !=
"not-set")
125 if (Comm.
MyPID() == 0)
126 cout <<
"Reading map from " << MapFileName << endl;
132 cerr <<
"You need to specify a map, sorry" << endl;
139 if (XFileName !=
"not-set")
141 if (Comm.
MyPID() == 0)
142 cout <<
"Reading vector from " << XFileName << endl;
147 if (BFileName !=
"not-set")
149 if (Comm.
MyPID() == 0)
150 cout <<
"Reading vector from " << BFileName << endl;
155 if (MatrixFileName !=
"not-set")
157 if (Comm.
MyPID() == 0)
158 cout <<
"Reading matrix from " << MatrixFileName << endl;
169 HDF5.
Create(HDF5FileName);
174 HDF5.
Write(MatrixHDF5Name, *Matrix);
176 HDF5.
Write(XHDF5Name, *X);
178 HDF5.
Write(BHDF5Name, *B);
182 if (Matrix)
delete Matrix;
190 return(EXIT_SUCCESS);
void Write(const std::string &GroupName, const std::string &DataSetName, int data)
Write an integer in group GroupName using the given DataSetName.
int MatrixMarketFileToMultiVector(const char *filename, const Epetra_BlockMap &map, Epetra_MultiVector *&A)
Constructs an Epetra_MultiVector object from a Matrix Market format file.
int main(int argc, char **argv)
int MatrixMarketFileToCrsMatrix(const char *filename, const Epetra_Comm &comm, Epetra_CrsMatrix *&A)
void setOption(const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL)
int MatrixMarketFileToMap(const char *filename, const Epetra_Comm &comm, Epetra_Map *&map)
Constructs an Epetra_BlockMap object from a Matrix Market format file.
EParseCommandLineReturn parse(int argc, char *argv[], std::ostream *errout=&std::cerr) const
void throwExceptions(const bool &throwExceptions)
class HDF5: A class for storing Epetra objects in parallel binary files
void Close()
Close the file.
void Create(const std::string FileName)
Create a new file.
std::string toString(const int &x)