[cig-commits] commit: new component provides for interface between a swarm variable, as defined in the code and specified through the XML, & an FeVariable. implicitly interpolates the swarm variable onto the mesh, such that new components do not need to be written for each swarm variable you wish to generate a mesh field from. seems to be working fine

Mercurial hg at geodynamics.org
Mon Nov 24 11:30:36 PST 2008


changeset:   45:a4fe7c0b50a5
user:        DavidLee
date:        Thu Oct 04 06:50:24 2007 +0000
files:       MaterialPoints/src/Init.c MaterialPoints/src/MaterialPoints.h MaterialPoints/src/ParticleFeVariable.c MaterialPoints/src/SwarmVariableField.c MaterialPoints/src/SwarmVariableField.h MaterialPoints/src/SwarmVariableField.meta MaterialPoints/src/types.h
description:
new component provides for interface between a swarm variable, as defined in the code and specified through the XML, & an FeVariable. implicitly interpolates the swarm variable onto the mesh, such that new components do not need to be written for each swarm variable you wish to generate a mesh field from. seems to be working fine


diff -r 0a6c762d4242 -r a4fe7c0b50a5 MaterialPoints/src/Init.c
--- a/MaterialPoints/src/Init.c	Thu Oct 04 02:55:34 2007 +0000
+++ b/MaterialPoints/src/Init.c	Thu Oct 04 06:50:24 2007 +0000
@@ -38,7 +38,7 @@
 **  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: Init.c 376 2006-10-18 06:58:41Z SteveQuenette $
+** $Id: Init.c 515 2007-10-04 06:50:24Z DavidLee $
 **
 **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
