aboutsummaryrefslogtreecommitdiff
path: root/CarpetDev/CarpetIOF5/src/iof5.hh
diff options
context:
space:
mode:
Diffstat (limited to 'CarpetDev/CarpetIOF5/src/iof5.hh')
-rw-r--r--CarpetDev/CarpetIOF5/src/iof5.hh108
1 files changed, 76 insertions, 32 deletions
diff --git a/CarpetDev/CarpetIOF5/src/iof5.hh b/CarpetDev/CarpetIOF5/src/iof5.hh
index 71524fa2c..76837a1e0 100644
--- a/CarpetDev/CarpetIOF5/src/iof5.hh
+++ b/CarpetDev/CarpetIOF5/src/iof5.hh
@@ -10,6 +10,7 @@
#include <limits>
#include <sstream>
#include <string>
+#include <vector>
#include <hdf5.h>
#include <F5/F5F.h>
@@ -33,8 +34,8 @@
template<typename T>
static
T failwarn (bool& error_flag, T const expr,
- int const line, char const *const file, char const *const thorn,
- char const *const msg)
+ int const line, char const* const file, char const* const thorn,
+ char const* const msg)
{
if (expr < 0) {
CCTK_VWarn (CCTK_WARN_ALERT, line, file, thorn,
@@ -79,9 +80,16 @@ namespace CarpetIOF5 {
CCTK_REAL const nan = numeric_limits<CCTK_REAL>::quiet_NaN();
// Special group and attribute names
- char const *const metadata_group = "Parameters and Global Attributes";
- char const *const all_parameters = "All Parameters";
- extern char const *const grid_structure;
+ char const* const metadata_group = "Parameters and Global Attributes";
+ char const* const all_parameters = "All Parameters";
+ extern char const* const grid_structure;
+
+
+
+ // Tensor types
+ enum tensortype_t {
+ tt_scalar, tt_vector, tt_symtensor, tt_tensor, tt_error
+ };
@@ -143,72 +151,108 @@ namespace CarpetIOF5 {
// Handle HDF5 attributes more comfortably
bool WriteAttribute (hid_t const group,
- char const * const name,
+ char const* const name,
int const ivalue);
bool WriteAttribute (hid_t const group,
- char const * const name,
+ char const* const name,
double const dvalue);
bool WriteAttribute (hid_t const group,
- char const *const name,
- char const *const svalue);
+ char const* const name,
+ char const* const svalue);
bool WriteAttribute (hid_t const group,
- char const *const name,
- int const *const ivalues,
+ char const* const name,
+ int const* const ivalues,
int const nvalues);
bool WriteAttribute (hid_t const group,
- char const *const name,
- double const *const dvalues,
+ char const* const name,
+ double const* const dvalues,
int const nvalues);
bool WriteAttribute (hid_t const group,
- char const *const name,
- char const *const *const svalues,
+ char const* const name,
+ char const* const* const svalues,
int const nvalues);
bool WriteLargeAttribute (hid_t const group,
- char const *const name,
- char const *const svalue);
+ char const* const name,
+ char const* const svalue);
// Generate a good file name ("alias") for a variable
string
- generate_basename (cGH const *const cctkGH,
+ generate_basename (cGH const* const cctkGH,
int const variable);
// Create the final file name on a particular processor
string
- create_filename (cGH const *const cctkGH,
+ create_filename (cGH const* const cctkGH,
string const basename,
int const proc,
bool const create_directories);
// Generate a good grid name (simulation name)
string
- generate_gridname (cGH const *const cctkGH);
+ generate_gridname (cGH const* const cctkGH);
- // Generate a good tensor basis name (coordinate system name)
+ // Generate a good topology name (refinement level name)
string
- generate_chartname (cGH const *const cctkGH);
+ generate_topologyname (cGH const* const cctkGH,
+ int const gi,
+ ivect const& reffact);
- // Generate a good fragment name (map name)
+ // Generate a good chart name (tensor basis name)
string
- generate_fragmentname (cGH const *const cctkGH, int const m);
- int
- interpret_fragmentname (cGH const *const cctkGH,
- char const *const fragmentname);
+ generate_chartname (cGH const* const cctkGH);
- // Generate a good topology name (map and refinement level name)
+ // Generate a good fragment name (map and component name)
string
- generate_topologyname (cGH const *const cctkGH,
- int const m, ivect const& reffact);
+ generate_fragmentname (cGH const* const cctkGH, int const m, int const c);
+ void
+ interpret_fragmentname (cGH const* const cctkGH,
+ char const* const fragmentname,
+ int& m, int& c);
+
+ // Generate a good field name (group or variable name)
+ string
+ generate_fieldname (cGH const* const cctkGH,
+ int const vi, tensortype_t const tt);
void
- write_metadata (cGH *const cctkGH, hid_t const file);
+ write_metadata (cGH const* const cctkGH, hid_t const file);
// Handle Carpet's grid structure (this should move to Carpet and/or
// CarpetLib)
string
- serialise_grid_structure (cGH const *const cctkGH);
+ serialise_grid_structure (cGH const* const cctkGH);
+
+
+
+ void output (cGH const* const cctkGH,
+ hid_t const file,
+ vector<bool> const& output_var,
+ bool const output_everything);
+
+
+
+ // Scheduled routines
+ extern "C" {
+ int CarpetIOF5_Startup ();
+ void CarpetIOF5_Init (CCTK_ARGUMENTS);
+ void CarpetIOF5_InitialDataCheckpoint (CCTK_ARGUMENTS);
+ void CarpetIOF5_EvolutionCheckpoint (CCTK_ARGUMENTS);
+ void CarpetIOF5_TerminationCheckpoint (CCTK_ARGUMENTS);
+ }
+
+ // Registered GH extension setup routine
+ void* SetupGH (tFleshConfig* const fleshconfig,
+ int const convLevel, cGH* const cctkGH);
+
+ // Callbacks for CarpetIOHDF5's I/O method
+ int OutputGH (cGH const* const cctkGH);
+ int TimeToOutput (cGH const* const cctkGH, int const vindex);
+ int TriggerOutput (cGH const* const cctkGH, int const vindex);
+ int OutputVarAs (cGH const* const cctkGH,
+ const char* const varname, const char* const alias);
} // end namespace CarpetIOF5