Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include "MOR_Hdf5MVOutputFile.hpp"
00007
00008 #include "Epetra_Comm.h"
00009
00010 #include "EpetraExt_HDF5.h"
00011
00012 #include "Teuchos_TestForException.hpp"
00013
00014 #include <stdexcept>
00015
00016 namespace MOR {
00017
00018 using Teuchos::RCP;
00019 using Teuchos::rcp;
00020
00021 Hdf5MVOutputFile::Hdf5MVOutputFile(const std::string &path,
00022 const std::string &groupName) :
00023 MultiVectorOutputFile(path),
00024 groupName_(groupName)
00025 {
00026
00027 }
00028
00029 void Hdf5MVOutputFile::write(const Epetra_MultiVector &mv)
00030 {
00031 #ifdef HAVE_EPETRAEXT_HDF5
00032 const Epetra_Comm &fileComm = mv.Comm();
00033 EpetraExt::HDF5 hdf5Output(fileComm);
00034
00035 hdf5Output.Create(path());
00036
00037 TEUCHOS_TEST_FOR_EXCEPTION(!hdf5Output.IsOpen(),
00038 std::runtime_error,
00039 "Cannot create output file: " + path());
00040
00041 hdf5Output.Write(groupName_, mv);
00042
00043 hdf5Output.Close();
00044 #else
00045 throw std::logic_error("HDF5 support disabled");
00046 #endif
00047 }
00048
00049 }