From cc6c9241fc14fc481b0ceb27ea422ebfdd33a7f5 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 22 Apr 2002 11:53:40 +0000 Subject: Print verbose messages only if IO::verbose is set. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IsoSurfacer/trunk@57 bfcf8e34-485d-4d46-a995-1fd6fa6fb178 --- src/IsoSurfacer.c | 75 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/IsoSurfacer.c b/src/IsoSurfacer.c index e48a8a7..2ef852c 100644 --- a/src/IsoSurfacer.c +++ b/src/IsoSurfacer.c @@ -114,7 +114,6 @@ static int IsoSurfacerHandleCommands(const cGH *GH) /* Here it just needs to read from the control socket and then change the isosurface appropriately */ -#define VERBOSE #ifdef CCTK_MPI /* now we need to bcast this value to all procs */ { @@ -122,10 +121,11 @@ static int IsoSurfacerHandleCommands(const cGH *GH) 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 + if (verbose) + { + printf("+++++++++Process Command [%s] [%s] [%s]\n", + command.cmd.object,command.cmd.target,command.cmd.value); + } new_isovalue=atof(command.cmd.value); /* steer it. */ } else @@ -135,8 +135,8 @@ static int IsoSurfacerHandleCommands(const cGH *GH) tmpval=new_isovalue; CACTUS_MPI_ERROR(MPI_Bcast(&tmpval,1, - PUGH_MPI_REAL,0, /* ugh. nor REAL8 */ - pughGH->PUGH_COMM_WORLD)); + PUGH_MPI_REAL,0, /* ugh. nor REAL8 */ + pughGH->PUGH_COMM_WORLD)); new_isovalue=tmpval; /* copyback */ sprintf(stringval,"%f", tmpval); @@ -146,10 +146,11 @@ static int IsoSurfacerHandleCommands(const cGH *GH) } #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 + if (verbose) + { + printf("+++++++++Process Command [%s] [%s] [%s]\n", + command.cmd.object,command.cmd.target,command.cmd.value); + } /* Steer the parameter */ CCTK_ParameterSet("isovalue","isosurfacer",command.cmd.value); @@ -224,10 +225,10 @@ static void computeIso(int vindex, const cGH *GH, isosurfacerGH *myGH) int handle; handle = CCTK_ReductionHandle ("minimum"); CCTK_Reduce (GH_fake_const.non_const_ptr, 0,handle,1,CCTK_VARIABLE_REAL, - &(myGH->minval),1, vindex); + &(myGH->minval),1, vindex); handle = CCTK_ReductionHandle ("maximum"); CCTK_Reduce (GH_fake_const.non_const_ptr, 0, handle, 1, CCTK_VARIABLE_REAL, - &(myGH->maxval), 1, vindex); + &(myGH->maxval), 1, vindex); } if (CCTK_MyProc (GH) == 0){ @@ -243,31 +244,31 @@ static void computeIso(int vindex, const cGH *GH, isosurfacerGH *myGH) } if (verbose) printf(" | IsoSurfacer: GF=%s, value %f,", - fullname, myGH->isovalue); + fullname, myGH->isovalue); if(myGH->totals.nverts > 0) { if (verbose) - printf("%d vertices, %d triangles\n", myGH->totals.nverts, myGH->totals.npolys); + printf("%d vertices, %d triangles\n", myGH->totals.nverts, myGH->totals.npolys); if(myGH->formats & BIN) - WriteBin(GH, &myGH->totals, myGH, fullname, myGH->isovalue); + WriteBin(GH, &myGH->totals, myGH, fullname, myGH->isovalue); if(myGH->formats & ASCII) - WriteASCII(GH, &myGH->totals, fullname, myGH->isovalue); + WriteASCII(GH, &myGH->totals, fullname, myGH->isovalue); if(myGH->formats & UCD) - WriteUCD(GH, &myGH->totals,fullname, myGH->isovalue); + WriteUCD(GH, &myGH->totals,fullname, myGH->isovalue); if(myGH->formats & VRML) - WriteVRML(GH, &myGH->totals, fullname,myGH->isovalue); + WriteVRML(GH, &myGH->totals, fullname,myGH->isovalue); /* !!!!!!!!!!!!!!!!!! what is J representing???? */ if(myGH->formats & SOCK) - WriteSock(GH, &myGH->totals,myGH,fullname,0, myGH->isovalue); + WriteSock(GH, &myGH->totals,myGH,fullname,0, myGH->isovalue); if(myGH->formats & ISOHDF5) - WriteHDF5(GH, &myGH->totals,myGH,fullname,0, myGH->isovalue); + WriteHDF5(GH, &myGH->totals,myGH,fullname,0, myGH->isovalue); } else @@ -321,7 +322,7 @@ int IsoSurfacer (const cGH *GH) else { CCTK_VWarn (9, __LINE__, __FILE__, CCTK_THORNSTRING, - "No storage assigned for '%s'", CCTK_VarName (i)); + "No storage assigned for '%s'", CCTK_VarName (i)); } } @@ -368,7 +369,7 @@ void CollectData(const cGH *GH, polypatch *perprocessor, polypatch *totals) { my_vpcount [0] = 3*perprocessor->nverts; my_vpcount [1] = 3*perprocessor->npolys; CACTUS_MPI_ERROR (MPI_Gather (my_vpcount, 2, PUGH_MPI_INT4, vpcount, 2, - PUGH_MPI_INT4, 0, pughGH->PUGH_COMM_WORLD)); + PUGH_MPI_INT4, 0, pughGH->PUGH_COMM_WORLD)); /* Allocate for the vertices */ if(pughGH->myproc == 0){ @@ -407,7 +408,7 @@ void CollectData(const cGH *GH, polypatch *perprocessor, polypatch *totals) { if(lastNverts < totals->nverts){ REALLOC(totals->verts, 3+3*totals->nverts, CCTK_REAL4); if(compute_normals){ - REALLOC(totals->norms, 3+3*totals->nverts, CCTK_REAL4); + REALLOC(totals->norms, 3+3*totals->nverts, CCTK_REAL4); } lastNverts = totals->nverts; } @@ -419,17 +420,17 @@ void CollectData(const cGH *GH, polypatch *perprocessor, polypatch *totals) { /* Gather the vertex lists from all processors */ CACTUS_MPI_ERROR (MPI_Gatherv (perprocessor->verts, perprocessor->nverts*3, - PUGH_MPI_REAL4, totals->verts, vcount, vdispl, PUGH_MPI_REAL4, - 0, pughGH->PUGH_COMM_WORLD)); + PUGH_MPI_REAL4, totals->verts, vcount, vdispl, PUGH_MPI_REAL4, + 0, pughGH->PUGH_COMM_WORLD)); /* Gather the polygon lists from all processors */ CACTUS_MPI_ERROR (MPI_Gatherv (perprocessor->polys, perprocessor->npolys*3, - PUGH_MPI_INT4, totals->polys, pcount, pdispl, PUGH_MPI_INT4, - 0, pughGH->PUGH_COMM_WORLD)); + PUGH_MPI_INT4, totals->polys, pcount, pdispl, PUGH_MPI_INT4, + 0, pughGH->PUGH_COMM_WORLD)); if(compute_normals){ CACTUS_MPI_ERROR (MPI_Gatherv (perprocessor->norms, perprocessor->nnorms*3, - PUGH_MPI_REAL4, totals->norms, vcount, vdispl, PUGH_MPI_REAL4, - 0, pughGH->PUGH_COMM_WORLD)); + PUGH_MPI_REAL4, totals->norms, vcount, vdispl, PUGH_MPI_REAL4, + 0, pughGH->PUGH_COMM_WORLD)); } /* JMS Comment: Now we need to re-number the connectivity list so that @@ -439,8 +440,8 @@ void CollectData(const cGH *GH, polypatch *perprocessor, polypatch *totals) { if(pughGH->myproc == 0){ /* If I'm the master processor */ for(a = 1; anprocs; a++) { /* for segments gathered from each processor */ for(b = 0; bpolys[pdispl[a]+b] += vdispl[a]/3; + /* Add displacement to each connectivity integer */ + totals->polys[pdispl[a]+b] += vdispl[a]/3; } } } @@ -459,8 +460,8 @@ int IsoWriteDataToClients(char *metadata, void *data); void WriteSock(const cGH *GH, polypatch *totals, isosurfacerGH *myGH, - const char *fullname, int isoindex, - CCTK_REAL4 IsoValue) + const char *fullname, int isoindex, + CCTK_REAL4 IsoValue) { /* Was: parms->timestep, which was callnumber from above. */ char tmpstring[128]; @@ -474,9 +475,9 @@ void WriteSock(const cGH *GH, polypatch *totals, isosurfacerGH *myGH, /* Needs to collect min/max here */ sprintf(tmpstring," :%s[0]=%f,%u range=%f:%f", - fullname,myGH->isovalue, - GH->cctk_iteration, - myGH->minval,myGH->maxval); + fullname,myGH->isovalue, + GH->cctk_iteration, + myGH->minval,myGH->maxval); /*puts("sock out+++++++++++++++++"); puts(tmpstring); */ /********Now write vertices**********/ -- cgit v1.2.3