From dfaee1a51775e04aecedad010bd366ab020d8e1a Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Mon, 28 Jan 2008 15:58:00 +0000 Subject: CarpetIOHDF5: Add attribute specifying whether coordinate system is Cartesian Add an HDF5 attribute "MapisCartesian" specifying whether the coordinate system is Cartesian. This attribute is added if there is a thorn providing this information. darcs-hash:20080128155820-dae7b-759cc1608ba8a7c9d34203b114ceb3836db0f64d.gz --- Carpet/CarpetIOHDF5/interface.ccl | 10 +++++++++- Carpet/CarpetIOHDF5/src/Output.cc | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'Carpet/CarpetIOHDF5') diff --git a/Carpet/CarpetIOHDF5/interface.ccl b/Carpet/CarpetIOHDF5/interface.ccl index 6c526e011..9d1f86161 100644 --- a/Carpet/CarpetIOHDF5/interface.ccl +++ b/Carpet/CarpetIOHDF5/interface.ccl @@ -30,7 +30,15 @@ CCTK_INT FUNCTION Coord_GroupSystem \ CCTK_STRING IN groupname) USES FUNCTION Coord_GroupSystem -# function to check whether existing output files should be truncated or not +# Specify whether a map uses a Cartesian or a curvilinear coordinate system +CCTK_INT FUNCTION \ + MultiPatch_MapIsCartesian \ + (CCTK_INT IN map) +USES FUNCTION MultiPatch_MapIsCartesian + + + +# Check whether existing output files should be truncated or not CCTK_INT FUNCTION IO_TruncateOutputFiles \ (CCTK_POINTER_TO_CONST IN GH) diff --git a/Carpet/CarpetIOHDF5/src/Output.cc b/Carpet/CarpetIOHDF5/src/Output.cc index 898952c1f..24cbcd9cb 100644 --- a/Carpet/CarpetIOHDF5/src/Output.cc +++ b/Carpet/CarpetIOHDF5/src/Output.cc @@ -664,6 +664,15 @@ static int AddAttributes (const cGH *const cctkGH, const char *fullname, free (groupname); } + // Specify whether the coordinate system is Cartesian or not + if (CCTK_IsFunctionAliased ("MultiPatch_MapIsCartesian")) { + int const map_is_cartesian = MultiPatch_MapIsCartesian (Carpet::map); + HDF5_ERROR (attr = H5Acreate (dataset, "MapIsCartesian", H5T_NATIVE_INT, + dataspace, H5P_DEFAULT)); + HDF5_ERROR (H5Awrite (attr, H5T_NATIVE_INT, & map_is_cartesian)); + HDF5_ERROR (H5Aclose (attr)); + } + hsize_t size = vdim; HDF5_ERROR (dataspace = H5Screate_simple (1, &size, NULL)); -- cgit v1.2.3