[cig-commits] r14636 - in long/3D/SNAC/trunk/Snac/plugins: . restarter_old

echoi at geodynamics.org echoi at geodynamics.org
Wed Apr 8 15:01:28 PDT 2009


Author: echoi
Date: 2009-04-08 15:01:27 -0700 (Wed, 08 Apr 2009)
New Revision: 14636

Added:
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/InitialConditions.c
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/InitialConditions.h
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/Make.mm
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/Makefile.def
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/Register.c
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/Register.h
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/RestartOld.h
   long/3D/SNAC/trunk/Snac/plugins/restarter_old/makefile
Log:
Added "restarter_old" for the backward compatibility in the tensor output format.


Added: long/3D/SNAC/trunk/Snac/plugins/restarter_old/InitialConditions.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter_old/InitialConditions.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter_old/InitialConditions.c	2009-04-08 22:01:27 UTC (rev 14636)
@@ -0,0 +1,164 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** $Id: InitialConditions.c 2498 2005-01-07 03:57:00Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "InitialConditions.h"
+#include "Register.h"
+
+#include <string.h>
+#ifndef PATH_MAX
+	#define PATH_MAX 1024
+#endif
+
+#define DEBUG
+
+void _SnacRestartOld_resetMinLengthScale( void* _context, void* data ) {
+
+	Snac_Context*			context = (Snac_Context*)_context;
+	FILE* fp;
+	char fname[PATH_MAX];
+	sprintf( fname, "%s/snac.minLengthScale.restart", context->outputPath );
+#ifdef DEBUG
+	fprintf(stderr,"RestartOld:  reading min length scale from %s\n",fname);
+#endif
+	Journal_Firewall( (fp = fopen( fname, "r" )) != NULL, "Failed to open %s\n", fname );
+	fscanf(fp,"%le",&(context->initMinLengthScale));
+	fclose( fp );
+
+}
+
+void _SnacRestartOld_InitialCoords( void* _context, void* data ) {
+	Snac_Context*			context = (Snac_Context*)_context;
+	FILE*				fp;
+	Node_LocalIndex			node_lI;
+	char				path[PATH_MAX];
+
+	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,"RestartOld:  loading mesh coordinates from %s for r=%d, ts=%d \n",path,context->rank,context->restartStep);
+#endif
+	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++ ) {
+		Coord*		coord = Snac_NodeCoord_P( context, node_lI );
+		double		x,y,z;
+		fscanf( fp, "%le %le %le", &x,&y,&z);
+
+		(*coord)[0] = x;
+		(*coord)[1] = y;
+		(*coord)[2] = z;
+#ifdef DEBUG
+/* 		fprintf(stderr,"Node %d:  %g, %g, %g\n", node_lI, x,y,z); */
+#endif
+	}
+	fclose( fp );
+}
+
+void _SnacRestartOld_InitialVelocities( void* _context, void* data ) {
+	Snac_Context*			context = (Snac_Context*)_context;
+	FILE*				fp;
+	Node_LocalIndex			node_lI;
+	char				path[PATH_MAX];
+
+	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,"RestartOld:  loading mesh velocities from %s for r=%d, ts=%d \n",path,context->rank,context->restartStep);
+#endif
+	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++ ) {
+		Snac_Node*			node = Snac_Node_At( context, node_lI );
+		double				vx,vy,vz;
+		fscanf( fp, "%le %le %le", &vx,&vy,&vz);
+
+		node->velocity[0] = vx;
+		node->velocity[1] = vy;
+		node->velocity[2] = vz;
+	}
+	fclose( fp );
+}
+
+void _SnacRestartOld_InitialStress( void* _context, void* data ) {
+	Snac_Context*			context = (Snac_Context*)_context;
+	FILE*				fp;
+	Element_LocalIndex		element_lI;
+	char				path[PATH_MAX];
+
+	Journal_Printf( context->snacInfo, "In: %s\n", __func__ );
+	sprintf(path, "%s/snac.stressTensor.%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 );
+
+#ifdef DEBUG
+	fprintf(stderr,"RestartOld:  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 );
+		Tetrahedra_Index			tetra_I;
+		Stress				sVolAvg=0.0f;
+		Stress				sOtherAvg=0.0f;
+
+		for( tetra_I = 0; tetra_I < Tetrahedra_Count; tetra_I++ ) {
+			double				S[3][3];
+			Index               i,j;
+			fscanf( fp, "%le %le %le %le %le %le %le %le %le", &S[0][0],&S[0][1],&S[0][2],&S[1][0],&S[1][1],&S[1][2],&S[2][0],&S[2][1],&S[2][2]);
+			for(i=0;i<3;i++)
+				for(j=0;j<3;j++)
+					element->tetra[tetra_I].stress[i][j] = S[i][j];
+		}
+		element->hydroPressure = 0.0f;
+		for( tetra_I = 0; tetra_I < Tetrahedra_Count; tetra_I++ ) {
+			element->hydroPressure += element->tetra[tetra_I].stress[0][0] / Tetrahedra_Count;
+			sVolAvg +=
+				element->tetra[tetra_I].stress[1][1] * element->tetra[tetra_I].stress[2][2] +
+				element->tetra[tetra_I].stress[2][2] * element->tetra[tetra_I].stress[0][0] +
+				element->tetra[tetra_I].stress[0][0] * element->tetra[tetra_I].stress[1][1];
+			sOtherAvg +=
+				element->tetra[tetra_I].stress[0][1] * element->tetra[tetra_I].stress[0][1] +
+				element->tetra[tetra_I].stress[1][2] * element->tetra[tetra_I].stress[1][2] +
+				element->tetra[tetra_I].stress[0][2] * element->tetra[tetra_I].stress[0][2];
+		}
+		sVolAvg /= Tetrahedra_Count;
+		sOtherAvg /= Tetrahedra_Count;
+		element->stress = 0.5f * sqrt( 0.5f * fabs( -1.0f * sVolAvg + sOtherAvg ) );
+	}
+	fclose( fp );
+}

Added: long/3D/SNAC/trunk/Snac/plugins/restarter_old/InitialConditions.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter_old/InitialConditions.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter_old/InitialConditions.h	2009-04-08 22:01:27 UTC (rev 14636)
@@ -0,0 +1,54 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+*/
+/** \file
+** Role:
+**	With respect to the exchanger/citcom coupling, set up Snac's initial conditions.
+**	Facilitated by applying the spherical mesh input conditions and tagging the outer walls as force boudary conditions.
+**
+** Assumptions:
+**	The dicitonary has a struct entry call "citcom", which has the values "thetaMin", "thetaMax", "phiMin", "phiMax", "rMin" and
+**		"rMax" within it as doubles.
+**
+** Comments:
+**	Needs to be added to the "AbstractContext_EP_IC" entry point as "EntryPoint_Add_AppendBeforeDefault", as it will change the
+**		initial geometry (and Snac's IC function calcs from it and dumps values to file).
+**
+** $Id: InitialConditions.h 1431 2004-05-18 07:19:21Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __SnacRestartOld_InitialConditions_h__
+#define __SnacRestartOld_InitialConditions_h__
+
+	void _SnacRestartOld_resetMinLengthScale( void* _context, void* data );
+	void _SnacRestartOld_InitialCoords( void* _context, void* data );
+	void _SnacRestartOld_InitialVelocities( void* _context, void* data );
+	void _SnacRestartOld_InitialStress( void* _context, void* data );
+
+#endif /* __SnacRestartOld_InitialConditions_h__ */

Added: long/3D/SNAC/trunk/Snac/plugins/restarter_old/Make.mm
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter_old/Make.mm	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter_old/Make.mm	2009-04-08 22:01:27 UTC (rev 14636)
@@ -0,0 +1,67 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003, 
+##	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+##	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+##	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+##
+## Authors:
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+##	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+##	Luc Lavier, Research Scientist, Caltech.
+##
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+##
+## $Id: Make.mm 2921 2005-05-10 06:44:06Z EunseoChoi $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+include Makefile.def
+
+PROJECT = Snac
+PACKAGE = ${def_mod}module
+
+PROJ_LIB = $(BLD_LIBDIR)/$(PACKAGE).a
+PROJ_DLL = $(BLD_LIBDIR)/$(PACKAGE).$(EXT_SO)
+PROJ_TMPDIR = $(BLD_TMPDIR)/$(PROJECT)/$(PACKAGE)
+PROJ_CLEAN += $(PROJ_LIB) $(PROJ_DLL)
+PROJ_INCDIR = $(BLD_INCDIR)/${def_inc}
+
+PROJ_SRCS = ${def_srcs}
+PROJ_CC_FLAGS += -I$(BLD_INCDIR)/$(PROJECT) -I$(BLD_INCDIR)/Snac -I$(BLD_INCDIR)/StGermain -I$(STGERMAIN_INCDIR)/ -I$(STGERMAIN_INCDIR)/StGermain `xml2-config --cflags` -DCURR_MODULE_NAME=\"${def_mod}\"
+PROJ_LIBRARIES = -L$(BLD_LIBDIR) -L$(STGERMAIN_LIBDIR)/ -lSnac -lStGermain `xml2-config --libs` $(MPI_LIBPATH) $(MPI_LIBS)
+LCCFLAGS =
+
+# I keep file lists to build a monolith .so from a set of .a's
+PROJ_OBJS_IN_TMP = ${addprefix $(PROJECT)/$(PACKAGE)/, ${addsuffix .o, ${basename $(PROJ_SRCS)}}}
+PROJ_OBJLIST = $(BLD_TMPDIR)/$(PROJECT).$(PACKAGE).objlist
+
+all: $(PROJ_LIB) DLL createObjList export
+
+DLL: product_dirs $(PROJ_OBJS)
+	$(CC) -o $(PROJ_DLL) $(PROJ_OBJS) $(COMPILER_LCC_SOFLAGS) $(LCCFLAGS) $(PROJ_LIBRARIES) $(EXTERNAL_LIBPATH) $(EXTERNAL_LIBS)
+
+
+
+createObjList:: 
+	@echo ${PROJ_OBJS_IN_TMP} | cat > ${PROJ_OBJLIST}
+
+#export:: export-headers
+export:: export-headers export-libraries
+EXPORT_HEADERS = ${def_hdrs}
+EXPORT_LIBS = $(PROJ_LIB) $(PROJ_DLL)
+
+check::

Added: long/3D/SNAC/trunk/Snac/plugins/restarter_old/Makefile.def
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter_old/Makefile.def	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter_old/Makefile.def	2009-04-08 22:01:27 UTC (rev 14636)
@@ -0,0 +1,43 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003, 
+##	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+##	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+##	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+##
+## Authors:
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+##	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+##	Luc Lavier, Research Scientist, Caltech.
+##	Luc Lavier, Caltech.
+##
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+##
+## $Id: Makefile.def 1683 2004-07-20 21:14:23Z EunseoChoi $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 
+def_mod = SnacRestartOld
+def_inc = Snac/RestartOld
+
+def_srcs = \
+	InitialConditions.c \
+	Register.c
+
+def_hdrs = \
+	InitialConditions.h \
+	Register.h \
+	RestartOld.h

Added: long/3D/SNAC/trunk/Snac/plugins/restarter_old/Register.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter_old/Register.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter_old/Register.c	2009-04-08 22:01:27 UTC (rev 14636)
@@ -0,0 +1,131 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003,
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** $Id: Register.c 2498 2005-01-07 03:57:00Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "InitialConditions.h"
+#include "Register.h"
+#include <stdio.h>
+
+#ifndef PATH_MAX
+	#define PATH_MAX 1024
+#endif
+
+#define DEBUG
+
+/* Textual name of this class */
+const Type SnacRestartOld_Type = "SnacRestartOld";
+
+
+Index _SnacRestartOld_Register( PluginsManager* pluginsMgr ) {
+	return PluginsManager_Submit( pluginsMgr, 
+				      SnacRestartOld_Type, 
+				      "0", 
+				      _SnacRestartOld_DefaultNew );
+}
+
+
+void* _SnacRestartOld_DefaultNew( Name name ) {
+	return _Codelet_New( sizeof(Codelet), 
+			     SnacRestartOld_Type, 
+			     _Codelet_Delete, 
+			     _Codelet_Print, 
+			     _Codelet_Copy, 
+			     _SnacRestartOld_DefaultNew, 
+			     _SnacRestartOld_Construct, 
+			     _Codelet_Build, 
+			     _Codelet_Initialise, 
+			     _Codelet_Execute, 
+			     _Codelet_Destroy, 
+			     name );
+}
+
+
+void _SnacRestartOld_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
+	Snac_Context*	context;
+	char fname[PATH_MAX];
+	FILE *fp;
+
+	/* Retrieve context. */
+	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 
+
+#ifdef DEBUG
+	printf( "In: _SnacRestartOld_Register( void* )\n" );
+#endif
+
+	if( context->rank == 0 ) {
+		sprintf( fname, "%s/coord.%d", context->outputPath, context->rank );
+		Journal_Firewall( ( ( fp = fopen( fname, "r") ) == NULL ), 
+				  context->snacError, 
+				  "\n\n ###### RESTARTER ERROR ######\n Do NOT restart in %s!!\n All the existing outputs will be overwritten !!\n If absolutely sure, remove the existing outputs first.\n #############################\n\n", 
+				  context->outputPath );
+	}
+
+	/*
+	 *  Shift the time step range to start from the restart time step
+	 *    - this doesn't seem to work since the changes don't appear to propagate into StGermain
+	 *     far enough to cause the maxTimeSteps to stop the simulation when desired
+	 */
+/* 	context->timeStep += context->restartStep; */
+/* 	context->maxTimeSteps += context->restartStep; */
+
+	EntryPoint_InsertBefore(
+		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
+		"SnacTimeStepZero",
+		SnacRestartOld_Type,
+		_SnacRestartOld_resetMinLengthScale,
+		SnacRestartOld_Type );
+	EntryPoint_InsertBefore(
+		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
+		"SnacTimeStepZero",
+		SnacRestartOld_Type,
+		_SnacRestartOld_InitialCoords,
+		SnacRestartOld_Type );
+	EntryPoint_InsertBefore(
+		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
+		"SnacTimeStepZero",
+		SnacRestartOld_Type,
+		_SnacRestartOld_InitialVelocities,
+		SnacRestartOld_Type );
+	EntryPoint_InsertBefore(
+		Context_GetEntryPoint( context, AbstractContext_EP_Initialise ),
+		"SnacTimeStepZero",
+		SnacRestartOld_Type,
+		_SnacRestartOld_InitialStress,
+		SnacRestartOld_Type );
+
+/* 	_SnacRestartOld_resetMinLengthScale(context,data); */
+/* 	_SnacRestartOld_InitialCoords(context,data); */
+/* 	_SnacRestartOld_InitialVelocities(context,data); */
+/* 	_SnacRestartOld_InitialStress(context,data); */
+}

