[cig-commits] r4148 - in long/3D/Gale/trunk/src/PICellerator: . plugins plugins/CalculateParticleDisplacement

walter at geodynamics.org walter at geodynamics.org
Tue Aug 1 01:53:47 PDT 2006


Author: walter
Date: 2006-08-01 01:53:46 -0700 (Tue, 01 Aug 2006)
New Revision: 4148

Added:
   long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/
   long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.c
   long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.h
   long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/makefile
Modified:
   long/3D/Gale/trunk/src/PICellerator/
Log:
 r463 at earth:  boo | 2006-08-01 01:52:05 -0700
  r458 at earth (orig r361):  PatrickSunter | 2006-07-23 17:44:28 -0700
  Added a new plugin, that stores a particle's original coordinate,
  and calculates the displacement and displacement magnitude from
  that initial coordinate each timestep.
  
  The 3 new swarm variable's are called:
     * materialSwarm-OriginalCoord
     * materialSwarm-Displacement
     * materialSwarm-DisplacementMagnitude (an OperatorSwarmVariable)
  
  At the moment they all assume there is a MaterialPointsSwarm
  component in the register called "materialSwarm". Will leave like
  this until plugins mk 3 is rolled out, where plugins can read
  their own sub-dictionary elegantly.
  
  This is mainly to support the granular sand flow models, where
  displacement from initial position is an important benchmark
  aspect of the model.
  
  
 



Property changes on: long/3D/Gale/trunk/src/PICellerator
___________________________________________________________________
Name: svk:merge
   - 00de75e2-39f1-0310-8538-9683d00a49cc:/trunk:360
aee11096-cf10-0410-a191-eea5772ba81f:/cig:462
   + 00de75e2-39f1-0310-8538-9683d00a49cc:/trunk:361
aee11096-cf10-0410-a191-eea5772ba81f:/cig:463

