From 3ce1695c749532d97e1a39e2cefe0f16a44946e5 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 1 Mar 2012 21:37:15 -0500 Subject: CarpetIOF5: Make outputting scalars and CCTK_INT variables work --- CarpetDev/CarpetIOF5/src/output.cc | 118 ++++++++++++++++++++++++------------- 1 file changed, 78 insertions(+), 40 deletions(-) (limited to 'CarpetDev') diff --git a/CarpetDev/CarpetIOF5/src/output.cc b/CarpetDev/CarpetIOF5/src/output.cc index b35d43775..36ff01335 100644 --- a/CarpetDev/CarpetIOF5/src/output.cc +++ b/CarpetDev/CarpetIOF5/src/output.cc @@ -364,7 +364,9 @@ namespace CarpetIOF5 { F5_FORTRAN_ORDER); assert (charts.at(mi.dim)); } - hid_t const type = charts.at(mi.dim)->DoublePrecision.Point_hid_t; + // hid_t const type = charts.at(mi.dim)->DoublePrecision.Point_hid_t; + hid_t const type = path->myChart->DoublePrecision.Point_hid_t; + assert (type); FAILWARN (F5Fwrite_linear (path, FIBER_HDF5_POSITIONS_STRING, mi.dim, &v2h(mi.gsh)[0], type, @@ -395,23 +397,25 @@ namespace CarpetIOF5 { fragmentname = generate_fragmentname(cctkGH, Carpet::map, component); - // Define coordinates - // TODO: also define and use is_cartesian for each map - if (not is_multipatch and group_type == CCTK_GF) { - // (This is redundant, since the level's overall bounding box - // was already defined above, but it provides the individual - // components' bounding boxes.) - component_indices_t const ci(cctkGH, group_index); - FAILWARN (F5Fwrite_linear_fraction (path, FIBER_HDF5_POSITIONS_STRING, - ci.dim, - &v2h(ci.gsh)[0], &v2h(ci.ilen)[0], - F5T_COORD3_DOUBLE, - &ci.clower, &ci.delta, - &v2h(ci.ioff)[0], - fragmentname.c_str())); - } else { - // Output coordinates - output_variable (path, CCTK_VarIndex("grid::x"), true); + if (group_type == CCTK_GF) { + // Define coordinates + // TODO: also define and use is_cartesian for each map + if (not is_multipatch) { + // (This is redundant, since the level's overall bounding + // box was already defined above, but it provides the + // individual components' bounding boxes.) + component_indices_t const ci(cctkGH, group_index); + FAILWARN (F5Fwrite_linear_fraction (path, FIBER_HDF5_POSITIONS_STRING, + ci.dim, + &v2h(ci.gsh)[0], &v2h(ci.ilen)[0], + F5T_COORD3_DOUBLE, + &ci.clower, &ci.delta, + &v2h(ci.ioff)[0], + fragmentname.c_str())); + } else { + // Output coordinates + output_variable (path, CCTK_VarIndex("grid::x"), true); + } } // Output variables @@ -468,7 +472,6 @@ namespace CarpetIOF5 { } assert (groupdata.stagtype == 0); - assert (groupdata.dim == dim); #warning "TODO: Do not output symmetry zones (unless requested by the user)" #warning "TODO: Do not output buffer zones (is that easily possible?)" @@ -617,28 +620,58 @@ namespace CarpetIOF5 { component_indices_t const ci(cctkGH, group_index); - CCTK_REAL const* rdata[num_comps]; - vector > idata(num_comps); void const* data[num_comps]; - for (int d=0; d= 0); // Enable compression if requested if (compression_level >= 0) { - FAILWARN (H5Pset_chunk (prop, dim, &v2h(ci.ilen).reverse()[0])); + FAILWARN (H5Pset_chunk (prop, ci.dim, &v2h(ci.ilen).reverse()[0])); FAILWARN (H5Pset_deflate (prop, compression_level)); } // Enable checksums if requested if (use_checksums) { - FAILWARN (H5Pset_chunk (prop, dim, &v2h(ci.ilen).reverse()[0])); + FAILWARN (H5Pset_chunk (prop, ci.dim, &v2h(ci.ilen).reverse()[0])); FAILWARN (H5Pset_fletcher32 (prop)); } @@ -661,7 +694,7 @@ namespace CarpetIOF5 { // instead) FAILWARN (F5Fwrite_fraction (path, name.c_str(), - dim, + ci.dim, is_multipatch ? NULL : &v2h(ci.gsh)[0], &v2h(ci.ilen)[0], type, type, data[0], @@ -671,7 +704,7 @@ namespace CarpetIOF5 { } else { FAILWARN (F5FSwrite_fraction (path, name.c_str(), - dim, + ci.dim, is_multipatch ? NULL : &v2h(ci.gsh)[0], &v2h(ci.ilen)[0], type, type, data, @@ -681,6 +714,11 @@ namespace CarpetIOF5 { will_cover_complete_domain)); } + for (int d=0; d