@@ -74,9 +74,12 @@ Bool PICellerator_MaterialPoints_Init( i
 	
 	Stg_ComponentRegister_Add( componentsRegister, SwarmAdvector_Type,            "0", _SwarmAdvector_DefaultNew );
 	Stg_ComponentRegister_Add( componentsRegister, SwarmAdvectorD_Type,            "0", _SwarmAdvectorD_DefaultNew );
-		Stg_ComponentRegister_Add( componentsRegister, SwarmAdvectorW_Type,            "0", _SwarmAdvectorW_DefaultNew );
+	Stg_ComponentRegister_Add( componentsRegister, SwarmAdvectorW_Type,            "0", _SwarmAdvectorW_DefaultNew );
 
 	Stg_ComponentRegister_Add( componentsRegister, PeriodicBoundariesManager_Type,"0", _PeriodicBoundariesManager_DefaultNew );
+	
+	/* dave, 18.09.07 */
+	Stg_ComponentRegister_Add( componentsRegister, SwarmVariableField_Type,"0", _SwarmVariableField_DefaultNew );
 
 	/* Doing this in alphabetical order to match ls output */
 	RegisterParent( BackgroundParticleLayout_Type,  ParticleLayout_Type );
@@ -97,6 +100,10 @@ Bool PICellerator_MaterialPoints_Init( i
 	RegisterParent( SwarmAdvector_Type,             TimeIntegratee_Type );
 	RegisterParent( SwarmAdvectorD_Type,            SwarmAdvector_Type );
 	RegisterParent( SwarmAdvectorW_Type,            SwarmAdvector_Type );
+	
+	/* dave, 18.09.07 */
+	RegisterParent( SwarmVariableField_Type,        ParticleFeVariable_Type );
+
 
 	return True;
 }
diff -r 0a6c762d4242 -r a4fe7c0b50a5 MaterialPoints/src/MaterialPoints.h
--- a/MaterialPoints/src/MaterialPoints.h	Thu Oct 04 02:55:34 2007 +0000
+++ b/MaterialPoints/src/MaterialPoints.h	Thu Oct 04 06:50:24 2007 +0000
@@ -51,7 +51,7 @@
 	#include "MaterialFeVariable.h"
 	#include "SwarmAdvector.h"
 	#include "SwarmAdvectorD.h"
-    #include "SwarmAdvectorW.h"
+	#include "SwarmAdvectorW.h"
 
 	#include "PeriodicBoundariesManager.h"
 
@@ -67,6 +67,9 @@
 	#include "MaterialPointsSwarm.h"
 	#include "IntegrationPointsSwarm.h"
 
+	/* dave 21.09.07 */
+	#include "SwarmVariableField.h"
+
 	#include "Context.h"
 	#include "Init.h"
 	#include "Finalise.h"
diff -r 0a6c762d4242 -r a4fe7c0b50a5 MaterialPoints/src/ParticleFeVariable.c
--- a/MaterialPoints/src/ParticleFeVariable.c	Thu Oct 04 02:55:34 2007 +0000
+++ b/MaterialPoints/src/ParticleFeVariable.c	Thu Oct 04 06:50:24 2007 +0000
@@ -38,7 +38,7 @@
 **  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: ParticleFeVariable.c 492 2007-07-09 23:41:51Z PatrickSunter $
+** $Id: ParticleFeVariable.c 515 2007-10-04 06:50:24Z DavidLee $
 **
 **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
@@ -284,7 +284,7 @@ void ParticleFeVariable_AssembleElement(
 	ForceTerm*                 forceTerm         = (ForceTerm*) _forceTerm;
 	ParticleFeVariable*        self              = Stg_CheckType( forceVector->feVariable, ParticleFeVariable );
 	IntegrationPointsSwarm*    swarm             = (IntegrationPointsSwarm*)forceTerm->integrationSwarm;
-	FeMesh*        mesh              = self->feMesh;
+	FeMesh*        		   mesh              = self->feMesh;
 	Element_NodeIndex          elementNodeCount  = FeMesh_GetElementNodeSize( mesh, lElement_I );
 	ElementType*               elementType       = FeMesh_GetElementType( mesh, lElement_I );
 	Cell_Index                 cell_I            = CellLayout_MapElementIdToCellId( swarm->cellLayout, lElement_I );
@@ -320,7 +320,7 @@ void ParticleFeVariable_AssembleElementS
 	ForceTerm*                 forceTerm         = (ForceTerm*) _forceTerm;
 	ParticleFeVariable*        self              = Stg_CheckType( forceVector->feVariable, ParticleFeVariable );
 	Swarm*                     swarm             = forceTerm->integrationSwarm;
-	FeMesh*        mesh              = self->feMesh;
+	FeMesh*        		   mesh              = self->feMesh;
 	Element_NodeIndex          elementNodeCount  = FeMesh_GetElementNodeSize( mesh, lElement_I );
 	ElementType*               elementType       = FeMesh_GetElementType( mesh, lElement_I );
 	Cell_Index                 cell_I            = CellLayout_MapElementIdToCellId( swarm->cellLayout, lElement_I );
diff -r 0a6c762d4242 -r a4fe7c0b50a5 MaterialPoints/src/SwarmVariableField.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MaterialPoints/src/SwarmVariableField.c	Thu Oct 04 06:50:24 2007 +0000
@@ -0,0 +1,314 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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: SwarmVariableField.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 "types.h"
+#include "ParticleFeVariable.h"
+#include "SwarmVariableField.h"
+#include "IntegrationPointsSwarm.h"
+#include "MaterialPointsSwarm.h"
+
+#include <assert.h>
+#include <string.h>
+
+const Type SwarmVariableField_Type = "SwarmVariableField";
+
+/* Creation implementation / Virtual constructor */
+SwarmVariableField* _SwarmVariableField_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,
+		FieldVariable_InterpolateValueAtFunction*         _interpolateValueAt,
+		FieldVariable_GetValueFunction*	                  _getMinGlobalFeMagnitude,
+		FieldVariable_GetValueFunction*                   _getMaxGlobalFeMagnitude,
+		FieldVariable_GetCoordFunction*             	  _getMinAndMaxLocalCoords,
+		FieldVariable_GetCoordFunction*             	  _getMinAndMaxGlobalCoords,
+		FeVariable_InterpolateWithinElementFunction*      _interpolateWithinElement,	
+		FeVariable_GetValueAtNodeFunction*	  	  _getValueAtNode,
+		/*SwarmVariableField_GetValueAtNodeFunction*	  _getValueAtNode,*/
+		/*SwarmVariableField_ValueAtParticleFunction*       _valueAtParticle,*/
+		ParticleFeVariable_ValueAtParticleFunction*       _valueAtParticle,
+		Name                                              name ) 
+{
+	SwarmVariableField* self;
+	
+	/* Allocate memory */
+	assert( _sizeOfSelf >= sizeof(SwarmVariableField) );
+
+	self = (SwarmVariableField*) _ParticleFeVariable_New(
+ 						_sizeOfSelf,
+						type,
+						_delete,
+						_print,
+						_copy, 
+						_defaultConstructor,
+						_construct,
+						_build,
+						_initialise,
+						_execute,
+						_destroy,
+						_interpolateValueAt,
+						_getMinGlobalFeMagnitude,
+						_getMaxGlobalFeMagnitude,
+						_getMinAndMaxLocalCoords,
+						_getMinAndMaxGlobalCoords,		
+						_interpolateWithinElement,	
+						_getValueAtNode,
+						_valueAtParticle,
+						name );
+	/* Virtual info */
+	
+	return self;
+}
+
+void _SwarmVariableField_Init( SwarmVariableField* swarmVariableField, SwarmVariable* swarmVar, Variable_Register* variable_Register ) {
+	SwarmVariableField* 	self 	= (SwarmVariableField*)swarmVariableField;
+	self->swarmVar = swarmVar;
+	self->variable_Register = variable_Register;
+}
+
+void _SwarmVariableField_Delete( void* swarmVariableField ) {
+	SwarmVariableField* self = (SwarmVariableField*)swarmVariableField;
+
+	_ParticleFeVariable_Delete( self );
+}
+
+void _SwarmVariableField_Print( void* swarmVariableField, Stream* stream ) {
+	SwarmVariableField* self = (SwarmVariableField*)swarmVariableField;
+	
+	_ParticleFeVariable_Print( self, stream );
+}
+
+void* _SwarmVariableField_DefaultNew( Name name ) {
+	return (void*)_SwarmVariableField_New( 
+			sizeof(SwarmVariableField), 
+			SwarmVariableField_Type,
+			_SwarmVariableField_Delete,
+			_SwarmVariableField_Print,
+			NULL,
+			_SwarmVariableField_DefaultNew,
+			_SwarmVariableField_Construct,
+			_SwarmVariableField_Build,
+			_SwarmVariableField_Initialise,
+			_SwarmVariableField_Execute,
+			_SwarmVariableField_Destroy,
+			_FeVariable_InterpolateValueAt,
+			_FeVariable_GetMinGlobalFieldMagnitude,
+			_FeVariable_GetMaxGlobalFieldMagnitude,
+			_FeVariable_GetMinAndMaxLocalCoords,
+			_FeVariable_GetMinAndMaxGlobalCoords,
+			_FeVariable_InterpolateNodeValuesToElLocalCoord,
+			_FeVariable_GetValueAtNode,
+			/*_SwarmVariableField_GetValueAtNode,*/
+			_SwarmVariableField_ValueAtParticle,
+			name );
+}
+
+void _SwarmVariableField_Construct( void* swarmVariableField, Stg_ComponentFactory* cf, void* data ) {
+	SwarmVariableField*     	self		= (SwarmVariableField*)swarmVariableField;
+	SwarmVariable*			swarmVar;
+	IntegrationPointsSwarm* 	integrationSwarm;
+	FiniteElementContext*		context;
+	Variable_Register*		variable_Register;
+
+	variable_Register = (Variable_Register*) Stg_ObjectList_Get( cf->registerRegister, "Variable_Register" );
+
+	/* Construct Parent */
+	_ParticleFeVariable_Construct( self, cf, data );
+
+	// TODO: just get the textual name here - see gLucifer's SwarmPlotter DrawignObject 
+	self->swarmVarName = Stg_ComponentFactory_GetString( cf, self->name, "SwarmVariable", "" );
+	assert( swarmVar );
+
+	self->materialSwarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, "MaterialSwarm", MaterialPointsSwarm, True, data );
+
+	integrationSwarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, "IntegrationSwarm", IntegrationPointsSwarm, True, NULL );
+	assert( integrationSwarm );
+
+	/* dunno if this is the right way about getting the context... */
+	context = (FiniteElementContext*) Stg_ComponentFactory_ConstructByName( cf, "context", FiniteElementContext, True, data );
+	assert( context );
+
+	_SwarmVariableField_Init( self, swarmVar, variable_Register );
+	_ParticleFeVariable_Init( self, integrationSwarm, context );
+}
+
+void _SwarmVariableField_Build( void* swarmVariableField, void* data ) {
+	SwarmVariableField*	self	= (SwarmVariableField*)swarmVariableField;
+	Name			tmpName;
+	unsigned		nDomainVerts	= Mesh_GetDomainSize( self->feMesh, MT_VERTEX );
+
+	/* make this more flexible to handle vector values at each node - will have to get the num dofs from the XML
+	 * as other components are not necessarily built yet... dave. 03.10.07 */
+	assert( Class_IsSuper( self->feMesh->topo, IGraph ) );
+	tmpName = Stg_Object_AppendSuffix( self, "DataVariable" );
+	self->dataVariable = Variable_NewScalar( tmpName,
+		       				 Variable_DataType_Double,
+						 /* this guy is NULL, & i have no idea what an igraph is,
+						  * but this arument is a pointer to the array size - 03.10.07 */
+						 //&((IGraph*)self->feMesh->topo)->remotes[MT_VERTEX]->nDomains,
+						 &nDomainVerts,
+						 NULL,
+						 (void**)&self->data,
+						 self->variable_Register );
+	Memory_Free( tmpName );
+	self->fieldComponentCount = 1;
+
+	tmpName = Stg_Object_AppendSuffix( self, "DofLayout" );
+	self->dofLayout = DofLayout_New( tmpName, self->variable_Register, 0, self->feMesh );
+
+	/* must build before adding the variable to the dof layout, dave. 04.10.07 */
+	//Stg_Component_Build( self->dofLayout, data, False );
+	Stg_Component_Build( self->dofLayout->mesh, data, False );
+	self->dofLayout->_numItemsInLayout = Mesh_GetDomainSize( self->dofLayout->mesh, MT_VERTEX );
+	DofLayout_AddAllFromVariableArray( self->dofLayout, 1, &self->dataVariable );
+	Memory_Free( tmpName );
+	
+	self->eqNum->dofLayout = self->dofLayout;
+
+
+	_ParticleFeVariable_Build( self, data );
+	/* TODO: build self->swarmVar */
+	// TODO: granb self->SwarmVariableName out of the swarm vart register, save reference as self->swarmVar
+	//_SwarmVariable_Build( self->swarmVar, data ); /* dave, 18.09.07 */
+}
+
+void _SwarmVariableField_Initialise( void* swarmVariableField, void* data ) {
+	SwarmVariableField*		self			= (SwarmVariableField*)swarmVariableField;
+	SwarmVariable_Register*		swarmVar_Register	= self->materialSwarm->swarmVariable_Register;
+	Stream*				errorStream		= Journal_Register( Error_Type, self->type );
+
+	/* assign the swarm variable, assume its already built */
+	if( 0 != strcmp( self->swarmVarName, "" ) ) {
+		self->swarmVar = SwarmVariable_Register_GetByName( swarmVar_Register, self->swarmVarName );
+		Journal_Firewall( self->swarmVar != NULL, errorStream, "Error - cannot find swarm variable \"%s\" in %s() for swarm \"%s\".\n",
+			          self->swarmVarName, __func__, self->materialSwarm->name );
+
+		Stg_Component_Build( self->swarmVar, data, False );
+		Stg_Component_Initialise( self->swarmVar, data, False );
+	}
+
+	_ParticleFeVariable_Initialise( self, data );
+
+	_SwarmVariable_Initialise( self->swarmVar, data );
+}
+
+void _SwarmVariableField_Execute( void* swarmVariableField, void* data ) {
+	_ParticleFeVariable_Execute( swarmVariableField, data );
+}
+
+void _SwarmVariableField_Destroy( void* swarmVariableField, void* data ) {
+	_ParticleFeVariable_Destroy( swarmVariableField, data );
+}
+
+void _SwarmVariableField_ValueAtParticle( void* swarmVariableField, 
+					  IntegrationPointsSwarm* swarm, 
+					  Element_LocalIndex lElement_I, 
+					  /*Particle_Index lParticle_I, */
+					  IntegrationPoint* particle,
+					  double* value ) 
+{
+	SwarmVariableField*	self            = (SwarmVariableField*)swarmVariableField;
+	//MaterialPoint*		matParticle;
+	GlobalParticle*		matParticle;
+	double			distance;
+	Cell_Index		cell_I;
+	Particle_InCellIndex	cParticle_I;
+	Particle_Index		lParticle_I;
+
+	matParticle = OneToOneMapper_GetMaterialPoint( swarm->mapper, particle, self->materialSwarm );
+	cell_I		= CellLayout_MapElementIdToCellId( swarm->cellLayout, lElement_I );
+
+	/* is the cell index required here local or global?? dave, 04.10.07 */
+	cParticle_I = Swarm_FindClosestParticleInCell( self->materialSwarm, 
+						       cell_I, 
+						       Mesh_GetDimSize( self->dofLayout->mesh ), 
+						       matParticle->coord, 
+						       &distance );
+
+	lParticle_I = self->materialSwarm->cellParticleTbl[cell_I][cParticle_I];
+	// TODO SwarmVariable_ValueAt( self->swarmVariable, lParticle_I )
+	// TODO return / copy value
+	SwarmVariable_ValueAt( self->swarmVar, lParticle_I, value ); /* does the copy inside this func. dave, 18.09.07 */
+}
+
+/* use the FeVariable_GetValueAtNode func. dave, 03.10.07 */
+void _SwarmVariableField_GetValueAtNode( void* swarmVariableField, Node_DomainIndex dNode_I, double* value ) {
+/*
+	SwarmVariableField*	self            = (SwarmVariableField*)swarmVariableField;
+	double*			localVecValues;
+
+	Vector_GetArray( self->assemblyVector->vector, &localVecValues );
+	*value	= localVecValues[ dNode_I * self->fieldComponentCount ];
+*/
+	FeVariable_GetValueAtNode( swarmVariableField, dNode_I, value );
+}
+
+/* implement these two functions later... */
+/*
+double _SwarmVariableField_GetMinGlobalMagnitude( void* swarmVariableField ) {
+	return _SwarmVariable_GetMinGlobalMagnitude( swarmVariableField );
+}
+double _SwarmVariableField_GetMaxGlobalMagnitude( void* swarmVariableField ) {
+	return _SwarmVariable_GetMaxGlobalMagnitude( swarmVariableField );
+}
+*/
+
+
+
diff -r 0a6c762d4242 -r a4fe7c0b50a5 MaterialPoints/src/SwarmVariableField.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MaterialPoints/src/SwarmVariableField.h	Thu Oct 04 06:50:24 2007 +0000
@@ -0,0 +1,115 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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_SwarmVariableField_h__
+#define __PICellerator_Utils_SwarmVariableField_h__
+
+	/** Textual name of this class */
+	extern const Type SwarmVariableField_Type;
+
+	typedef void (SwarmVariableField_GetValueAtNodeFunction) ( void* swarmVariableField, Node_DomainIndex dNode_I, double* result );
+	typedef void (SwarmVariableField_ValueAtParticleFunction) ( void* swarmVariableField, Particle_Index lParticle_I, double* result );
+
+	/** SwarmVariableField class contents */
+	#define __SwarmVariableField \
+		/* General info */ \
+		__ParticleFeVariable; \
+		/* Virtual info */ \
+		/* SwarmVariableField info */ \
+		unsigned		dofCount;     		\
+		MaterialPointsSwarm*	materialSwarm;  	\
+		Name			swarmVarName;		\
+		SwarmVariable*		swarmVar;     		\
+		Variable_Register*	variable_Register;	\
+
+	struct SwarmVariableField { __SwarmVariableField };
+/*	
+	SwarmVariableField* SwarmVariableField_New( 
+		Name                                                name,
+		MaterialPointsSwarm*                                swarm,
+		Index                                               dofCount );
+*/	
+	SwarmVariableField* _SwarmVariableField_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,
+		FieldVariable_InterpolateValueAtFunction*         _interpolateValueAt,
+		FieldVariable_GetValueFunction*	                  _getMinGlobalFeMagnitude,
+		FieldVariable_GetValueFunction*                   _getMaxGlobalFeMagnitude,
+		FieldVariable_GetCoordFunction*             	  _getMinAndMaxLocalCoords,
+		FieldVariable_GetCoordFunction*             	  _getMinAndMaxGlobalCoords,
+		FeVariable_InterpolateWithinElementFunction*      _interpolateWithinElement,	
+		FeVariable_GetValueAtNodeFunction*	  	  _getValueAtNode,
+		/*SwarmVariableField_GetValueAtNodeFunction*	  _getValueAtNode,*/
+		/*SwarmVariableField_ValueAtParticleFunction*       _valueAtParticle,*/
+		ParticleFeVariable_ValueAtParticleFunction*       _valueAtParticle,
+		Name                                              name );
+	
+	void _SwarmVariableField_Delete( void* swarmVariable );
+	void _SwarmVariableField_Print( void* swarmVariable, Stream* stream );
+
+	void* _SwarmVariableField_DefaultNew( Name name ) ;
+	void _SwarmVariableField_Construct( void* swarmVariable, Stg_ComponentFactory* cf, void* data ) ;
+	void _SwarmVariableField_Build( void* swarmVariable, void* data ) ;
+	void _SwarmVariableField_Initialise( void* swarmVariable, void* data ) ;
+	void _SwarmVariableField_Execute( void* swarmVariable, void* data ) ;
+	void _SwarmVariableField_Destroy( void* swarmVariable, void* data ) ;
+
+	void _SwarmVariableField_ValueAt( void* swarmVariable, Particle_Index lParticle_I, double* value ) ;
+	/*
+	double _SwarmVariableField_GetMinGlobalMagnitude( void* swarmVariable ) ;
+	double _SwarmVariableField_GetMaxGlobalMagnitude( void* swarmVariable ) ;
+	*/
+	void _SwarmVariableField_GetValueAtNode( void* swarmVariableField, Node_DomainIndex dNode_I, double* value );
+
+	void _SwarmVariableField_ValueAtParticle( void* swarmVariableField, IntegrationPointsSwarm* swarm, Element_LocalIndex lElement_I, /*Particle_Index lParticle_I*/ IntegrationPoint* particle, double* value );
+	
+#endif
diff -r 0a6c762d4242 -r a4fe7c0b50a5 MaterialPoints/src/SwarmVariableField.meta
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MaterialPoints/src/SwarmVariableField.meta	Thu Oct 04 06:50:24 2007 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">SwarmVariableField</param>
+<param name="Author">...</param>
+<param name="Organisation">VPAC and MCC</param>
+<param name="Project">PICellerator</param>
+<param name="Location">./PICellerator/MaterialPoints/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">SwarmVariable</param>
+<param name="Reference">...</param>
+<param name="Summary">...</param>
+<param name="Description">Creates a swarm variable from a value stored on each material. This means that the degrees of freedom for the SwarmVariable aren't extra data on the particles in the swarm but stored only once per material.</param>
+
+<list name="Params">
+</list>
+
+<list name="Dependencies">
+</list>
+<!-- Add an exmaple XML if possible -->
+<param name="Example">...</param>
+
+</StGermainData>
diff -r 0a6c762d4242 -r a4fe7c0b50a5 MaterialPoints/src/types.h
--- a/MaterialPoints/src/types.h	Thu Oct 04 02:55:34 2007 +0000
+++ b/MaterialPoints/src/types.h	Thu Oct 04 06:50:24 2007 +0000
@@ -49,7 +49,7 @@
 ** Comments:
 **	None as yet.
 **
-** $Id: types.h 349 2006-07-05 11:02:57Z WendySharples $
+** $Id: types.h 515 2007-10-04 06:50:24Z DavidLee $
 **
 **~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
@@ -76,10 +76,13 @@
 	typedef struct MaterialPoint                MaterialPoint;
 	typedef struct MaterialPointRef             MaterialPointRef;
 	typedef struct SwarmAdvector                SwarmAdvector;
-typedef struct SwarmAdvectorD                SwarmAdvectorD;
-typedef struct SwarmAdvectorW                SwarmAdvectorW;
+	typedef struct SwarmAdvectorD                SwarmAdvectorD;
+	typedef struct SwarmAdvectorW                SwarmAdvectorW;
 
 	typedef struct PeriodicBoundariesManager    PeriodicBoundariesManager;
+
+	/* dave, 18.09.07 */
+	typedef struct SwarmVariableField	SwarmVariableField;
 
 	/* Types, for readability */
 	typedef Index                             Material_Index;



More information about the CIG-COMMITS mailing list