[cig-commits] commit: Adding a set of changes that allows many to one mappings

Mercurial hg at geodynamics.org
Mon Feb 1 15:31:11 PST 2010


changeset:   344:c9d486818565
parent:      325:e65260562df0
user:        LukeHodkinson at localhost.localdomain
date:        Thu Dec 03 09:58:14 2009 +1100
files:       MaterialPoints/src/CoincidentMapper.c MaterialPoints/src/CoincidentMapper.h MaterialPoints/src/GaussCoincidentMapper.c MaterialPoints/src/GaussCoincidentMapper.h MaterialPoints/src/GaussMapper.c MaterialPoints/src/GaussMapper.h MaterialPoints/src/Init.c MaterialPoints/src/IntegrationPointMapper.c MaterialPoints/src/IntegrationPointMapper.h MaterialPoints/src/ManyToOneMapper.c MaterialPoints/src/ManyToOneMapper.h MaterialPoints/src/MaterialPoints.h MaterialPoints/src/MaterialPointsSwarm.c MaterialPoints/src/MaterialPointsSwarm.h MaterialPoints/src/OneToManyMapper.c MaterialPoints/src/OneToManyMapper.h MaterialPoints/src/OneToManyMapper.meta MaterialPoints/src/OneToOneMapper.c MaterialPoints/src/OneToOneMapper.h MaterialPoints/src/types.h
description:
Adding a set of changes that allows many to one mappings
from material points to integration points. This is needed
for Q2Q1 elements.


diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/CoincidentMapper.c
--- a/MaterialPoints/src/CoincidentMapper.c	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/CoincidentMapper.c	Thu Dec 03 09:58:14 2009 +1100
@@ -87,6 +87,8 @@ CoincidentMapper* CoincidentMapper_New(
 		_OneToOneMapper_GetMaterialPointsSwarms,
 		_OneToOneMapper_GetMaterialIndexOn,
 		_OneToOneMapper_GetExtensionOn,
+		_OneToOneMapper_GetDoubleFromExtension,
+		_OneToOneMapper_GetDoubleFromMaterial,
 		name,
 		True, /* initFlag */
 		integrationSwarm,
@@ -114,6 +116,8 @@ void* _CoincidentMapper_DefaultNew( Name
 			_OneToOneMapper_GetMaterialPointsSwarms,
 			_OneToOneMapper_GetMaterialIndexOn,
 			_OneToOneMapper_GetExtensionOn,
+			_OneToOneMapper_GetDoubleFromExtension,
+			_OneToOneMapper_GetDoubleFromMaterial,
 			name,
 			False,
 			NULL,
@@ -137,6 +141,8 @@ CoincidentMapper* _CoincidentMapper_New(
 		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+		IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+		IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 		Name                                                            name,
 		Bool                                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm,
@@ -160,6 +166,8 @@ CoincidentMapper* _CoincidentMapper_New(
 			_getMaterialPointsSwarms,
 			_getMaterialIndexOn,
 			_getExtensionOn,
+			_getDoubleFromExtension,
+			_getDoubleFromMaterial,
 			name,
 			initFlag,
 			integrationSwarm,
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/CoincidentMapper.h
--- a/MaterialPoints/src/CoincidentMapper.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/CoincidentMapper.h	Thu Dec 03 09:58:14 2009 +1100
@@ -84,6 +84,8 @@
 			IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 			Name                                                            name,
 			Bool                                                            initFlag,
 
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/GaussCoincidentMapper.c
--- a/MaterialPoints/src/GaussCoincidentMapper.c	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/GaussCoincidentMapper.c	Thu Dec 03 09:58:14 2009 +1100
@@ -87,6 +87,8 @@ GaussCoincidentMapper* GaussCoincidentMa
 		_OneToOneMapper_GetMaterialPointsSwarms,
 		_OneToOneMapper_GetMaterialIndexOn,
 		_OneToOneMapper_GetExtensionOn,
+		_OneToOneMapper_GetDoubleFromExtension,
+		_OneToOneMapper_GetDoubleFromMaterial,
 		name,
 		True, /* initFlag */
 		integrationSwarm,
@@ -114,6 +116,8 @@ void* _GaussCoincidentMapper_DefaultNew(
 			_OneToOneMapper_GetMaterialPointsSwarms,
 			_OneToOneMapper_GetMaterialIndexOn,
 			_OneToOneMapper_GetExtensionOn,
+			_OneToOneMapper_GetDoubleFromExtension,
+			_OneToOneMapper_GetDoubleFromMaterial,
 			name,
 			False,
 			NULL,
@@ -137,6 +141,8 @@ GaussCoincidentMapper* _GaussCoincidentM
 		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+		IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+		IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 		Name                                                            name,
 		Bool                                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm,
@@ -160,6 +166,8 @@ GaussCoincidentMapper* _GaussCoincidentM
 			_getMaterialPointsSwarms,
 			_getMaterialIndexOn,
 			_getExtensionOn,
+			_getDoubleFromExtension,
+			_getDoubleFromMaterial,
 			name,
 			initFlag,
 			integrationSwarm,
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/GaussCoincidentMapper.h
--- a/MaterialPoints/src/GaussCoincidentMapper.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/GaussCoincidentMapper.h	Thu Dec 03 09:58:14 2009 +1100
@@ -84,6 +84,8 @@
 			IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 			Name                                                            name,
 			Bool                                                            initFlag,
 
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/GaussMapper.c
--- a/MaterialPoints/src/GaussMapper.c	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/GaussMapper.c	Thu Dec 03 09:58:14 2009 +1100
@@ -60,6 +60,8 @@ GaussMapper* _GaussMapper_New(
 		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+		IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+		IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 		Name                                                            name,
 		Bool                                                            initFlag,
 
@@ -84,6 +86,8 @@ GaussMapper* _GaussMapper_New(
 			_getMaterialPointsSwarms,
 			_getMaterialIndexOn,
 			_getExtensionOn,
+			_getDoubleFromExtension,
+			_getDoubleFromMaterial,
 			name,
 			initFlag,
 			integrationSwarm,
@@ -130,6 +134,8 @@ void* _GaussMapper_DefaultNew( Name name
 			_OneToOneMapper_GetMaterialPointsSwarms,
 			_OneToOneMapper_GetMaterialIndexOn,
 			_OneToOneMapper_GetExtensionOn,
+			_OneToOneMapper_GetDoubleFromExtension,
+			_OneToOneMapper_GetDoubleFromMaterial,
 			name,
 			False,
 			NULL,
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/GaussMapper.h
--- a/MaterialPoints/src/GaussMapper.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/GaussMapper.h	Thu Dec 03 09:58:14 2009 +1100
@@ -58,6 +58,8 @@
 			IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 			Name                                                            name,
 			Bool                                                            initFlag,
 			IntegrationPointsSwarm*                                         integrationSwarm,
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/Init.c
--- a/MaterialPoints/src/Init.c	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/Init.c	Thu Dec 03 09:58:14 2009 +1100
@@ -96,6 +96,7 @@ Bool PICellerator_MaterialPoints_Init( i
 	RegisterParent( Materials_Register_Type,        NamedObject_Register_Type );
 	RegisterParent( MaterialPointsSwarm_Type,       Swarm_Type );
 	RegisterParent( OneToOneMapper_Type,            IntegrationPointMapper_Type );
+	RegisterParent(OneToManyMapper_Type, IntegrationPointMapper_Type);
 	RegisterParent( ParticleFeVariable_Type,        FeVariable_Type );
 	RegisterParent( PeriodicBoundariesManager_Type, Stg_Component_Type );
 	RegisterParent( SwarmAdvector_Type,             TimeIntegratee_Type );
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/IntegrationPointMapper.c
--- a/MaterialPoints/src/IntegrationPointMapper.c	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/IntegrationPointMapper.c	Thu Dec 03 09:58:14 2009 +1100
@@ -74,6 +74,8 @@ IntegrationPointMapper* _IntegrationPoin
 		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 		Name                                                            name,
 		Bool                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm )
@@ -99,6 +101,8 @@ IntegrationPointMapper* _IntegrationPoin
 	self->_getMaterialPointsSwarms       = _getMaterialPointsSwarms;
 	self->_getMaterialIndexOn            = _getMaterialIndexOn;
 	self->_getExtensionOn                = _getExtensionOn;
+	self->_getDoubleFromExtension        = _getDoubleFromExtension;
+	self->_getDoubleFromMaterial         = _getDoubleFromMaterial;
 
 	if (initFlag) {
 		_IntegrationPointMapper_Init( self, integrationSwarm );
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/IntegrationPointMapper.h
--- a/MaterialPoints/src/IntegrationPointMapper.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/IntegrationPointMapper.h	Thu Dec 03 09:58:14 2009 +1100
@@ -76,7 +76,19 @@
 				void*                   mapper, 
 				void*                   points, 
 				ExtensionInfo_Index     extHandle );
-	
+
+	typedef double (IntegrationPointMapper_GetDoubleFromExtension)(
+	    void*                   mapper,
+	    void*                   intPoint,
+	    ExtensionInfo_Index     extHandle,
+	    int                     offs );
+
+        typedef double (IntegrationPointMapper_GetDoubleFromMaterial)(
+	    void*                   mapper,
+	    void*                   intPoint,
+	    ExtensionInfo_Index     extHandle,
+	    int                     offs );
+
 	/* IntegrationPointMapper information */
 	#define __IntegrationPointMapper \
 		__Stg_Component \
@@ -86,6 +98,8 @@
 		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms; \
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn; \
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn; \
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension; \
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial; \
 		\
 		/* General info */ \
 		IntegrationPointsSwarm*                                     integrationSwarm;
@@ -112,6 +126,8 @@
 		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn, 
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn, 
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 		Name                                                            name,
 		Bool                                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm );
@@ -186,4 +202,11 @@ void _IntegrationPointMapper_Construct( 
 					extHandle )
 	void* IntegrationPointMapper_GetExtensionAtFunc( void* mapper, Index point_I, ExtensionInfo_Index extHandle );
 
+
+#define IntegrationPointMapper_GetDoubleFromExtension(mapper, intPoint, extHandle, offs) \
+    ((IntegrationPointMapper*)mapper)->_getDoubleFromExtension(mapper, intPoint, extHandle, offs);
+
+#define IntegrationPointMapper_GetDoubleFromMaterial(mapper, intPoint, extHandle, offs) \
+    ((IntegrationPointMapper*)mapper)->_getDoubleFromMaterial(mapper, intPoint, extHandle, offs);
+
 #endif
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/ManyToOneMapper.c
--- a/MaterialPoints/src/ManyToOneMapper.c	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/ManyToOneMapper.c	Thu Dec 03 09:58:14 2009 +1100
@@ -74,6 +74,8 @@ ManyToOneMapper* _ManyToOneMapper_New(
 		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+		IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+		IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 		Name                                                            name,
 		Bool                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm,
@@ -98,6 +100,8 @@ ManyToOneMapper* _ManyToOneMapper_New(
 			_getMaterialPointsSwarms,
 			_getMaterialIndexOn,
 			_getExtensionOn,
+			_getDoubleFromExtension,
+			_getDoubleFromMaterial,
 			name,
 			initFlag,	
 			integrationSwarm );
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/ManyToOneMapper.h
--- a/MaterialPoints/src/ManyToOneMapper.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/ManyToOneMapper.h	Thu Dec 03 09:58:14 2009 +1100
@@ -86,6 +86,8 @@
 			IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 			Name                                                            name,
 			Bool                                                            initFlag,
 			IntegrationPointsSwarm*                                         integrationSwarm,
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/MaterialPoints.h
--- a/MaterialPoints/src/MaterialPoints.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/MaterialPoints.h	Thu Dec 03 09:58:14 2009 +1100
@@ -59,6 +59,7 @@
 
 	#include "IntegrationPointMapper.h"
 	#include "OneToOneMapper.h"
+        #include "OneToManyMapper.h"
 	#include "CoincidentMapper.h"
 	#include "GaussCoincidentMapper.h"
 	#include "GaussMapper.h"
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/MaterialPointsSwarm.c
--- a/MaterialPoints/src/MaterialPointsSwarm.c	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/MaterialPointsSwarm.c	Thu Dec 03 09:58:14 2009 +1100
@@ -557,6 +557,22 @@ Index MaterialPointsSwarm_GetMaterialInd
 	return point->materialIndex;
 }
 
+void* MaterialPointsSwarm_GetMaterialExtensionOn( void* swarm, void *matPoint, Index extHandle ) {
+	MaterialPointsSwarm *self  = (MaterialPointsSwarm*)swarm;
+	Material *mat;
+
+	mat = MaterialPointsSwarm_GetMaterialOn(self, matPoint);
+	return ExtensionManager_Get(mat->extensionMgr, mat, extHandle);
+}
+
+void* MaterialPointsSwarm_GetMaterialExtensionAt( void* swarm, int matPointInd, Index extHandle ) {
+	MaterialPointsSwarm *self  = (MaterialPointsSwarm*)swarm;
+	Material *mat;
+
+	mat = MaterialPointsSwarm_GetMaterialAt(self, matPointInd);
+	return ExtensionManager_Get(mat->extensionMgr, mat, extHandle);
+}
+
 void* MaterialPointsSwarm_GetExtensionAt( void* swarm, Index point_I, Index extHandle ) {
 	MaterialPointsSwarm* self  = (MaterialPointsSwarm*)swarm;
 	MaterialPoint*       point;
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/MaterialPointsSwarm.h
--- a/MaterialPoints/src/MaterialPointsSwarm.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/MaterialPointsSwarm.h	Thu Dec 03 09:58:14 2009 +1100
@@ -161,6 +161,12 @@
 	/** Returns the material instance associated with the given point index */
 	Index MaterialPointsSwarm_GetMaterialIndexAt( void* swarm, Index point_I );
 
+        /** Get the extension on a material. */
+        void* MaterialPointsSwarm_GetMaterialExtensionOn( void* swarm, void *matPoint, Index extHandle );
+
+        /** Get the extension on a material index. */
+        void* MaterialPointsSwarm_GetMaterialExtensionAt( void* swarm, int matPointInd, Index extHandle );
+
 	/** Returns the particle extension at given point index */
 	void* MaterialPointsSwarm_GetExtensionAt( void* swarm, Index point_I, Index extHandle );
 	
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/OneToManyMapper.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MaterialPoints/src/OneToManyMapper.c	Thu Dec 03 09:58:14 2009 +1100
@@ -0,0 +1,245 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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:  $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/PopulationControl/PopulationControl.h>
+#include <PICellerator/Weights/Weights.h>
+
+#include <assert.h>
+#include <string.h>
+#include <math.h>
+
+#include "MaterialPoints.h"
+
+const Type OneToManyMapper_Type = "OneToManyMapper";
+
+OneToManyMapper* _OneToManyMapper_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,
+		IntegrationPointMapper_MapFunction*                             _map,
+		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
+		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
+		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
+		Name                                                            name,
+		Bool                                                            initFlag,
+		IntegrationPointsSwarm*                                         integrationSwarm,
+		MaterialPointsSwarm*                                            materialSwarm )
+{
+	OneToManyMapper* result;
+
+	result = (OneToManyMapper*)_IntegrationPointMapper_New(
+					_sizeOfSelf,
+					type,
+					_delete,
+					_print,
+					_copy,
+					_defaultConstructor,
+					_construct,
+					_build,
+					_initialise,
+					_execute,
+					_destroy,
+					_map,
+					_getMaterialPointsSwarms,
+					_getMaterialIndexOn,
+					_getExtensionOn,
+					_getDoubleFromExtension,
+					_getDoubleFromMaterial,
+					name,
+					initFlag,
+					integrationSwarm );
+
+	if (initFlag) {
+		_OneToManyMapper_Init( result, integrationSwarm, materialSwarm );
+	}
+		
+	return result;
+}
+
+void _OneToManyMapper_Init( void* mapper, IntegrationPointsSwarm* integrationSwarm, MaterialPointsSwarm* materialSwarm ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+
+	_IntegrationPointMapper_Init( mapper, integrationSwarm );
+	
+	self->errorStream = Journal_MyStream( Error_Type, self );
+	self->materialSwarm = materialSwarm;
+
+	ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, False );
+	self->refHandle = ExtensionManager_Add( 
+	    self->integrationSwarm->particleExtensionMgr,
+	    materialSwarm->name, 
+	    sizeof(OneToManyRef) );
+	ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, True );
+}
+
+void _OneToManyMapper_Delete( void* mapper ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+
+	Stg_Class_Delete( self->materialSwarm );
+	
+	_IntegrationPointMapper_Delete( self );
+}
+void _OneToManyMapper_Print( void* mapper, Stream* stream ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+	
+	_IntegrationPointMapper_Print( self, stream );
+	Stream_Indent( stream );
+	Stg_Class_Print( self->materialSwarm, stream );
+	Stream_UnIndent( stream );
+}
+void* _OneToManyMapper_Copy( void* mapper, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+	OneToManyMapper* newCopy;
+	
+	newCopy = (OneToManyMapper*)_IntegrationPointMapper_Copy( self, dest, deep, nameExt, ptrMap );
+	newCopy->materialSwarm = (MaterialPointsSwarm*)Stg_Class_Copy( self->materialSwarm, NULL, deep, nameExt, ptrMap );
+
+	return newCopy;
+}
+
+void _OneToManyMapper_Construct( void* mapper, Stg_ComponentFactory* cf, void* data ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+	MaterialPointsSwarm* materialSwarm;
+	
+	_IntegrationPointMapper_Construct( self, cf, data );
+
+	materialSwarm = Stg_ComponentFactory_ConstructByKey( 
+				cf, 
+				self->name, 
+				MaterialPointsSwarm_Type, 
+				MaterialPointsSwarm,  
+				True,
+				data  );
+
+	_OneToManyMapper_Init( self, self->integrationSwarm, materialSwarm );
+
+}
+
+void _OneToManyMapper_Build( void* mapper, void* data ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+
+	_IntegrationPointMapper_Build( mapper, data );
+	Stg_Component_Build( self->materialSwarm, data, False );
+	
+}
+void _OneToManyMapper_Initialise( void* mapper, void* data ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+
+	_IntegrationPointMapper_Initialise( mapper, data );
+	Stg_Component_Initialise( self->materialSwarm, data, False );
+}
+void _OneToManyMapper_Execute( void* mapper, void* data ) {}
+void _OneToManyMapper_Destroy( void* mapper, void* data ) {}
+
+OneToManyRef* OneToManyMapper_GetMaterialRef( void* mapper, void* intPoint ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+
+	return (OneToManyRef*)ExtensionManager_Get( 
+			self->integrationSwarm->particleExtensionMgr, 
+			intPoint,
+			self->refHandle );
+}
+
+MaterialPointsSwarm** _OneToManyMapper_GetMaterialPointsSwarms( void* mapper, Index* count ) {
+	OneToManyMapper* self = (OneToManyMapper*)mapper;
+	MaterialPointsSwarm** result = Memory_Alloc_Array( MaterialPointsSwarm*, 1,  "Swarms" );
+	result[0] = self->materialSwarm;
+	*count = 1;
+
+	return result;
+}
+
+Material_Index _OneToManyMapper_GetMaterialIndexOn( void* mapper, void* point ) {
+    /* This method cannot work with a one-to-many mapping. */
+    return -1;
+}
+
+void* _OneToManyMapper_GetExtensionOn( void* mapper, void* point, ExtensionInfo_Index extHandle ) {
+    /* This method cannot work with a one-to-many mapping. */
+    return NULL;
+}
+
+double _OneToManyMapper_GetDoubleFromExtension(void* mapper, void* intPoint, ExtensionInfo_Index extHandle, int offs) {
+    OneToManyMapper *self = (OneToManyMapper*)mapper;
+    OneToManyRef *ref;
+    double v = 0.0, c;
+    int ii;
+
+    ref = OneToManyMapper_GetMaterialRef(mapper, intPoint);
+    for(ii = 0; ii < ref->numParticles; ii++) {
+	c = *(double*)(MaterialPointsSwarm_GetExtensionAt(self->materialSwarm, ref->particleInds[ii], extHandle) + offs);
+	v += ((double)ref->weights[ii])*c;
+    }
+
+    return v;
+}
+
+double _OneToManyMapper_GetDoubleFromMaterial(void* mapper, void* intPoint, ExtensionInfo_Index extHandle, int offs) {
+    OneToManyMapper *self = (OneToManyMapper*)mapper;
+    OneToManyRef *ref;
+    double v = 0.0, c;
+    int ii;
+
+    ref = OneToManyMapper_GetMaterialRef(mapper, intPoint);
+    for(ii = 0; ii < ref->numParticles; ii++) {
+	c = *(double*)(MaterialPointsSwarm_GetMaterialExtensionAt(self->materialSwarm, ref->particleInds[ii], extHandle) + offs);
+	v += ((double)ref->weights[ii])*c;
+    }
+
+    return v;
+}
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/OneToManyMapper.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MaterialPoints/src/OneToManyMapper.h	Thu Dec 03 09:58:14 2009 +1100
@@ -0,0 +1,130 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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
+**
+*/
+/** \file
+**  Role:
+**     An IntegrationPointMapper which maps one MaterialPointsSwarm to one IntegrationPointsSwarm.
+**     Each material point will then have a corresponding integration point generated during mapping.
+**
+** Assumptions:
+**
+** Comments:
+**     Reverse mapping between integration point to material can be done through the IntegrationPointsSwarm or
+**     IntegrationPointMapper interface. It does this by extending each IntegrationPoint with a MaterialPointRef
+**     struct, which has enough information to fetch a particular point out of a particular swarm again.
+**     
+**
+** $Id: OneToManyMapper.h 189 2005-10-20 00:39:29Z RobertTurnbull $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __PICellerator_MaterialPoints_OneToManyMapper_h__
+#define __PICellerator_MaterialPoints_OneToManyMapper_h__
+
+	extern const Type OneToManyMapper_Type;
+
+        struct OneToManyRef {
+	    int numParticles;
+	    int *particleInds;
+	    float *weights;
+        };
+
+	/* OneToManyMapper information */
+	#define __OneToManyMapper \
+		__IntegrationPointMapper \
+		\
+		Stream*				errorStream; \
+		MaterialPointsSwarm*		materialSwarm; \
+		Index                           refHandle; /**< Extension handle to reference struct of material points */
+
+	struct OneToManyMapper { __OneToManyMapper };
+	
+	OneToManyMapper* _OneToManyMapper_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,
+			IntegrationPointMapper_MapFunction*                             _map,
+			IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
+			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
+			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
+			Name                                                            name,
+			Bool                                                            initFlag,
+			IntegrationPointsSwarm*                                         integrationSwarm,
+			MaterialPointsSwarm*                                            materialSwarm );
+
+	void _OneToManyMapper_Init( 
+			void*                   mapper, 
+			IntegrationPointsSwarm* integrationSwarm,
+			MaterialPointsSwarm*    materialSwarm );
+
+	void _OneToManyMapper_Delete( void* mapper );
+	void _OneToManyMapper_Print( void* mapper, Stream* stream );
+	#define OneToManyMapper_Copy( self ) \
+		(OneToManyMapper*) Stg_Class_Copy( self, NULL, False, NULL, NULL )
+	#define OneToManyMapper_DeepCopy( self ) \
+		(OneToManyMapper*) Stg_Class_Copy( self, NULL, True, NULL, NULL )
+	void* _OneToManyMapper_Copy( void* mapper, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
+	
+	void _OneToManyMapper_Construct( void* shape, Stg_ComponentFactory* cf, void* data );
+	void _OneToManyMapper_Build( void* mapper, void* data ) ;
+	void _OneToManyMapper_Initialise( void* mapper, void* data );
+	void _OneToManyMapper_Execute( void* mapper, void* data );
+	void _OneToManyMapper_Destroy( void* mapper, void* data );
+
+	MaterialPointsSwarm** _OneToManyMapper_GetMaterialPointsSwarms( void* mapper, Index* count );	
+	Material_Index _OneToManyMapper_GetMaterialIndexOn( void* mapper, void* point );
+	void* _OneToManyMapper_GetExtensionOn( void* mapper, void* point, ExtensionInfo_Index extHandle );
+        double _OneToManyMapper_GetDoubleFromExtension(void* mapper, void* intPoint, ExtensionInfo_Index extHandle, int offs);
+        double _OneToManyMapper_GetDoubleFromMaterial(void* mapper, void* intPoint, ExtensionInfo_Index extHandle, int offs);
+
+        OneToManyRef* OneToManyMapper_GetMaterialRef( void* mapper, void* intPoint );
+
+#endif
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/OneToManyMapper.meta
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MaterialPoints/src/OneToManyMapper.meta	Thu Dec 03 09:58:14 2009 +1100
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">OneToManyMapper</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">http://www.stgermainproject.org/PICellerator.html</param>
+<param name="Copyright">Copyright (C) 2005 VPAC and Monash Cluster Computing.</param>
+<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
+<param name="Parent">IntegrationPointMapper</param>
+<param name="Reference">...</param>
+<param name="Summary">...</param>
+<param name="Description">An abstract mapper which will yield one-to-one mapping of integration points to material points.</param>
+
+<!--Now the interesting stuff-->
+<list name="Params">
+</list>
+
+<list name="Dependencies">
+	<struct>
+		<param name="Essential">True</param>
+		<param name="Name">MaterialPointsSwarm</param>
+		<param name="Type">MaterialPointsSwarm</param>
+		<param name="Description">The list of material points to be mapped.</param>
+	</struct>
+</list>
+
+<!-- Add an exmaple XML if possible -->
+<param name="Example">n/a</param>
+
+</StGermainData>
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/OneToOneMapper.c
--- a/MaterialPoints/src/OneToOneMapper.c	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/OneToOneMapper.c	Thu Dec 03 09:58:14 2009 +1100
@@ -74,6 +74,8 @@ OneToOneMapper* _OneToOneMapper_New(
 		IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 		IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 		IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+                IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 		Name                                                            name,
 		Bool                                                            initFlag,
 		IntegrationPointsSwarm*                                         integrationSwarm,
@@ -97,6 +99,8 @@ OneToOneMapper* _OneToOneMapper_New(
 					_getMaterialPointsSwarms,
 					_getMaterialIndexOn,
 					_getExtensionOn,
+					_getDoubleFromExtension,
+					_getDoubleFromMaterial,
 					name,
 					initFlag,
 					integrationSwarm );
@@ -254,3 +258,15 @@ void* _OneToOneMapper_GetExtensionOn( vo
 
 	return ExtensionManager_Get( swarm->particleExtensionMgr, materialPoint, extHandle );
 }
+
+double _OneToOneMapper_GetDoubleFromExtension(void* mapper, void* intPoint, ExtensionInfo_Index extHandle, int offs) {
+    return *(double*)(IntegrationPointMapper_GetExtensionOn(mapper, intPoint, extHandle) + offs);
+}
+
+double _OneToOneMapper_GetDoubleFromMaterial(void* mapper, void* intPoint, ExtensionInfo_Index extHandle, int offs) {
+    MaterialPointsSwarm *matSwarm;
+    MaterialPoint *matPoint;
+
+    matPoint = OneToOneMapper_GetMaterialPoint(mapper, intPoint, &matSwarm);
+    return *(double*)(MaterialPointsSwarm_GetMaterialExtensionOn(matSwarm, matPoint, extHandle) + offs);
+}
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/OneToOneMapper.h
--- a/MaterialPoints/src/OneToOneMapper.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/OneToOneMapper.h	Thu Dec 03 09:58:14 2009 +1100
@@ -87,6 +87,8 @@
 			IntegrationPointMapper_GetMaterialPointsSwarmsFunction*         _getMaterialPointsSwarms,
 			IntegrationPointMapper_GetMaterialIndexOnFunction*              _getMaterialIndexOn,
 			IntegrationPointMapper_GetExtensionOnFunction*                  _getExtensionOn,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromExtension,
+			IntegrationPointMapper_GetDoubleFromExtension*                  _getDoubleFromMaterial,
 			Name                                                            name,
 			Bool                                                            initFlag,
 			IntegrationPointsSwarm*                                         integrationSwarm,
@@ -114,6 +116,8 @@
 	MaterialPointsSwarm** _OneToOneMapper_GetMaterialPointsSwarms( void* mapper, Index* count );	
 	Material_Index _OneToOneMapper_GetMaterialIndexOn( void* mapper, void* point );
 	void* _OneToOneMapper_GetExtensionOn( void* mapper, void* point, ExtensionInfo_Index extHandle );
+        double _OneToOneMapper_GetDoubleFromExtension(void* mapper, void* intPoint, ExtensionInfo_Index extHandle, int offs);
+        double _OneToOneMapper_GetDoubleFromMaterial(void* mapper, void* intPoint, ExtensionInfo_Index extHandle, int offs);
 
 	MaterialPointRef* OneToOneMapper_GetMaterialRef( void* mapper, void* integrationPoint );
 	MaterialPoint* OneToOneMapper_GetMaterialPoint( void* mapper, void* integrationPoint, MaterialPointsSwarm** materialSwarm );
diff -r e65260562df0 -r c9d486818565 MaterialPoints/src/types.h
--- a/MaterialPoints/src/types.h	Mon Nov 23 15:44:07 2009 +1100
+++ b/MaterialPoints/src/types.h	Thu Dec 03 09:58:14 2009 +1100
@@ -61,6 +61,8 @@
 
 	typedef struct IntegrationPointMapper       IntegrationPointMapper;
 	typedef struct OneToOneMapper               OneToOneMapper;
+        typedef struct OneToManyRef OneToManyRef;
+        typedef struct OneToManyMapper OneToManyMapper;
 	typedef struct CoincidentMapper             CoincidentMapper;
 	typedef struct GaussCoincidentMapper        GaussCoincidentMapper;
 	typedef struct GaussMapper                  GaussMapper;



More information about the CIG-COMMITS mailing list