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 _GeneralSwarm_Init( void* swarm, EscapedRoutine* escapedRoutine ) { GeneralSwarm* self = (GeneralSwarm*)swarm; GlobalParticle globalParticle; self->swarmAdvector = NULL; /* If we're using a SwarmAdvector, it will 'attach' itself later on. */ self->escapedRoutine = escapedRoutine; self->particleCoordVariable = Swarm_NewVectorVariable( self, (Name)"Position", GetOffsetOfMember( globalParticle, coord ), Variable_DataType_Double, self->dim, "PositionX", "PositionY", "PositionZ" ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->particleCoordVariable->variable ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->particleCoordVariable ); /* init members */ self->previousIntSwarmMap = NULL; /* lets init this guy with one spot for convenience */ self->intSwarmMapList = List_New("intSwarmMapList"); List_SetItemSize(self->intSwarmMapList, sizeof(SwarmMap*)); }
void _MaterialPointsSwarm_Init( void* swarm, Material* material, Materials_Register* materials_Register ) { MaterialPointsSwarm* self = (MaterialPointsSwarm*)swarm; MaterialPoint particle; GlobalParticle globalParticle; self->material = material; self->materials_Register = materials_Register; self->materialIndexVariable = Swarm_NewScalarVariable( self, (Name)"MaterialIndex", GetOffsetOfMember( particle , materialIndex ), Variable_DataType_Int ); /* Should be unsigned int */ LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->materialIndexVariable->variable ); LiveComponentRegister_Add( LiveComponentRegister_GetLiveComponentRegister(), (Stg_Component*)self->materialIndexVariable ); }
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 ); }