void _OneToOneMapper_Init( void* mapper, MaterialPointsSwarm* materialSwarm ) { OneToOneMapper* self = (OneToOneMapper*)mapper; self->errorStream = Journal_MyStream( Error_Type, self ); self->materialSwarm = materialSwarm; ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, False ); self->materialRefHandle = ExtensionManager_Add( self->integrationSwarm->particleExtensionMgr, (Name)materialSwarm->name, sizeof(MaterialPointRef) ); ExtensionManager_SetLockDown( self->integrationSwarm->particleExtensionMgr, True ); }
void _IntegrationPointsSwarm_Init( void* swarm, FeMesh* mesh ) { IntegrationPointsSwarm* self = (IntegrationPointsSwarm*)swarm; LocalParticle localParticle; IntegrationPoint particle; self->mesh = mesh; self->weightVariable = Swarm_NewScalarVariable( self, (Name)"Weight", GetOffsetOfMember( particle , weight ), Variable_DataType_Double ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->weightVariable ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->weightVariable->variable ); self->localCoordVariable = Swarm_NewVectorVariable( self, (Name)"LocalElCoord", GetOffsetOfMember( localParticle , xi ), Variable_DataType_Double, self->dim, "Xi", "Eta", "Zeta" ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->localCoordVariable ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->localCoordVariable->variable ); /* _Construct calls _Swarm_Init */ /* Lock down the extension manager. * It doesn't make sense for the IntegrationPointsSwarm to allow IntegrationPoints to be extended * This means attempts to extend integration points are firewalled to pickup errors. * -- Alan 20060506 */ ExtensionManager_SetLockDown( self->particleExtensionMgr, True ); self->swarmsMappedTo = List_New("swarmsMappedTo"); List_SetItemSize(self->swarmsMappedTo, sizeof(SwarmMap*)); }
void _IntegrationPointsSwarm_Init( void* swarm, FeMesh* mesh, TimeIntegrator* timeIntegrator, WeightsCalculator* weights, IntegrationPointMapper* mapper, Materials_Register* materials_Register, Bool recalculateWeights ) { IntegrationPointsSwarm* self = (IntegrationPointsSwarm*)swarm; LocalParticle localParticle; IntegrationPoint particle; self->mesh = mesh; self->timeIntegrator = timeIntegrator; self->weights = weights; self->mapper = mapper; self->materials_Register = materials_Register; self->recalculateWeights = recalculateWeights; /* Disable checkpointing and reloading of IP swarms - currently they can't be reloaded if the particles don't have a global coord. We assume there is no history info on them which means we're happy to re-create them from scratch given the position the material points were in when the checkpoint was made as input -- PatrickSunter 12 June 2006 */ self->isSwarmTypeToCheckPointAndReload = False; self->weightVariable = Swarm_NewScalarVariable( self, (Name)"Weight", GetOffsetOfMember( particle , weight ), Variable_DataType_Double ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->weightVariable ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->weightVariable->variable ); self->localCoordVariable = Swarm_NewVectorVariable( self, (Name)"LocalElCoord", GetOffsetOfMember( localParticle , xi ), Variable_DataType_Double, self->dim, "Xi", "Eta", "Zeta" ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->localCoordVariable ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->localCoordVariable->variable ); if ( timeIntegrator ) { /* Assuming this is called from _IntegrationPointsSwarm_AssignFromXML, it would have always called construct * on the mapper which in turn would have constructed any MaterialPointsSwarms with it. * The MaterialPointsSwarms would have already appended their update routines to the EP, and hence this * ensures that the _IntegrationPointsSwarm_UpdateHook will always be called last */ TimeIntegrator_InsertAfterFinishEP( timeIntegrator, (Name) "MaterialPointsSwarm_Update", /* Needs to be after a the material update */ (Name) "IntegrationPointsSwarm_Update", _IntegrationPointsSwarm_UpdateHook, self->name, self ); } /* _Construct calls _Swarm_Init */ /* Lock down the extension manager. * It doesn't make sense for the IntegrationPointsSwarm to allow IntegrationPoints to be extended * This means attempts to extend integration points are firewalled to pickup errors. * -- Alan 20060506 */ ExtensionManager_SetLockDown( self->particleExtensionMgr, True ); }