[cig-commits] commit: Rejiged _Delete/_Destroy function.

Mercurial hg at geodynamics.org
Mon Feb 1 15:30:39 PST 2010


changeset:   316:22a9f568d844
branch:      pcu_rejig
user:        JericoRevote
date:        Wed Nov 18 16:00:48 2009 +1100
files:       MaterialPoints/src/Material.c MaterialPoints/tests/AdvectionSuite.c Weights/tests/ConstantWeightsSuite.c Weights/tests/IterativeWeightsSuite.c Weights/tests/MomentBalanceWeightsSuite.c libPICellerator/tests/LibPICelleratorSuite.c
description:
Rejiged _Delete/_Destroy function.
Also cleaned up some of the tests here.


diff -r eae4870103df -r 22a9f568d844 MaterialPoints/src/Material.c
--- a/MaterialPoints/src/Material.c	Wed Nov 18 14:26:19 2009 +1100
+++ b/MaterialPoints/src/Material.c	Wed Nov 18 16:00:48 2009 +1100
@@ -162,7 +162,6 @@ void _Material_Delete( void* material ) 
 void _Material_Delete( void* material ) {
 	Material* self = (Material*) material;
 
-	Stg_Class_Delete( self->extensionMgr );
 	_Stg_Component_Delete( material );
 }
 
