aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlanfer <lanfer@edbb7e70-9571-45d5-a481-0a560a9b4751>2000-04-27 15:28:47 +0000
committerlanfer <lanfer@edbb7e70-9571-45d5-a481-0a560a9b4751>2000-04-27 15:28:47 +0000
commite7d2623d32fa5481c3b0a874813e52f1502f23d9 (patch)
tree91b443faaf8c629aa37ac1765b35cd902e29db5d
parentc5acf03eb954ef06cb4bc30220d5dd9abf5aa7e7 (diff)
fixing bug in mixed_slicing
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinBase/CoordGauge/trunk@26 edbb7e70-9571-45d5-a481-0a560a9b4751
-rw-r--r--src/Slicing.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/Slicing.c b/src/Slicing.c
index 2a5639a..ccb7cd7 100644
--- a/src/Slicing.c
+++ b/src/Slicing.c
@@ -29,7 +29,7 @@ static char *rcsid = "$Id$";
#include "Slicing.h"
#include "ErrorCodes.h"
-/*#define ESLIC_DEBUG*/
+/*$#define ESLIC_DEBUG$*/
/* Local data holding info on slicings..*/
@@ -223,11 +223,10 @@ void Einstein_ActivateSlicing(cGH *GH)
struct Einstein_slicing *slic;
CCTK_INT *active_slicing_handle;
- int handle, priority,i;
+ int handle, priority,i,h, ierr;
char *err, *split_string;
char *item=NULL, *after=NULL;
-
/* Get our grid scalar pointer: initialize with -1*/
i = CCTK_VarIndex("Einstein::active_slicing_handle");
if (i<0) CCTK_WARN(0,"INTERNAL ERROR: cannot find grid scalar: active_slicing_handle");
@@ -243,9 +242,12 @@ void Einstein_ActivateSlicing(cGH *GH)
if (handle<0) {
/* If slicing is set to "none", only warn level 2 (could be initial data only) */
- if (CCTK_Equals(slicing,"none")) {
+ if (CCTK_Equals(slicing,"none"))
+ {
CCTK_WARN(2,"No slicing set. Prob. fatal when you enter evolution loop (itlast>0).\n");
- } else {
+ }
+ else
+ {
err = (char*)malloc(256*sizeof(char));
sprintf(err,"%s%s%s%s",
"WARNING: cannot get handle for slicing: >>",
@@ -283,11 +285,18 @@ void Einstein_ActivateSlicing(cGH *GH)
2) set slicing->param_active, counting from 1 to n according to the
position. The higher the number the lower the priority (0=inactive!!)
*/
- priority = 1;
- split_string= mixed_slicing;
+
+ /* we attach an additional space for string splitting */
+ split_string= (char*)malloc(strlen(mixed_slicing)*sizeof(char)+2);
+ sprintf(split_string,"%s ",mixed_slicing);
/* Here we take the string appart */
- while (Util_SplitString(&item,&after,split_string," ")==0) {
+ ierr=Util_SplitString(&item,&after,split_string," ");
+ /*printf(" item >%s< after: >%s< \n",item,after);*/
+
+ priority = 1;
+ while (item)
+ {
slic = Util_GetHandledData(Eslicings,Util_GetHandle(Eslicings,item,NULL));
if (!slic) {
@@ -300,9 +309,11 @@ void Einstein_ActivateSlicing(cGH *GH)
slic->param_active = priority;
#ifdef ESLIC_DEBUG
printf("ACTIVATE_SLICING: found %s priority %d \n",item, priority);
-#endif
+#endif
priority++;
split_string = after;
+ ierr=Util_SplitString(&item,&after,split_string," ");
+ /*printf(" item >%s< after: >%s< %d\n",item,after,ierr);*/
}
if (item) free(item);
@@ -461,7 +472,7 @@ void Einstein_SetNextSlicing(cGH *GH) {
for (h=0;h<num_slicings;h++)
{
#ifdef ESLIC_DEBUG
- printf("HANDLE LOOP: %d/%d\n",h,num_slicings);
+ printf("HANDLE LOOP: %d of %d\n",h,num_slicings);
#endif
slic = (struct Einstein_slicing *)Util_GetHandledData(Eslicings,h);
if (!slic)
@@ -476,8 +487,7 @@ void Einstein_SetNextSlicing(cGH *GH) {
set the active_slicing_handle to one of the two handles in this order
*/
#ifdef ESLIC_DEBUG
- printf(" h: %d pa: %d yes %d egal %d \n",h,slic->param_active,h_yes, h_egal);
-
+ printf(" handle: %d pactive: %d yes: %d egal: %d \n",h,slic->param_active,h_yes, h_egal);
#endif
if ((slic->param_active>0)) {
if (slic->timetoslice!=NULL) {
@@ -491,9 +501,9 @@ void Einstein_SetNextSlicing(cGH *GH) {
}
}
- /* First try to set the scalar to the highest priority that cares (h_yes), else
- to the highest prio, that doesn;t care (h_egal). If that fails, we are in trouble.
- */
+ /* First try to set the scalar to the highest priority that
+ cares (h_yes), else to the highest prio, that doesn;t
+ care (h_egal). If that fails, we are in trouble. */
if (h_yes!=num_slicings) *active_slicing_handle = h_yes;
else