//{ Panel int panel_hitscan(panel_t *panel,int hx,int hy) { int idofs=PAN_ENT*panel->index+PAN_ENT; int wy=D(PANEL_WY+idofs); if(kbpanel&&panel->items[0].str_id==kbpanel) { if(kbpanel==KB_INSTALL) { if(kbitem[kbpanel]>2)kbitem[kbpanel]=2; return panel->index-8==kbitem[kbpanel]; } if(kbitem[kbpanel]>panel->items[0].action_id)kbitem[kbpanel]=panel->items[0].action_id; while(panel->items[kbitem[kbpanel]].type!=TYPE_CHECKBOX&& panel->items[kbitem[kbpanel]].type!=TYPE_BUTTON)kbitem[kbpanel]++; return kbitem[kbpanel]; } if(!wy)return -1; hx-=Xp(panel)+D(PNLITEM_OFSX); hy-=Yp(panel)+D(PNLITEM_OFSY); if(!expertmode&&panel->items[0].type==TYPE_GROUP_BREAK)return -2; if(hx<0||hy<0||hx>XP(panel)-D(PNLITEM_OFSX)*2)return -3; if(hy/wy>=panel->items[0].action_id)return -4; return hy/wy+1; }
VectorXd predict_feature(VectorXd X, float p, float q, float alpha){ VectorXd X_prime(3),Xp(3); X_prime(0)=(X(0)-p)*cos(alpha)-(X(2)-q)*sin(alpha); X_prime(1)=X(1); X_prime(2)=(X(0)-p)*sin(alpha)+(X(2)-q)*cos(alpha); Xp=X_prime; return Xp; }
GEODE_COLD static void assert_delaunay(const char* prefix, const TriangleTopology& mesh, RawField<const EV,VertexId> X, const Hashtable<Vector<VertexId,2>>& constrained=Tuple<>(), const bool oriented_only=false, const bool check_boundary=true) { Field<Perturbed2,VertexId> Xp(X.size(),uninit); for (const int i : range(X.size())) Xp.flat[i] = Perturbed2(i,X.flat[i]); assert_delaunay(prefix,mesh,Xp,constrained,oriented_only,check_boundary); }
triple Force::planet(int IDP, double mu) { triple Xa = X; double poss[3]; double lt1; triple rp, Delta; spkgps_c(IDP, time, "J2000", Global::IDC, poss, <1); triple Xp(poss); Delta = Xp - Xa; double d = Delta.getAbs(); double r = Xp.getAbs(); triple accp = Delta*mu / pow(d, 3) - Xp*mu / pow(r, 3); return accp; }
void panel_draw_inv(panel_t *panel) { int x=Xp(panel),y=Yp(panel); int idofs=PAN_ENT*panel->index+PAN_ENT; int wy=D(PANEL_WY+idofs); int ofsy=D(PNLITEM_OFSY); RECT rect; if(!panel)return; rect.left=x; rect.top=y; rect.right=x+XP(panel); rect.bottom=y+(wy+1)*panel->items[0].action_id+ofsy*2; InvalidateRect(hMain,&rect,0); }
Ref<TriangleTopology> exact_delaunay_points(RawArray<const EV> X, RawArray<const Vector<int,2>> edges, const bool validate) { const int n = X.size(); GEODE_ASSERT(n>=3); // Quantize all input points, reorder, and add sentinels Field<const Perturbed2,VertexId> Xp(partially_sorted_shuffle(X)); // Compute Delaunay triangulation const auto mesh = deterministic_exact_delaunay(Xp,validate); // Undo the vertex permutation mesh->permute_vertices(Xp.flat.slice(0,n).project<int,&Perturbed2::seed_>().copy()); // Insert constraint edges in random order add_constraint_edges(mesh,RawField<const EV,VertexId>(X),edges,validate); // All done! return mesh; }
void Foam::SprayCloud<CloudType>::motion(TrackData& td) { const scalar dt = this->solution().trackTime(); td.part() = TrackData::tpLinearTrack; CloudType::move(td, dt); this->updateCellOccupancy(); if (stochasticCollision().active()) { const liquidMixtureProperties& liqMix = this->composition().liquids(); label i = 0; forAllIter(typename SprayCloud<CloudType>, *this, iter) { label j = 0; forAllIter(typename SprayCloud<CloudType>, *this, jter) { if (j > i) { parcelType& p = iter(); scalar Vi = this->mesh().V()[p.cell()]; scalarField X1(liqMix.X(p.Y())); scalar sigma1 = liqMix.sigma(p.pc(), p.T(), X1); scalar mp = p.mass()*p.nParticle(); parcelType& q = jter(); scalar Vj = this->mesh().V()[q.cell()]; scalarField X2(liqMix.X(q.Y())); scalar sigma2 = liqMix.sigma(q.pc(), q.T(), X2); scalar mq = q.mass()*q.nParticle(); bool updateProperties = stochasticCollision().update ( dt, this->rndGen(), p.position(), mp, p.d(), p.nParticle(), p.U(), p.rho(), p.T(), p.Y(), sigma1, p.cell(), Vi, q.position(), mq, q.d(), q.nParticle(), q.U(), q.rho(), q.T(), q.Y(), sigma2, q.cell(), Vj ); // for coalescence we need to update the density and // the diameter cause of the temp/conc/mass-change if (updateProperties) { if (mp > VSMALL) { scalarField Xp(liqMix.X(p.Y())); p.rho() = liqMix.rho(p.pc(), p.T(), Xp); p.Cp() = liqMix.Cp(p.pc(), p.T(), Xp); p.d() = cbrt ( 6.0*mp /( p.nParticle() *p.rho() *constant::mathematical::pi ) ); } if (mq > VSMALL) { scalarField Xq(liqMix.X(q.Y())); q.rho() = liqMix.rho(q.pc(), q.T(), Xq); q.Cp() = liqMix.Cp(q.pc(), q.T(), Xq); q.d() = cbrt ( 6.0*mq /( q.nParticle() *q.rho() *constant::mathematical::pi ) ); } } } j++; } i++; } // remove coalesced particles (diameter set to 0) forAllIter(typename SprayCloud<CloudType>, *this, iter) { parcelType& p = iter(); if (p.mass() < VSMALL) { this->deleteParticle(p); } } } }
/** \brief The executable compute the SNR curve and by product the GW and noise response * \author A. Petiteau * \version 2.0 * \date 25/02/2011 * * * */ int main (int argc, char * const argv[]) { try { LCTools MT; int nOptions(0); char cmd[16384]; long SeedRand((long)time(NULL)); int Nsrc(1); int iNStart(0); int iRealiStudy(-1); int NRand(1); LCModSig X(&MT), Xp(&MT); X.Detector = LISA; X.GalacticNoise = false; X.sSrcType(SPINBBHHHARM); double SNRth(6.); char CharIndPar[1064]; strcpy(CharIndPar, "None"); int MCMCNStepMax(100000); double MCMCscale(1.); double MCMCheat(2.); int MCMCFIMRecomp(-1); //! *** Name of TDI observables char TDINameAll[16384]; strcpy(TDINameAll, "X"); //strcpy(TDINameAll, "Am,Em"); // *********** Help ************* if(((argc>1)&&(strcmp(argv[1],"--help")==0))||((argc>1)&&(strcmp(argv[1],"-h")==0))){ Coutm << " ----- HELP -----" << Endl; Coutm << Endl << "\tExecution :" << Endl; Coutm << "\t\t(./)LC2 MCMC [Options] ConfigFile1.xml ConfigFile2.xml ..." << Endl; Coutm << Endl << "\tArguments :" << Endl; Coutm << Endl << "\t\t * ConfigFileI.xml (required) : Configuration fileX. " << Endl; Coutm << Endl << "\tOptions :" << Endl; Coutm << "\t\t * -o %sOutFile : Output file containing results [default: SNRResultX.txt]" << Endl ; Coutm << "\t\t * -G key : Type of GW source. [default : MBHBInsPrecHH ] " << Endl ; Coutm << "\t\t\t GB or GalBin : galactic binary," << Endl ; Coutm << "\t\t\t SH or MBHBInsPrecHH : Massive black hole binary inspiral phase with spin precession and higher harmonicX." << Endl ; Coutm << "\t\t * -C %sCatalog : Catalogue containing the list of parameters : if not random source. [default : None] " << Endl ; Coutm << "\t\t * -N %dNSrc : Number of sources to study (-1 : number of source in catalogue). [default : " << Nsrc << " ]" << Endl ; Coutm << "\t\t * -f %diFSrc : Fisrt source to study is iFSrc*NSrc. [default : " << iNStart << "]" << Endl ; Coutm << "\t\t * -R %diReali : Study only the source from the realization %diReali (-1:not used). [default : "<< iRealiStudy << "]" << Endl ; //Coutm << "\t\t * -r %dNrand : Make Nrand randomization of free paramters for each source. [default : "<< NRand << "]" << Endl ; Coutm << "\t\t * -dt %step : Minimal time step. [default : " << X.dtMesMin << "]" << Endl ; Coutm << "\t\t * -D %dConfig : For computing analytic noise : LISA,C1,C2,C3,C4,C5 [default : LISA]" << Endl ; Coutm << "\t\t * -cn : Include analytic confusion noise [default : None]" << Endl ; Coutm << "\t\t * -tdi %sObsName : Names of TDI generators [default : " << TDINameAll << " ]" << Endl ; //Coutm << "\t\t * -S %fSNRth : SNR threshold for selected for FIM compute [default : " << SNRth << "]" << Endl ; Coutm << "\t\t * -P %diP1,%diP2 : Index of parameters to study ('L' before the index mean that we have to use the log). [default : 0,1,14,13,12,4,L5,L15,17,6,7,8,9,10,11 if src MBHBInsPrecHH , 0,1,2,3,L4,6,7 if src GalBin ]" << Endl ; //Coutm << "\t\t * -cv %diP %fDeltaMin %fDeltaMax %fDeltaLogStep : Test convergence for parameter iP with value of Delta between DeltaMin and DeltaMax with step log step of DeltaLogStep [default : None]" << Endl ; Coutm << "\t\t * -M %fMax %sDir : Maximum memory in RAM and directory for swaping [default : Max = " << X.gMaxMemRAM() << ", Dir = " << X.gDirSwapMem() << " ]" << Endl ; Coutm << "\t\t * -n %dN : Maximal number of MCMC steps [default : " << MCMCNStepMax << "]" << Endl ; Coutm << "\t\t * -E %fscale : Scale used for MCMC steps [default : " << MCMCscale << "]" << Endl ; Coutm << "\t\t * -F %dFreqFIM : Frequency of FIM recomputation : recompute each %dFreqFIM MCMC accepted steps [default : " << MCMCFIMRecomp << "]" << Endl ; Coutm << "\t\t * -co : Write the check output fileX. [default : false]" << Endl ; Coutm << "\t\t * -s %dseed : Seed for random gennerator. [default : current time]" << Endl ; Coutm << "\t\t\t NB: If not specified the random seed is the time machine." << Endl; Coutm << "\t\t * -dn \t\t: No screen display. [default: false]" << Endl ; Coutm << "\t\t * -dl %sfile \t: Write standard output in a file. [default: no file]" << Endl ; Coutm << "\t\t * -v \t\t: Verbose mode : display full details. [default: false]" << Endl ; Coutm << "\t\t * -h \t\t: This help." << Endl ; Coutm << "\t\t * -V \t\t: Version." << Endl ; Coutm << Endl << " ----------------" << Endl; return 0; } // *********** Version ************* if(((argc>1)&&(strcmp(argv[1],"--version")==0))||((argc>1)&&(strcmp(argv[1],"-V")==0))){ Coutm << " ----- VERSION -----" << Endl; Coutm << " LC2MCMC : Compute the signal to noise ratio (SNR) and Fisher Matrix (FIM) - LISACode package - version " << LC::LCVersion << " at " << LC::DateOfLastUpdate << Endl; Coutm << " ----------------" << Endl; return 0; } // ***** Main declaration ***** //! *** Output (results) file char bNOut[16384]; strcpy(bNOut, "ResMCMC"); //! *** Catalogue and parameters of sources char fNInCatalogue[16384]; int NRecCat(-1); int NRowsCat(-1); std::ifstream fInCatalogue; int TypeCat(0); // 0->standard, 1->result file bool StopEndFile(true); std::string junk; bool CheckOutput(false); std::vector<char*> Words(0); //! **** Selection parameters //! ** Threshold in mass ratio double qth(1./20.); qth = 1./50.; strcpy(fNInCatalogue, "None"); //! *** For SNR, FIM, errors LCMatrix FIM; LCMatrix CovM; double SNR; double * Err(NULL); double * ptry(NULL); //! *** Data dcomplex ** fDat(NULL); int NfDat, NTDI, iFmin; double df; //! ********** Read options ********** for(int iarg=1; iarg<argc; iarg++){ if((argc>1)&&(strcmp(argv[iarg],"-o")==0)){ // *** Read base name of output file in option strcpy(bNOut, argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-G")==0)){ bool NotFound(true); if( (MT.wcmp(argv[iarg+1],"GB")) || (MT.wcmp(argv[iarg+1],"GalBin")) ){ X.sSrcType(GALBIN); NotFound = false; } if( (MT.wcmp(argv[iarg+1],"SH")) || (MT.wcmp(argv[iarg+1],"MBHBInsPrecHH")) ){ X.sSrcType(SPINBBHHHARM); NotFound = false; } if( (MT.wcmp(argv[iarg+1],"NR")) || (MT.wcmp(argv[iarg+1],"NRwave")) ){ X.sSrcType(NRWAVE); NotFound = false; } if(NotFound){ Coutm << "ERROR : The source type " << argv[iarg+1] << " is unknown !" << Endl; throw std::invalid_argument("ERROR : The source type is unknown !"); } nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-C")==0)){ strcpy(fNInCatalogue, argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-N")==0)){ Nsrc = atoi(argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-f")==0)){ iNStart = atoi(argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-R")==0)){ iRealiStudy = atoi(argv[iarg+1]); nOptions +=2; } /*if((argc>1)&&(strcmp(argv[iarg],"-r")==0)){ NRand = atoi(argv[iarg+1]); nOptions +=2; }*/ if((argc>1)&&(strcmp(argv[iarg],"-dt")==0)){ X.dtMesMin = atof(argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-D")==0)){ X.Detector = UNKNOWNDC; if(MT.wcmp(argv[iarg+1], "LISA")){ X.Detector = LISA; } if(MT.wcmp(argv[iarg+1], "ELISA")){ X.Detector = ELISA; } if(MT.wcmp(argv[iarg+1], "C1")){ X.Detector = C1; } if(MT.wcmp(argv[iarg+1], "C2")){ X.Detector = C2; } if(MT.wcmp(argv[iarg+1], "C3")){ X.Detector = C3; } if(MT.wcmp(argv[iarg+1], "C4")){ X.Detector = C4; } if(MT.wcmp(argv[iarg+1], "C5")){ X.Detector = C5; } if(X.Detector == UNKNOWNDC) throw std::invalid_argument("Unknow type of detector."); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-cn")==0)){ X.GalacticNoise = true; nOptions ++; } if((argc>1)&&(strcmp(argv[iarg],"-tdi")==0)){ strcpy(TDINameAll, argv[iarg+1]); nOptions +=2; } /*if((argc>1)&&(strcmp(argv[iarg],"-S")==0)){ SNRth = atof(argv[iarg+1]); nOptions +=2; }*/ if((argc>1)&&(strcmp(argv[iarg],"-P")==0)){ //! **** Read list of parameters to study strcpy(CharIndPar, argv[iarg+1]); nOptions +=2; } /*if((argc>1)&&(strcmp(argv[iarg],"-cv")==0)){ if(argc-iarg<4) throw std::invalid_argument("ERROR : Need 4 parameters for testing the convergence !"); ConviP = atoi(argv[iarg+1]); ConvDMin = atof(argv[iarg+2]); ConvDMax = atof(argv[iarg+3]); ConvDLogStep = atof(argv[iarg+4]); NConvStep = MT.ifloor((log10(ConvDMax)-log10(ConvDMin))/ConvDLogStep); nOptions += 5; }*/ if((argc>1)&&(strcmp(argv[iarg],"-M")==0)){ if(argc-iarg<4) throw std::invalid_argument("ERROR : Need 2 parameters (path of directory and max RAM size) for configuring swap !"); X.sSwap(argv[iarg+2], atof(argv[iarg+1])); nOptions +=3; } if((argc>1)&&(strcmp(argv[iarg],"-n")==0)){ MCMCNStepMax = atoi(argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-E")==0)){ MCMCscale = atof(argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-F")==0)){ MCMCFIMRecomp = atoi(argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-co")==0)){ CheckOutput = true; nOptions++; } if((argc>1)&&(strcmp(argv[iarg],"-s")==0)){ SeedRand = atoi(argv[iarg+1]); nOptions +=2; } if((argc>1)&&(strcmp(argv[iarg],"-dn")==0)){ MT.unsetDisp(); nOptions++; } if((argc>1)&&(strcmp(argv[iarg],"-dl")==0)){ MT.setDispInFile(argv[iarg+1],true); nOptions+=2; } if((argc>1)&&(strcmp(argv[iarg],"-v")==0)){ MT.setDispDetails(); nOptions++; } } MT.setRandSeed(SeedRand); //! ********** Configuration ********** //! ***** Decode a char string to obtain the list of parameters to study if(MT.wcmp(CharIndPar, "None")){ if(X.gSrcType()==SPINBBHHHARM) strcpy(CharIndPar, "0,1,14,13,12,4,L5,L15,17,6,7,8,9,10,11"); if(X.gSrcType()==GALBIN) strcpy(CharIndPar, "0,1,2,3,L4,6,7"); } X.sParStudy(CharIndPar); //! ***** Read configuration files in arguments for(int ia=1+nOptions; ia<argc; ia++){ X.addfCfg(argv[ia]); } // ***** Display for checking which files we are using Coutm << "Configuration files : " << Endl; for(int i=0; i<X.NfNCfg; i++){ Coutm << "\t + " << X.fNCfg[i] ; MT.CheckFile("", X.fNCfg[i]); } //! *** Read the bloc name of TDI generators and obtain the individual names and the number of generators X.sTDI(TDINameAll); Coutm << "TDI generators : "; for(int i=0; i<X.gNTDI(); i++) Coutm << " " << X.gTDIName(i); Coutm << Endl; //! ********** Initialization ********** X.AllocBaseMem(); Xp.CopyBase(X); FIM.init(&MT, X.gNParStudy(), X.gNParStudy()); CovM.init(&MT, X.gNParStudy(), X.gNParStudy()); Err = (double*) MT.AllocMemory(X.gNParStudy()*sizeof(double)); for(int i=0; i<X.gNParStudy(); i++) Err[i] = 0.; //! **** Open and analyse the catalogue if(!MT.wcmp(fNInCatalogue,"None")){ Coutm << "Open the catalogue file " << fNInCatalogue << " ... " << Endl; fInCatalogue.open(fNInCatalogue); if(!fInCatalogue) throw std::invalid_argument("Problem in openning parameters file."); //! ** Count number of record while(fInCatalogue.peek() == '#') fInCatalogue.ignore(16384,'\n'); NRecCat = 0; while((fInCatalogue.peek() != '\n')&&(!fInCatalogue.eof())){ fInCatalogue >> junk; if(fInCatalogue.peek() == ' '){ int ipos(fInCatalogue.tellg()); ipos++; fInCatalogue.seekg(ipos); } NRecCat++; } fInCatalogue.close(); fInCatalogue.clear(); //! ** Count the number of rows fInCatalogue.open(fNInCatalogue); char fCatHead[16384]; while(fInCatalogue.peek() == '#') fInCatalogue.getline(fCatHead, 16384,'\n'); MT.wextract(fCatHead, Words); if(Words[4][0]=='z') TypeCat = 1; NRowsCat = 0; while(!fInCatalogue.eof()){ fInCatalogue.ignore(16384,'\n'); if(!fInCatalogue.eof()){ NRowsCat++; } } fInCatalogue.close(); fInCatalogue.clear(); if(Nsrc == -1) Nsrc = NRowsCat; } if(NRecCat!=-1){ fInCatalogue.open(fNInCatalogue); while(fInCatalogue.peek() == '#') fInCatalogue.ignore(16384,'\n'); if(iNStart*Nsrc<NRowsCat){ int iS(0); while((!fInCatalogue.eof())&&(iS < iNStart*Nsrc)){ fInCatalogue.ignore(16384,'\n'); iS++; } } } //! ***** Prepare the result output file //! ** Common part int iTitCol(0); int iTitColBase(0); char TitColBase[10000]; if(X.gSrcType()==SPINBBHHHARM){ strcpy(TitColBase,"#realID[1] srcID[2] Name[3] iStep[4] z[5] M1[6] q[7] lamS[8] betS[9] phL[10] thL[11] phi0[12] tc[13] a1[14] a2[15] thS1[16] thS2[17] phS1[18] phS2[19] per[20] e[21] DL0[22] Mcz[23] eta[24] thBS1[25] thBS2[26] phBS1[27] phBS2[28]"); iTitColBase = 29; } if(X.gSrcType()==GALBIN){ strcpy(TitColBase,"#realID[1] srcID[2] Name[3] iStep[4] M1[5] M2[6] P[7] Pdot[8] e[9] i[10] lam[11] bet[12] d[13] psi[14] Amp[15] f[16] fdot[17] phi0[18]"); iTitColBase = 19; } if(X.gSrcType()==NRWAVE){ strcpy(TitColBase,"#realID[1] srcID[2] Name[3] RandID[4] z[5] M1[6] q[7] lamS[8] betS[9] phL[10] thL[11] phi0[12] tc[13] a1[14] a2[15] thS1[16] thS2[17] phS1[18] phS2[19] per[20] e[21] DL0[22] Mcz[23] eta[24] thBS1[25] thBS2[26] phBS1[27] phBS2[28]"); iTitColBase = 29; } //! *** Open file containing error FIM results and write header char fNOutErr[10000]; sprintf(fNOutErr,"%s-Err.txt",bNOut); std::ofstream fOutErr(fNOutErr); iTitCol = iTitColBase; fOutErr << TitColBase; for(int i=0; i<X.gNTDI(); i++) for(int iP=0; iP<X.gNParStudy(); iP++){ fOutErr << " Par" << X.giParStudy(iP) << "[" << iTitCol++ << "]"; fOutErr << " Err" << X.giParStudy(iP) << "[" << iTitCol++ << "]"; } fOutErr << " Likelihood[" << iTitCol++ << "]" << Endl; fOutErr.precision(12); //! *** Open FIM output file and write header char fNOutFIM[10000]; sprintf(fNOutFIM, "%s-FIM.txt", bNOut); std::ofstream fOutFIM(fNOutFIM); iTitCol = iTitColBase; fOutFIM << TitColBase; for(int iP1=0; iP1<X.gNParStudy(); iP1++) for(int iP2=0; iP2<X.gNParStudy(); iP2++) fOutFIM << " FIM" << X.giParStudy(iP1) << X.giParStudy(iP2) << "[" << iTitCol++ << "]"; for(int iP1=0; iP1<X.gNParStudy(); iP1++) for(int iP2=0; iP2<X.gNParStudy(); iP2++) fOutFIM << " CovM" << X.giParStudy(iP1) << X.giParStudy(iP2) << "[" << iTitCol++ << "]"; fOutFIM << Endl; fOutFIM.precision(12); //! *** Open MCMC output file and write header char fNOutMCMC[10000]; sprintf(fNOutMCMC, "%s-MCMC.txt", bNOut); std::ofstream fOutMCMC(fNOutMCMC); iTitCol = iTitColBase; fOutMCMC << TitColBase << " LogL[" << iTitCol << "] MCMCratio[" << iTitCol+1 << "] MCMCRand[" << iTitCol+2 << "] Accepted[" << iTitCol+3 << "]"; iTitCol += 4; for(int iP=0; iP<X.gNParStudy(); iP++) fOutMCMC << " pTry" << X.giParStudy(iP) << "[" << iTitCol++ << "]"; fOutMCMC << Endl; fOutMCMC.precision(12); //! ********** Main part : loop on sources ********** int iSrc(0); bool CContinue(true); while(CContinue){ int realID(-1), srcID(iSrc); double z(0.), M1(0.), q(0.), betS(0.), lamS(0.), phL(0.), thL(0.), phi0(0.), tc(0.), a1(0.), a2(0.), thS1(0.), thS2(0.), phS1(0.), phS2(0.), per(0.), ecc(0.), DL0(0.), DL0d(0.), Mcz(0.), eta(0.), thBS1(0.), thBS2(0.), phBS1(0.), phBS2(0.); char srcName[100]; double lamSd(0.), betSd(0.), M2(0.), Period(0.), Pdot(0.), inc(0.), incd(0.), psi(0.), Amp(0.), freq(0.), fdot(0.); char StrParam[10000]; time_t tstart, tendSNR, tend; //! **** Read source in catalogue if((NRecCat!=-1)&&(!fInCatalogue.eof())){ if(X.gSrcType()==SPINBBHHHARM){ if(NRecCat>15){ int iRStart(26); //! ** All parameters are in the catalogue fInCatalogue >> realID >> srcID; if(TypeCat==1){ fInCatalogue >> junk >> junk; iRStart += 2; } fInCatalogue >> z >> M1 >> q >> lamS >> betS >> phL >> thL >> phi0 >> tc >> a1 >> a2 >> thS1 >> thS2 >> phS1 >> phS2 >> per >> ecc >> DL0d >> Mcz >> eta >> thBS1 >> thBS2 >> phBS1 >> phBS2; Coutm << phBS2 << Endl; for(int iR=iRStart; iR<NRecCat; iR++){ fInCatalogue >> junk; //Coutm << iR << " --> " << junk << Endl; } if(TypeCat==1) DL0d *= 1.e-3; //! Converion from kpc to Mpc because we use Mpc as input and we write kpc so when we use output of previous run as catalogue, we have to convert }else{ //! ** Some parameters are in the catalogue but not the fInCatalogue >> realID >> srcID >> z >> M1 >> q >> lamSd >> betSd >> phL >> thL >> phi0 >> tc >> DL0d >> Mcz >> eta; } sprintf(srcName,"Real%d-%d", realID, srcID); }
void panel_draw(HDC hdc,panel_t *panel) { WCHAR buf[BUFLEN]; POINT p; HRGN rgn=0; int cur_i; int i; int idofs=PAN_ENT*panel->index+PAN_ENT; int x=Xp(panel),y=Yp(panel); int ofsx=D(PNLITEM_OFSX),ofsy=D(PNLITEM_OFSY); int wy=D(PANEL_WY+idofs); if(XP(panel)<0)return; //if(panel_lasti/256!=panel->index)return; GetCursorPos(&p); ScreenToClient(hMain,&p); cur_i=panel_hitscan(panel,p.x,p.y); if(!D(PANEL_WY+idofs))return; for(i=0;i<panel->items[0].action_id+1;i++) { if(i==1&&panel->index==0) { wsprintf(buf,L"%s",STR(STR_SYSINF_MOTHERBOARD)); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+SYSINFO_COL1,y+ofsy,buf,wcslen(buf)); wsprintf(buf,L"%s",STR(STR_SYSINF_ENVIRONMENT)); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+SYSINFO_COL2,y+ofsy,buf,wcslen(buf)); } if(i==2&&panel->index==0) { wsprintf(buf,L"%s (%d-bit)",get_winverstr(manager_g),manager_g->matcher->state->architecture?64:32); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+10+SYSINFO_COL0,y+ofsy,buf,wcslen(buf)); wsprintf(buf,L"%s",state_getproduct(manager_g->matcher->state)); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+10+SYSINFO_COL1,y+ofsy,buf,wcslen(buf)); wsprintf(buf,L"%s",STR(STR_SYSINF_WINDIR)); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+10+SYSINFO_COL2,y+ofsy,buf,wcslen(buf)); wsprintf(buf,L"%s",manager_g->matcher->state->text+manager_g->matcher->state->windir); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+10+SYSINFO_COL3,y+ofsy,buf,wcslen(buf)); } if(i==3&&panel->index==0) { if(XP(panel)<10+SYSINFO_COL1) wsprintf(buf,L"%s",state_getproduct(manager_g->matcher->state)); else wsprintf(buf,L"%s",manager_g->matcher->state->platform.szCSDVersion); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+10+SYSINFO_COL0,y+ofsy,buf,wcslen(buf)); wsprintf(buf,L"%s: %s",STR(STR_SYSINF_TYPE),STR(isLaptop?STR_SYSINF_LAPTOP:STR_SYSINF_DESKTOP)); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+10+SYSINFO_COL1,y+ofsy,buf,wcslen(buf)); wsprintf(buf,L"%s",STR(STR_SYSINF_TEMP)); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+10+SYSINFO_COL2,y+ofsy,buf,wcslen(buf)); wsprintf(buf,L"%s",manager_g->matcher->state->text+manager_g->matcher->state->temp); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx+10+SYSINFO_COL3,y+ofsy,buf,wcslen(buf)); } if(panel->items[i].type==TYPE_GROUP_BREAK&&!expertmode)break; switch(panel->items[i].type) { case TYPE_CHECKBOX: drawcheckbox(hdc,x+ofsx,y+ofsy,D(CHKBOX_SIZE)-2,D(CHKBOX_SIZE)-2,panel->items[i].checked,i==cur_i); SetTextColor(hdc,D(i==cur_i?CHKBOX_TEXT_COLOR_H:CHKBOX_TEXT_COLOR)); TextOut(hdc,x+D(CHKBOX_TEXT_OFSX)+ofsx,y+ofsy,STR(panel->items[i].str_id),wcslen(STR(panel->items[i].str_id))); if(i==cur_i&&kbpanel)drawrectsel(hdc,x+ofsx,y+ofsy,x+XP(panel)-ofsx,y+ofsy+wy,0xff00,1); y+=D(PNLITEM_WY); break; case TYPE_BUTTON: if(panel->index>=8&&panel->index<=10&&D(PANEL_OUTLINE_WIDTH+idofs)<0) box_draw(hdc,x+ofsx,y+ofsy,x+XP(panel)-ofsx,y+ofsy+wy,i==cur_i?BOX_PANEL_H+panel->index*2+2:BOX_PANEL+panel->index*2+2); else box_draw(hdc,x+ofsx,y+ofsy,x+XP(panel)-ofsx,y+ofsy+wy-1,i==cur_i?BOX_BUTTON_H:BOX_BUTTON); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); if(i==1&&panel->index==8) { int j,cnt=0; itembar_t *itembar; itembar=&manager_g->items_list[RES_SLOTS]; for(j=RES_SLOTS;j<manager_g->items_handle.items;j++,itembar++) if(itembar->checked)cnt++; wsprintf(buf,L"%s (%d)",STR(panel->items[i].str_id),cnt); TextOut(hdc,x+ofsx+wy/2,y+ofsy+(wy-D(FONT_SIZE)-2)/2,buf,wcslen(buf)); } else TextOut(hdc,x+ofsx+wy/2,y+ofsy+(wy-D(FONT_SIZE)-2)/2,STR(panel->items[i].str_id),wcslen(STR(panel->items[i].str_id))); y+=D(PNLITEM_WY); break; case TYPE_TEXT: if(i==1&&panel->index==7) { version_t v; v.d=atoi(SVN_REV_D); v.m=atoi(SVN_REV_M); v.y=SVN_REV_Y; wsprintf(buf,L"%s (",TEXT(SVN_REV2)); str_date(&v,buf+wcslen(buf)); wcscat(buf,L")"); SetTextColor(hdc,D(CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx,y+ofsy,buf,wcslen(buf)); } SetTextColor(hdc,D(i==cur_i&&i>11?CHKBOX_TEXT_COLOR_H:CHKBOX_TEXT_COLOR)); TextOut(hdc,x+ofsx,y+ofsy,STR(panel->items[i].str_id),wcslen(STR(panel->items[i].str_id))); y+=D(PNLITEM_WY); break; case TYPE_GROUP_BREAK: case TYPE_GROUP: if(panel->index>=8&&panel->index<=10)break; if(i)y+=D(PNLITEM_WY); box_draw(hdc,x,y,x+XP(panel),y+(wy)*panel->items[i].action_id+ofsy*2, BOX_PANEL+panel->index*2+2); rgn=CreateRectRgn(x,y,x+XP(panel),y+(wy)*panel->items[i].action_id+ofsy*2); SelectClipRgn(hdc,rgn); break; default: break; } } if(rgn) { SelectClipRgn(hdc,0); DeleteObject(rgn); } }