@@ -212,7 +211,13 @@ void _Material_Build( void* material, vo
 void _Material_Build( void* material, void* data ) {}
 void _Material_Initialise( void* material, void* data ) {}
 void _Material_Execute( void* material, void* data ) {}
-void _Material_Destroy( void* material, void* data ) {}
+
+void _Material_Destroy( void* material, void* data ) {
+	Material* self = (Material*) material;
+
+	Stg_Class_Delete( self->extensionMgr );
+}
+
 
 void Material_Layout( void* material, MaterialPointsSwarm* swarm ) {	
 	Material*             self               = (Material*) material;
diff -r eae4870103df -r 22a9f568d844 MaterialPoints/tests/AdvectionSuite.c
--- a/MaterialPoints/tests/AdvectionSuite.c	Wed Nov 18 14:26:19 2009 +1100
+++ b/MaterialPoints/tests/AdvectionSuite.c	Wed Nov 18 16:00:48 2009 +1100
@@ -120,7 +120,7 @@ void check( PICelleratorContext* context
 	pcu_check_true( maxThetaErrorGlobal < thetaErrorTolerance );
 }
 
-void AdvectionSuite_Euler( AdvectionSuiteData* data ) {
+void AdvectionSuite_TestEuler( AdvectionSuiteData* data ) {
 	Stg_ComponentFactory* 	cf;
 	PICelleratorContext* 	context;
 	char			filename[PCU_PATH_MAX];
@@ -153,7 +153,7 @@ void AdvectionSuite_Euler( AdvectionSuit
 	Stg_ComponentFactory_DestroyComponents( cf, data );
 }
 
-void AdvectionSuite_RK2( AdvectionSuiteData* data ) {
+void AdvectionSuite_TestRK2( AdvectionSuiteData* data ) {
 	Stg_ComponentFactory* 	cf;
 	PICelleratorContext* 	context;
 	char			filename[PCU_PATH_MAX];
@@ -186,7 +186,7 @@ void AdvectionSuite_RK2( AdvectionSuiteD
 	Stg_ComponentFactory_DestroyComponents( cf, data );
 }
 
-void AdvectionSuite_RK4( AdvectionSuiteData* data ) {
+void AdvectionSuite_TestRK4( AdvectionSuiteData* data ) {
 	Stg_ComponentFactory* 	cf;
 	PICelleratorContext* 	context;
 	char			filename[PCU_PATH_MAX];
@@ -222,7 +222,7 @@ void AdvectionSuite( pcu_suite_t* suite 
 void AdvectionSuite( pcu_suite_t* suite ) {
    pcu_suite_setData( suite, AdvectionSuiteData );
    pcu_suite_setFixtures( suite, AdvectionSuite_Setup, AdvectionSuite_Teardown );
-   pcu_suite_addTest( suite, AdvectionSuite_Euler );
-   pcu_suite_addTest( suite, AdvectionSuite_RK2 );
-   pcu_suite_addTest( suite, AdvectionSuite_RK4 );
+   pcu_suite_addTest( suite, AdvectionSuite_TestEuler );
+   pcu_suite_addTest( suite, AdvectionSuite_TestRK2 );
+   pcu_suite_addTest( suite, AdvectionSuite_TestRK4 );
 }
diff -r eae4870103df -r 22a9f568d844 Weights/tests/ConstantWeightsSuite.c
--- a/Weights/tests/ConstantWeightsSuite.c	Wed Nov 18 14:26:19 2009 +1100
+++ b/Weights/tests/ConstantWeightsSuite.c	Wed Nov 18 16:00:48 2009 +1100
@@ -214,14 +214,14 @@ void ConstantWeightsSuite_Teardown( Cons
   stgMainDestroy( data->cf );
 }
 
-void ConstantWeightsSuite_TestElementIntegral_ConstantFunction( ConstantWeightsSuiteData* data ) {
+void ConstantWeightsSuite_TestConstantFunction( ConstantWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "ConstantFunction", 1000,
       1e-10, /* --mean-tolerance */
       1e-10, /* --standardDeviation-tolerance */
       2.96059e-16, /* --mean-expectedValue */
       4.98509e-23 /* --standardDeviation-expectedValue */ );
 }
-void ConstantWeightsSuite_TestElementIntegral_LinearFunction ( ConstantWeightsSuiteData* data ) {
+void ConstantWeightsSuite_TestLinearFunction ( ConstantWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "LinearFunction", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -229,7 +229,7 @@ void ConstantWeightsSuite_TestElementInt
       0.0921005 /* --standardDeviation-expectedValue */ );
 }
 
-void ConstantWeightsSuite_TestElementIntegral_QuadraticFunction ( ConstantWeightsSuiteData* data ) {
+void ConstantWeightsSuite_TestQuadraticFunction ( ConstantWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "QuadraticFunction", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -237,7 +237,7 @@ void ConstantWeightsSuite_TestElementInt
       0.0627759 /* --standardDeviation-expectedValue */ );
 }
 
-void ConstantWeightsSuite_TestElementIntegral_PolynomialFunction ( ConstantWeightsSuiteData* data ) {
+void ConstantWeightsSuite_TestPolynomialFunction ( ConstantWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "PolynomialFunction", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -245,7 +245,7 @@ void ConstantWeightsSuite_TestElementInt
       0.0137385 /* --standardDeviation-expectedValue */ );
 }
 
-void ConstantWeightsSuite_TestElementIntegral_CircleInterface( ConstantWeightsSuiteData* data ) {
+void ConstantWeightsSuite_TestCircleInterface( ConstantWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "CircleInterface", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -253,7 +253,7 @@ void ConstantWeightsSuite_TestElementInt
       0.066458 /* --standardDeviation-expectedValue */ );
 }
    
-void ConstantWeightsSuite_TestElementIntegral_ExponentialInterface( ConstantWeightsSuiteData* data ) {
+void ConstantWeightsSuite_TestExponentialInterface( ConstantWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "ExponentialInterface", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -264,10 +264,10 @@ void ConstantWeightsSuite( pcu_suite_t* 
 void ConstantWeightsSuite( pcu_suite_t* suite ) {
    pcu_suite_setData( suite, ConstantWeightsSuiteData );
    pcu_suite_setFixtures( suite, ConstantWeightsSuite_Setup, ConstantWeightsSuite_Teardown );
-   pcu_suite_addTest( suite, ConstantWeightsSuite_TestElementIntegral_ConstantFunction );
-   pcu_suite_addTest( suite, ConstantWeightsSuite_TestElementIntegral_LinearFunction );
-   pcu_suite_addTest( suite, ConstantWeightsSuite_TestElementIntegral_QuadraticFunction );
-   pcu_suite_addTest( suite, ConstantWeightsSuite_TestElementIntegral_PolynomialFunction );
-   pcu_suite_addTest( suite, ConstantWeightsSuite_TestElementIntegral_ExponentialInterface );
-   pcu_suite_addTest( suite, ConstantWeightsSuite_TestElementIntegral_CircleInterface );
+   pcu_suite_addTest( suite, ConstantWeightsSuite_TestConstantFunction );
+   pcu_suite_addTest( suite, ConstantWeightsSuite_TestLinearFunction );
+   pcu_suite_addTest( suite, ConstantWeightsSuite_TestQuadraticFunction );
+   pcu_suite_addTest( suite, ConstantWeightsSuite_TestPolynomialFunction );
+   pcu_suite_addTest( suite, ConstantWeightsSuite_TestExponentialInterface );
+   pcu_suite_addTest( suite, ConstantWeightsSuite_TestCircleInterface );
 }
diff -r eae4870103df -r 22a9f568d844 Weights/tests/IterativeWeightsSuite.c
--- a/Weights/tests/IterativeWeightsSuite.c	Wed Nov 18 14:26:19 2009 +1100
+++ b/Weights/tests/IterativeWeightsSuite.c	Wed Nov 18 16:00:48 2009 +1100
@@ -61,21 +61,21 @@ void IterativeWeightsSuite_Teardown( Ite
    stgMainDestroy( data->cf );
 }
 
-void IterativeWeightsSuite_TestElementIntegral_ConstantFunction( IterativeWeightsSuiteData* data ) {
+void IterativeWeightsSuite_TestConstantFunction( IterativeWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "ConstantFunction", 1000,
       1e-10, /* --mean-tolerance */
       1e-10, /* --standardDeviation-tolerance */
       0.0, /* --mean-expectedValue */
       0.0 /* --standardDeviation-expectedValue */ );
 }
-void IterativeWeightsSuite_TestElementIntegral_LinearFunction ( IterativeWeightsSuiteData* data ) {
+void IterativeWeightsSuite_TestLinearFunction ( IterativeWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "LinearFunction", 1000,
       1e-4, /* --mean-tolerance */
       1e-4, /* --standardDeviation-tolerance */
       0.0, /* --mean-expectedValue */
       0.0 /* --standardDeviation-expectedValue */ );
 }
-void IterativeWeightsSuite_TestElementIntegral_QuadraticFunction ( IterativeWeightsSuiteData* data ) {
+void IterativeWeightsSuite_TestQuadraticFunction ( IterativeWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "QuadraticFunction", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -83,7 +83,7 @@ void IterativeWeightsSuite_TestElementIn
       0.0326016 /* --standardDeviation-expectedValue */ );
 }
 
-void IterativeWeightsSuite_TestElementIntegral_PolynomialFunction( IterativeWeightsSuiteData* data ) {
+void IterativeWeightsSuite_TestPolynomialFunction( IterativeWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "PolynomialFunction", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -91,7 +91,7 @@ void IterativeWeightsSuite_TestElementIn
       0.013522 /* --standardDeviation-expectedValue */ );
 }
 
-void IterativeWeightsSuite_TestElementIntegral_CircleInterface( IterativeWeightsSuiteData* data ) {
+void IterativeWeightsSuite_TestCircleInterface( IterativeWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "CircleInterface", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -99,8 +99,7 @@ void IterativeWeightsSuite_TestElementIn
       0.070065 /* --standardDeviation-expectedValue */ );
 }
 
-
-void IterativeWeightsSuite_TestElementIntegral_ExponentialInterface( IterativeWeightsSuiteData* data ) {
+void IterativeWeightsSuite_TestExponentialInterface( IterativeWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "ExponentialInterface", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -108,16 +107,13 @@ void IterativeWeightsSuite_TestElementIn
       0.06681 /* --standardDeviation-expectedValue */ );
 }
 
-
-
-
 void IterativeWeightsSuite( pcu_suite_t* suite ) {
    pcu_suite_setData( suite, IterativeWeightsSuiteData );
    pcu_suite_setFixtures( suite, IterativeWeightsSuite_Setup, IterativeWeightsSuite_Teardown );
-   pcu_suite_addTest( suite, IterativeWeightsSuite_TestElementIntegral_ConstantFunction );
-   pcu_suite_addTest( suite, IterativeWeightsSuite_TestElementIntegral_LinearFunction );
-   pcu_suite_addTest( suite, IterativeWeightsSuite_TestElementIntegral_QuadraticFunction );
-   pcu_suite_addTest( suite, IterativeWeightsSuite_TestElementIntegral_PolynomialFunction );
-   pcu_suite_addTest( suite, IterativeWeightsSuite_TestElementIntegral_CircleInterface );
-   pcu_suite_addTest( suite, IterativeWeightsSuite_TestElementIntegral_ExponentialInterface );
+   pcu_suite_addTest( suite, IterativeWeightsSuite_TestConstantFunction );
+   pcu_suite_addTest( suite, IterativeWeightsSuite_TestLinearFunction );
+   pcu_suite_addTest( suite, IterativeWeightsSuite_TestQuadraticFunction );
+   pcu_suite_addTest( suite, IterativeWeightsSuite_TestPolynomialFunction );
+   pcu_suite_addTest( suite, IterativeWeightsSuite_TestCircleInterface );
+   pcu_suite_addTest( suite, IterativeWeightsSuite_TestExponentialInterface );
 }
diff -r eae4870103df -r 22a9f568d844 Weights/tests/MomentBalanceWeightsSuite.c
--- a/Weights/tests/MomentBalanceWeightsSuite.c	Wed Nov 18 14:26:19 2009 +1100
+++ b/Weights/tests/MomentBalanceWeightsSuite.c	Wed Nov 18 16:00:48 2009 +1100
@@ -42,43 +42,38 @@
 #include "MomentBalanceWeightsSuite.h"
 
 typedef struct {
-   PICelleratorContext*       context;
-   Stg_ComponentFactory* cf;
+   PICelleratorContext*		context;
+   Stg_ComponentFactory*	cf;
 } MomentBalanceWeightsSuiteData;
 
-
 void MomentBalanceWeightsSuite_Setup( MomentBalanceWeightsSuiteData* data ) {
-   char              xmlInputFilename[PCU_PATH_MAX];
+   char xmlInputFilename[PCU_PATH_MAX];
 
    pcu_filename_input( "testMomentBalanceWeights.xml", xmlInputFilename );
    data->cf = stgMainInitFromXML( xmlInputFilename, MPI_COMM_WORLD, NULL );
-   data->context = LiveComponentRegister_Get( data->cf->LCRegister, "context" );
+   data->context = (PICelleratorContext*) LiveComponentRegister_Get( data->cf->LCRegister, "context" );
    stgMainBuildAndInitialise( data->cf );
 } 
-
 
 void MomentBalanceWeightsSuite_Teardown( MomentBalanceWeightsSuiteData* data ) {
    stgMainDestroy( data->cf );
 }
 
-
-
-
-void MomentBalanceWeightsSuite_TestElementIntegral_ConstantFunction( MomentBalanceWeightsSuiteData* data ) {
+void MomentBalanceWeightsSuite_TestConstantFunction( MomentBalanceWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "ConstantFunction", 1000,
       1e-10, /* --mean-tolerance */
       1e-10, /* --standardDeviation-tolerance */
       0.0, /* --mean-expectedValue */
       0.0 /* --standardDeviation-expectedValue */ );
 }
-void MomentBalanceWeightsSuite_TestElementIntegral_LinearFunction ( MomentBalanceWeightsSuiteData* data ) {
+void MomentBalanceWeightsSuite_TestLinearFunction ( MomentBalanceWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "LinearFunction", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
       0.00363688, /* --mean-expectedValue */
       0.029866 /* --standardDeviation-expectedValue */ );
 }
-void MomentBalanceWeightsSuite_TestElementIntegral_QuadraticFunction ( MomentBalanceWeightsSuiteData* data ) {
+void MomentBalanceWeightsSuite_TestQuadraticFunction ( MomentBalanceWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "QuadraticFunction", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -86,7 +81,7 @@ void MomentBalanceWeightsSuite_TestEleme
       0.0351938 /* --standardDeviation-expectedValue */ );
 }
 
-void MomentBalanceWeightsSuite_TestElementIntegral_PolynomialFunction( MomentBalanceWeightsSuiteData* data ) {
+void MomentBalanceWeightsSuite_TestPolynomialFunction( MomentBalanceWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "PolynomialFunction", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -94,7 +89,7 @@ void MomentBalanceWeightsSuite_TestEleme
       0.0130415 /* --standardDeviation-expectedValue */ );
 }
 
-void MomentBalanceWeightsSuite_TestElementIntegral_CircleInterface( MomentBalanceWeightsSuiteData* data ) {
+void MomentBalanceWeightsSuite_TestCircleInterface( MomentBalanceWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "CircleInterface", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -102,7 +97,7 @@ void MomentBalanceWeightsSuite_TestEleme
       0.0686067 /* --standardDeviation-expectedValue */ );
 }
 
-void MomentBalanceWeightsSuite_TestElementIntegral_ExponentialInterface( MomentBalanceWeightsSuiteData* data ) {
+void MomentBalanceWeightsSuite_TestExponentialInterface( MomentBalanceWeightsSuiteData* data ) {
    WeightsSuite_TestElementIntegral( data->context, "ExponentialInterface", 1000,
       0.000001, /* --mean-tolerance */
       0.000001, /* --standardDeviation-tolerance */
@@ -113,11 +108,11 @@ void MomentBalanceWeightsSuite( pcu_suit
 void MomentBalanceWeightsSuite( pcu_suite_t* suite ) {
    pcu_suite_setData( suite, MomentBalanceWeightsSuiteData );
    pcu_suite_setFixtures( suite, MomentBalanceWeightsSuite_Setup, MomentBalanceWeightsSuite_Teardown );
-   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestElementIntegral_ConstantFunction );
-   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestElementIntegral_LinearFunction );
-   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestElementIntegral_QuadraticFunction );
-   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestElementIntegral_PolynomialFunction );
-   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestElementIntegral_CircleInterface );
-   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestElementIntegral_ExponentialInterface );
+   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestConstantFunction );
+   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestLinearFunction );
+   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestQuadraticFunction );
+   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestPolynomialFunction );
+   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestCircleInterface );
+   pcu_suite_addTest( suite, MomentBalanceWeightsSuite_TestExponentialInterface );
 }
 
diff -r eae4870103df -r 22a9f568d844 libPICellerator/tests/LibPICelleratorSuite.c
--- a/libPICellerator/tests/LibPICelleratorSuite.c	Wed Nov 18 14:26:19 2009 +1100
+++ b/libPICellerator/tests/LibPICelleratorSuite.c	Wed Nov 18 16:00:48 2009 +1100
@@ -24,13 +24,13 @@ void LibPICelleratorSuite_Teardown( LibP
 void LibPICelleratorSuite_Teardown( LibPICelleratorSuiteData* data ) {
 }
 
-void LibPICelleratorSuite_DirectoryStGermain( LibPICelleratorSuiteData* data ) {
+void LibPICelleratorSuite_TestDirectoryStGermain( LibPICelleratorSuiteData* data ) {
     Stg_Object* testDirectoryStGermain;
     testDirectoryStGermain = Stg_ObjectList_Get( Project_XMLSearchPaths, "StGermain" );
     pcu_check_true( testDirectoryStGermain != NULL );
 }
 
-void LibPICelleratorSuite_DirectoryStgFEM( LibPICelleratorSuiteData * data ) {
+void LibPICelleratorSuite_TestDirectoryStgFEM( LibPICelleratorSuiteData * data ) {
     Stg_Object* testDirectoryStGermain;
     Stg_Object* testDirectoryStgFEM;
 
@@ -40,8 +40,7 @@ void LibPICelleratorSuite_DirectoryStgFE
     pcu_check_true( ( strcmp((char*)LIB_DIR, (char*)testDirectoryStGermain) ) || ( testDirectoryStgFEM != NULL ) );
 }
 
-
-void LibPICelleratorSuite_DirectoryPICellerator( LibPICelleratorSuiteData * data ) {
+void LibPICelleratorSuite_TestDirectoryPICellerator( LibPICelleratorSuiteData * data ) {
     Stg_Object* testDirectoryStGermain;
     Stg_Object* testDirectoryPICellerator;
 
@@ -56,7 +55,7 @@ void LibPICelleratorSuite( pcu_suite_t* 
     pcu_suite_setData( suite, LibPICelleratorSuiteData );
     pcu_suite_setFixtures( suite, LibPICelleratorSuite_Setup, LibPICelleratorSuite_Teardown);
 
-    pcu_suite_addTest( suite, LibPICelleratorSuite_DirectoryStGermain );
-    pcu_suite_addTest( suite, LibPICelleratorSuite_DirectoryStgFEM);
-    pcu_suite_addTest( suite, LibPICelleratorSuite_DirectoryPICellerator);
+    pcu_suite_addTest( suite, LibPICelleratorSuite_TestDirectoryStGermain );
+    pcu_suite_addTest( suite, LibPICelleratorSuite_TestDirectoryStgFEM);
+    pcu_suite_addTest( suite, LibPICelleratorSuite_TestDirectoryPICellerator);
 }



More information about the CIG-COMMITS mailing list