aboutsummaryrefslogtreecommitdiff
path: root/src/IsoSurfacer.c
diff options
context:
space:
mode:
authorjshalf <jshalf@bfcf8e34-485d-4d46-a995-1fd6fa6fb178>2000-10-30 03:29:03 +0000
committerjshalf <jshalf@bfcf8e34-485d-4d46-a995-1fd6fa6fb178>2000-10-30 03:29:03 +0000
commite6d057402882838b675d5b2afbe56ea02ffbba60 (patch)
treedc7f97c47ba8b6642c7e53b73338db362f96d96b /src/IsoSurfacer.c
parent0df7382c160c68a507a22457d81f62bb66f3df5f (diff)
Forgot to take PUGH into account for steering.
So now it properly propagates steering information to *ALL* processes when running in MPI mode. Also added parameters so that it is fully compatable in terms of parameters with the old isosurfacer (still testing this though). git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IsoSurfacer/trunk@15 bfcf8e34-485d-4d46-a995-1fd6fa6fb178
Diffstat (limited to 'src/IsoSurfacer.c')
-rw-r--r--src/IsoSurfacer.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/src/IsoSurfacer.c b/src/IsoSurfacer.c
index fc421b6..6c20659 100644
--- a/src/IsoSurfacer.c
+++ b/src/IsoSurfacer.c
@@ -58,8 +58,10 @@ static void WriteHDF5(cGH *GH, polypatch *totals, isosurfacerGH *myGH,
/***************************************************************************/
static int IsoSurfacerHandleCommands(cGH *GH)
{
+ IsoCommand *Iso_PollCommand(cGH *cctkGH,IsoCommand *cmd);
IsoCommand command;
isosurfacerGH *myGH = (isosurfacerGH *) GH->extensions [CCTK_GHExtensionHandle ("IsoSurfacer")];
+ if(!myGH->RunIsoSurfacer) return 0; /* not running */
/* Grab all events that are waiting in queue */
/*
@@ -108,21 +110,46 @@ static int IsoSurfacerHandleCommands(cGH *GH)
/* Here it just needs to read from the control socket
and then change the isosurface appropriately */
- IsoCommand *Iso_PollCommand(cGH *cctkGH,IsoCommand *cmd);
+#ifdef CCTK_MPI
+ /* now we need to bcast this value to all procs */
+ {
+ CCTK_REAL tmpval;
+ pGH *pughGH = PUGH_pGH (GH);
+ if(pughGH->myproc==0 && Iso_PollCommand(GH,&command)){
+#ifdef VERBOSE
+ printf("+++++++++Process Command [%s] [%s] [%s]\n",
+ command.cmd.object,command.cmd.target,command.cmd.value);
+#endif
+ myGH->isovalue=atof(command.cmd.value); /* steer it. */
+ }
+ tmpval=myGH->isovalue;
+ CACTUS_MPI_ERROR(MPI_Bcast(&tmpval,1,
+ PUGH_MPI_REAL,0, /* ugh. nor REAL8 */
+ pughGH->PUGH_COMM_WORLD));
+ myGH->isovalue=tmpval; /* copyback */
+ }
+#else
if(Iso_PollCommand(GH,&command)){
#ifdef VERBOSE
printf("+++++++++Process Command [%s] [%s] [%s]\n",
command.cmd.object,command.cmd.target,command.cmd.value);
#endif
myGH->isovalue=atof(command.cmd.value); /* steer it. */
+ /* If we have MPI, must propagate the steering info
+ to all processes */
}
+#endif
return 0;
}
static int doIso(int index, cGH *GH, isosurfacerGH *myGH)
{
- char *fullname = CCTK_FullName (index);
+ char *fullname;
+
+ if(!myGH->RunIsoSurfacer) return 0;
+
+ fullname = CCTK_FullName (index);
/* printf("Check doIso: fullname[%s]:[%s]",fullname,myGH->funcName);*/
if(!strcmp(fullname,myGH->funcName)){
if(myGH->firstIteration<=GH->cctk_iteration &&
@@ -141,12 +168,16 @@ static void computeIso(int index, cGH *GH, isosurfacerGH *myGH)
{
DECLARE_CCTK_PARAMETERS
/* is it really required to have this static here?? */
- char* fullname = CCTK_FullName (index);
+ char* fullname;
int i,j;
int nx,ny,nz;
CCTK_REAL *xcoords,*ycoords,*zcoords,*data;
int timelevel;
timelevel = CCTK_NumTimeLevelsFromVarI (index);
+
+ if(!myGH->RunIsoSurfacer) return; /* not running */
+
+ fullname = CCTK_FullName (index);
if (timelevel > 0)
timelevel--;
data = (CCTK_REAL *) GH->data [index][timelevel];
@@ -233,6 +264,7 @@ static void computeIso(int index, cGH *GH, isosurfacerGH *myGH)
int IsoSurfacer(cGH *GH){
int i,n;
isosurfacerGH *myGH = (isosurfacerGH *) GH->extensions [CCTK_GHExtensionHandle ("IsoSurfacer")];
+ if(!myGH->RunIsoSurfacer) return 0; /* not running */
IsoSurfacerHandleCommands(GH);
/* do a check for new isosurfaces */
/* Perhaps do a bcast for "changed" flags.
@@ -276,17 +308,7 @@ void CollectData(cGH *GH, polypatch *perprocessor, polypatch *totals) {
static CCTK_INT4 *vpcount = NULL;
pGH *pughGH;
-
pughGH = PUGH_pGH (GH);
-
-#if 0
- cdtimes.ncalls++;
-#ifndef _WIN32
- cdtimes.realtime_begin = times(&cdtimes.tms_begin);
-#endif
-
-#endif
-
/* Allocate temporary arrays for the MPI_Gatherv() operation */
if(pughGH->myproc == 0) {
if(vpcount == NULL) {
@@ -704,7 +726,7 @@ WriteUCD(cGH *GH, polypatch *totals, const char *fullname,
int IsoSurfacer_TimeForOutput(cGH *GH, int i){
/* Get the GH extensions for IOUtil and IOASCII */
isosurfacerGH *myGH = (isosurfacerGH *)GH->extensions[CCTK_GHExtensionHandle("IsoSurfacer")];
- if (!myGH)
+ if (!myGH ||!myGH->RunIsoSurfacer)
return 0;
/* do a check for new isosurfaces */
/* Perhaps do a bcast for "changed" flags.
@@ -715,6 +737,7 @@ int IsoSurfacer_TimeForOutput(cGH *GH, int i){
int IsoSurfacer_TriggerOutput(cGH *GH,int variable){
isosurfacerGH *myGH;
myGH = (isosurfacerGH *) GH->extensions [CCTK_GHExtensionHandle ("IsoSurfacer")];
+ if(!myGH || !myGH->RunIsoSurfacer) return 0;
computeIso(variable,GH,myGH);
/* FIXME MAYBE
myGH->out1D_last[variable] = GH->cctk_iteration;