void UpdateRadius(CellPtr pCell){ double MaxRad = GetMaxRadius(pCell); double Rad = pCell->GetCellData()->GetItem("Radius"); if(Rad<MaxRad-0.1){ SetRadius(pCell,Rad+=GetTimestep()); } };
JunctionQueue *DestroyTimeSystem::Process(Entity *entity) { DestroyTimeComponent *destroy = (DestroyTimeComponent*)(entity->GetComponent(Component::ComponentType::DestroyTime)); JunctionQueue *msgs = new JunctionQueue(); if (destroy->UpdateTime(GetTimestep())) { Message *msg = new Message(Message::MessageType::DestroyEntity, entity->GetId()); msgs->Push(msg); } return msgs; }
sc::result CellStateChart_CellCycle_Mitosis_S::react( const EvCellStateChart_CellCycleUpdate & ){ CellPtr myCell=context<CellStatechart>().pCell; double dist=GetDistanceFromDTC(myCell); double TotalDuration; if(dist>=0 && dist<7){ TotalDuration = 32-24*dist/7.0; }else if(dist>7 ){ TotalDuration = 8+24*(dist-7.0)/93.0; } double Duration=TotalDuration*0.4165; context<CellStatechart>().TimeInPhase+=GetTimestep(); if(context<CellStatechart>().TimeInPhase>=Duration){ return transit<CellStateChart_CellCycle_Mitosis_G2>(); } return forward_event(); };
int main(void){ //allocate varuables particle_t* SPH = new particle_t[N_SPHP]; node_t* node = new node_t[3*N_SPHP]; system_t system; //display Information DisplayInfo(); printf("\n[Push enter key to start calculation...]\n"); getchar(); //make history dir if not exist. if(isExist("history") == false) MakeDir("history"); //set upt initial condition SetUpInitial<double>(SPH); InitializeProperty(SPH); OutputFile(SPH, system); printf("STEP %d (%16.16lf percent)\n", system.step, system.time / TIME * 100.0); /////////// TreeConstruction(SPH, node); TreeTraverse(SPH, node); //GetNeighbour(SPH); /////////// CalcHydroForce(SPH); GetTimestep(SPH, &system); //time integration while(system.time < TIME){ ++ system.step; //Compute v and u at half step. InitialKick(SPH, system.dt); //Advance x (, rho and h) by a full step. FullDrift(SPH, system.dt); //Predict v and u at full step. Predict(SPH, system.dt); //Time becomes t + dt. system.time += system.dt; //Construct Tree. TreeConstruction(SPH, node); for(int l = 0 ; l < 2 ; ++ l){ //Sweep0: Adjust smoothing length. CalcSmoothing(SPH); TreeTraverse(SPH, node); //GetNeighbour(SPH); //Sweep1: Compute density, div_v and rot_v. // Between this sweep, obtain p and c from rho and u. CalcDensity(SPH); } //Sweep2: Compute v_dot and u_dot. CalcHydroForce(SPH); //Set v and u at full step. FinalKick(SPH, system.dt); //Output result. if(system.step % OUTPUT_INTERVAL == 0) OutputFile(SPH, system); //Search dt. GetTimestep(SPH, &system); // CalcConservativeVaruables(SPH, &system); //Print message printf("STEP %d (%16.16lf percent)\n", system.step, system.time / TIME * 100.0); } //free memory. delete []SPH; delete []node; //Return success code. return SUCCESS; }