[cig-commits] commit: Add ability to switch between regular and harmonic average in OneToManyMapper

Mercurial hg at geodynamics.org
Wed Nov 2 15:53:54 PDT 2011


changeset:   440:b31e0806821e
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Wed Nov 02 15:53:43 2011 -0700
files:       MaterialPoints/src/OneToManyMapper.cxx MaterialPoints/src/OneToManyMapper.h
description:
Add ability to switch between regular and harmonic average in OneToManyMapper


diff -r 314f260ea5b8 -r b31e0806821e MaterialPoints/src/OneToManyMapper.cxx
--- a/MaterialPoints/src/OneToManyMapper.cxx	Wed Nov 02 15:11:59 2011 -0700
+++ b/MaterialPoints/src/OneToManyMapper.cxx	Wed Nov 02 15:53:43 2011 -0700
@@ -62,6 +62,7 @@ OneToManyMapper* _OneToManyMapper_New( O
 
 	result = (OneToManyMapper*)_IntegrationPointMapper_New( INTEGRATIONPOINTMAPPER_PASSARGS );
         result->swarm=_swarm;
+        result->harmonic_average=_harmonic_average;
 		
 	return result;
 }
@@ -98,15 +99,19 @@ void* _OneToManyMapper_DefaultNew( Name 
   IntegrationPointMapper_GetDoubleFromExtension*
     _getDoubleFromMaterial = _OneToManyMapper_GetDoubleFromMaterial;
   IntegrationPointsSwarm *_swarm=NULL;
+  Bool _harmonic_average=True;
 
   return _OneToManyMapper_New( ONETOMANYMAPPER_PASSARGS );
 }
 
-void _OneToManyMapper_Init( void* mapper, IntegrationPointsSwarm* swarm ) {
+void _OneToManyMapper_Init( void* mapper,
+                            IntegrationPointsSwarm* swarm,
+                            Bool harmonic_average ) {
 	OneToManyMapper* self = (OneToManyMapper*)mapper;
 
 	self->errorStream = Journal_MyStream( Error_Type, self );
 	self->swarm = swarm;
+	self->harmonic_average = harmonic_average;
 }
 
 void _OneToManyMapper_Delete( void* mapper ) {
@@ -135,14 +140,15 @@ void _OneToManyMapper_AssignFromXML( voi
 void _OneToManyMapper_AssignFromXML( void* mapper, Stg_ComponentFactory* cf, void* data ) {
 	OneToManyMapper* self = (OneToManyMapper*)mapper;
 	IntegrationPointsSwarm* swarm;
+        Bool harmonic_average;
 	
 	_IntegrationPointMapper_AssignFromXML( self, cf, data );
 
 	swarm =
           Stg_ComponentFactory_ConstructByKey(cf,self->name,"MappedSwarm",
                                               IntegrationPointsSwarm,True,data);
-
-	_OneToManyMapper_Init( self, swarm );
+        harmonic_average=Stg_ComponentFactory_GetBool(cf,self->name,"HarmonicAverage",True);
+	_OneToManyMapper_Init( self, swarm, harmonic_average );
 
 }
 
diff -r 314f260ea5b8 -r b31e0806821e MaterialPoints/src/OneToManyMapper.h
--- a/MaterialPoints/src/OneToManyMapper.h	Wed Nov 02 15:11:59 2011 -0700
+++ b/MaterialPoints/src/OneToManyMapper.h	Wed Nov 02 15:53:43 2011 -0700
@@ -61,19 +61,13 @@
 
 	extern const Type OneToManyMapper_Type;
 
-        // struct OneToManyRef {
-	//     int numParticles;
-	//     int *particleInds;
-	//     float *weights;
-        // };
-
 	/* OneToManyMapper information */
 	#define __OneToManyMapper \
 		__IntegrationPointMapper \
 		\
 		Stream*				errorStream; \
 		IntegrationPointsSwarm*		swarm; \
-		Index                           refHandle; /**< Extension handle to reference struct of material points */
+                Bool                            harmonic_average;
 
 	struct OneToManyMapper { __OneToManyMapper };
 
@@ -83,15 +77,16 @@
 
 	#define ONETOMANYMAPPER_DEFARGS \
                 INTEGRATIONPOINTMAPPER_DEFARGS, \
-                IntegrationPointsSwarm *_swarm
+                IntegrationPointsSwarm *_swarm, \
+                Bool _harmonic_average
 
 	#define ONETOMANYMAPPER_PASSARGS \
                 INTEGRATIONPOINTMAPPER_PASSARGS, \
-                _swarm
+                _swarm, _harmonic_average
 	
 OneToManyMapper* _OneToManyMapper_New( ONETOMANYMAPPER_DEFARGS );
 
-void _OneToManyMapper_Init( void* mapper, IntegrationPointsSwarm* swarm );
+void _OneToManyMapper_Init( void* mapper, IntegrationPointsSwarm* swarm, Bool harmonic_average );
 
 	void _OneToManyMapper_Delete( void* mapper );
 	void _OneToManyMapper_Print( void* mapper, Stream* stream );



More information about the CIG-COMMITS mailing list