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 _SnacHillSlope_Construct( void* component, Stg_ComponentFactory* cf, void* data ) { Snac_Context* context; #ifdef DEBUG fprintf(stderr, "Entering Register.c...\n"); #endif /* Retrieve context. */ context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); Journal_Printf( context->debug, "In: %s\n", __func__ ); /* Add extensions to nodes, elements and the context */ SnacHillSlope_ContextHandle = ExtensionManager_Add( context->extensionMgr, SnacHillSlope_Type, sizeof(SnacHillSlope_Context) ); /* Add extensions to the entry points */ EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_Build ), SnacHillSlope_Type, _SnacHillSlope_Build, SnacHillSlope_Type ); EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_Initialise ), SnacHillSlope_Type, _SnacHillSlope_InitialConditions, SnacHillSlope_Type ); /* EntryPoint_Append( */ /* Context_GetEntryPoint( context, Snac_EP_Constitutive ), */ /* SnacHillSlope_Type, */ /* _SnacHillSlope_Constitutive, */ /* SnacHillSlope_Type ); */ EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_DestroyExtensions ), SnacHillSlope_Type, _SnacHillSlope_DeleteExtensions, SnacHillSlope_Type ); /* Construct. */ _SnacHillSlope_ConstructExtensions( context, data ); #ifdef DEBUG fprintf(stderr, "In Register.c\n"); #endif #ifdef DEBUG fprintf(stderr, "...leaving Register.c\n"); #endif }
void TimeIntegrator_AppendFinishEP( void* timeIntegrator, Name name, Func_Ptr funcPtr, char* addedBy, void* data ) { TimeIntegrator* self = (TimeIntegrator*)timeIntegrator; EntryPoint_Append( self->finishEP, name, funcPtr, addedBy ); Stg_ObjectList_Append( 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 ); }
void _SnacRemesher_Construct( void* component, Stg_ComponentFactory* cf, void* data ) { Snac_Context* context; /* Retrieve context. */ context = (Snac_Context*)Stg_ComponentFactory_ConstructByName( cf, "context", Snac_Context, True, data ); Journal_Printf( context->debug, "In: %s\n", __func__ ); /* Add extensions to nodes, elements and the context */ SnacRemesher_ContextHandle = ExtensionManager_Add( context->extensionMgr, SnacRemesher_Type, sizeof(SnacRemesher_Context) ); SnacRemesher_MeshHandle = ExtensionManager_Add( context->meshExtensionMgr, SnacRemesher_Type, sizeof(SnacRemesher_Mesh) ); Journal_Printf( context->debug, "\tcontext extension handle: %u\n", SnacRemesher_ContextHandle ); Journal_Printf( context->debug, "\tmesh extension handle: %u\n", SnacRemesher_MeshHandle ); /* Register new entry points to the context (which manages them) */ Context_AddEntryPoint( context, SnacRemesher_EntryPoint_New( SnacRemesher_EP_InterpolateNode, SnacRemesher_InterpolateNode_CastType ) ); Context_AddEntryPoint( context, SnacRemesher_EntryPoint_New( SnacRemesher_EP_InterpolateElement, SnacRemesher_InterpolateElement_CastType ) ); Context_AddEntryPoint( context, SnacRemesher_EntryPoint_New( SnacRemesher_EP_CopyElement, SnacRemesher_CopyElement_CastType ) ); /* Add extensions to the entry points */ EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_Build ), SnacRemesher_Type, _SnacRemesher_Build, SnacRemesher_Type ); EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_Initialise ), SnacRemesher_Type, _SnacRemesher_InitialConditions, SnacRemesher_Type ); EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_Sync ), SnacRemesher_Type, _SnacRemesher_Remesh, SnacRemesher_Type ); EntryPoint_Append( Context_GetEntryPoint( context, SnacRemesher_EP_InterpolateNode ), SnacRemesher_Type, _SnacRemesher_InterpolateNode, SnacRemesher_Type ); EntryPoint_Append( Context_GetEntryPoint( context, SnacRemesher_EP_InterpolateElement ), SnacRemesher_Type, _SnacRemesher_InterpolateElement, SnacRemesher_Type ); EntryPoint_Append( Context_GetEntryPoint( context, SnacRemesher_EP_CopyElement ), SnacRemesher_Type, _SnacRemesher_CopyElement, SnacRemesher_Type ); EntryPoint_Append( Context_GetEntryPoint( context, AbstractContext_EP_DestroyExtensions ), SnacRemesher_Type, _SnacRemesher_DeleteExtensions, SnacRemesher_Type ); /* Construct. */ _SnacRemesher_ConstructExtensions( context, data ); }