Example #1
0
void H5input::ReadFields(double ***field, std::string fname, int nx, int ny, int nz, int rank){

  h5_float64_t*     buffer;

  buffer = new h5_float64_t[nz*ny*nx];

  H5Block3dReadScalarFieldFloat64(fldsfile, fname.c_str(), buffer);

  std::ofstream myfile;

  if (rank!=-1) {
    std::stringstream  ss;
    ss << "proc-" << rank << ".txt";
    std::string filename = ss.str();
    myfile.open(filename.c_str());
  }

  int n = 0;
  for (int k=1; k<nz-1; k++) {
    for (int j=1; j<ny-1; j++) {
      for (int i=1; i<nx-1; i++) {
        field[i][j][k] = buffer[n++];
        if (rank!=-1) myfile << i << " " << j << " " << k << " : " << field[i][j][k] << std::endl;
      }
    }
  }
  if (rank!=-1) myfile.close();

  delete [] buffer;
}
Example #2
0
h5part_int64_t
h5bl_3d_read_scalar_field_r8 (
	h5part_int64_t *f,
	const char *field_name,
	h5part_float64_t *data,
	const int l_field_name
	) {

	H5PartFile *filehandle = (H5PartFile*)(size_t)*f;

	char *field_name2 =  _H5Part_strdupfor2c ( field_name,  l_field_name );

	h5part_int64_t herr = H5Block3dReadScalarFieldFloat64 (
		filehandle, field_name2, data );

	free ( field_name2 );
	return herr;
}