Is there an easy way to initialize all variables to zero (including _p _pp)?
Cheers, Steve
You can ask Carpet to loop over all timelevels in the scheduler, so that your scheduled functions are called multiple times. If you set the variables to zero, all timelevels will be zero. You can also ask Carpet to copy the current timelevel to all past timelevels after initialisation.
Your other alternative is to set the _p and _p_p variables to zero manually.
-erik
On Wed, Aug 24, 2011 at 12:18 PM, Steven R. Brandt sbrandt@cct.lsu.edu wrote:
Is there an easy way to initialize all variables to zero (including _p _pp)?
Cheers, Steve _______________________________________________ Users mailing list Users@einsteintoolkit.org http://lists.einsteintoolkit.org/mailman/listinfo/users
I was wondering if there a way to do something like this (I'm making up the function names, I don't know if there are real ones)
for(int n=0;n<CCTK_Max_Variable_Index(cctkGH);n++) { CCTK_REAL *gf = CCTK_LookupCCTKRealGF(n); for(int i=.... for(int j=... for(int k=... gf[CCTK_GFINDEX3D(cctkGH, i, j, k)] = 0 }
Cheers, Steve
On 08/24/2011 11:37 AM, Erik Schnetter wrote:
You can ask Carpet to loop over all timelevels in the scheduler, so that your scheduled functions are called multiple times. If you set the variables to zero, all timelevels will be zero. You can also ask Carpet to copy the current timelevel to all past timelevels after initialisation.
Your other alternative is to set the _p and _p_p variables to zero manually.
-erik
On Wed, Aug 24, 2011 at 12:18 PM, Steven R. Brandtsbrandt@cct.lsu.edu wrote:
Is there an easy way to initialize all variables to zero (including _p _pp)?
Cheers, Steve _______________________________________________ Users mailing list Users@einsteintoolkit.org http://lists.einsteintoolkit.org/mailman/listinfo/users
Hello Steve,
I was wondering if there a way to do something like this (I'm making up the function names, I don't know if there are real ones)
for(int n=0;n<CCTK_Max_Variable_Index(cctkGH);n++) { CCTK_REAL *gf = CCTK_LookupCCTKRealGF(n); for(int i=.... for(int j=... for(int k=... gf[CCTK_GFINDEX3D(cctkGH, i, j, k)] = 0 }
There is CCTK_NumVars, CCTK_NumTimeLevelsVI, CCTK_VarDataPtrI to get the number of Cactus variables, the number of timelevels for a variable, and the pointer to the data of this variable. Information on the type of the variable (GF, scalar, CCTK_REAL, CCTK_INT) is likely somehwere in GroupTypeFromVarI and CCTK_GroupData though those I have not used myself.
Yours, Roland
Yes, this is correct. You would call CCTK_ActiveTimeLevels instead of CCTK_NumTimeLevels to find out how many time levels are active, not how many are declared. The variable type needs to be CCTK_VARIABLE_REAL, and the group type needs to be CCTK_GF.
-erik
On Wed, Aug 24, 2011 at 5:00 PM, Roland Haas roland.haas@physics.gatech.edu wrote:
Hello Steve,
I was wondering if there a way to do something like this (I'm making up the function names, I don't know if there are real ones)
for(int n=0;n<CCTK_Max_Variable_Index(cctkGH);n++) { CCTK_REAL *gf = CCTK_LookupCCTKRealGF(n); for(int i=.... for(int j=... for(int k=... gf[CCTK_GFINDEX3D(cctkGH, i, j, k)] = 0 }
There is CCTK_NumVars, CCTK_NumTimeLevelsVI, CCTK_VarDataPtrI to get the number of Cactus variables, the number of timelevels for a variable, and the pointer to the data of this variable. Information on the type of the variable (GF, scalar, CCTK_REAL, CCTK_INT) is likely somehwere in GroupTypeFromVarI and CCTK_GroupData though those I have not used myself.
Yours, Roland
Users mailing list Users@einsteintoolkit.org http://lists.einsteintoolkit.org/mailman/listinfo/users
users@lists.einsteintoolkit.org