[cig-commits] r6193 - in long/3D/Gale/trunk/src/PICellerator: . MaterialPoints/src MaterialPoints/tests Utils/src Utils/tests Utils/tests/expected libPICellerator libPICellerator/src libPICellerator/tests libPICellerator/tests/expected

walter at geodynamics.org walter at geodynamics.org
Thu Mar 8 11:26:20 PST 2007


Author: walter
Date: 2007-03-08 11:20:46 -0800 (Thu, 08 Mar 2007)
New Revision: 6193

Added:
   long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.c
   long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.h
   long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.meta
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_Circle.0of1.output.dat.expected
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_ExpIface.0of1.output.dat.expected
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_Poly.0of1.output.dat.expected
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/log/
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/makefile
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/output/
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/testElementIntegral.xml
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC.xml
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Circle.0of1.sh
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_ExpIface.0of1.sh
   long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Poly.0of1.sh
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/expected/
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/expected/testLibPICellerator.0of1.expected
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/log/
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/makefile
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/output/
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.0of1.sh
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.c
Modified:
   long/3D/Gale/trunk/src/PICellerator/
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/CoincidentMapper.c
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/CoincidentMapper.h
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/GaussMapper.c
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/GaussMapper.h
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointMapper.c
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointMapper.h
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.c
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.h
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/ManyToOneMapper.c
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/ManyToOneMapper.h
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/Material.c
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/Material.h
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/MaterialPointsSwarm.c
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/MaterialPointsSwarm.h
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/OneToOneMapper.c
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/OneToOneMapper.h
   long/3D/Gale/trunk/src/PICellerator/MaterialPoints/tests/testPeriodicBCs.c
   long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTerm.c
   long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTerm.h
   long/3D/Gale/trunk/src/PICellerator/Utils/src/Init.c
   long/3D/Gale/trunk/src/PICellerator/Utils/src/PCDVC.c
   long/3D/Gale/trunk/src/PICellerator/Utils/src/Utils.h
   long/3D/Gale/trunk/src/PICellerator/Utils/src/types.h
   long/3D/Gale/trunk/src/PICellerator/libPICellerator/src/Init.c
Log:
 r571 at earth (orig r439):  LukeHodkinson | 2007-03-06 14:20:02 -0800
 Keeping the branch up to date with the trunk.
 
 



Property changes on: long/3D/Gale/trunk/src/PICellerator
___________________________________________________________________
Name: svk:merge
   - 00de75e2-39f1-0310-8538-9683d00a49cc:/branches/decomp3d:431
00de75e2-39f1-0310-8538-9683d00a49cc:/trunk:381
aee11096-cf10-0410-a191-eea5772ba81f:/cig:524
   + 00de75e2-39f1-0310-8538-9683d00a49cc:/branches/decomp3d:439
00de75e2-39f1-0310-8538-9683d00a49cc:/trunk:381
aee11096-cf10-0410-a191-eea5772ba81f:/cig:524

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/CoincidentMapper.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/CoincidentMapper.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/CoincidentMapper.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -65,6 +65,62 @@
 
 const Type CoincidentMapper_Type = "CoincidentMapper";
 
+CoincidentMapper* CoincidentMapper_New(
+	Name                       name,
+	IntegrationPointsSwarm*    integrationSwarm,
+	MaterialPointsSwarm*       materialSwarm
+	)
+{
+	CoincidentMapper* self = (CoincidentMapper*) _CoincidentMapper_New(
+		sizeof(CoincidentMapper),
+		CoincidentMapper_Type,
+		_CoincidentMapper_Delete,
+		_CoincidentMapper_Print,
+		_CoincidentMapper_Copy,
+		_CoincidentMapper_DefaultNew,
+		_CoincidentMapper_Construct,
+		_CoincidentMapper_Build,
+		_CoincidentMapper_Initialise,
+		_CoincidentMapper_Execute,
+		_CoincidentMapper_Destroy,
+		_CoincidentMapper_Map,
+		_OneToOneMapper_GetMaterialPointsSwarms,
+		_OneToOneMapper_GetMaterialIndexOn,
+		_OneToOneMapper_GetExtensionOn,
+		name,
+		True, /* initFlag */
+		integrationSwarm,
+		materialSwarm
+		);
+
+	return self;
+}
+
+
+void* _CoincidentMapper_DefaultNew( Name name ) {
+	return _CoincidentMapper_New(
+			sizeof(CoincidentMapper),
+			CoincidentMapper_Type,
+			_CoincidentMapper_Delete,
+			_CoincidentMapper_Print,
+			_CoincidentMapper_Copy,
+			_CoincidentMapper_DefaultNew,
+			_CoincidentMapper_Construct,
+			_CoincidentMapper_Build,
+			_CoincidentMapper_Initialise,
+			_CoincidentMapper_Execute,
+			_CoincidentMapper_Destroy,
+			_CoincidentMapper_Map,
+			_OneToOneMapper_GetMaterialPointsSwarms,
+			_OneToOneMapper_GetMaterialIndexOn,
+			_OneToOneMapper_GetExtensionOn,
+			name,
+			False,
+			NULL,
+			NULL );
+}
+
+
 CoincidentMapper* _CoincidentMapper_New(
 		SizeT                                                           _sizeOfSelf,
 		Type                                                            type,
@@ -82,6 +138,7 @@
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 		Name                                                            name,
+		Bool                                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm,
 		MaterialPointsSwarm*                                            materialSwarm )
 {
@@ -104,14 +161,20 @@
 			_getMaterialIndexOn,
 			_getExtensionOn,
 			name,
+			initFlag,
 			integrationSwarm,
 			materialSwarm );
-
-	_CoincidentMapper_Init( result, integrationSwarm, materialSwarm );
-
+	if (initFlag) {
+		_CoincidentMapper_Init( result, integrationSwarm, materialSwarm );
+	}
+		
 	return result;
 }
 
+void _CoincidentMapper_Construct( void* mapper, Stg_ComponentFactory* cf, void* data ) {
+	_OneToOneMapper_Construct( mapper, cf, data );
+}
+
 void _CoincidentMapper_Init(
 		void*                   mapper,
 		IntegrationPointsSwarm* integrationSwarm,
@@ -130,40 +193,17 @@
 	return _IntegrationPointMapper_Copy( mapper, dest, deep, nameExt, ptrMap );
 }
 
-void* _CoincidentMapper_DefaultNew( Name name ) {
-	return _CoincidentMapper_New(
-			sizeof(CoincidentMapper),
-			CoincidentMapper_Type,
-			_CoincidentMapper_Delete,
-			_CoincidentMapper_Print,
-			_CoincidentMapper_Copy,
-			_CoincidentMapper_DefaultNew,
-			_CoincidentMapper_Construct,
-			_CoincidentMapper_Build,
-			_CoincidentMapper_Initialise,
-			_CoincidentMapper_Execute,
-			_CoincidentMapper_Destroy,
-			_CoincidentMapper_Map,
-			_OneToOneMapper_GetMaterialPointsSwarms,
-			_OneToOneMapper_GetMaterialIndexOn,
-			_OneToOneMapper_GetExtensionOn,
-			name,
-			NULL,
-			NULL );
-}
-
-void _CoincidentMapper_Construct( void* mapper, Stg_ComponentFactory* cf, void* data ) {
-	_OneToOneMapper_Construct( mapper, cf, data );
-}
-
 void _CoincidentMapper_Build( void* mapper, void* cf ) {
 	_OneToOneMapper_Build( mapper, cf );
 }
+
 void _CoincidentMapper_Initialise( void* mapper, void* cf ) {
 	_OneToOneMapper_Initialise( mapper, cf );
 }
+
 void _CoincidentMapper_Execute( void* mapper, void* data ) {
 }
+
 void _CoincidentMapper_Destroy( void* mapper, void* data ) {
 }
 

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/CoincidentMapper.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/CoincidentMapper.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/CoincidentMapper.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -62,7 +62,12 @@
 		__OneToOneMapper 
 
 	struct CoincidentMapper { __CoincidentMapper };
-		
+
+	CoincidentMapper* CoincidentMapper_New(
+			Name                       name,
+			IntegrationPointsSwarm*    integrationSwarm,
+			MaterialPointsSwarm*       materialSwarm);	
+	
 	CoincidentMapper* _CoincidentMapper_New(
 			SizeT                                                           _sizeOfSelf,
 			Type                                                            type,
@@ -80,6 +85,8 @@
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 			Name                                                            name,
+			Bool                                                            initFlag,
+
 			IntegrationPointsSwarm*                                         integrationSwarm,
 			MaterialPointsSwarm*                                            materialSwarm );
 
@@ -107,4 +114,4 @@
 
 	void _CoincidentMapper_Map( void* mapper );
 	
-#endif 
+#endif

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/GaussMapper.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/GaussMapper.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/GaussMapper.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -54,6 +54,8 @@
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 		Name                                                            name,
+		Bool                                                            initFlag,
+
 		IntegrationPointsSwarm*                                         integrationSwarm,
 		MaterialPointsSwarm*                                            materialSwarm )
 {
@@ -76,11 +78,13 @@
 			_getMaterialIndexOn,
 			_getExtensionOn,
 			name,
+			initFlag,
 			integrationSwarm,
 			materialSwarm );
 
-	_GaussMapper_Init( result, integrationSwarm, materialSwarm );
-
+	if (initFlag) {
+		_GaussMapper_Init( result, integrationSwarm, materialSwarm );
+	}
 	return result;
 }
 
@@ -120,6 +124,7 @@
 			_OneToOneMapper_GetMaterialIndexOn,
 			_OneToOneMapper_GetExtensionOn,
 			name,
+			False,
 			NULL,
 			NULL );
 }

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/GaussMapper.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/GaussMapper.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/GaussMapper.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -59,6 +59,7 @@
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 			Name                                                            name,
+			Bool                                                            initFlag,
 			IntegrationPointsSwarm*                                         integrationSwarm,
 			MaterialPointsSwarm*                                            materialSwarm );
 
@@ -86,4 +87,4 @@
 
 	void _GaussMapper_Map( void* mapper );
 	
-#endif 
+#endif

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointMapper.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointMapper.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointMapper.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -75,6 +75,7 @@
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 		Name                                                            name,
+		Bool                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm )
 {
 	IntegrationPointMapper* self;
@@ -99,7 +100,9 @@
 	self->_getMaterialIndexOn            = _getMaterialIndexOn;
 	self->_getExtensionOn                = _getExtensionOn;
 
-	_IntegrationPointMapper_Init( self, integrationSwarm );
+	if (initFlag) {
+		_IntegrationPointMapper_Init( self, integrationSwarm );
+	}
 
 	return self;
 }
@@ -210,4 +213,3 @@
 	
 	return IntegrationPointMapper_GetExtensionOn( mapper, point, extHandle );
 }
-

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointMapper.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointMapper.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointMapper.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -113,6 +113,7 @@
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn, 
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn, 
 		Name                                                            name,
+		Bool                                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm );
 
 	void _IntegrationPointMapper_Init( void* mapper, IntegrationPointsSwarm* integrationSwarm );
@@ -185,7 +186,4 @@
 					extHandle )
 	void* IntegrationPointMapper_GetExtensionAtFunc( void* mapper, Index point_I, ExtensionInfo_Index extHandle );
 
-#endif 
-
-
-
+#endif

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -61,65 +61,201 @@
 /* Textual name of this class */
 const Type IntegrationPointsSwarm_Type = "IntegrationPointsSwarm";
 
