From d1d22dc0c67f65fd07dc0c020d1f0dda75d8f448 Mon Sep 17 00:00:00 2001 From: allen Date: Sun, 25 Feb 2001 08:57:32 +0000 Subject: Removing compiler warnings git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinBase/CoordGauge/trunk@34 edbb7e70-9571-45d5-a481-0a560a9b4751 --- src/Slicing.c | 156 +++++++++++++++++++++++++++------------------------------- 1 file changed, 73 insertions(+), 83 deletions(-) diff --git a/src/Slicing.c b/src/Slicing.c index dd1584c..3f1f47c 100644 --- a/src/Slicing.c +++ b/src/Slicing.c @@ -1,5 +1,3 @@ -static char *rcsid = "$Id$"; - /*@@ @file Slicing.c @date Wed Jul 14 16:03:12 1999 @@ -31,6 +29,15 @@ static char *rcsid = "$Id$"; #include "Slicing.h" #include "ErrorCodes.h" +int CCTK_FCALL CCTK_FNAME(Einstein_RegisterSlicing)(ONE_FORTSTRING_ARG); +int CCTK_FCALL CCTK_FNAME(Einstein_GetSlicingHandle)(ONE_FORTSTRING_ARG); +void Einstein_ActivateSlicing(cGH *GH) ; + +static char *rcsid = "$Header$"; + +CCTK_FILEVERSION(CactusEinstein_Einstein_Slicing_c) + + /*#define ESLIC_DEBUG*/ @@ -61,7 +68,6 @@ static cHandledData *Eslicings = NULL; int Einstein_RegisterSlicing(const char *slice_name) { int handle; - char *err; struct Einstein_slicing *new_slicing; @@ -124,9 +130,10 @@ int Einstein_RegisterSlicing(const char *slice_name) @date Wed Jul 14 15:57:32 1999 @author Gerd Lanfermann @desc - This FORTRAN routine registers a slicing in a structure which provides information - whether it is activated by parameter and which function is responsible - for evaluating whether the slicing should be used in the next iteartion. + This FORTRAN routine registers a slicing in a structure which provides + information whether it is activated by parameter and which function is + responsible for evaluating whether the slicing should be used in the + next iteartion. @enddesc @calls @calledby @@ -169,7 +176,6 @@ int CCTK_FCALL CCTK_FNAME(Einstein_RegisterSlicing)(ONE_FORTSTRING_ARG) int Einstein_RegisterTimeToSlice(int handle, int (*func)(cGH *)) { int return_code=1; - char *err; struct Einstein_slicing *slicing; slicing = Util_GetHandledData(Eslicings, handle); @@ -203,9 +209,9 @@ int Einstein_RegisterTimeToSlice(int handle, int (*func)(cGH *)) @desc After the slicings have been registered by the thorns (in Startup .e.g.), this routines checks which slicing is specified in the parameter database - and activates them. The activation flag takes a number, which reflect the order - in which the keywords appear in the parameter: first = 1 = highest priority, - sec. = 2 ,lower priority. + and activates them. The activation flag takes a number, which reflect + the order in which the keywords appear in the parameter: + first = 1 = highest priority, sec. = 2 ,lower priority. @enddesc @calls @calledby @@ -284,7 +290,8 @@ void Einstein_ActivateSlicing(cGH *GH) slic->param_active = 1; /*Some error checking: */ - if (slic->timetoslice!=NULL) { + if (slic->timetoslice!=NULL) + { err = (char*)malloc(256*sizeof(char)); sprintf(err,"%s%s%s%s", "ERROR: You have specified a unique slicing (",slic->name, @@ -296,65 +303,65 @@ void Einstein_ActivateSlicing(cGH *GH) } /* We have mixed slicing: we check the mixed_slicing parameter */ else + { + /* for all slicings in the mix: e.g. mixed_slicing = "1+log maximal static" + 1) get the handle for each slicing + + 2) set slicing->param_active, counting from 1 to n according to the + position. The higher the number the lower the priority (0=inactive!!) + */ + + /* 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 */ + ierr=Util_SplitString(&item,&after,split_string," "); + /*printf(" item >%s< after: >%s< \n",item,after);*/ + + priority = 1; + while (item) { - /* for all slicings in the mix: e.g. mixed_slicing = "1+log maximal static" - 1) get the handle for each slicing - - 2) set slicing->param_active, counting from 1 to n according to the - position. The higher the number the lower the priority (0=inactive!!) - */ - - /* 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 */ - ierr=Util_SplitString(&item,&after,split_string," "); - /*printf(" item >%s< after: >%s< \n",item,after);*/ - - priority = 1; - while (item) + if (CCTK_Equals(item,"static")) { - if (CCTK_Equals(item,"static")) + printf("Registering Static\n"); + handle2=Einstein_RegisterSlicing("static"); + if (handle2<0) { - printf("Registering Static\n"); - handle2=Einstein_RegisterSlicing("static"); - if (handle2<0) - { - CCTK_WARN(1,"Cannot register static slicing"); - } + CCTK_WARN(1,"Cannot register static slicing"); } - else if (CCTK_Equals(item,"geodesic")) + } + else if (CCTK_Equals(item,"geodesic")) + { + handle2=Einstein_RegisterSlicing("geodesic"); + if (handle2<0) { - handle2=Einstein_RegisterSlicing("geodesic"); - if (handle2<0) - { - CCTK_WARN(1,"Cannot register geodesic slicing"); - } - } + CCTK_WARN(1,"Cannot register geodesic slicing"); + } + } - slic = Util_GetHandledData(Eslicings,Util_GetHandle(Eslicings,item,NULL)); + slic = Util_GetHandledData(Eslicings,Util_GetHandle(Eslicings,item,NULL)); - if (!slic) - { - CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING, - "No registered slicing for <%s>",item); - } + if (!slic) + { + CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING, + "No registered slicing for <%s>",item); + } - slic->param_active = priority; + slic->param_active = priority; #ifdef ESLIC_DEBUG - printf("ACTIVATE_SLICING: found %s priority %d \n",item, priority); + printf("ACTIVATE_SLICING: found %s priority %d \n",item, priority); #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); - if (after)free(after); - if (split_string) free(split_string); + 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); + if (after)free(after); + if (split_string) free(split_string); + } /* We initialize the active_slicing_handle at CACTUS_BASE for the first time. This is important as some thorns might depend on @@ -407,37 +414,20 @@ void Einstein_ActivateSlicing(cGH *GH) @@*/ -int Einstein_GetSlicingHandle(const char *name) { +int Einstein_GetSlicingHandle(const char *name) +{ int handle; - char *err; - /* printf("NAME: %s\n",name);*/ handle = Util_GetHandle(Eslicings,name,NULL); - if (handle<0) { - err = (char*)malloc(256*sizeof(char)); - sprintf(err,"WARNING: cannot get handle for slicing %s\n%s",name, - "Typo ? Slicing registered by the thorn ? Prob. fatal if you continue evolving. "); - CCTK_WARN(1,err); - if (err) free(err); + if (handle<0) + { + CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING, + "Einstein_GetSlicingHandle: cannot get handle for slicing %s", + name); } return(handle); } -/*@@ - @routine Einstein_GetSlicingHandle-F - @date Thu Jul 22 11:30:47 1999 - @author Gerd Lanfermann - @desc - Fortran routine; error checking done in the C-routine; - @enddesc - @calls Einstein_GetSlicingHandle - @calledby - @history - - @endhistory - -@@*/ - int CCTK_FCALL CCTK_FNAME(Einstein_GetSlicingHandle)(ONE_FORTSTRING_ARG) { int handle; -- cgit v1.2.3