• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

MOR_Hdf5MVOutputFile.cpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
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   // Nothing to do
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()); // Truncate existing file if necessary
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 /* HAVE_EPETRAEXT_HDF5 */
00045   throw std::logic_error("HDF5 support disabled");
00046 #endif /* HAVE_EPETRAEXT_HDF5 */
00047 }
00048 
00049 } // namespace MOR

Generated on Wed Mar 26 2014 18:36:40 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1