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

echoi at geodynamics.org echoi at geodynamics.org
Fri Sep 4 09:59:34 PDT 2009


Author: echoi
Date: 2009-09-04 09:59:34 -0700 (Fri, 04 Sep 2009)
New Revision: 15647

Added:
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Make.mm
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Makefile.def
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Register.c
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Register.h
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc.h
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_ElementCondFunc.c
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_ElementCondFunc.h
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_NodeCondFunc.c
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_NodeCondFunc.h
   long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/makefile
Modified:
   long/3D/SNAC/trunk/Snac/plugins/Makefile.def
Log:
A new plugin, "SnacCondFunc", will centralize the management of condition functions.

Users need only to modify SnacCondFunc_ElementCondFunc.{c,h} and/or SnacCondFunc_NodeCondFunc.{c,h} to add new condition functions. Existing code will function as templates.


Modified: long/3D/SNAC/trunk/Snac/plugins/Makefile.def
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/Makefile.def	2009-09-04 16:43:50 UTC (rev 15646)
+++ long/3D/SNAC/trunk/Snac/plugins/Makefile.def	2009-09-04 16:59:34 UTC (rev 15647)
@@ -32,4 +32,4 @@
 ##
 ##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-def_sub = customCartesianMesh cylinder_quadrant cylindrical elastic exchanger heterogeneities hydroStaticIC temperature maxwell plastic plSeeds remesher restarter restarter_old spherical viscoplastic vpSeeds winkler hillSlope tractionBC 