-IntegrationPointsSwarm* _IntegrationPointsSwarm_New(
-		SizeT                                           _sizeOfSelf,
-                Type                                            type,
-                Stg_Class_DeleteFunction*                       _delete,
-                Stg_Class_PrintFunction*                        _print,
-                Stg_Class_CopyFunction*                         _copy,
-                Stg_Component_DefaultConstructorFunction*       _defaultConstructor,
-                Stg_Component_ConstructFunction*                _construct,
-                Stg_Component_BuildFunction*                    _build,
-                Stg_Component_InitialiseFunction*               _initialise,
-                Stg_Component_ExecuteFunction*                  _execute,
-                Stg_Component_DestroyFunction*                  _destroy,
-                Name                                            name,
-                Bool                                            initFlag,
-                CellLayout*                                     cellLayout,
-                ParticleLayout*                                 particleLayout,
-                Dimension_Index                                 dim,
-		SizeT                                           particleSize,
-                Particle_InCellIndex                            cellParticleTblDelta,
-                double                                          extraParticlesFactor,
-                ExtensionManager_Register*                      extensionMgr_Register,
-                Variable_Register*                              swarmVariable_Register,
-                MPI_Comm                                        comm)
+IntegrationPointsSwarm* IntegrationPointsSwarm_New(
+		Name                                  name,
+		void*                                 cellLayout,
+		void*                                 particleLayout,
+		Dimension_Index                       dim,
+		SizeT                                 particleSize,
+		Particle_InCellIndex                  cellParticleTblDelta,
+		double                                extraParticlesFactor,
+		FeMesh*                   	      mesh,
+		TimeIntegrator*                       timeIntegrator,
+		WeightsCalculator*                    weights,
+		IntegrationPointMapper*               mapper,
+		Bool                                  recalculateWeights,
+		ExtensionManager_Register*            extensionMgr_Register,
+		Variable_Register*                    swarmVariable_Register,
+		Materials_Register*                   materials_Register,
+		MPI_Comm                              comm)
 {
-	IntegrationPointsSwarm* self;
-	
-	/* Allocate memory */
-	assert( _sizeOfSelf >= sizeof(IntegrationPointsSwarm) );
-	self = (IntegrationPointsSwarm*)_Swarm_New( 
-			_sizeOfSelf,
-			type,
-			_delete,
-			_print,
-			_copy,
-			_defaultConstructor,
-			_construct,
-			_build,
-			_initialise,
-			_execute,
-			_destroy,		
+	IntegrationPointsSwarm* self = _IntegrationPointsSwarm_New(
+			sizeof(IntegrationPointsSwarm),
+			IntegrationPointsSwarm_Type,
+			_IntegrationPointsSwarm_Delete,
+			_IntegrationPointsSwarm_Print,
+			_IntegrationPointsSwarm_Copy,
+			_IntegrationPointsSwarm_DefaultNew,
+			_IntegrationPointsSwarm_Construct,
+			_IntegrationPointsSwarm_Build,
+			_IntegrationPointsSwarm_Initialise,
+			_IntegrationPointsSwarm_Execute,
+			_IntegrationPointsSwarm_Destroy,
 			name,
-			initFlag,
+			True,
 			cellLayout,
 			particleLayout,
 			dim,
 			particleSize,
 			cellParticleTblDelta,
 			extraParticlesFactor,
+			mesh,
+			timeIntegrator,
+			weights,
+			mapper,
+			recalculateWeights,
 			extensionMgr_Register,
 			swarmVariable_Register,
-			comm );
+			materials_Register,
+			comm
+			);
+	return self;
+}
 
-	if ( initFlag ) {
-		_IntegrationPointsSwarm_Init( self, NULL, NULL, NULL, NULL, NULL, True );
+
+void* _IntegrationPointsSwarm_DefaultNew( Name name ) {
+	return (void*) _IntegrationPointsSwarm_New(
+			sizeof(IntegrationPointsSwarm),
+			IntegrationPointsSwarm_Type,
+			_IntegrationPointsSwarm_Delete,
+			_IntegrationPointsSwarm_Print,
+			_IntegrationPointsSwarm_Copy,
+			_IntegrationPointsSwarm_DefaultNew,
+			_IntegrationPointsSwarm_Construct,
+			_IntegrationPointsSwarm_Build,
+			_IntegrationPointsSwarm_Initialise,
+			_IntegrationPointsSwarm_Execute,
+			_IntegrationPointsSwarm_Destroy,
+			name,
+			False,
+			NULL,                           /* cellLayout */
+			NULL,                           /* particleLayout */
+			0,                              /* dim */
+			sizeof(IntegrationPoint),       /* particleSize */
+			0,                              /* cellParticleTblDelta */
+			0.0,                            /* extraParticlesFactor */
+			NULL,                           /* mesh */
+			NULL,                           /* timeIntegrator */
+			NULL,                           /* weights */
+			NULL,                           /* mapper */
+			False,                          /* recalculateWeights */
+			NULL,                           /* extensionMgr_Register */
+			NULL,                           /* swarmVariable_Register */
+			NULL,                           /* materials_Register */
+			MPI_COMM_WORLD                 /* MPI_Comm */
+			);
+}
+
+
+IntegrationPointsSwarm* _IntegrationPointsSwarm_New(
+		SizeT                                           _sizeOfSelf,
+		Type                                            type,
+		Stg_Class_DeleteFunction*                       _delete,
+		Stg_Class_PrintFunction*                        _print,
+		Stg_Class_CopyFunction*                         _copy,
+		Stg_Component_DefaultConstructorFunction*       _defaultConstructor,
+		Stg_Component_ConstructFunction*                _construct,
+		Stg_Component_BuildFunction*                    _build,
+		Stg_Component_InitialiseFunction*               _initialise,
+		Stg_Component_ExecuteFunction*                  _execute,
+		Stg_Component_DestroyFunction*                  _destroy,
+		Name                                            name,
+		Bool                                            initFlag,
+		CellLayout*                                     cellLayout,
+		ParticleLayout*                                 particleLayout,
+		Dimension_Index                                 dim,
+		SizeT                                           particleSize,
+		Particle_InCellIndex                            cellParticleTblDelta,
+		double                                          extraParticlesFactor,
+		FeMesh*     		                        mesh, 
+		TimeIntegrator*                                 timeIntegrator,
+		WeightsCalculator*                              weights,
+		IntegrationPointMapper*                         mapper,
+		Bool                                            recalculateWeights,
+		ExtensionManager_Register*                      extensionMgr_Register,
+		Variable_Register*                              swarmVariable_Register,
+		Materials_Register*                             materials_Register,
+		MPI_Comm                                        comm)
+{
+	IntegrationPointsSwarm* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(IntegrationPointsSwarm) );
+	self = (IntegrationPointsSwarm*)_Swarm_New( 
+		_sizeOfSelf,
+		type,
+		_delete,
+		_print,
+		_copy,
+		_defaultConstructor,
+		_construct,
+		_build,
+		_initialise,
+		_execute,
+		_destroy,		
+		name,
+		initFlag,
+		cellLayout,
+		particleLayout,
+		dim,
+		particleSize,
+		cellParticleTblDelta,
+		extraParticlesFactor,
+		extensionMgr_Register,
+		swarmVariable_Register,
+		comm );
+
+	if (initFlag) {
+		_IntegrationPointsSwarm_Init( 
+			self,
+			mesh, 
+			timeIntegrator,
+			weights,
+			mapper,
+			materials_Register,
+			recalculateWeights );
 	}
-	
+		
 	return self;
 }
 
+
+void _IntegrationPointsSwarm_Construct( void* integrationPoints, Stg_ComponentFactory* cf, void* data ) {
+	IntegrationPointsSwarm*	        self          = (IntegrationPointsSwarm*) integrationPoints;
+	FeMesh*             		mesh;
+	TimeIntegrator*                 timeIntegrator;
+	WeightsCalculator*              weights;
+	IntegrationPointMapper*         mapper;
+	Materials_Register*             materials_Register;
+	Bool                            recalculateWeights;
+
+	/* This will also call _Swarm_Init */
+	_Swarm_Construct( self, cf, data );
+
+	mesh           = Stg_ComponentFactory_ConstructByKey( cf, self->name, "FeMesh", FeMesh, True, data );
+	timeIntegrator = Stg_ComponentFactory_ConstructByKey( cf, self->name, "TimeIntegrator", TimeIntegrator, True, data );
+	weights        = Stg_ComponentFactory_ConstructByKey( cf, self->name, "WeightsCalculator", WeightsCalculator, False, data );
+	mapper         = Stg_ComponentFactory_ConstructByKey( cf, self->name, "IntegrationPointMapper", IntegrationPointMapper, True, data );
+	recalculateWeights = Stg_ComponentFactory_GetBool( cf, self->name, "recalculateWeights", True );
+
+	Journal_Firewall (
+			weights != NULL ||
+			(weights == NULL && Stg_Class_IsInstance( mapper, GaussMapper_Type ) ),
+			Journal_MyStream( Error_Type, self ),
+			"In func %s, %s which is a %s must either have a %s or use %s\n",
+			__func__,
+			self->name,
+			self->type,
+			WeightsCalculator_Type,
+			GaussMapper_Type );
+	
+	materials_Register = Stg_ObjectList_Get( cf->registerRegister, "Materials_Register" );
+	assert( materials_Register );
+
+	_IntegrationPointsSwarm_Init( self, mesh, timeIntegrator, weights, mapper, materials_Register, recalculateWeights );
+}
+
+
 void _IntegrationPointsSwarm_Init( 
 		void*                                 swarm,
 		FeMesh*                   mesh, 
@@ -238,69 +374,6 @@
 }
 
 
-
-void* _IntegrationPointsSwarm_DefaultNew( Name name ) {
-	return (void*) _IntegrationPointsSwarm_New(
-			sizeof(IntegrationPointsSwarm),
-			IntegrationPointsSwarm_Type,
-			_IntegrationPointsSwarm_Delete,
-			_IntegrationPointsSwarm_Print,
-			_IntegrationPointsSwarm_Copy,
-			_IntegrationPointsSwarm_DefaultNew,
-			_IntegrationPointsSwarm_Construct,
-			_IntegrationPointsSwarm_Build,
-			_IntegrationPointsSwarm_Initialise,
-			_IntegrationPointsSwarm_Execute,
-			_IntegrationPointsSwarm_Destroy,
-			name,
-			False,
-			NULL,                           /* cellLayout */
-			NULL,                           /* particleLayout */
-			0,                              /* dim */
-			sizeof(IntegrationPoint),       /* particleSize */
-			0,
-			0.0,
-			NULL,
-			NULL,
-			0);
-}
-
-
-void _IntegrationPointsSwarm_Construct( void* integrationPoints, Stg_ComponentFactory* cf, void* data ) {
-	IntegrationPointsSwarm*	        self          = (IntegrationPointsSwarm*) integrationPoints;
-	FeMesh*             mesh;
-	TimeIntegrator*                 timeIntegrator;
-	WeightsCalculator*              weights;
-	IntegrationPointMapper*         mapper;
-	Materials_Register*             materials_Register;
-	Bool                            recalculateWeights;
-
-	/* This will also call _Swarm_Init */
-	_Swarm_Construct( self, cf, data );
-
-	mesh           = Stg_ComponentFactory_ConstructByKey( cf, self->name, "FeMesh", FeMesh, True, data );
-	timeIntegrator = Stg_ComponentFactory_ConstructByKey( cf, self->name, "TimeIntegrator", TimeIntegrator, True, data );
-	weights        = Stg_ComponentFactory_ConstructByKey( cf, self->name, "WeightsCalculator", WeightsCalculator, False, data );
-	mapper         = Stg_ComponentFactory_ConstructByKey( cf, self->name, "IntegrationPointMapper", IntegrationPointMapper, True, data );
-	recalculateWeights = Stg_ComponentFactory_GetBool( cf, self->name, "recalculateWeights", True );
-
-	Journal_Firewall (
-			weights != NULL ||
-			(weights == NULL && Stg_Class_IsInstance( mapper, GaussMapper_Type ) ),
-			Journal_MyStream( Error_Type, self ),
-			"In func %s, %s which is a %s must either have a %s or use %s\n",
-			__func__,
-			self->name,
-			self->type,
-			WeightsCalculator_Type,
-			GaussMapper_Type );
-	
-	materials_Register = Stg_ObjectList_Get( cf->registerRegister, "Materials_Register" );
-	assert( materials_Register );
-
-	_IntegrationPointsSwarm_Init( self, mesh, timeIntegrator, weights, mapper, materials_Register, recalculateWeights );
-}
-
 void _IntegrationPointsSwarm_Build( void* integrationPoints, void* data ) {
 	IntegrationPointsSwarm*	self = (IntegrationPointsSwarm*) integrationPoints;
 
@@ -412,4 +485,3 @@
 		swarm->materials_Register, 
 		IntegrationPointsSwarm_GetMaterialIndexOn( swarm, point ) );
 }
