MPC::MPC(ParticleSet& ptcl, double cutoff) : PtclRef(&ptcl), Ecut(cutoff), FirstTime(true), VlongSpline(0), DensitySpline(0) { int it=ptcl.addTable(ptcl); initBreakup(); }
MPC_CUDA::MPC_CUDA(ParticleSet& ptcl, double cutoff) : MPC(ptcl, cutoff), SumGPU("MPC::SumGPU"), L("MPC::L"), Linv("MPC::Linv") { initBreakup(); //create virtual particle myPtcl.resize(omp_get_max_threads()); app_log() << "MPC_CUDA::evalLR uses " << myPtcl.size() << " threads." << endl; for(int i=0; i<myPtcl.size(); ++i) myPtcl[i]=new ParticleSet(ptcl); }
StressPBCAA::StressPBCAA(ParticleSet& ref, bool active) : AA(0), myGrid(0), rVs(0), FirstTime(true), myConst(0.0), ForceBase(ref,ref), Ps(ref), is_active(active) { ReportEngine PRE("StressPBCAA","StressPBCAA"); //save source tag SourceID=ref.tag(); //create a distance table: just to get the table name DistanceTableData *d_aa = DistanceTable::add(ref); PtclRefName=d_aa->Name; initBreakup(ref); prefix="S_"+PtclRefName; app_log() << " Maximum K shell " << AA->MaxKshell << endl; app_log() << " Number of k vectors " << AA->Fk.size() << endl; if(!is_active) { d_aa->evaluate(ref); update_source(ref); app_log()<<"Evaluating Stress SymTensor::Long Range\n"; sLR=evalLR(ref); app_log()<<"Short Range...\n"; sSR=evalSR(ref); stress=sLR+sSR+myConst; //RealType eL(0.0), eS(0.0); //if (computeForces) //{ // forces = 0.0; // eS=evalSRwithForces(ref); // // 1.3978248322 // eL=evalLRwithForces(ref); // // 2.130267378 //} //else //{ // eL=evalLR(ref); // eS=evalSR(ref); //} //NewValue=Value = eL+eS+myConst; //app_log() << " Fixed Coulomb potential for " << ref.getName(); //app_log() << "\n e-e Madelung Const. =" << MC0 // << "\n Vtot =" << Value << endl; } app_log() << " Stress SymTensor components for " << ref.getName(); app_log() << "\n e-e Madelung Const. =\n" << MC0 << "\n Stot =\n" << stress << "\n S_SR =\n" << sSR << "\n S_LR =\n" << sLR << "\n S_Const =\n" << myConst<<endl; }
CoulombPBCAB::CoulombPBCAB(ParticleSet& ions, ParticleSet& elns, bool computeForces): PtclA(ions), myConst(0.0), myGrid(0),V0(0),ComputeForces(computeForces), ForceBase (ions, elns), MaxGridPoints(10000),Pion(ions),Peln(elns) { // if (ComputeForces) // InitVarReduction (0.5, 0, 3); ReportEngine PRE("CoulombPBCAB","CoulombPBCAB"); //Use singleton pattern //AB = new LRHandlerType(ions); myTableIndex=elns.addTable(ions); initBreakup(elns); prefix="Flocal"; app_log() << " Maximum K shell " << AB->MaxKshell << endl; app_log() << " Number of k vectors " << AB->Fk.size() << endl; }
bool ONScripter::setEffect( EffectLink *effect, bool generate_effect_dst, bool update_backup_surface ) { if ( effect->effect == 0 ) return true; if (update_backup_surface) refreshSurface(backup_surface, &dirty_rect.bounding_box, REFRESH_NORMAL_MODE); int effect_no = effect->effect; if (effect_cut_flag && (skip_mode & SKIP_NORMAL || ctrl_pressed_status)) effect_no = 1; SDL_BlitSurface( accumulation_surface, NULL, effect_src_surface, NULL ); if (generate_effect_dst){ int refresh_mode = refreshMode(); if (update_backup_surface && refresh_mode == REFRESH_NORMAL_MODE){ SDL_BlitSurface( backup_surface, &dirty_rect.bounding_box, effect_dst_surface, &dirty_rect.bounding_box ); } else{ if (effect_no == 1) refreshSurface( effect_dst_surface, &dirty_rect.bounding_box, refresh_mode ); else refreshSurface( effect_dst_surface, NULL, refresh_mode ); } } /* Load mask image */ if ( effect_no == 15 || effect_no == 18 ){ if ( !effect->anim.image_surface ){ parseTaggedString( &effect->anim ); setupAnimationInfo( &effect->anim ); } } if ( effect_no == 11 || effect_no == 12 || effect_no == 13 || effect_no == 14 || effect_no == 16 || effect_no == 17 ) dirty_rect.fill( screen_width, screen_height ); if (effect_no == 99){ // dll-based if (effect->anim.image_name != NULL){ printf("dll effect: Got dll '%s'\n", effect->anim.image_name); if (!strncmp(effect->anim.image_name, "breakup.dll", 11)) initBreakup(effect->anim.image_name); dirty_rect.fill( screen_width, screen_height ); } } effect_counter = 0; effect_duration = effect->duration; if (skip_mode & SKIP_NORMAL || ctrl_pressed_status){ // shorten the duration of effects while skipping if ( effect_cut_flag ) effect_duration = 0; else if (effect_duration > 100){ effect_duration = effect_duration / 10; } else if (effect_duration > 10){ effect_duration = 10; } else { effect_duration = 1; } } return false; }
bool ONScripterLabel::setEffect( EffectLink *effect, bool generate_effect_dst, bool update_backup_surface ) { if ( effect->effect == 0 ) return true; if (update_backup_surface) refreshSurface(backup_surface, &dirty_rect.bounding_box, REFRESH_NORMAL_MODE); int effect_no = effect->effect; SDL_BlitSurface( accumulation_surface, NULL, effect_src_surface, NULL ); if (generate_effect_dst){ int refresh_mode = refreshMode(); if (update_backup_surface && refresh_mode == REFRESH_NORMAL_MODE){ SDL_BlitSurface( backup_surface, &dirty_rect.bounding_box, effect_dst_surface, &dirty_rect.bounding_box ); } else{ if (effect_no == 1) refreshSurface( effect_dst_surface, &dirty_rect.bounding_box, refresh_mode ); else refreshSurface( effect_dst_surface, NULL, refresh_mode ); } } effect_counter = 0; effect_start_time_old = SDL_GetTicks(); effect_duration = effect->duration; if (ctrl_pressed_status || skip_mode & SKIP_NORMAL) { // shorten the duration of effects while skipping if ( effect_cut_flag ) { effect_duration = 0; return false; //don't parse effects if effectcut skip } else if (effect_duration > 100) { effect_duration = effect_duration / 10; } else if (effect_duration > 10) { effect_duration = 10; } else { effect_duration = 1; } } else if (effectspeed == EFFECTSPEED_INSTANT) { effect_duration = 0; return false; //don't parse effects if instant speed } else if (effectspeed == EFFECTSPEED_QUICKER) { effect_duration = effect_duration / 2; if (effect_duration <= 0) effect_duration = 1; } /* Load mask image */ if ( effect_no == 15 || effect_no == 18 ){ if ( !effect->anim.image_surface ){ parseTaggedString( &effect->anim, true ); #ifdef RCA_SCALE setupAnimationInfo( &effect->anim, NULL, scr_stretch_x, scr_stretch_y ); #else setupAnimationInfo( &effect->anim ); #endif } } if ( effect_no == 11 || effect_no == 12 || effect_no == 13 || effect_no == 14 || effect_no == 16 || effect_no == 17 ) dirty_rect.fill( screen_width, screen_height ); dll = params = NULL; if (effect_no == 99) { // dll-based dll = effect->anim.image_name; if (dll != NULL) { //just in case no dll is given if (debug_level > 0) printf("dll effect: Got dll/params '%s'\n", dll); params = dll; while (*params != 0 && *params != '/') params++; if (*params == '/') params++; if (!strncmp(dll, "whirl.dll", 9)) { buildSinTable(); buildCosTable(); buildWhirlTable(); dirty_rect.fill( screen_width, screen_height ); } else if (!strncmp(dll, "trvswave.dll", 12)) { buildSinTable(); dirty_rect.fill( screen_width, screen_height ); } else if (!strncmp(dll, "breakup.dll", 11)) { initBreakup(params); dirty_rect.fill( screen_width, screen_height ); } else { dirty_rect.fill( screen_width, screen_height ); } } } return false; }