#include #include #include "cctk.h" #include "Carpet/CarpetLib/src/dh.hh" #include "Carpet/CarpetLib/src/gf.hh" #include "carpet.hh" static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Storage.cc,v 1.3 2001/11/02 10:59:00 schnetter Exp $"; namespace Carpet { using namespace std; int EnableGroupStorage (cGH* cgh, const char* groupname) { Checkpoint ("%*sEnableGroupStorage %s", 2*reflevel, "", groupname); // TODO: Enabling storage for one refinement level has to enable // it for all other refinement levels as well. Disabling must // wait until all refinement levels have been disabled. // TODO: Invent a mode "reflevel==-1" that is global, i. e. has // effect for all refinement levels. This mode is used during // INITIAL, and en-/disabling storage in it is also global. const int group = CCTK_GroupIndex(groupname); assert (group>=0 && group=0); const int num_tl = CCTK_NumTimeLevelsFromVarI(n0); assert (num_tl>0); const int tmin = 1 - num_tl; const int tmax = 0; assert (arrdata[group].data.size()==0 || arrdata[group].data[0] == 0); for (int var=0; var<(int)arrdata[group].data.size(); ++var) { const int n = n0 + var; switch (CCTK_VarTypeI(n)) { #define TYPECASE(N,T) \ case N: \ arrdata[group].data[var] = new gf \ (CCTK_VarName(n), *arrdata[group].tt, *arrdata[group].dd, \ tmin, tmax); \ break; #include "typecase" #undef TYPECASE default: UnsupportedVarType(n); } // switch } // for // Reinitialise Cactus variables set_component (cgh, component); PoisonGroup (cgh, group, alltimes); // storage was not enabled previously return 0; } int DisableGroupStorage (cGH* cgh, const char* groupname) { Checkpoint ("%*sDisableGroupStorage %s", 2*reflevel, "", groupname); const int group = CCTK_GroupIndex(groupname); assert (group>=0 && group*)arrdata[group].data[var]; \ break; #include "typecase" #undef TYPECASE default: UnsupportedVarType(n); } // switch arrdata[group].data[var] = 0; } // for // Reinitialise Cactus variables set_component (cgh, component); // storage was not disabled previously return 1; } int QueryGroupStorageB (const cGH* cgh, int group, const char* groupname) { if (groupname) { group = CCTK_GroupIndex(groupname); } assert (group>=0 && group=0 && n=0 && group=0 && dir=0 && var=0 && group