-

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/IntegrationPointsSwarm.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -78,6 +78,29 @@
 	/*---------------------------------------------------------------------------------------------------------------------
 	** Constructors
 	*/
+
+	/** Classic C++-style constructor */
+	IntegrationPointsSwarm* IntegrationPointsSwarm_New(
+		Name                                  name,
+		void*                                 cellLayout,
+		void*                                 particleLayout,
+		Dimension_Index                       dim,
+		SizeT                                 particleSize,
+		Particle_InCellIndex                  cellParticleTblDelta,
+		double                                extraParticlesFactor,
+		FeMesh*				      mesh, 
+		TimeIntegrator*                       timeIntegrator,
+		WeightsCalculator*                    weights,
+		IntegrationPointMapper*               mapper,
+		Bool                                  recalculateWeights,
+		ExtensionManager_Register*            extensionMgr_Register,
+		Variable_Register*                    swarmVariable_Register,
+		Materials_Register*                   materials_Register,
+		MPI_Comm                              comm);
+	
+	void* _IntegrationPointsSwarm_DefaultNew( Name name ) ;
+
+	/** Private New */
 	IntegrationPointsSwarm* _IntegrationPointsSwarm_New(
 		SizeT                                           _sizeOfSelf, 
 		Type                                            type,
@@ -89,7 +112,7 @@
 		Stg_Component_BuildFunction*                    _build,
 		Stg_Component_InitialiseFunction*               _initialise,
 		Stg_Component_ExecuteFunction*                  _execute,
-		Stg_Component_DestroyFunction*                  _destroy,		
+		Stg_Component_DestroyFunction*                  _destroy,
 		Name                                            name,
 		Bool                                            initFlag,
 		CellLayout*                                     cellLayout,
@@ -98,10 +121,19 @@
 		SizeT                                           particleSize, 
 		Particle_InCellIndex                            cellParticleTblDelta, 
 		double                                          extraParticlesFactor,
+		FeMesh*         		                mesh, 
+		TimeIntegrator*                                 timeIntegrator,
+		WeightsCalculator*                              weights,
+		IntegrationPointMapper*                         mapper,
+		Bool                                            recalculateWeights,
 		ExtensionManager_Register*                      extensionMgr_Register,
 		Variable_Register*                              swarmVariable_Register,
-		MPI_Comm                                        comm);
+		Materials_Register*                             materials_Register,
+		MPI_Comm                                        comm
+		);
 
+	void _IntegrationPointsSwarm_Construct( void* shape, Stg_ComponentFactory* cf, void* data ) ;
+
 	void _IntegrationPointsSwarm_Init(
 		void*                                           swarm,
 		FeMesh*                             mesh, 
@@ -120,8 +152,6 @@
 		(IntegrationPointsSwarm*) Stg_Class_Copy( self, NULL, True, NULL, NULL )
 	void* _IntegrationPointsSwarm_Copy( void* integrationPoints, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
 	
-	void* _IntegrationPointsSwarm_DefaultNew( Name name ) ;
-void _IntegrationPointsSwarm_Construct( void* shape, Stg_ComponentFactory* cf, void* data ) ;
 	void _IntegrationPointsSwarm_Build( void* integrationPoints, void* data ) ;
 	void _IntegrationPointsSwarm_Initialise( void* integrationPoints, void* data ) ;
 	void _IntegrationPointsSwarm_Execute( void* integrationPoints, void* data );
@@ -162,4 +192,4 @@
 	#define IntegrationPointsSwarm_GetExtensionAt( swarm, point_I, extHandle ) \
 		IntegrationPointMapper_GetExtensionAt( ((IntegrationPointsSwarm*)(swarm))->mapper, (point_I), (extHandle) )
 
-#endif 
+#endif

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/ManyToOneMapper.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/ManyToOneMapper.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/ManyToOneMapper.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -75,6 +75,7 @@
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 		Name                                                            name,
+		Bool                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm,
 		MaterialPointsSwarm**                                           materialSwarms,
 		Index                                                           materialSwarmCount ) 
@@ -97,10 +98,13 @@
 			_getMaterialPointsSwarms,
 			_getMaterialIndexOn,
 			_getExtensionOn,
-			name, 
+			name,
+			initFlag,	
 			integrationSwarm );
 
-	_ManyToOneMapper_Init( result, integrationSwarm, materialSwarms, materialSwarmCount );
+	if (initFlag) {
+		_ManyToOneMapper_Init( result, integrationSwarm, materialSwarms, materialSwarmCount );
+	}
 
 	return result;
 }
@@ -243,4 +247,3 @@
 
 	return result;
 }
-

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/ManyToOneMapper.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/ManyToOneMapper.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/ManyToOneMapper.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -87,6 +87,7 @@
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 			Name                                                            name,
+			Bool                                                            initFlag,
 			IntegrationPointsSwarm*                                         integrationSwarm,
 			MaterialPointsSwarm**                                           materialSwarms,
 			Index                                                           materialSwarmCount );
@@ -113,4 +114,4 @@
 	void _ManyToOneMapper_Destroy( void* mapper, void* data ) ;
 
 	MaterialPointsSwarm** ManyToOneMapper_GetMaterialPointsSwarms( void* mapper, Index* count );
-#endif 
+#endif

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/Material.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/Material.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/Material.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -78,13 +78,35 @@
 			_Material_Initialise, 
 			_Material_Execute, 
 			_Material_Destroy,
-			name );
+			name,
+			shape,
+			materialDictionary,
+			materialRegister );
 
-	_Material_Init( self, shape, materialDictionary, materialRegister );
-
 	return self;
 }
 
+
+void* _Material_DefaultNew( Name name ) {
+	return (void*) _Material_New(
+			sizeof(Material),
+			Material_Type,
+			_Material_Delete, 
+			_Material_Print, 
+			_Material_Copy, 
+			_Material_DefaultNew, 
+			_Material_Construct, 
+			_Material_Build, 
+			_Material_Initialise, 
+			_Material_Execute, 
+			_Material_Destroy,
+			name,
+			NULL,
+			NULL,
+			NULL );
+}
+
+
 /* Private Constructor */
 Material* _Material_New(
 		SizeT                                           _sizeOfSelf,
@@ -98,7 +120,10 @@
 		Stg_Component_InitialiseFunction*               _initialise,
 		Stg_Component_ExecuteFunction*                  _execute,
 		Stg_Component_DestroyFunction*                  _destroy,
-		Name                                            name )
+		Name                                            name,
+		Stg_Shape*                                      shape,
+		Dictionary*                                     materialDictionary,
+		Materials_Register*                             materialRegister )
 {
 	Material* self;
 	
@@ -118,9 +143,12 @@
 			name,
 			NON_GLOBAL );
 
+	_Material_Init( self, shape, materialDictionary, materialRegister );
+
 	return self;
 }
 
+
 void _Material_Init( 
 		void*                                           material,
 		Stg_Shape*                                      shape,
@@ -148,6 +176,8 @@
 	Stg_Class_Delete( self->extensionMgr );
 	_Stg_Component_Delete( material );
 }
+
+
 void _Material_Print( void* material, Stream* stream ) {
 	Material* self = (Material*) material;
 
@@ -157,6 +187,7 @@
 	Journal_PrintUnsignedInt( stream, self->index );
 }
 
+
 void* _Material_Copy( void* material, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
 	Material* self = (Material*) material;
 	Material* newMaterial;
@@ -169,21 +200,6 @@
 	return newMaterial;
 }
 
-void* _Material_DefaultNew( Name name ) {
-	return (void*) _Material_New(
-			sizeof(Material),
-			Material_Type,
-			_Material_Delete, 
-			_Material_Print, 
-			_Material_Copy, 
-			_Material_DefaultNew, 
-			_Material_Construct, 
-			_Material_Build, 
-			_Material_Initialise, 
-			_Material_Execute, 
-			_Material_Destroy,
-			name );
-}
 
 void _Material_Construct( void* material, Stg_ComponentFactory* cf, void* data ) {
 	Material*             self               = (Material*) material;
@@ -198,6 +214,7 @@
 	_Material_Init( self, shape, materialDictionary, materials_Register );
 }
 
+
 void _Material_Build( void* material, void* data ) {}
 void _Material_Initialise( void* material, void* data ) {}
 void _Material_Execute( void* material, void* data ) {}

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/Material.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/Material.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/Material.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -64,6 +64,8 @@
 		Dictionary*                                     materialDictionary,
 		Materials_Register*                             materialRegister );
 
+	void* _Material_DefaultNew( Name name );
+
 	/* Private Constructor */
 	Material* _Material_New(
 		SizeT                                           _sizeOfSelf,
@@ -77,8 +79,13 @@
 		Stg_Component_InitialiseFunction*               _initialise,
 		Stg_Component_ExecuteFunction*                  _execute,
 		Stg_Component_DestroyFunction*                  _destroy,				
-		Name                                            name );
+		Name                                            name,
+		Stg_Shape*                                      shape,
+		Dictionary*                                     materialDictionary,
+		Materials_Register*                             materialRegister );
 
+	void _Material_Construct( void* material, Stg_ComponentFactory* cf, void* data );
+
 	void _Material_Init( 
 		void*                                           material, 	
 		Stg_Shape*                                      shape,
@@ -90,8 +97,6 @@
 	void _Material_Print( void* material, Stream* stream ) ;
 	void* _Material_Copy( void* material, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) ;
 
-	void* _Material_DefaultNew( Name name );
-	void _Material_Construct( void* material, Stg_ComponentFactory* cf, void* data );
 	void _Material_Build( void* material, void* data );
 	void _Material_Initialise( void* material, void* data );
 	void _Material_Execute( void* material, void* data );

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/MaterialPointsSwarm.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/MaterialPointsSwarm.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/MaterialPointsSwarm.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -388,6 +388,15 @@
 	point->materialIndex = materialIndex;
 }
 
