[cig-commits] commit: Minor clean-up on these ForceTerm children.

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


changeset:   337:c30dec974d34
branch:      pcu_rejig
parent:      335:fed10f57c2d4
user:        JericoRevote
date:        Mon Nov 30 15:11:11 2009 +1100
files:       Utils/src/BuoyancyForceTerm.c Utils/src/BuoyancyForceTermThermoChem.c
description:
Minor clean-up on these ForceTerm children.


diff -r fed10f57c2d4 -r c30dec974d34 Utils/src/BuoyancyForceTerm.c
--- a/Utils/src/BuoyancyForceTerm.c	Fri Nov 27 16:20:09 2009 +1100
+++ b/Utils/src/BuoyancyForceTerm.c	Mon Nov 30 15:11:11 2009 +1100
@@ -193,16 +193,19 @@ void _BuoyancyForceTerm_AssignFromXML( v
 
 	dict = Dictionary_Entry_Value_AsDictionary( Dictionary_Get( cf->componentDict, self->name ) );
 	temperatureField = Stg_ComponentFactory_ConstructByKey( cf, self->name, "TemperatureField", FeVariable, False, data ) ;
-	gravity          = Stg_ComponentFactory_GetDouble( cf, self->name, "gravity", 0.0 );
-	adjust           = Stg_ComponentFactory_GetBool( cf, self->name, "adjust", False );
+	gravity = Stg_ComponentFactory_GetDouble( cf, self->name, "gravity", 0.0 );
+	adjust = Stg_ComponentFactory_GetBool( cf, self->name, "adjust", False );
 
 	direcList = Dictionary_Get( dict, "gravityDirection" );
+
 	if( direcList ) {
 		nDims = Dictionary_Entry_Value_GetCount( direcList );
 		direc = AllocArray( double, nDims );
+
 		for( d_i = 0; d_i < nDims; d_i++ ) {
 			tmp = Dictionary_Entry_Value_GetElement( direcList, d_i );
 			rootKey = Dictionary_Entry_Value_AsString( tmp );
+
 			if( !Stg_StringIsNumeric( rootKey ) )
 				tmp = Dictionary_Get( cf->rootDict, rootKey );
 			direc[d_i] = Dictionary_Entry_Value_AsDouble( tmp );
@@ -307,7 +310,9 @@ void _BuoyancyForceTerm_Initialise( void
 }
 
 void _BuoyancyForceTerm_Execute( void* forceTerm, void* data ) {
-	_ForceTerm_Execute( forceTerm, data );
+	BuoyancyForceTerm* self = (BuoyancyForceTerm*)forceTerm;
+
+	_ForceTerm_Execute( self, data );
 }
 
 void _BuoyancyForceTerm_Destroy( void* forceTerm, void* data ) {
@@ -315,18 +320,17 @@ void _BuoyancyForceTerm_Destroy( void* f
 	Index i;
 
 	for ( i = 0; i < self->materialSwarmCount; ++i ) {
-		Stg_Class_Delete( self->densitySwarmVariables[i] );
-		Stg_Class_Delete( self->alphaSwarmVariables[i] );
+		_Stg_Component_Delete( self->densitySwarmVariables[i] );
+		_Stg_Component_Delete( self->alphaSwarmVariables[i] );
 	}
 
 	FreeArray( self->gHat );
 
-	MemFree( self->densitySwarmVariables );
-	MemFree( self->alphaSwarmVariables );
+	Memory_Free( self->densitySwarmVariables );
+	Memory_Free( self->alphaSwarmVariables );
 
 	_ForceTerm_Destroy( forceTerm, data );
 }
-
 
 void _BuoyancyForceTerm_AssembleElement( void* forceTerm, ForceVector* forceVector, Element_LocalIndex lElement_I, double* elForceVec ) {
 	BuoyancyForceTerm*               self               = (BuoyancyForceTerm*) forceTerm;
diff -r fed10f57c2d4 -r c30dec974d34 Utils/src/BuoyancyForceTermThermoChem.c
--- a/Utils/src/BuoyancyForceTermThermoChem.c	Fri Nov 27 16:20:09 2009 +1100
+++ b/Utils/src/BuoyancyForceTermThermoChem.c	Mon Nov 30 15:11:11 2009 +1100
@@ -178,21 +178,21 @@ void _BuoyancyForceTermThermoChem_Print(
 }
 
 void _BuoyancyForceTermThermoChem_AssignFromXML( void* forceTerm, Stg_ComponentFactory* cf, void* data ) {
-	BuoyancyForceTermThermoChem*          self             = (BuoyancyForceTermThermoChem*)forceTerm;
-	FeVariable*                 temperatureField;
-	double                      RaT;
-	double                      RaC;
-	Bool                        adjust;
-	Materials_Register*         materials_Register;
-	PICelleratorContext*	    context;
+	BuoyancyForceTermThermoChem*	self = (BuoyancyForceTermThermoChem*)forceTerm;
+	FeVariable*							temperatureField;
+	double								RaT;
+	double								RaC;
+	Bool									adjust;
+	Materials_Register*				materials_Register;
+	PICelleratorContext*				context;
 
 	/* Construct Parent */
 	_ForceTerm_AssignFromXML( self, cf, data );
 
 	temperatureField = Stg_ComponentFactory_ConstructByKey( cf, self->name, "TemperatureField", FeVariable, False, data ) ;
-	RaT              = Stg_ComponentFactory_GetDouble( cf, self->name, "RaT", 0.0 );
-	RaC              = Stg_ComponentFactory_GetDouble( cf, self->name, "RaC", 0.0 );
-	adjust           = Stg_ComponentFactory_GetBool( cf, self->name, "adjust", False );
+	RaT = Stg_ComponentFactory_GetDouble( cf, self->name, "RaT", 0.0 );
+	RaC = Stg_ComponentFactory_GetDouble( cf, self->name, "RaC", 0.0 );
+	adjust = Stg_ComponentFactory_GetBool( cf, self->name, "adjust", False );
 
 	context = (PICelleratorContext*)self->context;
 	assert( Stg_CheckType( context, PICelleratorContext ) );
@@ -276,8 +276,9 @@ void _BuoyancyForceTermThermoChem_Destro
 	Index i;
 
 	for ( i = 0; i < self->materialSwarmCount; ++i ) {
-		Stg_Class_Delete( self->densitySwarmVariables[i] );
+		_Stg_Component_Delete( self->densitySwarmVariables[i] );
 	}
+	Memory_Free( self->densitySwarmVariables );
 
 	_ForceTerm_Destroy( self, data );
 }



More information about the CIG-COMMITS mailing list