Skip to content

Commit

Permalink
Merge pull request #1 from pnorbert/williamfgc-refactor
Browse files Browse the repository at this point in the history
Fix heatTransfer codes for refactored classes
  • Loading branch information
williamfgc authored Jun 5, 2017
2 parents d96fd39 + e79fc48 commit 0b9fceb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
12 changes: 6 additions & 6 deletions examples/heatTransfer/write/IO_adios2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ IO::IO(const Settings &s, MPI_Comm comm)

// Define method for engine creation

adios::IO &bpWriterSettings = ad->DeclareIO("output");
if (!bpWriterSettings.InConfigFile())
adios::IO &bpio = ad->DeclareIO("output");
if (!bpio.InConfigFile())
{
// if not defined by user, we can change the default settings
// BPFileWriter is the default engine
Expand All @@ -39,11 +39,11 @@ IO::IO(const Settings &s, MPI_Comm comm)
// Passing parameters to the transport
}

varGndx = &bpWriterSettings.DefineVariable<unsigned int>("gndx");
bpWriterSettings.DefineVariable<unsigned int>("gndy");
varGndx = &bpio.DefineVariable<unsigned int>("gndx");
bpio.DefineVariable<unsigned int>("gndy");

// define T as 2D global array
varT = &bpWriterSettings.DefineVariable<double>(
varT = &bpio.DefineVariable<double>(
"T",
// Global dimensions
{s.gndx, s.gndy},
Expand All @@ -58,7 +58,7 @@ IO::IO(const Settings &s, MPI_Comm comm)
// varT.AddTransform( tr,"accuracy=0.001" ); // for ZFP

bpWriter =
bpWriterSettings.Open(m_outputfilename, adios::OpenMode::w, comm);
bpio.Open(m_outputfilename, adios::OpenMode::w, comm);

if (!bpWriter)
{
Expand Down
22 changes: 10 additions & 12 deletions examples/heatTransfer/write/IO_ph5_adios2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,46 +24,44 @@ 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);
ad = new adios::ADIOS(comm, adios::Verbose::INFO, false);
ad = new adios::ADIOS(comm, adios::DebugOFF);

// Define method for engine creation
// 1. Get method def from config file or define new one

adios::Method &h5writerSettings = ad->DeclareMethod("output");
if (!h5writerSettings.IsUserDefined())
adios::IO &h5io = ad->DeclareIO("output");
if (!h5io.InConfigFile())
{
// if not defined by user, we can change the default settings
// BPFileWriter is the default engine
h5writerSettings.SetEngine("HDF5Writer");
h5io.SetEngine("HDF5Writer");
// Allow an extra thread for data processing

const std::string aggregatorsParam("Aggregators=" +
std::to_string((s.nproc + 1) / 2));
h5writerSettings.SetParameters("have_metadata_file=yes",
aggregatorsParam);
h5io.SetParameters("have_metadata_file=yes", aggregatorsParam);
}

// ad->DefineScalar<unsigned int>("gndx", true);
varGndx = &(ad->DefineVariable<unsigned int>("gndx"));
ad->DefineVariable<unsigned int>("gndy");
varGndx = &h5io.DefineVariable<unsigned int>("gndx");
h5io.DefineVariable<unsigned int>("gndy");

// define T as 2D global array
varT = &(ad->DefineArray<double>(
varT = &h5io.DefineVariable<double>(
"T",
// Global dimensions
{s.gndx, s.gndy},
// 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( );
// varT.AddTransform( tr, "" );
// varT.AddTransform( tr,"accuracy=0.001" ); // for ZFP

h5writer = ad->Open(m_outputfilename, "w", comm, h5writerSettings);
h5writer = h5io.Open(m_outputfilename, adios::OpenMode::w, comm);

if (h5writer == nullptr)
throw std::ios_base::failure("ERROR: failed to open ADIOS h5writer\n");
Expand Down

0 comments on commit 0b9fceb

Please sign in to comment.