+
+Material* MaterialPointsSwarm_GetMaterialOn( void* swarm, void* particle ) {
+	MaterialPointsSwarm* self  = (MaterialPointsSwarm*)swarm;
+	MaterialPoint*       materialPoint = (MaterialPoint*)particle;
+	
+	return Materials_Register_GetByIndex( self->materials_Register, materialPoint->materialIndex );
+}
+
+
 Material* MaterialPointsSwarm_GetMaterialAt( void* swarm, Index point_I ) {
 	MaterialPointsSwarm* self  = (MaterialPointsSwarm*)swarm;
 	MaterialPoint*       point;

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/MaterialPointsSwarm.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/MaterialPointsSwarm.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/MaterialPointsSwarm.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -157,6 +157,9 @@
 	/** Returns the material instance associated with the given point index */
 	Material* MaterialPointsSwarm_GetMaterialAt( void* swarm, Index point_I );
 
+	/** Returns the material instance associated with the given MaterialPoint */
+	Material* MaterialPointsSwarm_GetMaterialOn( void* swarm, void* particle );
+
 	/** Returns the material instance associated with the given point index */
 	Index MaterialPointsSwarm_GetMaterialIndexAt( void* swarm, Index point_I );
 

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/OneToOneMapper.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/OneToOneMapper.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/OneToOneMapper.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -75,6 +75,7 @@
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 		Name                                                            name,
+		Bool                                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm,
 		MaterialPointsSwarm*                                            materialSwarm )
 {
@@ -97,10 +98,13 @@
 					_getMaterialIndexOn,
 					_getExtensionOn,
 					name,
+					initFlag,
 					integrationSwarm );
 
-	_OneToOneMapper_Init( result, integrationSwarm, materialSwarm );
-
+	if (initFlag) {
+		_OneToOneMapper_Init( result, integrationSwarm, materialSwarm );
+	}
+		
 	return result;
 }
 
@@ -110,7 +114,13 @@
 	_IntegrationPointMapper_Init( mapper, integrationSwarm );
 	
 	self->materialSwarm = materialSwarm;
-	self->materialRefHandle = (Index)-1;
+
+	ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, False );
+	self->materialRefHandle = ExtensionManager_Add( 
+				self->integrationSwarm->particleExtensionMgr,
+				materialSwarm->name, 
+				sizeof(MaterialPointRef) );
+	ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, True );
 }
 
 void _OneToOneMapper_Delete( void* mapper ) {
@@ -154,12 +164,6 @@
 
 	_OneToOneMapper_Init( self, self->integrationSwarm, materialSwarm );
 
-	ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, False );
-	self->materialRefHandle = ExtensionManager_Add( 
-				self->integrationSwarm->particleExtensionMgr,
-				materialSwarm->name, 
-				sizeof(MaterialPointRef) );
-	ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, True );
 }
 
 void _OneToOneMapper_Build( void* mapper, void* data ) {

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/OneToOneMapper.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/OneToOneMapper.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/src/OneToOneMapper.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -87,6 +87,7 @@
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
 			Name                                                            name,
+			Bool                                                            initFlag,
 			IntegrationPointsSwarm*                                         integrationSwarm,
 			MaterialPointsSwarm*                                            materialSwarm );
 
@@ -117,4 +118,4 @@
 	MaterialPoint* OneToOneMapper_GetMaterialPoint( void* mapper, void* integrationPoint, MaterialPointsSwarm** materialSwarm );
 	
 	
-#endif 
+#endif

Modified: long/3D/Gale/trunk/src/PICellerator/MaterialPoints/tests/testPeriodicBCs.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/MaterialPoints/tests/testPeriodicBCs.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/MaterialPoints/tests/testPeriodicBCs.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -95,7 +95,7 @@
 	EntryPoint_Register*		epRegister;
 	PeriodicBoundariesManager*	perBCsManager;
 	Index                           decompDims;
-	
+	char*                           directory;	
 	/* Initialise MPI, get world info */
 	MPI_Init( &argc, &argv );
 	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
@@ -110,6 +110,14 @@
         PICellerator_MaterialPoints_Init( &argc, &argv );	
 
 	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+	/* Add the PICellerator path to the global xml path dictionary */
+	directory = Memory_Alloc_Array( char, 200, "xmlDirectory" ) ;
+	sprintf(directory, "%s%s", LIB_DIR, "/StGermain" );
+	XML_IO_Handler_AddDirectory( "PICellerator", directory );
+	Memory_Free(directory);
+						
+	/* Add the plugin path to the global plugin list */
+	PluginsManager_AddDirectory( "PICellerator", LIB_DIR );
 
 	stream = Journal_Register (Info_Type, "myStream");
 

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTerm.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTerm.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTerm.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -135,9 +135,9 @@
 {
 	self->temperatureField    = temperatureField;
 	self->gravity             = gravity;
+	self->gHat		  = NULL;
 	self->adjust              = adjust;
 	self->materials_Register  = materials_Register;
-
 }
 
 void BuoyancyForceTerm_InitAll( 
@@ -159,6 +159,7 @@
 	BuoyancyForceTerm* self = (BuoyancyForceTerm*)forceTerm;
 	Index i;
 
+	FreeArray( self->gHat );
 	for ( i = 0; i < self->materialSwarmCount; ++i ) {
 		Stg_Class_Delete( self->densitySwarmVariables[i] );
 		Stg_Class_Delete( self->alphaSwarmVariables[i] );
@@ -199,18 +200,46 @@
 
 void _BuoyancyForceTerm_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) {
 	BuoyancyForceTerm*          self             = (BuoyancyForceTerm*)forceTerm;
+	Dictionary*		dict;
+	Dictionary_Entry_Value*	tmp;
+	char*			rootKey;
 	FeVariable*                 temperatureField;
 	double                      gravity;
 	Bool                        adjust;
 	Materials_Register*         materials_Register;
+	unsigned		    nDims;
+	Dictionary_Entry_Value*	    direcList;
+	double*			    direc;
+	unsigned		d_i;
 
 	/* Construct Parent */
 	_ForceTerm_Construct( self, cf, data );
 
+	dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, self->name ) );
 	temperatureField = Stg_ComponentFactory_ConstructByKey( cf, self->name, "TemperatureField", FeVariable, False, data ) ;
 	gravity          = Stg_ComponentFactory_GetDouble( cf, self->name, "gravity", 0.0 );
 	adjust           = Stg_ComponentFactory_GetBool( cf, self->name, "adjust", False );
 
+	direcList = Dictionary_Get( dict, "gravityDirection" );
+	nDims = Dictionary_Entry_Value_GetCount( direcList );
+	if( direcList ) {
+		direc = AllocArray( double, nDims );
+		for( d_i = 0; d_i < nDims; d_i++ ) {
+			tmp = Dictionary_Entry_Value_GetElement( direcList, d_i );
+			rootKey = Dictionary_Entry_Value_AsString( tmp );
+			if( !Stg_StringIsNumeric( rootKey ) )
+				tmp = Dictionary_Get( cf->rootDict, rootKey );
+			direc[d_i] = Dictionary_Entry_Value_AsDouble( tmp );
+		}
+	}
+	else
+		direc = NULL;
+	if( nDims == 2 )
+		Vec_Norm2D( direc, direc );
+	else
+		Vec_Norm3D( direc, direc );
+	self->gHat = direc;
+
 	materials_Register = Stg_ObjectList_Get( cf->registerRegister, "Materials_Register" );
 	assert( materials_Register );
 
@@ -276,8 +305,6 @@
 		Stg_Component_Build( self->densitySwarmVariables[materialSwarm_I], data, False );
 		Stg_Component_Build( self->alphaSwarmVariables[materialSwarm_I],   data, False );
 	}