Added: long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.c
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.c	2006-08-01 08:53:46 UTC (rev 4147)
+++ long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.c	2006-08-01 08:53:46 UTC (rev 4148)
@@ -0,0 +1,193 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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 <StG_FEM/StG_FEM.h>
+#include <PICellerator/PICellerator.h>
+
+#include "CalculateParticleDisplacement.h"
+#include <math.h>
+#include <string.h>
+#include <assert.h>
+
+const Type PICellerator_CalculateParticleDisplacement_Type = "PICellerator_CalculateParticleDisplacement";
+
+void _PICellerator_CalculateParticleDisplacement_Construct( void* component, Stg_ComponentFactory* data ) {
+	CalculateParticleDisplacementPlugin*  self = (CalculateParticleDisplacementPlugin*)component;
+	DiscretisationContext*                context;
+	MaterialPointsSwarm*                  materialPointsSwarm;
+	StandardParticle                      particle;
+	ParticleDisplacementInfo*             particleExt;
+	
+	context = (DiscretisationContext*)Stg_ComponentFactory_ConstructByName( data, "context", DiscretisationContext, True );
+
+	ContextEP_Append( context, AbstractContext_EP_IC, _PICellerator_CalculateParticleDisplacement_StoreOriginalPos );
+	ContextEP_Append( context, AbstractContext_EP_Step, _PICellerator_CalculateParticleDisplacement_UpdateDisplacement );
+
+	/* Extend particle with original pos */
+	materialPointsSwarm = (MaterialPointsSwarm*) LiveComponentRegister_Get( context->CF->LCRegister, "materialSwarm" );
+	assert( materialPointsSwarm );
+	self->particleDisplacementInfo_Handle = ExtensionManager_Add( materialPointsSwarm->particleExtensionMgr, CURR_MODULE_NAME,
+		sizeof( ParticleDisplacementInfo ) );
+
+	/* now register these guys as swarm variables */
+	particleExt = ExtensionManager_Get( materialPointsSwarm->particleExtensionMgr, &particle,
+		self->particleDisplacementInfo_Handle );
+
+	self->particleOriginalCoordSwarmVariable = Swarm_NewVectorVariable(
+		materialPointsSwarm,
+		"OriginalCoord",
+		(ArithPointer) &particleExt->originalCoord - (ArithPointer) &particle,
+		Variable_DataType_Double,
+		materialPointsSwarm->dim,
+		"OriginalCoordX",
+		"OriginalCoordY",
+		"OriginalCoordZ" );
+		
+	self->particleDisplacementSwarmVariable = Swarm_NewVectorVariable(
+		materialPointsSwarm,
+		"Displacement",
+		(ArithPointer) &particleExt->displacement - (ArithPointer) &particle,
+		Variable_DataType_Double,
+		materialPointsSwarm->dim,
+		"DisplacementX",
+		"DisplacementY",
+		"DisplacementZ" );
+
+	/* Create this here, rather than in XML, since if we tried to create it in XML it couldn't
+	find the Displacement swarm variable at configure-time */
+	/* OperatorSwarmVariables don't automatically prefix the swarm's name to the name
+	you give, so we have to add it manually here */
+	self->particleDisplacementMagSwarmVariable = OperatorSwarmVariable_NewUnary(
+		"materialSwarm-DisplacementMagnitude",
+		self->particleDisplacementSwarmVariable,
+		"Magnitude" );
+	
+	/* Need to make sure this guy is build/initialised */
+}
+
+
+void _PICellerator_CalculateParticleDisplacement_StoreOriginalPos( PICelleratorContext* context ) {
+	CalculateParticleDisplacementPlugin*  self;
+	MaterialPointsSwarm*                  materialPointsSwarm;
+	GlobalParticle*                       particle;
+	double*                               originalCoord;
+	ParticleDisplacementInfo*             particleDisplacementInfo; 
+	Particle_Index                        lParticle_I;
+
+	materialPointsSwarm = (MaterialPointsSwarm*) LiveComponentRegister_Get( context->CF->LCRegister, "materialSwarm" );
+	assert( materialPointsSwarm );
+	self = (CalculateParticleDisplacementPlugin*) LiveComponentRegister_Get( context->CF->LCRegister,
+		"PICellerator_CalculateParticleDisplacement" );
+	assert( self );
+
+	for ( lParticle_I = 0 ; lParticle_I < materialPointsSwarm->particleLocalCount ; lParticle_I++ ) {
+		particle = (GlobalParticle*)Swarm_ParticleAt( materialPointsSwarm, lParticle_I );
+		particleDisplacementInfo = ExtensionManager_Get( materialPointsSwarm->particleExtensionMgr,
+			particle, self->particleDisplacementInfo_Handle );
+		originalCoord = particleDisplacementInfo->originalCoord;
+
+		memcpy( originalCoord, particle->coord, sizeof(Coord) );
+		memset( particleDisplacementInfo->displacement, 0, sizeof(XYZ) );
+	}
+}
+
+
+void _PICellerator_CalculateParticleDisplacement_UpdateDisplacement( PICelleratorContext* context ) {
+	CalculateParticleDisplacementPlugin*  self;
+	MaterialPointsSwarm*                  materialPointsSwarm;
+	GlobalParticle*                       particle;
+	double*                               originalCoord;
+	double*                               coord;
+	Particle_Index                        lParticle_I;
+	ParticleDisplacementInfo*             particleDisplacementInfo = NULL;
+	Dimension_Index                       dim_I;
+
+	/* Add original pos to particle */
+	materialPointsSwarm = (MaterialPointsSwarm*) LiveComponentRegister_Get( context->CF->LCRegister, "materialSwarm" );
+	assert( materialPointsSwarm );
+	self = (CalculateParticleDisplacementPlugin*) LiveComponentRegister_Get( context->CF->LCRegister,
+		"PICellerator_CalculateParticleDisplacement" );
+	assert( self );
+
+	for ( lParticle_I = 0 ; lParticle_I < materialPointsSwarm->particleLocalCount ; lParticle_I++ ) {
+		particle      = (GlobalParticle*)Swarm_ParticleAt( materialPointsSwarm, lParticle_I );
+		coord         = particle->coord;
+		particleDisplacementInfo = ExtensionManager_Get( materialPointsSwarm->particleExtensionMgr, particle,
+			self->particleDisplacementInfo_Handle );
+		originalCoord = particleDisplacementInfo->originalCoord;	
+
+		for ( dim_I = 0; dim_I < materialPointsSwarm->dim; dim_I++ ) {
+			particleDisplacementInfo->displacement[dim_I] = coord[dim_I] - originalCoord[dim_I];
+		}
+	}
+}
+
+
+void* _PICellerator_CalculateParticleDisplacement_DefaultNew( Name name ) {
+	return _Codelet_New(
+			sizeof( CalculateParticleDisplacementPlugin ),
+			PICellerator_CalculateParticleDisplacement_Type,
+			_Codelet_Delete,
+			_Codelet_Print,
+			_Codelet_Copy,
+			_PICellerator_CalculateParticleDisplacement_DefaultNew,
+			_PICellerator_CalculateParticleDisplacement_Construct,
+			_Codelet_Build,
+			_Codelet_Initialise,
+			_Codelet_Execute,
+			_Codelet_Destroy,
+			name );
+}
+
+
+Index PICellerator_CalculateParticleDisplacement_Register( PluginsManager* pluginsManager ) {
+	Index result;
+
+	result = PluginsManager_Submit( pluginsManager, PICellerator_CalculateParticleDisplacement_Type, "0",
+		_PICellerator_CalculateParticleDisplacement_DefaultNew );
+
+	return result;
+}


