[cig-commits] r14344 - in long/3D/Gale/trunk: . src/Underworld/plugins/Output/VTKOutput
walter at geodynamics.org
walter at geodynamics.org
Mon Mar 16 14:00:48 PDT 2009
Author: walter
Date: 2009-03-16 14:00:48 -0700 (Mon, 16 Mar 2009)
New Revision: 14344
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c
Log:
r2555 at dante: boo | 2009-03-16 14:00:00 -0700
Make VTKOutput more robust when files don't exist. Also get rid of MPI_Comm stuff since context has the rank and nprocs info
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2554
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2555
Modified: long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c 2009-03-16 21:00:45 UTC (rev 14343)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c 2009-03-16 21:00:48 UTC (rev 14344)
@@ -96,16 +96,6 @@
UnderworldContext* context = (UnderworldContext*)_context;
Dictionary* dictionary = context->dictionary;
- int myRank, nprocs;
- MPI_Comm comm;
-
- comm=CommTopology_GetComm
- ( Mesh_GetCommTopology(context->picIntegrationPoints->mesh,
- MT_VERTEX));
-
- MPI_Comm_rank( comm, (int*)&myRank );
- MPI_Comm_size( comm, (int*)&nprocs );
-
/* Only dump if at the right time step. We use timeStep-1,
because we are outputing after a solve, but before
advection. So timeStep-1 makes more sense in terms of when
@@ -121,8 +111,9 @@
Dictionary_GetInt_WithDefault
(dictionary,"particleStepping",1),
context->outputPath, context->timeStep-1,
- context->dim,myRank,nprocs);
- VTKOutput_fields(context,myRank,nprocs,context->timeStep-1);
+ context->dim,context->rank,context->nproc);
+ VTKOutput_fields(context,context->rank,context->nproc,
+ context->timeStep-1);
}
void VTKOutput_particles(IntegrationPointsSwarm* picswarm,
@@ -151,12 +142,24 @@
fp=fopen(filename,"w");
Memory_Free( filename );
+ if(fp==NULL)
+ {
+ fprintf(stderr,"WARNING: Can not open particle file for rank %d step %d\n",myRank,
+ timeStep);
+ return;
+ }
/* Open the parallel control file */
if(myRank==0)
{
Stg_asprintf( &filename, "%s/particles.%05d.pvtu", outputPath, timeStep);
pfp=fopen(filename,"w");
Memory_Free( filename );
+
+ if(pfp==NULL)
+ {
+ fprintf(stderr,"FATAL ERROR: Can not open master particle file for step %d",timeStep);
+ abort();
+ }
}
/* Write a header */
@@ -451,11 +454,16 @@
Stg_asprintf( &field_filename, "%s/fields.%d.%05d.vts", self->outputPath,
myRank, timeStep);
-
field_fp=fopen(field_filename,"w");
-
Memory_Free( field_filename );
+ if(field_fp==NULL)
+ {
+ fprintf(stderr,"WARNING: Can not open fields file for rank %d step %d\n",
+ myRank,timeStep);
+ return;
+ }
+
/* Print out the parallel control files if rank==0 */
if(myRank==0)
{
@@ -463,6 +471,13 @@
timeStep);
pfield_fp=fopen(field_filename,"w");
Memory_Free( field_filename );
+ if(pfield_fp==NULL)
+ {
+ fprintf(stderr,
+ "FATAL ERROR: Can not open master fields file for step %d\n",
+ timeStep);
+ abort();
+ }
}
/* First, update the fields that are derived from particles. This
More information about the CIG-COMMITS
mailing list