void _SnacPlastic_Construct( void* component, Stg_ComponentFactory* cf, void* data ) { Snac_Context* context; EntryPoint* interpolateElementEP; /* Retrieve context. */ context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); #ifdef DEBUG printf( "In: _SnacPlastic_Register( void*, void* )\n" ); #endif /* Add extensions to nodes, elements and the context */ SnacPlastic_ElementHandle = ExtensionManager_Add( context->mesh->elementExtensionMgr, SnacPlastic_Type, sizeof(SnacPlastic_Element) ); SnacPlastic_ContextHandle = ExtensionManager_Add( context->extensionMgr, SnacPlastic_Type, sizeof(SnacPlastic_Context) ); #ifdef DEBUG printf( "\tcontext extension handle: %u\n", SnacPlastic_ContextHandle ); printf( "\telement extension handle: %u\n", SnacPlastic_ElementHandle ); #endif /* Add extensions to the entry points */ EntryPoint_Append( Context_GetEntryPoint( context, Snac_EP_Constitutive ), SnacPlastic_Type, SnacPlastic_Constitutive, SnacPlastic_Type ); EntryPoint_InsertBefore( Context_GetEntryPoint( context, AbstractContext_EP_Initialise ), "SnacTimeStepZero", SnacPlastic_Type, SnacPlastic_InitialConditions, SnacPlastic_Type ); EntryPoint_Prepend( /* Dump the initial plastic strain */ Context_GetEntryPoint( context, AbstractContext_EP_Execute ), "SnacPlastic_Write", _SnacPlastic_WritePlasticStrain, SnacPlastic_Type ); EntryPoint_Append( /* and dump each loop */ Context_GetEntryPoint( context, Snac_EP_CalcStresses ), "SnacPlastic_Write", _SnacPlastic_WritePlasticStrain, SnacPlastic_Type ); /* Add extensions to the interpolate element entry point, but it will only exist if the remesher is loaded. */ interpolateElementEP = Context_GetEntryPoint( context, "SnacRemesher_EP_InterpolateElement" ); if( interpolateElementEP ) { EntryPoint_Append( interpolateElementEP, SnacPlastic_Type, _SnacPlastic_InterpolateElement, SnacPlastic_Type ); } /* Construct. */ _SnacPlastic_ConstructExtensions( context, data ); }
void TimeIntegrator_PrependFinishEP( void* timeIntegrator, Name name, Func_Ptr funcPtr, char* addedBy, void* data ) { TimeIntegrator* self = (TimeIntegrator*)timeIntegrator; EntryPoint_Prepend( self->finishEP, name, funcPtr, addedBy ); Stg_ObjectList_Prepend( self->finishData, data ); }
void _SnacTemperature_Construct( void* component, Stg_ComponentFactory* cf, void* data ) { Snac_Context* context; EntryPoint* interpolateNodeEP; /* Retrieve context. */ context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); #ifdef DEBUG printf( "In: _SnacTemperature_Register( void*, void* )\n" ); #endif /* Add extensions to nodes, elements and the context */ SnacTemperature_NodeHandle = ExtensionManager_Add( context->mesh->nodeExtensionMgr, SnacTemperature_Type, sizeof(SnacTemperature_Node) ); SnacTemperature_ElementHandle = ExtensionManager_Add( context->mesh->elementExtensionMgr, SnacTemperature_Type, sizeof(SnacTemperature_Element) ); SnacTemperature_ContextHandle = ExtensionManager_Add( context->extensionMgr, SnacTemperature_Type, sizeof(SnacTemperature_Context) ); #ifdef DEBUG printf( "\tcontext extension handle: %u\n", SnacTemperature_ContextHandle ); printf( "\telement extension handle: %u\n", SnacTemperature_ElementHandle ); printf( "\tnode extension handle: %u\n", SnacTemperature_NodeHandle ); #endif /* Add extensions to the entry points */ EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_Build ), SnacTemperature_Type, _SnacTemperature_Build, SnacTemperature_Type ); EntryPoint_InsertBefore( Context_GetEntryPoint( context, AbstractContext_EP_Initialise ), "SnacTimeStepZero", SnacTemperature_Type, _SnacTemperature_InitialConditions, SnacTemperature_Type ); EntryPoint_Append( Context_GetEntryPoint( context, Snac_EP_LoopNodesEnergy ), SnacTemperature_Type, SnacTemperature_LoopNodes, SnacTemperature_Type ); EntryPoint_Append( Context_GetEntryPoint( context, Snac_EP_LoopElementsEnergy ), SnacTemperature_Type, SnacTemperature_LoopElements, SnacTemperature_Type ); EntryPoint_Prepend( /* Dump the initial temperature */ Context_GetEntryPoint( context, AbstractContext_EP_Execute ), "SnacTemperature_Write", _SnacTemperature_WriteTemp, SnacTemperature_Type ); EntryPoint_Append( /* and dump each loop */ Context_GetEntryPoint( context, Snac_EP_LoopNodesEnergy ), "SnacTemperature_Write", _SnacTemperature_WriteTemp, SnacTemperature_Type ); EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_DestroyExtensions ), SnacTemperature_Type, _SnacTemperature_DeleteExtensions, SnacTemperature_Type ); /* Add extensions to the interpolate element entry point, but it will only exist if the remesher is loaded. */ interpolateNodeEP = Context_GetEntryPoint( context, "SnacRemesher_EP_InterpolateNode" ); if( interpolateNodeEP ) { EntryPoint_Append( interpolateNodeEP, SnacTemperature_Type, _SnacTemperature_InterpolateNode, SnacTemperature_Type ); } /* Construct. */ _SnacTemperature_ConstructExtensions( context, data ); }