Added: long/3D/SNAC/trunk/Snac/plugins/restarter_old/Register.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter_old/Register.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter_old/Register.h	2009-04-08 22:01:27 UTC (rev 14636)
@@ -0,0 +1,53 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, 
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+** 
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+** 
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+*/
+/** \file
+** Role:
+**
+** Assumptions:
+**	Only one can be registered at the time (limitation).
+**
+** Comments:
+**
+** $Id: Register.h 1848 2004-08-11 07:10:08Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __SnacRestartOld_Register_h__
+#define __SnacRestartOld_Register_h__
+	
+	/* Textual name of this class */
+	extern const Type SnacRestartOld_Type;
+	
+	Index _SnacRestartOld_Register( PluginsManager* pluginsMgr );
+
+	void* _SnacRestartOld_DefaultNew( Name name );
+
+	void _SnacRestartOld_Construct( void* component, Stg_ComponentFactory* cf, void* data );
+	
+#endif /* __SnacRestartOld_Register_h__ */

Added: long/3D/SNAC/trunk/Snac/plugins/restarter_old/RestartOld.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter_old/RestartOld.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter_old/RestartOld.h	2009-04-08 22:01:27 UTC (rev 14636)
@@ -0,0 +1,46 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, 
+**	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+**	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+**	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+**	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+**	Luc Lavier, Research Scientist, Caltech.
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 2, or (at your option) any
+** later version.
+** 
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+** 
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+*/
+/** \file
+** Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: Spherical.h 1431 2004-05-18 07:19:21Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __SnacRestart_h__
+#define __SnacRestart_h__
+	
+	#include "InitialConditions.h"
+	#include "Register.h"
+	
+#endif /* __SnacRestart_h__ */