-
-
 }
 
 void _BuoyancyForceTerm_Initialise( void* forceTerm, void* data ) {
@@ -327,6 +354,8 @@
 	Material*                        material;
 	FeVariable*                      temperatureField   = self->temperatureField;
 	double                           temperature        = 0.0;
+	double*				 gHat;
+	unsigned			d_i;
 
 	double totalWeight = 0.0;
 	double adjustFactor = 0.0;
@@ -336,6 +365,7 @@
 	nodeDofCount      = dim;
 	cell_I            = CellLayout_MapElementIdToCellId( swarm->cellLayout, lElement_I );
 	cellParticleCount = swarm->cellParticleCountTbl[cell_I];
+	gHat		  = self->gHat;
 
 	/* adjust & adjustFactor -- 20060411 Alan
 	 *
@@ -355,7 +385,7 @@
 	else {
 		adjustFactor = 1.0;
 	}
-			
+
 	for( cParticle_I = 0 ; cParticle_I < cellParticleCount ; cParticle_I++ ) {
 		particle = (IntegrationPoint*) Swarm_ParticleInCellAt( swarm, cell_I, cParticle_I );
 		xi       = particle->xi;
@@ -375,8 +405,14 @@
 		factor = detJac * particle->weight * adjustFactor * force;
 
 		/* Apply force in verticle direction */
-		for( eNode_I = 0 ; eNode_I < elementNodeCount; eNode_I++ ) { 		
-			elForceVec[ eNode_I * nodeDofCount + J_AXIS ] += factor * Ni[ eNode_I ] ;
+		for( eNode_I = 0 ; eNode_I < elementNodeCount; eNode_I++ ) {
+			if( gHat ) {
+				for( d_i = 0; d_i < dim; d_i++ )
+					elForceVec[ eNode_I * nodeDofCount + d_i ] += gHat[d_i] * factor * Ni[ eNode_I ] ;
+			}
+			else {
+				elForceVec[ eNode_I * nodeDofCount + J_AXIS ] += factor * Ni[ eNode_I ] ;
+			}
 		}
 	}
 	

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTerm.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTerm.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTerm.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -69,6 +69,7 @@
 		/* BuoyancyForceTerm info */ \
 		FeVariable*                                         temperatureField;                  \
 		double                                              gravity;                           \
+		double*						    gHat;			       \
 		Bool                                                adjust;                            \
 		Materials_Register*                                 materials_Register;                \
 		ExtensionInfo_Index                                 materialExtHandle;                 \

Added: long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,394 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+**	Melbourne, 3053, Australia.
+** Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+**	Victoria, 3800, Australia
+**
+** Primary Contributing Organisations:
+**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+**	Monash Cluster Computing - http://www.mcc.monash.edu.au
+**
+** Contributors:
+**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+**	Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**	David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+**	Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library 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
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: BuoyancyForceTermThermoChem.c 376 2006-10-18 06:58:41Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/Voronoi/Voronoi.h>
+#include <PICellerator/PopulationControl/PopulationControl.h>
+#include <PICellerator/Weights/Weights.h>
+#include <PICellerator/MaterialPoints/MaterialPoints.h>
+
+#include "types.h"
+#include "BuoyancyForceTermThermoChem.h"
+#include "MaterialSwarmVariable.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class */
+const Type BuoyancyForceTermThermoChem_Type = "BuoyancyForceTermThermoChem";
+
+BuoyancyForceTermThermoChem* BuoyancyForceTermThermoChem_New( 
+		Name                                                name,
+		ForceVector*                                        forceVector,
+		Swarm*                                              integrationSwarm,
+		FeVariable*                                         temperatureField,
+		double                                              RaT,
+		double                                              RaC,
+		Bool                                                adjust,
+		Materials_Register*                                 materials_Register )
+{
+	BuoyancyForceTermThermoChem* self = (BuoyancyForceTermThermoChem*) _BuoyancyForceTermThermoChem_DefaultNew( name );
+
+	BuoyancyForceTermThermoChem_InitAll( 
+			self,
+			forceVector,
+			integrationSwarm,
+			temperatureField,
+			RaT,
+			RaC,
+			adjust,
+			materials_Register );
+
+	return self;
+}
+
+/* Creation implementation / Virtual constructor */
+BuoyancyForceTermThermoChem* _BuoyancyForceTermThermoChem_New( 
+		SizeT                                               sizeOfSelf,  
+		Type                                                type,
+		Stg_Class_DeleteFunction*                           _delete,
+		Stg_Class_PrintFunction*                            _print,
+		Stg_Class_CopyFunction*                             _copy, 
+		Stg_Component_DefaultConstructorFunction*           _defaultConstructor,
+		Stg_Component_ConstructFunction*                    _construct,
+		Stg_Component_BuildFunction*                        _build,
+		Stg_Component_InitialiseFunction*                   _initialise,
+		Stg_Component_ExecuteFunction*                      _execute,
+		Stg_Component_DestroyFunction*                      _destroy,
+		ForceTerm_AssembleElementFunction*                  _assembleElement,		
+		BuoyancyForceTermThermoChem_CalcRaTFunction*              _calcRaT,
+		BuoyancyForceTermThermoChem_CalcRaCFunction*              _calcRaC,
+		Name                                                name )
+{
+	BuoyancyForceTermThermoChem* self;
+	
+	/* Allocate memory */
+	assert( sizeOfSelf >= sizeof(BuoyancyForceTermThermoChem) );
+	self = (BuoyancyForceTermThermoChem*) _ForceTerm_New( 
+		sizeOfSelf, 
+		type, 
+		_delete, 
+		_print, 
+		_copy,
+		_defaultConstructor,
+		_construct,
+		_build, 
+		_initialise,
+		_execute,
+		_destroy,
+		_assembleElement,
+		name );
+	
+	/* Virtual info */
+	self->_calcRaT = _calcRaT;
+	self->_calcRaC = _calcRaC;
+	
+	return self;
+}
+
+void _BuoyancyForceTermThermoChem_Init( 
+		BuoyancyForceTermThermoChem*                                  self, 
+		FeVariable*                                         temperatureField,
+		double                                              RaT,
+		double                                              RaC,
+		Bool                                                adjust,
+		Materials_Register*                                 materials_Register )
+{
+	self->temperatureField    = temperatureField;
+	self->RaT                 = RaT;
+	self->RaC                 = RaC;
+	self->adjust              = adjust;
+	self->materials_Register  = materials_Register;
+
+}
+
+void BuoyancyForceTermThermoChem_InitAll( 
+		void*                                               forceTerm,
+		ForceVector*                                        forceVector,
+		Swarm*                                              integrationSwarm,
+		FeVariable*                                         temperatureField,
+		double                                              RaT,
+		double                                              RaC,
+		Bool                                                adjust,
+		Materials_Register*                                 materials_Register )
+{
+	BuoyancyForceTermThermoChem* self = (BuoyancyForceTermThermoChem*) forceTerm;
+
+	ForceTerm_InitAll( self, forceVector, integrationSwarm, NULL );
+	_BuoyancyForceTermThermoChem_Init( self, temperatureField, RaT, RaC, adjust, materials_Register );
+}
+
+void _BuoyancyForceTermThermoChem_Delete( void* forceTerm ) {
+	BuoyancyForceTermThermoChem* self = (BuoyancyForceTermThermoChem*)forceTerm;
+	Index i;
+
+	for ( i = 0; i < self->materialSwarmCount; ++i ) {
+		Stg_Class_Delete( self->densitySwarmVariables[i] );
+	}
+	Stg_Class_Delete( self->densitySwarmVariables );
+
+	_ForceTerm_Delete( self );
+}
+
+void _BuoyancyForceTermThermoChem_Print( void* forceTerm, Stream* stream ) {
+	BuoyancyForceTermThermoChem* self = (BuoyancyForceTermThermoChem*)forceTerm;
+	
+	_ForceTerm_Print( self, stream );
+
+	/* General info */
+	Journal_PrintPointer( stream, self->temperatureField );
+	Journal_PrintDouble( stream, self->RaT );
+	Journal_PrintDouble( stream, self->RaC );
+}
+
+void* _BuoyancyForceTermThermoChem_DefaultNew( Name name ) {
+	return (void*)_BuoyancyForceTermThermoChem_New( 
+		sizeof(BuoyancyForceTermThermoChem), 
+		BuoyancyForceTermThermoChem_Type,
+		_BuoyancyForceTermThermoChem_Delete,
+		_BuoyancyForceTermThermoChem_Print,
+		NULL,
+		_BuoyancyForceTermThermoChem_DefaultNew,
+		_BuoyancyForceTermThermoChem_Construct,
+		_BuoyancyForceTermThermoChem_Build,
+		_BuoyancyForceTermThermoChem_Initialise,
+		_BuoyancyForceTermThermoChem_Execute,
+		_BuoyancyForceTermThermoChem_Destroy,
+		_BuoyancyForceTermThermoChem_AssembleElement,
+		_BuoyancyForceTermThermoChem_CalcRaT,
+		_BuoyancyForceTermThermoChem_CalcRaC,
+		name );
+}
+
+void _BuoyancyForceTermThermoChem_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) {
+	BuoyancyForceTermThermoChem*          self             = (BuoyancyForceTermThermoChem*)forceTerm;
+	FeVariable*                 temperatureField;
+	double                      RaT;
+	double                      RaC;
+	Bool                        adjust;
+	Materials_Register*         materials_Register;
+
+	/* Construct Parent */
+	_ForceTerm_Construct( self, cf, data );
+
+	temperatureField = Stg_ComponentFactory_ConstructByKey( cf, self->name, "TemperatureField", FeVariable, False, data ) ;
+	RaT              = Stg_ComponentFactory_GetDouble( cf, self->name, "RaT", 0.0 );
+	RaC              = Stg_ComponentFactory_GetDouble( cf, self->name, "RaC", 0.0 );
+	adjust           = Stg_ComponentFactory_GetBool( cf, self->name, "adjust", False );
+
+	materials_Register = Stg_ObjectList_Get( cf->registerRegister, "Materials_Register" );
+	assert( materials_Register );
+
+	_BuoyancyForceTermThermoChem_Init( self, temperatureField, RaT, RaC, adjust, materials_Register );
+}
+
+void _BuoyancyForceTermThermoChem_Build( void* forceTerm, void* data ) {
+	BuoyancyForceTermThermoChem*               self               = (BuoyancyForceTermThermoChem*)forceTerm;
+	BuoyancyForceTermThermoChem_MaterialExt*   materialExt;
+	Material_Index                   material_I;
+	Material*                        material;
+	Materials_Register*              materials_Register = self->materials_Register;
+	IntegrationPointsSwarm*          swarm              = (IntegrationPointsSwarm*)self->integrationSwarm;
+	MaterialPointsSwarm**            materialSwarms;
+	Index                            materialSwarm_I;
+	Name                             name;
+
+	_ForceTerm_Build( self, data );
+
+	if ( self->temperatureField )
+		Stg_Component_Build( self->temperatureField, data, False );
+
+	/* Sort out material extension stuff */
+	self->materialExtHandle = Materials_Register_AddMaterialExtension( 
+			self->materials_Register, 
+			self->type, 
+			sizeof(BuoyancyForceTermThermoChem_MaterialExt) );
+	for ( material_I = 0 ; material_I < Materials_Register_GetCount( materials_Register ) ; material_I++) {
+		material = Materials_Register_GetByIndex( materials_Register, material_I );
+		materialExt = ExtensionManager_GetFunc( material->extensionMgr, material, self->materialExtHandle );
+
+		materialExt->density = Dictionary_GetDouble_WithDefault( material->dictionary, "density", 0.0 );
+	}
+	
+	/* Create Swarm Variables of each material swarm this ip swarm is mapped against */
+	materialSwarms = IntegrationPointMapper_GetMaterialPointsSwarms( swarm->mapper, &(self->materialSwarmCount) );
+	self->densitySwarmVariables = Memory_Alloc_Array( MaterialSwarmVariable*, self->materialSwarmCount, "DensityVariables" );
+	
+	for ( materialSwarm_I = 0; materialSwarm_I < self->materialSwarmCount; ++materialSwarm_I ) {
+		name = Stg_Object_AppendSuffix( materialSwarms[materialSwarm_I], "Density" );
+		self->densitySwarmVariables[materialSwarm_I] = MaterialSwarmVariable_New( 
+				name, 
+				materialSwarms[materialSwarm_I], 
+				1, 
+				self->materials_Register, 
+				self->materialExtHandle, 
+				GetOffsetOfMember( *materialExt, density ) );
+		Memory_Free( name );
+		
+		/* Build new Swarm Variables */
+		Stg_Component_Build( self->densitySwarmVariables[materialSwarm_I], data, False );
+	}
+
+
+}
+
+void _BuoyancyForceTermThermoChem_Initialise( void* forceTerm, void* data ) {
+	BuoyancyForceTermThermoChem*             self             = (BuoyancyForceTermThermoChem*)forceTerm;
+	Index                          i;
+
+	_ForceTerm_Initialise( self, data );
+
+	if ( self->temperatureField )
+		Stg_Component_Initialise( self->temperatureField, data, False );
+	
+	for ( i = 0; i < self->materialSwarmCount; ++i ) {
+		Stg_Component_Initialise( self->densitySwarmVariables[i], data, False );
+	}
+}
+
+void _BuoyancyForceTermThermoChem_Execute( void* forceTerm, void* data ) {
+	_ForceTerm_Execute( forceTerm, data );
+}
+
+void _BuoyancyForceTermThermoChem_Destroy( void* forceTerm, void* data ) {
+	_ForceTerm_Destroy( forceTerm, data );
+}
+
+
+void _BuoyancyForceTermThermoChem_AssembleElement( void* forceTerm, ForceVector* forceVector, Element_LocalIndex lElement_I, double* elForceVec ) {
+	BuoyancyForceTermThermoChem*               self               = (BuoyancyForceTermThermoChem*) forceTerm;
+	IntegrationPoint*                particle;
+	BuoyancyForceTermThermoChem_MaterialExt*   materialExt;
+	Particle_InCellIndex             cParticle_I;
+	Particle_InCellIndex             cellParticleCount;
+	Element_NodeIndex                elementNodeCount;
+	Dimension_Index                  dim                = forceVector->dim;
+	IntegrationPointsSwarm*          swarm              = (IntegrationPointsSwarm*)self->integrationSwarm;
+	FeMesh*		                 mesh               = forceVector->feVariable->feMesh;
+	Node_ElementLocalIndex           eNode_I;
+	Cell_Index                       cell_I;
+	ElementType*                     elementType;
+	Dof_Index                        nodeDofCount;
+	double                           RaT;
+	double                           RaC;
+	double                           detJac             = 0.0;
+	double                           factor;
+	double                           Ni[8];
+	double                           force;
+	double*                          xi;
+	Material*                        material;
+	FeVariable*                      temperatureField   = self->temperatureField;
+	double                           temperature        = 0.0;
+
+	double totalWeight = 0.0;
+	double adjustFactor = 0.0;
+
+	elementType       = FeMesh_GetElementType( mesh, lElement_I );
+	elementNodeCount  = elementType->nodeCount;
+	nodeDofCount      = dim;
+	cell_I            = CellLayout_MapElementIdToCellId( swarm->cellLayout, lElement_I );
+	cellParticleCount = swarm->cellParticleCountTbl[cell_I];
+
+	/* adjust & adjustFactor -- 20060411 Alan
+	 *
+	 * The adjust decides whether an adjustFactor should be applied to the resulting factor.
+	 * If on, the total weight of the particles in the cell are scaled to the cell local volume.
+	 *
+	 * This is designed to be used when integrating with swarms which do not cover the whole domain
+	 * (ie - I used it to do dave.m's test of 1 swarm for blob, 1 swarm for background)
+	 */ 
+	if ( self->adjust ) {
+		for( cParticle_I = 0 ; cParticle_I < cellParticleCount ; cParticle_I++ ) {
+			particle = (IntegrationPoint*) Swarm_ParticleInCellAt( swarm, cell_I, cParticle_I );
+			totalWeight += particle->weight;
+		}
+		adjustFactor = swarm->weights->cellLocalVolume / totalWeight;
+	}
+	else {
+		adjustFactor = 1.0;
+	}
+			
+	for( cParticle_I = 0 ; cParticle_I < cellParticleCount ; cParticle_I++ ) {
+		particle = (IntegrationPoint*) Swarm_ParticleInCellAt( swarm, cell_I, cParticle_I );
+		xi       = particle->xi;
+
+		detJac = ElementType_JacobianDeterminant( elementType, mesh, lElement_I, xi, dim );
+		ElementType_EvaluateShapeFunctionsAt( elementType, xi, Ni );
+
+		/* Get parameters */
+		if ( temperatureField )
+			FeVariable_InterpolateWithinElement( temperatureField, lElement_I, xi, &temperature );
+		material = IntegrationPointsSwarm_GetMaterialOn( (IntegrationPointsSwarm*) swarm, particle );
+		materialExt = ExtensionManager_Get( material->extensionMgr, material, self->materialExtHandle );
+
+		/* Calculate Force */
+		RaT = BuoyancyForceTermThermoChem_CalcRaT( self, (Swarm*)swarm, lElement_I, particle );
+		RaC = BuoyancyForceTermThermoChem_CalcRaC( self, (Swarm*)swarm, lElement_I, particle );
+
+		force =  ( RaT * temperature) - ( materialExt->density * RaC );
+		factor = detJac * particle->weight * adjustFactor * force;
+
+		/* Apply force in verticle direction */
+		for( eNode_I = 0 ; eNode_I < elementNodeCount; eNode_I++ ) { 		
+			elForceVec[ eNode_I * nodeDofCount + J_AXIS ] += factor * Ni[ eNode_I ] ;
+		}
+	}
+	
+}
+
+/* The default implementation is for the RaC to be constant. */
+double _BuoyancyForceTermThermoChem_CalcRaT( void* forceTerm, Swarm* swarm, Element_DomainIndex dElement_I, void* particle ) {
+	BuoyancyForceTermThermoChem*               self               = (BuoyancyForceTermThermoChem*) forceTerm;
+
+	return self->RaT;
+}
+
+double _BuoyancyForceTermThermoChem_CalcRaC( void* forceTerm, Swarm* swarm, Element_DomainIndex dElement_I, void* particle ) {
+	BuoyancyForceTermThermoChem*               self               = (BuoyancyForceTermThermoChem*) forceTerm;
+
+	return self->RaC;
+}

