aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjshalf <jshalf@bfcf8e34-485d-4d46-a995-1fd6fa6fb178>2000-12-15 09:04:26 +0000
committerjshalf <jshalf@bfcf8e34-485d-4d46-a995-1fd6fa6fb178>2000-12-15 09:04:26 +0000
commit630488ceb5e2419de52ed7d1c0c4ea665cdd60ce (patch)
tree1aa5bbaced6b2abcc2481af298d48a8a31158273 /src
parent0ccc9a60fa04d9a2f03ad7a65e3777d730fa07ec (diff)
Added parallel collection of vertex normals.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IsoSurfacer/trunk@29 bfcf8e34-485d-4d46-a995-1fd6fa6fb178
Diffstat (limited to 'src')
-rw-r--r--src/IsoSurfacer.c16
-rw-r--r--src/IsoSurfacerInit.c8
2 files changed, 21 insertions, 3 deletions
diff --git a/src/IsoSurfacer.c b/src/IsoSurfacer.c
index c9c6b86..d811495 100644
--- a/src/IsoSurfacer.c
+++ b/src/IsoSurfacer.c
@@ -202,7 +202,7 @@ static void computeIso(int index, cGH *GH, isosurfacerGH *myGH)
i = CCTK_CoordIndex (-1,"z","cart3d");
zcoords = (CCTK_REAL *) CCTK_VarDataPtrI (GH, timelevel, i);
/* Actually perform the Isosurfacing Operation */
- NuFindSurface(data,nx,ny,nz,xcoords,ycoords,zcoords,myGH->isovalue,0,&(myGH->perprocessor));
+ NuFindSurface(data,nx,ny,nz,xcoords,ycoords,zcoords,myGH->isovalue,myGH->ComputeNormals,&(myGH->perprocessor));
/* And collect the geometry to node 0 */
CollectData(GH, &(myGH->perprocessor), &(myGH->totals));
/* and for the writers, collect min,max to node 0 */
@@ -354,6 +354,10 @@ void CollectData(cGH *GH, polypatch *perprocessor, polypatch *totals) {
totals->nverts /= 3;
totals->npolys /= 3;
+ if(compute_normals)
+ totals->nnorms=totals->nverts;
+ else
+ totals->nnorms=0;
/*
Kludge:
@@ -366,12 +370,15 @@ void CollectData(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);
+ }
lastNverts = totals->nverts;
}
if(lastNpolys < totals->npolys){
REALLOC(totals->polys, 3+3*totals->npolys, CCTK_INT4);
lastNpolys = totals->npolys;
- }
+ }
} /* end processor 0 setup */
/* Gather the vertex lists from all processors */
@@ -383,6 +390,11 @@ void CollectData(cGH *GH, polypatch *perprocessor, polypatch *totals) {
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));
+ 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));
+ }
/* JMS Comment:
Now we need to re-number the connectivity list so that
they can be combined in the master list (remember, the
diff --git a/src/IsoSurfacerInit.c b/src/IsoSurfacerInit.c
index 16c872d..746d6c1 100644
--- a/src/IsoSurfacerInit.c
+++ b/src/IsoSurfacerInit.c
@@ -30,6 +30,8 @@ void *IsoSurfacer_SetupGH (tFleshConfig *config,
myGH->perprocessor.nverts = myGH->totals.nverts = 0;
myGH->perprocessor.polys = myGH->totals.polys = NULL;
myGH->perprocessor.npolys = myGH->totals.npolys = 0;
+ myGH->perprocessor.norms = myGH->totals.norms = NULL;
+ myGH->perprocessor.nnorms = myGH->totals.nnorms = 0;
return myGH;
}
@@ -51,18 +53,22 @@ int IsoSurfacer_InitGH (cGH *GH){
myGH = (isosurfacerGH *) GH->extensions [CCTK_GHExtensionHandle ("IsoSurfacer")];
- printf("IsoInit\n");
+ /*printf("IsoInit\n"); */
/* initialize values */
myGH->funcName=0;
myGH->formats=0;
myGH->outfreq=output_frequency;
myGH->firstIteration=output_start;
myGH->ComputeNormals=compute_normals;
+ /* printf("************* compute Normals = %u *****************\n",
+ myGH->ComputeNormals); */
myGH->isovalue=isovalue;
myGH->perprocessor.verts = myGH->totals.verts = NULL;
myGH->perprocessor.nverts = myGH->totals.nverts = 0;
myGH->perprocessor.polys = myGH->totals.polys = NULL;
myGH->perprocessor.npolys = myGH->totals.npolys = 0;
+ myGH->perprocessor.norms = myGH->totals.norms = NULL;
+ myGH->perprocessor.nnorms = myGH->totals.nnorms = 0;
myGH->minval=0.0;
myGH->maxval=1.0;