[cig-commits] r14268 - long/3D/SNAC/trunk/Snac/plugins/restarter

cstark at geodynamics.org cstark at geodynamics.org
Mon Mar 9 15:41:53 PDT 2009


Author: cstark
Date: 2009-03-09 15:41:52 -0700 (Mon, 09 Mar 2009)
New Revision: 14268

Modified:
   long/3D/SNAC/trunk/Snac/plugins/restarter/InitialConditions.c
   long/3D/SNAC/trunk/Snac/plugins/restarter/Register.c
Log:
Restart: shift timeStep by restartStep and adjust maxTimeSteps accordingly.  

This at least makes time step printing correct after restart



Modified: long/3D/SNAC/trunk/Snac/plugins/restarter/InitialConditions.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter/InitialConditions.c	2009-03-09 03:35:58 UTC (rev 14267)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter/InitialConditions.c	2009-03-09 22:41:52 UTC (rev 14268)
@@ -48,11 +48,11 @@
 	Snac_Context*			context = (Snac_Context*)_context;
 	FILE* fp;
 	char fname[PATH_MAX];
+	sprintf( fname, "%s/snac.minLengthScale.restart", context->outputPath );
 #ifdef DEBUG
-	fprintf(stderr,"Restarter:  reading min length scale\n");
+	fprintf(stderr,"Restarter:  reading min length scale from %s\n",fname);
 #endif
-	sprintf( fname, "%s/snac.minLengthScale.restart", context->outputPath );
-	Journal_Firewall( (fp = fopen( fname, "r" )), "Failed to open %s\n", fname );
+	Journal_Firewall( (fp = fopen( fname, "r" )) != NULL, "Failed to open %s\n", fname );
 	fscanf(fp,"%le",&(context->initMinLengthScale));
 	fclose( fp );
 
@@ -66,11 +66,11 @@
 
 	Journal_Printf( context->snacInfo, "In: %s\n", __func__ );
 
+	sprintf(path, "%s/snac.coord.%d.%06d.restart",context->outputPath,context->rank,context->restartStep);
 #ifdef DEBUG
-	fprintf(stderr,"Restarter:  loading mesh coordinates\n");
+	fprintf(stderr,"Restarter:  loading mesh coordinates from %s for r=%d, ts=%d \n",path,context->rank,context->restartStep);
 #endif
-	sprintf(path, "%s/snac.coord.%d.%06d.restart",context->outputPath,context->rank,context->restartStep);
-	Journal_Firewall( ( (fp=fopen(path,"r")) != NULL), context->snacError, "Can't find %s - is the parameter \"restartStep\" set correctly in the input xml?\n", path );
+	Journal_Firewall( (fp = fopen(path,"r")) != NULL, "Can't find %s - is the parameter \"restartStep\" set correctly in the input xml?\n", path);
 
 	/* read in restart file to construct the initial mesh */
 	for( node_lI = 0; node_lI < context->mesh->nodeLocalCount; node_lI++ ) {
@@ -96,11 +96,11 @@
 
 	Journal_Printf( context->snacInfo, "In: %s\n", __func__ );
 
+	sprintf(path, "%s/snac.vel.%d.%06d.restart",context->outputPath,context->rank,context->restartStep);
 #ifdef DEBUG
-	fprintf(stderr,"Restarter:  loading mesh velocities\n");
+	fprintf(stderr,"Restarter:  loading mesh velocities from %s for r=%d, ts=%d \n",path,context->rank,context->restartStep);
 #endif
-	sprintf(path, "%s/snac.vel.%d.%06d.restart",context->outputPath,context->rank,context->restartStep);
-	Journal_Firewall( (fp = fopen(path,"r")) != NULL, "Can't find %s - is the parameter \"restartStep\" set correctly in the input xml?\n", path );
+	Journal_Firewall( (fp = fopen(path,"r")) != NULL, "Can't find %s - is the parameter \"restartStep\" set correctly in the input xml?\n", path);
 
 	/* read in restart file to construct the initial mesh */
 	for( node_lI = 0; node_lI < context->mesh->nodeLocalCount; node_lI++ ) {
@@ -126,8 +126,9 @@
 	Journal_Firewall( (fp = fopen(path,"r")) != NULL, "Can't find %s - is the parameter \"restartStep\" set correctly in the input xml?\n", path );
 
 #ifdef DEBUG
-	fprintf(stderr,"Restarter:  loading stress tensors\n");
+	fprintf(stderr,"Restarter:  loading stress tensors from %s for r=%d, ts=%d \n",path,context->rank,context->restartStep);
 #endif
+
 	/* read in restart file to assign initial stress field. */
 	for( element_lI = 0; element_lI < context->mesh->elementLocalCount; element_lI++ ) {
 		Snac_Element*			element = Snac_Element_At( context, element_lI );

Modified: long/3D/SNAC/trunk/Snac/plugins/restarter/Register.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter/Register.c	2009-03-09 03:35:58 UTC (rev 14267)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter/Register.c	2009-03-09 22:41:52 UTC (rev 14268)
@@ -91,6 +91,12 @@
 				  context->outputPath );
 	}
 
+	/*
+	 *  Shift the time step range to start from the restart time step
+	 */
+	context->timeStep += context->restartStep;
+	context->maxTimeSteps += context->restartStep;
+
 	EntryPoint_InsertBefore(
 		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
 		"SnacTimeStepZero",



More information about the CIG-COMMITS mailing list