+def_sub = customCartesianMesh cylinder_quadrant cylindrical elastic exchanger heterogeneities hydroStaticIC temperature maxwell plastic plSeeds remesher restarter restarter_old spherical viscoplastic vpSeeds winkler hillSlope tractionBC conditionFunctions

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Make.mm
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Make.mm	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Make.mm	2009-09-04 16:59:34 UTC (rev 15647)
@@ -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 955 2004-03-04 18:43:37Z SteveQuenette $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+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/conditionFunctions/Makefile.def
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Makefile.def	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Makefile.def	2009-09-04 16:59:34 UTC (rev 15647)
@@ -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.
+##	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 1677 2004-07-20 10:30:34Z SteveQuenette $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 
+def_mod = SnacCondFunc
+def_inc = Snac/conditionFunctions
+
+def_srcs = \
+	Register.c \
+	SnacCondFunc_NodeCondFunc.c \
+	SnacCondFunc_ElementCondFunc.c
+
+def_hdrs = \
+	SnacCondFunc.h \
+	Register.h \
+	SnacCondFunc_NodeCondFunc.h \
+	SnacCondFunc_ElementCondFunc.h
+

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Register.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Register.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Register.c	2009-09-04 16:59:34 UTC (rev 15647)
@@ -0,0 +1,83 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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, wrioe to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+**
+** $Id: Register.c 3177 2005-12-22 00:01:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "SnacCondFunc.h"
+#include "Register.h"
+#include <stdio.h>
+
+/* Textual name of this class */
+const Type SnacCondFunc_Type = "SnacCondFunc";
+
+
+Index _SnacCondFunc_Register( PluginsManager* pluginsMgr ) {
+        return PluginsManager_Submit( pluginsMgr,
+                                      SnacCondFunc_Type,
+                                      "0",
+                                      _SnacCondFunc_DefaultNew );
+}
+
+
+void* _SnacCondFunc_DefaultNew( Name name ) {
+        return _Codelet_New( sizeof(Codelet),
+                             SnacCondFunc_Type,
+                             _Codelet_Delete,
+                             _Codelet_Print,
+                             _Codelet_Copy,
+                             _SnacCondFunc_DefaultNew,
+                             _SnacCondFunc_Construct,
+                             _Codelet_Build,
+                             _Codelet_Initialise,
+                             _Codelet_Execute,
+                             _Codelet_Destroy,
+                             name );
+}
+
+
+void _SnacCondFunc_Construct( void* component, Stg_ComponentFactory* cf, void* data ) {
+	Snac_Context*	context;
+	context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); 
+	Journal_Printf( context->snacInfo, "In: %s\n", __func__ );
+	
+	ConditionFunction_Register_Add(
+			context->condFunc_Register,
+			ConditionFunction_New(_SnacCondFunc_AssignPhaseID,"SnacCF_AssignPhaseID" ) );
+	ConditionFunction_Register_Add(
+			context->condFunc_Register,
+			ConditionFunction_New( _SnacCondFunc_MaxwellBenchmark,"SnacCF_MaxwellBenchmark" ) );
+	ConditionFunction_Register_Add(
+			context->condFunc_Register,
+			ConditionFunction_New( _SnacCondFunc_ObliqueRift,"SnacCF_ObliqueRift" ) );
+}
+

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Register.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Register.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/Register.h	2009-09-04 16:59:34 UTC (rev 15647)
@@ -0,0 +1,53 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~o
+**
+** 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 3177 2005-12-22 00:01:05Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __SnacCondFunc_Register_h__
+#define __SnacCondFunc_Register_h__
+	
+	/* Textual name of this class */
+	extern const Type SnacCondFunc_Type;
+	
+	Index _SnacCondFunc_Register( PluginsManager* pluginsMgr );
+
+	void* _SnacCondFunc_DefaultNew( Name name );
+
+	void _SnacCondFunc_Construct( void* component, Stg_ComponentFactory* cf, void* data );
+	
+#endif /* __SnacCondFunc_Register_h__ */

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc.h	2009-09-04 16:59:34 UTC (rev 15647)
@@ -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
+**
+** Role:
+**	Handles the temperature initial and boundary conditions
+**
+** Assumptions:
+**	None as yet.
+**
+** Comments:
+**	None as yet.
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __SnacCondFunc_h__
+#define __SnacCondFunc_h__
+
+        #include "Register.h"
+        #include "SnacCondFunc_NodeCondFunc.h"
+        #include "SnacCondFunc_ElementCondFunc.h"
+
+#endif /* __SnacCondFunc_h__ */

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_ElementCondFunc.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_ElementCondFunc.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_ElementCondFunc.c	2009-09-04 16:59:34 UTC (rev 15647)
@@ -0,0 +1,69 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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: SnacCondFunc_InitialCondition.c 3192 2006-06-14 03:07:59Z LaetitiaLePourhiet $
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "SnacCondFunc_ElementCondFunc.h"
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+/*
+  Assuming this cond func is called in the Element IC 
+  to assign spatially varying amaterial_I. 
+
+  Make this a template for other situations.
+*/
+void _SnacCondFunc_AssignPhaseID( Index element_lI, Variable_Index var_I, void* _context, void* result ){
+	Snac_Context*		context = (Snac_Context*)_context;
+	Snac_Element*		element = Snac_Element_At( context, element_lI );
+	Material_Index*		material_I = (Material_Index*)result;
+	
+	/* Stuff for convenience */
+	Mesh*				mesh = context->mesh;
+	MeshLayout*			layout = (MeshLayout*)mesh->layout;
+	HexaMD*				decomp = (HexaMD*)layout->decomp;
+	IJK					ijk;
+	Element_GlobalIndex	element_gI = _MeshDecomp_Element_LocalToGlobal1D( decomp, element_lI );
+	Index				oneThird = (unsigned int)((11.0/30.0)*decomp->elementGlobal3DCounts[0]);
+	Index				twoThirds = (unsigned int)((19.0/30.0)*decomp->elementGlobal3DCounts[0]);
+
+	RegularMeshUtils_Element_1DTo3D( decomp, element_gI, &ijk[0], &ijk[1], &ijk[2] );
+
+	fprintf(stderr,"Running %s\n",__func__);
+	
+	if( ijk[0] < oneThird )
+		(*material_I) = 0;
+	else if( ijk[0] >= oneThird && ijk[0] <= twoThirds )
+		(*material_I) = 1;
+	else
+		(*material_I) = 0;
+}

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_ElementCondFunc.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_ElementCondFunc.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_ElementCondFunc.h	2009-09-04 16:59:34 UTC (rev 15647)
@@ -0,0 +1,50 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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
+**
+** Role:
+**	Handles the temperature initial and boundary conditions
+**
+** Assumptions:
+**	None as yet.
+**
+** Comments:
+**	None as yet.
+**
+** $Id: Heat.h 1095 2004-03-28 00:51:42Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __Snac_CondFunc_ElementCondFunc_h__
+#define __Snac_CondFunc_ElementCondFunc_h__
+
+	void _SnacCondFunc_AssignPhaseID( 
+		Element_LocalIndex		element_lI, 
+		Variable_Index			var_I, 
+		void*				context, 
+		void*				result );
+
+#endif

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_NodeCondFunc.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_NodeCondFunc.c	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_NodeCondFunc.c	2009-09-04 16:59:34 UTC (rev 15647)
@@ -0,0 +1,80 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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: SnacCondFunc_InitialCondition.c 3192 2006-06-14 03:07:59Z LaetitiaLePourhiet $
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StGermain/FD/FD.h>
+#include "Snac/Snac.h"
+#include "Snac/Temperature/Temperature.h"
+#include "SnacCondFunc_NodeCondFunc.h"
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+
+/*
+  Velocity-related condition functions.
+*/
+void _SnacCondFunc_ObliqueRift( Index node_dI, Variable_Index var_I, void* _context, void* result ){
+	Snac_Context*		context = (Snac_Context*)_context;
+	Mesh*				mesh = context->mesh;
+	MeshLayout*			layout = (MeshLayout*)mesh->layout;
+	HexaMD*				decomp = (HexaMD*)layout->decomp;
+	
+	double*				velComponent = (double*)result;
+	IJK					ijk;
+	Node_GlobalIndex	node_gI = _MeshDecomp_Node_LocalToGlobal1D( decomp, node_dI );
+	Index				oneThird = (unsigned int)((11.0/30.0)*decomp->nodeGlobal3DCounts[0]);
+	Index				twoThirds = (unsigned int)((19.0/30.0)*decomp->nodeGlobal3DCounts[0]);
+	
+	const double vmag = 1.4e-06;
+
+	RegularMeshUtils_Node_1DTo3D( decomp, node_gI, &ijk[0], &ijk[1], &ijk[2] );
+	
+	if( ijk[0] < oneThird )
+		(*velComponent) = -1.0*vmag;
+	else if( ijk[0] >= oneThird && ijk[0] <= twoThirds )
+		(*velComponent) =  -1.0*vmag + 2.0*vmag*((double)(ijk[0])-(double)oneThird)/((double)twoThirds-(double)oneThird);
+	else
+		(*velComponent) = vmag;
+}
+
+void _SnacCondFunc_MaxwellBenchmark( Index index, Variable_Index var_I, void* _context, void* result ){
+	Snac_Context*			context = (Snac_Context*)_context;
+	
+	double*				vy = (double*)result;
+	if(context->timeStep > 0.02 * context->maxTimeSteps) 
+		(*vy)=0.0;
+	else 
+		(*vy) = 0.005*erfc(context->currentTime*4.0);
+	
+//        if(context->timeStep > 0.02 * context->maxTimeSteps) (*vx)=0.0;
+//        else (*vx) = 1.e-8;
+
+}

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_NodeCondFunc.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_NodeCondFunc.h	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/SnacCondFunc_NodeCondFunc.h	2009-09-04 16:59:34 UTC (rev 15647)
@@ -0,0 +1,56 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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
+**
+** Role:
+**	Handles the temperature initial and boundary conditions
+**
+** Assumptions:
+**	None as yet.
+**
+** Comments:
+**	None as yet.
+**
+** $Id: Heat.h 1095 2004-03-28 00:51:42Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __Snac_CondFunc_NodeCondFunc_h__
+#define __Snac_CondFunc_NodeCondFunc_h__
+
+	void _SnacCondFunc_MaxwellBenchmark(
+		Node_LocalIndex node_lI,
+		Variable_Index var_I,
+		void* context,
+		void* result );
+
+	void _SnacCondFunc_ObliqueRift(
+		Node_LocalIndex node_lI,
+		Variable_Index var_I,
+		void* context,
+		void* result );
+
+#endif

Added: long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/makefile
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/makefile	                        (rev 0)
+++ long/3D/SNAC/trunk/Snac/plugins/conditionFunctions/makefile	2009-09-04 16:59:34 UTC (rev 15647)
@@ -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.rules 1792 2004-07-30 05:42:39Z SteveQuenette $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# 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