Added: long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,145 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+**	Melbourne, 3053, Australia.
+** Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+**	Victoria, 3800, Australia
+**
+** Primary Contributing Organisations:
+**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+**	Monash Cluster Computing - http://www.mcc.monash.edu.au
+**
+** Contributors:
+**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+**	Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**	David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+**	Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library 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
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+
+
+#ifndef __PICellerator_Utils_BuoyancyForceTermThermoChem_h__
+#define __PICellerator_Utils_BuoyancyForceTermThermoChem_h__
+
+	typedef double (BuoyancyForceTermThermoChem_CalcRaTFunction) (
+				void* forceTerm, 
+				Swarm* swarm, 
+				Element_LocalIndex lElement_I, 
+				void* particle );
+
+	typedef double (BuoyancyForceTermThermoChem_CalcRaCFunction) (
+				void* forceTerm, 
+				Swarm* swarm, 
+				Element_LocalIndex lElement_I, 
+				void* particle );
+
+	/** Textual name of this class */
+	extern const Type BuoyancyForceTermThermoChem_Type;
+
+	typedef struct {
+		double density;
+	} BuoyancyForceTermThermoChem_MaterialExt;
+
+	/** BuoyancyForceTermThermoChem class contents */
+	#define __BuoyancyForceTermThermoChem \
+		/* General info */ \
+		__ForceTerm \
+		\
+		/* Virtual info */ \
+		BuoyancyForceTermThermoChem_CalcRaTFunction*              _calcRaT;                          \
+		\
+		BuoyancyForceTermThermoChem_CalcRaCFunction*              _calcRaC;                          \
+		\
+		/* BuoyancyForceTermThermoChem info */ \
+		FeVariable*                                         temperatureField;                  \
+		double                                              RaT;                           \
+		double                                              RaC;                           \
+		Bool                                                adjust;                            \
+		Materials_Register*                                 materials_Register;                \
+		ExtensionInfo_Index                                 materialExtHandle;                 \
+		MaterialSwarmVariable**                             densitySwarmVariables;             \
+		Index                                               materialSwarmCount;
+
+	struct BuoyancyForceTermThermoChem { __BuoyancyForceTermThermoChem };
+
+	BuoyancyForceTermThermoChem* BuoyancyForceTermThermoChem_New( 
+		Name                                                name,
+		ForceVector*                                        forceVector,
+		Swarm*                                              integrationSwarm,
+		FeVariable*                                         temperatureField,
+		double                                              RaT,
+		double                                              RaC,
+		Bool                                                adjust,
+		Materials_Register*                                 materials_Register );
+
+	BuoyancyForceTermThermoChem* _BuoyancyForceTermThermoChem_New( 
+		SizeT                                               sizeOfSelf,  
+		Type                                                type,
+		Stg_Class_DeleteFunction*                           _delete,
+		Stg_Class_PrintFunction*                            _print,
+		Stg_Class_CopyFunction*                             _copy, 
+		Stg_Component_DefaultConstructorFunction*           _defaultConstructor,
+		Stg_Component_ConstructFunction*                    _construct,
+		Stg_Component_BuildFunction*                        _build,
+		Stg_Component_InitialiseFunction*                   _initialise,
+		Stg_Component_ExecuteFunction*                      _execute,
+		Stg_Component_DestroyFunction*                      _destroy,
+		ForceTerm_AssembleElementFunction*                  _assembleElement,		
+		BuoyancyForceTermThermoChem_CalcRaTFunction*              _calcRaT,
+		BuoyancyForceTermThermoChem_CalcRaCFunction*              _calcRaC,
+		Name                                                name );
+	
+	void BuoyancyForceTermThermoChem_InitAll( 
+		void*                                               forceTerm,
+		ForceVector*                                        forceVector,
+		Swarm*                                              integrationSwarm,
+		FeVariable*                                         temperatureField,
+		double                                              RaT,
+		double                                              RaC,
+		Bool                                                adjust,
+		Materials_Register*                                 materials_Register );
+
+	void _BuoyancyForceTermThermoChem_Delete( void* forceTerm );
+	void _BuoyancyForceTermThermoChem_Print( void* forceTerm, Stream* stream );
+
+	void* _BuoyancyForceTermThermoChem_DefaultNew( Name name ) ;
+void _BuoyancyForceTermThermoChem_Construct( void* forceTerm, Stg_ComponentFactory* cf, void* data ) ;
+	void _BuoyancyForceTermThermoChem_Build( void* forceTerm, void* data ) ;
+	void _BuoyancyForceTermThermoChem_Initialise( void* forceTerm, void* data ) ;
+	void _BuoyancyForceTermThermoChem_Execute( void* forceTerm, void* data ) ;
+	void _BuoyancyForceTermThermoChem_Destroy( void* forceTerm, void* data ) ;
+
+	void _BuoyancyForceTermThermoChem_AssembleElement( void* forceTerm, ForceVector* forceVector, Element_LocalIndex lElement_I, double* elForceVec ) ;
+	double _BuoyancyForceTermThermoChem_CalcRaT( void* forceTerm, Swarm* swarm, Element_LocalIndex lElement_I, void* particle ) ;
+	#define BuoyancyForceTermThermoChem_CalcRaT( forceTerm, swarm, lElement_I, particle )\
+		(( (BuoyancyForceTermThermoChem*) forceTerm )->_calcRaT( forceTerm, swarm, lElement_I, particle ) )
+
+	double _BuoyancyForceTermThermoChem_CalcRaC( void* forceTerm, Swarm* swarm, Element_LocalIndex lElement_I, void* particle ) ;
+
+	#define BuoyancyForceTermThermoChem_CalcRaC( forceTerm, swarm, lElement_I, particle )\
+		(( (BuoyancyForceTermThermoChem*) forceTerm )->_calcRaC( forceTerm, swarm, lElement_I, particle ) )
+
+#endif

Added: long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.meta
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.meta	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/BuoyancyForceTermThermoChem.meta	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">BuoyancyForceTermThermoChem</param>
+<param name="Author">...</param>
+<param name="Organisation">VPAC and MCC</param>
+<param name="Project">PICellerator</param>
+<param name="Location">./PICellerator/Utils/src/</param>
+<param name="Project Web">https://csd.vpac.org/twiki/bin/view/PICellerator/WebHome</param>
+<param name="Copyright">Copyright (C) 2005 VPAC and Monash Cluster Computing.</param>
+<param name="License">https://csd.vpac.org/twiki/bin/view/Stgermain/SoftwareLicense http://www.opensource.org/licenses/bsd-license.php</param>
+<param name="Parent">ForceTerm</param>
+<param name="Reference">...</param>
+<param name="Summary">...</param>
+<param name="Description">This adds a force term for themo-chemical convection, as found in van Keken et al, 'A comparison of methods for modelling of thermochemcical convection', JGR, 1997</param>
+<param name="Equation">$temperature * RaT - \rho * RaC $</param>
+
+<!--Now the interesting stuff-->
+
+
+<list name="Params">
+	<struct>
+		<param name="Name">RaT</param>
+		<param name="Type">Double</param>
+		<param name="Default">0.0</param>
+		<param name="Description">thermal Rayleigh number</param>
+	</struct>
+	<struct>
+		<param name="Name">RaC</param>
+		<param name="Type">Double</param>
+		<param name="Default">0.0</param>
+		<param name="Description">chemical Rayleigh number</param>
+	</struct>
+</list>
+
+<list name="Dependencies">
+	<struct>
+		<param name="Essential">No</param>
+		<param name="Name">TemperatureField</param>
+		<param name="Type">FeVariable</param>
+		<param name="Description">This is the FeVariable from which the temperature, $T$, is calculated in the above calculation.</param>
+	</struct>
+</list>
+<!-- Add an exmaple XML if possible -->
+<param name="Example">
+		<struct name="buoyancyForceTerm">
+			<param name="Type">BuoyancyForceTermThermoChem</param>
+			<param name="ForceVector">mom_force</param>
+			<param name="TemperatureField">TemperatureField</param>
+			<param name="Swarm">picIntegrationPoints</param>
+			<param name="RaT">RaT</param>
+			<param name="RaC">RaC</param>
+		</struct>
+</param>
+
+</StGermainData>

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/Init.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/Init.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -58,11 +58,12 @@
 
 	Journal_Printf( Journal_Register( DebugStream_Type, "Context" ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
 	
+        Stg_ComponentRegister_Add( componentsRegister, PCDVC_Type,                    "0", _PCDVC_DefaultNew );
 	Stg_ComponentRegister_Add( componentsRegister, BuoyancyForceTerm_Type,            "0", _BuoyancyForceTerm_DefaultNew );
-        Stg_ComponentRegister_Add( componentsRegister, PCDVC_Type,                    "0", _PCDVC_DefaultNew );
+	Stg_ComponentRegister_Add( componentsRegister, BuoyancyForceTermThermoChem_Type,            "0", _BuoyancyForceTermThermoChem_DefaultNew );
 
 	RegisterParent( BuoyancyForceTerm_Type,     ForceTerm_Type );
-
+	RegisterParent( BuoyancyForceTermThermoChem_Type,     ForceTerm_Type );
 	Stg_ComponentRegister_Add( componentsRegister, StressBC_Type,            "0", _StressBC_DefaultNew );
 
 	RegisterParent( StressBC_Type,     ForceTerm_Type );

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/PCDVC.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/PCDVC.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/PCDVC.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -214,11 +214,11 @@
 	int resolution[3];
 	int maxD, maxS;
 	Bool splitInInterfaceCells;
-	Stream*  stream;
+	_DVCWeights_Construct( self, cf, data );
+	materialPointsSwarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, "MaterialPointsSwarm", MaterialPointsSwarm, True, data );
+	Stream*  stream = Journal_Register( Info_Type, materialPointsSwarm->type );
 	
-	_DVCWeights_Construct( self, cf, data );
 
-	materialPointsSwarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, "MaterialPointsSwarm", MaterialPointsSwarm, True, data );
 	stream = Journal_Register( Info_Type, materialPointsSwarm->type );
 	upT = Stg_ComponentFactory_GetDouble( cf, self->name, "upperT", 25 );
 	lowT = Stg_ComponentFactory_GetDouble( cf, self->name, "lowerT", 0.6 );

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/Utils.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/Utils.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/Utils.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -47,6 +47,7 @@
 	#include "types.h"
 	#include "BuoyancyForceTerm.h"
 	#include "StressBC.h"
