diff --git a/examples/heatTransfer/write/IO_ph5_adios2.cpp b/examples/heatTransfer/write/IO_ph5_adios2.cpp index a4b37c5dc466eba83a2d60a2f1918ecdd421adef..abed29d13712e1da144744f01879724122f4d8c5 100644 --- a/examples/heatTransfer/write/IO_ph5_adios2.cpp +++ b/examples/heatTransfer/write/IO_ph5_adios2.cpp @@ -24,7 +24,7 @@ IO::IO(const Settings &s, MPI_Comm comm) { rank_saved = s.rank; m_outputfilename = s.outputfile + ".h5"; - //adios::ADIOS adios(comm, adios::Verbose::INFO, false); + // adios::ADIOS adios(comm, adios::Verbose::INFO, false); ad = new adios::ADIOS(comm, adios::Verbose::INFO, false); // Define method for engine creation @@ -36,7 +36,7 @@ IO::IO(const Settings &s, MPI_Comm comm) // if not defined by user, we can change the default settings // BPFileWriter is the default engine h5writerSettings.SetEngine("HDF5Writer"); - // Allow an extra thread for data processing + // Allow an extra thread for data processing const std::string aggregatorsParam("Aggregators=" + std::to_string((s.nproc + 1) / 2)); @@ -56,7 +56,7 @@ IO::IO(const Settings &s, MPI_Comm comm) // starting offset of the local array in the global space {s.offsx, s.offsy}, // local size, could be defined later using SetSelection() - {s.ndx, s.ndy})); + {s.ndx, s.ndy})); // add transform to variable // adios::Transform tr = adios::transform::BZIP2( ); @@ -72,7 +72,7 @@ IO::IO(const Settings &s, MPI_Comm comm) IO::~IO() { h5writer->Close(); - //delete ad; + // delete ad; } void IO::write(int step, const HeatTransfer &ht, const Settings &s, @@ -86,8 +86,8 @@ void IO::write(int step, const HeatTransfer &ht, const Settings &s, // Make a selection to describe the local dimensions of the variable we // write and its offsets in the global spaces. This could have been done in // adios.DefineVariable() - //adios::SelectionBoundingBox sel({s.offsx, s.offsy}, {s.ndx, s.ndy}); - //varT->SetSelection(sel); + // adios::SelectionBoundingBox sel({s.offsx, s.offsy}, {s.ndx, s.ndy}); + // varT->SetSelection(sel); /* Select the area that we want to write from the data pointer we pass to the @@ -100,12 +100,12 @@ void IO::write(int step, const HeatTransfer &ht, const Settings &s, above. Default memspace is always the full selection. */ - //adios::SelectionBoundingBox memspace = + // adios::SelectionBoundingBox memspace = // adios::SelectionBoundingBox({1, 1}, {s.ndx, s.ndy}); - //varT->SetMemorySelection(memspace); + // varT->SetMemorySelection(memspace); h5writer->Write<double>(*varT, ht.data_noghost().data()); - //h5writer->Write(*varT, ht.data_noghost().data()); + // h5writer->Write(*varT, ht.data_noghost().data()); h5writer->Write<unsigned int>(*varGndx, s.gndx); h5writer->Write<unsigned int>("gndy", s.gndy); diff --git a/source/adios2/engine/hdf5/HDF5WriterP.cpp b/source/adios2/engine/hdf5/HDF5WriterP.cpp index 6969c4a40138bd44924dd75ddc206bdf50b9d0c0..acd523feca71fa7e9c59e006178b7efdf73a05da 100644 --- a/source/adios2/engine/hdf5/HDF5WriterP.cpp +++ b/source/adios2/engine/hdf5/HDF5WriterP.cpp @@ -23,7 +23,7 @@ HDF5Writer::HDF5Writer(ADIOS &adios, const std::string name, : Engine(adios, "HDF5Writer", name, accessMode, mpiComm, method, /*debugMode, cores,*/ " HDF5Writer constructor (or call to ADIOS Open).\n") - //m_Buffer(m_DebugMode) +// m_Buffer(m_DebugMode) { Init(); } @@ -256,17 +256,20 @@ void HDF5Writer::UseHDFWrite(Variable<T> &variable, const T *values, int dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size()); - if (dimSize == 0) { - // scalar - hid_t filespaceID = H5Screate(H5S_SCALAR); - hid_t dsetID = H5Dcreate(m_H5File.m_GroupId, variable.m_Name.c_str(), h5Type, filespaceID, - H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - herr_t status = H5Dwrite(dsetID, h5Type, H5S_ALL, H5S_ALL, H5P_DEFAULT, values); - - H5Sclose (filespaceID); - H5Dclose (dsetID); - - return; + if (dimSize == 0) + { + // scalar + hid_t filespaceID = H5Screate(H5S_SCALAR); + hid_t dsetID = + H5Dcreate(m_H5File.m_GroupId, variable.m_Name.c_str(), h5Type, + filespaceID, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + herr_t status = + H5Dwrite(dsetID, h5Type, H5S_ALL, H5S_ALL, H5P_DEFAULT, values); + + H5Sclose(filespaceID); + H5Dclose(dsetID); + + return; } std::vector<hsize_t> dimsf, count, offset; diff --git a/source/adios2/engine/hdf5/HDF5WriterP.h b/source/adios2/engine/hdf5/HDF5WriterP.h index d4c4d217e4afd56fc392eba8d68acf481febfe7a..3ab1b970ec75231a04537a74d9ad97967af8dd75 100644 --- a/source/adios2/engine/hdf5/HDF5WriterP.h +++ b/source/adios2/engine/hdf5/HDF5WriterP.h @@ -91,7 +91,7 @@ public: private: ///< heap capsule, contains data and metadata buffers - //capsule::STLVector m_Buffer; + // capsule::STLVector m_Buffer; void Init();