[cig-commits] commit: Rejigged Material component.
Mercurial
hg at geodynamics.org
Mon Feb 1 15:30:38 PST 2010
changeset: 315:eae4870103df
branch: pcu_rejig
user: JericoRevote
date: Wed Nov 18 14:26:19 2009 +1100
files: MaterialPoints/src/Material.c MaterialPoints/src/Material.h MaterialPoints/src/PICelleratorContext.c MaterialPoints/tests/MaterialComponentsSuite.c
description:
Rejigged Material component.
diff -r 622153e57368 -r eae4870103df MaterialPoints/src/Material.c
--- a/MaterialPoints/src/Material.c Wed Nov 18 12:20:16 2009 +1100
+++ b/MaterialPoints/src/Material.c Wed Nov 18 14:26:19 2009 +1100
@@ -61,29 +61,16 @@ const Index UNDEFINED_MATERIAL = (unsign
/* Public Constructor */
Material* Material_New(
- Name name,
- Stg_Shape* shape,
- Dictionary* materialDictionary,
- Materials_Register* materialRegister )
+ Name name,
+ PICelleratorContext* context,
+ Stg_Shape* shape,
+ Dictionary* materialDictionary,
+ Materials_Register* materialRegister )
{
- Material* self;
+ Material* self = _Material_DefaultNew( name );
- self = (Material*) _Material_New(
- sizeof(Material),
- Material_Type,
- _Material_Delete,
- _Material_Print,
- _Material_Copy,
- _Material_DefaultNew,
- _Material_AssignFromXML,
- _Material_Build,
- _Material_Initialise,
- _Material_Execute,
- _Material_Destroy,
- name,
- shape,
- materialDictionary,
- materialRegister );
+ self->isConstructed = True;
+ _Material_Init( self, context, shape, materialDictionary, materialRegister );
return self;
}
@@ -111,21 +98,21 @@ void* _Material_DefaultNew( Name name )
/* Private Constructor */
Material* _Material_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,
- Name name,
- Stg_Shape* shape,
- Dictionary* materialDictionary,
- Materials_Register* materialRegister )
+ 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,
+ Name name,
+ Stg_Shape* shape,
+ Dictionary* materialDictionary,
+ Materials_Register* materialRegister )
{
Material* self;
@@ -145,23 +132,23 @@ Material* _Material_New(
name,
NON_GLOBAL );
- _Material_Init( self, shape, materialDictionary, materialRegister );
-
return self;
}
void _Material_Init(
- void* material,
- Stg_Shape* shape,
- Dictionary* materialDictionary,
- Materials_Register* materialRegister )
+ void* material,
+ PICelleratorContext* context,
+ Stg_Shape* shape,
+ Dictionary* materialDictionary,
+ Materials_Register* materialRegister )
{
Material* self = (Material*)material;
/* Set Values */
+ self->context = context;
self->dictionary = materialDictionary;
- self->shape = shape;
+ self->shape = shape;
/* Register material */
if (materialRegister != NULL)
@@ -204,20 +191,21 @@ void* _Material_Copy( void* material, vo
void _Material_AssignFromXML( void* material, Stg_ComponentFactory* cf, void* data ) {
- Material* self = (Material*) material;
- Dictionary* materialDictionary;
- Stg_Shape* shape;
- Materials_Register* materials_Register;
+ Material* self = (Material*) material;
+ Dictionary* materialDictionary;
+ Stg_Shape* shape;
+ Materials_Register* materials_Register;
+ PICelleratorContext* context;
- self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, "Context", PICelleratorContext, False, data );
- if( !self->context )
- self->context = Stg_ComponentFactory_ConstructByName( cf, "context", PICelleratorContext, True, data );
+ context = Stg_ComponentFactory_ConstructByKey( cf, self->name, "Context", PICelleratorContext, False, data );
+ if( !context )
+ context = Stg_ComponentFactory_ConstructByName( cf, "context", PICelleratorContext, True, data );
materialDictionary = Dictionary_GetDictionary( cf->componentDict, self->name );
shape = Stg_ComponentFactory_ConstructByKey( cf, self->name, "Shape", Stg_Shape, True, data ) ;
- materials_Register = self->context->materials_Register;
+ materials_Register = context->materials_Register;
- _Material_Init( self, shape, materialDictionary, materials_Register );
+ _Material_Init( self, context, shape, materialDictionary, materials_Register );
}
diff -r 622153e57368 -r eae4870103df MaterialPoints/src/Material.h
--- a/MaterialPoints/src/Material.h Wed Nov 18 12:20:16 2009 +1100
+++ b/MaterialPoints/src/Material.h Wed Nov 18 14:26:19 2009 +1100
@@ -52,20 +52,21 @@
#define __Material \
__Stg_Component \
\
- PICelleratorContext* context; \
- Dictionary* dictionary; \
- Stg_Shape* shape; \
- Material_Index index; /**< The index inside the Materials_Register */ \
- ExtensionManager* extensionMgr; \
+ PICelleratorContext* context; \
+ Dictionary* dictionary; \
+ Stg_Shape* shape; \
+ Material_Index index; /**< The index inside the Materials_Register */ \
+ ExtensionManager* extensionMgr;
struct Material { __Material };
/* Public Constructor */
Material* Material_New(
- Name name,
- Stg_Shape* shape,
- Dictionary* materialDictionary,
- Materials_Register* materialRegister );
+ Name name,
+ PICelleratorContext* context,
+ Stg_Shape* shape,
+ Dictionary* materialDictionary,
+ Materials_Register* materialRegister );
void* _Material_DefaultNew( Name name );
@@ -90,19 +91,25 @@
void _Material_AssignFromXML( void* material, Stg_ComponentFactory* cf, void* data );
void _Material_Init(
- void* material,
- Stg_Shape* shape,
- Dictionary* materialDictionary,
- Materials_Register* materialRegister ) ;
+ void* material,
+ PICelleratorContext* context,
+ Stg_Shape* shape,
+ Dictionary* materialDictionary,
+ Materials_Register* materialRegister );
/** Virtual Functions */
- void _Material_Delete( void* material ) ;
- void _Material_Print( void* material, Stream* stream ) ;
- void* _Material_Copy( void* material, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) ;
+ void _Material_Delete( void* material );
+
+ void _Material_Print( void* material, Stream* stream );
+
+ void* _Material_Copy( void* material, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
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 );
/** Performs a layout of this material onto the points of the swarm, assigning the material index if the global
@@ -121,10 +128,10 @@
* field and store it in result. result must be an array of as many doubles as there are components
* in the field. */
void Material_IntegrateField(
- void* material,
- IntegrationPointsSwarm* swarm,
- FeVariable* field,
- double* volumeGlobal,
- double* result );
+ void* material,
+ IntegrationPointsSwarm* swarm,
+ FeVariable* field,
+ double* volumeGlobal,
+ double* result );
#endif
diff -r 622153e57368 -r eae4870103df MaterialPoints/src/PICelleratorContext.c
--- a/MaterialPoints/src/PICelleratorContext.c Wed Nov 18 12:20:16 2009 +1100
+++ b/MaterialPoints/src/PICelleratorContext.c Wed Nov 18 14:26:19 2009 +1100
@@ -169,12 +169,12 @@ void _PICelleratorContext_SetDt( void* c
/* EntryPoint Hooks ----------------------------------------------------------------------------------------------------*/
void PICelleratorContext_CreateDefaultMaterial( void* context ) {
- PICelleratorContext* self = (PICelleratorContext*) context;
+ PICelleratorContext* self = (PICelleratorContext*) context;
if ( Materials_Register_GetCount( self->materials_Register ) == 0 ) {
Stg_Shape* everywhereShape = (Stg_Shape*) Everywhere_New( "defaultShape", self->dim );
- Material_New( "backgroundMaterial", everywhereShape, self->dictionary, self->materials_Register );
+ Material_New( "backgroundMaterial", self, everywhereShape, self->dictionary, self->materials_Register );
}
}
diff -r 622153e57368 -r eae4870103df MaterialPoints/tests/MaterialComponentsSuite.c
--- a/MaterialPoints/tests/MaterialComponentsSuite.c Wed Nov 18 12:20:16 2009 +1100
+++ b/MaterialPoints/tests/MaterialComponentsSuite.c Wed Nov 18 14:26:19 2009 +1100
@@ -213,8 +213,8 @@ void MaterialComponentsSuite_Setup( Mate
GetOffsetOfMember( particle , matProp4 ),
Variable_DataType_Int );
- data->mat1 = Material_New( "mat1", data->shape1, data->matDict1, data->mRegister );
- data->mat2 = Material_New( "mat2", data->shape2, data->matDict2, data->mRegister );
+ data->mat1 = Material_New( "mat1", NULL, data->shape1, data->matDict1, data->mRegister );
+ data->mat2 = Material_New( "mat2", NULL, data->shape2, data->matDict2, data->mRegister );
MaterialComponentsSuite_BuildInitSwarmBasics( data );
/* Now set them all the swarm var properties to 0 / False initially */
More information about the CIG-COMMITS
mailing list