+	#include "BuoyancyForceTermThermoChem.h"
 	#include "MaterialSwarmVariable.h"
 
 	#include "Init.h"

Modified: long/3D/Gale/trunk/src/PICellerator/Utils/src/types.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/src/types.h	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/src/types.h	2007-03-08 19:20:46 UTC (rev 6193)
@@ -57,6 +57,7 @@
 	typedef struct BuoyancyForceTerm                BuoyancyForceTerm;
 	typedef struct StressBC                         StressBC;
 	typedef struct MaterialSwarmVariable            MaterialSwarmVariable;
+	typedef struct BuoyancyForceTermThermoChem      BuoyancyForceTermThermoChem;
         typedef struct PCDVC                        PCDVC;
 
 /* StressBC types */

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_Circle.0of1.output.dat.expected
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_Circle.0of1.output.dat.expected	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_Circle.0of1.output.dat.expected	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,2 @@
+Mean is within tolerance, 0.001000 of 0.162000
+Standard Deviation is within tolerance, 0.001000 of 0.063000

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_ExpIface.0of1.output.dat.expected
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_ExpIface.0of1.output.dat.expected	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_ExpIface.0of1.output.dat.expected	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,2 @@
+Mean is within tolerance, 0.001000 of 0.070000
+Standard Deviation is within tolerance, 0.001000 of 0.050000

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_Poly.0of1.output.dat.expected
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_Poly.0of1.output.dat.expected	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/expected/testPCDVC_Poly.0of1.output.dat.expected	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,2 @@
+Mean is within tolerance, 0.001000 of 0.012000
+Standard Deviation is within tolerance, 0.001000 of 0.002000

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/makefile
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/makefile	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/makefile	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,62 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+##	Melbourne, 3053, Australia.
+## Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+##	Victoria, 3800, Australia
+##
+## Primary Contributing Organisations:
+##	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+##	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+##	Monash Cluster Computing - http://www.mcc.monash.edu.au
+##
+## Contributors:
+##	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+##	Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+##	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+##	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+##	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+##	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+##	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+##	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+##	David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+##	Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+##
+##  This library is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU Lesser General Public
+##  License as published by the Free Software Foundation; either
+##  version 2.1 of the License, or (at your option) any later version.
+##
+##  This library 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
+##  Lesser General Public License for more details.
+##
+##  You should have received a copy of the GNU Lesser General Public
+##  License along with this library; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+## $Id: makefile 422 2007-02-12 04:15:13Z KathleenHumble $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+#Finds the Absolute path to the Project Root directory
+SHELL := /bin/bash
+PROJ_ROOT := $(shell until test -r ./Makefile.system ; do cd .. ; done ; echo `pwd`)
+include ${PROJ_ROOT}/Makefile.system
+
+
+# External Libraries and Headers
+EXTERNAL_INCLUDES = ${STGFEM_INCLUDES} ${STGERMAIN_INCLUDES} ${MPI_INCLUDES} ${XML_CFLAGS}
+EXTERNAL_LIBS = ${STGERMAIN_FEM_LIBS} ${STGERMAIN_LIBS} ${MPI_LIBS} ${XML_LIBS}
+
+#packages
+packages = STGFEM STGERMAIN PETSC MPI XML MATH
+
+checks = $(wildcard *.sh)
+
+tests = libPICelleratorUtils
+
+include ${PROJ_ROOT}/Makefile.vmake

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/testElementIntegral.xml
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/testElementIntegral.xml	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/testElementIntegral.xml	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+	
+	<include>StgFEM/LinearMesh.xml</include>
+	<include>StgFEM/ElementLayout.xml</include>
+	<include>StgFEM/VelocityField.xml</include>
+	<include>StgFEM/TimeIntegrator.xml</include>
+	
+	<struct name="components" mergeType="merge">
+		<struct name="elementCellLayout">
+			<param name="Type">ElementCellLayout</param>
+			<param name="Mesh">mesh-linear</param>
+		</struct>
+		<struct name="localLayout">
+			<param name="Type">MappedParticleLayout</param>
+		</struct>
+		<struct name="swarm">
+			<param name="Type">IntegrationPointsSwarm</param>
+			<param name="CellLayout">elementCellLayout</param>
+			<param name="ParticleLayout">localLayout</param>
+			<param name="FiniteElement_Mesh">mesh-linear</param>
+			<param name="WeightsCalculator">weights</param>
+			<param name="TimeIntegrator">timeIntegrator</param>
+			<param name="IntegrationPointMapper">mapper</param>
+			
+			<param name="VelocityField">VelocityField</param>
+		</struct>
+		<struct name="mapper">
+			<param name="Type">CoincidentMapper</param>
+			<param name="IntegrationPointsSwarm">swarm</param>
+			<param name="MaterialPointsSwarm">picIntegrationPoints</param>
+		</struct>
+		<struct name="particleLayout">
+			<param name="Type">RandomParticleLayout</param>
+			<param name="cellParticleCount">particleCount</param>
+		</struct>
+		<struct name="picIntegrationPoints">
+			<param name="Type">MaterialPointsSwarm</param>
+			<param name="CellLayout">elementCellLayout</param>
+			<param name="ParticleLayout">particleLayout</param>
+			<param name="FiniteElement_Mesh">mesh-linear</param>
+		</struct>
+							  
+	</struct>
+
+	<list name="plugins">
+		<param>testElementIntegral</param>
+	</list>
+	
+	<param name="journal-level.info.Stg_ComponentFactory"> 2 </param>
+	<param name="maxTimeSteps"> 1 </param>
+	<param name="dumpEvery"> 1 </param>
+	<param name="outputPath"> ./output </param>
+	<param name="dim"> 2 </param>
+	
+	<param name="particleCount"> 20 </param>
+	<param name="FunctionName"> CircleInterface </param>
+	<param name="SampleSize"> 1000 </param>
+
+	<!-- Mesh Stuff -->
+	<param name="elementResI"> 2 </param>
+	<param name="elementResJ"> 2 </param>
+	<param name="elementResK"> 1 </param>
+	
+	<param name="shadowDepth"> 1 </param>
+	<param name="minX"> 0.0 </param>
+	<param name="minY"> 0.0 </param>
+	<param name="minZ"> 0.0 </param>
+	<param name="maxX"> 4.0 </param>
+	<param name="maxY"> 4.0 </param>
+	<param name="maxZ"> 1.0 </param>
+	<param name="allowUnbalancing"> True </param>
+	<param name="buildElementNodeTbl"> True </param>
+	
+</StGermainData>

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC.xml
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC.xml	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC.xml	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+	<!-- This included xml is a copy from PICellerator/Weights/tests
+	directory. It uses a plugin defined in that directory --> 
+	<include>testElementIntegral.xml</include>
+	
+	<struct name="components" mergeType="merge">
+
+		<struct name="weights">
+  			<param name="Type">PCDVC</param>
+			<param name="resolutionX">10</param>
+			<param name="resolutionY">10</param>
+			<param name="resolutionZ">10</param>
+			<param name="lowerT">0.6</param>
+			<param name="upperT">25</param>
+			<param name="maxDeletions">3</param>
+			<param name="maxSplits">3</param>
+			<param name="MaterialPointsSwarm">picIntegrationPoints</param>
+		</struct>
+	</struct>
+
+</StGermainData>

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Circle.0of1.sh
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Circle.0of1.sh	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Circle.0of1.sh	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,52 @@
+#!/bin/sh
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+##	Melbourne, 3053, Australia.
+## Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+##	Victoria, 3800, Australia
+##
+## Primary Contributing Organisations:
+##	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+##	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+##	Monash Cluster Computing - http://www.mcc.monash.edu.au
+##
+## Contributors:
+##	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+##	Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+##	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+##	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+##	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+##	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+##	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+##	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+##	David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+##	Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+##
+##  This library is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU Lesser General Public
+##  License as published by the Free Software Foundation; either
+##  version 2.1 of the License, or (at your option) any later version.
+##
+##  This library 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
+##  Lesser General Public License for more details.
+##
+##  You should have received a copy of the GNU Lesser General Public
+##  License along with this library; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+## $Id: testConstantWeightsCircle.0of1.sh 279 2006-04-11 12:36:05Z PatrickSunter $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+TEST_SCRIPT=./VMake/executableTester.sh
+until test -r ${TEST_SCRIPT} ; do
+        TEST_SCRIPT=../${TEST_SCRIPT}
+done
+. ${TEST_SCRIPT}
+
+runAndHandleSystemTestStdLocations "PICellerator testPCDVC.xml --FunctionName=CircleInterface --mean-tolerance=0.001 --standardDeviation-tolerance=0.001 --mean-expectedValue=0.162 --standardDeviation-expectedValue=0.063" "$0" "$@"


Property changes on: long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Circle.0of1.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_ExpIface.0of1.sh
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_ExpIface.0of1.sh	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_ExpIface.0of1.sh	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,52 @@
+#!/bin/sh
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+##	Melbourne, 3053, Australia.
+## Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+##	Victoria, 3800, Australia
+##
+## Primary Contributing Organisations:
+##	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+##	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+##	Monash Cluster Computing - http://www.mcc.monash.edu.au
+##
+## Contributors:
+##	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+##	Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+##	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+##	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+##	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+##	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+##	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+##	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+##	David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+##	Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+##
+##  This library is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU Lesser General Public
+##  License as published by the Free Software Foundation; either
+##  version 2.1 of the License, or (at your option) any later version.
+##
+##  This library 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
+##  Lesser General Public License for more details.
+##
+##  You should have received a copy of the GNU Lesser General Public
+##  License along with this library; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+## $Id: testConstantWeightsExpIface.0of1.sh 279 2006-04-11 12:36:05Z PatrickSunter $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+TEST_SCRIPT=./VMake/executableTester.sh
+until test -r ${TEST_SCRIPT} ; do
+        TEST_SCRIPT=../${TEST_SCRIPT}
+done
+. ${TEST_SCRIPT}
+
+runAndHandleSystemTestStdLocations "PICellerator testPCDVC.xml --FunctionName=ExponentialInterface --mean-tolerance=0.001 --standardDeviation-tolerance=0.001 --mean-expectedValue=0.07 --standardDeviation-expectedValue=0.05" "$0" "$@"