Added: long/3D/SNAC/trunk/Snac/plugins/restarter_old/makefile
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/restarter_old/makefile	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/restarter_old/makefile	2009-04-08 22:01:27 UTC (rev 14636)
@@ -0,0 +1,53 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003, 
+##	Steve Quenette, 110 Victoria Street, Melbourne, Victoria, 3053, Australia.
+##	Californian Institute of Technology, 1200 East California Boulevard, Pasadena, California, 91125, USA.
+##	University of Texas, 1 University Station, Austin, Texas, 78712, USA.
+##
+## Authors:
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	Stevan M. Quenette, Visitor in Geophysics, Caltech.
+##	Luc Lavier, Research Scientist, The University of Texas. (luc at utig.ug.utexas.edu)
+##	Luc Lavier, Research Scientist, Caltech.
+##
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+## 
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+## 
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+##
+## $Id: makefile 3049 2005-06-22 07:46:15Z AlanLo $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# obtain defaults for required variables according to system and project location, and then run the build.
+ifndef PROJ_ROOT
+	PROJ_ROOT=../..
+endif
+include ${PROJ_ROOT}/Makefile.system
+
+include Makefile.def
+
+mod = ${def_mod}
+includes = ${def_inc}
+
+SRCS = ${def_srcs}
+
+HDRS = ${def_hdrs}
+
+PROJ_LIBS = ${def_libs}
+EXTERNAL_LIBS = -L${STGERMAIN_LIBDIR}  -lSnac -lStGermain 
+EXTERNAL_INCLUDES = -I${STGERMAIN_INCDIR}/StGermain -I${STGERMAIN_INCDIR} 
+
+packages = MPI XML MATH
+
+include ${PROJ_ROOT}/Makefile.vmake



More information about the CIG-COMMITS mailing list