// register.cc -- register variables with various thorns that need-to-know // $Header$ // // GRHydro_register_GZPatchSystem - register with GZPatchSystem // // Cut 'n paste job from BackgroundWaveToy, author J Thornburg... #include #include #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" using namespace std; //****************************************************************************** // // This function is called by the Cactus scheduler to (maybe) register // our to-be-interpatch-synchronized variables with GZPatchSystem. It // checks if the GZPatchSystem registration function has been provided // (which it should be if and only if GZPatchSystem is active), and if so, // does the registration. // // If we're using Carpet, this function must be called in meta mode. // extern "C"void GRHydro_register_GZPatchSystem(CCTK_ARGUMENTS) { DECLARE_CCTK_PARAMETERS; if (CCTK_IsFunctionAliased("GZPatchSystem_register_sync")) { CCTK_VInfo(CCTK_THORNSTRING, "registering to-be-interpatch-synchronized variables " "with GZPatchSystem"); if(CCTK_EQUALS(Bvec_evolution_method,"GRHydro")) { if(clean_divergence) { string var[10] = {"HydroBase::rho", "HydroBase::press", "HydroBase::eps", "HydroBase::vel", "GRHydro::dens", "GRHydro::tau", "GRHydro::w_lorentz", "GRHydro::scon", "HydroBase::Bvec", "GRHydro::psidc"}; for (int i = 0; i < 10; i++) { int status = GZPatchSystem_register_sync(var[i].c_str()); if (status < 0) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "***** GRHydro_register_GZPatchSystem():\n" " error registering var group %s to be " "interpatch-synchronized!\n" " (GZPatchSystem_register_sync() error code %d)\n", var[i].c_str(), status); } } } else { string var[9] = {"HydroBase::rho", "HydroBase::press", "HydroBase::eps", "HydroBase::vel", "GRHydro::dens", "GRHydro::tau", "GRHydro::w_lorentz", "GRHydro::scon", "HydroBase::Bvec"}; for (int i = 0; i < 9; i++) { int status = GZPatchSystem_register_sync(var[i].c_str()); if (status < 0) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "***** GRHydro_register_GZPatchSystem():\n" " error registering var group %s to be " "interpatch-synchronized!\n" " (GZPatchSystem_register_sync() error code %d)\n", var[i].c_str(), status); } } } } else { string var[8] = {"HydroBase::rho", "HydroBase::press", "HydroBase::eps", "HydroBase::vel", "GRHydro::dens", "GRHydro::tau", "GRHydro::w_lorentz", "GRHydro::scon"}; for (int i = 0; i < 8; i++) { int status = GZPatchSystem_register_sync(var[i].c_str()); if (status < 0) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "***** GRHydro_register_GZPatchSystem():\n" " error registering var group %s to be " "interpatch-synchronized!\n" " (GZPatchSystem_register_sync() error code %d)\n", var[i].c_str(), status); } } } } else { CCTK_WARN(1, "Function GZPatchSystem_register_sync not registered!"); } if (CCTK_IsFunctionAliased("GZPatchSystem_register_cxform")) { CCTK_VInfo(CCTK_THORNSTRING, "registering to-be-cxformed variables with GZPatchSystem"); if(CCTK_EQUALS(Bvec_evolution_method,"GRHydro")) { if(clean_divergence) { string var[13] = {"HydroBase::rho", "HydroBase::press", "HydroBase::eps", "HydroBase::vel", "GRHydro::dens", "GRHydro::tau", "GRHydro::w_lorentz", "GRHydro::scon", "HydroBase::Bvec", "GRHydro::psidc", "ADMBase::metric", "ADMBase::curv", "ADMBase::shift"}; for (int i = 0; i < 13; i++) for (int j = 0; j < 3; j++) { int ps_status = GZPatchSystem_register_cxform(j, var[i].c_str()); if (ps_status < 0) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "***** GRHydro_register_GZPatchSystem():\n" " error registering var group %s to be " "interpatch-cxformhronized!\n" " (GZPatchSystem_register_cxform() error code %d)\n", var[i].c_str(), ps_status); } } } else { string var[12] = {"HydroBase::rho", "HydroBase::press", "HydroBase::eps", "HydroBase::vel", "GRHydro::dens", "GRHydro::tau", "GRHydro::w_lorentz", "GRHydro::scon", "HydroBase::Bvec", "ADMBase::metric", "ADMBase::curv", "ADMBase::shift"}; for (int i = 0; i < 12; i++) for (int j = 0; j < 3; j++) { int ps_status = GZPatchSystem_register_cxform(j, var[i].c_str()); if (ps_status < 0) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "***** GRHydro_register_GZPatchSystem():\n" " error registering var group %s to be " "interpatch-cxformhronized!\n" " (GZPatchSystem_register_cxform() error code %d)\n", var[i].c_str(), ps_status); } } } } else { string var[11] = {"HydroBase::rho", "HydroBase::press", "HydroBase::eps", "HydroBase::vel", "GRHydro::dens", "GRHydro::tau", "GRHydro::w_lorentz", "GRHydro::scon", "ADMBase::metric", "ADMBase::curv", "ADMBase::shift"}; for (int i = 0; i < 11; i++) for (int j = 0; j < 3; j++) { int ps_status = GZPatchSystem_register_cxform(j, var[i].c_str()); if (ps_status < 0) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "***** GRHydro_register_GZPatchSystem():\n" " error registering var group %s to be " "interpatch-cxformhronized!\n" " (GZPatchSystem_register_cxform() error code %d)\n", var[i].c_str(), ps_status); } } } } else { CCTK_WARN(1, "Function GZPatchSystem_register_cxform not registered!"); } }