Property changes on: long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_ExpIface.0of1.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Poly.0of1.sh
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Poly.0of1.sh	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Poly.0of1.sh	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,52 @@
+#!/bin/sh
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+##	Melbourne, 3053, Australia.
+## Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+##	Victoria, 3800, Australia
+##
+## Primary Contributing Organisations:
+##	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+##	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+##	Monash Cluster Computing - http://www.mcc.monash.edu.au
+##
+## Contributors:
+##	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+##	Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+##	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+##	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+##	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+##	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+##	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+##	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+##	David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+##	Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+##
+##  This library is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU Lesser General Public
+##  License as published by the Free Software Foundation; either
+##  version 2.1 of the License, or (at your option) any later version.
+##
+##  This library 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
+##  Lesser General Public License for more details.
+##
+##  You should have received a copy of the GNU Lesser General Public
+##  License along with this library; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+## $Id: testConstantWeightsPoly.0of1.sh 279 2006-04-11 12:36:05Z PatrickSunter $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+TEST_SCRIPT=./VMake/executableTester.sh
+until test -r ${TEST_SCRIPT} ; do
+        TEST_SCRIPT=../${TEST_SCRIPT}
+done
+. ${TEST_SCRIPT}
+
+runAndHandleSystemTestStdLocations "PICellerator testPCDVC.xml --FunctionName=PolynomialFunction --mean-tolerance=0.001 --standardDeviation-tolerance=0.001 --mean-expectedValue=0.012 --standardDeviation-expectedValue=0.002" "$0" "$@"


Property changes on: long/3D/Gale/trunk/src/PICellerator/Utils/tests/testPCDVC_Poly.0of1.sh
___________________________________________________________________
Name: svn:executable
   + *

Modified: long/3D/Gale/trunk/src/PICellerator/libPICellerator/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/libPICellerator/src/Init.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/libPICellerator/src/Init.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -54,6 +54,7 @@
 such as streams etc */
 Bool PICellerator_Init( int* argc, char** argv[] ) {
 	int tmp;
+	char* directory;
 
 	PICellerator_Voronoi_Init( argc, argv );
 	PICellerator_PopulationControl_Init( argc, argv );
@@ -69,6 +70,15 @@
                         "Particle-In-Cellerator (FEM/PIC framework) revision %s. Copyright (C) 2005 VPAC & Monash Cluster Computing.\n", VERSION );
 	Stream_Flush( Journal_Register( InfoStream_Type, "Context" ) );
 	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, "Context" ), tmp );
+
+	/* Add the PICellerator path to the global xml path dictionary */
+	directory = Memory_Alloc_Array( char, 200, "xmlDirectory" ) ;
+	sprintf(directory, "%s%s", LIB_DIR, "/StGermain" );
+	XML_IO_Handler_AddDirectory( "PICellerator", directory );
+	Memory_Free(directory);
 	
+	/* Add the plugin path to the global plugin list */
+	PluginsManager_AddDirectory( "PICellerator", LIB_DIR );
+
 	return True;
 }

Added: long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/expected/testLibPICellerator.0of1.expected
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/expected/testLibPICellerator.0of1.expected	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/expected/testLibPICellerator.0of1.expected	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,12 @@
+StGermain Framework revision 4012. Copyright (C) 2003-2005 VPAC.
+StGermain Discretisation Library revision 4012. Copyright (C) 2003-2005 VPAC.
+StGermain Finite Element Framework revision 747. Copyright (C) 2003-2005 VPAC.
+StGermain FEM Discretisation Framework revision 747. Copyright (C) 2003-2005 VPAC.
+StGermain SLE Library revision 747. Copyright (C) 2003-2005 VPAC.
+StGermain PETSc-LinearAlgebra Interface revision 747. Copyright (C) 2003-2005 VPAC.
+StGermain FEM Assembly Library revision 747. Copyright (C) 2003-2005 VPAC.
+Particle-In-Cellerator (FEM/PIC framework) revision 426. Copyright (C) 2005 VPAC & Monash Cluster Computing.
+Watching rank: 0
+StGermain XML library Path found.
+StgFEM XML library Path found.
+PICellerator XML library Path found.

Added: long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/makefile
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/makefile	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/makefile	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,61 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+##      Melbourne, 3053, Australia.
+## Copyright (c) 2005-2006, Monash Cluster Computing, Building 28, Monash University Clayton Campus,
+##      Victoria, 3800, Australia
+##
+## Primary Contributing Organisations:
+##      Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+##      Australian Computational Earth Systems Simulator - http://www.access.edu.au
+##      Monash Cluster Computing - http://www.mcc.monash.edu.au
+##
+## Contributors:
+##      Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+##      Patrick D. Sunter, Software Engineer, VPAC. (patrick at vpac.org)
+##      Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+##      Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##      David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+##      Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+##      Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+##      Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+##      Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+##      Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+##      David Stegman, Postdoctoral Fellow, Monash University. (david.stegman at sci.monash.edu.au)
+##      Wendy Sharples, PhD Student, Monash University (wendy.sharples at sci.monash.edu.au)
+##
+##  This library is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU Lesser General Public
+##  License as published by the Free Software Foundation; either
+##  version 2.1 of the License, or (at your option) any later version.
+##
+##  This library 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
+##  Lesser General Public License for more details.
+##
+##  You should have received a copy of the GNU Lesser General Public
+##  License along with this library; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+## $Id: makefile 422 2007-02-12 04:15:13Z KathleenHumble $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+SHELL := /bin/bash
+# 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
+
+tests = lib${PROJECT}
+
+checks = $(wildcard *.sh)
+
+SRCS = $(wildcard *.c)
+EXTERNAL_INCLUDES = -I${INC_DIR}/${PROJECT} ${STGFEM_INCLUDES} ${STGERMAIN_INCLUDES} ${MPI_INCLUDES} ${XML_CFLAGS} -DLIB_DIR=\"${LIB_DIR}\"
+EXTERNAL_LIBS = ${RPATH_LFLAGS} -L${LIB_DIR} -l${PROJECT} ${STGFEM_LIBS} ${STGERMAIN_LIBS} ${MPI_LIBS} ${XML_LIBS}
+
+packages = STGFEM STGERMAIN MPI XML MATH
+
+include ${PROJ_ROOT}/Makefile.vmake

Added: long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.0of1.sh
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.0of1.sh	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.0of1.sh	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,49 @@
+#!/bin/sh
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+##	Melbourne, 3053, Australia.
+##
+## Primary Contributing Organisations:
+##	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+##	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+##	Monash Cluster Computing - http://www.mcc.monash.edu.au
+##	Computational Infrastructure for Geodynamics - http://www.geodynamics.org
+##
+## Contributors:
+##	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+##	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+##	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+##	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+##	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+##	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+##	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+##	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+##	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+##	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+##
+##  This library is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU Lesser General Public
+##  License as published by the Free Software Foundation; either
+##  version 2.1 of the License, or (at your option) any later version.
+##
+##  This library 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
+##  Lesser General Public License for more details.
+##
+##  You should have received a copy of the GNU Lesser General Public
+##  License along with this library; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+## $Id: testLibStgFEM.0of1.sh 656 2006-10-18 06:45:50Z SteveQuenette $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+TEST_SCRIPT=./VMake/executableTester.sh
+until test -r ${TEST_SCRIPT} ; do
+        TEST_SCRIPT=../${TEST_SCRIPT}
+done
+. ${TEST_SCRIPT}
+
+runAndHandleSystemTestStdLocations "testLibPICellerator " "$0" "$@"


Property changes on: long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.0of1.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.c	2007-03-08 17:51:14 UTC (rev 6192)
+++ long/3D/Gale/trunk/src/PICellerator/libPICellerator/tests/testLibPICellerator.c	2007-03-08 19:20:46 UTC (rev 6193)
@@ -0,0 +1,133 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+**	Melbourne, 3053, Australia.
+**
+** Primary Contributing Organisations:
+**	Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+**	Australian Computational Earth Systems Simulator - http://www.access.edu.au
+**	Monash Cluster Computing - http://www.mcc.monash.edu.au
+**	Computational Infrastructure for Geodynamics - http://www.geodynamics.org
+**
+** Contributors:
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+**	Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**	Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+**	Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library 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
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: testLibStgFEM.c 656 2006-10-18 06:45:50Z SteveQuenette $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/PICellerator.h>
+#include "PICellerator/Init.h"
+#include "PICellerator/Finalise.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main( int argc, char* argv[] ) {
+	MPI_Comm		CommWorld;
+	int			rank;
+	int			numProcessors;
+	int			procToWatch;
+	
+	/* Initialise MPI, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+	/* Read input */
+
+	if( !StGermain_Init( &argc, &argv ) ) {
+		fprintf( stderr, "Error initialising StGermain, exiting.\n" );
+		exit( EXIT_FAILURE );
+	}
+	if (!StgFEM_Init( &argc, &argv ) ) {
+		fprintf( stderr, "Error initialising StgFEM, exiting.\n" );
+		exit( EXIT_FAILURE );
+	}		
+	PICellerator_Init( &argc, &argv );
+	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+
+	if( argc >= 2 ) {
+		procToWatch = atoi( argv[1] );
+	}
+	else {
+		procToWatch = 0;
+	}
+	if( rank == procToWatch ) {
+		Stg_Object* testDirectory;
+
+		printf( "Watching rank: %i\n", rank );
+		/* Testing entries in xmlSearchPaths */
+		testDirectory = Stg_ObjectList_Get( xmlSearchPaths,"StGermain" );
+		if (testDirectory != NULL) {
+			printf("StGermain XML library Path found.\n");
+		}
+		else {
+			printf("StGermain XML library Path not found.\n"); 
+		}
+		/* For build in the same build directory */
+		if (strcmp((char*)LIB_DIR, (char*)testDirectory)) {
+			printf("StgFEM XML library Path found.\n");
+		}
+		/* For build in separate directories */
+		else{
+			testDirectory = Stg_ObjectList_Get( xmlSearchPaths,"StgFEM" );
+			if (testDirectory != NULL) {
+				printf("StgFEM XML library Path found.\n");
+			}
+			else {
+				printf("StgFEM XML library Path not found.\n"); 
+			}
+		}
+		/* For build in the same build directory */
+		if (strcmp((char*)LIB_DIR, (char*)testDirectory)) {
+			printf("PICellerator XML library Path found.\n");
+		}
+		/* For build in separate directories */
+		else{
+			testDirectory = Stg_ObjectList_Get( xmlSearchPaths,"PICellerator" );
+			if (testDirectory != NULL) {
+				printf("PICellerator XML library Path found.\n");
+			}
+			else {
+				printf("PICellerator XML library Path not found.\n"); 
+			}
+		}
+	}
+	
+	PICellerator_Finalise(); 
+	StgFEM_Finalise();
+	StGermain_Finalise();
+	
+	/* Close off MPI */
+	MPI_Finalize();
+
+	return 0; /* success */
+}



More information about the cig-commits mailing list