#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // This requires defining a boolean local variable "error_flag", // initialised to false #define FAILWARN(_expr) \ failwarn(error_flag, _expr, __LINE__, __FILE__, CCTK_THORNSTRING, #_expr) template static T failwarn (bool& error_flag, T const expr, 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, "Expression \"%s\" return %d", msg, (int)expr); error_flag = true; } return expr; } namespace CarpetIOF5 { class indent_t; }; ostream& operator<<(ostream& os, CarpetIOF5::indent_t const& indent); namespace CarpetIOF5 { using namespace std; using namespace Carpet; // Indentation class indent_t { static int const width = 3; static int level; public: indent_t() { ++level; } ~indent_t() { --level; } ostream& output(ostream& os) const; }; // File mode for creating directories int const mode = 0755; // A nan CCTK_REAL const nan = numeric_limits::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; // Tensor types enum tensortype_t { tt_scalar, tt_vector, tt_symtensor, tt_tensor, tt_error }; // Data types for HDF5 and F5 types typedef vect hvect; // Conversion operators for these datatypes static inline hvect v2h (ivect const& a) { return hvect(a); } static inline ivect h2v (hvect const& a) { return ivect(a); } static inline ivect h2v (hsize_t const* const a) { ivect res; for (int d=0; d 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