#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; // 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