diff options
Diffstat (limited to 'src/IsoSurfacer.c')
-rw-r--r-- | src/IsoSurfacer.c | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/src/IsoSurfacer.c b/src/IsoSurfacer.c index 366e552..7db611b 100644 --- a/src/IsoSurfacer.c +++ b/src/IsoSurfacer.c @@ -47,27 +47,29 @@ if( (p += strlen(tmps)) >= lfs ) \ } \ strcpy(&(outs)[q], (tmps)) /* ***** Some function forward declarations ***** */ -static void CollectData(cGH *GH, polypatch *perprocessor, polypatch *totals); -static void WriteBin(cGH *GH, polypatch *totals,isosurfacerGH *myGH, +static void CollectData(const cGH *GH, polypatch *perprocessor, polypatch *totals); +static void WriteBin(const cGH *GH, polypatch *totals,isosurfacerGH *myGH, const char *fullname, CCTK_REAL4 isolevel); -static void WriteVRML(cGH *GH, polypatch *totals, +static void WriteVRML(const cGH *GH, polypatch *totals, const char *fullname, CCTK_REAL4 isolevel); -static void WriteASCII(cGH *GH, polypatch *totals, +static void WriteASCII(const cGH *GH, polypatch *totals, const char *fullname, CCTK_REAL4 isolevel); -static void WriteUCD(cGH *GH, polypatch *totals, +static void WriteUCD(const cGH *GH, polypatch *totals, const char *fullname, CCTK_REAL4 isolevel); -static void WriteSock(cGH *GH, polypatch *totals, isosurfacerGH *myGH, +static void WriteSock(const cGH *GH, polypatch *totals, isosurfacerGH *myGH, const char *fullname, int isoindex, CCTK_REAL4 isolevel); -static void WriteHDF5(cGH *GH, polypatch *totals, isosurfacerGH *myGH, +static void WriteHDF5(const cGH *GH, polypatch *totals, isosurfacerGH *myGH, const char *fullname, int isoindex, CCTK_REAL4 isolevel); /***************************************************************************/ -static int IsoSurfacerHandleCommands(cGH *GH) +static int IsoSurfacerHandleCommands(const cGH *GH) { DECLARE_CCTK_PARAMETERS - IsoCommand *Iso_PollCommand(cGH *cctkGH,IsoCommand *cmd); + IsoCommand *Iso_PollCommand(const cGH *cctkGH,IsoCommand *cmd); IsoCommand command; +#ifdef CCTK_MPI CCTK_REAL new_isovalue; +#endif isosurfacerGH *myGH = (isosurfacerGH *) GH->extensions [CCTK_GHExtensionHandle ("IsoSurfacer")]; if(!myGH->RunIsoSurfacer) return 0; /* not running */ @@ -156,7 +158,7 @@ static int IsoSurfacerHandleCommands(cGH *GH) return 0; } -static int doIso(int vindex, cGH *GH, isosurfacerGH *myGH) +static int doIso(int vindex, const cGH *GH, isosurfacerGH *myGH) { char *fullname; @@ -177,7 +179,7 @@ static int doIso(int vindex, cGH *GH, isosurfacerGH *myGH) } -static void computeIso(int vindex, cGH *GH, isosurfacerGH *myGH) +static void computeIso(int vindex, const cGH *GH, isosurfacerGH *myGH) { DECLARE_CCTK_PARAMETERS /* is it really required to have this static here?? */ @@ -186,6 +188,16 @@ static void computeIso(int vindex, cGH *GH, isosurfacerGH *myGH) int nx,ny,nz; CCTK_REAL *xcoords,*ycoords,*zcoords,*data; int timelevel=0; + /*** FIXME: can CCTK_Reduce() have a 'const cGH *' parameter ?? ***/ + union + { + const cGH *const_ptr; + cGH *non_const_ptr; + } GH_fake_const; + + + GH_fake_const.const_ptr = GH; + if(!myGH->RunIsoSurfacer) return; /* not running */ @@ -211,10 +223,10 @@ static void computeIso(int vindex, cGH *GH, isosurfacerGH *myGH) if(myGH->formats & (SOCK|ISOHDF5|BIN)){ int handle; handle = CCTK_ReductionHandle ("minimum"); - CCTK_Reduce (GH, 0,handle,1,CCTK_VARIABLE_REAL, + CCTK_Reduce (GH_fake_const.non_const_ptr, 0,handle,1,CCTK_VARIABLE_REAL, &(myGH->minval),1, vindex); handle = CCTK_ReductionHandle ("maximum"); - CCTK_Reduce (GH, 0, handle, 1, CCTK_VARIABLE_REAL, + CCTK_Reduce (GH_fake_const.non_const_ptr, 0, handle, 1, CCTK_VARIABLE_REAL, &(myGH->maxval), 1, vindex); } @@ -274,7 +286,7 @@ static void computeIso(int vindex, cGH *GH, isosurfacerGH *myGH) free (fullname); } -int IsoSurfacer(cGH *GH){ +int IsoSurfacer(const cGH *GH){ DECLARE_CCTK_PARAMETERS int i,n; isosurfacerGH *myGH = (isosurfacerGH *) GH->extensions [CCTK_GHExtensionHandle ("IsoSurfacer")]; @@ -301,7 +313,7 @@ int IsoSurfacer(cGH *GH){ /***************************************************************************/ -void CollectData(cGH *GH, polypatch *perprocessor, polypatch *totals) { +void CollectData(const cGH *GH, polypatch *perprocessor, polypatch *totals) { DECLARE_CCTK_PARAMETERS #ifdef CCTK_MPI @@ -417,6 +429,7 @@ void CollectData(cGH *GH, polypatch *perprocessor, polypatch *totals) { } #else /* !MPI */ + GH = GH; *totals = *perprocessor; #endif /* MPI */ } @@ -428,7 +441,7 @@ int IsoWriteDataToClients(char *metadata, IsoType type, void *data); -void WriteSock(cGH *GH, polypatch *totals, isosurfacerGH *myGH, +void WriteSock(const cGH *GH, polypatch *totals, isosurfacerGH *myGH, const char *fullname, int isoindex, CCTK_REAL4 IsoValue) { @@ -467,7 +480,7 @@ void WriteSock(cGH *GH, polypatch *totals, isosurfacerGH *myGH, /***************************************************************************/ -static void WriteHDF5(cGH *GH, polypatch *totals, isosurfacerGH *myGH, +static void WriteHDF5(const cGH *GH, polypatch *totals, isosurfacerGH *myGH, const char *fullname, int isoindex, CCTK_REAL4 IsoValue) { DECLARE_CCTK_PARAMETERS @@ -505,7 +518,7 @@ static void WriteHDF5(cGH *GH, polypatch *totals, isosurfacerGH *myGH, /***************************************************************************/ void -WriteBin(cGH *GH, polypatch *totals, isosurfacerGH *myGH, const char *fullname, +WriteBin(const cGH *GH, polypatch *totals, isosurfacerGH *myGH, const char *fullname, CCTK_REAL4 isolevel) { /* Write Isosurfaces in Manuel's own format which can @@ -566,7 +579,7 @@ WriteBin(cGH *GH, polypatch *totals, isosurfacerGH *myGH, const char *fullname, /***************************************************************************/ void -WriteVRML(cGH *GH, polypatch *totals, const char *fullname, +WriteVRML(const cGH *GH, polypatch *totals, const char *fullname, CCTK_REAL4 isolevel) { /* Write isosurfaces in VRML 1.0 ASCII format @@ -634,7 +647,7 @@ WriteVRML(cGH *GH, polypatch *totals, const char *fullname, /***************************************************************************/ void -WriteASCII(cGH *GH, polypatch *totals, const char *fullname, +WriteASCII(const cGH *GH, polypatch *totals, const char *fullname, CCTK_REAL4 isolevel) { /* Write Iso's in Paul's ASCII format */ @@ -692,7 +705,7 @@ WriteASCII(cGH *GH, polypatch *totals, const char *fullname, /***************************************************************************/ void -WriteUCD(cGH *GH, polypatch *totals, const char *fullname, +WriteUCD(const cGH *GH, polypatch *totals, const char *fullname, CCTK_REAL4 isolevel) { /* Write Iso's in AVS ascii UCD format */ @@ -760,7 +773,7 @@ WriteUCD(cGH *GH, polypatch *totals, const char *fullname, /***************************************************************************/ /* this is pretty redundant. Should be removed and just use doIso() */ -int IsoSurfacer_TimeForOutput(cGH *GH, int i){ +int IsoSurfacer_TimeForOutput(const cGH *GH, int i){ /* Get the GH extensions for IOUtil and IOASCII */ isosurfacerGH *myGH = (isosurfacerGH *)GH->extensions[CCTK_GHExtensionHandle("IsoSurfacer")]; if (!myGH ||!myGH->RunIsoSurfacer) @@ -771,7 +784,7 @@ int IsoSurfacer_TimeForOutput(cGH *GH, int i){ return doIso(i, GH, myGH); } -int IsoSurfacer_TriggerOutput(cGH *GH,int variable){ +int IsoSurfacer_TriggerOutput(const cGH *GH,int variable){ isosurfacerGH *myGH; myGH = (isosurfacerGH *) GH->extensions [CCTK_GHExtensionHandle ("IsoSurfacer")]; if(!myGH || !myGH->RunIsoSurfacer) return 0; |