Property changes on: long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.c
___________________________________________________________________
Name: svn:keywords
   + LastChangedDate Author Id
Name: svn:eol-style
   + native

Added: long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.h
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.h	2006-08-01 08:53:46 UTC (rev 4147)
+++ long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.h	2006-08-01 08:53:46 UTC (rev 4148)
@@ -0,0 +1,24 @@
+
+	typedef struct ParticleDisplacementInfo {
+		Coord     originalCoord;
+		XYZ       displacement;
+	} ParticleDisplacementInfo;
+
+	/** The CalculateParticleDisplacementPlugin extends upon the Codelet class */
+	#define __CalculateParticleDisplacementPlugin \
+		__Codelet \
+		\
+		ExtensionInfo_Index     particleDisplacementInfo_Handle; \
+		SwarmVariable*          particleOriginalCoordSwarmVariable; \
+		SwarmVariable*          particleDisplacementSwarmVariable;  \
+		OperatorSwarmVariable*  particleDisplacementMagSwarmVariable;
+
+	typedef struct CalculateParticleDisplacementPlugin 
+		{ __CalculateParticleDisplacementPlugin } CalculateParticleDisplacementPlugin;
+
+	extern const Type PICellerator_CalculateParticleDisplacement_Type;
+
+	void _PICellerator_CalculateParticleDisplacement_StoreOriginalPos( PICelleratorContext* context );
+	void _PICellerator_CalculateParticleDisplacement_UpdateDisplacement( PICelleratorContext* context );
+	
+	


Property changes on: long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/CalculateParticleDisplacement.h
___________________________________________________________________
Name: svn:keywords
   + LastChangedDate Author Id
Name: svn:eol-style
   + native

Added: long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/makefile
===================================================================
--- long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/makefile	2006-08-01 08:53:46 UTC (rev 4147)
+++ long/3D/Gale/trunk/src/PICellerator/plugins/CalculateParticleDisplacement/makefile	2006-08-01 08:53:46 UTC (rev 4148)
@@ -0,0 +1,78 @@
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+##
+## 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 277 2006-04-11 11:28:01Z PatrickSunter $
+##
+##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+#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
+
+# Subdirectories
+subdirs := $(shell find * -type d -prune ! -name .svn ) 
+
+# Source Code and Header files
+SRCS := $(wildcard *.c)
+HDRS := $(wildcard *.h)
+
+# What to call the plugin
+modName := $(shell basename `pwd`)
+mod = ${PROJECT}_${modName}
+
+# Where to put header files
+includes = ${PROJECT}/${modName}
+
+# External Libraries and Headers
+EXTERNAL_INCLUDES = ${STG_FEM_INCLUDES} ${STGERMAIN_INCLUDES} ${PETSC_INCLUDES} ${MPI_INCLUDES} ${XML_CFLAGS} 
+EXTERNAL_LIBS = \
+	${STG_FEM_RPATH} ${STG_FEM_LIBS} \
+	${STG_FEM_RPATH} ${STGERMAIN_LIBS} \
+	${PETSC_RPATH} ${PETSC_LIBS} \
+	${MPI_RPATH} ${MPI_LIBS} \
+	${XML_LIBS} 
+
+ifdef HAVE_PYTHON
+	packages += PYTHON
+endif
+
+
+include ${PROJ_ROOT}/Makefile.vmake



More information about the cig-commits mailing list