Exemplo n.º 1
0
void HDF5IO::saveStdVector(const std::string& GroupName, const std::string& Name,
    const std::vector<std::complex<double> >& V)
{
  try{
    H5::CompType ComplexDataType = openCompType("complex");
    hsize_t Dim[1] = {hsize_t(V.size())};
    H5::DataSpace dataspace(1,Dim);
    H5::Group FG = getGroup( GroupName.c_str() );
    try{
      H5::Exception::dontPrint();
      H5::DataSet dataset = FG.openDataSet(Name.c_str());
      dataset.write(V.data(), ComplexDataType, dataspace);
    } catch( const H5::GroupIException not_found_error ){
      H5::DataSet dataset = FG.createDataSet(Name.c_str(), ComplexDataType,
        dataspace);
      dataset.write(V.data(), ComplexDataType);
    } catch( const H5::FileIException error){
      error.printError();
    } catch( const H5::DataSetIException error){
      error.printError();
    }
    FG.close();
  } catch( const H5::Exception err ){
    err.printError();
    RUNTIME_ERROR("HDF5IO::saveComplexStdVector. ");
  }
}
Exemplo n.º 2
0
void HDF5IO::saveNumber(const std::string& GroupName, const std::string& Name,
    ComplexType C)
{
    H5::CompType ComplexDataType = openCompType("complex");
    H5::Group FG = getGroup( GroupName );
    try{
      H5::Exception::dontPrint();
      H5::DataSet dataset = FG.openDataSet(Name.c_str());
      RealType RealImag[2] = {real(C),imag(C)};
      dataset.write(RealImag, ComplexDataType);
    } catch ( const H5::GroupIException not_found_error ){
      H5::DataSet dataset = FG.createDataSet(Name.c_str(), ComplexDataType, H5::DataSpace());
      RealType RealImag[2] = {real(C),imag(C)};
      dataset.write(RealImag, ComplexDataType);
    }
    FG.close();
}
Exemplo n.º 3
0
//--------------------------------------------------------------------------
// Function:	CommonFG::openCompType
///\brief	This is an overloaded member function, provided for convenience.
///		It differs from the above function in that it takes an
///		\c H5std_string for \a name.
// Programmer	Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
CompType CommonFG::openCompType( const H5std_string& name ) const
{
   return( openCompType( name.c_str()) );
}