Skip to content

Commit

Permalink
Merge pull request #624 from drroe/data_3d_read
Browse files Browse the repository at this point in the history
Fixes for reading and writing 3D (grid) data sets
  • Loading branch information
drroe committed Jul 27, 2018
2 parents 93f534f + d54bc21 commit 1811cfb
Show file tree
Hide file tree
Showing 20 changed files with 2,333 additions and 45 deletions.
17 changes: 17 additions & 0 deletions src/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,23 @@ CpptrajState::RetType Command::ExecuteCommand( CpptrajState& State, ArgList cons
break;
}
}
# ifdef MPI
// Check that everyone had same return value from command
int iret = (int)ret_val;
std::vector<int> rvals(Parallel::World().Size(), 0);
Parallel::World().AllGather(&iret, 1, MPI_INT, &rvals[0]);
for (std::vector<int>::const_iterator it = rvals.begin(); it != rvals.end(); ++it)
{
if (*it != rvals.front()) {
// This thread had a return value different than thread 0 - notify and
// set the overall return value to error.
mprinterr("Internal Error: Thread %u command return value %i differs from world master %i\n",
it-rvals.begin(), *it, rvals.front());
ret_val = CpptrajState::ERR;
}
}
Parallel::World().Barrier();
# endif
return ret_val;
}

Expand Down
6 changes: 1 addition & 5 deletions src/DataIO_OpenDx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bool DataIO_OpenDx::ID_DataFormat( CpptrajFile& infile ) {
int DataIO_OpenDx::ReadData(FileName const& fname,
DataSetList& datasetlist, std::string const& dsname)
{
// TODO append?
// Add grid data set. Default to float for now.
DataSet* ds = datasetlist.AddSet( DataSet::GRID_FLT, dsname, "GRID" );
if (ds==0) return 1;
Expand Down Expand Up @@ -148,11 +149,6 @@ int DataIO_OpenDx::LoadGrid(const char* filename, DataSet& ds)
}
progress.Update( ndata );
}
// Set dimensions
// FIXME: This should be integrated with allocation
//grid.SetDim(Dimension::X, Dimension(oxyz[0], dx, nx, "X"));
//grid.SetDim(Dimension::Y, Dimension(oxyz[1], dy, ny, "Y"));
//grid.SetDim(Dimension::Z, Dimension(oxyz[2], dz, nz, "Z"));
return 0;
}

Expand Down

0 comments on commit 1811cfb

Please sign in to comment.