blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
986 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
145 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
122 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
5cc69ea1dc132d5c0cf2cd6801505f54195e47b2
335fb8bfc5f4ff394d0e2abd20205d1670ecd0b1
/Beginner Problems/Page 1/1021 - Banknotes and Coins.cpp
cd2139e1ba7173b0799cf217f8e7fab51ec9a571
[]
no_license
AhmedGharseldin/URI-Online_Judge
e6d9120c4190b276bad7b91312a519a61f6db89d
adf3e0d92337a0b986818b9ec57d2afcf9709b9e
refs/heads/main
2023-02-17T09:39:35.270078
2021-01-17T11:38:21
2021-01-17T11:38:21
330,255,688
0
0
null
null
null
null
UTF-8
C++
false
false
994
cpp
//https://www.urionlinejudge.com.br/judge/en/problems/view/1021 #include <iostream> using namespace std; int main(){ double x; cin>>x; int t = x; int n = (x - t)*100; int u = 0; cout<<"NOTAS:"<<endl; cout<<t/100<<" nota(s) de R$ 100.00"<<endl; //100 u = t%100; cout<<u/50<<" nota(s) de R$ 50.00"<<endl; //50 u = u%50; cout<<u/20<<" nota(s) de R$ 20.00"<<endl; //20 u = u%20; cout<<u/10<<" nota(s) de R$ 10.00"<<endl; //10 u = u%10; cout<<u/5<<" nota(s) de R$ 5.00"<<endl; u = u%5; cout<<u/2<<" nota(s) de R$ 2.00"<<endl; u = u%2; cout<<"MOEDAS:"<<endl; cout<<u/1<<" moeda(s) de R$ 1.00"<<endl; cout<<n/50<<" moeda(s) de R$ 0.50"<<endl; n = n%50; cout<<n/25<<" moeda(s) de R$ 0.25"<<endl; n = n%25; cout<<n/10<<" moeda(s) de R$ 0.10"<<endl; n = n%10; cout<<n/5<<" moeda(s) de R$ 0.05"<<endl; n = n%5; cout<<n/1<<" moeda(s) de R$ 0.01"<<endl; return 0; }
[ "63879928+AhmedGharseldin@users.noreply.github.com" ]
63879928+AhmedGharseldin@users.noreply.github.com
a3a708fc5dc4686a629f4f99cb755b07f5d564c6
dc7b248286b79ebd7787208d4357b1a4a18aa45c
/PWGGA/PHOSTasks/PHOS_Run2/AliAnalysisTaskPHOSEmbedding.cxx
5f6c52e004e53984e3d82ba87b2715cb71fb93d8
[]
no_license
mfloris/AliPhysics
d73cb4fa1fd136b84abf96e5d53a6147864b40ac
20c8b26f77b8f2f42c17e71f07230bb89fb8d505
refs/heads/master
2021-01-23T02:04:47.991147
2017-12-08T10:46:20
2017-12-08T10:46:20
85,959,803
0
0
null
2017-03-23T14:32:47
2017-03-23T14:32:47
null
UTF-8
C++
false
false
33,912
cxx
#include <stdio.h> #include <iostream> #include "TChain.h" #include "TTree.h" #include "TObjArray.h" #include "TClonesArray.h" #include "TRandom3.h" #include "TGrid.h" #include "TROOT.h" #include "AliInputEventHandler.h" #include "AliAnalysisManager.h" #include "AliAnalysisTaskSE.h" #include "AliAnalysisTaskESDfilter.h" #include "AliLog.h" #include "AliESDtrackCuts.h" #include "AliESDHeader.h" #include "AliESDEvent.h" #include "AliESDVZERO.h" #include "AliESDTZERO.h" #include "AliESDCaloCells.h" #include "AliESDCaloCluster.h" #include "AliESDVertex.h" #include "AliESDtrack.h" #include "AliVEvent.h" #include "AliVHeader.h" #include "AliVTrack.h" #include "AliVCluster.h" #include "AliVCaloCells.h" #include "AliMultSelection.h" #include "AliEventplane.h" #include "AliPDG.h" #include "AliAODMCHeader.h" #include "AliAODHeader.h" #include "AliAODEvent.h" #include "AliAODCaloCells.h" #include "AliAODCaloCluster.h" #include "AliAODVertex.h" #include "AliAODTrack.h" #include "AliAODMCParticle.h" #include "AliAODInputHandler.h" #include "AliMCEventHandler.h" #include "AliMCEvent.h" #include "AliStack.h" #include "TGeoManager.h" #include "TGeoGlobalMagField.h" #include "AliGeomManager.h" #include "AliGRPObject.h" #include "AliMagF.h" #include "AliPHOSGeometry.h" #include "AliPHOSDigit.h" #include "AliPHOSReconstructor.h" #include "AliPHOSClusterizerv1.h" #include "AliPHOSCalibData.h" #include "AliCDBManager.h" #include "AliCDBPath.h" #include "AliCDBEntry.h" #include "AliCDBMetaData.h" #include "AliPHOSAodCluster.h" #include "AliPHOSEsdCluster.h" #include "AliOADBContainer.h" #include "AliAnalysisTaskPHOSEmbedding.h" using namespace std; // Author: Daiki Sekihata (Hiroshima University) ClassImp(AliAnalysisTaskPHOSEmbedding) //____________________________________________________________________________________________________________________________________ AliAnalysisTaskPHOSEmbedding::AliAnalysisTaskPHOSEmbedding(const char *name): AliAnalysisTaskSE(name), //AliAnalysisTaskESDfilter(name), fParticle(""), fEvent(0x0), fRandom3(0x0), fAODPathArray(0x0), fAODPath(""), fAODInput(0x0), fAODTree(0x0), fAODEvent(0x0), fNEvents(0), fEventCounter(0), fEventLoopMin(0), fEventLoopMax(0), fCellsPHOS(0x0), fDigitsTree(0x0), fClustersTree(0x0), fDigitsArr(0x0), fPHOSReconstructor(0x0), fClusterizer(0x0), fInitialized(kFALSE), fRunNumber(0), fESDEvent(0x0), fMCArray(0x0), fEmbeddedClusterArray(0x0), fEmbeddedCells(0x0), fSignalECorrection(1.), fSignalCalibData(0x0), fUserNonLin(0x0) { // Constructor //fRandom3 = new TRandom3(1);//0 is not preferable. AliCDBManager *cdb = AliCDBManager::Instance(); cdb->SetDefaultStorage("raw://"); cdb->SetRun(246982);//dummy run number//necessary run number is set in Init() fUserNonLin = new TF1("fUserNonLin","1.",0,100); //fEventCuts = new AliEventCuts(kFALSE); // Define input and output slots here // Input slot #0 works with a TChain DefineInput(0, TChain::Class()); // Output slot #0 id reserved by the base class for AOD // Output slot #1 writes into a TH1 container //DefineOutput(1, THashList::Class()); } //____________________________________________________________________________________________________________________________________ AliAnalysisTaskPHOSEmbedding::~AliAnalysisTaskPHOSEmbedding() { delete fRandom3; fRandom3 = 0x0; delete fUserNonLin; fUserNonLin = 0x0; if(fPHOSReconstructor){ delete fPHOSReconstructor; fPHOSReconstructor = 0x0; } if(fMCArray){ delete fMCArray; fMCArray = 0x0; } if(fEmbeddedClusterArray){ delete fEmbeddedClusterArray; fEmbeddedClusterArray = 0x0; } if(fEmbeddedCells){ delete fEmbeddedCells; fEmbeddedCells = 0x0; } } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::UserCreateOutputObjects() { // Create histograms // Called once //fOutputContainer = new THashList(); //fOutputContainer->SetOwner(kTRUE); fMCArray = new TClonesArray("AliAODMCParticle",0); fEmbeddedClusterArray = new TClonesArray("AliAODCaloCluster",0); //fEmbeddedClusterArray->SetName(Form("Embedded%sCaloClusters",fParticle.Data())); fEmbeddedCells = new AliAODCaloCells(); //fEmbeddedCells->SetName(Form("Embedded%sPHOScells",fParticle.Data())); //PostData(1,fOutputContainer); } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::UserExec(Option_t *option) { // Main loop // Called for each event fEvent = dynamic_cast<AliVEvent*>(InputEvent()); if(!fEvent){ AliError("event is not available."); return; } if(fRunNumber != fEvent->GetRunNumber()){ fRunNumber = fEvent->GetRunNumber(); Init(); } if(fEventLoopMax > fEventCounter + fEventLoopMin){ fEventCounter++; } else{//fEventCounter reaches Nevent in input AOD MC tree. go to next file. AliInfo("fEventCounter reaches at fEventLoopMax. Go to next external MC file."); Bool_t IsFileOK = OpenAODFile();//fNEvents are set here. //fEventCounter is reset here. if(!IsFileOK){ AliError(Form("external file (%s) could not be opened. return.",fAODPath.Data())); return; } } AliInfo(Form("fEventCounter = %d in current MC AOD input.",fEventCounter)); fAODTree->GetEvent(fEventCounter + fEventLoopMin); ConvertAODtoESD(); //To do //SetPHOSCells //SetClusters //start embedding CopyRecalibrateDigits(); if(fDigitsArr){ delete fDigitsArr; fDigitsArr = 0x0; } fDigitsArr = new TClonesArray("AliPHOSDigit",4*56*64); fDigitsArr->Clear(); gROOT->cd(); //make sure that the digits and RecPoints Trees are memory resident if(fDigitsTree){ delete fDigitsTree; fDigitsTree = 0x0; } fDigitsTree = new TTree("digitstree","digitstree"); fDigitsTree->Branch("PHOS","TClonesArray", &fDigitsArr, 32000); if(fClustersTree){ delete fClustersTree; fClustersTree = 0x0; } fClustersTree = new TTree("clustertree","clustertree"); //Remember number of Clusters before we added new ones... Int_t fNCaloClustersOld = fEvent->GetNumberOfCaloClusters(); Int_t nPHOSBefore=0; Int_t nCPVBefore=0; Int_t nEMCALBefore=0; for(Int_t iClust=0; iClust<fEvent->GetNumberOfCaloClusters(); iClust++){ AliVCluster *cluster = (AliVCluster*)fEvent->GetCaloCluster(iClust); if(cluster->GetType() == AliVCluster::kPHOSNeutral) nPHOSBefore++; else if(cluster->GetType() == AliVCluster::kPHOSCharged) nCPVBefore++; else nEMCALBefore++; } AliInfo(Form("Before embedding: Nall = %d , nPHOS = %d , nCPV = %d , nEMCAL = %d.",fNCaloClustersOld, nPHOSBefore, nCPVBefore, nEMCALBefore)); AliInfo(Form("Ncluster in sigle simulation = %d",fAODEvent->GetNumberOfCaloClusters())); AliAODCaloCells *cellsEmb = (AliAODCaloCells*)fAODEvent->GetPHOSCells(); Int_t NcellEmb = cellsEmb->GetNumberOfCells(); AliInfo(Form("Before embedding: N PHOS cells in simulation = %d",NcellEmb)); //------------------------------------------------------------------------------------- //Transform CaloCells into Digits which can be used for standard reconstruction //Add signal digits to the event //------------------------------------------------------------------------------------- //First copy data digits Int_t ndigit=0 ; for (Short_t icell = 0; icell < fCellsPHOS->GetNumberOfCells(); icell++) { Short_t id=0; Double_t time=0., amp=0. ; Int_t mclabel; Double_t efrac =0. ; if(fCellsPHOS->GetCell(icell, id, amp, time,mclabel, efrac) != kTRUE) break; Int_t idLong=id ; if(id<0)idLong= -id+56*64*5 ; //CPV digits new((*fDigitsArr)[ndigit]) AliPHOSDigit(-1,idLong,float(amp),float(time),ndigit); ndigit++; } //Add Digits from Signal TClonesArray sdigits("AliPHOSDigit",0) ; Int_t isdigit=0 ; if(fAODEvent){ AliAODCaloCells* cellsS = fAODEvent->GetPHOSCells(); Int_t cellLabels[1000]={0} ; //1000 should be enough for simulated Int_t cellSecondLabels[1000]={0} ; //low-statistics event. for(Int_t i=0;i<cellsS->GetNumberOfCells();i++){ cellLabels[i]=-1 ; cellSecondLabels[i]=-1; } //------------------------------------------------------------------------------------ //Ancestry information //Celect digits contributing to fAODEvent clusters and add primary information //(it is not stored in CaloCells) //------------------------------------------------------------------------------------ sdigits.Expand(cellsS->GetNumberOfCells()); for(Int_t i=0; i<fAODEvent->GetNumberOfCaloClusters(); i++) { //cluster from embedded signal AliAODCluster *clus = (AliAODCaloCluster*)fAODEvent->GetCaloCluster(i); if(!clus->IsPHOS()) continue; AliInfo(Form("Ecluster in M.C. = %e GeV",clus->E())); Int_t label = clus->GetLabel(); Int_t label2 = -1 ; if (clus->GetNLabels()>=2) label2 = clus->GetLabelAt(1) ; UShort_t * index = clus->GetCellsAbsId() ; for(Int_t ic=0; ic < clus->GetNCells(); ic++ ){ for (Int_t icell = 0; icell < cellsS->GetNumberOfCells(); icell++){ Short_t cellNumber; Double_t cellAmplitude=0., cellTime=0. ; Int_t mclabel; Double_t efrac =0. ; cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime,mclabel,efrac) ; Int_t longCellNumber=cellNumber ; if(cellNumber<0)longCellNumber= -cellNumber+56*64*5 ; //CPV digits if(longCellNumber==index[ic]){ cellLabels[icell]=label; cellSecondLabels[icell]=label2; break ; } } } } for (Int_t icell = 0; icell < cellsS->GetNumberOfCells(); icell++) { Short_t cellNumber; Double_t cellAmplitude=0., cellTime=0. ; Int_t mclabel; Double_t efrac =0. ; if (cellsS->GetCell(icell, cellNumber, cellAmplitude, cellTime,mclabel,efrac) != kTRUE) break; //Add only digits related to the cluster, no noisy digits... if(cellLabels[icell]==-1){ continue ; } cellAmplitude = DecalibrateSignal(cellAmplitude,cellNumber);//decalibration from Dmitri, Daiki added this line on 21.December.2016 Int_t longCellNumber=cellNumber ; if(cellNumber<0)longCellNumber= -cellNumber+56*64*5 ; //CPV digits new(sdigits[isdigit]) AliPHOSDigit(cellLabels[icell],longCellNumber,float(cellAmplitude),float(cellTime),isdigit); isdigit++; } } //Merge digits Int_t icurrent = 0 ; //index of the last used digit in underlying event fDigitsArr->Expand(ndigit+isdigit) ; for(Int_t i=0; i<isdigit;i++){ AliPHOSDigit * sdigit=static_cast<AliPHOSDigit*>(sdigits.At(i)) ; Bool_t added=kFALSE ; for(Int_t id=icurrent;id<ndigit;id++){ AliPHOSDigit * digit=static_cast<AliPHOSDigit*>(fDigitsArr->At(id)) ; if(sdigit->GetId() == digit->GetId() ){ *digit += *sdigit ; //add energies icurrent=id+1 ; added=kTRUE ; break ; //no more digits with same ID in the list } if(sdigit->GetId() < digit->GetId() ){ icurrent=id ; break ; //no more digits with same ID in the list } } if(!added){ new((*fDigitsArr)[ndigit]) AliPHOSDigit(*sdigit) ; ndigit++ ; } } //Change Amp back from Energy to ADC counts //Note that Reconstructor uses best ("new") calibration for(Int_t i=0; i<ndigit;i++){ AliPHOSDigit * digit=static_cast<AliPHOSDigit*>(fDigitsArr->At(i)) ; Float_t calib =fPHOSReconstructor->Calibrate(1.,digit->GetId()) ; if(calib>0.) digit->SetEnergy(digit->GetEnergy()/calib) ; } fDigitsArr->Sort() ; for (Int_t i = 0 ; i < ndigit ; i++) { AliPHOSDigit *digit = static_cast<AliPHOSDigit*>( fDigitsArr->At(i) ) ; digit->SetIndexInList(i) ; } fDigitsTree->Fill(); //clusterize and make tracking//no track matching here! fPHOSReconstructor->Reconstruct(fDigitsTree,fClustersTree) ; //Note that the current ESDEvent will be modified! fPHOSReconstructor->FillESD(fDigitsTree, fClustersTree, fESDEvent); //this modified event should go to ConvertEmbeddedClusters Int_t nPHOSAfter=0; Int_t nCPVAfter=0; Int_t nEMCALAfter=0; for(Int_t iClust=0; iClust<fESDEvent->GetNumberOfCaloClusters(); iClust++) { AliESDCaloCluster * cluster = (AliESDCaloCluster*)fESDEvent->GetCaloCluster(iClust); if(cluster->IsPHOS()){ if(cluster->GetType() == AliVCluster::kPHOSNeutral) nPHOSAfter++; if(cluster->GetType() == AliVCluster::kPHOSCharged) nCPVAfter++; } else{ nEMCALAfter++; } } AliInfo(Form("After embedding: Nall = %d , nPHOSAfter = %d , nCPVAfter = %d , nEMCALAfter = %d.", fESDEvent->GetNumberOfCaloClusters(), nPHOSAfter, nCPVAfter, nEMCALAfter)); const Int_t Ncell = fESDEvent->GetPHOSCells()->GetNumberOfCells(); AliInfo(Form("%d PHOS cells after embedding.",Ncell)); ConvertESDtoAOD(); //convert AliAODMCParticle TClonesArray *mcarray_org = dynamic_cast<TClonesArray*>(fAODEvent->FindListObject(AliAODMCParticle::StdBranchName())); const Int_t Npart = mcarray_org->GetEntries(); fMCArray->Clear(); fMCArray->Expand(Npart); for(Int_t i=0;i<Npart;i++){ AliAODMCParticle* aodpart = (AliAODMCParticle*)mcarray_org->At(i); //printf("PDG = %d , X = %e , Y = %e , Z = %e\n",aodpart->GetPdgCode(), aodpart->Xv(),aodpart->Yv(),aodpart->Zv()); new ((*fMCArray)[i]) AliAODMCParticle(*aodpart); } AliVEvent* input = InputEvent(); const TString brname = Form("%s_%s",AliAODMCParticle::StdBranchName(),fParticle.Data()); TObject* outMC = input->FindListObject(brname); AliInfo(Form("MC array name = %s , entry = %d.",brname.Data(),Npart)); if(!outMC){ AliInfo(Form("%s object is not found in input event. Add it.",brname.Data())); fMCArray->SetName(brname); input->AddObject(fMCArray); } const TString brname_cluster = Form("Embedded%sCaloClusters",fParticle.Data()); AliInfo(Form("name of embedded cluster array = %s",brname_cluster.Data())); TObject* outClusters = input->FindListObject(brname_cluster); if(!outClusters){ AliInfo(Form("%s object is not found in input event. Add it.",brname_cluster.Data())); fEmbeddedClusterArray->SetName(brname_cluster); input->AddObject(fEmbeddedClusterArray); } const TString brname_cell = Form("Embedded%sPHOScells",fParticle.Data()); AliInfo(Form("name of embedded cells = %s",brname_cell.Data())); TObject* outCells = input->FindListObject(brname_cell); if(!outCells){ AliInfo(Form("%s object is not found in input event. Add it.",brname_cell.Data())); fEmbeddedCells->SetName(brname_cell); input->AddObject(fEmbeddedCells); } //PostData(1, fOutputContainer); } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::Terminate(Option_t *option) { //Called once at the end of the query //In principle, this function is not needed... AliInfo(Form("%s is done.",GetName())); } //____________________________________________________________________________________________________________________________________ Bool_t AliAnalysisTaskPHOSEmbedding::UserNotify() { AliAODInputHandler *aodH = dynamic_cast<AliAODInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); TTree* tr = aodH->GetTree(); TDirectory* dr = tr->GetDirectory(); TString DataPath = dr->GetPath(); TObjArray *tx = DataPath.Tokenize("/"); //tx->Print(); Int_t Nt = tx->GetEntries(); //for (Int_t i = 0; i < Nt; i++) std::cout << "i = " << i << " , " << ((TObjString *)(tx->At(i)))->String() << std::endl; TString filestr = ((TObjString *)(tx->At(Nt-2)))->String(); Int_t fileID = filestr.Atoi(); TString runstr = ((TObjString *)(tx->At(5)))->String(); Int_t runNum = runstr.Atoi(); UInt_t seed = UInt_t(runNum * 1e+4) + UInt_t(fileID); AliInfo(Form("seed is %u",seed)); fRandom3 = new TRandom3(seed); return kTRUE; } //____________________________________________________________________________________________________________________________________ Int_t AliAnalysisTaskPHOSEmbedding::SelectAODFile() { Int_t Nfile = fAODPathArray->GetEntries(); Int_t ientry = (Int_t)(Nfile * fRandom3->Rndm()); TObjString *objStr = (TObjString*) fAODPathArray->At(ientry); if(!objStr){ AliError("Could not get path of AOD MC file."); return -1; } fAODPath = objStr->GetString(); AliInfo(Form("External MC file is %s.",fAODPath.Data())); return Nfile; } //____________________________________________________________________________________________________________________________________ Bool_t AliAnalysisTaskPHOSEmbedding::OpenAODFile() { AliInfo("Open a new file."); if(!gGrid){ AliInfo("Trying to connect to AliEn ..."); TGrid::Connect("alien://"); } if(fAODInput && fAODInput->IsOpen()) fAODInput->Close(); Int_t Nfile = SelectAODFile();//1st trial fAODInput = TFile::Open(fAODPath,"TIMEOUT=180"); if(!fAODInput){ AliError(Form("1/3 trial failed : An external AOD MC input (%s) could not be opened.",fAODPath.Data())); Nfile = SelectAODFile();//2nd trial fAODInput = TFile::Open(fAODPath,"TIMEOUT=180"); if(!fAODInput){ AliError(Form("2/3 trial failed : An external AOD MC input (%s) could not be opened.",fAODPath.Data())); Nfile = SelectAODFile();//3rd trial fAODInput = TFile::Open(fAODPath,"TIMEOUT=180"); if(!fAODInput){ AliError(Form("3/3 trial failed : An external AOD MC input (%s) could not be opened.",fAODPath.Data())); return kFALSE; }//end of 3rd trial }//end of 2nd trial }//end of 1st trial fAODTree = (TTree*)fAODInput->Get("aodTree"); if(!fAODTree){ AliError(Form("aodTree from an external AOD MC input (%s) is not found.",fAODPath.Data())); return kFALSE; } if(fAODEvent){ //remove previous input MC event delete fAODEvent; fAODEvent = 0x0; } fAODEvent = new AliAODEvent(); fAODEvent->ReadFromTree(fAODTree); fNEvents = fAODTree->GetEntries(); AliInfo(Form("%d events are stored in %s.",fNEvents,fAODPath.Data())); fEventCounter = 0;//reset counter. Int_t index1 = Int_t(fNEvents * fRandom3->Rndm()); Int_t index2 = Int_t(fNEvents * fRandom3->Rndm()); fEventLoopMin = TMath::Min(index1,index2); fEventLoopMax = TMath::Max(index1,index2); AliInfo(Form("Event loop in external MC file will run over %d - %d.",fEventLoopMin,fEventLoopMax)); return kTRUE; } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::CopyRecalibrateDigits() { //Recalibrate digits if there is better calibration ("new") //exists than one used in reconstruction ("ESD") AliAODEvent *event = dynamic_cast<AliAODEvent*>(fEvent); if(fCellsPHOS){ delete fCellsPHOS; fCellsPHOS = 0x0; } fCellsPHOS = new AliAODCaloCells(); fCellsPHOS->CreateContainer(event->GetPHOSCells()->GetNumberOfCells()); AliInfo(Form("%d PHOS cells in real data.",event->GetPHOSCells()->GetNumberOfCells())); for (Short_t icell=0;icell<event->GetPHOSCells()->GetNumberOfCells();icell++){ Short_t id=0; Double_t time=0., amp=0.; Int_t mclabel = -1; Double_t efrac =0.; if(event->GetPHOSCells()->GetCell(icell, id, amp, time, mclabel, efrac) != kTRUE) break; fCellsPHOS->SetCell(icell, id, amp, time, mclabel, efrac); } } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::Init() { AliAODEvent *event = dynamic_cast<AliAODEvent*>(InputEvent()); if(!event){ AliError("Can not obtain InputEvent!") ; return; } Int_t runNum = event->GetRunNumber(); AliCDBManager::Instance()->SetRun(runNum); //AliCDBManager::Instance()->SetDefaultStorage("raw://"); fPHOSReconstructor = new AliPHOSReconstructor("Run2"); AliCDBPath path("PHOS","Calib","RecoParam"); AliCDBEntry *entry = AliCDBManager::Instance()->Get(path.GetPath()); if(!entry){ AliError(Form("Can not get OCDB entry %s",path.GetPath().Data())) ; return ; } TObjArray* recoParamArray = (TObjArray*)entry->GetObject(); AliPHOSRecoParam* recoParam = (AliPHOSRecoParam*)recoParamArray->At(2); fPHOSReconstructor->SetRecoParam(recoParam) ; InitMF() ; InitGeometry() ; //Get OADB calibration for this run for de-calibration of signal AliOADBContainer calibContainer("phosRecalibration"); calibContainer.InitFromFile("$ALICE_PHYSICS/OADB/PHOS/PHOSCalibrations.root","phosRecalibration"); TObjArray *recalib = (TObjArray*)calibContainer.GetObject(runNum,"PHOSRecalibration"); if(!recalib){ AliWarning(Form("Can not read calibrations for run %d, do not apply OADB de-calibration\n",runNum)) ; } else{ const Int_t recoPass=1; fSignalCalibData = (AliPHOSCalibData*)recalib->At(recoPass-1) ; } } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::InitMF() { //------------------------------------ // Initialization of the Mag.Fiels from GRP entry // Copied from AliReconstruction::InitGRP() //------------------------------------ AliCDBEntry* entry = AliCDBManager::Instance()->Get("GRP/GRP/Data"); AliGRPObject * aGRPData=0 ; if (entry) { TMap* m = dynamic_cast<TMap*>(entry->GetObject()); // old GRP entry if (m) { AliInfo("Found a TMap in GRP/GRP/Data, converting it into an AliGRPObject"); m->Print(); aGRPData = new AliGRPObject(); aGRPData->ReadValuesFromMap(m); } else { AliInfo("Found an AliGRPObject in GRP/GRP/Data, reading it"); aGRPData = dynamic_cast<AliGRPObject*>(entry->GetObject()); // new GRP entry entry->SetOwner(0); } } if (!aGRPData) { AliError("No GRP entry found in OCDB!"); return ; } //*** Dealing with the magnetic field map TString lhcState = aGRPData->GetLHCState(); if (lhcState==AliGRPObject::GetInvalidString()) { AliError("GRP/GRP/Data entry: missing value for the LHC state ! Using UNKNOWN"); lhcState = "UNKNOWN"; } TString beamType = aGRPData->GetBeamType(); if (beamType==AliGRPObject::GetInvalidString()) { AliError("GRP/GRP/Data entry: missing value for the beam type ! Using UNKNOWN"); beamType = "UNKNOWN"; } Float_t beamEnergy = aGRPData->GetBeamEnergy(); if (beamEnergy==AliGRPObject::GetInvalidFloat()) { AliError("GRP/GRP/Data entry: missing value for the beam energy ! Using 0"); beamEnergy = 0; } TString runType = aGRPData->GetRunType(); if (runType==AliGRPObject::GetInvalidString()) { AliError("GRP/GRP/Data entry: missing value for the run type ! Using UNKNOWN"); runType = "UNKNOWN"; } if ( TGeoGlobalMagField::Instance()->IsLocked() ) { if (TGeoGlobalMagField::Instance()->GetField()->TestBit(AliMagF::kOverrideGRP)) { AliInfo("PHOSEmbedding: MF is locked - GRP information will be ignored !"); AliInfo("Running with the externally locked B field !"); } else { AliInfo("Destroying existing B field instance!"); delete TGeoGlobalMagField::Instance(); } } if ( !TGeoGlobalMagField::Instance()->IsLocked() ) { // Construct the field map out of the information retrieved from GRP. Bool_t ok = kTRUE; // L3 Float_t l3Current = aGRPData->GetL3Current((AliGRPObject::Stats)0); if (l3Current == AliGRPObject::GetInvalidFloat()) { AliError("GRP/GRP/Data entry: missing value for the L3 current !"); ok = kFALSE; } Char_t l3Polarity = aGRPData->GetL3Polarity(); if (l3Polarity == AliGRPObject::GetInvalidChar()) { AliError("GRP/GRP/Data entry: missing value for the L3 polarity !"); ok = kFALSE; } // Dipole Float_t diCurrent = aGRPData->GetDipoleCurrent((AliGRPObject::Stats)0); if (diCurrent == AliGRPObject::GetInvalidFloat()) { AliError("GRP/GRP/Data entry: missing value for the dipole current !"); ok = kFALSE; } Char_t diPolarity = aGRPData->GetDipolePolarity(); if (diPolarity == AliGRPObject::GetInvalidChar()) { AliError("GRP/GRP/Data entry: missing value for the dipole polarity !"); ok = kFALSE; } // read special bits for the polarity convention and map type Int_t polConvention = aGRPData->IsPolarityConventionLHC() ? AliMagF::kConvLHC : AliMagF::kConvDCS2008; Bool_t uniformB = aGRPData->IsUniformBMap(); if (ok) { AliMagF* fld = AliMagF::CreateFieldMap(TMath::Abs(l3Current) * (l3Polarity ? -1:1), TMath::Abs(diCurrent) * (diPolarity ? -1:1), polConvention,uniformB,beamEnergy, beamType.Data()); if (fld) { TGeoGlobalMagField::Instance()->SetField( fld ); TGeoGlobalMagField::Instance()->Lock(); AliInfo("Running with the B field constructed out of GRP !"); } else AliFatal("Failed to create a B field map !"); } else AliFatal("B field is neither set nor constructed from GRP ! Exitig..."); } } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::InitGeometry() { // Import ideal TGeo geometry and apply misalignment if (!gGeoManager) { AliGeomManager::LoadGeometry("geometry.root"); if (!gGeoManager) { AliFatal("Can not load geometry"); } if(!AliGeomManager::CheckSymNamesLUT("PHOS")) { AliFatal("CheckSymNamesLUT"); } } TString detStr = "PHOS"; TString loadAlObjsListOfDets = "PHOS"; if(AliGeomManager::GetNalignable("GRP") != 0) loadAlObjsListOfDets.Prepend("GRP "); //add alignment objects for non-sensitive modules AliGeomManager::ApplyAlignObjsFromCDB(loadAlObjsListOfDets.Data()); AliCDBManager::Instance()->UnloadFromCache("*/Align/*"); AliCDBManager::Instance()->UnloadFromCache("GRP/Geometry/Data"); } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::ConvertAODtoESD() { //this ESD event is necessary for AliPHOSReconstructor::FillESD. if(fESDEvent){ delete fESDEvent; fESDEvent = 0x0; } const AliVVertex *vVertex = fEvent->GetPrimaryVertex(); Double_t vtx_data[3] = {-999,-999,-999}; vtx_data[0] = vVertex->GetX(); vtx_data[1] = vVertex->GetY(); vtx_data[2] = vVertex->GetZ(); AliInfo(Form("vetex position in AOD | X = %f cm , Y = %f cm , Z = %f cm.",vtx_data[0],vtx_data[1],vtx_data[2])); //create AliESDEvent and set vertex position from AOD. //only vertex position is necessary for AliPHOSPID/AliPHOSTrackSegmentsMaker //think again AliPHOSReconstructor::FillESD should be called or I should write them here manually. //at least, track maching is re-done in PHOSTender. fESDEvent = new AliESDEvent(); fESDEvent->CreateStdContent();//this is important to set PHOSCells in AliESDEvent. AliESDVertex *vertex = new AliESDVertex(); vertex->SetXYZ(vtx_data); fESDEvent->SetPrimaryVertexTracks(vertex); fESDEvent->SetPrimaryVertexSPD(vertex); fESDEvent->SetPrimaryVertexTPC(vertex); delete vertex; vertex = 0x0; const Int_t Ncell = fEvent->GetPHOSCells()->GetNumberOfCells(); AliESDCaloCells *phoscells = dynamic_cast<AliESDCaloCells*>(fESDEvent->GetPHOSCells()); phoscells->CreateContainer(Ncell); AliInfo(Form("%d PHOS cells in real data before embedding.",Ncell)); for (Short_t icell=0;icell<Ncell;icell++){ Short_t id=0; Double_t time=0., amp=0.; Int_t mclabel = -1; Double_t efrac =0.; if(fEvent->GetPHOSCells()->GetCell(icell, id, amp, time, mclabel, efrac) != kTRUE) break; phoscells->SetCell(icell, id, amp, time, mclabel, efrac); } const AliESDVertex *esdVertexBest = fESDEvent->GetPrimaryVertex(); Double_t vtxBest[3] = {}; vtxBest[0] = esdVertexBest->GetX(); vtxBest[1] = esdVertexBest->GetY(); vtxBest[2] = esdVertexBest->GetZ(); AliInfo(Form("vetex position in ESD | X = %f cm , Y = %f cm , Z = %f cm.",vtxBest[0],vtxBest[1],vtxBest[2])); } //____________________________________________________________________________________________________________________________________ void AliAnalysisTaskPHOSEmbedding::ConvertESDtoAOD() { fEmbeddedClusterArray->Clear(); fEmbeddedCells->Clear(""); // Access to the AOD container of clusters Int_t jClusters = 0; const Int_t Ncluster = fESDEvent->GetNumberOfCaloClusters(); fEmbeddedClusterArray->Expand(Ncluster); //PHOS + CPV clusters are stored. for (Int_t iClust=0; iClust<Ncluster; iClust++) { AliESDCaloCluster * cluster = (AliESDCaloCluster*)fESDEvent->GetCaloCluster(iClust); Int_t id = cluster->GetID(); Int_t nLabel = cluster->GetNLabels(); Int_t *labels = cluster->GetLabels(); Float_t energy = cluster->E(); Float_t posF[3] = {0.}; cluster->GetPosition(posF); AliAODCaloCluster *caloCluster = new((*fEmbeddedClusterArray)[jClusters++]) AliAODCaloCluster(id, nLabel, labels, energy, posF, NULL, cluster->GetType(),0); Double_t dx=cluster->GetTrackDx() ; Double_t dz=cluster->GetTrackDz() ; Float_t cpv=99. ; //No track matched by default //no track matching // TArrayI * itracks = cluster->GetTracksMatched() ; // if(itracks->GetSize()>0){ // Int_t iTr = itracks->At(0); // if(iTr>=0 && iTr<fESDEvent->GetNumberOfTracks()){ // AliESDtrack *track = fESDEvent->GetTrack(iTr) ; // Double_t pt = track->Pt() ; // Short_t charge = track->Charge() ; // cpv=TestCPVRun2(dx, dz, pt,charge) ; // } // } caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), cluster->GetDispersion(), cluster->GetM20(), cluster->GetM02(), cpv, cluster->GetNExMax(),cluster->GetTOF()) ; caloCluster->SetPIDFromESD(cluster->GetPID()); caloCluster->SetNCells(cluster->GetNCells()); caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); } //for(Int_t i=0;i<fEmbeddedClusterArray->GetEntriesFast();i++){ // AliAODCaloCluster *caloCluster =(AliAODCaloCluster *)fEmbeddedClusterArray->At(i) ; // caloCluster->GetID(); //} //Now cells if(fESDEvent->GetPHOSCells()){ // protection against missing ESD information AliESDCaloCells &fESDEventPHcells = *(fESDEvent->GetPHOSCells()); Int_t nPHcell = fESDEventPHcells.GetNumberOfCells() ; fEmbeddedCells->CreateContainer(nPHcell); fEmbeddedCells->SetType(AliAODCaloCells::kPHOSCell); for (Int_t iCell = 0; iCell < nPHcell; iCell++) { //fEmbeddedCells->SetCell(iCell,fESDEventPHcells.GetCellNumber(iCell),fESDEventPHcells.GetAmplitude(iCell),fESDEventPHcells.GetTime(iCell)); fEmbeddedCells->SetCell(iCell,fESDEventPHcells.GetCellNumber(iCell),fESDEventPHcells.GetAmplitude(iCell),fESDEventPHcells.GetTime(iCell),fESDEventPHcells.GetMCLabel(iCell),fESDEventPHcells.GetEFraction(iCell),fESDEventPHcells.GetHighGain(iCell)); } fEmbeddedCells->Sort(); } AliInfo(Form("entry of fEmbeddedClusterArray = %d (PHOS+CPV) and Ncell = %d (PHOS+CPV) after embedding.",fEmbeddedClusterArray->GetEntriesFast(),fEmbeddedCells->GetNumberOfCells())); } //____________________________________________________________________________________________________________________________________ Double_t AliAnalysisTaskPHOSEmbedding::DecalibrateSignal(Double_t cellAmplitude,Int_t cellNumber) { //Apply de-calibration inverse to the calibration, stored in OADB AliInfo(Form("before correction : cellAmplitude = %e (GeV), fSignalECorrection = %e.",cellAmplitude,fSignalECorrection)); //Apply overall energy correction cellAmplitude *= fSignalECorrection; if(!fSignalCalibData){ AliInfo("fSignalCalibData is not applied."); return cellAmplitude; } Int_t relId[4]; AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance(); phosgeom->AbsToRelNumbering(cellNumber,relId); if(relId[1]!=0) //CPV return cellAmplitude ; Int_t module = relId[0]; Int_t column = relId[3]; Int_t row = relId[2]; Double_t c = fSignalCalibData->GetADCchannelEmc(module,column,row); AliInfo(Form("calibration co-efficient at M%d : X%d : Z%d in OADB is %e",module,row,column,c)); if(c>0){ cellAmplitude *= 1./c; cellAmplitude *= fUserNonLin->Eval(cellAmplitude); AliInfo(Form("after correction : cellAmplitude = %e (GeV)",cellAmplitude)); return cellAmplitude; } else{ cellAmplitude *= fUserNonLin->Eval(cellAmplitude); AliInfo(Form("after correction : cellAmplitude = %e (GeV)",cellAmplitude)); return cellAmplitude; } } //____________________________________________________________________________________________________________________________________ //____________________________________________________________________________________________________________________________________ //____________________________________________________________________________________________________________________________________ //____________________________________________________________________________________________________________________________________
[ "daiki.sekihata@cern.ch" ]
daiki.sekihata@cern.ch
4cb7a1dcf97644f4f00dbfa35b81b35a1366835d
27da6c0a879fc46fa91501b83f9b587b7dede3ce
/thirdparty/gtest-1.7.0/test/gtest-port_test.cc
1a1ee4a58af35dca49d906319aa09aa1e6794891
[ "MIT", "LicenseRef-scancode-generic-cla", "BSD-3-Clause" ]
permissive
waqarsqureshi/Restore
6b0a0e2d5164442f6355a0c21fa78fd9cc411a60
436fcf3eeffd015f5196fd3408aaad758450c290
refs/heads/master
2020-12-11T09:07:22.877304
2016-04-17T20:07:17
2016-04-17T20:07:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
39,176
cc
// Copyright 2008, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // // Authors: vladl@google.com (Vlad Losev), wan@google.com (Zhanyong Wan) // // This file tests the internal cross-platform support utilities. #include "gtest/internal/gtest-port.h" #include <stdio.h> #if GTEST_OS_MAC # include <time.h> #endif // GTEST_OS_MAC #include <list> #include <utility> // For std::pair and std::make_pair. #include <vector> #include "gtest/gtest.h" #include "gtest/gtest-spi.h" // Indicates that this translation unit is part of Google Test's // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in // his code. #define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ using std::make_pair; using std::pair; namespace testing { namespace internal { TEST(IsXDigitTest, WorksForNarrowAscii) { EXPECT_TRUE(IsXDigit('0')); EXPECT_TRUE(IsXDigit('9')); EXPECT_TRUE(IsXDigit('A')); EXPECT_TRUE(IsXDigit('F')); EXPECT_TRUE(IsXDigit('a')); EXPECT_TRUE(IsXDigit('f')); EXPECT_FALSE(IsXDigit('-')); EXPECT_FALSE(IsXDigit('g')); EXPECT_FALSE(IsXDigit('G')); } TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) { EXPECT_FALSE(IsXDigit(static_cast<char>(0x80))); EXPECT_FALSE(IsXDigit(static_cast<char>('0' | 0x80))); } TEST(IsXDigitTest, WorksForWideAscii) { EXPECT_TRUE(IsXDigit(L'0')); EXPECT_TRUE(IsXDigit(L'9')); EXPECT_TRUE(IsXDigit(L'A')); EXPECT_TRUE(IsXDigit(L'F')); EXPECT_TRUE(IsXDigit(L'a')); EXPECT_TRUE(IsXDigit(L'f')); EXPECT_FALSE(IsXDigit(L'-')); EXPECT_FALSE(IsXDigit(L'g')); EXPECT_FALSE(IsXDigit(L'G')); } TEST(IsXDigitTest, ReturnsFalseForWideNonAscii) { EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(0x80))); EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x80))); EXPECT_FALSE(IsXDigit(static_cast<wchar_t>(L'0' | 0x100))); } class Base { public: // Copy constructor and assignment operator do exactly what we need, so we // use them. Base() : member_(0) {} explicit Base(int n) : member_(n) {} virtual ~Base() {} int member() { return member_; } private: int member_; }; class Derived : public Base { public: explicit Derived(int n) : Base(n) {} }; TEST(ImplicitCastTest, ConvertsPointers) { Derived derived(0); EXPECT_TRUE(&derived == ::testing::internal::ImplicitCast_<Base*>(&derived)); } TEST(ImplicitCastTest, CanUseInheritance) { Derived derived(1); Base base = ::testing::internal::ImplicitCast_<Base>(derived); EXPECT_EQ(derived.member(), base.member()); } class Castable { public: explicit Castable(bool* converted) : converted_(converted) {} operator Base() { *converted_ = true; return Base(); } private: bool* converted_; }; TEST(ImplicitCastTest, CanUseNonConstCastOperator) { bool converted = false; Castable castable(&converted); Base base = ::testing::internal::ImplicitCast_<Base>(castable); EXPECT_TRUE(converted); } class ConstCastable { public: explicit ConstCastable(bool* converted) : converted_(converted) {} operator Base() const { *converted_ = true; return Base(); } private: bool* converted_; }; TEST(ImplicitCastTest, CanUseConstCastOperatorOnConstValues) { bool converted = false; const ConstCastable const_castable(&converted); Base base = ::testing::internal::ImplicitCast_<Base>(const_castable); EXPECT_TRUE(converted); } class ConstAndNonConstCastable { public: ConstAndNonConstCastable(bool* converted, bool* const_converted) : converted_(converted), const_converted_(const_converted) {} operator Base() { *converted_ = true; return Base(); } operator Base() const { *const_converted_ = true; return Base(); } private: bool* converted_; bool* const_converted_; }; TEST(ImplicitCastTest, CanSelectBetweenConstAndNonConstCasrAppropriately) { bool converted = false; bool const_converted = false; ConstAndNonConstCastable castable(&converted, &const_converted); Base base = ::testing::internal::ImplicitCast_<Base>(castable); EXPECT_TRUE(converted); EXPECT_FALSE(const_converted); converted = false; const_converted = false; const ConstAndNonConstCastable const_castable(&converted, &const_converted); base = ::testing::internal::ImplicitCast_<Base>(const_castable); EXPECT_FALSE(converted); EXPECT_TRUE(const_converted); } class To { public: To(bool* converted) { *converted = true; } // NOLINT }; TEST(ImplicitCastTest, CanUseImplicitConstructor) { bool converted = false; To to = ::testing::internal::ImplicitCast_<To>(&converted); (void)to; EXPECT_TRUE(converted); } TEST(IteratorTraitsTest, WorksForSTLContainerIterators) { StaticAssertTypeEq<int, IteratorTraits< ::std::vector<int>::const_iterator>::value_type>(); StaticAssertTypeEq<bool, IteratorTraits< ::std::list<bool>::iterator>::value_type>(); } TEST(IteratorTraitsTest, WorksForPointerToNonConst) { StaticAssertTypeEq<char, IteratorTraits<char*>::value_type>(); StaticAssertTypeEq<const void*, IteratorTraits<const void**>::value_type>(); } TEST(IteratorTraitsTest, WorksForPointerToConst) { StaticAssertTypeEq<char, IteratorTraits<const char*>::value_type>(); StaticAssertTypeEq<const void*, IteratorTraits<const void* const*>::value_type>(); } // Tests that the element_type typedef is available in scoped_ptr and refers // to the parameter type. TEST(ScopedPtrTest, DefinesElementType) { StaticAssertTypeEq<int, ::testing::internal::scoped_ptr<int>::element_type>(); } // TODO(vladl@google.com): Implement THE REST of scoped_ptr tests. TEST(GtestCheckSyntaxTest, BehavesLikeASingleStatement) { if (AlwaysFalse()) GTEST_CHECK_(false) << "This should never be executed; " "It's a compilation test only."; if (AlwaysTrue()) GTEST_CHECK_(true); else ; // NOLINT if (AlwaysFalse()) ; // NOLINT else GTEST_CHECK_(true) << ""; } TEST(GtestCheckSyntaxTest, WorksWithSwitch) { switch (0) { case 1: break; default: GTEST_CHECK_(true); } switch (0) case 0: GTEST_CHECK_(true) << "Check failed in switch case"; } // Verifies behavior of FormatFileLocation. TEST(FormatFileLocationTest, FormatsFileLocation) { EXPECT_PRED_FORMAT2(IsSubstring, "foo.cc", FormatFileLocation("foo.cc", 42)); EXPECT_PRED_FORMAT2(IsSubstring, "42", FormatFileLocation("foo.cc", 42)); } TEST(FormatFileLocationTest, FormatsUnknownFile) { EXPECT_PRED_FORMAT2( IsSubstring, "unknown file", FormatFileLocation(NULL, 42)); EXPECT_PRED_FORMAT2(IsSubstring, "42", FormatFileLocation(NULL, 42)); } TEST(FormatFileLocationTest, FormatsUknownLine) { EXPECT_EQ("foo.cc:", FormatFileLocation("foo.cc", -1)); } TEST(FormatFileLocationTest, FormatsUknownFileAndLine) { EXPECT_EQ("unknown file:", FormatFileLocation(NULL, -1)); } // Verifies behavior of FormatCompilerIndependentFileLocation. TEST(FormatCompilerIndependentFileLocationTest, FormatsFileLocation) { EXPECT_EQ("foo.cc:42", FormatCompilerIndependentFileLocation("foo.cc", 42)); } TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFile) { EXPECT_EQ("unknown file:42", FormatCompilerIndependentFileLocation(NULL, 42)); } TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownLine) { EXPECT_EQ("foo.cc", FormatCompilerIndependentFileLocation("foo.cc", -1)); } TEST(FormatCompilerIndependentFileLocationTest, FormatsUknownFileAndLine) { EXPECT_EQ("unknown file", FormatCompilerIndependentFileLocation(NULL, -1)); } #if GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_LINUX void* ThreadFunc(void* data) { pthread_mutex_t* mutex = static_cast<pthread_mutex_t*>(data); pthread_mutex_lock(mutex); pthread_mutex_unlock(mutex); return NULL; } TEST(GetThreadCountTest, ReturnsCorrectValue) { EXPECT_EQ(1U, GetThreadCount()); pthread_mutex_t mutex; pthread_attr_t attr; pthread_t thread_id; // TODO(vladl@google.com): turn mutex into internal::Mutex for automatic // destruction. pthread_mutex_init(&mutex, NULL); pthread_mutex_lock(&mutex); ASSERT_EQ(0, pthread_attr_init(&attr)); ASSERT_EQ(0, pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE)); const int status = pthread_create(&thread_id, &attr, &ThreadFunc, &mutex); ASSERT_EQ(0, pthread_attr_destroy(&attr)); ASSERT_EQ(0, status); EXPECT_EQ(2U, GetThreadCount()); pthread_mutex_unlock(&mutex); void* dummy; ASSERT_EQ(0, pthread_join(thread_id, &dummy)); # if GTEST_OS_MAC || GTEST_OS_LINUX // MacOS X and Linux may not immediately report the updated thread count after // joining a thread, causing flakiness in this test. To counter that, we // wait for up to .5 seconds for the OS to report the correct value. for (int i = 0; i < 5; ++i) { if (GetThreadCount() == 1) break; SleepMilliseconds(100); } # endif // GTEST_OS_MAC || GTEST_OS_LINUX EXPECT_EQ(1U, GetThreadCount()); pthread_mutex_destroy(&mutex); } #else TEST(GetThreadCountTest, ReturnsZeroWhenUnableToCountThreads) { EXPECT_EQ(0U, GetThreadCount()); } #endif // GTEST_OS_MAC || GTEST_OS_QNX || GTEST_OS_LINUX TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) { const bool a_false_condition = false; const char regex[] = #ifdef _MSC_VER "gtest-port_test\\.cc\\(\\d+\\):" #elif GTEST_USES_POSIX_RE "gtest-port_test\\.cc:[0-9]+" #else "gtest-port_test\\.cc:\\d+" #endif // _MSC_VER ".*a_false_condition.*Extra info.*"; EXPECT_DEATH_IF_SUPPORTED(GTEST_CHECK_(a_false_condition) << "Extra info", regex); } #if GTEST_HAS_DEATH_TEST TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) { EXPECT_EXIT({ GTEST_CHECK_(true) << "Extra info"; ::std::cerr << "Success\n"; exit(0); }, ::testing::ExitedWithCode(0), "Success"); } #endif // GTEST_HAS_DEATH_TEST // Verifies that Google Test choose regular expression engine appropriate to // the platform. The test will produce compiler errors in case of failure. // For simplicity, we only cover the most important platforms here. TEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) { #if GTEST_HAS_POSIX_RE EXPECT_TRUE(GTEST_USES_POSIX_RE); #else EXPECT_TRUE(GTEST_USES_SIMPLE_RE); #endif } #if GTEST_USES_POSIX_RE # if GTEST_HAS_TYPED_TEST template <typename Str> class RETest : public ::testing::Test {}; // Defines StringTypes as the list of all string types that class RE // supports. typedef testing::Types< ::std::string, # if GTEST_HAS_GLOBAL_STRING ::string, # endif // GTEST_HAS_GLOBAL_STRING const char*> StringTypes; TYPED_TEST_CASE(RETest, StringTypes); // Tests RE's implicit constructors. TYPED_TEST(RETest, ImplicitConstructorWorks) { const RE empty(TypeParam("")); EXPECT_STREQ("", empty.pattern()); const RE simple(TypeParam("hello")); EXPECT_STREQ("hello", simple.pattern()); const RE normal(TypeParam(".*(\\w+)")); EXPECT_STREQ(".*(\\w+)", normal.pattern()); } // Tests that RE's constructors reject invalid regular expressions. TYPED_TEST(RETest, RejectsInvalidRegex) { EXPECT_NONFATAL_FAILURE({ const RE invalid(TypeParam("?")); }, "\"?\" is not a valid POSIX Extended regular expression."); } // Tests RE::FullMatch(). TYPED_TEST(RETest, FullMatchWorks) { const RE empty(TypeParam("")); EXPECT_TRUE(RE::FullMatch(TypeParam(""), empty)); EXPECT_FALSE(RE::FullMatch(TypeParam("a"), empty)); const RE re(TypeParam("a.*z")); EXPECT_TRUE(RE::FullMatch(TypeParam("az"), re)); EXPECT_TRUE(RE::FullMatch(TypeParam("axyz"), re)); EXPECT_FALSE(RE::FullMatch(TypeParam("baz"), re)); EXPECT_FALSE(RE::FullMatch(TypeParam("azy"), re)); } // Tests RE::PartialMatch(). TYPED_TEST(RETest, PartialMatchWorks) { const RE empty(TypeParam("")); EXPECT_TRUE(RE::PartialMatch(TypeParam(""), empty)); EXPECT_TRUE(RE::PartialMatch(TypeParam("a"), empty)); const RE re(TypeParam("a.*z")); EXPECT_TRUE(RE::PartialMatch(TypeParam("az"), re)); EXPECT_TRUE(RE::PartialMatch(TypeParam("axyz"), re)); EXPECT_TRUE(RE::PartialMatch(TypeParam("baz"), re)); EXPECT_TRUE(RE::PartialMatch(TypeParam("azy"), re)); EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re)); } # endif // GTEST_HAS_TYPED_TEST #elif GTEST_USES_SIMPLE_RE TEST(IsInSetTest, NulCharIsNotInAnySet) { EXPECT_FALSE(IsInSet('\0', "")); EXPECT_FALSE(IsInSet('\0', "\0")); EXPECT_FALSE(IsInSet('\0', "a")); } TEST(IsInSetTest, WorksForNonNulChars) { EXPECT_FALSE(IsInSet('a', "Ab")); EXPECT_FALSE(IsInSet('c', "")); EXPECT_TRUE(IsInSet('b', "bcd")); EXPECT_TRUE(IsInSet('b', "ab")); } TEST(IsAsciiDigitTest, IsFalseForNonDigit) { EXPECT_FALSE(IsAsciiDigit('\0')); EXPECT_FALSE(IsAsciiDigit(' ')); EXPECT_FALSE(IsAsciiDigit('+')); EXPECT_FALSE(IsAsciiDigit('-')); EXPECT_FALSE(IsAsciiDigit('.')); EXPECT_FALSE(IsAsciiDigit('a')); } TEST(IsAsciiDigitTest, IsTrueForDigit) { EXPECT_TRUE(IsAsciiDigit('0')); EXPECT_TRUE(IsAsciiDigit('1')); EXPECT_TRUE(IsAsciiDigit('5')); EXPECT_TRUE(IsAsciiDigit('9')); } TEST(IsAsciiPunctTest, IsFalseForNonPunct) { EXPECT_FALSE(IsAsciiPunct('\0')); EXPECT_FALSE(IsAsciiPunct(' ')); EXPECT_FALSE(IsAsciiPunct('\n')); EXPECT_FALSE(IsAsciiPunct('a')); EXPECT_FALSE(IsAsciiPunct('0')); } TEST(IsAsciiPunctTest, IsTrueForPunct) { for (const char* p = "^-!\"#$%&'()*+,./:;<=>?@[\\]_`{|}~"; *p; p++) { EXPECT_PRED1(IsAsciiPunct, *p); } } TEST(IsRepeatTest, IsFalseForNonRepeatChar) { EXPECT_FALSE(IsRepeat('\0')); EXPECT_FALSE(IsRepeat(' ')); EXPECT_FALSE(IsRepeat('a')); EXPECT_FALSE(IsRepeat('1')); EXPECT_FALSE(IsRepeat('-')); } TEST(IsRepeatTest, IsTrueForRepeatChar) { EXPECT_TRUE(IsRepeat('?')); EXPECT_TRUE(IsRepeat('*')); EXPECT_TRUE(IsRepeat('+')); } TEST(IsAsciiWhiteSpaceTest, IsFalseForNonWhiteSpace) { EXPECT_FALSE(IsAsciiWhiteSpace('\0')); EXPECT_FALSE(IsAsciiWhiteSpace('a')); EXPECT_FALSE(IsAsciiWhiteSpace('1')); EXPECT_FALSE(IsAsciiWhiteSpace('+')); EXPECT_FALSE(IsAsciiWhiteSpace('_')); } TEST(IsAsciiWhiteSpaceTest, IsTrueForWhiteSpace) { EXPECT_TRUE(IsAsciiWhiteSpace(' ')); EXPECT_TRUE(IsAsciiWhiteSpace('\n')); EXPECT_TRUE(IsAsciiWhiteSpace('\r')); EXPECT_TRUE(IsAsciiWhiteSpace('\t')); EXPECT_TRUE(IsAsciiWhiteSpace('\v')); EXPECT_TRUE(IsAsciiWhiteSpace('\f')); } TEST(IsAsciiWordCharTest, IsFalseForNonWordChar) { EXPECT_FALSE(IsAsciiWordChar('\0')); EXPECT_FALSE(IsAsciiWordChar('+')); EXPECT_FALSE(IsAsciiWordChar('.')); EXPECT_FALSE(IsAsciiWordChar(' ')); EXPECT_FALSE(IsAsciiWordChar('\n')); } TEST(IsAsciiWordCharTest, IsTrueForLetter) { EXPECT_TRUE(IsAsciiWordChar('a')); EXPECT_TRUE(IsAsciiWordChar('b')); EXPECT_TRUE(IsAsciiWordChar('A')); EXPECT_TRUE(IsAsciiWordChar('Z')); } TEST(IsAsciiWordCharTest, IsTrueForDigit) { EXPECT_TRUE(IsAsciiWordChar('0')); EXPECT_TRUE(IsAsciiWordChar('1')); EXPECT_TRUE(IsAsciiWordChar('7')); EXPECT_TRUE(IsAsciiWordChar('9')); } TEST(IsAsciiWordCharTest, IsTrueForUnderscore) { EXPECT_TRUE(IsAsciiWordChar('_')); } TEST(IsValidEscapeTest, IsFalseForNonPrintable) { EXPECT_FALSE(IsValidEscape('\0')); EXPECT_FALSE(IsValidEscape('\007')); } TEST(IsValidEscapeTest, IsFalseForDigit) { EXPECT_FALSE(IsValidEscape('0')); EXPECT_FALSE(IsValidEscape('9')); } TEST(IsValidEscapeTest, IsFalseForWhiteSpace) { EXPECT_FALSE(IsValidEscape(' ')); EXPECT_FALSE(IsValidEscape('\n')); } TEST(IsValidEscapeTest, IsFalseForSomeLetter) { EXPECT_FALSE(IsValidEscape('a')); EXPECT_FALSE(IsValidEscape('Z')); } TEST(IsValidEscapeTest, IsTrueForPunct) { EXPECT_TRUE(IsValidEscape('.')); EXPECT_TRUE(IsValidEscape('-')); EXPECT_TRUE(IsValidEscape('^')); EXPECT_TRUE(IsValidEscape('$')); EXPECT_TRUE(IsValidEscape('(')); EXPECT_TRUE(IsValidEscape(']')); EXPECT_TRUE(IsValidEscape('{')); EXPECT_TRUE(IsValidEscape('|')); } TEST(IsValidEscapeTest, IsTrueForSomeLetter) { EXPECT_TRUE(IsValidEscape('d')); EXPECT_TRUE(IsValidEscape('D')); EXPECT_TRUE(IsValidEscape('s')); EXPECT_TRUE(IsValidEscape('S')); EXPECT_TRUE(IsValidEscape('w')); EXPECT_TRUE(IsValidEscape('W')); } TEST(AtomMatchesCharTest, EscapedPunct) { EXPECT_FALSE(AtomMatchesChar(true, '\\', '\0')); EXPECT_FALSE(AtomMatchesChar(true, '\\', ' ')); EXPECT_FALSE(AtomMatchesChar(true, '_', '.')); EXPECT_FALSE(AtomMatchesChar(true, '.', 'a')); EXPECT_TRUE(AtomMatchesChar(true, '\\', '\\')); EXPECT_TRUE(AtomMatchesChar(true, '_', '_')); EXPECT_TRUE(AtomMatchesChar(true, '+', '+')); EXPECT_TRUE(AtomMatchesChar(true, '.', '.')); } TEST(AtomMatchesCharTest, Escaped_d) { EXPECT_FALSE(AtomMatchesChar(true, 'd', '\0')); EXPECT_FALSE(AtomMatchesChar(true, 'd', 'a')); EXPECT_FALSE(AtomMatchesChar(true, 'd', '.')); EXPECT_TRUE(AtomMatchesChar(true, 'd', '0')); EXPECT_TRUE(AtomMatchesChar(true, 'd', '9')); } TEST(AtomMatchesCharTest, Escaped_D) { EXPECT_FALSE(AtomMatchesChar(true, 'D', '0')); EXPECT_FALSE(AtomMatchesChar(true, 'D', '9')); EXPECT_TRUE(AtomMatchesChar(true, 'D', '\0')); EXPECT_TRUE(AtomMatchesChar(true, 'D', 'a')); EXPECT_TRUE(AtomMatchesChar(true, 'D', '-')); } TEST(AtomMatchesCharTest, Escaped_s) { EXPECT_FALSE(AtomMatchesChar(true, 's', '\0')); EXPECT_FALSE(AtomMatchesChar(true, 's', 'a')); EXPECT_FALSE(AtomMatchesChar(true, 's', '.')); EXPECT_FALSE(AtomMatchesChar(true, 's', '9')); EXPECT_TRUE(AtomMatchesChar(true, 's', ' ')); EXPECT_TRUE(AtomMatchesChar(true, 's', '\n')); EXPECT_TRUE(AtomMatchesChar(true, 's', '\t')); } TEST(AtomMatchesCharTest, Escaped_S) { EXPECT_FALSE(AtomMatchesChar(true, 'S', ' ')); EXPECT_FALSE(AtomMatchesChar(true, 'S', '\r')); EXPECT_TRUE(AtomMatchesChar(true, 'S', '\0')); EXPECT_TRUE(AtomMatchesChar(true, 'S', 'a')); EXPECT_TRUE(AtomMatchesChar(true, 'S', '9')); } TEST(AtomMatchesCharTest, Escaped_w) { EXPECT_FALSE(AtomMatchesChar(true, 'w', '\0')); EXPECT_FALSE(AtomMatchesChar(true, 'w', '+')); EXPECT_FALSE(AtomMatchesChar(true, 'w', ' ')); EXPECT_FALSE(AtomMatchesChar(true, 'w', '\n')); EXPECT_TRUE(AtomMatchesChar(true, 'w', '0')); EXPECT_TRUE(AtomMatchesChar(true, 'w', 'b')); EXPECT_TRUE(AtomMatchesChar(true, 'w', 'C')); EXPECT_TRUE(AtomMatchesChar(true, 'w', '_')); } TEST(AtomMatchesCharTest, Escaped_W) { EXPECT_FALSE(AtomMatchesChar(true, 'W', 'A')); EXPECT_FALSE(AtomMatchesChar(true, 'W', 'b')); EXPECT_FALSE(AtomMatchesChar(true, 'W', '9')); EXPECT_FALSE(AtomMatchesChar(true, 'W', '_')); EXPECT_TRUE(AtomMatchesChar(true, 'W', '\0')); EXPECT_TRUE(AtomMatchesChar(true, 'W', '*')); EXPECT_TRUE(AtomMatchesChar(true, 'W', '\n')); } TEST(AtomMatchesCharTest, EscapedWhiteSpace) { EXPECT_FALSE(AtomMatchesChar(true, 'f', '\0')); EXPECT_FALSE(AtomMatchesChar(true, 'f', '\n')); EXPECT_FALSE(AtomMatchesChar(true, 'n', '\0')); EXPECT_FALSE(AtomMatchesChar(true, 'n', '\r')); EXPECT_FALSE(AtomMatchesChar(true, 'r', '\0')); EXPECT_FALSE(AtomMatchesChar(true, 'r', 'a')); EXPECT_FALSE(AtomMatchesChar(true, 't', '\0')); EXPECT_FALSE(AtomMatchesChar(true, 't', 't')); EXPECT_FALSE(AtomMatchesChar(true, 'v', '\0')); EXPECT_FALSE(AtomMatchesChar(true, 'v', '\f')); EXPECT_TRUE(AtomMatchesChar(true, 'f', '\f')); EXPECT_TRUE(AtomMatchesChar(true, 'n', '\n')); EXPECT_TRUE(AtomMatchesChar(true, 'r', '\r')); EXPECT_TRUE(AtomMatchesChar(true, 't', '\t')); EXPECT_TRUE(AtomMatchesChar(true, 'v', '\v')); } TEST(AtomMatchesCharTest, UnescapedDot) { EXPECT_FALSE(AtomMatchesChar(false, '.', '\n')); EXPECT_TRUE(AtomMatchesChar(false, '.', '\0')); EXPECT_TRUE(AtomMatchesChar(false, '.', '.')); EXPECT_TRUE(AtomMatchesChar(false, '.', 'a')); EXPECT_TRUE(AtomMatchesChar(false, '.', ' ')); } TEST(AtomMatchesCharTest, UnescapedChar) { EXPECT_FALSE(AtomMatchesChar(false, 'a', '\0')); EXPECT_FALSE(AtomMatchesChar(false, 'a', 'b')); EXPECT_FALSE(AtomMatchesChar(false, '$', 'a')); EXPECT_TRUE(AtomMatchesChar(false, '$', '$')); EXPECT_TRUE(AtomMatchesChar(false, '5', '5')); EXPECT_TRUE(AtomMatchesChar(false, 'Z', 'Z')); } TEST(ValidateRegexTest, GeneratesFailureAndReturnsFalseForInvalid) { EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(NULL)), "NULL is not a valid simple regular expression"); EXPECT_NONFATAL_FAILURE( ASSERT_FALSE(ValidateRegex("a\\")), "Syntax error at index 1 in simple regular expression \"a\\\": "); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a\\")), "'\\' cannot appear at the end"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("\\n\\")), "'\\' cannot appear at the end"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("\\s\\hb")), "invalid escape sequence \"\\h\""); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^^")), "'^' can only appear at the beginning"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex(".*^b")), "'^' can only appear at the beginning"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("$$")), "'$' can only appear at the end"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^$a")), "'$' can only appear at the end"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a(b")), "'(' is unsupported"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("ab)")), "')' is unsupported"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("[ab")), "'[' is unsupported"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("a{2")), "'{' is unsupported"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("?")), "'?' can only follow a repeatable token"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("^*")), "'*' can only follow a repeatable token"); EXPECT_NONFATAL_FAILURE(ASSERT_FALSE(ValidateRegex("5*+")), "'+' can only follow a repeatable token"); } TEST(ValidateRegexTest, ReturnsTrueForValid) { EXPECT_TRUE(ValidateRegex("")); EXPECT_TRUE(ValidateRegex("a")); EXPECT_TRUE(ValidateRegex(".*")); EXPECT_TRUE(ValidateRegex("^a_+")); EXPECT_TRUE(ValidateRegex("^a\\t\\&?")); EXPECT_TRUE(ValidateRegex("09*$")); EXPECT_TRUE(ValidateRegex("^Z$")); EXPECT_TRUE(ValidateRegex("a\\^Z\\$\\(\\)\\|\\[\\]\\{\\}")); } TEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrOne) { EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "a", "ba")); // Repeating more than once. EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "aab")); // Repeating zero times. EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "ba")); // Repeating once. EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, 'a', '?', "b", "ab")); EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '#', '?', ".", "##")); } TEST(MatchRepetitionAndRegexAtHeadTest, WorksForZeroOrMany) { EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '*', "a$", "baab")); // Repeating zero times. EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', "b", "bc")); // Repeating once. EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '*', "b", "abc")); // Repeating more than once. EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '*', "-", "ab_1-g")); } TEST(MatchRepetitionAndRegexAtHeadTest, WorksForOneOrMany) { EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', "a$", "baab")); // Repeating zero times. EXPECT_FALSE(MatchRepetitionAndRegexAtHead(false, '.', '+', "b", "bc")); // Repeating once. EXPECT_TRUE(MatchRepetitionAndRegexAtHead(false, '.', '+', "b", "abc")); // Repeating more than once. EXPECT_TRUE(MatchRepetitionAndRegexAtHead(true, 'w', '+', "-", "ab_1-g")); } TEST(MatchRegexAtHeadTest, ReturnsTrueForEmptyRegex) { EXPECT_TRUE(MatchRegexAtHead("", "")); EXPECT_TRUE(MatchRegexAtHead("", "ab")); } TEST(MatchRegexAtHeadTest, WorksWhenDollarIsInRegex) { EXPECT_FALSE(MatchRegexAtHead("$", "a")); EXPECT_TRUE(MatchRegexAtHead("$", "")); EXPECT_TRUE(MatchRegexAtHead("a$", "a")); } TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithEscapeSequence) { EXPECT_FALSE(MatchRegexAtHead("\\w", "+")); EXPECT_FALSE(MatchRegexAtHead("\\W", "ab")); EXPECT_TRUE(MatchRegexAtHead("\\sa", "\nab")); EXPECT_TRUE(MatchRegexAtHead("\\d", "1a")); } TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithRepetition) { EXPECT_FALSE(MatchRegexAtHead(".+a", "abc")); EXPECT_FALSE(MatchRegexAtHead("a?b", "aab")); EXPECT_TRUE(MatchRegexAtHead(".*a", "bc12-ab")); EXPECT_TRUE(MatchRegexAtHead("a?b", "b")); EXPECT_TRUE(MatchRegexAtHead("a?b", "ab")); } TEST(MatchRegexAtHeadTest, WorksWhenRegexStartsWithRepetionOfEscapeSequence) { EXPECT_FALSE(MatchRegexAtHead("\\.+a", "abc")); EXPECT_FALSE(MatchRegexAtHead("\\s?b", " b")); EXPECT_TRUE(MatchRegexAtHead("\\(*a", "((((ab")); EXPECT_TRUE(MatchRegexAtHead("\\^?b", "^b")); EXPECT_TRUE(MatchRegexAtHead("\\\\?b", "b")); EXPECT_TRUE(MatchRegexAtHead("\\\\?b", "\\b")); } TEST(MatchRegexAtHeadTest, MatchesSequentially) { EXPECT_FALSE(MatchRegexAtHead("ab.*c", "acabc")); EXPECT_TRUE(MatchRegexAtHead("ab.*c", "ab-fsc")); } TEST(MatchRegexAnywhereTest, ReturnsFalseWhenStringIsNull) { EXPECT_FALSE(MatchRegexAnywhere("", NULL)); } TEST(MatchRegexAnywhereTest, WorksWhenRegexStartsWithCaret) { EXPECT_FALSE(MatchRegexAnywhere("^a", "ba")); EXPECT_FALSE(MatchRegexAnywhere("^$", "a")); EXPECT_TRUE(MatchRegexAnywhere("^a", "ab")); EXPECT_TRUE(MatchRegexAnywhere("^", "ab")); EXPECT_TRUE(MatchRegexAnywhere("^$", "")); } TEST(MatchRegexAnywhereTest, ReturnsFalseWhenNoMatch) { EXPECT_FALSE(MatchRegexAnywhere("a", "bcde123")); EXPECT_FALSE(MatchRegexAnywhere("a.+a", "--aa88888888")); } TEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingPrefix) { EXPECT_TRUE(MatchRegexAnywhere("\\w+", "ab1_ - 5")); EXPECT_TRUE(MatchRegexAnywhere(".*=", "=")); EXPECT_TRUE(MatchRegexAnywhere("x.*ab?.*bc", "xaaabc")); } TEST(MatchRegexAnywhereTest, ReturnsTrueWhenMatchingNonPrefix) { EXPECT_TRUE(MatchRegexAnywhere("\\w+", "$$$ ab1_ - 5")); EXPECT_TRUE(MatchRegexAnywhere("\\.+=", "= ...=")); } // Tests RE's implicit constructors. TEST(RETest, ImplicitConstructorWorks) { const RE empty(""); EXPECT_STREQ("", empty.pattern()); const RE simple("hello"); EXPECT_STREQ("hello", simple.pattern()); } // Tests that RE's constructors reject invalid regular expressions. TEST(RETest, RejectsInvalidRegex) { EXPECT_NONFATAL_FAILURE({ const RE normal(NULL); }, "NULL is not a valid simple regular expression"); EXPECT_NONFATAL_FAILURE({ const RE normal(".*(\\w+"); }, "'(' is unsupported"); EXPECT_NONFATAL_FAILURE({ const RE invalid("^?"); }, "'?' can only follow a repeatable token"); } // Tests RE::FullMatch(). TEST(RETest, FullMatchWorks) { const RE empty(""); EXPECT_TRUE(RE::FullMatch("", empty)); EXPECT_FALSE(RE::FullMatch("a", empty)); const RE re1("a"); EXPECT_TRUE(RE::FullMatch("a", re1)); const RE re("a.*z"); EXPECT_TRUE(RE::FullMatch("az", re)); EXPECT_TRUE(RE::FullMatch("axyz", re)); EXPECT_FALSE(RE::FullMatch("baz", re)); EXPECT_FALSE(RE::FullMatch("azy", re)); } // Tests RE::PartialMatch(). TEST(RETest, PartialMatchWorks) { const RE empty(""); EXPECT_TRUE(RE::PartialMatch("", empty)); EXPECT_TRUE(RE::PartialMatch("a", empty)); const RE re("a.*z"); EXPECT_TRUE(RE::PartialMatch("az", re)); EXPECT_TRUE(RE::PartialMatch("axyz", re)); EXPECT_TRUE(RE::PartialMatch("baz", re)); EXPECT_TRUE(RE::PartialMatch("azy", re)); EXPECT_FALSE(RE::PartialMatch("zza", re)); } #endif // GTEST_USES_POSIX_RE #if !GTEST_OS_WINDOWS_MOBILE TEST(CaptureTest, CapturesStdout) { CaptureStdout(); fprintf(stdout, "abc"); EXPECT_STREQ("abc", GetCapturedStdout().c_str()); CaptureStdout(); fprintf(stdout, "def%cghi", '\0'); EXPECT_EQ(::std::string("def\0ghi", 7), ::std::string(GetCapturedStdout())); } TEST(CaptureTest, CapturesStderr) { CaptureStderr(); fprintf(stderr, "jkl"); EXPECT_STREQ("jkl", GetCapturedStderr().c_str()); CaptureStderr(); fprintf(stderr, "jkl%cmno", '\0'); EXPECT_EQ(::std::string("jkl\0mno", 7), ::std::string(GetCapturedStderr())); } // Tests that stdout and stderr capture don't interfere with each other. TEST(CaptureTest, CapturesStdoutAndStderr) { CaptureStdout(); CaptureStderr(); fprintf(stdout, "pqr"); fprintf(stderr, "stu"); EXPECT_STREQ("pqr", GetCapturedStdout().c_str()); EXPECT_STREQ("stu", GetCapturedStderr().c_str()); } TEST(CaptureDeathTest, CannotReenterStdoutCapture) { CaptureStdout(); EXPECT_DEATH_IF_SUPPORTED(CaptureStdout(), "Only one stdout capturer can exist at a time"); GetCapturedStdout(); // We cannot test stderr capturing using death tests as they use it // themselves. } #endif // !GTEST_OS_WINDOWS_MOBILE TEST(ThreadLocalTest, DefaultConstructorInitializesToDefaultValues) { ThreadLocal<int> t1; EXPECT_EQ(0, t1.get()); ThreadLocal<void*> t2; EXPECT_TRUE(t2.get() == NULL); } TEST(ThreadLocalTest, SingleParamConstructorInitializesToParam) { ThreadLocal<int> t1(123); EXPECT_EQ(123, t1.get()); int i = 0; ThreadLocal<int*> t2(&i); EXPECT_EQ(&i, t2.get()); } class NoDefaultContructor { public: explicit NoDefaultContructor(const char*) {} NoDefaultContructor(const NoDefaultContructor&) {} }; TEST(ThreadLocalTest, ValueDefaultContructorIsNotRequiredForParamVersion) { ThreadLocal<NoDefaultContructor> bar(NoDefaultContructor("foo")); bar.pointer(); } TEST(ThreadLocalTest, GetAndPointerReturnSameValue) { ThreadLocal<std::string> thread_local_string; EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get())); // Verifies the condition still holds after calling set. thread_local_string.set("foo"); EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get())); } TEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) { ThreadLocal<std::string> thread_local_string; const ThreadLocal<std::string>& const_thread_local_string = thread_local_string; EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer()); thread_local_string.set("foo"); EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer()); } #if GTEST_IS_THREADSAFE void AddTwo(int* param) { *param += 2; } TEST(ThreadWithParamTest, ConstructorExecutesThreadFunc) { int i = 40; ThreadWithParam<int*> thread(&AddTwo, &i, NULL); thread.Join(); EXPECT_EQ(42, i); } TEST(MutexDeathTest, AssertHeldShouldAssertWhenNotLocked) { // AssertHeld() is flaky only in the presence of multiple threads accessing // the lock. In this case, the test is robust. EXPECT_DEATH_IF_SUPPORTED({ Mutex m; { MutexLock lock(&m); } m.AssertHeld(); }, "thread .*hold"); } TEST(MutexTest, AssertHeldShouldNotAssertWhenLocked) { Mutex m; MutexLock lock(&m); m.AssertHeld(); } class AtomicCounterWithMutex { public: explicit AtomicCounterWithMutex(Mutex* mutex) : value_(0), mutex_(mutex), random_(42) {} void Increment() { MutexLock lock(mutex_); int temp = value_; { // Locking a mutex puts up a memory barrier, preventing reads and // writes to value_ rearranged when observed from other threads. // // We cannot use Mutex and MutexLock here or rely on their memory // barrier functionality as we are testing them here. pthread_mutex_t memory_barrier_mutex; GTEST_CHECK_POSIX_SUCCESS_( pthread_mutex_init(&memory_barrier_mutex, NULL)); GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_lock(&memory_barrier_mutex)); SleepMilliseconds(random_.Generate(30)); GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_unlock(&memory_barrier_mutex)); GTEST_CHECK_POSIX_SUCCESS_(pthread_mutex_destroy(&memory_barrier_mutex)); } value_ = temp + 1; } int value() const { return value_; } private: volatile int value_; Mutex* const mutex_; // Protects value_. Random random_; }; void CountingThreadFunc(pair<AtomicCounterWithMutex*, int> param) { for (int i = 0; i < param.second; ++i) param.first->Increment(); } // Tests that the mutex only lets one thread at a time to lock it. TEST(MutexTest, OnlyOneThreadCanLockAtATime) { Mutex mutex; AtomicCounterWithMutex locked_counter(&mutex); typedef ThreadWithParam<pair<AtomicCounterWithMutex*, int> > ThreadType; const int kCycleCount = 20; const int kThreadCount = 7; scoped_ptr<ThreadType> counting_threads[kThreadCount]; Notification threads_can_start; // Creates and runs kThreadCount threads that increment locked_counter // kCycleCount times each. for (int i = 0; i < kThreadCount; ++i) { counting_threads[i].reset(new ThreadType(&CountingThreadFunc, make_pair(&locked_counter, kCycleCount), &threads_can_start)); } threads_can_start.Notify(); for (int i = 0; i < kThreadCount; ++i) counting_threads[i]->Join(); // If the mutex lets more than one thread to increment the counter at a // time, they are likely to encounter a race condition and have some // increments overwritten, resulting in the lower then expected counter // value. EXPECT_EQ(kCycleCount * kThreadCount, locked_counter.value()); } template <typename T> void RunFromThread(void (func)(T), T param) { ThreadWithParam<T> thread(func, param, NULL); thread.Join(); } void RetrieveThreadLocalValue( pair<ThreadLocal<std::string>*, std::string*> param) { *param.second = param.first->get(); } TEST(ThreadLocalTest, ParameterizedConstructorSetsDefault) { ThreadLocal<std::string> thread_local_string("foo"); EXPECT_STREQ("foo", thread_local_string.get().c_str()); thread_local_string.set("bar"); EXPECT_STREQ("bar", thread_local_string.get().c_str()); std::string result; RunFromThread(&RetrieveThreadLocalValue, make_pair(&thread_local_string, &result)); EXPECT_STREQ("foo", result.c_str()); } // DestructorTracker keeps track of whether its instances have been // destroyed. static std::vector<bool> g_destroyed; class DestructorTracker { public: DestructorTracker() : index_(GetNewIndex()) {} DestructorTracker(const DestructorTracker& /* rhs */) : index_(GetNewIndex()) {} ~DestructorTracker() { // We never access g_destroyed concurrently, so we don't need to // protect the write operation under a mutex. g_destroyed[index_] = true; } private: static int GetNewIndex() { g_destroyed.push_back(false); return g_destroyed.size() - 1; } const int index_; }; typedef ThreadLocal<DestructorTracker>* ThreadParam; void CallThreadLocalGet(ThreadParam thread_local_param) { thread_local_param->get(); } // Tests that when a ThreadLocal object dies in a thread, it destroys // the managed object for that thread. TEST(ThreadLocalTest, DestroysManagedObjectForOwnThreadWhenDying) { g_destroyed.clear(); { // The next line default constructs a DestructorTracker object as // the default value of objects managed by thread_local_tracker. ThreadLocal<DestructorTracker> thread_local_tracker; ASSERT_EQ(1U, g_destroyed.size()); ASSERT_FALSE(g_destroyed[0]); // This creates another DestructorTracker object for the main thread. thread_local_tracker.get(); ASSERT_EQ(2U, g_destroyed.size()); ASSERT_FALSE(g_destroyed[0]); ASSERT_FALSE(g_destroyed[1]); } // Now thread_local_tracker has died. It should have destroyed both the // default value shared by all threads and the value for the main // thread. ASSERT_EQ(2U, g_destroyed.size()); EXPECT_TRUE(g_destroyed[0]); EXPECT_TRUE(g_destroyed[1]); g_destroyed.clear(); } // Tests that when a thread exits, the thread-local object for that // thread is destroyed. TEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) { g_destroyed.clear(); { // The next line default constructs a DestructorTracker object as // the default value of objects managed by thread_local_tracker. ThreadLocal<DestructorTracker> thread_local_tracker; ASSERT_EQ(1U, g_destroyed.size()); ASSERT_FALSE(g_destroyed[0]); // This creates another DestructorTracker object in the new thread. ThreadWithParam<ThreadParam> thread( &CallThreadLocalGet, &thread_local_tracker, NULL); thread.Join(); // Now the new thread has exited. The per-thread object for it // should have been destroyed. ASSERT_EQ(2U, g_destroyed.size()); ASSERT_FALSE(g_destroyed[0]); ASSERT_TRUE(g_destroyed[1]); } // Now thread_local_tracker has died. The default value should have been // destroyed too. ASSERT_EQ(2U, g_destroyed.size()); EXPECT_TRUE(g_destroyed[0]); EXPECT_TRUE(g_destroyed[1]); g_destroyed.clear(); } TEST(ThreadLocalTest, ThreadLocalMutationsAffectOnlyCurrentThread) { ThreadLocal<std::string> thread_local_string; thread_local_string.set("Foo"); EXPECT_STREQ("Foo", thread_local_string.get().c_str()); std::string result; RunFromThread(&RetrieveThreadLocalValue, make_pair(&thread_local_string, &result)); EXPECT_TRUE(result.empty()); } #endif // GTEST_IS_THREADSAFE } // namespace internal } // namespace testing
[ "kai.wolf@gmail.com" ]
kai.wolf@gmail.com
0f3484457a8aea3cf0a2d3e6085acd1a448a8176
64d8b83603bb04b9022bf6d1776f3a3593d3ac7d
/unit_test/EnTT/Test_EnTT.cpp
7aa62e9534ab0bf4023aea3fd3666a53693a7bb5
[ "MIT" ]
permissive
nitishingde/yaui
a2c7244bce6ec802936ba8d252c38d2db412d09e
47698857e026b451bfac1dd0204fa38b2d377540
refs/heads/master
2021-06-14T04:54:42.594569
2020-12-15T14:39:58
2020-12-15T14:39:58
191,589,819
0
0
null
null
null
null
UTF-8
C++
false
false
313
cpp
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file #include "catch2/catch.hpp" #include "entt/entt.hpp" #include <iostream> TEST_CASE("Initialization of EnTT", "[init]") { entt::registry *reg = new entt::registry(); CHECK(reg != nullptr); delete reg; }
[ "ngshingde@gmail.com" ]
ngshingde@gmail.com
ded7379471bf7632f902c99987a938ef990085c8
cc94542e78e38567f9f0f891f8fa31996ea169cb
/ITMLib/Utils/ITMSceneParams.h
859875ab2de0bf145d714c8eececa14bec4c062a
[]
no_license
WSX741405/ITM
725700e57ff4d1e7cfe784b85c12f25597df87b2
78ad22bc19211d16d1a1db6b9df22b72600ffea1
refs/heads/master
2021-04-09T16:36:54.226544
2018-03-20T13:03:39
2018-03-20T13:03:39
125,861,673
0
0
null
null
null
null
UTF-8
C++
false
false
1,990
h
// Copyright 2014-2017 Oxford University Innovation Limited and the authors of ITM #pragma once namespace ITMLib { /** \brief Stores parameters of a scene like voxel size */ class ITMSceneParams { public: /// Size of a voxel, usually given in meters. float voxelSize; /** @{ */ /** \brief Fallback parameters: consider only parts of the scene from @p viewFrustum_min in front of the camera to a distance of @p viewFrustum_max. Usually the actual depth range should be determined automatically by a ITMLib::Engine::ITMVisualisationEngine. */ float viewFrustum_min, viewFrustum_max; /** @} */ /** \brief Encodes the width of the band of the truncated signed distance transform that is actually stored in the volume. This is again usually specified in meters. The resulting width in voxels is @ref mu divided by @ref voxelSize. */ float mu; /** \brief Up to @ref maxW observations per voxel are averaged. Beyond that a sliding average is computed. */ int maxW; /** Stop integration once maxW has been reached. */ bool stopIntegratingAtMaxW; ITMSceneParams(void) {} ITMSceneParams(float mu, int maxW, float voxelSize, float viewFrustum_min, float viewFrustum_max, bool stopIntegratingAtMaxW) { this->mu = mu; this->maxW = maxW; this->voxelSize = voxelSize; this->viewFrustum_min = viewFrustum_min; this->viewFrustum_max = viewFrustum_max; this->stopIntegratingAtMaxW = stopIntegratingAtMaxW; } explicit ITMSceneParams(const ITMSceneParams *sceneParams) { this->SetFrom(sceneParams); } void SetFrom(const ITMSceneParams *sceneParams) { this->voxelSize = sceneParams->voxelSize; this->viewFrustum_min = sceneParams->viewFrustum_min; this->viewFrustum_max = sceneParams->viewFrustum_max; this->mu = sceneParams->mu; this->maxW = sceneParams->maxW; this->stopIntegratingAtMaxW = sceneParams->stopIntegratingAtMaxW; } }; }
[ "wsx741405@gmail.com" ]
wsx741405@gmail.com
d9741621c329989185baccfc166c4b8d10392ab6
d39ae1b1339634388b0ba8b7cdc1ae8ca7b45a8f
/3. Dynamic Programing/Mariano and Luisito.cc
d48db7410614e13ad74786971a9c6c1aed981386
[]
no_license
delefme/Algorismia
56840375ba866a51731702428f1535b0fd27cf5a
744412a6cc2061b2a15b0d1dd1012cb4c43fc29b
refs/heads/master
2022-12-02T22:10:45.809243
2020-08-08T20:35:11
2020-08-08T20:35:11
286,115,880
1
0
null
2020-08-08T20:38:06
2020-08-08T20:38:05
null
UTF-8
C++
false
false
1,670
cc
#include <iostream> #include <vector> using namespace std; int main() { int W, L; while (cin >> W >> L) { vector<vector<int> > mat(L, vector<int> (W,-1)); for (int i = 0; i < L; ++i) { for (int j = 0; j < W; ++j) { char c; cin >> c; if (c == 'M') mat[i][j] = 0; if (c == 'T') mat[i][j] = -3; if (c == '*' or (i == 0 and c != 'M')) mat[i][j] = -2; } } for (int i = 1; i < L; ++i) { for (int j = 0; j < W; ++j) { if (mat[i][j] != -2) { int val = 0; if (mat[i][j] == -3) val = 3; if(j > 0 and mat[i-1][j-1] != -2) mat[i][j] = mat[i-1][j-1] + 1; if(mat[i-1][j] != -2) { if(mat[i][j] < 0) mat[i][j] = mat[i-1][j]; else mat[i][j] = min(mat[i][j],mat[i-1][j]); } if(j < W - 1 and mat[i-1][j+1] != -2) { if(mat[i][j] < 0) mat[i][j] = mat[i-1][j+1] + 1; else mat[i][j] = min(mat[i][j],mat[i-1][j+1] + 1); } if (mat[i][j] < 0) mat[i][j] = -2; else mat[i][j] += val; } } } int minim = -2; for (int i = 0; i < W; ++i) { if (minim < 0 and mat[L-1][i] >= 0) minim = mat[L-1][i]; else if(minim >= 0 and mat[L-1][i] >= 0) minim = min(minim, mat[L-1][i]); } if(minim < 0) cout << "IMPOSSIBLE" << endl; else cout << minim << endl; } }
[ "noreply@github.com" ]
delefme.noreply@github.com
f0a91cef27572012fd80398356a730452b80fd62
d6e0e7b7597d74bb28f45ca352b40bd66e8bc1b3
/sync_tcp_client/sync_tcp_client.cpp
5efcbaa5d67c9e616462f283341d258b3db34f5d
[]
no_license
benzispawn/network__boost.asio
a40fdc371c15636f9faad7e66a15d0f65aa40dc3
8635927754ca436ee33c405fbc64ee0c7d96fad4
refs/heads/main
2023-01-10T14:16:59.293770
2020-11-11T03:08:28
2020-11-11T03:08:28
311,507,968
0
0
null
null
null
null
UTF-8
C++
false
false
799
cpp
#include "sync_tcp_client.h" int main() { const std::string raw_ip_address = "127.0.0.1"; const unsigned short port_num = 3333; try { SyncTCPClient client(raw_ip_address, port_num); client.connect(); std::cout << "Sending request to the server..." << std::endl; std::string response = client.emulateLongComputationOp(10); std::cout << "Response received: " << response << std::endl; // Close client client.close(); } catch(boost::system::system_error &e) { std::cout << "Error occured! Error code = " << e.code() << ". Message: " << e.what(); return e.code().value(); } return 0; }
[ "spawnbenzi@gmail.com" ]
spawnbenzi@gmail.com
a7543702cd41752d9089994e0ac5d9428da87aeb
a44a67ae800e785b9cd2d677668836d8564df0c5
/android-jni/jni/boost/variant/variant.hpp
b623baae5bfb003324241eb7e8b9349ea9d54a6f
[ "MIT" ]
permissive
thanghoang/S3ORAM
a6809dfb98fdbf0089e6b1c01eb4a8476852668e
ae524107508c03ec45a37b388f069cd8c40242a9
refs/heads/master
2022-11-02T08:03:28.101304
2022-10-24T20:55:08
2022-10-24T20:55:08
101,727,862
20
9
MIT
2022-10-24T20:53:47
2017-08-29T06:38:10
C++
UTF-8
C++
false
false
66,748
hpp
//----------------------------------------------------------------------------- // boost variant/variant.hpp header file // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // // Copyright (c) 2002-2003 // Eric Friedman, Itay Maman // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_VARIANT_VARIANT_HPP #define BOOST_VARIANT_VARIANT_HPP #include <cstddef> // for std::size_t #include <new> // for placement new #if !defined(BOOST_NO_TYPEID) #include <typeinfo> // for typeid, std::type_info #endif // BOOST_NO_TYPEID #include "boost/variant/detail/config.hpp" #include "boost/mpl/aux_/config/eti.hpp" #include "boost/mpl/aux_/value_wknd.hpp" #include "boost/variant/variant_fwd.hpp" #include "boost/variant/detail/backup_holder.hpp" #include "boost/variant/detail/enable_recursive_fwd.hpp" #include "boost/variant/detail/forced_return.hpp" #include "boost/variant/detail/initializer.hpp" #include "boost/variant/detail/make_variant_list.hpp" #include "boost/variant/detail/over_sequence.hpp" #include "boost/variant/detail/visitation_impl.hpp" #include "boost/variant/detail/hash_variant.hpp" #include "boost/variant/detail/generic_result_type.hpp" #include "boost/variant/detail/has_nothrow_move.hpp" #include "boost/variant/detail/move.hpp" #include "boost/detail/reference_content.hpp" #include "boost/aligned_storage.hpp" #include "boost/blank.hpp" #include "boost/math/common_factor_ct.hpp" #include "boost/static_assert.hpp" #include "boost/preprocessor/cat.hpp" #include "boost/preprocessor/repeat.hpp" #include "boost/type_traits/alignment_of.hpp" #include "boost/type_traits/add_const.hpp" #include "boost/type_traits/has_nothrow_constructor.hpp" #include "boost/type_traits/has_nothrow_copy.hpp" #include "boost/type_traits/is_const.hpp" #include "boost/type_traits/is_same.hpp" #include "boost/type_traits/is_rvalue_reference.hpp" #include "boost/utility/enable_if.hpp" #include "boost/utility/declval.hpp" #include "boost/variant/recursive_wrapper_fwd.hpp" #include "boost/variant/static_visitor.hpp" #include "boost/mpl/assert.hpp" #include "boost/mpl/begin_end.hpp" #include "boost/mpl/bool.hpp" #include "boost/mpl/deref.hpp" #include "boost/mpl/empty.hpp" #include "boost/mpl/eval_if.hpp" #include "boost/mpl/find_if.hpp" #include "boost/mpl/fold.hpp" #include "boost/mpl/front.hpp" #include "boost/mpl/identity.hpp" #include "boost/mpl/if.hpp" #include "boost/mpl/int.hpp" #include "boost/mpl/is_sequence.hpp" #include "boost/mpl/iterator_range.hpp" #include "boost/mpl/iter_fold_if.hpp" #include "boost/mpl/logical.hpp" #include "boost/mpl/max_element.hpp" #include "boost/mpl/next.hpp" #include "boost/mpl/not.hpp" #include "boost/mpl/pair.hpp" #include "boost/mpl/protect.hpp" #include "boost/mpl/push_front.hpp" #include "boost/mpl/same_as.hpp" #include "boost/mpl/size_t.hpp" #include "boost/mpl/sizeof.hpp" #include "boost/mpl/transform.hpp" /////////////////////////////////////////////////////////////////////////////// // Implementation Macros: // // BOOST_VARIANT_VISITATION_UNROLLING_LIMIT // Defined in boost/variant/detail/visitation_impl.hpp. // // BOOST_VARIANT_MINIMIZE_SIZE // When #defined, implementation employs all known means to minimize the // size of variant obje cts. However, often unsuccessful due to alignment // issues, and potentially harmful to runtime speed, so not enabled by // default. (TODO: Investigate further.) #if defined(BOOST_VARIANT_MINIMIZE_SIZE) # include <climits> // for SCHAR_MAX # include "boost/mpl/eval_if.hpp" # include "boost/mpl/equal_to.hpp" # include "boost/mpl/identity.hpp" # include "boost/mpl/int.hpp" # include "boost/mpl/if.hpp" # include "boost/mpl/less.hpp" # include "boost/mpl/long.hpp" # include "boost/mpl/O1_size.hpp" #endif namespace boost { namespace detail { namespace variant { /////////////////////////////////////////////////////////////////////////////// // (detail) metafunction max_value // // Finds the maximum value of the unary metafunction F over Sequence. // template <typename Sequence, typename F> struct max_value { private: // helpers, for metafunction result (below) typedef typename mpl::transform1<Sequence, F>::type transformed_; typedef typename mpl::max_element<transformed_ >::type max_it; public: // metafunction result typedef typename mpl::deref<max_it>::type type; }; struct add_alignment { template <typename State, typename Item> struct apply : mpl::size_t< ::boost::math::static_lcm< BOOST_MPL_AUX_VALUE_WKND(State)::value , ::boost::alignment_of<Item>::value >::value > {}; }; /////////////////////////////////////////////////////////////////////////////// // (detail) metafunction find_fallback_type // // Provides a fallback (i.e., nothrow default-constructible) type from the // specified sequence, or no_fallback_type if not found. // // This implementation is designed to prefer boost::blank over other potential // fallback types, regardless of its position in the specified sequence. // class no_fallback_type; struct find_fallback_type_pred { template <typename Iterator> struct apply { private: typedef typename mpl::deref<Iterator>::type t_; public: typedef mpl::not_< has_nothrow_constructor<t_> > type; }; }; template <typename Types> struct find_fallback_type { private: // helpers, for metafunction result (below) typedef typename mpl::end<Types>::type end_it; // [Find the first suitable fallback type...] typedef typename mpl::iter_fold_if< Types , mpl::int_<0>, mpl::protect< mpl::next<> > , mpl::protect< find_fallback_type_pred > >::type first_result_; typedef typename first_result_::first first_result_index; typedef typename first_result_::second first_result_it; // [...now search the rest of the sequence for boost::blank...] typedef typename mpl::iter_fold_if< mpl::iterator_range< first_result_it,end_it > , first_result_index, mpl::protect< mpl::next<> > , mpl::protect< mpl::not_same_as<boost::blank> > >::type second_result_; typedef typename second_result_::second second_result_it; public: // metafunction result // [...and return the results of the search:] typedef typename mpl::eval_if< is_same< second_result_it,end_it > , mpl::if_< is_same< first_result_it,end_it > , mpl::pair< no_fallback_type,no_fallback_type > , first_result_ > , mpl::identity< second_result_ > >::type type; }; #if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG) template<> struct find_fallback_type<int> { typedef mpl::pair< no_fallback_type,no_fallback_type > type; }; #endif // BOOST_MPL_CFG_MSVC_60_ETI_BUG workaround /////////////////////////////////////////////////////////////////////////////// // (detail) metafunction make_storage // // Provides an aligned storage type capable of holding any of the types // specified in the given type-sequence. // template <typename Types, typename NeverUsesBackupFlag> struct make_storage { private: // helpers, for metafunction result (below) typedef typename mpl::eval_if< NeverUsesBackupFlag , mpl::identity< Types > , mpl::push_front< Types, backup_holder<void*> > >::type types; typedef typename max_value< types, mpl::sizeof_<mpl::_1> >::type max_size; #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551)) typedef typename mpl::fold< types , mpl::size_t<1> , add_alignment >::type max_alignment; #else // borland // temporary workaround -- use maximal alignment typedef mpl::size_t< -1 > max_alignment; #endif // borland workaround public: // metafunction result #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) typedef ::boost::aligned_storage< BOOST_MPL_AUX_VALUE_WKND(max_size)::value , BOOST_MPL_AUX_VALUE_WKND(max_alignment)::value > type; #else // MSVC7 and below BOOST_STATIC_CONSTANT(std::size_t, msvc_max_size_c = max_size::value); BOOST_STATIC_CONSTANT(std::size_t, msvc_max_alignment_c = max_alignment::value); typedef ::boost::aligned_storage< msvc_max_size_c , msvc_max_alignment_c > type; #endif // MSVC workaround }; #if defined(BOOST_MPL_CFG_MSVC_60_ETI_BUG) template<> struct make_storage<int,int> { typedef int type; }; #endif // BOOST_MPL_CFG_MSVC_60_ETI_BUG workaround /////////////////////////////////////////////////////////////////////////////// // (detail) class destroyer // // Internal visitor that destroys the value it visits. // struct destroyer : public static_visitor<> { public: // visitor interfaces template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(T& operand, int) const { operand.~T(); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551)) || \ BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) operand; // suppresses warnings #endif BOOST_VARIANT_AUX_RETURN_VOID; } }; /////////////////////////////////////////////////////////////////////////////// // (detail) class template known_get // // Visitor that returns a reference to content of the specified type. // // Precondition: visited variant MUST contain logical content of type T. // template <typename T> class known_get : public static_visitor<T&> { #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) public: // visitor interface T& operator()(T& operand) const BOOST_NOEXCEPT { return operand; } template <typename U> T& operator()(U&) const { // logical error to be here: see precondition above BOOST_ASSERT(false); return ::boost::detail::variant::forced_return< T& >(); } #else // MSVC6 private: // helpers, for visitor interface (below) T& execute(T& operand, mpl::true_) const { return operand; } template <typename U> T& execute(U& operand, mpl::false_) const { // logical error to be here: see precondition above BOOST_ASSERT(false); return ::boost::detail::variant::forced_return< T& >(); } public: // visitor interface template <typename U> T& operator()(U& operand) const { typedef typename is_same< U,T >::type U_is_T; return execute(operand, U_is_T()); } #endif // MSVC6 workaround }; /////////////////////////////////////////////////////////////////////////////// // (detail) class copy_into // // Internal visitor that copies the value it visits into the given buffer. // class copy_into : public static_visitor<> { private: // representation void* storage_; public: // structors explicit copy_into(void* storage) BOOST_NOEXCEPT : storage_(storage) { } public: // internal visitor interface template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const { new(storage_) T( operand.get() ); BOOST_VARIANT_AUX_RETURN_VOID; } template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(const boost::detail::variant::backup_holder<T>& operand, long) const { new(storage_) T( operand.get() ); BOOST_VARIANT_AUX_RETURN_VOID; } template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(const T& operand, int) const { new(storage_) T(operand); BOOST_VARIANT_AUX_RETURN_VOID; } }; /////////////////////////////////////////////////////////////////////////////// // (detail) class move_into // // Internal visitor that moves the value it visits into the given buffer. // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES class move_into : public static_visitor<> { private: // representation void* storage_; public: // structors explicit move_into(void* storage) BOOST_NOEXCEPT : storage_(storage) { } public: // internal visitor interface template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const { new(storage_) T( ::boost::detail::variant::move(operand.get()) ); BOOST_VARIANT_AUX_RETURN_VOID; } template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(T& operand, int) const BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(T(boost::declval<T>()))) { new(storage_) T(::boost::detail::variant::move(operand)); BOOST_VARIANT_AUX_RETURN_VOID; } }; #endif /////////////////////////////////////////////////////////////////////////////// // (detail) class assign_storage // // Internal visitor that assigns the given storage (which must be a // constructed value of the same type) to the value it visits. // struct assign_storage : public static_visitor<> { private: // representation const void* rhs_storage_; public: // structors explicit assign_storage(const void* rhs_storage) BOOST_NOEXCEPT : rhs_storage_(rhs_storage) { } public: // internal visitor interfaces template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(backup_holder<T>& lhs_content, long) const { lhs_content.get() = static_cast< const backup_holder<T>* >(rhs_storage_)->get(); BOOST_VARIANT_AUX_RETURN_VOID; } template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(const backup_holder<T>& lhs_content, long) const { lhs_content.get() = static_cast< const backup_holder<T>* >(rhs_storage_)->get(); BOOST_VARIANT_AUX_RETURN_VOID; } template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(T& lhs_content, int) const { // NOTE TO USER : // Compile error here indicates one of variant's bounded types does // not meet the requirements of the Assignable concept. Thus, // variant is not Assignable. // // Hint: Are any of the bounded types const-qualified or references? // lhs_content = *static_cast< const T* >(rhs_storage_); BOOST_VARIANT_AUX_RETURN_VOID; } }; /////////////////////////////////////////////////////////////////////////////// // (detail) class move_storage // // Internal visitor that moves the given storage (which must be a // constructed value of the same type) to the value it visits. // struct move_storage : public static_visitor<> { private: // representation void* rhs_storage_; public: // structors explicit move_storage(void* rhs_storage) BOOST_NOEXCEPT : rhs_storage_(rhs_storage) { } public: // internal visitor interfaces template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(backup_holder<T>& lhs_content, long) const { lhs_content.get() = ::boost::detail::variant::move(static_cast<backup_holder<T>* >(rhs_storage_)->get()); BOOST_VARIANT_AUX_RETURN_VOID; } template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(const backup_holder<T>& lhs_content, long) const { lhs_content.get() = ::boost::detail::variant::move(static_cast<backup_holder<T>* >(rhs_storage_)->get()); BOOST_VARIANT_AUX_RETURN_VOID; } template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(T& lhs_content, int) const { // NOTE TO USER : // Compile error here indicates one of variant's bounded types does // not meet the requirements of the Assignable concept. Thus, // variant is not Assignable. // // Hint: Are any of the bounded types const-qualified or references? // lhs_content = ::boost::detail::variant::move(*static_cast<T* >(rhs_storage_)); BOOST_VARIANT_AUX_RETURN_VOID; } }; /////////////////////////////////////////////////////////////////////////////// // (detail) class direct_assigner // // Generic static visitor that: if and only if the visited value is of the // specified type, assigns the given value to the visited value and returns // true; else returns false. // template <typename T> class direct_assigner : public static_visitor<bool> { private: // representation const T& rhs_; public: // structors explicit direct_assigner(const T& rhs) BOOST_NOEXCEPT : rhs_(rhs) { } #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) public: // visitor interface bool operator()(T& lhs) { lhs = rhs_; return true; } template <typename U> bool operator()(U&) BOOST_NOEXCEPT { return false; } #else // MSVC6 private: // helpers, for visitor interface (below) bool execute(T& lhs, mpl::true_) { lhs = rhs_; return true; } template <typename U> bool execute(U&, mpl::false_) { return false; } public: // visitor interface template <typename U> bool operator()(U& lhs) { typedef typename is_same<U,T>::type U_is_T; return execute(lhs, U_is_T()); } #endif // MSVC6 workaround #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) private: // silence MSVC warning C4512: assignment operator could not be generated direct_assigner& operator= (direct_assigner const&); #endif }; /////////////////////////////////////////////////////////////////////////////// // (detail) class direct_mover // // Generic static visitor that: if and only if the visited value is of the // specified type, move assigns the given value to the visited value and returns // true; else returns false. // template <typename T> class direct_mover : public static_visitor<bool> { private: // representation T& rhs_; public: // structors explicit direct_mover(T& rhs) BOOST_NOEXCEPT : rhs_(rhs) { } #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) public: // visitor interface bool operator()(T& lhs) { lhs = ::boost::detail::variant::move(rhs_); return true; } template <typename U> bool operator()(U&) BOOST_NOEXCEPT { return false; } #else // MSVC6 public: // visitor interface template <typename U> bool operator()(U& lhs) { // MSVC6 can not use direct_mover class return direct_assigner(rhs_)(lhs); } #endif // MSVC6 workaround #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) private: // silence MSVC warning C4512: assignment operator could not be generated direct_mover& operator= (direct_mover const&); #endif }; /////////////////////////////////////////////////////////////////////////////// // (detail) class backup_assigner // // Internal visitor that "assigns" the given value to the visited value, // using backup to recover if the destroy-copy sequence fails. // // NOTE: This needs to be a friend of variant, as it needs access to // indicate_which, indicate_backup_which, etc. // template <typename Variant> class backup_assigner : public static_visitor<> { private: // representation Variant& lhs_; int rhs_which_; const void* rhs_content_; void (*copy_rhs_content_)(void*, const void*); public: // structors template<class RhsT> backup_assigner(Variant& lhs, int rhs_which, const RhsT& rhs_content) : lhs_(lhs) , rhs_which_(rhs_which) , rhs_content_(&rhs_content) , copy_rhs_content_(&construct_impl<RhsT>) { } private: // helpers, for visitor interface (below) template<class RhsT> static void construct_impl(void* addr, const void* obj) { new(addr) RhsT(*static_cast<const RhsT*>(obj)); } template <typename LhsT> void backup_assign_impl( LhsT& lhs_content , mpl::true_// has_nothrow_move ) { // Move lhs content to backup... LhsT backup_lhs_content( ::boost::detail::variant::move(lhs_content) ); // nothrow // ...destroy lhs content... lhs_content.~LhsT(); // nothrow try { // ...and attempt to copy rhs content into lhs storage: copy_rhs_content_(lhs_.storage_.address(), rhs_content_); } catch (...) { // In case of failure, restore backup content to lhs storage... new(lhs_.storage_.address()) LhsT( ::boost::detail::variant::move(backup_lhs_content) ); // nothrow // ...and rethrow: throw; } // In case of success, indicate new content type: lhs_.indicate_which(rhs_which_); // nothrow } template <typename LhsT> void backup_assign_impl( LhsT& lhs_content , mpl::false_// has_nothrow_move ) { // Backup lhs content... LhsT* backup_lhs_ptr = new LhsT(lhs_content); // ...destroy lhs content... lhs_content.~LhsT(); // nothrow try { // ...and attempt to copy rhs content into lhs storage: copy_rhs_content_(lhs_.storage_.address(), rhs_content_); } catch (...) { // In case of failure, copy backup pointer to lhs storage... new(lhs_.storage_.address()) backup_holder<LhsT>( backup_lhs_ptr ); // nothrow // ...indicate now using backup... lhs_.indicate_backup_which( lhs_.which() ); // nothrow // ...and rethrow: throw; } // In case of success, indicate new content type... lhs_.indicate_which(rhs_which_); // nothrow // ...and delete backup: delete backup_lhs_ptr; // nothrow } public: // visitor interface template <typename LhsT> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(LhsT& lhs_content, int) { typedef typename has_nothrow_move_constructor<LhsT>::type nothrow_move; backup_assign_impl( lhs_content, nothrow_move() ); BOOST_VARIANT_AUX_RETURN_VOID; } #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) private: // silence MSVC warning C4512: assignment operator could not be generated backup_assigner& operator= (backup_assigner const&); #endif }; /////////////////////////////////////////////////////////////////////////////// // (detail) class swap_with // // Visitor that swaps visited value with content of given variant. // // Precondition: Given variant MUST have same logical type as visited value. // template <typename Variant> struct swap_with : public static_visitor<> { private: // representation Variant& toswap_; public: // structors explicit swap_with(Variant& toswap) : toswap_(toswap) { } public: // internal visitor interfaces template <typename T> void operator()(T& operand) const { // Since the precondition ensures types are same, get T... known_get<T> getter; T& other = toswap_.apply_visitor(getter); // ...and swap: ::boost::detail::variant::move_swap( operand, other ); } private: swap_with& operator=(const swap_with&); }; /////////////////////////////////////////////////////////////////////////////// // (detail) class reflect // // Generic static visitor that performs a typeid on the value it visits. // #if !defined(BOOST_NO_TYPEID) class reflect : public static_visitor<const std::type_info&> { public: // visitor interfaces template <typename T> const std::type_info& operator()(const T&) const BOOST_NOEXCEPT { return typeid(T); } }; #endif // BOOST_NO_TYPEID /////////////////////////////////////////////////////////////////////////////// // (detail) class comparer // // Generic static visitor that compares the content of the given lhs variant // with the visited rhs content using Comp. // // Precondition: lhs.which() == rhs.which() // template <typename Variant, typename Comp> class comparer : public static_visitor<bool> { private: // representation const Variant& lhs_; public: // structors explicit comparer(const Variant& lhs) BOOST_NOEXCEPT : lhs_(lhs) { } public: // visitor interfaces template <typename T> bool operator()(const T& rhs_content) const { // Since the precondition ensures lhs and rhs types are same, get T... known_get<const T> getter; const T& lhs_content = lhs_.apply_visitor(getter); // ...and compare lhs and rhs contents: return Comp()(lhs_content, rhs_content); } private: comparer& operator=(const comparer&); }; /////////////////////////////////////////////////////////////////////////////// // (detail) class equal_comp // // Generic function object compares lhs with rhs using operator==. // struct equal_comp { template <typename T> bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; } }; /////////////////////////////////////////////////////////////////////////////// // (detail) class less_comp // // Generic function object compares lhs with rhs using operator<. // struct less_comp { template <typename T> bool operator()(const T& lhs, const T& rhs) const { return lhs < rhs; } }; /////////////////////////////////////////////////////////////////////////////// // (detail) class template invoke_visitor // // Internal visitor that invokes the given visitor using: // * for wrappers (e.g., recursive_wrapper), the wrapper's held value. // * for all other values, the value itself. // template <typename Visitor> class invoke_visitor { private: // representation Visitor& visitor_; public: // visitor typedefs typedef typename Visitor::result_type result_type; public: // structors explicit invoke_visitor(Visitor& visitor) BOOST_NOEXCEPT : visitor_(visitor) { } #if !defined(BOOST_NO_VOID_RETURNS) public: // internal visitor interfaces template <typename T> result_type internal_visit(T& operand, int) { return visitor_(operand); } # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564)) template <typename T> result_type internal_visit(const T& operand, int) { return visitor_(operand); } # endif #else // defined(BOOST_NO_VOID_RETURNS) private: // helpers, for internal visitor interfaces (below) template <typename T> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) visit_impl(T& operand, mpl::false_) { return visitor_(operand); } template <typename T> BOOST_VARIANT_AUX_RETURN_VOID_TYPE visit_impl(T& operand, mpl::true_) { visitor_(operand); BOOST_VARIANT_AUX_RETURN_VOID; } public: // internal visitor interfaces template <typename T> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) internal_visit(T& operand, int) { typedef typename is_same<result_type, void>::type has_void_result_type; return visit_impl(operand, has_void_result_type()); } #endif // BOOST_NO_VOID_RETURNS) workaround public: // internal visitor interfaces, cont. template <typename T> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) internal_visit(boost::recursive_wrapper<T>& operand, long) { return internal_visit( operand.get(), 1L ); } template <typename T> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) internal_visit(const boost::recursive_wrapper<T>& operand, long) { return internal_visit( operand.get(), 1L ); } template <typename T> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) internal_visit(boost::detail::reference_content<T>& operand, long) { return internal_visit( operand.get(), 1L ); } template <typename T> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) internal_visit(const boost::detail::reference_content<T>& operand, long) { return internal_visit( operand.get(), 1L ); } template <typename T> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) internal_visit(boost::detail::variant::backup_holder<T>& operand, long) { return internal_visit( operand.get(), 1L ); } template <typename T> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) internal_visit(const boost::detail::variant::backup_holder<T>& operand, long) { return internal_visit( operand.get(), 1L ); } #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) private: // silence MSVC warning C4512: assignment operator could not be generated invoke_visitor& operator= (invoke_visitor const&); #endif }; }} // namespace detail::variant /////////////////////////////////////////////////////////////////////////////// // class template variant (concept inspired by Andrei Alexandrescu) // // See docs and boost/variant/variant_fwd.hpp for more information. // template < typename T0_ , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(typename T) > class variant { private: // helpers, for typedefs (below) typedef variant wknd_self_t; struct is_recursive_ : detail::variant::is_recursive_flag<T0_> { }; typedef typename mpl::eval_if< is_recursive_ , T0_ , mpl::identity< T0_ > >::type unwrapped_T0_; struct is_sequence_based_ : detail::variant::is_over_sequence<unwrapped_T0_> { }; #if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT) private: // helpers, for typedefs (below) typedef typename mpl::eval_if< is_sequence_based_ , unwrapped_T0_ // over_sequence<...>::type , detail::variant::make_variant_list< unwrapped_T0_ , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T) > >::type specified_types; BOOST_STATIC_ASSERT(( ::boost::mpl::not_< mpl::empty<specified_types> >::value )); typedef typename mpl::eval_if< is_recursive_ , mpl::transform< specified_types , mpl::protect< detail::variant::quoted_enable_recursive<wknd_self_t> > > , mpl::identity< specified_types > >::type recursive_enabled_types; public: // public typedefs typedef typename mpl::transform< recursive_enabled_types , unwrap_recursive<mpl::_1> >::type types; private: // internal typedefs typedef typename mpl::transform< recursive_enabled_types , mpl::protect< detail::make_reference_content<> > >::type internal_types; typedef typename mpl::front< internal_types >::type internal_T0; #else // defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT) private: // helpers, for typedefs (below) typedef unwrapped_T0_ T0; #define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS(z,N,_) \ typedef typename mpl::eval_if< \ is_recursive_ \ , detail::variant::enable_recursive< \ BOOST_PP_CAT(T,N) \ , wknd_self_t \ > \ , mpl::identity< BOOST_PP_CAT(T,N) > \ >::type BOOST_PP_CAT(recursive_enabled_T,N); \ /**/ BOOST_PP_REPEAT( BOOST_VARIANT_LIMIT_TYPES , BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS , _ ) #undef BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS #define BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS(z,N,_) \ typedef typename unwrap_recursive< \ BOOST_PP_CAT(recursive_enabled_T,N) \ >::type BOOST_PP_CAT(public_T,N); \ /**/ BOOST_PP_REPEAT( BOOST_VARIANT_LIMIT_TYPES , BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS , _ ) #undef BOOST_VARIANT_AUX_UNWRAP_RECURSIVE_TYPEDEFS public: // public typedefs typedef typename detail::variant::make_variant_list< BOOST_VARIANT_ENUM_PARAMS(public_T) >::type types; private: // helpers, for internal typedefs (below) #define BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS(z,N,_) \ typedef detail::make_reference_content< \ BOOST_PP_CAT(recursive_enabled_T,N) \ >::type BOOST_PP_CAT(internal_T,N); \ /**/ BOOST_PP_REPEAT( BOOST_VARIANT_LIMIT_TYPES , BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS , _ ) #undef BOOST_VARIANT_AUX_MAKE_REFERENCE_CONTENT_TYPEDEFS private: // internal typedefs typedef typename detail::variant::make_variant_list< BOOST_VARIANT_ENUM_PARAMS(internal_T) >::type internal_types; private: // static precondition assertions // NOTE TO USER : // variant< type-sequence > syntax is not supported on this compiler! // BOOST_MPL_ASSERT_NOT(( is_sequence_based_ )); #endif // BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT workaround private: // helpers, for representation (below) typedef typename detail::variant::find_fallback_type< internal_types >::type fallback_type_result_; typedef typename fallback_type_result_::first fallback_type_index_; typedef typename fallback_type_result_::second fallback_type_; struct has_fallback_type_ : mpl::not_< is_same< fallback_type_, detail::variant::no_fallback_type > > { }; typedef has_fallback_type_ never_uses_backup_flag; typedef typename detail::variant::make_storage< internal_types, never_uses_backup_flag >::type storage_t; private: // helpers, for representation (below) // which_ on: // * [0, size<internal_types>) indicates stack content // * [-size<internal_types>, 0) indicates pointer to heap backup // if which_ >= 0: // * then which() -> which_ // * else which() -> -(which_ + 1) #if !defined(BOOST_VARIANT_MINIMIZE_SIZE) typedef int which_t; #else // defined(BOOST_VARIANT_MINIMIZE_SIZE) // [if O1_size available, then attempt which_t size optimization...] // [select signed char if fewer than SCHAR_MAX types, else signed int:] typedef typename mpl::eval_if< mpl::equal_to< mpl::O1_size<internal_types>, mpl::long_<-1> > , mpl::identity< int > , mpl::if_< mpl::less< mpl::O1_size<internal_types>, mpl::int_<SCHAR_MAX> > , signed char , int > >::type which_t; #endif // BOOST_VARIANT_MINIMIZE_SIZE switch // representation -- private when possible #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) private: #else public: #endif which_t which_; storage_t storage_; void indicate_which(int which_arg) BOOST_NOEXCEPT { which_ = static_cast<which_t>( which_arg ); } void indicate_backup_which(int which_arg) BOOST_NOEXCEPT { which_ = static_cast<which_t>( -(which_arg + 1) ); } private: // helpers, for queries (below) bool using_backup() const BOOST_NOEXCEPT { return which_ < 0; } public: // queries int which() const BOOST_NOEXCEPT { // If using heap backup... if (using_backup()) // ...then return adjusted which_: return -(which_ + 1); // Otherwise, return which_ directly: return which_; } private: // helpers, for structors (below) struct initializer : BOOST_VARIANT_AUX_INITIALIZER_T( recursive_enabled_types, recursive_enabled_T ) { }; void destroy_content() { detail::variant::destroyer visitor; this->internal_apply_visitor(visitor); } public: // structors ~variant() { destroy_content(); } variant() { // NOTE TO USER : // Compile error from here indicates that the first bound // type is not default-constructible, and so variant cannot // support its own default-construction. // new( storage_.address() ) internal_T0(); indicate_which(0); // zero is the index of the first bounded type } private: // helpers, for structors, cont. (below) class convert_copy_into : public static_visitor<int> { private: // representation void* storage_; public: // structors explicit convert_copy_into(void* storage) BOOST_NOEXCEPT : storage_(storage) { } public: // internal visitor interfaces (below) template <typename T> int internal_visit(T& operand, int) const { // NOTE TO USER : // Compile error here indicates one of the source variant's types // cannot be unambiguously converted to the destination variant's // types (or that no conversion exists). // return initializer::initialize(storage_, operand); } # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0564)) template <typename T> result_type internal_visit(const T& operand, int) const { return initializer::initialize(storage_, operand); } # endif template <typename T> int internal_visit(boost::detail::reference_content<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(const boost::detail::reference_content<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(const boost::detail::variant::backup_holder<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(boost::recursive_wrapper<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(const boost::recursive_wrapper<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } }; friend class convert_copy_into; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES class convert_move_into : public static_visitor<int> { private: // representation void* storage_; public: // structors explicit convert_move_into(void* storage) BOOST_NOEXCEPT : storage_(storage) { } public: // internal visitor interfaces (below) template <typename T> int internal_visit(T& operand, int) const { // NOTE TO USER : // Compile error here indicates one of the source variant's types // cannot be unambiguously converted to the destination variant's // types (or that no conversion exists). // return initializer::initialize(storage_, detail::variant::move(operand) ); } template <typename T> int internal_visit(boost::detail::reference_content<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(const boost::detail::reference_content<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(boost::detail::variant::backup_holder<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(const boost::detail::variant::backup_holder<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(boost::recursive_wrapper<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } template <typename T> int internal_visit(const boost::recursive_wrapper<T>& operand, long) const { return internal_visit( operand.get(), 1L ); } }; friend class convert_move_into; #endif private: // helpers, for structors, below template <typename T> void convert_construct( T& operand , int , mpl::false_ = mpl::false_() // is_foreign_variant ) { // NOTE TO USER : // Compile error here indicates that the given type is not // unambiguously convertible to one of the variant's types // (or that no conversion exists). // indicate_which( initializer::initialize( storage_.address() , operand ) ); } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <typename T> typename boost::enable_if<boost::is_rvalue_reference<T&&> >::type convert_construct( T&& operand , int , mpl::false_ = mpl::false_() // is_foreign_variant ) { // NOTE TO USER : // Compile error here indicates that the given type is not // unambiguously convertible to one of the variant's types // (or that no conversion exists). // indicate_which( initializer::initialize( storage_.address() , detail::variant::move(operand) ) ); } #endif template <typename Variant> void convert_construct( Variant& operand , long , mpl::true_// is_foreign_variant ) { convert_copy_into visitor(storage_.address()); indicate_which( operand.internal_apply_visitor(visitor) ); } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <typename Variant> typename boost::enable_if<boost::is_rvalue_reference<Variant&&> >::type convert_construct( Variant&& operand , long , mpl::true_// is_foreign_variant ) { convert_move_into visitor(storage_.address()); indicate_which( operand.internal_apply_visitor(visitor) ); } #endif template <typename Variant> void convert_construct_variant(Variant& operand) { // [Determine if the given variant is itself a bounded type, or if its // content needs to be converted (i.e., it is a 'foreign' variant):] // typedef typename mpl::find_if< types , is_same< add_const<mpl::_1> , const Variant > >::type found_it; typedef typename mpl::end<types>::type not_found; typedef typename is_same< found_it, not_found >::type is_foreign_variant; // Convert construct from operand: convert_construct( operand, 1L , is_foreign_variant() ); } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <typename Variant> typename boost::enable_if<boost::is_rvalue_reference<Variant&&> >::type convert_construct_variant(Variant&& operand) { // [Determine if the given variant is itself a bounded type, or if its // content needs to be converted (i.e., it is a 'foreign' variant):] // typedef typename mpl::find_if< types , is_same< add_const<mpl::_1> , const Variant > >::type found_it; typedef typename mpl::end<types>::type not_found; typedef typename is_same< found_it, not_found >::type is_foreign_variant; // Convert move construct from operand: convert_construct( detail::variant::move(operand), 1L , is_foreign_variant() ); } #endif template <BOOST_VARIANT_ENUM_PARAMS(typename U)> void convert_construct( boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>& operand , long ) { convert_construct_variant(operand); } template <BOOST_VARIANT_ENUM_PARAMS(typename U)> void convert_construct( const boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>& operand , long ) { convert_construct_variant(operand); } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <BOOST_VARIANT_ENUM_PARAMS(typename U)> void convert_construct( boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>&& operand , long ) { convert_construct_variant( detail::variant::move(operand) ); } #endif public: // structors, cont. #if !defined(BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING) template <typename T> variant(const T& operand) { convert_construct(operand, 1L); } template <typename T> variant(T& operand) { convert_construct(operand, 1L); } #elif defined(BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND) // For compilers that cannot distinguish between T& and const T& in // template constructors, but do fully support SFINAE, we can workaround: template <typename T> variant(const T& operand) { convert_construct(operand, 1L); } template <typename T> variant( T& operand , typename enable_if< mpl::not_< is_const<T> > , void >::type* = 0 ) { convert_construct(operand, 1L); } #else // !defined(BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND) // For compilers that cannot distinguish between T& and const T& in // template constructors, and do NOT support SFINAE, we can't workaround: template <typename T> variant(const T& operand) { convert_construct(operand, 1L); } #endif // BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING workarounds #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <class T> variant(T&& operand, typename boost::enable_if<boost::is_rvalue_reference<T&&> >::type* = 0) { convert_construct( detail::variant::move(operand), 1L); } #endif public: // structors, cont. // [MSVC6 requires copy constructor appear after template constructors] variant(const variant& operand) { // Copy the value of operand into *this... detail::variant::copy_into visitor( storage_.address() ); operand.internal_apply_visitor(visitor); // ...and activate the *this's primary storage on success: indicate_which(operand.which()); } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES variant(variant&& operand) { // Move the value of operand into *this... detail::variant::move_into visitor( storage_.address() ); operand.internal_apply_visitor(visitor); // ...and activate the *this's primary storage on success: indicate_which(operand.which()); } #endif private: // helpers, for modifiers (below) # if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template <typename Variant> friend class detail::variant::backup_assigner; # endif // class assigner // // Internal visitor that "assigns" the visited value to the given variant // by appropriate destruction and copy-construction. // class assigner : public static_visitor<> { private: // representation variant& lhs_; int rhs_which_; public: // structors assigner(variant& lhs, int rhs_which) BOOST_NOEXCEPT : lhs_(lhs) , rhs_which_(rhs_which) { } private: // helpers, for internal visitor interface (below) template <typename RhsT, typename B1, typename B2> void assign_impl( const RhsT& rhs_content , mpl::true_// has_nothrow_copy , B1// has_nothrow_move_constructor , B2// has_fallback_type ) { // Destroy lhs's content... lhs_.destroy_content(); // nothrow // ...copy rhs content into lhs's storage... new(lhs_.storage_.address()) RhsT( rhs_content ); // nothrow // ...and indicate new content type: lhs_.indicate_which(rhs_which_); // nothrow } template <typename RhsT, typename B> void assign_impl( const RhsT& rhs_content , mpl::false_// has_nothrow_copy , mpl::true_// has_nothrow_move_constructor , B// has_fallback_type ) { // Attempt to make a temporary copy (so as to move it below)... RhsT temp(rhs_content); // ...and upon success destroy lhs's content... lhs_.destroy_content(); // nothrow // ...move the temporary copy into lhs's storage... new(lhs_.storage_.address()) RhsT( detail::variant::move(temp) ); // nothrow // ...and indicate new content type: lhs_.indicate_which(rhs_which_); // nothrow } template <typename RhsT> void assign_impl( const RhsT& rhs_content , mpl::false_// has_nothrow_copy , mpl::false_// has_nothrow_move_constructor , mpl::true_// has_fallback_type ) { // Destroy lhs's content... lhs_.destroy_content(); // nothrow try { // ...and attempt to copy rhs's content into lhs's storage: new(lhs_.storage_.address()) RhsT( rhs_content ); } catch (...) { // In case of failure, default-construct fallback type in lhs's storage... new (lhs_.storage_.address()) fallback_type_; // nothrow // ...indicate construction of fallback type... lhs_.indicate_which( BOOST_MPL_AUX_VALUE_WKND(fallback_type_index_)::value ); // nothrow // ...and rethrow: throw; } // In the event of success, indicate new content type: lhs_.indicate_which(rhs_which_); // nothrow } template <typename RhsT> void assign_impl( const RhsT& rhs_content , mpl::false_// has_nothrow_copy , mpl::false_// has_nothrow_move_constructor , mpl::false_// has_fallback_type ) { detail::variant::backup_assigner<wknd_self_t> visitor(lhs_, rhs_which_, rhs_content); lhs_.internal_apply_visitor(visitor); } public: // internal visitor interfaces template <typename RhsT> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(const RhsT& rhs_content, int) { typedef typename has_nothrow_copy<RhsT>::type nothrow_copy; typedef typename mpl::or_< // reduces compile-time nothrow_copy , detail::variant::has_nothrow_move_constructor<RhsT> >::type nothrow_move_constructor; assign_impl( rhs_content , nothrow_copy() , nothrow_move_constructor() , has_fallback_type_() ); BOOST_VARIANT_AUX_RETURN_VOID; } #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) private: // silence MSVC warning C4512: assignment operator could not be generated assigner& operator= (assigner const&); #endif }; friend class assigner; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES // class move_assigner // // Internal visitor that "move assigns" the visited value to the given variant // by appropriate destruction and move-construction. // class move_assigner : public static_visitor<> { private: // representation variant& lhs_; int rhs_which_; public: // structors move_assigner(variant& lhs, int rhs_which) BOOST_NOEXCEPT : lhs_(lhs) , rhs_which_(rhs_which) { } private: // helpers, for internal visitor interface (below) template <typename RhsT, typename B1, typename B2> void assign_impl( RhsT& rhs_content , mpl::true_// has_nothrow_copy , mpl::false_// has_nothrow_move_constructor , B2// has_fallback_type ) { // Destroy lhs's content... lhs_.destroy_content(); // nothrow // ...copy rhs content into lhs's storage... new(lhs_.storage_.address()) RhsT( rhs_content ); // nothrow // ...and indicate new content type: lhs_.indicate_which(rhs_which_); // nothrow } template <typename RhsT, typename B> void assign_impl( RhsT& rhs_content , mpl::true_// has_nothrow_copy , mpl::true_// has_nothrow_move_constructor , B// has_fallback_type ) { // ...destroy lhs's content... lhs_.destroy_content(); // nothrow // ...move the rhs_content into lhs's storage... new(lhs_.storage_.address()) RhsT( detail::variant::move(rhs_content) ); // nothrow // ...and indicate new content type: lhs_.indicate_which(rhs_which_); // nothrow } template <typename RhsT> void assign_impl( RhsT& rhs_content , mpl::false_// has_nothrow_copy , mpl::false_// has_nothrow_move_constructor , mpl::true_// has_fallback_type ) { // Destroy lhs's content... lhs_.destroy_content(); // nothrow try { // ...and attempt to copy rhs's content into lhs's storage: new(lhs_.storage_.address()) RhsT( detail::variant::move(rhs_content) ); } catch (...) { // In case of failure, default-construct fallback type in lhs's storage... new (lhs_.storage_.address()) fallback_type_; // nothrow // ...indicate construction of fallback type... lhs_.indicate_which( BOOST_MPL_AUX_VALUE_WKND(fallback_type_index_)::value ); // nothrow // ...and rethrow: throw; } // In the event of success, indicate new content type: lhs_.indicate_which(rhs_which_); // nothrow } template <typename RhsT> void assign_impl( const RhsT& rhs_content , mpl::false_// has_nothrow_copy , mpl::false_// has_nothrow_move_constructor , mpl::false_// has_fallback_type ) { detail::variant::backup_assigner<wknd_self_t> visitor(lhs_, rhs_which_, rhs_content); lhs_.internal_apply_visitor(visitor); } public: // internal visitor interfaces template <typename RhsT> BOOST_VARIANT_AUX_RETURN_VOID_TYPE internal_visit(RhsT& rhs_content, int) { typedef typename detail::variant::has_nothrow_move_constructor<RhsT>::type nothrow_move_constructor; typedef typename mpl::or_< // reduces compile-time nothrow_move_constructor , has_nothrow_copy<RhsT> >::type nothrow_copy; assign_impl( rhs_content , nothrow_copy() , nothrow_move_constructor() , has_fallback_type_() ); BOOST_VARIANT_AUX_RETURN_VOID; } #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600)) private: // silence MSVC warning C4512: assignment operator could not be generated move_assigner& operator= (move_assigner const&); #endif }; friend class move_assigner; #endif // BOOST_NO_CXX11_RVALUE_REFERENCES void variant_assign(const variant& rhs) { // If the contained types are EXACTLY the same... if (which_ == rhs.which_) { // ...then assign rhs's storage to lhs's content: detail::variant::assign_storage visitor(rhs.storage_.address()); this->internal_apply_visitor(visitor); } else { // Otherwise, perform general (copy-based) variant assignment: assigner visitor(*this, rhs.which()); rhs.internal_apply_visitor(visitor); } } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES void variant_assign(variant&& rhs) { // If the contained types are EXACTLY the same... if (which_ == rhs.which_) { // ...then move rhs's storage to lhs's content: detail::variant::move_storage visitor(rhs.storage_.address()); this->internal_apply_visitor(visitor); } else { // Otherwise, perform general (move-based) variant assignment: move_assigner visitor(*this, rhs.which()); rhs.internal_apply_visitor(visitor); } } #endif // BOOST_NO_CXX11_RVALUE_REFERENCES private: // helpers, for modifiers (below) template <typename T> void assign(const T& rhs) { // If direct T-to-T assignment is not possible... detail::variant::direct_assigner<T> direct_assign(rhs); if (this->apply_visitor(direct_assign) == false) { // ...then convert rhs to variant and assign: // // While potentially inefficient, the following construction of a // variant allows T as any type convertible to one of the bounded // types without excessive code redundancy. // variant temp(rhs); variant_assign( detail::variant::move(temp) ); } } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <typename T> void move_assign(T&& rhs) { // If direct T-to-T move assignment is not possible... detail::variant::direct_mover<T> direct_move(rhs); if (this->apply_visitor(direct_move) == false) { // ...then convert rhs to variant and assign: // // While potentially inefficient, the following construction of a // variant allows T as any type convertible to one of the bounded // types without excessive code redundancy. // variant temp( detail::variant::move(rhs) ); variant_assign( detail::variant::move(temp) ); } } #endif // BOOST_NO_CXX11_RVALUE_REFERENCES public: // modifiers #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <class T> typename boost::enable_if<boost::is_rvalue_reference<T&&>, variant& >::type operator=(T&& rhs) { move_assign( detail::variant::move(rhs) ); return *this; } #endif // BOOST_NO_CXX11_RVALUE_REFERENCES template <typename T> variant& operator=(const T& rhs) { assign(rhs); return *this; } // [MSVC6 requires copy assign appear after templated operator=] variant& operator=(const variant& rhs) { variant_assign(rhs); return *this; } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES variant& operator=(variant&& rhs) { variant_assign( detail::variant::move(rhs) ); return *this; } #endif // BOOST_NO_CXX11_RVALUE_REFERENCES void swap(variant& rhs) { // If the contained types are the same... if (which() == rhs.which()) { // ...then swap the values directly: detail::variant::swap_with<variant> visitor(rhs); this->apply_visitor(visitor); } else { // ...otherwise, perform general variant swap: variant tmp( detail::variant::move(rhs) ); rhs = detail::variant::move(*this); *this = detail::variant::move(tmp); } } public: // queries // // NOTE: member which() defined above. // bool empty() const BOOST_NOEXCEPT { return false; } #if !defined(BOOST_NO_TYPEID) const std::type_info& type() const { detail::variant::reflect visitor; return this->apply_visitor(visitor); } #endif public: // prevent comparison with foreign types #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) # define BOOST_VARIANT_AUX_FAIL_COMPARISON_RETURN_TYPE \ void #else // MSVC7 // // MSVC7 gives error about return types for above being different than // the true comparison operator overloads: // # define BOOST_VARIANT_AUX_FAIL_COMPARISON_RETURN_TYPE \ bool #endif // MSVC7 workaround template <typename U> BOOST_VARIANT_AUX_FAIL_COMPARISON_RETURN_TYPE operator==(const U&) const { BOOST_STATIC_ASSERT( false && sizeof(U) ); } template <typename U> BOOST_VARIANT_AUX_FAIL_COMPARISON_RETURN_TYPE operator<(const U&) const { BOOST_STATIC_ASSERT( false && sizeof(U) ); } public: // comparison operators // [MSVC6 requires these operators appear after template operators] bool operator==(const variant& rhs) const { if (this->which() != rhs.which()) return false; detail::variant::comparer< variant, detail::variant::equal_comp > visitor(*this); return rhs.apply_visitor(visitor); } bool operator<(const variant& rhs) const { // // Dirk Schreib suggested this collating order. // if (this->which() != rhs.which()) return this->which() < rhs.which(); detail::variant::comparer< variant, detail::variant::less_comp > visitor(*this); return rhs.apply_visitor(visitor); } // helpers, for visitation support (below) -- private when possible #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template < BOOST_VARIANT_ENUM_PARAMS(typename U) > friend class variant; private: #else// defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) public: #endif// !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template <typename Visitor, typename VoidPtrCV> static BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE( typename Visitor::result_type ) internal_apply_visitor_impl( int internal_which , int logical_which , Visitor& visitor , VoidPtrCV storage ) { typedef mpl::int_<0> first_which; typedef typename mpl::begin<internal_types>::type first_it; typedef typename mpl::end<internal_types>::type last_it; typedef detail::variant::visitation_impl_step< first_it, last_it > first_step; return detail::variant::visitation_impl( internal_which, logical_which , visitor, storage, mpl::false_() , never_uses_backup_flag() , static_cast<first_which*>(0), static_cast<first_step*>(0) ); } template <typename Visitor> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE( typename Visitor::result_type ) internal_apply_visitor(Visitor& visitor) { return internal_apply_visitor_impl( which_, which(), visitor, storage_.address() ); } template <typename Visitor> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE( typename Visitor::result_type ) internal_apply_visitor(Visitor& visitor) const { return internal_apply_visitor_impl( which_, which(), visitor, storage_.address() ); } public: // visitation support template <typename Visitor> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE( typename Visitor::result_type ) apply_visitor(Visitor& visitor) { detail::variant::invoke_visitor<Visitor> invoker(visitor); return this->internal_apply_visitor(invoker); } template <typename Visitor> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE( typename Visitor::result_type ) apply_visitor(Visitor& visitor) const { detail::variant::invoke_visitor<Visitor> invoker(visitor); return this->internal_apply_visitor(invoker); } }; // class variant /////////////////////////////////////////////////////////////////////////////// // metafunction make_variant_over // // See docs and boost/variant/variant_fwd.hpp for more information. // template <typename Types> struct make_variant_over { private: // precondition assertions #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) BOOST_STATIC_ASSERT(( ::boost::mpl::is_sequence<Types>::value )); #endif public: // metafunction result typedef variant< detail::variant::over_sequence< Types > > type; }; /////////////////////////////////////////////////////////////////////////////// // function template swap // // Swaps two variants of the same type (i.e., identical specification). // template < BOOST_VARIANT_ENUM_PARAMS(typename T) > inline void swap( variant< BOOST_VARIANT_ENUM_PARAMS(T) >& lhs , variant< BOOST_VARIANT_ENUM_PARAMS(T) >& rhs ) { lhs.swap(rhs); } } // namespace boost // implementation additions #if !defined(BOOST_NO_IOSTREAM) #include "boost/variant/detail/variant_io.hpp" #endif // BOOST_NO_IOSTREAM #endif // BOOST_VARIANT_VARIANT_HPP
[ "hoangmin@oregonstate.edu" ]
hoangmin@oregonstate.edu
498b5217859fd2d020bba53f50c9776f6795a84a
fcd5d7e0fcb55763afd03ea3d72ec441b9a9e2c7
/rocky/test/skull/OddTest.cpp
23e419108d32aec1836e99712e2f2079478b9b59
[]
no_license
ghjang/rocky
74f9f36c2a95d527fc0a0e877ff0a8ea36fefbb9
07b2de51a8b619d4d682c73023508b5eb5843061
refs/heads/master
2021-01-10T11:24:03.989558
2017-02-03T15:58:43
2017-02-03T15:58:43
45,999,680
1
0
null
null
null
null
UTF-8
C++
false
false
351
cpp
#include "../catch.hpp" #include "rocky/skull/Odd.h" TEST_CASE("Odd for std::integral_constant", "[skull]") { // expected compile-time error. //static_assert(Odd<std::tuple<>>()); static_assert(!Odd<int_c_t<0>>()); static_assert(Odd<int_c_t<1>>()); static_assert(!Odd<int_c_t<2>>()); static_assert(Odd<int_c_t<101>>()); }
[ "jmxexpert@hotmail.com" ]
jmxexpert@hotmail.com
1272fff024cf10a9afad039f1ff00bca3518035f
c40c0662fc17ab591fd4e766961fc5e224271fd4
/Algorithms/C++/Sorting/Selection_sort.cpp
9c4550c1d9c33463262c2de835be996e777c2a8f
[]
no_license
ShauryaChaubey/HacktoberFest2020
fcb60f67ad0a12f436ba7a88fe6a30849f2eb581
461a85f0da125b605f097a63e8e66de5d52fb491
refs/heads/master
2022-12-26T20:41:41.037418
2020-10-12T13:00:10
2020-10-12T13:00:10
302,106,294
0
0
null
2020-10-12T13:00:12
2020-10-07T17:09:13
HTML
UTF-8
C++
false
false
1,303
cpp
Selection Sort The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from unsorted part and putting it at the beginning. The algorithm maintains two subarrays in a given array. 1) The subarray which is already sorted. 2) Remaining subarray which is unsorted. In every iteration of selection sort, the minimum element (considering ascending order) from the unsorted subarray is picked and moved to the sorted subarray. Time Complexity: O(n2) as there are two nested loops. Auxiliary Space: O(1)The good thing about selection sort is it never makes more than O(n) swaps and can be useful when memory write is a costly operation. #include <bits/stdc++.h> using namespace std; void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp; *yp = temp; } void selectionSort(int arr[], int n) { int i, j, min_idx; // One by one move boundary of unsorted subarray for (i = 0; i < n-1; i++) { // Find the minimum element in unsorted array min_idx = i; for (j = i+1; j < n; j++) if (arr[j] < arr[min_idx]) min_idx = j; // Swap the found minimum element with the first element swap(&arr[min_idx], &arr[i]); } }
[ "noreply@github.com" ]
ShauryaChaubey.noreply@github.com
5aac5a697a0348eec5e1c25cfbdf3d0acf326271
13b14c9c75143bf2eda87cb4a41006a52dd6f02b
/Uva/Uva2008/123/123.cpp
33306aed88811f721ab558863eac9eac359f932e
[]
no_license
yutaka-watanobe/problem-solving
2c311ac856c79c20aef631938140118eb3bc3835
f0b92125494fbd3c8d203989ec9fef53f52ad4b4
refs/heads/master
2021-06-03T12:58:39.881107
2020-12-16T14:34:16
2020-12-16T14:34:16
94,963,754
0
1
null
null
null
null
UTF-8
C++
false
false
1,611
cpp
#include<iostream> #include<sstream> #include<string> #include<vector> #include<map> #include<algorithm> using namespace std; class Line{ public: int row, col; vector<string> words; string title; Line(){} void set(int r, int c, vector<string> w){ row = r; col = c; words = w; title = words[col]; } string getTitle(){ return words[col]; } bool operator < ( const Line &l ) const{ if ( title == l.title ){ if ( row == l.row ) return col == l.col; else return row < l.row; } else return title < l.title; } string toUpper(string str){ for ( int i = 0; i < str.size(); i++ ) str[i] = toupper(str[i]); return str; } void print(){ for ( int i = 0; i < words.size(); i++ ){ if ( i ) cout << " "; if ( i == col ) cout << toUpper(words[i]); else cout << words[i]; } cout << endl; } }; map<string, bool> IG; string toLower(string str){ for ( int i = 0; i < str.size(); i++ ) str[i] = tolower(str[i]); return str; } int main(){ string line; while(1){ getline(cin, line); if ( line == "::" ) break; IG[line] = true; } string word; vector<Line> L; while(1){ getline( cin , line ); if ( cin.eof() ) break; stringstream sin(line); vector<string> words; while( sin >> word) words.push_back(toLower(word)); for ( int i = 0; i < words.size(); i++ ){ if ( IG[words[i]] ) continue; L.push_back(Line()); L[L.size()-1].set(L.size()-1, i, words); } } sort( L.begin(), L.end() ); for ( int i = 0; i < L.size(); i++ ) L[i].print(); return 0; }
[ "y.watanobe@gmail.com" ]
y.watanobe@gmail.com
2938c0cd1613028516786a21709d527a58f0c436
a6d15c19698025ee007ed6b7b258a4de9eca40d2
/softwarecontest/src/GameLobby.h
52de347b2d18661bb8e998d37e4a04dae6d7823f
[]
no_license
dougreichard/software-contest-2013
109910cf837cc9ee46e1f3d8569b2086df49e62a
ec4c3ebae22f9530da8ebc4de280d8d3fd5da338
refs/heads/master
2021-01-13T02:10:37.063244
2013-02-28T17:10:37
2013-02-28T17:10:37
8,271,942
0
0
null
2023-08-29T18:19:55
2013-02-18T16:12:57
C
UTF-8
C++
false
false
408
h
#pragma once #include "Socket.h" #include <list> using namespace std; class GameClient; class GameLobby: public ServerSocket { public: void leave(GameClient* client); GameClient* getPlayerByName(string name); list<GameClient*>& getClients(); protected: virtual ClientSocket* AllocClient(); virtual void OnString(string s); protected: list<GameClient*> _clients; list<GameClient*> _goneclients; };
[ "doug.reichard+github@gmail.com" ]
doug.reichard+github@gmail.com
491da2437a921e528b30a12db347300ff964d18c
6546fda2718aa80b4cc9fc5f33e35ed619c0f604
/section 4 codes/GameState.hpp
62b3def3af23dc8f768e6dccaf4cf503aa7aa6d9
[ "MIT" ]
permissive
PacktPublishing/Building-Games-with-SFML
aa47a0e693a8d8eded1247e3bf1d27ef6271ed09
d79d787ea4e580fe158b92c57a97853f4bf8a656
refs/heads/master
2021-06-23T14:29:23.023006
2021-01-20T07:39:06
2021-01-20T07:39:06
188,033,642
11
3
null
null
null
null
UTF-8
C++
false
false
2,107
hpp
#ifndef PACWOMAN_GAMESTATE_HPP #define PACWOMAN_GAMESTATE_HPP #include "Maze.hpp" #include "PacWoman.hpp" #include "Ghost.hpp" #include <SFML/Graphics.hpp> class Game; class GameState { public: enum State { NoCoin, GetReady, Playing, Won, Lost, Count }; GameState (Game* game); Game* getGame() const; virtual void insertCoin()=0; virtual void pressButton()=0; virtual void moveStick(sf::Vector2i direction)=0; virtual void update(sf::Time delta)=0; virtual void draw(sf::RenderWindow& window)=0; private: Game* m_game; }; class NoCoinState : public GameState { public: NoCoinState (Game* game); void insertCoin(); void pressButton(); void moveStick(sf::Vector2i direction); void update(sf::Time Delta); void draw(sf::RenderWindow& window); private: sf::Text m_text; sf::Sprite m_sprite; bool m_displayText; }; class GetReadyState : public GameState { public: GetReadyState (Game* game); void insertCoin(); void pressButton(); void moveStick(sf::Vector2i direction); void update(sf::Time Delta); void draw(sf::RenderWindow& window); private: sf::Text m_text; }; class PlayingState : public GameState { public: PlayingState (Game* game); ~PlayingState(); void insertCoin(); void pressButton(); void moveStick(sf::Vector2i direction); void update(sf::Time Delta); void draw(sf::RenderWindow& window); private: PacWoman* m_pacWoman; std::vector<Ghost*> m_ghosts; //Ghost m_ghost; Maze m_maze; sf::View m_camera; }; class LostState : public GameState { public: LostState (Game* game); void insertCoin(); void pressButton(); void moveStick(sf::Vector2i direction); void update(sf::Time Delta); void draw(sf::RenderWindow& window); private: sf::Text m_text; sf::Time m_countDown; sf::Text m_countDownText; }; class WonState : public GameState { public: WonState (Game* game); void insertCoin(); void pressButton(); void moveStick(sf::Vector2i direction); void update(sf::Time Delta); void draw(sf::RenderWindow& window); private: sf::Text m_text; }; # endif // PACWOMAN_GAMESTATE_HPP
[ "noreply@github.com" ]
PacktPublishing.noreply@github.com
9326e7c7f1df0cbdb675cb90aa603e656d143fb5
e3dbb5424ac55ed2cbdde92be998dee4571ebceb
/math/gvec.tpp
4b92463a6993934ac6f75df8c3e74805b7691583
[]
no_license
ralismark/sd1
c027b8ead3465493dbd8c3474025cc0019546337
6290604bfa4dabc5d3183af6806b8d2a5ec18967
refs/heads/master
2021-08-19T11:52:10.966848
2017-01-02T11:14:08
2017-01-02T11:14:08
112,053,737
1
0
null
null
null
null
UTF-8
C++
false
false
3,811
tpp
#pragma once #include "gvec.hpp" template <typename T, size_t N> gvec<T, N>::gvec(T init) { for(size_t i = 0; i < N; ++i) { vals[i] = init; } } template <typename T, size_t N> gvec<T, N>::gvec(std::initializer_list<T> il) { auto it = il.begin(); for(size_t i = 0; i < il.size() && i < N; ++i) { vals[i] = *it++; } } template <typename T, size_t N> gvec<T, N> gvec<T, N>::operator+() const { return *this; } template <typename T, size_t N> gvec<T, N> gvec<T, N>::operator-() const { auto copy = *this; for(size_t i = 0; i < N; ++i) { copy.vals[i] = -copy.vals[i]; } return copy; } template <typename T, size_t N> gvec<T, N>& gvec<T, N>::operator+=(const gvec<T, N>& other) { for(size_t i = 0; i < N; ++i) { vals[i] += other.vals[i]; } return *this; } template <typename T, size_t N> gvec<T, N>& gvec<T, N>::operator-=(const gvec<T, N>& other) { for(size_t i = 0; i < N; ++i) { vals[i] -= other.vals[i]; } return *this; } template <typename T, size_t N> gvec<T, N>& gvec<T, N>::operator*=(const gvec<T, N>& other) { for(size_t i = 0; i < N; ++i) { vals[i] *= other.vals[i]; } return *this; } template <typename T, size_t N> gvec<T, N>& gvec<T, N>::operator/=(const gvec<T, N>& other) { for(size_t i = 0; i < N; ++i) { vals[i] /= other.vals[i]; } return *this; } template <typename T, size_t N> gvec<T, N> gvec<T, N>::operator+(gvec<T, N> other) const { return other += *this; } template <typename T, size_t N> gvec<T, N> gvec<T, N>::operator-(gvec<T, N> other) const { other -= *this; return -other; } template <typename T, size_t N> gvec<T, N> gvec<T, N>::operator*(gvec<T, N> other) const { return other *= *this; } template <typename T, size_t N> gvec<T, N> operator/(gvec<T, N> self, const gvec<T, N>& other) { return self /= other; } template <typename T, size_t N> gvec<T, N>& gvec<T, N>::operator*=(const T& other) { for(size_t i = 0; i < N; ++i) { vals[i] *= other; } return *this; } template <typename T, size_t N> gvec<T, N>& gvec<T, N>::operator/=(const T& other) { for(size_t i = 0; i < N; ++i) { vals[i] /= other; } return *this; } template <typename T, size_t N> gvec<T, N> operator*(gvec<T, N> self, const T& other) { return self *= other; } template <typename T, size_t N> gvec<T, N> operator/(gvec<T, N> self, const T& other) { return self /= other; } template <typename T, size_t N> gvec<T, N> operator*(const T& other, gvec<T, N> self) { return self *= other; } template <typename T, size_t N> bool gvec<T, N>::operator==(const gvec<T, N>& other) const { for(size_t i = 0; i < N; ++i) { if(vals[i] != other[i]) { return false; } } return true; } template <typename T, size_t N> bool gvec<T, N>::operator!=(const gvec<T, N>& other) const { return !(*this == other); } template <typename T, size_t N> typename detail::access<T, N>::type* gvec<T, N>::operator->() { return &access; } template <typename T, size_t N> const typename detail::access<T, N>::type* gvec<T, N>::operator->() const { return &access; } template <typename T, size_t N> const T& gvec<T, N>::operator[](size_t n) const { return vals[n]; } template <typename T, size_t N> T& gvec<T, N>::operator[](size_t n) { return vals[n]; } template <typename T, size_t N> std::ostream& operator<<(std::ostream& os, const gvec<T, N>& gv) { os << "[ "; for(size_t i = 0; i < N; ++i) { if(i != 0) { os << ", "; } os << gv[i]; } os << " ]"; return os; } template <typename T, size_t N> template <typename C> gvec<typename std::enable_if<std::is_convertible<T, C>::value, C>::type, N> gvec<T, N>::cast() const { gvec<C, N> out; for(size_t i = 0; i < N; ++i) { out[i] = vals[i]; } return out; } template <typename O, typename... T> gvec<O, sizeof...(T)> make_vec(T... vals) { gvec<O, sizeof...(T)> gv = {vals...}; return gv; }
[ "timmy.yao@outlook.com.au" ]
timmy.yao@outlook.com.au
a81bce621612542d5c5992a348d515b98879f9cd
dae907db0cf43b427fd1a456b338be3910fc5f90
/P84219_en_First_occurrence.cc
444eb96b05bec023f97f381e6d62a1ed81c7e5aa
[]
no_license
FranciOrtiz/jutge_problems
4c5c273ada09f20088b08287356bbb967a642e45
a838f6ad8995cf57ae6f11cc6beeb3f13fa7e55d
refs/heads/master
2022-12-23T20:33:43.775974
2020-09-24T09:49:10
2020-09-24T09:49:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
543
cc
#include <iostream> #include <cmath> #include <vector> using namespace std; int first_occurrence(double x, const vector<double>& v) { int L = 0, R = v.size()-1; while (L<=R) { int M = (L+R)/2; if (v[M]==x and v[M-1]!=x) return M; else if (v[M] < x) L = M+1; else R = M-1; } return -1; } int main () { vector <double> vv; int s; cin >> s; vv.resize(s); for (int i = 0; i < s; i++) cin >> vv[i]; double xx; cin >> xx; cout << first_occurrence(xx,vv) << endl; }
[ "abone9999@gmail.com" ]
abone9999@gmail.com
f7e028dc5f9b42de6e19aa1b4738c876156bc4b8
270d448184cbe958e6e6bb17a98b35c381e22d99
/objectOriented/lectures/examples/3-5-abstractClass.cpp
43ed3e5d82468ad038dd4d3da2d49ee2fbfbf69c
[]
no_license
jcjolley/school
016ffde715bb07f9ddc09f0c7c0cf4d59a2bd0b3
bab28da74b1baba32844ec19278feb11ab65c375
refs/heads/master
2021-05-01T11:58:47.576569
2016-07-20T15:03:10
2016-07-20T15:03:10
59,164,873
1
0
null
null
null
null
UTF-8
C++
false
false
2,004
cpp
/*********************************************************************** * This demo program is designed to: * Demonstrate pure Virtual Functions. Note that we cannot * create an object out of an abstract class so we will * get a compile error ************************************************************************/ #include <iostream> using namespace std; /***************************** * Base class * This is an abstract class because * of the pure virtual function *****************************/ class Base { public: /********************************************** * BASE :: METHOD * This is a pure virtual function (because of the = 0) * at the end of the method definition Thus the VTable * has a NULL pointer and the compiler will not allow us * create an object of type Base *********************************************/ virtual void method() = 0; }; /*************************** * Derived class **************************/ class Derived: public Base { public: /********************************************* * DERIVED :: METHOD * This is a derived class. Note that, though * it is defined in the class definition, it is not * an inline function. Virtual functions cannot * be inline *********************************************/ virtual void method() { cout << "Derived!\n"; } }; /********************************************************************** * main(): just a drive program to demonstrate the comile error **********************************************************************/ int main() { Base base; // compile error. Because Base is an Abstract Class due to the // pure virtual function method(), we cannot // instantiate an object of this type. // even if we could create an object called base, we would crash // here due to the NULL pointer in the VTable of Base base.method(); return 0; }
[ "jolleyboy@gmail.com" ]
jolleyboy@gmail.com
2d2b0f443cdac8bbfeaee086f83c5e2dd2ced49a
e65b5d37f2c6554746ceb2140c0ee634f49f1c7d
/source/ashespp/Image/Sampler.cpp
8966d1c0a6acc3b566f5735b13bdd36266cd7b5a
[ "MIT" ]
permissive
aviallon/Ashes
45b31826946efdb660199d34415fd610911fcdba
e6b9cd621c17ee6a95c90df61c5aae0f2edcb111
refs/heads/master
2022-05-31T17:14:38.058611
2020-04-25T17:17:16
2020-04-25T17:17:16
259,637,550
1
0
null
2020-04-28T12:58:24
2020-04-28T12:58:24
null
UTF-8
C++
false
false
692
cpp
/* This file belongs to Ashes. See LICENSE file in root folder. */ #include "ashespp/Image/Sampler.hpp" #include "ashespp/Core/Device.hpp" namespace ashes { Sampler::Sampler( Device const & device , SamplerCreateInfo createInfo ) : m_device{ device } , m_createInfo{ createInfo } { DEBUG_DUMP( m_info ); auto res = m_device.vkCreateSampler( m_device , &static_cast< VkSamplerCreateInfo const & >( m_createInfo ) , nullptr , &m_internal ); checkError( res, "Sampler creation" ); registerObject( m_device, "Sampler", this ); } Sampler::~Sampler() { unregisterObject( m_device, this ); m_device.vkDestroySampler( m_device , m_internal , nullptr ); } }
[ "noreply@github.com" ]
aviallon.noreply@github.com
d06b4f02bf9d1e0578cb7fdb10cd8341d137c130
f113b7f7695bf2f5c09e5e8afb28cc99ee06c63a
/include/DOTk_NonlinearCG/DOTk_LiuStorey.hpp
ecebe0aba8fcf8d466cfb6da62021cf5a5141aa0
[]
no_license
maguilo11/locus
501a074a12e260e2b9f0940a6eb389ad36aefb89
cbf926808493c621893cc11f124f813b9e0fcbde
refs/heads/master
2021-09-24T21:35:27.503003
2018-10-15T02:58:38
2018-10-15T02:58:38
72,475,433
1
0
null
null
null
null
UTF-8
C++
false
false
1,153
hpp
/* * DOTk_LiuStorey.hpp * * Created on: Sep 12, 2014 * Author: Miguel A. Aguilo Valentin */ #ifndef DOTK_LIUSTOREY_HPP_ #define DOTK_LIUSTOREY_HPP_ #include "DOTk_DescentDirection.hpp" namespace dotk { class DOTk_OptimizationDataMng; template<typename ScalarType> class Vector; class DOTk_LiuStorey : public dotk::DOTk_DescentDirection { public: DOTk_LiuStorey(); virtual ~DOTk_LiuStorey(); Real computeScaleFactor(const std::shared_ptr<dotk::Vector<Real> > & old_grad_, const std::shared_ptr<dotk::Vector<Real> > & new_grad_, const std::shared_ptr<dotk::Vector<Real> > & dir_); void getDirection(const std::shared_ptr<dotk::Vector<Real> > & old_grad_, const std::shared_ptr<dotk::Vector<Real> > & new_grad_, const std::shared_ptr<dotk::Vector<Real> > & dir_); virtual void direction(const std::shared_ptr<dotk::DOTk_OptimizationDataMng> & mng_); private: DOTk_LiuStorey(const dotk::DOTk_LiuStorey &); dotk::DOTk_LiuStorey & operator=(const dotk::DOTk_LiuStorey &); }; } #endif /* DOTK_LIUSTOREY_HPP_ */
[ "aguilo.miguel@gmail.com" ]
aguilo.miguel@gmail.com
06c6ad3183830022793d51e6c12d3d5bfafa41a1
c459ada4ee8a006f244757d9b14eaccc2f897c4f
/src/demo_apps/server/main.cc
b6fdb872bc1e64f5ad2512cf1a2cd0cd2d6d3fb4
[ "Apache-2.0" ]
permissive
rrozestw/smf
56133b24aab55847d53578dfbb186074c06e538f
1dafa1ed529134fd81e504129356cb252694a80f
refs/heads/master
2021-04-28T11:14:12.385041
2018-02-16T04:08:11
2018-02-16T23:46:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,939
cc
// Copyright (c) 2017 Alexander Gallego. All rights reserved. // #include <chrono> #include <iostream> #include <core/app-template.hh> #include <core/distributed.hh> #include "histogram/histogram_seastar_utils.h" #include "histogram/unique_histogram_adder.h" #include "platform/log.h" #include "rpc/filters/zstd_filter.h" #include "rpc/rpc_filter.h" #include "rpc/rpc_server.h" #include "flatbuffers/demo_service.smf.fb.h" class storage_service : public smf_gen::demo::SmfStorage { virtual seastar::future<smf::rpc_typed_envelope<smf_gen::demo::Response>> Get(smf::rpc_recv_typed_context<smf_gen::demo::Request> &&rec) final { smf::rpc_typed_envelope<smf_gen::demo::Response> data; // return the same payload if (rec) { data.data->name = rec->name()->c_str(); } data.envelope.set_status(200); return seastar::make_ready_future< smf::rpc_typed_envelope<smf_gen::demo::Response>>(std::move(data)); } }; void cli_opts(boost::program_options::options_description_easy_init o) { namespace po = boost::program_options; o("ip", po::value<std::string>()->default_value("127.0.0.1"), "ip to connect to"); o("port", po::value<uint16_t>()->default_value(20776), "port for service"); o("httpport", po::value<uint16_t>()->default_value(20777), "port for http stats service"); } int main(int args, char **argv, char **env) { std::setvbuf(stdout, nullptr, _IOLBF, 1024); seastar::distributed<smf::rpc_server> rpc; seastar::app_template app; cli_opts(app.add_options()); return app.run_deprecated(args, argv, [&] { seastar::engine().at_exit([&] { return rpc .map_reduce(smf::unique_histogram_adder(), &smf::rpc_server::copy_histogram) .then([](auto h) { LOG_INFO("Writing server histograms"); return smf::histogram_seastar_utils::write("server_hdr.hgrm", std::move(h)); }) .then([&rpc] { return rpc.stop(); }); }); auto &cfg = app.configuration(); smf::rpc_server_args args; args.ip = cfg["ip"].as<std::string>().c_str(); args.rpc_port = cfg["port"].as<uint16_t>(); args.http_port = cfg["httpport"].as<uint16_t>(); // Normal services would either use the defaults or something smarter // This triggers the memory pressure args.basic_req_size = 60 /*payload size*/; args.bloat_mult = 1; // no bloat args.memory_avail_per_core = static_cast<uint64_t>(0.9 * seastar::memory::stats().total_memory()); return rpc.start(args) .then([&rpc] { LOG_INFO("Registering smf_gen::demo::storage_service"); return rpc.invoke_on_all( &smf::rpc_server::register_service<storage_service>); }) .then([&rpc] { LOG_INFO("Invoking rpc start on all cores"); return rpc.invoke_on_all(&smf::rpc_server::start); }); }); }
[ "gallego.alexx@gmail.com" ]
gallego.alexx@gmail.com
d18c0a35b2c4d9f6920fcdb7a9ed8f59591b0f49
e13580c8245c231f80418a9711c4a1aff15e87b0
/Code/sieve.cpp
5743cfac88d04ef42966d3379df8e40c96727c23
[]
no_license
YsHaNgM/PrimeSieveCXX
ddc4046d67ca816ec55c54741369ef7c939272d0
8d7c3558db49ef091d523edf0c8963626ab10433
refs/heads/master
2022-12-31T09:32:48.096246
2020-10-21T11:25:17
2020-10-21T11:25:17
305,846,470
0
0
null
null
null
null
UTF-8
C++
false
false
1,803
cpp
#include <algorithm> #include <chrono> #include <cmath> #include <iostream> #include <memory> #ifdef _OPENMP #include <omp.h> #endif //#define NDEBUG // See README.md for instructions and information. using ptr = std::shared_ptr<int[]>; // gcc-7 is needed, for shared_ptr [] operand c++17 P0414R2 void filter(int &count, int &p, int *val) { *val *= (count % p); // if (*val == 1) // { // auto mod = (count % p); // switch (mod) // { // case 0: // *val = 0; // break; // default: // break; // } // } }; int main(int argc, char *argv[]) { #ifdef _OPENMP std::clock_t c_start = std::clock(); auto t_start = std::chrono::high_resolution_clock::now(); auto n = 1000; ptr numbers(new int[n + 1]); std::fill(numbers.get(), numbers.get() + n, 1); // #pragma omp parallel shared(numbers), firstprivate(n) { int bound = std::sqrt(n); // #pragma omp for for (auto p = 2; p <= bound; p++) { if (numbers[p] != 0) { for (int count = p * 2; count <= n; count++) { filter(count, p, numbers.get() + count); } } } } std::clock_t c_end = std::clock(); auto t_end = std::chrono::high_resolution_clock::now(); std::cout << std::fixed << "CPU time used: " << 1000.0 * (c_end - c_start) / CLOCKS_PER_SEC << " ms\n" << "Wall clock time passed: " << std::chrono::duration<double, std::milli>(t_end - t_start).count() << " ms\n"; for (auto i = 2; i <= n; i++) { if (numbers[i] != 0) { std::cout << i << " "; } } #endif return 0; }
[ "ysh788@gmail.com" ]
ysh788@gmail.com
019e5d90b98cf0044c34dc583a4eac6a72aabe88
78a483c9c75aef625bcc78bb1e9cc1edfce56127
/sci/LinearOT/linear-uniform.h
748d9ac458c17781b0c500e69eeb3c20d987da3f
[]
no_license
smog70151/SCI
4cf3255e998602738ef6ca8e0a44adbfbaca8bd8
d8819900793be5d2a95ba91a1e23be7136bc7316
refs/heads/master
2023-04-26T22:37:40.739371
2021-05-14T12:30:40
2021-05-14T12:30:40
346,612,600
0
0
null
null
null
null
UTF-8
C++
false
false
32,980
h
/* Authors: Nishant Kumar Copyright: Copyright (c) 2020 Microsoft Research Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef LINEAR_UNIFORM_H__ #define LINEAR_UNIFORM_H__ #include <iostream> #ifdef USE_EIGEN #include <Eigen/Dense> #endif #include "sci/OT/iknp.h" // Special case of LinearOT which works only for uniform bitwidth multiplication // Faster than LinearOT for uniform bitwidth matrix multiplication template <typename IO, typename intType, typename otType> class MatMulUniform { public: IO *io = nullptr; sci::OT<otType> *otImpl = nullptr; sci::OT<otType> *otImplRoleReversed = nullptr; int SCI_party; int bitlength; const uint32_t batchSizeOTs = 1ULL << 18; // This is the default size of the batch of OTs that will be // done in one go for matmul // This will be scaled appropriately to manage memory if the // matmul dimensions are too large. const uint64_t MaxMemToUseInBytes = 2.5 * (1 << 30); // 2.5 GiB intType moduloMask; MatMulUniform(int SCI_party, int bitlength, IO *io, sci::OT<otType> *otImpl, sci::OT<otType> *otImplRoleReversed) { this->SCI_party = SCI_party; assert(((SCI_party == 1) || (SCI_party == 2)) && "PartyNum should be 1 or 2."); this->bitlength = bitlength; this->io = io; assert(io != nullptr && "IO can't be nullptr."); assert(otImpl != nullptr && "otImpl can't be nullptr."); this->otImpl = otImpl; this->otImplRoleReversed = otImplRoleReversed; if (bitlength == 64) moduloMask = -1; else moduloMask = (1ULL << bitlength) - 1; } ~MatMulUniform() {} #ifdef USE_EIGEN void ideal_func_eigen(int s1, int s2, int s3, const intType *A, const intType *B, intType *C) { Eigen::Matrix<intType, Eigen::Dynamic, Eigen::Dynamic> eigen_a(s1, s2); Eigen::Matrix<intType, Eigen::Dynamic, Eigen::Dynamic> eigen_b(s2, s3); Eigen::Matrix<intType, Eigen::Dynamic, Eigen::Dynamic> eigen_c(s1, s3); for (int i = 0; i < s1; i++) { for (int j = 0; j < s2; j++) { eigen_a(i, j) = Arr2DIdxRowM(A, s1, s2, i, j); } } for (int i = 0; i < s2; i++) { for (int j = 0; j < s3; j++) { eigen_b(i, j) = Arr2DIdxRowM(B, s2, s3, i, j); } } eigen_c = eigen_a * eigen_b; for (int i = 0; i < s1; i++) { for (int j = 0; j < s3; j++) { Arr2DIdxRowM(C, s1, s3, i, j) = eigen_c(i, j); } } } #endif void ideal_func(int s1, int s2, int s3, const intType *A, const intType *B, intType *C) { #ifndef USE_EIGEN for (int i = 0; i < s1; i++) { for (int j = 0; j < s3; j++) { Arr2DIdxRowM(C, s1, s3, i, j) = 0; for (int k = 0; k < s2; k++) { Arr2DIdxRowM(C, s1, s3, i, j) += (Arr2DIdxRowM(A, s1, s2, i, k) * Arr2DIdxRowM(B, s2, s3, k, j)); } } } #else ideal_func_eigen(s1, s2, s3, A, B, C); #endif for (int i = 0; i < s1 * s3; i++) { C[i] = C[i] & moduloMask; } } void verifyMatmulShares(int s1, int s2, int s3, const intType *A_share, const intType *B_share, const intType *C_share) { if (SCI_party == sci::ALICE) { intType *A_temp_share = new intType[s1 * s2]; intType *B_temp_share = new intType[s2 * s3]; intType *C_temp_share = new intType[s1 * s3]; intType *C_clear = new intType[s1 * s3]; io->recv_data(A_temp_share, sizeof(intType) * s1 * s2); io->recv_data(B_temp_share, sizeof(intType) * s2 * s3); io->recv_data(C_temp_share, sizeof(intType) * s1 * s3); sci::elemWiseAdd<intType>(s1 * s2, A_share, A_temp_share, A_temp_share); sci::elemWiseAdd<intType>(s2 * s3, B_share, B_temp_share, B_temp_share); sci::elemWiseAdd<intType>(s1 * s3, C_share, C_temp_share, C_temp_share); ideal_func(s1, s2, s3, A_temp_share, B_temp_share, C_clear); for (int i = 0; i < s1; i++) { for (int j = 0; j < s3; j++) { assert(Arr2DIdxRowM(C_clear, s1, s3, i, j) == (Arr2DIdxRowM(C_temp_share, s1, s3, i, j) & moduloMask)); } } delete[] A_temp_share; delete[] B_temp_share; delete[] C_temp_share; delete[] C_clear; } else if (SCI_party == sci::BOB) { io->send_data(A_share, sizeof(intType) * s1 * s2); io->send_data(B_share, sizeof(intType) * s2 * s3); io->send_data(C_share, sizeof(intType) * s1 * s3); } else { assert(false); } } void fillInSimpleValues(int s1, int s2, intType *arr) { if (SCI_party == sci::ALICE) { for (int i = 0; i < s1; i++) { for (int j = 0; j < s2; j++) { Arr2DIdxRowM(arr, s1, s2, i, j) = i + j + 1; } } } else if (SCI_party == sci::BOB) { for (int i = 0; i < s1; i++) { for (int j = 0; j < s2; j++) { Arr2DIdxRowM(arr, s1, s2, i, j) = 0; } } } } /* This function is not being used anywhere right now - matmul where dimensions of matrices are (s1,s2) and (s2,s3) - inp is input of the sender of size (s1,s2) - outp is the share of the result of size (s1,s3) */ void funcOTSenderNonBatched(int s1, int s2, int s3, const intType *inp, intType *outp, sci::OT<otType> *otInstance) { uint64_t *corrData = new uint64_t[s1 * s2 * bitlength * s3]; uint64_t *rData = new uint64_t[s1 * s2 * bitlength * s3]; uint64_t *chunkSizes = new uint64_t[s2 * bitlength * s3]; uint64_t *numChunks = new uint64_t[s2 * bitlength * s3]; intType *inpColumnMajor = new intType[s1 * s2]; intType *outpColumnMajor = new intType[s1 * s3]; sci::convertRowToColMajor<intType>(s1, s2, inp, inpColumnMajor); for (int i = 0; i < s1 * s3; i++) { outpColumnMajor[i] = 0; } for (int col = 0; col < s3; col++) { for (int j = 0; j < s2; j++) { for (int k = 0; k < bitlength; k++) { for (int i = 0; i < s1; i++) { intType curElem = Arr2DIdxColM(inpColumnMajor, s1, s2, i, j); Arr4DIdxRowM(corrData, s3, s2, bitlength, s1, col, j, k, i) = ((intType)(((intType)curElem) << k)) >> k; // casting is imp to make sure that // right shift happens in apt bitwidth } chunkSizes[col * s2 * bitlength + j * bitlength + k] = bitlength - k; numChunks[col * s2 * bitlength + j * bitlength + k] = s1; } } } otInstance->template send_cot_matmul<intType>( rData, corrData, chunkSizes, numChunks, s2 * bitlength * s3); for (int col = 0; col < s3; col++) { for (int i = 0; i < s2; i++) { for (int j = 0; j < bitlength; j++) { for (int k = 0; k < s1; k++) { // Arr3DIdxRowM(rData,s2,bitlength,s1,i,j,k) should be of // bitlength-j bits -- top j bits should be 0. uint64_t curElem = Arr4DIdxRowM(rData, s3, s2, bitlength, s1, col, i, j, k); assert(((((1ULL << j) - 1) << (bitlength - j)) & curElem) == 0 && "assertion failed"); Arr2DIdxColM(outpColumnMajor, s1, s3, k, col) -= (((intType)curElem) << j); } } } } sci::convertColToRowMajor<intType>(s1, s3, outpColumnMajor, outp); for (int i = 0; i < s1 * s3; i++) { outp[i] = outp[i] & moduloMask; } delete[] corrData; delete[] rData; delete[] chunkSizes; delete[] numChunks; } /* This function is not being used anywhere right now - The matrix multiplication being performed is (s1, s2) * (s2, s3). - inp is the receiver's array to be multiplied of size (s2, s3) - outp is the share of the receiver after multiplication of size (s1,s3) */ void funcOTReceiverNonBatched(int s1, int s2, int s3, const intType *inp, intType *outp, sci::OT<otType> *otInstance) { // copy inp from row to column and outp from column to row major uint8_t *choiceBitArr = new uint8_t[s2 * bitlength * s3]; uint64_t *recv_data = new uint64_t[s1 * s2 * bitlength * s3]; uint64_t *chunkSizes = new uint64_t[s2 * bitlength * s3]; uint64_t *numChunks = new uint64_t[s2 * bitlength * s3]; intType *inpColumnMajor = new intType[s2 * s3]; intType *outpColumnMajor = new intType[s1 * s3]; sci::convertRowToColMajor<intType>(s2, s3, inp, inpColumnMajor); for (int j = 0; j < s3; j++) { for (int i = 0; i < s2; i++) { for (int k = 0; k < bitlength; k++) { choiceBitArr[j * s2 * bitlength + i * bitlength + k] = (Arr2DIdxColM(inpColumnMajor, s2, s3, i, j) & (1ULL << k)) >> k; // Unsigned right shift chunkSizes[j * s2 * bitlength + i * bitlength + k] = (bitlength - k); numChunks[j * s2 * bitlength + i * bitlength + k] = s1; } } } otInstance->template recv_cot_matmul<intType>( recv_data, choiceBitArr, chunkSizes, numChunks, s2 * s3 * bitlength); // recv_data can be interpreted as a 4d array of size(s3,s2,bitlength,s1) for (int i = 0; i < s1 * s3; i++) { outpColumnMajor[i] = 0; } for (int i = 0; i < s3; i++) { for (int j = 0; j < s2; j++) { for (int k = 0; k < bitlength; k++) { for (int w = 0; w < s1; w++) { Arr2DIdxColM(outpColumnMajor, s1, s3, w, i) += (((intType)Arr4DIdxRowM(recv_data, s3, s2, bitlength, s1, i, j, k, w)) << k); } } } } sci::convertColToRowMajor<intType>(s1, s3, outpColumnMajor, outp); for (int i = 0; i < s1 * s3; i++) { outp[i] = outp[i] & moduloMask; } delete[] choiceBitArr; delete[] recv_data; delete[] chunkSizes; delete[] numChunks; } int chooseOptimalBatchSize(int senderMatmulDims) { uint64_t temp = MaxMemToUseInBytes / ((uint64_t)senderMatmulDims * sizeof(intType)); if (temp > batchSizeOTs) { temp = batchSizeOTs; } return temp; } /* - matmul where dimensions of matrices are (s1,s2) and (s2,s3) - inp is input of the sender of size (s1,s2) - outp is the share of the result of size (s1,s3) */ void funcOTSenderInputA(int s1, int s2, int s3, const intType *inp, intType *outp, sci::OT<otType> *otInstance, bool inpAlreadyColumnMajor = false) { intType *inpColumnMajor = const_cast<intType *>(inp); if (!inpAlreadyColumnMajor) { inpColumnMajor = new intType[s1 * s2]; sci::convertRowToColMajor<intType>(s1, s2, inp, inpColumnMajor); } intType *outpColumnMajor = new intType[s1 * s3]; int curBatchSizeOTs = chooseOptimalBatchSize(s1); intType *corrData = new intType[curBatchSizeOTs * s1]; intType *data = new intType[curBatchSizeOTs * s1]; uint32_t *chunkSizes = new uint32_t[curBatchSizeOTs]; uint32_t *numChunks = new uint32_t[curBatchSizeOTs]; for (int i = 0; i < s1 * s3; i++) { outpColumnMajor[i] = 0; } int numOTs = s2 * s3 * bitlength; int bitIdxRecv = 0, rowIdxRecv = 0, colIdxRecv = 0; for (int i = 0; i < numOTs; i += curBatchSizeOTs) { int j; for (j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, s3, s2, bitlength, colIdxRecv, rowIdxRecv, bitIdxRecv); for (int k = 0; k < s1; k++) { corrData[(j - i) * s1 + k] = (((intType)Arr2DIdxColM(inpColumnMajor, s1, s2, k, rowIdxRecv)) << bitIdxRecv) >> bitIdxRecv; } chunkSizes[j - i] = bitlength - bitIdxRecv; numChunks[j - i] = s1; } otInstance->template send_cot_matmul<intType>(data, corrData, chunkSizes, numChunks, j - i, s1); for (int j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, s3, s2, bitlength, colIdxRecv, rowIdxRecv, bitIdxRecv); for (int k = 0; k < s1; k++) { Arr2DIdxColM(outpColumnMajor, s1, s3, k, colIdxRecv) -= (((intType)Arr2DIdxRowM(data, curBatchSizeOTs, s1, (j - i), k)) << bitIdxRecv); } } } sci::convertColToRowMajor<intType>(s1, s3, outpColumnMajor, outp); for (int i = 0; i < s1 * s3; i++) { outp[i] = outp[i] & moduloMask; } if (!inpAlreadyColumnMajor) delete[] inpColumnMajor; delete[] outpColumnMajor; delete[] corrData; delete[] data; delete[] chunkSizes; delete[] numChunks; } /* - The matrix multiplication being performed is (s1, s2) * (s2, s3). - inp is the receiver's array to be multiplied of size (s2, s3) - outp is the share of the receiver after multiplication of size (s1,s3) */ void funcOTReceiverInputB(int s1, int s2, int s3, const intType *inp, intType *outp, sci::OT<otType> *otInstance, bool inpAlreadyColumnMajor = false) { // copy inp from row to column and outp from column to row major intType *inpColumnMajor = const_cast<intType *>(inp); intType *outpColumnMajor = new intType[s1 * s3]; if (!inpAlreadyColumnMajor) { inpColumnMajor = new intType[s2 * s3]; sci::convertRowToColMajor<intType>(s2, s3, inp, inpColumnMajor); } uint64_t masks[64]; for (int i = 0; i < 64; i++) { masks[i] = 1ULL << i; } int curBatchSizeOTs = chooseOptimalBatchSize(s1); intType *data = new intType[curBatchSizeOTs * s1]; uint8_t *choiceBitArr = new uint8_t[curBatchSizeOTs]; uint32_t *chunkSizes = new uint32_t[curBatchSizeOTs]; uint32_t *numChunks = new uint32_t[curBatchSizeOTs]; for (int i = 0; i < s1 * s3; i++) { outpColumnMajor[i] = 0; } int numOTs = s2 * s3 * bitlength; int bitIdxRecv = 0, rowIdxRecv = 0, colIdxRecv = 0; for (int i = 0; i < numOTs; i += curBatchSizeOTs) { int j; for (j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, s3, s2, bitlength, colIdxRecv, rowIdxRecv, bitIdxRecv); choiceBitArr[j - i] = (Arr2DIdxColM(inpColumnMajor, s2, s3, rowIdxRecv, colIdxRecv) & masks[bitIdxRecv]) >> bitIdxRecv; chunkSizes[j - i] = bitlength - bitIdxRecv; numChunks[j - i] = s1; } otInstance->template recv_cot_matmul<intType>( data, choiceBitArr, chunkSizes, numChunks, j - i, s1); for (int j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, s3, s2, bitlength, colIdxRecv, rowIdxRecv, bitIdxRecv); for (int k = 0; k < s1; k++) { Arr2DIdxColM(outpColumnMajor, s1, s3, k, colIdxRecv) += (((intType)Arr2DIdxRowM(data, curBatchSizeOTs, s1, (j - i), k)) << bitIdxRecv); } } } sci::convertColToRowMajor<intType>(s1, s3, outpColumnMajor, outp); for (int i = 0; i < s1 * s3; i++) { outp[i] = outp[i] & moduloMask; } if (!inpAlreadyColumnMajor) delete[] inpColumnMajor; delete[] outpColumnMajor; delete[] data; delete[] choiceBitArr; delete[] chunkSizes; delete[] numChunks; } /* - matmul where dimensions of matrices are (s1,s2) and (s2,s3) - inp is input of the sender of size (s2,s3) - outp is the share of the result of size (s1,s3) */ void funcOTSenderInputB(int s1, int s2, int s3, const intType *inp, intType *outp, sci::OT<otType> *otInstance) { int curBatchSizeOTs = chooseOptimalBatchSize(s3); intType *corrData = new intType[curBatchSizeOTs * s3]; intType *data = new intType[curBatchSizeOTs * s3]; uint32_t *chunkSizes = new uint32_t[curBatchSizeOTs]; uint32_t *numChunks = new uint32_t[curBatchSizeOTs]; for (int i = 0; i < s1 * s3; i++) { outp[i] = 0; } int numOTs = s1 * s2 * bitlength; int bitIdxRecv = 0, rowIdxRecv = 0, colIdxRecv = 0; for (int i = 0; i < numOTs; i += curBatchSizeOTs) { int j; for (j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, s1, s2, bitlength, rowIdxRecv, colIdxRecv, bitIdxRecv); for (int k = 0; k < s3; k++) { corrData[(j - i) * s3 + k] = (((intType)Arr2DIdxRowM(inp, s2, s3, colIdxRecv, k)) << bitIdxRecv) >> bitIdxRecv; } chunkSizes[j - i] = bitlength - bitIdxRecv; numChunks[j - i] = s3; } otInstance->template send_cot_matmul<intType>(data, corrData, chunkSizes, numChunks, j - i, s3); for (int j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, s1, s2, bitlength, rowIdxRecv, colIdxRecv, bitIdxRecv); for (int k = 0; k < s3; k++) { Arr2DIdxRowM(outp, s1, s3, rowIdxRecv, k) -= (((intType)Arr2DIdxRowM(data, curBatchSizeOTs, s3, (j - i), k)) << bitIdxRecv); } } } for (int i = 0; i < s1 * s3; i++) { outp[i] = outp[i] & moduloMask; } delete[] corrData; delete[] data; delete[] chunkSizes; delete[] numChunks; } /* - The matrix multiplication being performed is (s1, s2) * (s2, s3). - inp is the receiver's array to be multiplied of size (s1, s2) - outp is the share of the receiver after multiplication of size (s1,s3) */ void funcOTReceiverInputA(int s1, int s2, int s3, const intType *inp, intType *outp, sci::OT<otType> *otInstance) { uint64_t masks[64]; for (int i = 0; i < 64; i++) { masks[i] = 1ULL << i; } int curBatchSizeOTs = chooseOptimalBatchSize(s3); intType *data = new intType[curBatchSizeOTs * s3]; uint8_t *choiceBitArr = new uint8_t[curBatchSizeOTs]; uint32_t *chunkSizes = new uint32_t[curBatchSizeOTs]; uint32_t *numChunks = new uint32_t[curBatchSizeOTs]; for (int i = 0; i < s1 * s3; i++) { outp[i] = 0; } int numOTs = s1 * s2 * bitlength; int bitIdxRecv = 0, rowIdxRecv = 0, colIdxRecv = 0; for (int i = 0; i < numOTs; i += curBatchSizeOTs) { int j; for (j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, s1, s2, bitlength, rowIdxRecv, colIdxRecv, bitIdxRecv); choiceBitArr[j - i] = (Arr2DIdxRowM(inp, s1, s2, rowIdxRecv, colIdxRecv) & masks[bitIdxRecv]) >> bitIdxRecv; chunkSizes[j - i] = bitlength - bitIdxRecv; numChunks[j - i] = s3; } otInstance->template recv_cot_matmul<intType>( data, choiceBitArr, chunkSizes, numChunks, j - i, s3); for (int j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, s1, s2, bitlength, rowIdxRecv, colIdxRecv, bitIdxRecv); for (int k = 0; k < s3; k++) { Arr2DIdxRowM(outp, s1, s3, rowIdxRecv, k) += (((intType)Arr2DIdxRowM(data, curBatchSizeOTs, s3, (j - i), k)) << bitIdxRecv); } } } for (int i = 0; i < s1 * s3; i++) { outp[i] = outp[i] & moduloMask; } delete[] data; delete[] choiceBitArr; delete[] chunkSizes; delete[] numChunks; } /* - Dot product functionality - Sender has input 'inp' of size 'size' */ void funcDotProdOTSender(int size, const intType *inp, intType *outp, sci::OT<otType> *otInstance) { for (int i = 0; i < size; i++) { outp[i] = 0; } int curBatchSizeOTs = batchSizeOTs; int numOTs = size * bitlength; intType *curCorrData = new intType[curBatchSizeOTs]; uint32_t *curChunkSizes = new uint32_t[curBatchSizeOTs]; uint32_t *curNumChunks = new uint32_t[curBatchSizeOTs]; intType *curData = new intType[curBatchSizeOTs]; int bitIdxRecv = 0, cellIdxRecv = 0; for (int i = 0; i < numOTs; i += curBatchSizeOTs) { int j; for (j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, size, bitlength, cellIdxRecv, bitIdxRecv); curCorrData[j - i] = (((intType)inp[cellIdxRecv]) << bitIdxRecv) >> bitIdxRecv; curChunkSizes[j - i] = bitlength - bitIdxRecv; curNumChunks[j - i] = 1; } otInstance->template send_cot_matmul<intType>( curData, curCorrData, curChunkSizes, curNumChunks, j - i, size); for (int j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, size, bitlength, cellIdxRecv, bitIdxRecv); outp[cellIdxRecv] -= (((intType)curData[j - i]) << bitIdxRecv); } } for (int i = 0; i < size; i++) { outp[i] = outp[i] & moduloMask; } delete[] curCorrData; delete[] curChunkSizes; delete[] curNumChunks; delete[] curData; } /* - Dot product functionality - Receiver has input 'inp' of size 'size' */ void funcDotProdOTReceiver(int size, const intType *inp, intType *outp, sci::OT<otType> *otInstance) { uint64_t masks[64]; for (int i = 0; i < 64; i++) { masks[i] = 1ULL << i; } for (int i = 0; i < size; i++) { outp[i] = 0; } int curBatchSizeOTs = batchSizeOTs; int numOTs = size * bitlength; uint8_t *curChoiceBits = new uint8_t[curBatchSizeOTs]; uint32_t *curNumChunks = new uint32_t[curBatchSizeOTs]; uint32_t *curChunkSizes = new uint32_t[curBatchSizeOTs]; intType *curData = new intType[curBatchSizeOTs]; int bitIdxRecv = 0, cellIdxRecv = 0; for (int i = 0; i < numOTs; i += curBatchSizeOTs) { int j; for (j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, size, bitlength, cellIdxRecv, bitIdxRecv); curChoiceBits[j - i] = (inp[cellIdxRecv] & masks[bitIdxRecv]) >> bitIdxRecv; curChunkSizes[j - i] = bitlength - bitIdxRecv; curNumChunks[j - i] = 1; } otInstance->template recv_cot_matmul<intType>( curData, curChoiceBits, curChunkSizes, curNumChunks, j - i, size); for (int j = i; (j < numOTs) && (j < i + curBatchSizeOTs); j++) { // current OT# is j sci::linIdxRowMInverseMapping(j, size, bitlength, cellIdxRecv, bitIdxRecv); outp[cellIdxRecv] += (curData[j - i] << bitIdxRecv); } } for (int i = 0; i < size; i++) { outp[i] = outp[i] & moduloMask; } delete[] curChoiceBits; delete[] curNumChunks; delete[] curChunkSizes; delete[] curData; } /* This code is unoptimized and not being used anywhere currently. - Matrix triplet of size (s1,s2)*(s2,s3) - A_share, B_share, C_share are shares of A,B,C - shape(A_share) = (s1,s2) - shape(B_share) = (s2,s3) - shape(C_share) = (s1,s3) */ void generateBeaverMatrixTriplet(int s1, int s2, int s3, sci::PRG128 prg, intType *A_share, intType *B_share, intType *C_share) { assert(otImplRoleReversed != nullptr); prg.random_data(A_share, s1 * s2 * sizeof(intType)); prg.random_data(B_share, s2 * s3 * sizeof(intType)); intType *temp = new intType[s1 * s3]; if (SCI_party == sci::ALICE) { // The OTs can be done in parallel funcOTSenderInputA(s1, s2, s3, A_share, C_share, otImpl); funcOTReceiverInputB(s1, s2, s3, B_share, temp, otImplRoleReversed); } else if (SCI_party == sci::BOB) { funcOTReceiverInputB(s1, s2, s3, B_share, C_share, otImpl); funcOTSenderInputA(s1, s2, s3, A_share, temp, otImplRoleReversed); } else { assert(false); } sci::elemWiseAdd<intType>(s1 * s3, C_share, temp, C_share); ideal_func(s1, s2, s3, A_share, B_share, temp); sci::elemWiseAdd<intType>(s1 * s3, C_share, temp, C_share); } /* This code is unoptimized and not being used anywhere currently. - Run the online phase of beaver - Matrices to be multiplied are of size (s1,s2) and (s2,s3). - X_share => size = (s1,s2), share of X - Y_share => size = (s2,s3), share of Y - Z_share => size = (s1,s3), share of output Z=X*Y - A_share, B_share, C_share are shares of the beaver triplet (A,B,C) */ void runBeaverOnlinePhase(int s1, int s2, int s3, const intType *X_share, const intType *Y_share, intType *Z_share, const intType *A_share, const intType *B_share, const intType *C_share) { intType *E_share = new intType[s1 * s2]; intType *F_share = new intType[s2 * s3]; intType *E_temp_share = new intType[s1 * s2]; intType *F_temp_share = new intType[s2 * s3]; intType *Z_temp_share = new intType[s1 * s3]; sci::elemWiseSub<intType>(s1 * s2, X_share, A_share, E_share); sci::elemWiseSub<intType>(s2 * s3, Y_share, B_share, F_share); if (SCI_party == sci::ALICE) { io->send_data(E_share, sizeof(intType) * s1 * s2); io->send_data(F_share, sizeof(intType) * s2 * s3); io->recv_data(E_temp_share, sizeof(intType) * s1 * s2); io->recv_data(F_temp_share, sizeof(intType) * s2 * s3); } else if (SCI_party == sci::BOB) { io->recv_data(E_temp_share, sizeof(intType) * s1 * s2); io->recv_data(F_temp_share, sizeof(intType) * s2 * s3); io->send_data(E_share, sizeof(intType) * s1 * s2); io->send_data(F_share, sizeof(intType) * s2 * s3); } else { assert(false); } // Add the shares of E and F to get E and F in the clear sci::elemWiseAdd<intType>(s1 * s2, E_share, E_temp_share, E_share); sci::elemWiseAdd<intType>(s2 * s3, F_share, F_temp_share, F_share); // Now E_share and F_share hold the clear values of E & F ideal_func(s1, s2, s3, E_share, Y_share, Z_temp_share); if (SCI_party == sci::ALICE) { ideal_func(s1, s2, s3, X_share, F_share, Z_share); } else if (SCI_party == sci::BOB) { sci::elemWiseSub<intType>(s1 * s2, X_share, E_share, E_temp_share); ideal_func(s1, s2, s3, E_temp_share, F_share, Z_share); } sci::elemWiseAdd<intType>(s1 * s3, Z_share, Z_temp_share, Z_share); sci::elemWiseAdd<intType>(s1 * s3, C_share, Z_share, Z_share); delete[] E_share; delete[] F_share; delete[] E_temp_share; delete[] F_temp_share; delete[] Z_temp_share; } }; #endif // LINEAR_UNIFORM_H__
[ "smog70151@gmail.com" ]
smog70151@gmail.com
1b0292027478508c23a78592152c180e6d08c8a9
6b40e9dccf2edc767c44df3acd9b626fcd586b4d
/NT/inetsrv/intlwb/chs2/src/wordlink.cpp
023436287d63b36650a338a2e3630feb248d6ef0
[]
no_license
jjzhang166/WinNT5_src_20201004
712894fcf94fb82c49e5cd09d719da00740e0436
b2db264153b80fbb91ef5fc9f57b387e223dbfc2
refs/heads/Win2K3
2023-08-12T01:31:59.670176
2021-10-14T15:14:37
2021-10-14T15:14:37
586,134,273
1
0
null
2023-01-07T03:47:45
2023-01-07T03:47:44
null
UTF-8
C++
false
false
25,843
cpp
/*============================================================================ Microsoft Simplified Chinese Proofreading Engine Microsoft Confidential. Copyright 1997-1999 Microsoft Corporation. All Rights Reserved. Component: Word and WordLink Purpose: Define the CWord and CWordLink classes Using CMyPlex to alloc and manage memory for word object in the link Notes: This module is a fundamental stuff for SCProof'98, it does NOT depend on any other class. Owner: donghz@microsoft.com Platform: Win32 Revise: First created by: donghz 5/26/97 ============================================================================*/ #include "myafx.h" #include "wordlink.h" #include "myplex.h" #include "lexicon.h" /*============================================================================ Implementation of functions in CWord ============================================================================*/ /*============================================================================ CWord constructor ============================================================================*/ CWord::CWord( ) { m_dwWordID = 0; m_hLex = 0; m_dwFlag = 0; for (int i = 0; i < WORD_ATTRI_SIZE; i++) m_aAttri[i] = 0; m_idErr = 0; m_cwchText = 0; m_pwchText = NULL; m_pPrev = NULL; m_pNext = NULL; m_pMergedFrom = NULL; #ifdef DEBUG m_pMergedTo = NULL; #endif } /*============================================================================ CWord::FillWord(): Fill the word. ============================================================================*/ void CWord::FillWord( LPCWSTR pwchText, USHORT cwchText, CWordInfo* pwinfo ) { assert(pwchText); assert(cwchText); m_pwchText = const_cast<LPWSTR>(pwchText); m_cwchText = cwchText; m_dwFlag = 0; ZeroMemory( (LPVOID)m_aAttri, sizeof(DWORD)*WORD_ATTRI_SIZE); m_idErr = 0; if (m_cwchText == 1) { SetFlag(CWord::WF_CHAR); } if (pwinfo != NULL) { m_dwWordID = pwinfo->GetWordID(); m_hLex = pwinfo->GetLexHandle(); for (USHORT i = 0; i < pwinfo->AttriNum(); i++) { SetAttri( pwinfo->GetAttri(i) ); } } else { m_dwWordID = 0; m_hLex = 0; } } /*============================================================================ CWord::fIsWordText() Compare this word's text with given text. Returns: TRUE if match FALSE if not ============================================================================*/ BOOL CWord::fIsWordText(LPCWSTR lpwcText) const { assert(m_pwchText && m_cwchText); assert(lpwcText); if(m_cwchText != wcslen(lpwcText)) return FALSE; for(USHORT i = 0; i < m_cwchText; i++) { if(lpwcText[i] != m_pwchText[i]) return FALSE; } return TRUE; } /*============================================================================ CWord::fIsTextIdentical(const CWord*) Compare this word's text with other word's text Returns: TRUE if the text of them identical FALSE if not ============================================================================*/ BOOL CWord::fIsTextIdentical(const CWord* pWord) const { assert(m_pwchText); assert(m_cwchText); assert(pWord); assert(pWord->m_pwchText); if (m_pwchText == NULL || pWord->m_pwchText == NULL || m_cwchText != pWord->m_cwchText) { return FALSE; } return (BOOL)(wcsncmp(m_pwchText, pWord->m_pwchText, m_cwchText) == 0); } /*============================================================================ Implementation of functions in CWordLink ============================================================================*/ /*============================================================================ CWordLink constructor ============================================================================*/ CWordLink::CWordLink(UINT ciBlockWordCount) { // Assert: all blocks are in same size! m_dwFlag = 0; m_dwFormat = 0; m_ciBlockSize = ciBlockWordCount; m_pwchText = NULL; m_pWordPool = NULL; m_pHead = NULL; m_pTail = NULL; m_pFree = NULL; } /*============================================================================ CWordLink destructor ============================================================================*/ CWordLink::~CWordLink() { #ifdef DEBUG assert(!fDetectLeak()); // Assert: no memory leak detected #endif if(m_pWordPool) m_pWordPool->FreeChain(); } /*============================================================================ CWordLink::InitLink() Init word link, set the text buffer pointer and length. Remarks: If there are words in the link, free the link at first dwFormat is a format hint info generate by WinWord, it's a very important property of the sentence ============================================================================*/ void CWordLink::InitLink(const WCHAR* pwchText, USHORT cwchLen, DWORD dwFormat) { FreeLink(); m_dwFlag = 0; m_pwchText = pwchText; m_cwchLen = cwchLen; m_dwFormat = dwFormat; } /*============================================================================ CWord::pGetHead() Get the head Word node of the WordLink. Remarks: In debug mode, do a all nodes verify one by one. ============================================================================*/ #ifdef DEBUG CWord* CWordLink::pGetHead(void) { // Verify each node before iterate the WordLink CWord* pWord = m_pHead; WCHAR* pwchText; USHORT cwchText=0; if (pWord != NULL) { pwchText = pWord->m_pwchText; // head node's m_pwchText must match this WordLink's m_pwchText ! assert(pwchText == m_pwchText); } while (pWord) { assert(pWord->cwchLen() > 0); assert(pWord->fGetFlag(CWord::WF_SBCS) || (pWord->cwchLen() == 1 && pWord->fGetFlag(CWord::WF_CHAR)) || (pWord->cwchLen() > 1 && !pWord->fGetFlag(CWord::WF_CHAR)) ); assert(pwchText + cwchText == pWord->m_pwchText); cwchText += pWord->m_cwchText; pWord->pChildWord(); // do a recursion to childs pWord = pWord->pNextWord(); } return (CWord*)m_pHead; } #else CWord* CWordLink::pGetHead(void) { return m_pHead; }; #endif // DEBUG /*============================================================================ CWordLink::pAllocWord() Alloc a new word, but do not chain the word into the link. All public fields in the word object set to 0. Returns: a CWord point to the new word. NULL if alloc failure. ============================================================================*/ CWord* CWordLink::pAllocWord(void) { assert(m_pwchText); // Catch uninitialized call CWord* pWord = pNewWord(); if (pWord != NULL) { ZeroMemory( pWord, sizeof(CWord) ); /************ pWord->ClearWord(); pWord->m_pwchText = NULL; pWord->m_cwchText = 0; pWord->m_pNext = NULL; pWord->m_pPrev = NULL; pWord->m_pMergedFrom = NULL; #ifdef DEBUG pWord->m_pMergedTo = NULL; #endif // DEBUG ************/ } return pWord; } /*============================================================================ CWordLink::AppendWord() Append a word object into the link. ============================================================================*/ void CWordLink::AppendWord(CWord* pWord) { #ifdef DEBUG assert(m_pwchText && m_cwchLen); // Catch uninitialized call // Word's text pointer must fall in WordLink's text buffer assert(pWord->m_pwchText >= m_pwchText && pWord->m_cwchText); assert(pWord->m_pwchText + pWord->m_cwchText <= m_pwchText + m_cwchLen); assert(!fInLink(pWord)); // pWord must outof current link assert(!fInChild(pWord)); assert(fInBlocks(pWord)); // pWord must owned by current WordLink if (m_pTail) { // No zero-length word allowed assert(pWord->m_pwchText == m_pTail->m_pwchText + m_pTail->m_cwchText); } else { assert(pWord->m_pwchText == m_pwchText); } #endif // DEBUG pWord->m_pNext = NULL; if (!m_pHead) { assert(pWord->m_pwchText == m_pwchText); m_pHead = pWord; } else { assert(pWord->m_pwchText > m_pwchText); m_pTail->m_pNext = pWord; } pWord->m_pPrev = m_pTail; m_pTail = pWord; } /*============================================================================ CWordLink::FreeWord() Free word to the free chain, pWord must out of current WordLink ============================================================================*/ void CWordLink::FreeWord(CWord* pWord) { assert(pWord); assert(m_pwchText); // Catch uninitialized call #ifdef DEBUG assert(!fInLink(pWord)); // pWord should not in current link assert(!fInChild(pWord)); // must not in any of the child links assert(!fInFree(pWord)); // must not in free link assert(fInBlocks(pWord)); // pWord must owned by this WordLink instance #endif // DEBUG // link the word to the free link pWord->m_pNext = m_pFree; m_pFree = pWord; } /*============================================================================ CWordLink::FreeLink(CWord*) Free the word link begin with CWord* (link words to the free chain) ============================================================================*/ void CWordLink::FreeLink( CWord* pWord ) { assert(pWord); #ifdef DEBUG assert(fInBlocks(pWord)); // pWord must owned by this WordLink instance if (pWord != m_pHead) { if (m_pwchText) { assert(!fInLink(pWord)); // pWord should not in current link assert(!fInChild(pWord)); } } #endif // DEBUG CWord* pNode = pWord; while (pNode->m_pNext) { if (pNode->m_pMergedFrom) { FreeLink(pNode->m_pMergedFrom); } pNode = pNode->m_pNext; #ifdef DEBUG assert(!fInFree(pWord)); #endif // DEBUG } if (pNode->m_pMergedFrom) { FreeLink(pNode->m_pMergedFrom); } pNode->m_pNext = m_pFree; m_pFree = pWord; } /*============================================================================ CWordLink::pSplitWord() Split a proper word into two words and insert the new word into the link Returns: Return the new word pointer if success, return NULL if failed to alloc new word or invalid cchSplitAt Remarks: only Chinese word can be splitted ============================================================================*/ CWord* CWordLink::pSplitWord(CWord* pWord, USHORT cwchSplitAt) { assert(m_pwchText); // Catch uninitialized call assert(pWord); #ifdef DEBUG assert(fInLink(pWord)); // pWord must in current link #endif // DEBUG assert(cwchSplitAt < pWord->m_cwchText); assert(!pWord->fGetFlag(CWord::WF_SBCS) && cwchSplitAt > 0); if (cwchSplitAt == 0 || cwchSplitAt >= pWord->m_cwchText) { return NULL; } if (pWord->m_pMergedFrom != NULL) { // free the child chains! CWord* pTemp = pWord->m_pMergedFrom; pWord->m_pMergedFrom = NULL; FreeLink(pTemp); } CWord* pNew = pNewWord(); if (pNew != NULL) { // link the new word into the WordLink pNew->m_pPrev = pWord; if (pWord->m_pNext == NULL) { m_pTail = pNew; pNew->m_pNext = NULL; } else { pWord->m_pNext->m_pPrev = pNew; pNew->m_pNext = pWord->m_pNext; } pWord->m_pNext = pNew; pNew->m_pMergedFrom = NULL; #ifdef DEBUG pNew->m_pMergedTo = NULL; #endif // DEBUG // Initialize the new word node pNew->ClearWord(); pNew->m_pwchText = pWord->m_pwchText + cwchSplitAt; pNew->m_cwchText = pWord->m_cwchText - cwchSplitAt; if(pNew->m_cwchText == 1) { pNew->SetFlag(CWord::WF_CHAR); } // reset the original word node pWord->ClearWord(); pWord->m_cwchText = cwchSplitAt; if(cwchSplitAt == 1) { pWord->SetFlag(CWord::WF_CHAR); } } return pWord; } /*============================================================================ CWordLink::MergeWithNext() Merge pWord with its next word to a new single word, and chain the old two word as the new word's child word Remarks: pWord should not be the last word in the sentence ============================================================================*/ void CWordLink::MergeWithNext( CWord* pWord, BOOL fFree) // TRUE: free the words been merged // FALSE: chain the words been merged as new word's child { assert(m_pwchText); assert(pWord); #ifdef DEBUG assert(fInLink(pWord)); #endif // DEBUG assert(pWord->m_pNext); // catch the last word in the link pMerge(pWord, pWord->m_pNext, fFree); } /*============================================================================ CWordLink::pLeftMerge() Merge pWord and it's left ciWords words, the ciWords+1 words chained to be the new merged word's childs. Returns: pointer to the merged word. if there is not enough left word nodes, words are NOT merged ============================================================================*/ CWord* CWordLink::pLeftMerge( CWord* pWord, // merge begin from pWord with left ciWords words UINT ciWords, // 0 - don't merge, 1 - merge one time(merge with prev) // 2 - merge two time (contain 3 words) BOOL fFree) // TRUE: free the words been merged // FALSE: chain the words been merged as new word's child { assert(pWord); #ifdef DEBUG assert(fInLink(pWord)); #endif if (ciWords == 0) { return pWord; } assert(ciWords > 0); CWord* pLeft = pWord; CWord* pRight = pWord; for(UINT i = 0; i < ciWords; i++) { if((pLeft = pLeft->m_pPrev) == NULL) { // Defensive way! assert(0); return pWord; } } return pMerge(pLeft, pRight, fFree); } /*============================================================================ CWordLink::pRightMerge() Merge pWord and it's right ciWords words, the ciWords+1 words chained to be the new merged word's childs. Returns: pointer to the merged word. NULL if there is not enough right word nodes, and words are NOT merged ============================================================================*/ CWord* CWordLink::pRightMerge( CWord* pWord, // merge begin from pWord with right ciWords words UINT ciWords, // 0 - don't merge, 1 - merge one time(merge with next) // 2 - merge two time (contain 3 words) BOOL fFree) // TRUE: free the words been merged // FALSE: chain the words been merged as new word's child { assert(pWord); #ifdef DEBUG assert(fInLink(pWord)); #endif // DEBUG if (ciWords == 0) { return pWord; } assert(ciWords > 0); CWord* pLeft = pWord; CWord* pRight = pWord; for(UINT i = 0; i < ciWords; i++) { if ((pRight = pRight->m_pNext) == NULL) { // Defensive way! assert(0); return pWord; } } return pMerge(pLeft, pRight, fFree); } /*============================================================================ Implementation of private functions in CWordLink ============================================================================*/ // Merge word nodes from pLeft to pRight // only called by pLeftMerge() and pRightMerge() and MergeWithNext() // to do the merge work CWord* CWordLink::pMerge(CWord* pLeft, CWord* pRight, BOOL fFree) { assert(pLeft); assert(pRight); CWord* pNew; BOOL fSBCS = (BOOL)(pLeft->fGetFlag(CWord::WF_SBCS)); USHORT cwchText = pLeft->m_cwchText; pNew = pLeft; do { pNew = pNew->m_pNext; assert(pNew != NULL); fSBCS = fSBCS && pNew->fGetFlag(CWord::WF_SBCS); cwchText += pNew->m_cwchText; } while (pNew != pRight); // alloc a new word node to save the pLeft and serve as the old pLeft in child // the pLeft serve as the merged word. pNew = fFree ? NULL : pAllocWord(); // pNew != NULL if (pNew != NULL) { assert(fFree == FALSE); pNew->CopyWord(pLeft); #ifdef DEBUG if (pLeft->fHasChild()) { CWord* pTemp; pTemp = pLeft->pChildWord(); while (pTemp) { pTemp->m_pMergedTo = pNew; pTemp = pTemp->m_pNext; } } #endif // DEBUG } else { // pNew == NULL, low-resource of system, force the words been merged be freed. fFree = TRUE; pNew = pLeft->pNextWord(); } if ( pRight->m_pNext == NULL ) { // tail node m_pTail = pLeft; pLeft->m_pNext = NULL; } else { pRight->m_pNext->m_pPrev = pLeft; pLeft->m_pNext = pRight->m_pNext; } pLeft->m_cwchText = cwchText; if (fFree) { // pNew comes from pLeft->pNextWord() pNew->m_pPrev = NULL; pRight->m_pNext = NULL; FreeLink(pNew); if (pLeft->fHasChild()) { pNew = pLeft->pChildWord(); assert(pNew); pLeft->m_pMergedFrom = NULL; #ifdef DEBUG pNew->m_pMergedTo = NULL; #endif // DEBUG FreeLink(pNew); } } else { // link the pNew to pWord chain as the pLeft's child pNew->m_pPrev = NULL; pNew->m_pNext->m_pPrev = pNew; pRight->m_pNext = NULL; pLeft->m_pMergedFrom = pNew; #ifdef DEBUG while ( pNew != NULL ) { pNew->m_pMergedTo = pLeft; pNew = pNew->m_pNext; } assert(pLeft->pChildWord()); #endif //DEBUG } // reset the merged node pLeft->ClearWord(); if(fSBCS) { pLeft->SetFlag(CWord::WF_SBCS); } assert(pLeft->fGetFlag(CWord::WF_SBCS) || pLeft->m_cwchText > 1); pLeft->SetFlag(CWord::WF_REDUCED); // All merged word node should be reduced return pLeft; } /*============================================================================ CWordLink::pNewWord() Alloc a new word from the free chain, expand the blocks if free chain empty ============================================================================*/ inline CWord* CWordLink::pNewWord() { CWord* pWord; if (!m_pFree) { CMyPlex* pNewBlock = CMyPlex::Create(m_pWordPool, m_ciBlockSize, sizeof(CWord)); if (!pNewBlock) return NULL; // can not allocate more memory block // chain them into free list pWord = (CWord*)pNewBlock->Data(); // free in reverse order to make it easier to debug pWord += m_ciBlockSize - 1; for(int i = (m_ciBlockSize - 1); i >= 0; i--, pWord--) { pWord->m_pNext = m_pFree; m_pFree = pWord; } } assert(m_pFree != NULL); // we must have nodes in the free list now! pWord = m_pFree; m_pFree = m_pFree->m_pNext; return pWord; } /*============================================================================ CWordLink::FreeLink(void) Free word in the link and reset the link (only link words to the free chain) Remarks: This method call FreeLink( CWord *pWord ) recursion to free link and child link ============================================================================*/ void CWordLink::FreeLink(void) { #ifdef DEBUG assert(!fDetectLeak()); // Assert: no memory leak detected #endif // DEBUG if (m_pwchText) { if (m_pHead) { CWord* pTemp = m_pHead; m_pwchText = NULL; m_pHead = NULL; m_pTail = NULL; FreeLink(pTemp); } else { assert(m_pwchText == NULL); assert(m_pHead == NULL); assert(m_pTail == NULL); } } assert(!m_pHead); } /*============================================================================ Implementation of private debugging functions ============================================================================*/ #ifdef DEBUG /*============================================================================ CWordLink::fInLink() Debugging function to check whether a word pointer is in the link. Not check whether the pointer is in child chain. ============================================================================*/ BOOL CWordLink::fInLink(CWord* pWord) { CWord* pcw = m_pHead; while (pcw) { if (pcw == pWord) return TRUE; pcw = pcw->m_pNext; } return FALSE; } /*============================================================================ CWordLink::fInChild() Debugging function to check whether a word pointer is in one of the child chains. ============================================================================*/ inline BOOL CWordLink::fInChild(CWord* pWord) { CWord* pcw = m_pHead; while (pcw) { if (pcw->m_pMergedFrom != NULL && fInChildOf(pWord, pcw)) { return TRUE; } pcw = pcw->pNextWord(); } return FALSE; } /*============================================================================ CWordLink::fInChildOf() Debugging function to check whether a word pointer is in the child chain of the pParent. ============================================================================*/ BOOL CWordLink::fInChildOf(CWord* pWord, CWord* pParent) { CWord* pcw = pParent->pChildWord(); while (pcw) { if (pcw == pWord) { return TRUE; } else if (pcw->m_pMergedFrom != NULL && fInChildOf(pWord, pcw)) { return TRUE; } else { } pcw = pcw->m_pNext; } return FALSE; } /*============================================================================ CWordLink::fInBlocks() Debugging function to check whether the pWord is in CMyPlex blocks ============================================================================*/ BOOL CWordLink::fInBlocks(CWord* pWord) { CWord* pFirstWord; CMyPlex* pBlock = m_pWordPool; while(pBlock) { pFirstWord = (CWord*)(pBlock->Data()); if(pWord >= pFirstWord && pWord < (pFirstWord + m_ciBlockSize)) { return TRUE; } pBlock = pBlock->m_pNext; } return FALSE; } /*============================================================================ CWordLink::fInFree() Debugging function to check whether the pWord is in free links ============================================================================*/ BOOL CWordLink::fInFree(CWord* pWord) { CWord* pcw = m_pFree; while (pcw) { if (pcw == pWord) { return TRUE; } pcw = pcw->m_pNext; } return FALSE; } /*============================================================================ CWordLink::SetDetectFlag Debugging function to set the word node leak flg used by fDetectLeak() ============================================================================*/ void CWordLink::SetDetectFlag(CWord* pWord) { CWord* pcw = pWord; while (pcw) { if (pcw->m_pMergedFrom != NULL) { SetDetectFlag( pcw->m_pMergedFrom ); } pcw->SetFlag(CWord::WF_DEBUG); pcw = pcw->m_pNext; } return; } /*============================================================================ CWordLink::fDetectLeak() Debugging function to check whether there are some word node leak to out of the link and the free chain Returns: TRUE if any leak is detected, FALSE if no leak detected Remarks: I hire the most significant bit in CWord::m_bFlag as the debugging use ============================================================================*/ BOOL CWordLink::fDetectLeak(void) { CWord* pWord; CMyPlex* pBlock; UINT i; // clear flag bit for all words in all blocks for(pBlock = m_pWordPool; pBlock; pBlock = pBlock->m_pNext) { for(i = 0, pWord = (CWord*)(pBlock->Data()); i < m_ciBlockSize; i++, pWord++) { pWord->ClearFlag(CWord::WF_DEBUG); } } // mark the flag bit for words in current link and in the free chain SetDetectFlag( m_pHead ); for(pWord = m_pFree; pWord; pWord = pWord->m_pNext) { pWord->SetFlag(CWord::WF_DEBUG); } // Check whether there are any leak words for(pBlock = m_pWordPool; pBlock; pBlock = pBlock->m_pNext) { for(i = 0, pWord = (CWord*)(pBlock->Data()); i < m_ciBlockSize; i++, pWord++) { if(!pWord->fGetFlag(CWord::WF_DEBUG)) { return TRUE; } } } return FALSE; } #endif // DEBUG
[ "seta7D5@protonmail.com" ]
seta7D5@protonmail.com
2628725c8e745160e3e3d3c5056655a026406fdb
cce2be08daabedee6a6001e371df3f79d754c6d0
/virtual function.cpp
2c5c970840f982bae281cfd7ec21432b78b5a441
[]
no_license
AnshTrehan/old-C-CPP-codes
9a9fdac6a5bd3985ee8df900a66f55e2a48f90cd
0b8dd8117f4fd8ea2e4184aacdc73fe3ff57d2ae
refs/heads/master
2022-11-30T13:18:42.708708
2020-08-17T05:28:10
2020-08-17T05:28:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
491
cpp
#include<iostream> #include<conio.h> using namespace std; class base { public: int a; void virtualshow() { cout<<"\nHello base class"; cout<<a; } }; class derived: public base { public: int b; void show() { cout<<"\nHello derived class"; cout<<b; } }; int main() { base *ptr; base b1; ptr=&b1; ptr->a=100; *(ptr).show; //ptr->show() derived d1; ptr=&d1; d1.b=50; ptr->show(); getch(); }
[ "anshtrehan@gmail.com" ]
anshtrehan@gmail.com
5e847d96a7f6a94f047277bfa05bb2cae1f1f572
f8b5a550831d0e7a701be12b991ec037703118d7
/include/JoSIM/VoltageSource.hpp
6301549c082cdd7cd6b5341db8aec0aed4a204e0
[ "MIT" ]
permissive
JoeyDelp/JoSIM
37c54aa0c51595d72a472d83878204328cfc412d
8818fcef6cd192ac7e0be6dbce89af611b64ad6f
refs/heads/master
2023-08-31T00:04:42.941902
2023-08-10T13:06:34
2023-08-10T13:06:34
124,359,635
56
26
MIT
2023-02-05T16:21:18
2018-03-08T08:18:50
C++
UTF-8
C++
false
false
1,029
hpp
// Copyright (c) 2021 Johannes Delport // This code is licensed under MIT license (see LICENSE for details) #ifndef JOSIM_VOLTAGESOURCE_HPP #define JOSIM_VOLTAGESOURCE_HPP #include <optional> #include <unordered_map> #include <unordered_set> #include <vector> #include "JoSIM/BasicComponent.hpp" #include "JoSIM/Function.hpp" #include "JoSIM/ParameterName.hpp" #include "JoSIM/Parameters.hpp" namespace JoSIM { /* Vlabel V⁺ V⁻ sourcetype ⎡ 0 0 1⎤ ⎡V⁺⎤ ⎡ 0⎤ ⎜ 0 0 -1⎟ ⎜V⁻⎟ = ⎜ 0⎟ ⎣ 1 -1 0⎦ ⎣Io⎦ ⎣ 0⎦ */ class VoltageSource : public BasicComponent { public: int64_t sourceIndex_; double pn1_ = 0.0, pn2_ = pn1_, pn3_ = pn2_, pn4_ = 0.0; VoltageSource(const std::pair<tokens_t, string_o>& s, const NodeConfig& ncon, const nodemap& nm, std::unordered_set<std::string>& lm, nodeconnections& nc, int64_t& bi, const int64_t& ci); void step_back() override { pn2_ = pn4_; } }; // class VoltageSource } // namespace JoSIM #endif
[ "joeydelp@gmail.com" ]
joeydelp@gmail.com
845ffc28f988493fbad2093a0bb7897daf840456
3f07e0443a505b33f1862c1e30672f72efd932e6
/systems/reachnn_benchmark_6_tora_tanh_symbolic_remainder.cpp
caa342dbd42fa6e4edea90d8d65ad4d411dac000
[]
no_license
ChaoHuang2018/Real-time-Monitoring-for-NNCS
332a53e99f9d0288cde10867dd3a242fd010c5db
975e0f836440893f7839751f88e815e10f31498b
refs/heads/main
2023-05-09T13:45:14.953419
2021-06-02T13:48:48
2021-06-02T13:48:48
304,783,341
0
0
null
null
null
null
UTF-8
C++
false
false
7,662
cpp
#include "../flowstar-template/Continuous.h" #include "../NNTaylor.h" #include "../domain_computation.h" #include "../dynamics_linearization.h" using namespace std; using namespace flowstar; int main(int argc, char *argv[]) { intervalNumPrecision = 600; // Declaration of the state variables. unsigned int numVars = 5; int x0_id = stateVars.declareVar("x0"); int x1_id = stateVars.declareVar("x1"); int x2_id = stateVars.declareVar("x2"); int x3_id = stateVars.declareVar("x3"); int u_id = stateVars.declareVar("u"); int domainDim = numVars + 1; // Define the continuous dynamics. Expression_AST<Real> deriv_x0("x1"); // theta_r = 0 Expression_AST<Real> deriv_x1("-x0 + 0.1*sin(x2)"); // theta_r = 0 Expression_AST<Real> deriv_x2("x3"); // theta_r = 0 Expression_AST<Real> deriv_x3("u"); // theta_r = 0 Expression_AST<Real> deriv_u("0"); vector<Expression_AST<Real>> ode_rhs(numVars); ode_rhs[x0_id] = deriv_x0; ode_rhs[x1_id] = deriv_x1; ode_rhs[x2_id] = deriv_x2; ode_rhs[x3_id] = deriv_x3; ode_rhs[u_id] = deriv_u; Deterministic_Continuous_Dynamics dynamics(ode_rhs); // Specify the parameters for reachability computation. Computational_Setting setting; unsigned int order = stoi(argv[4]); // stepsize and order for reachability analysis setting.setFixedStepsize(0.005, order); // time horizon for a single control step setting.setTime(0.5); // cutoff threshold setting.setCutoffThreshold(1e-10); // queue size for the symbolic remainder setting.setQueueSize(1000); // print out the steps setting.printOff(); // remainder estimation Interval I(-0.01, 0.01); vector<Interval> remainder_estimation(numVars, I); setting.setRemainderEstimation(remainder_estimation); //setting.printOn(); setting.prepare(); /* * Initial set can be a box which is represented by a vector of intervals. * The i-th component denotes the initial set of the i-th state variable. */ double w = stod(argv[1]); int steps = stoi(argv[2]); Interval init_x0(-0.76 - w, -0.76 + w), init_x1(-0.44 - w, -0.44 + w), init_x2(-0.52 - w, -0.53 + w), init_x3(-0.29 - w, -0.29 + w), init_u(0); //w=0.01 std::vector<Interval> X0; X0.push_back(init_x0); X0.push_back(init_x1); X0.push_back(init_x2); X0.push_back(init_x3); X0.push_back(init_u); // translate the initial set to a flowpipe Flowpipe initial_set(X0); // no unsafe set vector<Constraint> unsafeSet; // result of the reachability computation Result_of_Reachability result; // define the neural network controller string nn_name = "systems_with_networks/reachnn_benchmark_6_tora/nn_6_tora_tanh"; NeuralNetwork nn(nn_name); unsigned int maxOrder = 15; Global_Computation_Setting g_setting; g_setting.prepareForReachability(maxOrder); // the order in use // unsigned int order = 5; Interval cutoff_threshold(-1e-8, 1e-8); unsigned int bernstein_order = stoi(argv[3]); unsigned int partition_num = 4000; unsigned int if_symbo = stoi(argv[5]); double err_max = 0; time_t start_timer; time_t end_timer; double seconds; time(&start_timer); vector<string> state_vars; state_vars.push_back("x0"); state_vars.push_back("x1"); state_vars.push_back("x2"); state_vars.push_back("x3"); // perform 35 control steps for (int iter = 0; iter < steps; ++iter) { cout << "Step " << iter << " starts. " << endl; //vector<Interval> box; //initial_set.intEval(box, order, setting.tm_setting.cutoff_threshold); TaylorModelVec<Real> tmv_input; // tmv_input.tms.push_back(initial_set.tmvPre.tms[0]); // tmv_input.tms.push_back(initial_set.tmvPre.tms[1]); TaylorModelVec<Real> tmv_temp; initial_set.compose(tmv_temp, order, cutoff_threshold); tmv_input.tms.push_back(tmv_temp.tms[0]); tmv_input.tms.push_back(tmv_temp.tms[1]); tmv_input.tms.push_back(tmv_temp.tms[2]); tmv_input.tms.push_back(tmv_temp.tms[3]); // taylor propagation NNTaylor nn_taylor(nn); TaylorInfo ti(g_setting, order, bernstein_order, partition_num, cutoff_threshold); TaylorModelVec<Real> tmv_output; if (if_symbo == 0) { nn_taylor.get_output_tmv(tmv_output, tmv_input, ti, initial_set.domain); } else { cout << "symbolic remainder starts." << endl; nn_taylor.NN_Reach(tmv_output, tmv_input, ti, initial_set.domain); } // cout << "initial_set.domain: " << initial_set.domain[0] << initial_set.domain[1] << endl; Matrix<Interval> rm1(1, 1); tmv_output.Remainder(rm1); cout << rm1 << endl; cout << "Neural network taylor remainder: " << rm1 << endl; // taylor // NNTaylor nn_taylor1(nn); // vector<Interval> box; // initial_set.intEval(box, order, setting.tm_setting.cutoff_threshold); // cout << "initial_set: " << box[0] << box[1] << endl; // vector<Interval> box_state; // for (int i = 0; i < state_vars.size(); i++) // { // box_state.push_back(box[i]); // } // nn_taylor1.set_taylor_linear(state_vars, box_state); // cout << "11111" << endl; // vector<double> jcb = nn_taylor1.get_jacobian(); // vector<Real> jcb_real; // for (int i = 0; i < jcb.size(); i++) // { // jcb_real.push_back(Real(jcb[i])); // } // Interval rem = nn_taylor1.get_taylor_remainder() + nn_taylor1.get_output(); // cout << "Whole remainder: " << rem << endl; // Polynomial<Real> tm_coef(jcb_real); // TaylorModel<Real> tm_output2(jcb_real, rem); // if (rm1[0][0].width() < rem.width()) if (true) { tmv_temp.tms[u_id] = tmv_output.tms[0]; Flowpipe flow_temp(tmv_temp, initial_set.domain, cutoff_threshold); initial_set = flow_temp; // initial_set.tmvPre.tms[u_id] = tmv_output.tms[0]; cout << "TM -- Propagation" << endl; } else { // initial_set.tmvPre.tms[u_id] = tm_output2; // cout << "TM -- Linear, whole" << endl; } dynamics.reach(result, setting, initial_set, unsafeSet); if (result.status == COMPLETED_SAFE || result.status == COMPLETED_UNSAFE || result.status == COMPLETED_UNKNOWN) { initial_set = result.fp_end_of_time; cout << "Flowpipe taylor remainder: " << initial_set.tmv.tms[0].remainder << " " << initial_set.tmv.tms[1].remainder << endl; } else { printf("Terminated due to too large overestimation.\n"); return 1; } } vector<Interval> end_box; string reach_result; reach_result = "Verification result: Unknown(35)"; result.fp_end_of_time.intEval(end_box, order, setting.tm_setting.cutoff_threshold); if (end_box[0].inf() >= 0.0 && end_box[0].sup() <= 0.2 && end_box[1].inf() >= 0.05 && end_box[1].sup() <= 0.3) { reach_result = "Verification result: Yes(35)"; } if (end_box[0].inf() >= 0.2 || end_box[0].sup() <= 0.0 || end_box[1].inf() >= 0.3 || end_box[1].sup() <= 0.05) { reach_result = "Verification result: No(35)"; } time(&end_timer); seconds = difftime(start_timer, end_timer); // plot the flowpipes in the x-y plane result.transformToTaylorModels(setting); Plot_Setting plot_setting; plot_setting.setOutputDims(x0_id, x1_id); int mkres = mkdir("./outputs", S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); if (mkres < 0 && errno != EEXIST) { printf("Can not create the directory for images.\n"); exit(1); } std::string running_time = "Running Time: " + to_string(-seconds) + " seconds"; std::string choice(argv[5]); ofstream result_output("./outputs/reachnn_benchmark_6_tora_tanh_" + choice + ".txt"); if (result_output.is_open()) { result_output << reach_result << endl; result_output << running_time << endl; } // you need to create a subdir named outputs // the file name is example.m and it is put in the subdir outputs plot_setting.plot_2D_interval_MATLAB("reachnn_benchmark_6_tora_tanh_" + choice, result); return 0; }
[ "thomashuangchao@gmail.com" ]
thomashuangchao@gmail.com
a4a0ae40973591591299cf83b585a7a854f2bbfd
9055c093cd4ba9ab67470fd40d1ef13330f42492
/Source/Client/ClientMain.cpp
55310769e14daa5cfdd432e26fe95fedf25fbfbb
[]
no_license
webdes27/LoongSource
379875f51df0c9d9753515f1952d5f11afdc7dec
6c248e3340788041714c3006906e704dd5853f71
refs/heads/master
2022-01-10T18:38:11.764963
2019-06-06T12:33:52
2019-06-06T12:33:52
null
0
0
null
null
null
null
GB18030
C++
false
false
39,646
cpp
//----------------------------------------------------------------------------- //!\file ClientMain.cpp //!\author Lyp //! //!\date 2008-03-27 //! last 2008-03-27 //! //!\brief 龙客户端 //! //! Copyright (c) 2008 CTCRST Entertainment All rights reserved. //----------------------------------------------------------------------------- #include "stdafx.h" #include "ClientMain.h" #include "shellapi.h" #include "ServerSelectFrame.h" #include "LoginFrame.h" #include "HealthyControlFrame.h" #include "SelectRoleFrame.h" #include "CreateRoleFrame.h" #include "WorldFrame.h" #include "LoadingFrame.h" #include "Render2D.h" #include "NetSession.h" #include "CreatureData.h" #include "PetProtoData.h" #include "SceneEffectData.h" #include "ItemProtoData.h" #include "SkillProtoData.h" #include "MapLogicData.h" #include "ShopProtoData.h" #include "MallData.h" #include "LonghunAttData.h" #include "RoleTitleProtoData.h" #include "RoleInfoProtoData.h" #include "GameSet.h" #include "SysMenuFrame.h" #include "SysOptionMenuFrame.h" #include "ExitPromptFrame.h" #include "GameSettingsFrame.h" #include "MiniMapStatic.h" #include "MiniMapFrame.h" #include "ActiveStatic.h" #include "ActiveProgress.h" #include "PlayerStateFrame.h" #include "TargetStateFrame.h" #include "TargetSpellStateFrame.h" #include "TeammatesStateFrame.h" #include "PlayerViewWindow.h" #include "PetShowWindow.h" #include "RoleHeadPicIcon.h" #include "ZoneMapData.h" #include "ZoneMapStatic.h" #include "ZoneMapFrame.h" #include "TeamSys.h" #include "TeammatesStateFrame.h" #include "QuitFrame.h" #include "StyleActionFrame.h" #include "FestivalActivityPromptFrame.h" #include "RoleLevelUpPromptFrame.h" #include "LoongBenedictionFrame.h" #include "ChatFrame.h" #include "MilleSoundFrame.h" #include "StaticForCast.h" #include "EmotionFrame.h" #include "RichEditBoxForChatInput.h" #include "RichEditBoxForChatShow.h" #include "ScrollRichEditBox.h" #include "ShortcutBarFrame.h" #include "ShortcutButton.h" #include "WorldPickerFrame.h" #include "CombatSys.h" #include "ItemFrame.h" #include "PocketFrame.h" #include "PetBagFrame.h" #include "PetInformationFrame.h" #include "PetTradeFrame.h" #include "PetTradeUIFrame.h" #include "ThroneFrame.h" #include "StorageFrame.h" #include "ToolTipFrame.h" #include "CharacterFrame.h" #include "TargetCharacterFrame.h" #include "StateFrame.h" #include "EquipmentFrame.h" #include "ReputeFrame.h" #include "FameHallFrame.h" #include "ClanTreasureFrame.h" #include "RoleTitleFrame.h" #include "InformationFrame.h" #include "DispRoleInfoFrame.h" #include "ItemProduceFrame.h" #include "EquipConsolidateFrame.h" #include "DeComposeFrame.h" #include "ConsolidateData.h" #include "ProduceData.h" #include "ComposeStatic.h" #include "TradeFrame.h" #include "PlayerTradeFrame.h" #include "LockStatic.h" #include "PlayerTryDressWnd.h" #include "MallFrame.h" #include "MallGiftFrame.h" #include "YuanbaoFrame.h" #include "FilterData.h" #include "PocketEncryptFrame.h" #include "TreasureChestFrame.h" #include "GuildFrame.h" #include "GuildMemberInfoFrame.h" #include "GuildMemberPosFrame.h" #include "GuildAffairFrame.h" #include "GuildUpgradeFrame.h" #include "GuildPickUpSilverFrame.h" #include "GuildContributeSilver.h" #include "GuildBusinessFrame.h" #include "GuildBusinessRankFrame.h" #include "GuildStorageFrame.h" #include "GuildStorePermitFrame.h" #include "NoticeFrame.h" #include "GroundItemTipsFrame.h" #include "InsuranceFrame.h" #include "GroupBuyFrame.h" #include "StallVipFrame.h" #include "SFXData.h" #include "PlayerActionData.h" #include "TalentFrame.h" #include "TalentTreeFrame.h" #include "SkillBookFrame.h" #include "QuestMgr.h" #include "AppliedTree.h" #include "..\Cool3D\Util\FileUtil.h" #include "SocialMgr.h" #include "HttpPicEx.h" #include "StaticEx.h" #include "TreeEx.h" #include "ProgressEx.h" #include "DungeonSys.h" #include "QuestTargetWnd.h" #include "ButtonEx.h" #include "DragBtn.h" #include "ItemButton.h" #include "ItemMenuButton.h" #include "SkillButton.h" #include "PetSkillButton.h" #include "TalentButton.h" #include "ShopShelfFrame.h" #include "StallShelfFrame.h" #include "StallVendFrame.h" #include "StallSignboardTipsFrame.h" #include "RichEditWithZ.h" #include "ChatShowPop.h" #include "ToolTipStatic.h" #include "RoleFloatTipsFrame.h" #include "SkillProgressFrame.h" #include "IconStatic.h" #include "SceneCenterInfoFrame.h" #include "RoleHeadTipsFrame.h" #include "DakFrame.h" #include "DakData.h" #include "LevelUpData.h" #include "PersonalityActData.h" #include "StaticNoInput.h" #include "CountDownFrame.h" #include "CursorMgr.h" #include "AudioSys.h" #include "ItemMgr.h" #include "EffectMgr.h" #include "InstanceQuitFrame.h" #include "ActivityPvPFrame.h" #include "RemoteRoleStateFrame.h" #include "ChatChannelSetFrame.h" #include "MouseIntoTipsFrame.h" #include "EquipRecencyFrame.h" #include "SpecialSkillFrame.h" #include "PetFrame.h" #include "PetSkillFrame.h" #include "OnlineTips.h" #include "GameInputFrame.h" #include "..\WorldDefine\msg_gm_cmd.h" #include "..\WorldDefine\svn_revision.h" #include "ServerTime.h" #include "OwnerImeMgr.h" #include "OwnerImeFrame.h" #include "LocalPlayer.h" #include "RoleMgr.h" #include "GmConsole.h" #include "PerfLogger.h" #include "SeleRoleMgr.h" #include "HelpFrame.h" #include "QuizFrame.h" #include "ProfessionFrame.h" #include "GuildBusinessStateWnd.h" #include "MonsterSayTable.h" #include "MapMgr.h" #include "MarriageFrame.h" #include "DivorceFrame.h" #include "RenameFrame.h" #include "IconStaticHL.h" #include "GemRemovalFrame.h" #include "GlintPushButton.h" extern VOID LuaOpenCommonLib(lua_State* l); //----------------------------------------------------------------------------- // init //----------------------------------------------------------------------------- BOOL Client::Init(HINSTANCE hInst) { m_pUtil->Randomize(timeGetTime()*1000); CreateObj("GameConfig", "VarContainer"); CreateObj("VFS_System", "VirtualFileSys"); CreateObj("VFS_Animation", "VirtualFileSys"); CreateObj("VFS_Model", "VirtualFileSys"); CreateObj("VFS_Map", "VirtualFileSys"); TObjRef<VirtualFileSys>("VFS_System")->SetWorkingPackage(_T("data\\system.cpk")); TObjRef<VirtualFileSys>("VFS_Animation")->SetWorkingPackage(_T("data\\system.cpk")); TObjRef<VirtualFileSys>("VFS_Model")->SetWorkingPackage(_T("data\\system.cpk")); TObjRef<Log>()->Create(NULL); tstring strPath = g_strLocalPath + _T("\\string_table.xml"); g_StrTable.Init("VFS_System", strPath.c_str()); IFS* pIFS = (IFS*)(VOID*)TObjRef<VirtualFileSys>("VFS_System"); ResMgr::Inst()->SetFS(ResMgr::EFST_System, pIFS); NavResMgr::Inst()->SetFS(NavResMgr::EFST_System, pIFS); pIFS = (IFS*)(VOID*)TObjRef<VirtualFileSys>("VFS_Animation"); ResMgr::Inst()->SetFS(ResMgr::EFST_Animation, pIFS); pIFS = (IFS*)(VOID*)TObjRef<VirtualFileSys>("VFS_Model"); ResMgr::Inst()->SetFS(ResMgr::EFST_Model, pIFS); NavResMgr::Inst()->SetFS(NavResMgr::EFST_Model, pIFS); pIFS = (IFS*)(VOID*)TObjRef<VirtualFileSys>("VFS_System"); ResMgr::Inst()->SetFS(ResMgr::EFST_Effect, pIFS); pIFS = (IFS*)(VOID*)TObjRef<VirtualFileSys>("VFS_Map"); ResMgr::Inst()->SetFS(ResMgr::EFST_Map, pIFS); NavResMgr::Inst()->SetFS(NavResMgr::EFST_Map, pIFS); // 初始化渲染系统 this->InitRenderSystem(hInst); //--初始化NavMap const int navPoolBytes=8*1024*1024; NavKernel::Inst()->Init(navPoolBytes); pIFS = (IFS*)(VOID*)TObjRef<VirtualFileSys>("VFS_System"); Cool3D::AudioSystem::Inst()->SetFS(pIFS); //--引擎资源管理器打开多线程读盘 ResMgr::Inst()->EnableIOAsync(true); NavResMgr::Inst()->EnableIOAsync(true); // 设置程序默认路径 vEngine::SetDefaultDir(); m_pAudioSys->Init(); m_pInput->Init(); // 初始化输入系统 m_pEditor->Init(m_pGUI, TRUE);// 初始化界面编辑器 m_pConsole->Init("VFS_System", 500, FALSE); // 初始化控制台 m_pGameScriptMgr->Init(); // 初始化脚本系统 m_pSession->Init(); // 初始化网络层 m_pFrameMgr->Init(); // 初始化程序框架 this->RegisterControl(); // 注册所有界面控件 this->RegisterFrame(); // 注册所有框架 // 启动选择服务器模块 m_pFrameMgr->CreateFrame(_T("Root"), _T("ServerSelect"), _T("ServerSelectFrame"), 0); // 启动资源读取线程 m_bTerminateThreadLoad = FALSE; m_hThreadLoad = (HANDLE)_beginthreadex(NULL, 0, (THREADPROC)m_Trunk.sfp1(&Client::ThreadLoad), NULL, 0, NULL); if( 0 == m_hThreadLoad || -1 == (INT)m_hThreadLoad ) { ERR(_T("Create Load thread failed")); return FALSE; } CursorMgr::Inst()->Init(hInst); if( GameSet::Inst()->Get(EGS_Console) ) { m_pInputMap->Register(0, g_StrTable[_T("Hotkey_Console")], (INPUTMAPEVENTHANDLE) m_pConsole->GetTrunk().sfp2(&vEngine::Console::Switch), DIK_F11, TRUE, TRUE, 1); m_pInputMap->Register(0, g_StrTable[_T("Hotkey_UIEditor")], (INPUTMAPEVENTHANDLE) m_pEditor->GetTrunk().sfp2(&vEngine::GUIEditor::Switch), DIK_F12, TRUE, TRUE, 1); } if( 17173 == GameSet::Inst()->Get(EGS_GmConsle) ) { // 创建GM console框架 m_pFrameMgr->CreateFrame(_T("Root"), _T("GmConsole"), _T("GmConsoleFrame"), 0); } m_pInputMap->Register(0, g_StrTable[_T("Hotkey_ScreenShot0")], (INPUTMAPEVENTHANDLE) m_Trunk.sfp2(&Client::ScreenShot), DIK_SCROLL, TRUE, TRUE, 1); // BMP格式截图 m_pInputMap->Register(1, g_StrTable[_T("Hotkey_ScreenShot1")], (INPUTMAPEVENTHANDLE) m_Trunk.sfp2(&Client::ScreenShot), DIK_SYSRQ, TRUE, TRUE, 1); // JPG格式截图 // todo 临时代码 F10显示/隐藏当前所有GUIWnd,同时摄像机进入fly模式 m_pInputMap->Register(0, g_StrTable[_T("Hotkey_UI")], (INPUTMAPEVENTHANDLE) m_Trunk.sfp2(&Client::SwitchGUIWnd), DIK_F10, TRUE, TRUE, 1); // 注册控制台命令 m_pConsole->Register(_T("gm"), m_Trunk.sfp1(&Client::GMCommand), _T("gm command"), 1); m_pConsole->Register(_T("res"), m_Trunk.sfp1(&Client::LogResPool), _T("log res"), 1); m_pConsole->Register(_T("lrole"), m_Trunk.sfp1(&Client::DisplayLocalRoleAtt), _T("lrole att"), 1); m_pConsole->Register(_T("headtips"), m_Trunk.sfp1(&Client::HeadTipsCommand), _T("headtips command"), 1); // 初始化性能LOG生成器 PerfLogger::Inst()->Init(); // 创建tips框架 m_pFrameMgr->CreateFrame(_T("Root"), _T("Tooltip"), _T("ToolTipFrame"), 0); // 创建自定义输入法 if( OwnerImeMgr::Inst()->IfOwnerIme() ) m_pFrameMgr->CreateFrame(_T("Root"), _T("OwnerIme"), _T("OwnerImeFrame"), 0); // 建立名贴控件默认使用目录 ::CreateDirectory(_T("temp"), NULL); return TRUE; } //----------------------------------------------------------------------------- // destroy //----------------------------------------------------------------------------- VOID Client::Destroy() { // 清空temp文件夹 DeleteDirectory(_T("temp")); // 游戏结束后打开网页 TCHAR szURL[MAX_PATH]={0}; ::GetPrivateProfileString(_T("Launcher"), _T("EndURL"), NULL, szURL, MAX_PATH, _T("launcher\\launcher.ini")); tstring strURL = szURL; m_pUtil->CutSpaceOfStringHeadAndTail(strURL); if( !strURL.empty() ) ShellExecute(NULL, _T("open"), _T("IEXPLORE"), szURL, NULL, SW_MAXIMIZE); m_pFrameMgr->Destroy(); m_pWindow->Destroy(); m_pEditor->Destroy(); m_pConsole->Destroy(); m_pGUI->Destroy(); SeleRoleMgr::Inst()->Destroy(); CursorMgr::Inst()->Destroy(); OwnerImeMgr::Inst()->Destroy(); m_pAudioSys->Destroy(); ServerTime::Inst()->Destroy(); g_StrTable.Destroy(); KillObj("GUIRender"); Kernel::Inst()->FinalDestroy(); NavKernel::Inst()->Destroy(); } //----------------------------------------------------------------------------- // Mainloop //----------------------------------------------------------------------------- VOID Client::Mainloop() { DWORD dwMsg=0, dwParam1=0, dwParam2=0; while( FALSE == m_pWindow->MsgLoop() ) { // update Cool3D::Kernel::Inst()->Tick(); WorldBase::NavKernel::Inst()->Tick(); Cool3D::IDevice* pDev=Cool3D::Device(); // 监视 m_pConsole->Watch(_T("FPS"), (DWORD)pDev->GetRenderStatus()->FPS); m_pConsole->Watch(_T("Client Revision"), CLIENT_BUILD_REVISION); m_pConsole->Watch(_T("vEngine Revision"), VENGINE_BUILD_REVISION); m_pConsole->Watch(_T("Cool3D Revision"), COOL3D_BUILD_REVISION); m_pConsole->Watch(_T("WorldBase Revision"), WORLDBASE_BUILD_REVISION); m_pConsole->Watch(_T("WorldDefine Revision"), WORLDDEFINE_BUILD_REVISION); m_pConsole->Watch(_T("Primative"), pDev->GetRenderStatus()->numPrim); m_pConsole->Watch(_T("Draw call"), pDev->GetRenderStatus()->numDrawCall); m_pConsole->Watch(_T("Texture switch"), pDev->GetRenderStatus()->numTexSwitch); m_pConsole->Watch(_T("VB switch"), pDev->GetRenderStatus()->numVBSwitch); m_pConsole->Watch(_T("Texture"), pDev->GetRenderStatus()->texSize); m_pConsole->Watch(_T("Render target"), pDev->GetRenderStatus()->renderTexSize); m_pConsole->Watch(_T("UI Render target"), m_pGUIRender->GetRTSize()); m_pConsole->Watch(_T("Static VB"), pDev->GetRenderStatus()->staticVBSize); m_pConsole->Watch(_T("Dynamic VB"), pDev->GetRenderStatus()->dynamicVBSize); m_pConsole->Watch(_T("Static IB"), pDev->GetRenderStatus()->staticIBSize); m_pConsole->Watch(_T("Dynamic IB"), pDev->GetRenderStatus()->dynamicIBSize); m_pConsole->Watch(_T("UI controls"), m_pGUI->GetControlNum()); m_pConsole->Watch(_T("Connected"), m_pSession->IsConnect()); m_pConsole->Watch(_T("EffectNum"), EffectMgr::Inst()->GetNumEffect()); // 更新性能LOG生成器 PerfLogger::Inst()->Updata(); BeginSpeedTest(_T("Client::Mainloop.msgloop")); while( m_pWindow->PeekWindowsMsg(dwMsg, dwParam1, dwParam2) ) { if( FALSE == m_pGUI->OnWindowsMsg(dwMsg, dwParam1, dwParam2) ) { // 回车,切换输入法,将win32消息投递到聊天系统 if( dwMsg==WM_INPUTLANGCHANGE || (dwMsg==WM_KEYDOWN && dwParam1==VK_RETURN) || dwMsg==WM_KEYDOWN && dwParam1==VK_PRIOR) { ChatFrame* pFrame = (ChatFrame*)m_pFrameMgr->GetFrame(_T("Chat")); if( P_VALID(pFrame) ) pFrame->OnWin32Msg(dwMsg, dwParam1, dwParam2); } } GUIWnd* pWnd = m_pGUI->GetActive(); if( P_VALID(pWnd) && !pWnd->IsEditable() && dwMsg==WM_IME_COMPOSITION ) { ChatFrame* pFrame = (ChatFrame*)m_pFrameMgr->GetFrame(_T("Chat")); if( P_VALID(pFrame) ) { HKL pHkl = pFrame->GetEnglishHKL(); if( pHkl ) ActivateKeyboardLayout( pHkl, KLF_SETFORPROCESS ); } continue; } //全真屏输入法 OwnerImeMgr::Inst()->OnWindowsMsg(dwMsg, dwParam1, dwParam2); CursorMgr::Inst()->OnWindowsMsg(dwMsg, dwParam1, dwParam2); if( dwMsg == WM_QUIT ) return; } EndSpeedTest(_T("Client::Mainloop.msgloop")); BeginSpeedTest(_T("Client::Mainloop.update")); m_pInput->Update(); m_pInputMap->Update(); m_pGUI->Update(); m_pLuaMgr->Update(Kernel::Inst()->GetDeltaTime()); BeginSpeedTest(_T("Client::Mainloop.update.gameframe")); m_pFrameMgr->Update(); EndSpeedTest(_T("Client::Mainloop.update.gameframe")); m_pGameScriptMgr->Update(Kernel::Inst()->GetDeltaTime()); m_pSession->Update(); EndSpeedTest(_T("Client::Mainloop.update")); m_pAudioSys->Update( Kernel::Inst()->GetDeltaTimeDW() ); if( FALSE == m_pWindow->IsWindowActive() ) { Sleep(100); } // render pDev->Begin(); DWORD dwBackGroundColor = 0xff000000; SceneGraph* pSG = MapMgr::Inst()->GetSceneGraph(); if( NULL != pSG ) { const tagDistFog& fog = pSG->GetSceneFog(); dwBackGroundColor = DWORD(fog.color); } pDev->Clear(true,true,true,dwBackGroundColor,1.0f,0); BeginSpeedTest(_T("Client::Mainloop.Render3D")); m_pFrameMgr->Render3D(); EndSpeedTest(_T("Client::Mainloop.Render3D")); BeginSpeedTest(_T("Client::Mainloop.Render2D")); Cool3D::IDraw2D::Inst()->BeginDraw(IDraw2D::EBlend_Alpha, false); // TODO:有些界面不需要Alpha混合 DWORD dwUIRenderTime = timeGetTime(); m_pGUI->Render(); m_pEditor->Render(); m_pConsole->Watch(_T("UI RenderTime"), timeGetTime() - dwUIRenderTime); Cool3D::IDraw2D::Inst()->EndDraw(); EndSpeedTest(_T("Client::Mainloop.Render2D")); DrawSpeedTest(0,200); pDev->End(); // 设备丢失处理,必须在Present之前处理 if( pDev->GetDeviceResetFlag() ) { m_pGUI->RedrawAllWnd(); m_pFrameMgr->SendEvent( &tagGameEvent( _T("DeviceResetEvent"), NULL ) ); pDev->ClearDeviceResetFlag(); } BeginSpeedTest(_T("Client::Mainloop.Present")); pDev->Present(); EndSpeedTest(_T("Client::Mainloop.Present")); } } //----------------------------------------------------------------------------- // RegisterControl //----------------------------------------------------------------------------- VOID Client::RegisterControl() { m_pGUI->Register(TWrap<HttpPicEx>(), _T("HttpPicEx"), _T("HttpPicEx")); m_pGUI->Register(TWrap<StaticEx>(), _T("StaticEx"), _T("StaticEx")); m_pGUI->Register(TWrap<TreeEx>(), _T("TreeEx"), _T("TreeEx")); m_pGUI->Register(TWrap<ProgressEx>(), _T("ProgressEx"), _T("ProgressEx")); m_pGUI->Register(TWrap<ButtonEx>(), _T("ButtonEx"), _T("ButtonEx")); m_pGUI->Register(TWrap<DragBtn>(), _T("DragBtn"), _T("DragBtn")); m_pGUI->Register(TWrap<ShortcutButton>(), _T("ShortcutButton"), _T("ShortcutButton")); m_pGUI->Register(TWrap<RichEditBoxForChatInput>(), _T("RichEditBoxForChatInput"), _T("RichEditBoxForChatInput")); m_pGUI->Register(TWrap<RichEditBoxForChatShow>(), _T("RichEditBoxForChatShow"), _T("RichEditBoxForChatShow")); m_pGUI->Register(TWrap<ScrollRichEditBox>(), _T("ScrollRichEditBox"), _T("ScrollRichEditBox")); m_pGUI->Register(TWrap<ItemButton>(), _T("ItemButton"), _T("ItemButton")); m_pGUI->Register(TWrap<ItemMenuButton>(), _T("ItemMenuButton"), _T("ItemMenuButton")); m_pGUI->Register(TWrap<SkillButton>(), _T("SkillButton"), _T("SkillButton")); m_pGUI->Register(TWrap<PetSkillButton>(), _T("PetSkillButton"), _T("PetSkillButton")); m_pGUI->Register(TWrap<TalentButton>(), _T("TalentButton"), _T("TalentButton")); m_pGUI->Register(TWrap<MiniMapStatic>(), _T("MiniMapStatic"), _T("MiniMapStatic")); m_pGUI->Register(TWrap<ActiveStatic>(), _T("ActiveStatic"), _T("ActiveStatic")); m_pGUI->Register(TWrap<ActiveProgress>(), _T("ActiveProgress"), _T("ActiveProgress")); m_pGUI->Register(TWrap<ComposeStatic>(), _T("ComposeStatic"), _T("ComposeStatic")); m_pGUI->Register(TWrap<PlayerViewWindow>(), _T("PlayerViewWindow"), _T("PlayerViewWindow")); m_pGUI->Register(TWrap<PetShowWindow>(), _T("PetShowWindow"), _T("PetShowWindow")); m_pGUI->Register(TWrap<AppliedTree>(), _T("AppliedTree"), _T("AppliedTree")); m_pGUI->Register(TWrap<ToolTipStatic>(), _T("ToolTipStatic"), _T("ToolTipStatic")); m_pGUI->Register(TWrap<RichEditWithZ>(), _T("RichEditWithZ"), _T("RichEditWithZ")); m_pGUI->Register(TWrap<StaticForCast>(), _T("StaticForCast"), _T("StaticForCast")); m_pGUI->Register(TWrap<RoleHeadPicIcon>(), _T("RoleHeadPicIcon"), _T("RoleHeadPicIcon")); m_pGUI->Register(TWrap<IconStatic>(), _T("IconStatic"), _T("IconStatic")); m_pGUI->Register(TWrap<StaticNoInput>(), _T("StaticNoInput"), _T("StaticNoInput")); m_pGUI->Register(TWrap<ZoneMapStatic>(), _T("ZoneMapStatic"), _T("ZoneMapStatic")); m_pGUI->Register(TWrap<LockStatic>(), _T("LockStatic"), _T("LockStatic")); m_pGUI->Register(TWrap<PlayerTryDressWnd>(), _T("PlayerTryDressWnd"), _T("PlayerTryDressWnd")); m_pGUI->Register(TWrap<GoodsButton>(), _T("GoodsButton"), _T("GoodsButton")); m_pGUI->Register(TWrap<MallButton>(), _T("MallButton"), _T("MallButton")); m_pGUI->Register(TWrap<SpecialSkillButton>(), _T("SpecialSkillButton"), _T("SpecialSkillButton")); m_pGUI->Register(TWrap<GlintPushButton>(), _T("GlintPushButton"), _T("GlintPushButton") ); m_pGUI->Register(TWrap<IconStaticHL>(), _T("IconStaticHL"), _T("IconStaticHL") ); } //----------------------------------------------------------------------------- // RegisterFrame //----------------------------------------------------------------------------- VOID Client::RegisterFrame() { m_pFrameMgr->Register(TWrap<LoginFrame>(), _T("LoginFrame")); m_pFrameMgr->Register(TWrap<SelectRoleFrame>(), _T("SelectRoleFrame")); m_pFrameMgr->Register(TWrap<HealthyControlFrame>(), _T("HealthyControlFrame")); m_pFrameMgr->Register(TWrap<WorldFrame>(), _T("WorldFrame")); m_pFrameMgr->Register(TWrap<LoadingFrame>(), _T("LoadingFrame")); m_pFrameMgr->Register(TWrap<SysMenuFrame>(), _T("SysMenuFrame")); m_pFrameMgr->Register(TWrap<SysOptionMenuFrame>(), _T("SysOptionMenuFrame")); m_pFrameMgr->Register(TWrap<ExitPromptFrame>(), _T("ExitPromptFrame")); m_pFrameMgr->Register(TWrap<GameSettingsFrame>(), _T("GameSettingsFrame")); m_pFrameMgr->Register(TWrap<MiniMapFrame>(), _T("MiniMapFrame")); m_pFrameMgr->Register(TWrap<PlayerStateFrame>(), _T("PlayerStateFrame")); m_pFrameMgr->Register(TWrap<TargetStateFrame>(), _T("TargetStateFrame")); m_pFrameMgr->Register(TWrap<TargetSpellStateFrame>(), _T("TargetSpellStateFrame")); m_pFrameMgr->Register(TWrap<TeammatesStateFrame>(), _T("TeammatesStateFrame")); m_pFrameMgr->Register(TWrap<CreateRoleFrame>(), _T("CreateRoleFrame")); m_pFrameMgr->Register(TWrap<ItemFrame>(), _T("ItemFrame")); m_pFrameMgr->Register(TWrap<PocketFrame>(), _T("PocketFrame")); m_pFrameMgr->Register(TWrap<PetBagFrame>(), _T("PetBagFrame")); m_pFrameMgr->Register(TWrap<ThroneFrame>(), _T("ThroneFrame")); m_pFrameMgr->Register(TWrap<StorageFrame>(), _T("StorageFrame")); m_pFrameMgr->Register(TWrap<PocketEncryptFrame>(), _T("PocketEncryptFrame")); m_pFrameMgr->Register(TWrap<TradeFrame>(), _T("TradeFrame")); m_pFrameMgr->Register(TWrap<ShopShelfFrame>(), _T("ShopShelfFrame")); m_pFrameMgr->Register(TWrap<PlayerTradeFrame>(), _T("PlayerTradeFrame")); m_pFrameMgr->Register(TWrap<ToolTipFrame>(), _T("ToolTipFrame")); m_pFrameMgr->Register(TWrap<CharacterFrame>(), _T("CharacterFrame")); m_pFrameMgr->Register(TWrap<TargetCharacterFrame>(), _T("TargetCharacterFrame")); m_pFrameMgr->Register(TWrap<StateFrame>(), _T("StateFrame")); m_pFrameMgr->Register(TWrap<EquipmentFrame>(), _T("EquipmentFrame")); m_pFrameMgr->Register(TWrap<ReputeFrame>(), _T("ReputeFrame")); m_pFrameMgr->Register(TWrap<FameHallFrame>(), _T("FameHallFrame")); m_pFrameMgr->Register(TWrap<ClanTreasureFrame>(), _T("ClanTreasureFrame")); m_pFrameMgr->Register(TWrap<RoleTitleFrame>(), _T("RoleTitleFrame")); m_pFrameMgr->Register(TWrap<InformationFrame>(), _T("InformationFrame")); m_pFrameMgr->Register(TWrap<DispRoleInfoFrame>(), _T("DispRoleInfoFrame")); m_pFrameMgr->Register(TWrap<ItemProduceFrame>(), _T("ItemProduceFrame")); m_pFrameMgr->Register(TWrap<DeComposeFrame>(), _T("DeComposeFrame")); m_pFrameMgr->Register(TWrap<EquipConsolidateFrame>(), _T("EquipConsolidateFrame")); m_pFrameMgr->Register(TWrap<ChatFrame>(), _T("ChatFrame")); m_pFrameMgr->Register(TWrap<MilleSoundFrame>(), _T("MilleSoundFrame")); m_pFrameMgr->Register(TWrap<EmotionFrame>(), _T("EmotionFrame")); m_pFrameMgr->Register(TWrap<ShortcutBarFrame>(), _T("ShortcutBarFrame")); m_pFrameMgr->Register(TWrap<WorldPickerFrame>(), _T("WorldPickerFrame")); m_pFrameMgr->Register(TWrap<CombatSys>(), _T("CombatSysFrame")); m_pFrameMgr->Register(TWrap<TalentFrame>(), _T("TalentFrame")); m_pFrameMgr->Register(TWrap<TalentTreeFrame>(), _T("TalentTreeFrame")); m_pFrameMgr->Register(TWrap<SkillBookFrame>(), _T("SkillBookFrame")); m_pFrameMgr->Register(TWrap<ServerSelectFrame>(), _T("ServerSelectFrame")); m_pFrameMgr->Register(TWrap<RoleFloatTipsFrame>(), _T("RoleFloatTipsFrame")); m_pFrameMgr->Register(TWrap<GameInputFrame>(), _T("GameInputFrame")); m_pFrameMgr->Register(TWrap<SkillProgressFrame>(), _T("SkillProgressFrame")); m_pFrameMgr->Register(TWrap<SceneCenterInfoFrame>(), _T("SceneCenterInfoFrame")); m_pFrameMgr->Register(TWrap<RoleHeadTipsFrame>(), _T("RoleHeadTipsFrame")); m_pFrameMgr->Register(TWrap<DakFrame>(), _T("DakFrame")); m_pFrameMgr->Register(TWrap<SocialMgr>(), _T("SocialMgrFrame")); m_pFrameMgr->Register(TWrap<ZoneMapFrame>(), _T("ZoneMapFrame")); m_pFrameMgr->Register(TWrap<MallFrame>(), _T("MallFrame")); m_pFrameMgr->Register(TWrap<MallGiftFrame>(), _T("MallGiftFrame")); m_pFrameMgr->Register(TWrap<YuanbaoFrame>(), _T("YuanbaoFrame")); m_pFrameMgr->Register(TWrap<TeammatesStateFrame>(), _T("TeammatesState")); m_pFrameMgr->Register(TWrap<StallShelfFrame>(), _T("StallShelfFrame")); m_pFrameMgr->Register(TWrap<StallVendFrame>(), _T("StallVendFrame")); m_pFrameMgr->Register(TWrap<StallSignboardTipsFrame>(), _T("StallSignboardTipsFrame")); m_pFrameMgr->Register(TWrap<QuitFrame>(), _T("QuitFrame")); m_pFrameMgr->Register(TWrap<InstanceQuitFrame>(), _T("InstanceQuitFrame")); m_pFrameMgr->Register(TWrap<DungeonSys>(), _T("DungeonSysFrame")); m_pFrameMgr->Register(TWrap<CountDownFrame>(), _T("CountDownFrame")); m_pFrameMgr->Register(TWrap<PetFrame>(), _T("PetFrame")); m_pFrameMgr->Register(TWrap<PetSkillFrame>(), _T("PetSkillFrame")); m_pFrameMgr->Register(TWrap<PetInformationFrame>(), _T("PetInformationFrame")); m_pFrameMgr->Register(TWrap<PetTradeFrame>(), _T("PetTradeFrame")); m_pFrameMgr->Register(TWrap<PetTradeUIFrame>(), _T("PetTradeUIFrame")); m_pFrameMgr->Register(TWrap<TreasureChestFrame>(), _T("TreasureChestFrame")); m_pFrameMgr->Register(TWrap<GuildFrame>(), _T("GuildFrame")); m_pFrameMgr->Register(TWrap<GuildMemberInfoFrame>(), _T("GuildMemberInfoFrame")); m_pFrameMgr->Register(TWrap<GuildMemberPosFrame>(), _T("GuildMemberPosFrame")); m_pFrameMgr->Register(TWrap<GuildAffairFrame>(), _T("GuildAffairFrame")); m_pFrameMgr->Register(TWrap<GuildUpgradeFrame>(), _T("GuildUpgradeFrame")); m_pFrameMgr->Register(TWrap<GuildPickUpSilverFrame>(), _T("GuildPickUpSilverFrame")); m_pFrameMgr->Register(TWrap<GuildContributeSilverFrame>(), _T("GuildContributeSilverFrame")); m_pFrameMgr->Register(TWrap<GuildBusinessFrame>(), _T("GuildBusinessFrame")); m_pFrameMgr->Register(TWrap<GuildBusinessRankFrame>(), _T("GuildBusinessRankFrame")); m_pFrameMgr->Register(TWrap<GuildBusinessStateWnd>(), _T("GuildBusinessStateWnd")); m_pFrameMgr->Register(TWrap<NoticeFrame>(), _T("NoticeFrame")); m_pFrameMgr->Register(TWrap<InsuranceFrame>(), _T("InsuranceFrame")); m_pFrameMgr->Register(TWrap<GroupBuyFrame>(), _T("GroupBuyFrame")); m_pFrameMgr->Register(TWrap<OnlineTips>(), _T("OnlineTipsFrame")); m_pFrameMgr->Register(TWrap<GroundItemTipsFrame>(), _T("GroundItemTipsFrame")); m_pFrameMgr->Register(TWrap<GmConsoleFrame>(), _T("GmConsoleFrame")); m_pFrameMgr->Register(TWrap<StallVipFrame>(), _T("StallVipFrame")); m_pFrameMgr->Register(TWrap<OwnerImeFrame>(), _T("OwnerImeFrame")); m_pFrameMgr->Register(TWrap<RemoteRoleStateFrame>(), _T("RemoteRoleStateFrame")); m_pFrameMgr->Register(TWrap<ChatChannelSetFrame>(), _T("ChatChannelSetFrame")); m_pFrameMgr->Register(TWrap<MouseIntoTipsFrame>(), _T("MouseIntoTipsFrame")); m_pFrameMgr->Register(TWrap<ActivityPvPFrame>(), _T("ActivityPvPFrame")); m_pFrameMgr->Register(TWrap<EquipRecencyFrame>(), _T("EquipRecencyFrame")); m_pFrameMgr->Register(TWrap<SpecialSkillFrame>(), _T("SpecialSkillFrame")); m_pFrameMgr->Register(TWrap<StyleActionFrame>(), _T("StyleActionFrame")); m_pFrameMgr->Register(TWrap<GuildStorageFrame>(), _T("GuildStorageFrame")); m_pFrameMgr->Register(TWrap<GuildStorePermitFrame>(), _T("GuildStorePermitFrame")); m_pFrameMgr->Register(TWrap<HelpFrame>(), _T("HelpFrame")); m_pFrameMgr->Register(TWrap<QuizFrame>(), _T("QuizFrame")); m_pFrameMgr->Register(TWrap<ProfessionFrame>(), _T("ProfessionFrame")); m_pFrameMgr->Register(TWrap<QuestTargetWnd>(), _T("QuestTargetWnd")); m_pFrameMgr->Register(TWrap<MarriageFrame>(), _T("MarriageFrame")); m_pFrameMgr->Register(TWrap<DivorceFrame>(), _T("DivorceFrame")); m_pFrameMgr->Register(TWrap<RenameFrame>(), _T("RenameFrame")); m_pFrameMgr->Register(TWrap<GemRemovalFrame>(),_T("GemRemovalFrame") ); //注册节日活动上线提示 m_pFrameMgr->Register(TWrap<FestivalActivityPromptFrame>(), _T("FestivalActivityPromptFrame") ); //角色升级到某个级别的提示,寻路 m_pFrameMgr->Register(TWrap<RoleLevelUpPromptFrame>(), _T("RoleLevelUpPromptFrame") ); // 注册神龙赐福模块 m_pFrameMgr->Register(TWrap<LoongBenedictionFrame>(), _T("LoongBenedictionFrame") ); QuestMgr::RegisterFrames(m_pFrameMgr); CombatSys::RegisterFrames(m_pFrameMgr); SocialMgr::RegisterFrames(m_pFrameMgr); } //----------------------------------------------------------------------------- // InitRenderSystem //----------------------------------------------------------------------------- BOOL Client::InitRenderSystem(HINSTANCE hInst) { GameSet::Inst()->Init(); DWORD dwWindow = GameSet::Inst()->Get(EGS_Windowed); INT nWidth = GameSet::Inst()->Get(EGS_PelsWidth); INT nHeight = GameSet::Inst()->Get(EGS_PelsHeight); RECT rc = {0}; // 窗口标题 tstringstream stream; stream<<g_pAppName<<_T(" ") <<g_pBuildType<<_T(" ")<<g_pVersion; Kernel::Inst()->CreateEngine(( Cool3D::ConfigFile*)NULL); switch(dwWindow) { case 0: // 全屏 { m_pWindow->Init(m_pGUIRender, nWidth, nHeight, FALSE, FALSE); m_pWindow->SetInvisibleIme(TRUE); OwnerImeMgr::Inst()->Init(); OwnerImeMgr::Inst()->EnableOwnerIme(); } break; case 1: // 最佳窗口 m_pWindow->Init(m_pGUIRender, 0, 0, FALSE, TRUE); break; case 2: // 标准窗口 m_pWindow->Init(m_pGUIRender, nWidth, nHeight, TRUE, TRUE); break; case 3: // 假全屏 m_pWindow->Init(m_pGUIRender, 0, 0, FALSE, FALSE); break; } m_pWindow->CreateWnd(stream.str().c_str(), hInst); HWND hWnd = (HWND)TObjRef<VarContainer>()->GetDword(_T("HWND")); // 得到实际客户区大小 ::GetClientRect(hWnd, (LPRECT)&rc); nWidth = rc.right - rc.left; nHeight = rc.bottom - rc.top; tagDeviceCfg cfg; cfg.bWindowed = (dwWindow > 0); cfg.depthFormat = EDF_D24S8; cfg.hWnd = hWnd; cfg.nWidth = nWidth; cfg.nHeight = nHeight; cfg.nFullScreenHZ = 0; cfg.bVerticalSync = TRUE == GameSet::Inst()->Get( EGS_VerSynch ); cfg.multiSampleType = (EMultisampleType)GameSet::Inst()->Get( EGS_MultiSampleType ); if(dwWindow>0) { HDC hDC=::GetDC(hWnd); int screenColorBits=GetDeviceCaps(hDC,BITSPIXEL); ReleaseDC(hWnd,hDC); //--自动检测16bit还是32bit窗口模式 cfg.pixelFormat = (screenColorBits==32) ? EPF_X8R8G8B8 : EPF_R5G6B5; } else cfg.pixelFormat=EPF_X8R8G8B8; Kernel::Inst()->CreateRenderDevice(&cfg); Kernel::Inst()->GetRenderSys()->EnableFog(true); // 清空一下后台缓冲 Cool3D::IDevice* pDev=Cool3D::Device(); pDev->Begin(); pDev->Clear(true,true,true,0xff000000,1.0f,0); pDev->End(); pDev->Present(); pDev->Begin(); pDev->Clear(true,true,true,0xff000000,1.0f,0); pDev->End(); pDev->Present(); GameSet::Inst()->ApplyAll(); m_pGUIRender->Init(); m_pGUI->Init(nWidth, nHeight, m_pGUIRender, "VFS_System"); // 载入字体 m_pGUI->LoadFont(_T("kaiti.ttf")); m_pGUI->LoadFont(_T("lishu.ttf")); m_pGUI->LoadFont(_T("hanyi.ttf")); m_pGUI->LoadFont(_T("MSYH.TTF")); m_pGUI->LoadFont(_T("msyhb.ttf")); return TRUE; } //----------------------------------------------------------------------------- // GUIWnd显示开关 //----------------------------------------------------------------------------- DWORD Client::SwitchGUIWnd( DWORD dwID, BOOL bDown ) { if( bDown ) { WorldFrame* pWolrdFrame = GetWorldFrm(); if( m_pGUI->GetDesktop()->IsInvisible() ) { m_pGUI->GetDesktop()->SetInvisible(false); // 显示界面 // 摄像机退出fly模式 if( P_VALID(pWolrdFrame) && 17173 == GameSet::Inst()->Get(EGS_GmConsle) ) pWolrdFrame->GetCamera()->EnableFlyMode(false); } else { m_pGUI->GetDesktop()->SetInvisible(true); // 隐藏界面 // 摄像机进入fly模式 if( P_VALID(pWolrdFrame) && 17173 == GameSet::Inst()->Get(EGS_GmConsle) ) pWolrdFrame->GetCamera()->EnableFlyMode(true); } } return 0; } //----------------------------------------------------------------------------- // 截图 //----------------------------------------------------------------------------- DWORD Client::ScreenShot(DWORD dwID, BOOL bDown) { // INT* p = 0; // *p = 0; if( !bDown ) return 0; // 创建目录,防止玩家将此目录删除之后无法保存图片 CreateDirectory(_T("screenshot"), NULL); vEngine::SetDefaultDir(); // 如果只使用系统时间作为文件名,那么同一秒内抓的文件会被覆盖 TCHAR szTime[MAX_PATH]; FILETIME CurrentTime; GetSystemTimeAsFileTime(&CurrentTime); szTime[0] = _T('\0'); WORD wDate, wTime; if (FileTimeToLocalFileTime(&CurrentTime, &CurrentTime) && FileTimeToDosDateTime(&CurrentTime, &wDate, &wTime)) { // 年月日以及时分秒和timeGetTime wsprintf(szTime, _T("[%d-%d-%d %02d%02d%02d]-%d"), (wDate / 32) & 15, wDate & 31, (wDate / 512) + 1980, (wTime >> 11), (wTime >> 5) & 0x3F, (wTime & 0x1F) * 2, timeGetTime()); } tstringstream streamPath; if( dwID == 0 ) streamPath << (_T("screenshot\\LoongScreenshot")) << szTime << _T(".bmp"); else streamPath << (_T("screenshot\\LoongScreenshot")) << szTime << _T(".jpg"); if( Device()->ScreenShot(streamPath.str().c_str(), dwID==1) ) { ChatFrame* pChatFrame = (ChatFrame*)(m_pFrameMgr->GetFrame(_T("Chat"))); if( P_VALID(pChatFrame) ) { tstring strMsg = g_StrTable[_T("ScreenShoot_OK")]; strMsg += streamPath.str(); //添加从服务器接受的聊天数据到相应的显示频道 pChatFrame->PushInfo(strMsg.c_str(), ESCC_System); } } return 0; } //----------------------------------------------------------------------------- // GM命令处理 //----------------------------------------------------------------------------- DWORD Client::GMCommand(LPCTSTR szCommand) { if( m_pSession->IsConnect() ) { tagNC_GMCommand cmd; lstrcpyn(cmd.szCommand, szCommand, MAX_GM_COMMAND_LEN-1); m_pSession->Send(&cmd); return 1; } else { IMSG(_T("Have not connected to Server yet\r\n")); return -1; } } //----------------------------------------------------------------------------- // 将3D引擎资源池状态写入日志文件 //----------------------------------------------------------------------------- DWORD Client::LogResPool( LPCTSTR szCommand ) { Cool3D::ResMgr::Inst()->Report(); Cool3D::IDraw2D::Inst()->Report(); WorldBase::NavResMgr::Inst()->Report(); return 0; } //----------------------------------------------------------------------------- // 显示本地角色所有属性 //----------------------------------------------------------------------------- DWORD Client::DisplayLocalRoleAtt(LPCTSTR szCommand) { LocalPlayer* pLP = RoleMgr::Inst()->GetLocalPlayer(); if( P_VALID(pLP)) { for( int i=ERA_AttA_Start; i<ERA_End; ++i ) { TCHAR szBuff[X_LONG_NAME] = {0}; _sntprintf( szBuff, X_LONG_NAME, _T("LocalPlayerAtt_%d"), i ); TCHAR szShow[X_LONG_NAME] = {0}; _sntprintf( szShow, X_LONG_NAME, g_StrTable[szBuff], pLP->GetAttribute((ERoleAttribute)i) ); IMSG(_T("%s\n"), szShow); } } return 0; } //----------------------------------------------------------------------------- // 关闭/开起头顶tips //----------------------------------------------------------------------------- DWORD Client::HeadTipsCommand(LPCTSTR szCommand) { RoleHeadTipsFrame* pFrame = (RoleHeadTipsFrame*)m_pFrameMgr->GetFrame(_T("RoleHeadTips")); if( P_VALID(pFrame) ) { tstring strTmp = szCommand; if( !strTmp.empty() && strTmp.find(_T('0'))!=strTmp.npos ) { pFrame->SetIsShowHeadTips(FALSE); } else if( !strTmp.empty() && strTmp.find(_T('1'))!=strTmp.npos ) { pFrame->SetIsShowHeadTips(TRUE); } } return 0; } //----------------------------------------------------------------------------- // 资源读取线程 //----------------------------------------------------------------------------- UINT Client::ThreadLoad( LPVOID ) { DWORD dwTotalTime = timeGetTime(); try { IMSG(_T("CreatureData Loaded.\r\n")); CreatureData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("PetData Loaded.\r\n")); PetProtoData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("ScnSfxData Loaded.\r\n")); SceneEffectData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("ItemProtoData Loaded.\r\n")); ItemProtoData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("SkillProtoData Loaded.\r\n")); SkillProtoData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("ShopProtoData Loaded.\r\n")); ShopProtoData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("ConsolidateData Loaded.\r\n")); ConsolidateData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("ProduceData Loaded.\r\n")); ProduceData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; RoleInfoProtoData::inst()->LoadFromFile(); if (m_bTerminateThreadLoad) return 0; RoleTitleProtoData::Inst()->LoadFromFile(); if (m_bTerminateThreadLoad) return 0; MapLogicData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("DakData Loaded.\r\n")); DakData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("LevelUpData Loaded.\r\n")); LevelUpData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("PersonalityActData Loaded.\r\n")); PersonalityActData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("ZoneMapData Loaded.\r\n")); ZoneMapData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("QuestMgr Loaded.\r\n")); QuestMgr::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; MallData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; FilterData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; LonghunAttData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; SFXData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; PlayerActionData::Inst()->LoadFromFile(); if( m_bTerminateThreadLoad ) return 0; MonsterSayTable::Inst()->Init(); if( m_bTerminateThreadLoad ) return 0; IMSG(_T("\r\nTotal time = %d\r\n"), timeGetTime()-dwTotalTime); } catch(vEngine::Exception) { #ifdef _DEBUG throw; // 方便调试器调试 #endif } _endthreadex(0); return 0; } //----------------------------------------------------------------------------- // 等待资源读取线程完成 //----------------------------------------------------------------------------- VOID Client::WaitThreadLoad() { WaitForSingleObject(m_hThreadLoad, INFINITE); } //----------------------------------------------------------------------------- // 等待资源读取线程强行结束 //----------------------------------------------------------------------------- VOID Client::ExitThreadLoad() { m_bTerminateThreadLoad = TRUE; WaitForSingleObject(m_hThreadLoad, INFINITE); } BOOL Client::DeleteDirectory( LPCTSTR szDirName ) { TCHAR cFiles[100] = {0}; _tcscpy(cFiles, szDirName); _tcscat(cFiles, _T("\\*.*")); WIN32_FIND_DATA wfd; HANDLE hFind = FindFirstFile(cFiles, &wfd); TCHAR cTmp[200] = {0}; if(hFind != INVALID_HANDLE_VALUE) { BOOL bFind = TRUE; while(bFind) { _tcscpy(cTmp, szDirName); _tcscat(cTmp, _T("\\")); _tcscat(cTmp, wfd.cFileName); SetFileAttributes(cTmp, FILE_ATTRIBUTE_NORMAL); DeleteFile(cTmp); bFind=FindNextFile(hFind,&wfd); } FindClose(hFind); } return TRUE; }
[ "prihodko@dlit.dp.ua" ]
prihodko@dlit.dp.ua
0de461b0ebd370c5b192af2b7a626a2e7f00d00a
9a042e84901ae0f9cfa034964ae6379800ec196d
/hydrogenMusic/lyrics.h
aefd0025e38cc8085aa0f7ee7217a4fb960c35af
[]
no_license
375187588/hydrogenMusic
8f57ad918ccc7e5af87440c85c15a7181f13a5bf
030d0f0e7c083633ab5fa69d56560cc73e5b0bfd
refs/heads/master
2022-01-12T17:27:18.131845
2019-05-25T22:40:51
2019-05-25T22:40:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,608
h
#ifndef LYRICS_H #define LYRICS_H #include <QObject> #include <QQmlListProperty> #include <string> #include <QVariant> const int MAX_LYRCE_REPEAT_NUM = 10; class Lyric:public QObject { Q_OBJECT Q_PROPERTY(QList<QString> header READ header) Q_PROPERTY(int lineNum READ lineNum) Q_PROPERTY(QList<QString> lheader READ lheader WRITE setlheader NOTIFY lheaderChanged) Q_PROPERTY(QList<QString> lyricContent READ lyricContent WRITE setlyricContent NOTIFY lyricContentChanged) Q_PROPERTY(QList<int> endTime READ endTime) Q_PROPERTY(QList<int> startTime READ startTime WRITE setstartTime NOTIFY startTimeChanged) public: explicit Lyric(QObject *parent = 0):QObject(parent) {/*readLyric();*/} QList<QString> header() const; int lineNum() const; QList<QString> lheader() const; void setlheader(QList<QString> &l); QList<QString> lyricContent() const; void setlyricContent(QList<QString> &lc); QList<int> endTime() const; QList<int> startTime() const; void setstartTime(QList<int> &s); Q_INVOKABLE void readLyric(QString addr); void analysisOneLine(std::string str); bool getLyricHeader(std::string str); Q_INVOKABLE int changeStringToInt(std::string str_time); void clean(); signals: void lheaderChanged(); void lyricContentChanged(); void startTimeChanged(); void lAddressChanged(); void ok(); private: QList<QString> m_header; int m_lineNum; QList<QString> m_Lheader; QList<QString> m_lyricContent; QList<int> m_endTime; QList<int> m_startTime; }; #endif // LYRICS_H
[ "root@localhost.localdomain" ]
root@localhost.localdomain
31d841ce4aa01cff1cdcfb7fbeee9b934d4c0927
d472087e262d07c629c6c1ab0ebb501906c7eae9
/fuzz_deepstate/test_art_fuzz_deepstate.cpp
5bcd68e2b401290de9f0689fa3b563b9ab7b2390
[ "Apache-2.0" ]
permissive
laurynas-biveinis/unodb
9fb4d8ba8c51cae48574b0863dacfa8dcb70b2da
5778d801e26044d2ce078ce658bfd1cb6f983611
refs/heads/master
2023-07-22T04:40:16.197881
2023-07-14T06:12:22
2023-07-14T06:12:22
166,560,550
43
4
Apache-2.0
2023-09-12T14:17:11
2019-01-19T15:16:54
C++
UTF-8
C++
false
false
10,450
cpp
// Copyright 2019-2023 Laurynas Biveinis #include "global.hpp" #include <algorithm> #include <cstddef> #include <cstdint> #include <limits> #include <new> #include <optional> #include <sstream> #include <tuple> #include <unordered_map> #include <utility> #include <vector> #include <deepstate/DeepState.hpp> #include <gsl/util> #include "art.hpp" #include "art_common.hpp" #include "deepstate_utils.hpp" #include "heap.hpp" #include "node_type.hpp" namespace { constexpr auto maximum_value_len = 1024 * 1024; // 1MB // Close to the longest test run that fits into 8192 random bytes provided by // DeepState API. constexpr auto test_length = 480; using dynamic_value = std::vector<std::byte>; using values_type = std::vector<dynamic_value>; using oracle_type = std::unordered_map<unodb::key, unodb::value_view>; [[nodiscard]] auto make_random_value(dynamic_value::size_type length) { dynamic_value result{length}; for (dynamic_value::size_type i = 0; i < length; i++) { // Ideally we would take random bytes from DeepState, but we'd end up // exhausting their default source len too soon. Do something deterministic // that has embedded zero bytes to shake out any C string API use result[i] = gsl::narrow_cast<std::byte>(i % 256); } return result; } [[nodiscard]] auto get_value(dynamic_value::size_type max_length, values_type &values) { const auto make_new_value = values.empty() || DeepState_Bool(); ASSERT(max_length <= std::numeric_limits<std::uint32_t>::max()); if (make_new_value) { const dynamic_value::size_type new_value_len = DeepState_SizeTInRange(0, max_length); auto new_value = make_random_value(new_value_len); LOG(TRACE) << "Making a new value of length " << new_value_len; const auto &inserted_value = values.emplace_back(std::move(new_value)); return unodb::value_view{inserted_value}; } LOG(TRACE) << "Reusing an existing value"; ASSERT(values.size() <= std::numeric_limits<std::uint32_t>::max()); const auto existing_value_i = DeepState_ContainerIndex(values); const auto &existing_value = values[existing_value_i]; return unodb::value_view{existing_value}; } [[nodiscard]] unodb::key get_key(unodb::key max_key_value, const std::vector<unodb::key> &keys) { const auto use_existing_key = !keys.empty() && DeepState_Bool(); if (use_existing_key) { ASSERT(!keys.empty()); ASSERT(keys.size() <= std::numeric_limits<std::uint32_t>::max()); const auto existing_key_i = DeepState_ContainerIndex(keys); return keys[existing_key_i]; } return DeepState_UInt64InRange(0, max_key_value); } void dump_tree(const unodb::db &tree) { // Dump the tree to a string. Do not attempt to check the dump format, only // that dumping does not crash std::stringstream dump_sink; tree.dump(dump_sink); } void assert_unchanged_tree_after_failed_op( const unodb::db &test_db, std::size_t mem_use_before, const unodb::node_type_counter_array &node_counts_before, const unodb::inode_type_counter_array &growing_inode_counts_before, const unodb::inode_type_counter_array &shrinking_inode_counts_before, std::size_t key_prefix_splits_before) { const auto mem_use_after = test_db.get_current_memory_use(); ASSERT(mem_use_after == mem_use_before); const auto node_counts_after = test_db.get_node_counts(); ASSERT(node_counts_before == node_counts_after); const auto growing_inode_counts_after = test_db.get_growing_inode_counts(); ASSERT(growing_inode_counts_before == growing_inode_counts_after); const auto shrinking_inode_counts_after = test_db.get_shrinking_inode_counts(); ASSERT(shrinking_inode_counts_before == shrinking_inode_counts_after); const auto key_prefix_splits_after = test_db.get_key_prefix_splits(); ASSERT(key_prefix_splits_before == key_prefix_splits_after); } void op_with_oom_test(oracle_type &oracle, std::vector<unodb::key> &keys, unodb::db &test_db, unodb::key key, std::optional<unodb::value_view> value) { const auto do_insert = value.has_value(); const auto mem_use_before = test_db.get_current_memory_use(); const auto node_counts_before = test_db.get_node_counts(); const auto growing_inode_counts_before = test_db.get_growing_inode_counts(); const auto shrinking_inode_counts_before = test_db.get_shrinking_inode_counts(); const auto key_prefix_splits_before = test_db.get_key_prefix_splits(); bool op_result; #ifndef NDEBUG unsigned fail_n = 1; #endif while (true) { UNODB_DETAIL_FAIL_ON_NTH_ALLOCATION(fail_n); bool op_completed; try { op_result = do_insert ? test_db.insert(key, *value) : test_db.remove(key); op_completed = true; } catch (const std::bad_alloc &) { const auto search_result = test_db.get(key).has_value(); ASSERT(search_result == (oracle.find(key) != oracle.cend())); assert_unchanged_tree_after_failed_op( test_db, mem_use_before, node_counts_before, growing_inode_counts_before, shrinking_inode_counts_before, key_prefix_splits_before); UNODB_DETAIL_RESET_ALLOCATION_FAILURE_INJECTOR(); #ifndef NDEBUG ++fail_n; #endif op_completed = false; } if (op_completed) break; } if (op_result) { const auto mem_use_after = test_db.get_current_memory_use(); if (do_insert) { ASSERT(mem_use_after > mem_use_before); UNODB_DETAIL_RESET_ALLOCATION_FAILURE_INJECTOR(); LOG(TRACE) << "Inserted key" << key; const auto [insert_itr, insert_ok] = oracle.try_emplace(key, *value); std::ignore = insert_itr; ASSERT(insert_ok); keys.emplace_back(key); } else { ASSERT(mem_use_after < mem_use_before); UNODB_DETAIL_RESET_ALLOCATION_FAILURE_INJECTOR(); LOG(TRACE) << "Deleted key " << key; const auto oracle_delete_result = oracle.erase(key); ASSERT(oracle_delete_result == 1); } } else { assert_unchanged_tree_after_failed_op( test_db, mem_use_before, node_counts_before, growing_inode_counts_before, shrinking_inode_counts_before, key_prefix_splits_before); ASSERT((oracle.find(key) == oracle.cend()) == !do_insert); UNODB_DETAIL_RESET_ALLOCATION_FAILURE_INJECTOR(); LOG(TRACE) << (do_insert ? "Tried inserting duplicated key " : "Tried deleting missing key ") << key; } dump_tree(test_db); LOG(TRACE) << "Current mem use: " << test_db.get_current_memory_use(); } } // namespace UNODB_START_DEEPSTATE_TESTS() TEST(ART, DeepStateFuzz) { const auto limit_max_key = DeepState_Bool(); const auto max_key_value = limit_max_key ? DeepState_UInt64InRange(0, std::numeric_limits<unodb::key>::max()) : std::numeric_limits<unodb::key>::max(); if (limit_max_key) LOG(TRACE) << "Limiting maximum key value to " << max_key_value; else LOG(TRACE) << "Not limiting maximum key value (" << max_key_value << ")"; static_assert(maximum_value_len <= std::numeric_limits<std::uint32_t>::max()); const auto limit_value_length = DeepState_Bool(); const auto max_value_length = limit_value_length ? DeepState_UIntInRange(0, maximum_value_len) : maximum_value_len; if (limit_value_length) LOG(TRACE) << "Limiting maximum value length to " << max_value_length; else LOG(TRACE) << "Not limiting value length (" << max_value_length << ")"; unodb::db test_db; ASSERT(test_db.empty()); std::vector<unodb::key> keys; values_type values; oracle_type oracle; for (auto i = 0; i < test_length; i++) { LOG(TRACE) << "Iteration " << i; deepstate::OneOf( // Insert [&] { const auto key = DeepState_UInt64InRange(0, max_key_value); const auto value = get_value(max_value_length, values); LOG(TRACE) << "Inserting key " << key; op_with_oom_test(oracle, keys, test_db, key, value); }, // Query [&] { UNODB_DETAIL_FAIL_ON_NTH_ALLOCATION(1); const auto key = get_key(max_key_value, keys); LOG(TRACE) << "Searching for key " << key; const auto search_result = test_db.get(key); const auto oracle_search_result = oracle.find(key); if (search_result) { ASSERT(!test_db.empty()); ASSERT(oracle_search_result != oracle.cend()) << "If search found a key, oracle must contain that key"; ASSERT(std::equal(std::cbegin(*search_result), std::cend(*search_result), std::cbegin(oracle_search_result->second), std::cend(oracle_search_result->second))) << "Values stored in ART and in oracle must match"; } else { ASSERT(oracle_search_result == oracle.cend()) << "If search did not find a key, oracle must not find it too "; } UNODB_DETAIL_RESET_ALLOCATION_FAILURE_INJECTOR(); }, // Delete [&] { // Delete everything with 0.1% probability const auto clear = (DeepState_UIntInRange(0, 999) == 0); if (clear) { LOG(TRACE) << "Clearing the tree"; UNODB_DETAIL_FAIL_ON_NTH_ALLOCATION(1); test_db.clear(); oracle.clear(); ASSERT(test_db.get_current_memory_use() == 0); ASSERT(test_db.empty()); UNODB_DETAIL_RESET_ALLOCATION_FAILURE_INJECTOR(); return; } const auto key = get_key(max_key_value, keys); LOG(TRACE) << "Deleting key " << key; op_with_oom_test(oracle, keys, test_db, key, {}); }); } auto prev_mem_use = test_db.get_current_memory_use(); while (!oracle.empty()) { const auto [key, value] = *oracle.cbegin(); LOG(TRACE) << "Shutdown: deleting key " << key; const auto oracle_remove_result = oracle.erase(key); ASSERT(oracle_remove_result == 1); const auto db_remove_result = test_db.remove(key); ASSERT(db_remove_result); const auto current_mem_use = test_db.get_current_memory_use(); LOG(TRACE) << "Current mem use: " << current_mem_use; ASSERT(current_mem_use < prev_mem_use); prev_mem_use = current_mem_use; } ASSERT(prev_mem_use == 0); ASSERT(test_db.empty()); }
[ "laurynas.biveinis@gmail.com" ]
laurynas.biveinis@gmail.com
60206d4a638ea746cdbcad325bd4dce25a74dfc8
ef5c199ad0b4d2bb6da40005c2babf84fe29fd60
/DatabaseConnector.h
09c5ec29f0f32d489c3250cde81e0d80c8652f5f
[]
no_license
SkyZoThreaD/Organizer
bd54b5a7367f016b1cbed4e3f50771b0f64e06a3
d22bf4d24fdb2c22143f257e5d3094332d0fae04
refs/heads/master
2021-04-12T01:58:05.686980
2018-03-26T15:30:32
2018-03-26T15:30:32
125,854,685
0
0
null
null
null
null
UTF-8
C++
false
false
986
h
/* Standard C++ includes */ #include <stdlib.h> #include <iostream> /* Include directly the different headers from cppconn/ and mysql_driver.h + mysql_util.h (and mysql_connection.h). This will reduce your build time! */ #include "mysql_connection.h" #include <cppconn/driver.h> #include <cppconn/exception.h> #include <cppconn/resultset.h> #include <cppconn/statement.h> #include "ModelColumns.h" #include <sstream> #include <gtkmm.h> std::string StateNumberToString(int nb); std::string UrgencyNumberToString(int nb); class DatabaseConnector { private: std::string m_ServerIpPort; std::string m_User; std::string m_Password; std::string m_Database; public: DatabaseConnector(std::string ServerIpPort, std::string User, std::string Password, std::string Database); void AddTask(std::string TaskTitle, std::string TaskContent, int TaskUrgency, int TaskState); void FillTreeModel(Glib::RefPtr<Gtk::ListStore> List, ModelColumns *m_Columns); };
[ "skyzothread@gmail.com" ]
skyzothread@gmail.com
3f3c18fe4424da301fea3448b8fdce5911333eb9
4b24f950cb588c1f847d239a934efdae873a3a62
/Semana4/Semana4/TrianguloRectangulo.cpp
d47af6dedabc157b67f9fb8cc369257f060c2099
[]
no_license
DJGR19/Semana-4-Progra-III
3d4926f6fae05080df24dd941a236d4b85f4de9a
df9a766ec7d0782e115b12758f4f30a8209d533a
refs/heads/master
2020-03-25T16:52:47.961595
2018-08-08T02:45:22
2018-08-08T02:45:22
143,951,895
0
0
null
null
null
null
ISO-8859-1
C++
false
false
1,314
cpp
#include <iostream> #include <cmath> #include "TrianguloRectangulo.h" //mary2312blue@yahoo.com using namespace std; TrianguloRectangulo::TrianguloRectangulo() : base(0), altura(0) {} TrianguloRectangulo::TrianguloRectangulo(float b, float a) { setAltura(a); setBase(b); } void TrianguloRectangulo::setBase(float b) { if (b > 0) this->base = b; else cout << "Error en ingreso de base!" << endl; } void TrianguloRectangulo::setAltura(float a) { if (a > 0) this->altura = a; else cout << "Error en ingreso de altura" << endl; } float TrianguloRectangulo::getBase() { return this->base; } float TrianguloRectangulo::getAltura() { return this->altura; } //FORMULA? float TrianguloRectangulo::getArea() { return (base*altura) / 2; } float TrianguloRectangulo::getPerimetro() { return base + altura + (sqrt(altura *altura + base *base)); } float TrianguloRectangulo::getHipotenusa() { return (sqrt(altura*altura + base * base)); } int TrianguloRectangulo::getTipo() { return 2;//TriangRecta } void TrianguloRectangulo::imprimirFigura() { cout << "TriánguloRectángulo: {Base: " << getBase() << "{Altura: " << getAltura() << "}" << endl; cout << "Área: " << getArea() << "Perímetro " << getPerimetro() << endl; }
[ "noreply@github.com" ]
DJGR19.noreply@github.com
e83863de74916659186770d163df3f85dce7ea9c
bfdfcb02edd4d792ab9888bcf0809036d919fc4e
/include/scenes/createAccountScene.h
03af274395e191dcd27bcca3f51f0688bf0ac4fe
[]
no_license
Krosser22/MultiplayerClient
67c6f3f4b76c803d393e993e2f8f8203c2336955
da12c323abf27efbe98c0ecdfe39b71662e0f477
refs/heads/master
2021-01-09T05:25:40.708269
2017-01-12T23:56:42
2017-01-12T23:56:42
80,764,872
0
0
null
null
null
null
UTF-8
C++
false
false
568
h
/** *** //////////////////////////////////////////// *** /////Autor: Juan Daniel Laserna Condado///// *** /////Email: S6106112@live.tees.ac.uk ///// *** ///// 2016-2017 ///// *** //////////////////////////////////////////// **/ #ifndef __CREATE_ACCOUNT_SCENE_H__ #define __CREATE_ACCOUNT_SCENE_H__ #include "scenes/scene.h" class CreateAccountScene : public Scene { public: CreateAccountScene() {}; ~CreateAccountScene() {}; void start(); void input(); void update(); void finish(); }; #endif //__CREATE_ACCOUNT_SCENE_H__
[ "condadodaniel@hotmail.com" ]
condadodaniel@hotmail.com
f301fb9996382476128ec41dd645c2f3f477a75c
1f1cc05377786cc2aa480cbdfde3736dd3930f73
/xulrunner-sdk-26/xulrunner-sdk/include/nsISerializable.h
bb9f9b6d98852432c046961d5bef48281445c01c
[ "Apache-2.0" ]
permissive
julianpistorius/gp-revolution-gaia
84c3ec5e2f3b9e76f19f45badc18d5544bb76e0d
6e27b83efb0d4fa4222eaf25fb58b062e6d9d49e
refs/heads/master
2021-01-21T02:49:54.000389
2014-03-27T09:58:17
2014-03-27T09:58:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,124
h
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM /builds/slave/m-cen-l64-xr-ntly-000000000000/build/xpcom/ds/nsISerializable.idl */ #ifndef __gen_nsISerializable_h__ #define __gen_nsISerializable_h__ #ifndef __gen_nsISupports_h__ #include "nsISupports.h" #endif /* For IDL files that don't want to include root IDL files. */ #ifndef NS_NO_VTABLE #define NS_NO_VTABLE #endif class nsIObjectInputStream; /* forward declaration */ class nsIObjectOutputStream; /* forward declaration */ /* starting interface: nsISerializable */ #define NS_ISERIALIZABLE_IID_STR "91cca981-c26d-44a8-bebe-d9ed4891503a" #define NS_ISERIALIZABLE_IID \ {0x91cca981, 0xc26d, 0x44a8, \ { 0xbe, 0xbe, 0xd9, 0xed, 0x48, 0x91, 0x50, 0x3a }} class NS_NO_VTABLE nsISerializable : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISERIALIZABLE_IID) /* void read (in nsIObjectInputStream aInputStream); */ NS_IMETHOD Read(nsIObjectInputStream *aInputStream) = 0; /* void write (in nsIObjectOutputStream aOutputStream); */ NS_IMETHOD Write(nsIObjectOutputStream *aOutputStream) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsISerializable, NS_ISERIALIZABLE_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSISERIALIZABLE \ NS_IMETHOD Read(nsIObjectInputStream *aInputStream); \ NS_IMETHOD Write(nsIObjectOutputStream *aOutputStream); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSISERIALIZABLE(_to) \ NS_IMETHOD Read(nsIObjectInputStream *aInputStream) { return _to Read(aInputStream); } \ NS_IMETHOD Write(nsIObjectOutputStream *aOutputStream) { return _to Write(aOutputStream); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSISERIALIZABLE(_to) \ NS_IMETHOD Read(nsIObjectInputStream *aInputStream) { return !_to ? NS_ERROR_NULL_POINTER : _to->Read(aInputStream); } \ NS_IMETHOD Write(nsIObjectOutputStream *aOutputStream) { return !_to ? NS_ERROR_NULL_POINTER : _to->Write(aOutputStream); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsSerializable : public nsISerializable { public: NS_DECL_ISUPPORTS NS_DECL_NSISERIALIZABLE nsSerializable(); private: ~nsSerializable(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsSerializable, nsISerializable) nsSerializable::nsSerializable() { /* member initializers and constructor code */ } nsSerializable::~nsSerializable() { /* destructor code */ } /* void read (in nsIObjectInputStream aInputStream); */ NS_IMETHODIMP nsSerializable::Read(nsIObjectInputStream *aInputStream) { return NS_ERROR_NOT_IMPLEMENTED; } /* void write (in nsIObjectOutputStream aOutputStream); */ NS_IMETHODIMP nsSerializable::Write(nsIObjectOutputStream *aOutputStream) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsISerializable_h__ */
[ "luis@geeksphone.com" ]
luis@geeksphone.com
d4af0963b36c3c3f3399f248cade0fb43357c057
9e61c2390580b6982cf08a6417e29d69a6acb600
/973_K_Closest_Points_To_Origin/heap.cpp
2e41ebfbbfc19f9877a77f7e1fdc86529b94b511
[]
no_license
acnokego/LeetCode
3027e1987cee4d130c9db7e2af4ec4de8a0f43bd
3e04e79e05ffcaf423d5a148668e132ee090596f
refs/heads/master
2021-06-07T02:39:57.956371
2019-11-30T03:45:29
2019-11-30T03:45:29
133,643,518
0
0
null
null
null
null
UTF-8
C++
false
false
822
cpp
class Solution { public: /* * Complexity: O(nlgk) * Space: O(k) */ struct compare { bool operator()(const vector<int>& p1, vector<int>& p2){ long dist1 = p1[0] * p1[0] + p1[1] * p1[1]; long dist2 = p2[0] * p2[0] + p2[1] * p2[1]; return dist1 < dist2; } }; vector<vector<int>> kClosest(vector<vector<int>>& points, int K) { priority_queue<vector<int>, vector<vector<int>>, compare>max_heap; for(int i = 0; i < points.size(); ++i){ max_heap.push(points[i]); while(max_heap.size() > K) { max_heap.pop(); } } vector<vector<int>>ans(max_heap.size()); copy(&(max_heap.top()), &(max_heap.top()) + max_heap.size(), &ans[0]); return ans; } };
[ "yuandychen@gmail.com" ]
yuandychen@gmail.com
a57716e8c60118153d20347c8b2e293f49a1e3fe
d01dc4b327e33816ac2ce2af40945a721f7b5854
/aws-cpp-sdk-imagebuilder/include/aws/imagebuilder/model/ListImageRecipesResult.h
02072cc97ea230cd7d664c9b589d793fb45f19a9
[ "MIT", "Apache-2.0", "JSON" ]
permissive
hpcc-systems/aws-sdk-cpp
36f89272e3b140fea596c73234c09fb240f86520
9c93f28159e1e01ea3ef789a1b0c2c9643955c96
refs/heads/master
2022-07-17T05:18:08.190972
2020-10-19T20:59:11
2020-10-19T20:59:11
90,974,127
0
1
Apache-2.0
2022-06-30T14:47:34
2017-05-11T11:58:14
C++
UTF-8
C++
false
false
6,310
h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/imagebuilder/Imagebuilder_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/imagebuilder/model/ImageRecipeSummary.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace imagebuilder { namespace Model { class AWS_IMAGEBUILDER_API ListImageRecipesResult { public: ListImageRecipesResult(); ListImageRecipesResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); ListImageRecipesResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>The request ID that uniquely identifies this request. </p> */ inline const Aws::String& GetRequestId() const{ return m_requestId; } /** * <p>The request ID that uniquely identifies this request. </p> */ inline void SetRequestId(const Aws::String& value) { m_requestId = value; } /** * <p>The request ID that uniquely identifies this request. </p> */ inline void SetRequestId(Aws::String&& value) { m_requestId = std::move(value); } /** * <p>The request ID that uniquely identifies this request. </p> */ inline void SetRequestId(const char* value) { m_requestId.assign(value); } /** * <p>The request ID that uniquely identifies this request. </p> */ inline ListImageRecipesResult& WithRequestId(const Aws::String& value) { SetRequestId(value); return *this;} /** * <p>The request ID that uniquely identifies this request. </p> */ inline ListImageRecipesResult& WithRequestId(Aws::String&& value) { SetRequestId(std::move(value)); return *this;} /** * <p>The request ID that uniquely identifies this request. </p> */ inline ListImageRecipesResult& WithRequestId(const char* value) { SetRequestId(value); return *this;} /** * <p>The list of image pipelines. </p> */ inline const Aws::Vector<ImageRecipeSummary>& GetImageRecipeSummaryList() const{ return m_imageRecipeSummaryList; } /** * <p>The list of image pipelines. </p> */ inline void SetImageRecipeSummaryList(const Aws::Vector<ImageRecipeSummary>& value) { m_imageRecipeSummaryList = value; } /** * <p>The list of image pipelines. </p> */ inline void SetImageRecipeSummaryList(Aws::Vector<ImageRecipeSummary>&& value) { m_imageRecipeSummaryList = std::move(value); } /** * <p>The list of image pipelines. </p> */ inline ListImageRecipesResult& WithImageRecipeSummaryList(const Aws::Vector<ImageRecipeSummary>& value) { SetImageRecipeSummaryList(value); return *this;} /** * <p>The list of image pipelines. </p> */ inline ListImageRecipesResult& WithImageRecipeSummaryList(Aws::Vector<ImageRecipeSummary>&& value) { SetImageRecipeSummaryList(std::move(value)); return *this;} /** * <p>The list of image pipelines. </p> */ inline ListImageRecipesResult& AddImageRecipeSummaryList(const ImageRecipeSummary& value) { m_imageRecipeSummaryList.push_back(value); return *this; } /** * <p>The list of image pipelines. </p> */ inline ListImageRecipesResult& AddImageRecipeSummaryList(ImageRecipeSummary&& value) { m_imageRecipeSummaryList.push_back(std::move(value)); return *this; } /** * <p>The next token used for paginated responses. When this is not empty, there * are additional elements that the service has not included in this request. Use * this token with the next request to retrieve additional objects. </p> */ inline const Aws::String& GetNextToken() const{ return m_nextToken; } /** * <p>The next token used for paginated responses. When this is not empty, there * are additional elements that the service has not included in this request. Use * this token with the next request to retrieve additional objects. </p> */ inline void SetNextToken(const Aws::String& value) { m_nextToken = value; } /** * <p>The next token used for paginated responses. When this is not empty, there * are additional elements that the service has not included in this request. Use * this token with the next request to retrieve additional objects. </p> */ inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); } /** * <p>The next token used for paginated responses. When this is not empty, there * are additional elements that the service has not included in this request. Use * this token with the next request to retrieve additional objects. </p> */ inline void SetNextToken(const char* value) { m_nextToken.assign(value); } /** * <p>The next token used for paginated responses. When this is not empty, there * are additional elements that the service has not included in this request. Use * this token with the next request to retrieve additional objects. </p> */ inline ListImageRecipesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;} /** * <p>The next token used for paginated responses. When this is not empty, there * are additional elements that the service has not included in this request. Use * this token with the next request to retrieve additional objects. </p> */ inline ListImageRecipesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;} /** * <p>The next token used for paginated responses. When this is not empty, there * are additional elements that the service has not included in this request. Use * this token with the next request to retrieve additional objects. </p> */ inline ListImageRecipesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;} private: Aws::String m_requestId; Aws::Vector<ImageRecipeSummary> m_imageRecipeSummaryList; Aws::String m_nextToken; }; } // namespace Model } // namespace imagebuilder } // namespace Aws
[ "aws-sdk-cpp-automation@github.com" ]
aws-sdk-cpp-automation@github.com
ec24f045a4dabd4e7ffd8f7a192bb82b3cd08a56
1c317570632645effae4558ea1dcaf05531b997f
/HotGain/Source/PluginProcessor.cpp
92bada3398ee2df534e0b165dd013d3da9880bf2
[]
no_license
ashtonmills/HotGain
8695f552e887db9a9c14709804b711415bc63c20
d198f3144b4835b583d48b47bdf9a0f49358d048
refs/heads/master
2020-07-27T13:23:16.375136
2019-09-17T16:32:58
2019-09-17T16:32:58
209,104,394
0
0
null
null
null
null
UTF-8
C++
false
false
6,525
cpp
/* ============================================================================== This file was auto-generated! It contains the basic framework code for a JUCE plugin processor. ============================================================================== */ #include "PluginProcessor.h" #include "PluginEditor.h" //============================================================================== //This is the initialization list: to initialise (so when the member is created, it is given a value, rather than reating it empty then giving it a value, this is more efficient apparently). HotGainAudioProcessor::HotGainAudioProcessor() #ifndef JucePlugin_PreferredChannelConfigurations : AudioProcessor (BusesProperties() #if ! JucePlugin_IsMidiEffect #if ! JucePlugin_IsSynth .withInput ("Input", AudioChannelSet::stereo(), true) #endif .withOutput ("Output", AudioChannelSet::stereo(), true) #endif ), //logVolume(-5.0f), parameters(*this, nullptr) //this is the constructor #endif { NormalisableRange<float>gainRange(-48.0f, 0.0f); parameters.createAndAddParameter(GAIN_ID, GAIN_NAME, GAIN_NAME, gainRange,0.5f, nullptr, nullptr); parameters.state = ValueTree("savedParams"); } HotGainAudioProcessor::~HotGainAudioProcessor() { } //============================================================================== const String HotGainAudioProcessor::getName() const { return JucePlugin_Name; } bool HotGainAudioProcessor::acceptsMidi() const { #if JucePlugin_WantsMidiInput return true; #else return false; #endif } bool HotGainAudioProcessor::producesMidi() const { #if JucePlugin_ProducesMidiOutput return true; #else return false; #endif } bool HotGainAudioProcessor::isMidiEffect() const { #if JucePlugin_IsMidiEffect return true; #else return false; #endif } double HotGainAudioProcessor::getTailLengthSeconds() const { return 0.0; } int HotGainAudioProcessor::getNumPrograms() { return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs, // so this should be at least 1, even if you're not really implementing programs. } int HotGainAudioProcessor::getCurrentProgram() { return 0; } void HotGainAudioProcessor::setCurrentProgram (int index) { } const String HotGainAudioProcessor::getProgramName (int index) { return {}; } void HotGainAudioProcessor::changeProgramName (int index, const String& newName) { } //============================================================================== void HotGainAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) { previousGain = pow(10, *parameters.getRawParameterValue(GAIN_ID)); } void HotGainAudioProcessor::releaseResources() { // When playback stops, you can use this as an opportunity to free up any // spare memory, etc. } #ifndef JucePlugin_PreferredChannelConfigurations bool HotGainAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const { #if JucePlugin_IsMidiEffect ignoreUnused (layouts); return true; #else // This is the place where you check if the layout is supported. // In this template code we only support mono or stereo. if (layouts.getMainOutputChannelSet() != AudioChannelSet::mono() && layouts.getMainOutputChannelSet() != AudioChannelSet::stereo()) return false; // This checks if the input layout matches the output layout #if ! JucePlugin_IsSynth if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet()) return false; #endif return true; #endif } #endif void HotGainAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages) { ScopedNoDenormals noDenormals; auto totalNumInputChannels = getTotalNumInputChannels(); auto totalNumOutputChannels = getTotalNumOutputChannels(); float currentGain = pow(10, *parameters.getRawParameterValue(GAIN_ID) / 20); if (currentGain == previousGain) { buffer.applyGain(currentGain); } else { //apply gain ramp gradually increments each sample from the start sample to the last sample in the buffer //this stops there being a 'click' when you change th values quickly. buffer.applyGainRamp(0, buffer.getNumSamples(), previousGain, currentGain); previousGain = currentGain; } // In case we have more outputs than inputs, this code clears any output // channels that didn't contain input data, (because these aren't // guaranteed to be empty - they may contain garbage). // This is here to avoid people getting screaming feedback // when they first compile a plugin, but obviously you don't need to keep // this code if your algorithm always overwrites all the output channels. for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i) buffer.clear (i, 0, buffer.getNumSamples()); // This is the place where you'd normally do the guts of your plugin's // audio processing... // Make sure to reset the state if your inner loop is processing // the samples and the outer loop is handling the channels. // Alternatively, you can process the samples with the channels // interleaved by keeping the same state. } //============================================================================== bool HotGainAudioProcessor::hasEditor() const { return true; // (change this to false if you choose to not supply an editor) } AudioProcessorEditor* HotGainAudioProcessor::createEditor() { return new HotGainAudioProcessorEditor (*this); } //============================================================================== void HotGainAudioProcessor::getStateInformation (MemoryBlock& destData) { std::unique_ptr<XmlElement> xml (parameters.state.createXml()); copyXmlToBinary(*xml, destData); } void HotGainAudioProcessor::setStateInformation (const void* data, int sizeInBytes) { std::unique_ptr <XmlElement> theParams(getXmlFromBinary(data, sizeInBytes)); if (theParams != nullptr) { if (theParams->hasTagName(parameters.state.getType())) { parameters.state = ValueTree::fromXml(*theParams); } } } //============================================================================== // This creates new instances of the plugin.. AudioProcessor* JUCE_CALLTYPE createPluginFilter() { return new HotGainAudioProcessor(); }
[ "ashton-mills@outlook.com" ]
ashton-mills@outlook.com
da660e68ea0fe1b62a0f4953e5708caa08a64422
ce99b399bead6c9a285f07d386d04a4a1c5f6bb7
/Cookbook/4569OS_CodeBundle/Chapter04/Chapter04/Shadows/Shadows/ShadowsDoc.h
36db4264eeead9962f03d519c6e3f8a697662009
[]
no_license
codediy/OgreDemo
13e97c984499330bbd733f5c7c64212324e428b4
6fb0ad2edde881feda040f5eb8bdf134f6ca9495
refs/heads/master
2020-12-05T21:44:51.348401
2020-01-07T06:13:00
2020-01-07T06:13:00
232,255,494
0
0
null
null
null
null
UTF-8
C++
false
false
1,462
h
// This MFC Samples source code demonstrates using MFC Microsoft Office Fluent User Interface // (the "Fluent UI") and is provided only as referential material to supplement the // Microsoft Foundation Classes Reference and related electronic documentation // included with the MFC C++ library software. // License terms to copy, use or distribute the Fluent UI are available separately. // To learn more about our Fluent UI licensing program, please visit // http://msdn.microsoft.com/officeui. // // Copyright (C) Microsoft Corporation // All rights reserved. // ShadowsDoc.h : interface of the CShadowsDoc class // #pragma once class CShadowsDoc : public CDocument { protected: // create from serialization only CShadowsDoc(); DECLARE_DYNCREATE(CShadowsDoc) // Attributes public: // Operations public: // Overrides public: virtual BOOL OnNewDocument(); virtual void Serialize(CArchive& ar); #ifdef SHARED_HANDLERS virtual void InitializeSearchContent(); virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds); #endif // SHARED_HANDLERS // Implementation public: virtual ~CShadowsDoc(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: DECLARE_MESSAGE_MAP() #ifdef SHARED_HANDLERS // Helper function that sets search content for a Search Handler void SetSearchContent(const CString& value); #endif // SHARED_HANDLERS };
[ "zmwwork@163.com" ]
zmwwork@163.com
27e829b521be49a518d3851f090e485a1034b8e1
cdd45cad8525c94b8beb1b3e75c76b3c870ab084
/chapter2/splitting_num.cpp
0519b4b0011381435361939a09212a1d77bf85b7
[]
no_license
kyro1202/Competitive-Programming-3
4fcf4e5516c83ce7dbfcb9084a6fa8e23b7d9dfe
1e1e784fac3f3db9117ebabca0486b0edffe149d
refs/heads/master
2021-03-22T00:16:20.365660
2018-06-06T05:02:07
2018-06-06T05:02:07
101,572,720
0
0
null
null
null
null
UTF-8
C++
false
false
577
cpp
#include <bits/stdc++.h> using namespace std; int main() { bitset<31> a,b; int count; long int n; while(true) { count = 0; cin >> n; if(!n) break; bitset<31> inp(n); a.reset(); b.reset(); for(int i = 0 ; i < inp.size() ; i++) { if(inp.test(i)) { count++; if(count%2) a[i] = 1; else b[i] = 1; } } cout << a.to_ulong() << " " << b.to_ulong() << endl; } }
[ "shivishiva2012@gmail.com" ]
shivishiva2012@gmail.com
0868122d064a8947679e49bfb1eeaed467fa8281
7d2f5e2795493e3d69eeebcd9f3d462b0ad491be
/GenXIntrinsics/include/llvmVCWrapper/IR/GlobalValue.h
98a88f3a0834f52f616ba047e063f55ba77439db
[ "MIT" ]
permissive
zuban32/vc-intrinsics
bdfc163617de68da5c578d2c8ed5d2f3d9e57c3c
c05825063e4e0e41a8cefa8bb79f17204c2be3a5
refs/heads/master
2023-03-26T21:54:52.210419
2021-03-11T12:16:28
2021-03-17T15:33:21
274,940,100
0
0
MIT
2020-06-25T14:39:20
2020-06-25T14:39:20
null
UTF-8
C++
false
false
1,666
h
/*===================== begin_copyright_notice ================================== Copyright (c) 2020, Intel Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ======================= end_copyright_notice ==================================*/ #ifndef VCINTR_IR_GLOBALVALUE_H #define VCINTR_IR_GLOBALVALUE_H #include <llvm/IR/GlobalValue.h> namespace VCINTR { namespace GlobalValue { inline unsigned getAddressSpace(const llvm::GlobalValue &GV) { #if VC_INTR_LLVM_VERSION_MAJOR <= 7 return GV.getType()->getAddressSpace(); #else return GV.getAddressSpace(); #endif } } // namespace GlobalValue } // namespace VCINTR #endif // VCINTR_IR_GLOBALVARIABLE_H
[ "konstantin.vladimirov@intel.com" ]
konstantin.vladimirov@intel.com
d97eaa94404f0339316e46074772b9f1654abf3c
b71556aee4654b48e91ba8124a3a8ded26de273e
/contest/ICPC/The 2019 Asia Yinchuan First Round Online Programming/F.cpp
f58df17363548d51da30abf67d231785e5243b44
[]
no_license
young-zy/algorithm
0255a327390c6b149870b34fbd34816dc002e82e
536eddd9a6bc03e81c566afa05c53f555eb14a86
refs/heads/master
2021-07-23T07:23:29.929221
2020-04-23T16:33:28
2020-04-23T16:33:28
149,439,464
0
0
null
null
null
null
UTF-8
C++
false
false
1,015
cpp
#include<bits/stdc++.h> #define endl "\n" #define INF 0x3f3f3f3f using namespace std; int a[205]; int d[205][205]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; for(int te = 0; te < t ; te++){ int n,q; cin>>n>>q; for(int i = 1; i<=n ; i ++){ cin>>a[i]; } for(int i = 1; i<=n ; i++){ for(int j = 0; j<=n;j++){ cin>>d[i][j]; } } for(int qe = 0 ;qe < q; qe++){ int u,v,w; cin>>u>>v>>w; int temp[205][205]; for(int i = 1; i<=n ; i++){ for(int j = 1; j<=n;j++){ if(i == j){ d[i][j] = 0; }else if(a[i] >w || a[j]>w ){ temp[i][j] = INF; }else{ temp[i][j] = d[i][j]; } } } } } return 0; }
[ "youngzhaozhou@gmail.com" ]
youngzhaozhou@gmail.com
f5f2b19b623ecda00a3c5695eba37543a2b186a1
b5a9d42f7ea5e26cd82b3be2b26c324d5da79ba1
/tensorflow/stream_executor/gpu/gpu_diagnostics.h
5b786b9c85a516ddcc85f4f08c81fa65aba92256
[ "Apache-2.0" ]
permissive
uve/tensorflow
e48cb29f39ed24ee27e81afd1687960682e1fbef
e08079463bf43e5963acc41da1f57e95603f8080
refs/heads/master
2020-11-29T11:30:40.391232
2020-01-11T13:43:10
2020-01-11T13:43:10
230,088,347
0
0
Apache-2.0
2019-12-25T10:49:15
2019-12-25T10:49:14
null
UTF-8
C++
false
false
3,995
h
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_STREAM_EXECUTOR_GPU_GPU_DIAGNOSTICS_H_ #define TENSORFLOW_STREAM_EXECUTOR_GPU_GPU_DIAGNOSTICS_H_ #include <tuple> #include "tensorflow/stream_executor/platform/port.h" #include "tensorflow/stream_executor/lib/statusor.h" #include "tensorflow/stream_executor/platform/port.h" namespace stream_executor { namespace gpu { // e.g. DriverVersion{346, 3, 4} using DriverVersion = std::tuple<int, int, int>; // FIXME: These functions are in stream_executor::cuda namespaces for now // Will move to stream_executor::gpu namespace in the near future // //// Converts a parsed driver version to string form. // string DriverVersionToString(DriverVersion version); // //// Converts a parsed driver version or status value to natural string form. // string DriverVersionStatusToString(port::StatusOr<DriverVersion> version); // //// Converts a string of a form like "331.79" to a DriverVersion{331, 79}. // port::StatusOr<DriverVersion> StringToDriverVersion(const string& value); class Diagnostician { public: // Logs diagnostic information when CUDA appears to be misconfigured (e.g. is // not initializing). // // Note: if we're running on a machine that has no GPUs, we don't want to // produce very much log spew beyond saying, "looks like there's no CUDA // kernel // module running". // // Note: we use non-Google-File:: API here because we may be called before // InitGoogle has completed. static void LogDiagnosticInformation(); // Given the driver version file contents, finds the kernel module version and // returns it as a string. // // This is solely used for more informative log messages when the user is // running on a machine that happens to have a libcuda/kernel driver mismatch. static port::StatusOr<DriverVersion> FindKernelModuleVersion( const string& driver_version_file_contents); // Extracts the kernel driver version from the current host. static port::StatusOr<DriverVersion> FindKernelDriverVersion(); // Iterates through loaded DSOs with DlIteratePhdrCallback to find the // driver-interfacing DSO version number. Returns it as a string. static port::StatusOr<DriverVersion> FindDsoVersion(); // Logs information about the kernel driver version and userspace driver // library version. static void LogDriverVersionInformation(); private: // Given the DSO version number and the driver version file contents, extracts // the driver version and compares, warning the user in the case of // incompatibility. // // This is solely used for more informative log messages when the user is // running on a machine that happens to have a libcuda/kernel driver mismatch. static void WarnOnDsoKernelMismatch( port::StatusOr<DriverVersion> dso_version, port::StatusOr<DriverVersion> kernel_version); // Logs information about the dev nodes present on this machine: their // existence, permissions, accessibility from this uid/gid. static void LogDevNodeDiagnosticInformation(); static string GetDevNodePath(int dev_node_ordinal); SE_DISALLOW_COPY_AND_ASSIGN(Diagnostician); }; } // namespace gpu } // namespace stream_executor #endif // TENSORFLOW_STREAM_EXECUTOR_GPU_GPU_DIAGNOSTICS_H_
[ "v-grniki@microsoft.com" ]
v-grniki@microsoft.com
aa04f826af9d3780f4623c24ac2e1f6b1f1e3710
4b62193204d4e2694fa52a8edae6c0542503e2c7
/abserv/abserv/InteractionComp.cpp
87c988a1bdd1d96a8eebaf50d0b46cb9ba7d8963
[ "MIT", "CC-BY-4.0" ]
permissive
blockspacer/ABx
67a216772cc5cf235a50e149969c6d668641bb4d
39b5f3be0406b7c2957c0496e41f902478dc2cb0
refs/heads/master
2023-01-03T04:12:28.223454
2020-10-26T08:34:53
2020-10-26T08:34:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
9,074
cpp
/** * Copyright 2020 Stefan Ascher * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "InteractionComp.h" #include "Player.h" #include "SelectionComp.h" #include "Npc.h" #include "ItemDrop.h" namespace Game { namespace Components { InteractionComp::InteractionComp(Player& owner) : owner_(owner) { owner_.SubscribeEvent<void(void)>(EVENT_ON_CANCELALL, std::bind(&InteractionComp::OnCancelAll, this)); } void InteractionComp::OnCancelAll() { type_ = Type::None; } void InteractionComp::UpdateGeneric() { auto interactingWith = target_.lock(); if (!interactingWith) return; if (Is<Npc>(*interactingWith)) { auto& npc = To<Npc>(*interactingWith); Ranges range = npc.GetInteractionRange(); if (npc.IsInRange(range, &owner_)) { npc.CallEvent<void(Actor*)>(EVENT_ON_INTERACT, &owner_); type_ = Type::None; } return; } if (Is<ItemDrop>(*interactingWith)) { if (interactingWith->IsInRange(Ranges::Adjecent, &owner_)) { To<ItemDrop>(*interactingWith).PickUp(&owner_); type_ = Type::None; } return; } if (Is<Player>(*interactingWith)) { if (interactingWith->IsInRange(Ranges::Adjecent, &owner_)) { type_ = Type::None; } return; } } void InteractionComp::UpdateSkill() { auto interactingWith = target_.lock(); if (!interactingWith) return; if (interactingWith->IsInRange(skillRange_, &owner_)) { owner_.UseSkill(skillIndex_, false); type_ = Type::None; } } void InteractionComp::Update(uint32_t) { if (type_ == Type::None) return; if (type_ == Type::Generic) return UpdateGeneric(); return UpdateSkill(); } void InteractionComp::Interact(bool suppress, bool ping) { auto* interactingWith = owner_.selectionComp_->GetSelectedObject(); if (!interactingWith) return; auto interactingWithSp = interactingWith->GetPtr<GameObject>(); if (owner_.IsImmobilized() || owner_.IsDead()) return; target_ = interactingWithSp; type_ = Type::None; if (AB::Entities::IsOutpost(owner_.GetGame()->data_.type)) { if (Is<Player>(interactingWith)) { if (!suppress) { owner_.FollowObject(interactingWith, ping, RANGE_TOUCH); type_ = Type::Generic; return; } if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::Follow, 0); return; } if (Is<Npc>(interactingWith)) { if (!suppress) { auto& npc = To<Npc>(*interactingWith); Ranges range = npc.GetInteractionRange(); if (!owner_.IsInRange(range, interactingWith)) { if (owner_.FollowObject(interactingWith, false, RANGE_TOUCH)) { type_ = Type::Generic; if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::TalkingTo, 0); } return; } type_ = Type::Generic; if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::TalkingTo, 0); return; } if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::TalkingTo, 0); } return; } if (Is<ItemDrop>(interactingWith)) { if (suppress) { if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::PickingUp, 0); return; } if (!owner_.IsInRange(Ranges::Adjecent, interactingWith)) { if (owner_.FollowObject(interactingWith, false, RANGE_TOUCH)) { type_ = Type::Generic; if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::PickingUp, 0); } return; } type_ = Type::Generic; if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::PickingUp, 0); return; } if (Is<Actor>(interactingWith)) { if (owner_.IsAlly(To<Actor>(interactingWith))) { if (!suppress) { owner_.FollowObject(interactingWith, ping); type_ = Type::Generic; } else { if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::Follow, 0); } return; } if (owner_.IsEnemy(To<Actor>(interactingWith))) { if (!suppress) { owner_.Attack(To<Actor>(interactingWith), ping); type_ = Type::Generic; } else { if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith->id_, AB::GameProtocol::ObjectCallType::Target, 0); } return; } } } void InteractionComp::UseSkill(bool suppress, int skillIndex, bool ping) { if (skillIndex < 0 || skillIndex >= PLAYER_MAX_SKILLS) return; if (owner_.IsImmobilized() || owner_.IsDead()) return; auto* interactingWith = owner_.selectionComp_->GetSelectedObject(); if (interactingWith) target_ = interactingWith->GetPtr<GameObject>(); else target_.reset(); skillIndex_ = skillIndex; SkillBar* sb = owner_.GetSkillBar(); auto skill = sb->GetSkill(skillIndex); if (!skill) { // Will send an error to the player owner_.UseSkill(skillIndex, ping); return; } if (suppress) { owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith ? interactingWith->id_ : 0, AB::GameProtocol::ObjectCallType::UseSkill, skillIndex + 1); return; } skillRange_ = skill->GetRange(); if (!skill->NeedsTarget()) { // Can use it right away owner_.UseSkill(skillIndex, ping); return; } if (!interactingWith) { // Needs a target but we don't have one -> send an error to the player owner_.UseSkill(skillIndex, ping); return; } if (interactingWith->IsInRange(skillRange_, &owner_)) { owner_.UseSkill(skillIndex_, ping); return; } if (ping) owner_.CallEvent<void(uint32_t, AB::GameProtocol::ObjectCallType, int)>(EVENT_ON_PINGOBJECT, interactingWith ? interactingWith->id_ : 0, AB::GameProtocol::ObjectCallType::UseSkill, skillIndex + 1); owner_.FollowObject(interactingWith, false, RangeDistances[static_cast<size_t>(skillRange_)]); type_ = Type::Skill; } } }
[ "sa@0x2a.wtf" ]
sa@0x2a.wtf
14f71bbf1f000a76b5e92c4b20a4ad45845f4240
1ede0ec505f59698f44ec45119d9af72187e4ffa
/Header/Game.h
14d26ba945eaf928637811c212046cbcccaa6e2a
[]
no_license
terepaii/Graverted
81cb1dc26b459edc66b19b071a43252342e5a015
111cacca03beec60c7e76652d62967df3371657a
refs/heads/master
2021-01-23T06:54:23.541665
2013-05-18T14:38:12
2013-05-18T14:38:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
768
h
#ifndef GAME_H_ #define GAME_H_ #include "ScreenManager.h" #include "SplashScreen.h" #include "CreditsMenu.h" #include "InputHandler.h" class Game { public: Game(); ~Game(); static const enum GameState{SPLASH, MAINMENU, LEVEL1, LEVEL2, LEVEL3, CREDITS, GAME_OVER, EXIT}; void Start(); private: void Load(); void showSplashScreen(sf::RenderWindow& window, std::string& filepath); void showMainMenu(sf::RenderWindow& window); void showCreditsMenu(sf::RenderWindow& window); void mainGameLoop(); bool exitGame(); sf::RenderWindow window; GameState gameState; std::string menuSelection; SplashScreen splashScreen; InputHandler input; CreditsMenu credits; ScreenManager mainMenu; }; #endif
[ "danielkeohane4823@gmail.com" ]
danielkeohane4823@gmail.com
36bc8de279ea2fd248a02cc85a5ff4c5fa4d5645
25edf5af35ca5f7d7b12846ded53a59739c1cce2
/lab/5/testzoolist_partial/utility.h
d459a3d54449c2ff45be1950b866981827d93673
[]
no_license
whanata/dsa-activities
14ebb0b920a51bc23db74df9780b64eeaa2a964e
97c4ee19f3749fd283eb5f184d680803ab1d1ba7
refs/heads/master
2021-01-21T12:59:36.185071
2016-05-03T05:39:31
2016-05-03T05:39:31
53,576,131
0
0
null
null
null
null
UTF-8
C++
false
false
819
h
#ifndef _UTILITY_H #define _UTILITY_H #include <fstream> #include <string.h> using namespace std; bool readline(ifstream &fin, char *line, int linesize, char delim) { // the problem // Unix ends text lines with \n // Mac ends with \r // Windows ends with \r\n // getline does not include the final delimiter // BUT, it will leave the \r from a windows file. // This means a line read with getline from a windows text file // will have an additional \r tacked to the end of the line. // This is very annoying!!!! if (fin.eof()) return false; fin.getline(line, linesize, delim); // check for \r and get rid of it if (!fin.good()) return false; int last = strlen(line) - 1; if (line >= 0 && line[last] == '\r') line[last] = '\0'; return true; } #endif
[ "whanata@gmail.com" ]
whanata@gmail.com
2310f86450914767af4505ae6e2bea4256315c07
5954dd2e2efa1b7da4165136fa56b286fd9d5638
/17_Console/Function.h
82f5478f6a2ecccc6f64e07c97c8a598a83f22d5
[]
no_license
zhmmmm/Public
466b4519dafcf2b2d1c82a039006928b344248c0
f8b895c28c7cc7b75de5492aed4da9b0702225f7
refs/heads/master
2020-03-30T23:58:40.450316
2018-10-22T14:19:43
2018-10-22T14:19:43
151,713,632
0
0
null
null
null
null
GB18030
C++
false
false
1,135
h
#pragma once #include <list> //功能性 //struct Bullet //{ // int X; // int Y; //}; ////链表型的子弹 //std::list<Bullet> mBullet; //if (true)//某键按下 //{ // Bullet Temp;//新建一个子弹 // Temp.X = 0;//子弹的当前位置 // Temp.Y = 0; // mBullet.push_back(Temp);//把新建好的子弹存入链表 //} ////逻辑更新 //for (std::list<Bullet>::iterator i = mBullet.begin(); i != mBullet.end(); i++)//遍历链表中的所有的子弹 //{ // if (true) // { // i = mBullet.erase(i);//越界的子弹释放 // } // else//未越界的子弹继续移动 // { // i->Y++; // } //} ////绘制 //for (std::list<Bullet>::iterator i = mBullet.begin(); i != mBullet.end(); i++)//遍历链表中的所有的子弹 //{ // //通过i->Y,i->X 作为左边来绘制 //} void ___Number(int *Num,int *Number) { int Add_10 = 10; int i = 0; int Arr[256] = { 0 }; int Arr_10 = 1; while (true) { int Temp = (*Num) % Add_10; Arr[i] = Temp / Arr_10; (*Num) -= Temp; Add_10 *= 10; i++; if ((*Num) == 0) { break; } Arr_10 *= 10; } for (int j = 0; j < i; j++) { (*Number) += (Arr[j] * Arr_10); Arr_10 /= 10; } }
[ "15982683979@163.com" ]
15982683979@163.com
fbeabfbdbee69edc15f390c466d42586702c42ff
7fc9d6c59c6a40d7bb3fa40a7d89f896753d25ee
/bzoj/2746.cpp
feca2b023da45ec0d7487606bc1dc60d089299b8
[]
no_license
yzcmf/oicode
902116f8d50c870e1a251083c6421c4563bab4fa
69d687e267a54ca64fc957595ef5327de37c005a
refs/heads/master
2020-07-25T14:17:00.186895
2016-08-08T03:07:15
2016-08-08T03:07:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,121
cpp
/* BZOJ-2746: [HEOI2012]旅行问题 * AC自动机+倍增LCA */ #include <cstdio> #include <cstring> #include <vector> #include <string> #include <algorithm> const int mod_v = 1000000007; const int MaxN = 1000010, MaxAlpha = 26, MaxL = 20; typedef std::vector<int> describe_t; struct node_t { int hash; int fail, ch[MaxAlpha]; } node[MaxN]; int used = 1; int dist[MaxL][MaxN], depth[MaxN]; char str[MaxN]; describe_t *describe; void add_string(const char* str, describe_t* desc) { int now = 1; for(int i = 0; str[i]; ++i) { int x = str[i] - 'a'; if(!node[now].ch[x]) { node[now].ch[x] = ++used; node[used].hash = (1ll * node[now].hash * MaxAlpha + x) % mod_v; } now = node[now].ch[x]; desc->push_back(now); } } void make_fail() { int *que = new int[used]; int qhead = 0, qtail = 0; que[qtail++] = 1; while(qhead != qtail) { int now = que[qhead++]; dist[0][now] = node[now].fail; depth[now] = depth[node[now].fail] + 1; for(int l = 1; l != MaxL; ++l) dist[l][now] = dist[l - 1][dist[l - 1][now]]; for(int i = 0; i != MaxAlpha; ++i) { int u = node[now].ch[i]; if(!u) continue; int z = node[now].fail; for(; z && !node[z].ch[i]; z = node[z].fail); if(!z) node[u].fail = 1; else node[u].fail = node[z].ch[i]; que[qtail++] = u; } } delete[] que; } int get_lca(int u, int v) { if(depth[u] < depth[v]) std::swap(u, v); int diff = depth[u] - depth[v]; for(int i = 0; diff; ++i, diff >>= 1) if(diff & 1) u = dist[i][u]; for(int p = MaxL - 1; u != v; p ? --p : 0) { if(!p || dist[p][u] != dist[p][v]) { u = dist[p][u]; v = dist[p][v]; } } return u; } int main() { int n, m; std::scanf("%d", &n); describe = new describe_t[n]; for(int i = 0; i != n; ++i) { std::scanf("%s", str); add_string(str, describe + i); } make_fail(); std::scanf("%d", &m); for(int i = 0; i != m; ++i) { int a, b, c, d; std::scanf("%d %d %d %d", &a, &b, &c, &d); int u = describe[a - 1][b - 1]; int v = describe[c - 1][d - 1]; int lca = get_lca(u, v); std::printf("%d\n", node[lca].hash); } delete[] describe; return 0; }
[ "miskcoo@gmail.com" ]
miskcoo@gmail.com
d48d6d859f34eef2fa3610d21d1c699df534b8c8
92235f47acfb1b2258d4627f92d7f87a8cd70fb9
/viennacl/linalg/host_based/gemm_sse_micro_kernel.hpp
0ebf03a29ec267d141af82f41f3083e4f9afeaaa
[ "MIT" ]
permissive
Fritzkefit/viennacl-dev
2c61eda4d226f8343ff5d3c449d9fbfc4932aa58
c1d44d77e9d6b6bac139a94def43902d10668229
refs/heads/master
2021-01-16T18:42:44.325976
2015-11-15T23:01:29
2015-11-15T23:01:29
40,937,663
0
0
null
2015-08-17T23:43:38
2015-08-17T23:43:38
null
UTF-8
C++
false
false
8,653
hpp
#ifndef VIENNACL_LINALG_HOST_BASED_GEMM_SSE_MICRO_KERNEL_HPP_ #define VIENNACL_LINALG_HOST_BASED_GEMM_SSE_MICRO_KERNEL_HPP_ #include "viennacl/linalg/host_based/common.hpp" #include "immintrin.h" /* register-block sizes: * D := double, F := float */ #define MR_D (6) #define NR_D (4) #define MR_F (8) #define NR_F (8) /* addresses for buffer_C */ #define C0_ROW_D(a) (a*NR_D) #define C1_ROW_D(a) (a*NR_D + NR_D/2) #define C0_ROW_F(a) (a*NR_F) #define C1_ROW_F(a) (a*NR_F + NR_F/2) namespace viennacl { /** * @brief general "dummy" template, fully specialized for supported types (double/float) */ template<typename NumericT> inline void sse_micro_kernel(NumericT const *buffer_A, NumericT const *buffer_B, NumericT *buffer_C, vcl_size_t num_micro_slivers, vcl_size_t mr, vcl_size_t nr) { assert(false && bool("called with unsupported numeric type!")); } /** * @brief SSE micro-kernel for floats, calculates a 8x8 block of matrix C from slivers of A and B */ template<> inline void sse_micro_kernel<float>(float const *buffer_A, float const *buffer_B, float *buffer_C, vcl_size_t num_micro_slivers, vcl_size_t mr, vcl_size_t nr) { assert( (mr == MR_F) && (nr == NR_F) && bool("mr and nr obtained by 'get_block_sizes()' in 'matrix_operations.hpp' and given to 'avx_micro_kernel()' do not match with MR_F/NR_F defined in 'gemm_avx_micro_kernel.hpp' ") ); __m128 xmm0 , xmm1 , xmm2 , xmm3 ; __m128 xmm4 , xmm5 , xmm6 , xmm7 ; __m128 xmm8 , xmm9 , xmm10, xmm11; __m128 xmm12, xmm13, xmm14, xmm15; for (vcl_size_t l=0; l<num_micro_slivers; ++l) { xmm0 = _mm_load_ps(buffer_B+l*NR_F); xmm1 = _mm_load_ps(buffer_B+l*NR_F+4); xmm2 = _mm_load_ps1(buffer_A+l*MR_F); xmm3 = _mm_mul_ps(xmm0, xmm2); xmm4 = _mm_mul_ps(xmm1, xmm2); xmm2 = _mm_load_ps1(buffer_A+l*MR_F+1); xmm5 = _mm_mul_ps(xmm0, xmm2); xmm6 = _mm_mul_ps(xmm1, xmm2); xmm2 = _mm_load_ps1(buffer_A+l*MR_F+2); xmm7 = _mm_mul_ps(xmm0, xmm2); xmm8 = _mm_mul_ps(xmm1, xmm2); xmm2 = _mm_load_ps1(buffer_A+l*MR_F+3); xmm9 = _mm_mul_ps(xmm0, xmm2); xmm10 = _mm_mul_ps(xmm1, xmm2); xmm2 = _mm_load_ps1(buffer_A+l*MR_F+4); xmm11 = _mm_mul_ps(xmm0, xmm2); xmm12 = _mm_mul_ps(xmm1, xmm2); xmm2 = _mm_load_ps1(buffer_A+l*MR_F+5); xmm13 = _mm_mul_ps(xmm0, xmm2); xmm14 = _mm_mul_ps(xmm1, xmm2); /* free registers by storing their results */ xmm15 = _mm_load_ps(buffer_C+C0_ROW_F(0)); xmm15 = _mm_add_ps(xmm15, xmm3); _mm_store_ps(buffer_C+C0_ROW_F(0), xmm15); xmm15 = _mm_load_ps(buffer_C+C1_ROW_F(0)); xmm15 = _mm_add_ps(xmm15, xmm4); _mm_store_ps(buffer_C+C1_ROW_F(0), xmm15); /* continue calculating */ xmm2 = _mm_load_ps1(buffer_A+l*MR_F+6); xmm3 = _mm_mul_ps(xmm0, xmm2); xmm4 = _mm_mul_ps(xmm1, xmm2); /* free registers by storing their results */ xmm15 = _mm_load_ps(buffer_C+C0_ROW_F(1)); xmm15 = _mm_add_ps(xmm15, xmm5); _mm_store_ps(buffer_C+C0_ROW_F(1), xmm15); xmm15 = _mm_load_ps(buffer_C+C1_ROW_F(1)); xmm15 = _mm_add_ps(xmm15, xmm6); _mm_store_ps(buffer_C+C1_ROW_F(1), xmm15); /* continue calculating */ xmm2 = _mm_load_ps1(buffer_A+l*MR_F+7); xmm5 = _mm_mul_ps(xmm0, xmm2); xmm6 = _mm_mul_ps(xmm1, xmm2); /* store the rest of the results */ xmm15 = _mm_load_ps(buffer_C+C0_ROW_F(2)); xmm15 = _mm_add_ps(xmm15, xmm7); _mm_store_ps(buffer_C+C0_ROW_F(2), xmm15); xmm15 = _mm_load_ps(buffer_C+C1_ROW_F(2)); xmm15 = _mm_add_ps(xmm15, xmm8); _mm_store_ps(buffer_C+C1_ROW_F(2), xmm15); xmm15 = _mm_load_ps(buffer_C+C0_ROW_F(3)); xmm15 = _mm_add_ps(xmm15, xmm9); _mm_store_ps(buffer_C+C0_ROW_F(3), xmm15); xmm15 = _mm_load_ps(buffer_C+C1_ROW_F(3)); xmm15 = _mm_add_ps(xmm15, xmm10); _mm_store_ps(buffer_C+C1_ROW_F(3), xmm15); xmm15 = _mm_load_ps(buffer_C+C0_ROW_F(4)); xmm15 = _mm_add_ps(xmm15, xmm11); _mm_store_ps(buffer_C+C0_ROW_F(4), xmm15); xmm15 = _mm_load_ps(buffer_C+C1_ROW_F(4)); xmm15 = _mm_add_ps(xmm15, xmm12); _mm_store_ps(buffer_C+C1_ROW_F(4), xmm15); xmm15 = _mm_load_ps(buffer_C+C0_ROW_F(5)); xmm15 = _mm_add_ps(xmm15, xmm13); _mm_store_ps(buffer_C+C0_ROW_F(5), xmm15); xmm15 = _mm_load_ps(buffer_C+C1_ROW_F(5)); xmm15 = _mm_add_ps(xmm15, xmm14); _mm_store_ps(buffer_C+C1_ROW_F(5), xmm15); xmm15 = _mm_load_ps(buffer_C+C0_ROW_F(6)); xmm15 = _mm_add_ps(xmm15, xmm3); _mm_store_ps(buffer_C+C0_ROW_F(6), xmm15); xmm15 = _mm_load_ps(buffer_C+C1_ROW_F(6)); xmm15 = _mm_add_ps(xmm15, xmm4); _mm_store_ps(buffer_C+C1_ROW_F(6), xmm15); xmm15 = _mm_load_ps(buffer_C+C0_ROW_F(7)); xmm15 = _mm_add_ps(xmm15, xmm5); _mm_store_ps(buffer_C+C0_ROW_F(7), xmm15); xmm15 = _mm_load_ps(buffer_C+C1_ROW_F(7)); xmm15 = _mm_add_ps(xmm15, xmm6); _mm_store_ps(buffer_C+C1_ROW_F(7), xmm15); }//for }//sse_micro_kernel() /** * @brief SSE micro-kernel for doubles, calculates a 6x4 block of matrix C from slivers of A and B */ template<> inline void sse_micro_kernel<double>(double const *buffer_A, double const *buffer_B, double *buffer_C, vcl_size_t num_micro_slivers, vcl_size_t mr, vcl_size_t nr) { assert( (mr == MR_D) && (nr == NR_D) && bool("mr and nr obtained by 'get_block_sizes()' in 'matrix_operations.hpp' and given to 'avx_micro_kernel()' do not match with MR_D/NR_D defined in 'gemm_avx_micro_kernel.hpp' ") ); __m128d xmm0 , xmm1 , xmm2 , xmm3 ; __m128d xmm4 , xmm5 , xmm6 , xmm7 ; __m128d xmm8 , xmm9 , xmm10, xmm11; __m128d xmm12, xmm13, xmm14, xmm15; vcl_size_t l; for (l=0; l<num_micro_slivers; ++l) { xmm0 = _mm_load_pd(buffer_B+l*NR_D); xmm1 = _mm_load_pd(buffer_B+l*NR_D+2); xmm2 = _mm_load_pd1(buffer_A+l*MR_D); xmm3 = _mm_mul_pd(xmm0, xmm2); xmm4 = _mm_mul_pd(xmm1, xmm2); xmm2 = _mm_load_pd1(buffer_A+l*MR_D+1); xmm5 = _mm_mul_pd(xmm0, xmm2); xmm6 = _mm_mul_pd(xmm1, xmm2); xmm2 = _mm_load_pd1(buffer_A+l*MR_D+2); xmm7 = _mm_mul_pd(xmm0, xmm2); xmm8 = _mm_mul_pd(xmm1, xmm2); xmm2 = _mm_load_pd1(buffer_A+l*MR_D+3); xmm9 = _mm_mul_pd(xmm0, xmm2); xmm10 = _mm_mul_pd(xmm1, xmm2); xmm2 = _mm_load_pd1(buffer_A+l*MR_D+4); xmm11 = _mm_mul_pd(xmm0, xmm2); xmm12 = _mm_mul_pd(xmm1, xmm2); xmm2 = _mm_load_pd1(buffer_A+l*MR_D+5); xmm13 = _mm_mul_pd(xmm0, xmm2); xmm14 = _mm_mul_pd(xmm1, xmm2); /* store new entries */ xmm15 = _mm_load_pd(buffer_C+C0_ROW_D(0)); xmm15 = _mm_add_pd(xmm15, xmm3); _mm_store_pd(buffer_C+C0_ROW_D(0), xmm15); xmm15 = _mm_load_pd(buffer_C+C1_ROW_D(0)); xmm15 = _mm_add_pd(xmm15, xmm4); _mm_store_pd(buffer_C+C1_ROW_D(0), xmm15); xmm15 = _mm_load_pd(buffer_C+C0_ROW_D(1)); xmm15 = _mm_add_pd(xmm15, xmm5); _mm_store_pd(buffer_C+C0_ROW_D(1), xmm15); xmm15 = _mm_load_pd(buffer_C+C1_ROW_D(1)); xmm15 = _mm_add_pd(xmm15, xmm6); _mm_store_pd(buffer_C+C1_ROW_D(1), xmm15); xmm15 = _mm_load_pd(buffer_C+C0_ROW_D(2)); xmm15 = _mm_add_pd(xmm15, xmm7); _mm_store_pd(buffer_C+C0_ROW_D(2), xmm15); xmm15 = _mm_load_pd(buffer_C+C1_ROW_D(2)); xmm15 = _mm_add_pd(xmm15, xmm8); _mm_store_pd(buffer_C+C1_ROW_D(2), xmm15); xmm15 = _mm_load_pd(buffer_C+C0_ROW_D(3)); xmm15 = _mm_add_pd(xmm15, xmm9); _mm_store_pd(buffer_C+C0_ROW_D(3), xmm15); xmm15 = _mm_load_pd(buffer_C+C1_ROW_D(3)); xmm15 = _mm_add_pd(xmm15, xmm10); _mm_store_pd(buffer_C+C1_ROW_D(3), xmm15); xmm15 = _mm_load_pd(buffer_C+C0_ROW_D(4)); xmm15 = _mm_add_pd(xmm15, xmm11); _mm_store_pd(buffer_C+C0_ROW_D(4), xmm15); xmm15 = _mm_load_pd(buffer_C+C1_ROW_D(4)); xmm15 = _mm_add_pd(xmm15, xmm12); _mm_store_pd(buffer_C+C1_ROW_D(4), xmm15); xmm15 = _mm_load_pd(buffer_C+C0_ROW_D(5)); xmm15 = _mm_add_pd(xmm15, xmm13); _mm_store_pd(buffer_C+C0_ROW_D(5), xmm15); xmm15 = _mm_load_pd(buffer_C+C1_ROW_D(5)); xmm15 = _mm_add_pd(xmm15, xmm14); _mm_store_pd(buffer_C+C1_ROW_D(5), xmm15); }//for }//sse_micro_kernel<double> }//viennacl #endif
[ "e1125349@student.tuwien.ac.at" ]
e1125349@student.tuwien.ac.at
b26b93ed73ef5357c27c8991e4fa248a2e95afff
08b8cf38e1936e8cec27f84af0d3727321cec9c4
/data/crawl/wget/old_hunk_2623.cpp
899afdc074d208f97946109ac0e41162ab371a6a
[]
no_license
ccdxc/logSurvey
eaf28e9c2d6307140b17986d5c05106d1fd8e943
6b80226e1667c1e0760ab39160893ee19b0e9fb1
refs/heads/master
2022-01-07T21:31:55.446839
2018-04-21T14:12:43
2018-04-21T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
137
cpp
file); if (unlink (file)) logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno)); register_delete_file (file); }
[ "993273596@qq.com" ]
993273596@qq.com
1194ac0326682b90ad1fea35b43cdc3e69f9905e
f31c0986ebc80731362a136f99bb6be461690440
/src/WorkLayer/ClientCredits.h
6bfb7cc24807bb34c24182144b38ce318dc72e2c
[]
no_license
witeyou/easyMule
9c3e0af72c49f754704f029a6c3c609f7300811a
ac91abd9cdf35dd5bb697e175e8d07a89c496944
refs/heads/master
2023-03-30T16:19:27.200126
2021-03-26T12:22:52
2021-03-26T12:22:52
351,774,027
1
1
null
null
null
null
UTF-8
C++
false
false
5,093
h
/* * $Id: ClientCredits.h 5577 2008-05-20 09:20:25Z huby $ * * this file is part of eMule * Copyright (C)2002-2006 Merkur ( strEmail.Format("%s@%s", "devteam", "emule-project.net") / http://www.emule-project.net ) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #pragma once #include "MapKey.h" #pragma warning(disable:4516) // access-declarations are deprecated; member using-declarations provide a better alternative #pragma warning(disable:4244) // conversion from 'type1' to 'type2', possible loss of data #pragma warning(disable:4100) // unreferenced formal parameter #pragma warning(disable:4702) // unreachable code #include <crypto/rsa.h> #pragma warning(default:4702) // unreachable code #pragma warning(default:4100) // unreferenced formal parameter #pragma warning(default:4244) // conversion from 'type1' to 'type2', possible loss of data #pragma warning(default:4516) // access-declarations are deprecated; member using-declarations provide a better alternative #define MAXPUBKEYSIZE 80 #define CRYPT_CIP_REMOTECLIENT 10 #define CRYPT_CIP_LOCALCLIENT 20 #define CRYPT_CIP_NONECLIENT 30 #pragma pack(1) struct CreditStruct_29a{ uchar abyKey[16]; uint32 nUploadedLo; // uploaded TO him uint32 nDownloadedLo; // downloaded from him uint32 nLastSeen; uint32 nUploadedHi; // upload high 32 uint32 nDownloadedHi; // download high 32 uint16 nReserved3; }; struct CreditStruct{ uchar abyKey[16]; uint32 nUploadedLo; // uploaded TO him uint32 nDownloadedLo; // downloaded from him uint32 nLastSeen; uint32 nUploadedHi; // upload high 32 uint32 nDownloadedHi; // download high 32 uint16 nReserved3; uint8 nKeySize; uchar abySecureIdent[MAXPUBKEYSIZE]; }; #pragma pack() enum EIdentState{ IS_NOTAVAILABLE, IS_IDNEEDED, IS_IDENTIFIED, IS_IDFAILED, IS_IDBADGUY, }; class CClientCredits { friend class CClientCreditsList; public: CClientCredits(CreditStruct* in_credits); CClientCredits(const uchar* key); ~CClientCredits(); const uchar* GetKey() const {return m_pCredits->abyKey;} uchar* GetSecureIdent() {return m_abyPublicKey;} uint8 GetSecIDKeyLen() const {return m_nPublicKeyLen;} CreditStruct* GetDataStruct() const {return m_pCredits;} void ClearWaitStartTime(); void AddDownloaded(uint32 bytes, uint32 dwForIP); void AddUploaded(uint32 bytes, uint32 dwForIP); uint64 GetUploadedTotal() const; uint64 GetDownloadedTotal() const; float GetScoreRatio(uint32 dwForIP) const; void SetLastSeen() {m_pCredits->nLastSeen = time(NULL);} bool SetSecureIdent(const uchar* pachIdent, uint8 nIdentLen); // Public key cannot change, use only if there is not public key yet uint32 m_dwCryptRndChallengeFor; uint32 m_dwCryptRndChallengeFrom; EIdentState GetCurrentIdentState(uint32 dwForIP) const; // can be != IdentState uint32 GetSecureWaitStartTime(uint32 dwForIP); void SetSecWaitStartTime(uint32 dwForIP); protected: void Verified(uint32 dwForIP); EIdentState IdentState; private: void InitalizeIdent(); CreditStruct* m_pCredits; byte m_abyPublicKey[80]; // even keys which are not verified will be stored here, and - if verified - copied into the struct uint8 m_nPublicKeyLen; uint32 m_dwIdentIP; uint32 m_dwSecureWaitTime; uint32 m_dwUnSecureWaitTime; uint32 m_dwWaitTimeIP; // client IP assigned to the waittime }; class CClientCreditsList { public: CClientCreditsList(); ~CClientCreditsList(); // return signature size, 0 = Failed | use sigkey param for debug only uint8 CreateSignature(CClientCredits* pTarget, uchar* pachOutput, uint8 nMaxSize, uint32 ChallengeIP, uint8 byChaIPKind, CryptoPP::RSASSA_PKCS1v15_SHA_Signer* sigkey = NULL); bool VerifyIdent(CClientCredits* pTarget, const uchar* pachSignature, uint8 nInputSize, uint32 dwForIP, uint8 byChaIPKind); CClientCredits* GetCredit(const uchar* key) ; void Process(); uint8 GetPubKeyLen() const {return m_nMyPublicKeyLen;} byte* GetPublicKey() {return m_abyMyPublicKey;} bool CryptoAvailable(); protected: void LoadList( bool bFromBakFile=false ); void SaveList(); void InitalizeCrypting(); bool CreateKeyPair(); void OnCorruptedFile(LPCTSTR lpszPathFile); #ifdef _DEBUG bool Debug_CheckCrypting(); #endif private: CMap<CCKey, const CCKey&, CClientCredits*, CClientCredits*> m_mapClients; uint32 m_nLastSaved; CryptoPP::RSASSA_PKCS1v15_SHA_Signer* m_pSignkey; byte m_abyMyPublicKey[80]; uint8 m_nMyPublicKeyLen; };
[ "1171838741@qq.com" ]
1171838741@qq.com
f33f88f767ec64277c5afe8c03f4edebbc3cfeb9
79dd87cd1cc02b0dfeb31b677e0aefd731025d60
/concatenate.cpp
3b8dd8fa0eb56e352bc7401e2cb7c451cbf98ac4
[]
no_license
mugdhaj2404/c-c-
bdcf5047a44464f5b8f2974e609bb754b90bcf6f
bed2942db6fdf8e989aa3c980e9db014b98ad7f4
refs/heads/master
2020-07-03T01:59:42.133610
2020-02-17T17:31:04
2020-02-17T17:31:04
201,750,414
0
0
null
null
null
null
UTF-8
C++
false
false
284
cpp
#include<iostream> #include<stdio.h> using namespace std; int main() { int i,j; char s1[100],s2[100]; cout<<"Enter ste1"; cin>>s1; cout<<"Enter str2"; cin>>s2; for(i=0;s1[i]!='\0';++i); for(j=0;s2[j]!='\0';++j,++i) { s1[i] = s2[j]; } s1[i] = '\0'; cout<<s1; }
[ "noreply@github.com" ]
mugdhaj2404.noreply@github.com
56d6c4f91b0d3e1fce5c41df394692114f1067db
8ca7e4b6a56a0a969e3ff56226ae632193b98017
/main.cpp
27b65e5f02fd8bfe6f254e34e7df76f487044fd3
[]
no_license
YunkeXiao/CP-Template
af1f80618c3fc6ac43469ab8dee40bb6de765ab9
9d6fbf3f9b33c6fa3b2a23b68af0845a2eea1b10
refs/heads/master
2020-07-27T14:51:32.438272
2019-09-26T19:45:22
2019-09-26T19:45:22
209,131,090
0
0
null
null
null
null
UTF-8
C++
false
false
6,438
cpp
#include <bits/stdc++.h> using namespace std; #define vi vector<int> #define ii pair<int,int> #define iii pair<int,pair<int,int>> #define vii vector<pair<int,int>> #define vvi vector<vector<int>> typedef long long ll; typedef unsigned long long ull; typedef unordered_map<ll, ll> ump; typedef map<ll, ll> mp; typedef unordered_set<ll> uset; #define pb push_back #define mp make_pair #define fi first #define se second //**************************************** GRAPH ****************************************** //**********DSU********** ll findp(ll v, ll plist[], ll slist[]) { if (plist[v] == v) { return v; } else { plist[v] = findp(plist[v], plist, slist); return plist[v]; } } bool unionp(ll a, ll b, ll plist[], ll slist[]) { ll ap = findp(a, plist, slist), bp = findp(b, plist, slist); if (ap == bp) { return false; } plist[bp] = ap; slist[ap] += slist[bp]; return true; } //**********dijkstra********* //adj is start->end->value vector<ll> dijkstra(int start, vector<vector<pair<ll, ll>>> adj // ,vector<int> & p ) { const int INF = 1000000000; ll n = (ll) adj.size(); vector<ll> d; d.assign((unsigned long) n, INF); // p.assign(n, -1); d[start] = 0; set<pair<ll, ll>> q; q.insert({0, start}); while (!q.empty()) { ll v = q.begin()->second; q.erase(q.begin()); for (auto edge : adj[v]) { ll to = edge.first; ll len = edge.second; if (d[v] + len < d[to]) { q.erase({d[to], to}); d[to] = d[v] + len; // p[to] = v; q.insert({d[to], to}); } } } return d; } //**************************************** MATH ****************************************** //**********Powerset********** vvi powerSet(int set[], int set_size) { ll pow_set_size = (ll) pow(2, set_size); int counter, j; vvi output; for (ll count = 0; count < pow_set_size; count++) { vi comb; for (j = 0; j < set_size; j++) { if ((count >> j) & 1) { comb.pb(set[j]); } } output.pb(comb); } return output; } //**********N choose K********** ll nck(ll n, ll k) { ll out = n; if (k > n) return 0; if (k * 2 > n) k = n - k; if (k == 0) return 1; for (int i = 2; i <= k; i++) { out *= (n - i + 1); out /= i; } return out; } //**********sieve********** //If prime factor, if case is prime, endloop != 1, add endloop value to list vi sieve(ll n) { ll size = n + 10; bitset<10000010> p; vi primes; p.set(); p[0] = p[1] = false; for (ll i = 2; i <= size; i++) { if (p[i]) { for (ll j = i * 2; j <= size; j += i) { p[j] = false; } primes.pb((int) i); } } return primes; } //**********isPrime********** bool isPrime(ll n) { // Sieve (Modify size for max) ll size = n + 10; bitset<10000010> bs; vi primes; bs.set(); bs[0] = bs[1] = false; for (ll i = 2; i <= size; i++) { if (bs[i]) { for (ll j = i * i; j <= size; j *= i) { bs[j] = false; } primes.pb((int) i); } } if (n <= 10000010) { return bs[n]; } for (int i = 0; i < (int) primes.size(); i++) { if (n % primes[i] == 0) { return false; }} return true; }; //**********modpow*********** ll modpow(ll n, ll e, ll mod) { ll output = 1, x = n % mod, y = e; while (y > 0) { if (y & 1) { output = (output * x) % mod; } y = y >> 1; x = (x * x) % mod; } return output; } //**********GCD/LCM********** // GCD(a, b, c) = GCD(a, GCD(b, c)) ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); } ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); } //********************************************************************************************************************* int main() { ios_base::sync_with_stdio(false); cin.tie(0); return 0; } /* ⠶⣿⣭⡧⡤⣤⣻⣛⣹⣿⣿⣿⣶⣄ ⣼⣊⣤⣶⣷⣶⣧⣤⣽⣿⣿⣿⣿⣿⣿⣷ ⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇ ⢀⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧ ⠸⠿⣿⣿⠿⣿⣿⣿⣿⣿⣿⣿⡿⣿⣻⣿⣿⣿⣿⣿⡆ ⢸⣿⣿⡀⠘⣿⡿⢿⣿⣿⡟⣾⣿⣯⣽⣼⣿⣿⣿⣿⡀ ⢀⡠⠚⢛⣛⣃⢄⡁⢀⢀⢀⠈⠁⠛⠛⠛⠛⠚⠻⣿⣿⣿⣷ ⣴⣶⣶⣶⣷⡄⠊⠉⢻⣟⠃⢀⢀⢀⢀⡠⠔⠒⢀ ⢀ ⢀ ⢀⢹⣿⣿⣿⣄ ⢠⣾⣿⣿⣿⣿⣿⣿⣿⣶⣄⣙⠻⠿⠶⠒⠁⢀⢀⣀⣤⣰⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄ ⢿⠟⠛⠋⣿⣿⣿⣿⣿⣿⣿⣟⡿⠷⣶⣶⣶⢶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠉⠙⠻⠿⣿⣿⡿ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⢸⣿⣿⣿⣿⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⢸⣿⣿⣿⣿⣄⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⡿⠟⣹⣿⣿⣿⣿⣿⣿⣿⣿⠇ ⢻⣿⣿⣿⣿⣧⣀⢀⢀⠉⠛⠛⠋⠉⢀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⠏ ⢻⣿⣿⣿⣿⣿⣷⣤⣄⣀⣀⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋ ⠙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛ ⢹⣿⡿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁ ⢸⣿⡇ ⠈⠙⠛⠛⠛⠛⠛⠛⠻⣿⣿⣿⠇ ⣸⣿⡇ ⢨⣿⣿ ⣾⣿⡿⠃ ⢸⣿⡏ ⠻⠿ ⢠⣿⣿⡇ */
[ "yunke0123@hotmail.com" ]
yunke0123@hotmail.com
a7b08f8b17266bf8e1fdda69106beb085b437b49
5a07933eda39f8463cc0b06087e5b875bb9293d3
/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h
9b6b259decaef1af61f151ff43301b6b2477109b
[ "Apache-2.0" ]
permissive
codeblooded/grpc
4bd818c02b74e119dd75c4681bf9359cc696c5e2
e11c486c6a6d6f24bc1cc4cd0cb76bce57404ca5
refs/heads/master
2021-06-27T20:29:38.995197
2020-05-11T23:26:16
2020-05-11T23:26:16
236,610,890
3
0
Apache-2.0
2020-10-22T06:43:42
2020-01-27T22:36:20
C++
UTF-8
C++
false
false
1,493
h
// // Copyright 2019 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_BALANCER_ADDRESSES_H #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_BALANCER_ADDRESSES_H #include <grpc/support/port_platform.h> #include <grpc/impl/codegen/grpc_types.h> #include "src/core/ext/filters/client_channel/server_address.h" namespace grpc_core { grpc_arg CreateGrpclbBalancerAddressesArg( const ServerAddressList* address_list); const ServerAddressList* FindGrpclbBalancerAddressesInChannelArgs( const grpc_channel_args& args); grpc_arg CreateGrpclbBalancerNameArg(const char* balancer_name); const char* FindGrpclbBalancerNameInChannelArgs(const grpc_channel_args& args); } // namespace grpc_core #endif /* \ GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_BALANCER_ADDRESSES_H \ */
[ "roth@google.com" ]
roth@google.com
1a8d75470e79bb69732a98508cb3ec579f00d1d7
fc13a625638bd671c9384f6abd4b67190a766dc9
/sources/dc-motor-state-control/src/main.cpp
491bc7ac5d21fe5ba5f0830fa09a0e89e3b72250
[]
no_license
Martinsoyyo/inverted-pendulum
04ed6c271d2b376c44d74e4d9f53a99b2d32f17b
114e5881d5d42f897228091013fced8d26882c59
refs/heads/master
2023-08-21T16:32:50.692889
2021-09-23T15:39:58
2021-09-23T15:39:58
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,319
cpp
/** * == Stabilizing DC motor with state control == * * Cart is being controlled by state controller (x, v) based on params found by fitting the model * * == Hardware specification == * OMRON E6B2-CWZ6C pinout * - Brown - Vcc * - Black - Phase A * - White - Phase B * - Orange - Phaze Z * - Blue - GND * * LPD3806-600BM-G5-24C pinout * - Green - Phase A * - White - Phase B * - Red - Vcc * - Black - GND */ #include <Arduino.h> // motor encoder pins #define OUTPUT_A 3 // PE5 #define OUTPUT_B 2 // PE4 // pulses per revolution #define PPR 2400 #define SHAFT_R 0.00573 #define PWM_PIN 10 #define DIR_PIN 8 #define MAX_STALL_U 45.0 #define POSITION_LIMIT 0.2 #define X0 0.065 #define A 35.98 #define B 2.22 #define C -2.79 #define Kx 285.4 #define Kv 37.1 volatile long encoderValue = 0L; volatile long lastEncoded = 0L; unsigned long now = 0L; unsigned long lastTimeMicros = 0L; float x, last_x, v, dt; unsigned long log_prescaler = 0; void encoderHandler(); void setup() { // setting PWD frequency on pin 10 to 31kHz TCCR2B = (TCCR2B & 0b11111000) | 0x01; pinMode(OUTPUT_A, INPUT_PULLUP); pinMode(OUTPUT_B, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(OUTPUT_A), encoderHandler, CHANGE); attachInterrupt(digitalPinToInterrupt(OUTPUT_B), encoderHandler, CHANGE); pinMode(PWM_PIN, OUTPUT); pinMode(DIR_PIN, OUTPUT); digitalWrite(DIR_PIN, LOW); Serial.begin(9600); lastTimeMicros = 0L; } float sign(float v) { if (fabs(v) < 1e-8) { return 0.0; } else if (v > 0) { return 1.0; } else { return -1.0; } } float avoidStall(float u) { if (fabs(u) < MAX_STALL_U) { return u > 0 ? u + MAX_STALL_U : u - MAX_STALL_U; } return u; } float saturate(float v, float maxValue) { if (fabs(v) > maxValue) { return (v > 0) ? maxValue : -maxValue; } else { return v; } } float getCartDistance(long pulses, long ppr) { return 2.0 * PI * pulses / PPR * SHAFT_R; } void driveMotor(float u) { digitalWrite(DIR_PIN, u > 0.0 ? LOW : HIGH); analogWrite(PWM_PIN, fabs(u)); } void log_state(float control, float u) { if (log_prescaler % 50 == 0) { Serial.print(x, 4);Serial.print("\t"); Serial.print(v, 4);Serial.print("\t"); Serial.print(control, 4);Serial.print("\t"); Serial.println(u, 4); } log_prescaler++; } void loop() { now = micros(); dt = 1.0 * (now - lastTimeMicros) / 1000000; x = getCartDistance(encoderValue, PPR); v = (x - last_x) / dt; float control = - (Kx * (x - X0) + Kv * v); float u = (control + A * v - C * sign(v)) / B; u = 255.0 * u / 12.0; last_x = x; lastTimeMicros = now; driveMotor(saturate(u, 250)); log_state(control, u); delay(5); } void encoderHandler() { int MSB = (PINE & (1 << PE5)) >> PE5; //MSB = most significant bit int LSB = (PINE & (1 << PE4)) >> PE4; //LSB = least significant bit int encoded = (MSB << 1) | LSB; //converting the 2 pin value to single number int sum = (lastEncoded << 2) | encoded; //adding it to the previous encoded value if(sum == 0b1101 || sum == 0b0100 || sum == 0b0010 || sum == 0b1011) { encoderValue++; //CW } if(sum == 0b1110 || sum == 0b0111 || sum == 0b0001 || sum == 0b1000) { encoderValue--; //CCW } lastEncoded = encoded; //store this value for next time }
[ "zjor.se@gmail.com" ]
zjor.se@gmail.com
e0f34b28e8c173e98ca5e4c7e8af9d468fc9b04f
ad48248020176912cb6190c85db85bcb47201cd1
/Loong/LoongCore/include/LoongCore/scene/components/LoongCCamera.h
4dce3366b02d0d4d92460d5cccd2b7d0d7bf3c33
[ "Apache-2.0" ]
permissive
carlcc/Loong
f2d77c3fa465f4e9c99c113d0c0fee35ca11d6e4
577e89b436eb0e5899295c95ee4587c0270cea94
refs/heads/master
2023-02-01T21:56:49.343306
2020-12-20T09:08:07
2020-12-20T09:08:07
268,041,564
9
0
null
null
null
null
UTF-8
C++
false
false
1,213
h
// // Copyright (c) 2020 Carl Chen. All rights reserved. // #pragma once #include "LoongCore/scene/LoongComponent.h" #include "LoongRenderer/LoongCamera.h" namespace Loong::Core { class LoongCCamera final : public LoongComponent { public: explicit LoongCCamera(LoongActor* owner); ~LoongCCamera() override; const std::string& GetName() override { static const std::string kName("Camera"); return kName; } void SetFov(float value) { camera_.SetFov(Math::Clamp(value, 0.0F, float(Math::Pi))); } void SetNear(float value) { camera_.SetNear(Math::Clamp(value, 0.01F, GetFar())); } void SetFar(float value) { camera_.SetFar(Math::Max(value, GetNear())); } void SetClearColor(const Math::Vector3& clearColor) { camera_.SetClearColor(clearColor); } float GetFov() const { return camera_.GetFov(); } float GetNear() const { return camera_.GetNear(); } float GetFar() const { return camera_.GetFar(); } const Math::Vector3& GetClearColor() const { return camera_.GetClearColor(); } Renderer::LoongCamera& GetCamera() { return camera_; } private: Renderer::LoongCamera camera_; }; }
[ "carlmarxchen@foxmail.com" ]
carlmarxchen@foxmail.com
80e0fc887759da8d041192bf354639a2c82d7a07
6bf5715d3a12f67115a7b9b4b9daa1ab21c6cb0f
/Lstack.cpp
a8948f70a9e3f87bb815e0876299d3a6cc3bfd6b
[]
no_license
r3dark/DS_CODES
442656ac9a218c222d3d578c1c6a9e51a004f95b
163478ec5f9b4ae943e7ee8e5cf0f58f20d9c9c6
refs/heads/master
2021-04-29T23:57:58.643855
2018-02-14T22:12:07
2018-02-14T22:12:07
121,567,080
0
0
null
null
null
null
UTF-8
C++
false
false
1,277
cpp
#include<iostream> #include<string> #include<algorithm> using namespace std; class node { public: int data; node* next; }; class stack { public: node* top; stack() { top=NULL; } void push(int d); void pop(); void display(); int full(); int empty(); }; int stack::full() { // if() } int stack::empty() { if(!top) return 1; else return 0; } void stack::push(int d) { node* newnode=new node; newnode->data=d; newnode->next=NULL; if(!top) { top=newnode; } else { newnode->next=top; top=newnode; } } void stack::pop() { if(empty()) { return; } else { node* temp=top; top=top->next; delete temp; temp=NULL; } } void stack::display() { node* temp=top; if(!top) { cout<<"stack is empty\n"; } cout<<top->data<<endl; // while(temp->next) // { // cout<<temp->data<<endl; // temp=temp->next; // } } int main() { int x,d; stack s; while(1) { cout<<"1.Push\n2.Pop\n3.Display\n"; cin>>x; switch(x) { case(1): cout<<"enter element\n"; cin>>d; s.push(d); break; case(2): s.pop(); break; case(3): s.display(); break; default: exit(1); } } }
[ "noreply@github.com" ]
r3dark.noreply@github.com
aa07e0158a20af2e8b95e10247a5b473e5283305
510959a396e2e72eaec632c5c5f7b32f01adbdb4
/elenasrc2/ide/historylist.h
2694521a421d12ac936381a4fbc2fc4ac1a81307
[ "Apache-2.0" ]
permissive
sanyaade-teachings/elena-lang
a6c700ccf0cc8186d271f2226205cdf76bf19f5d
5b9871e654fe2e57e88931bbebcfbb5155a52247
refs/heads/master
2020-05-29T11:35:21.276914
2014-01-25T08:52:14
2014-01-25T08:52:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
711
h
//--------------------------------------------------------------------------- // E L E N A P r o j e c t: ELENA IDE // MenuHistoryList class header // (C)2005-2011, by Alexei Rakov //--------------------------------------------------------------------------- #ifndef historylistH #define historylistH #include "ide.h" #include "menulist.h" namespace _GUI_ { // --- MenuHistoryList --- class RecentList : public MenuHistoryList { public: void load(_ELENA_::IniConfigFile& file, const char* section); void save(_ELENA_::IniConfigFile& file, const char* section); RecentList(int maxCount, int menuBaseId); }; } // _GUI_ #endif // historylistH
[ "arakov@yandex.ru" ]
arakov@yandex.ru
e31b1051cb8025101b392068dd7f6b40faec2b8b
e0bf5836e4f0d75b28b1f787446e655cdeeb8b03
/files/459e.cpp
58ca311f7641c2e736e5ab9245d255541dac15b3
[]
no_license
arunnsit/allcodes
3f0b73facdee06e802455c6c3fb5de7baae702c2
5e6a8bf3883d0c5f67dfa7cc3dc026dbb4c63a71
refs/heads/master
2021-01-10T13:58:24.900593
2017-10-03T18:11:34
2017-10-03T18:11:34
50,598,937
0
2
null
2019-09-30T20:16:32
2016-01-28T17:06:03
C++
UTF-8
C++
false
false
843
cpp
#include<stdio.h> #include<algorithm> struct node{ int u; int v; int w; }; using namespace std; bool cmp(node a,node b){ return a.w<b.w; } int dp[400000][3]={0}; node a[400000]; int main(){ int n,m,x,y,i,j,s=-1; scanf("%d %d",&n,&m); for (int i = 0; i < m; ++i) { scanf("%d %d %d",&a[i].u,&a[i].v,&a[i].w); /* code */ } sort(a,a+m,cmp); for (int i = 0; i < m; ++i){ if(dp[a[i].u][0]+1>dp[a[i].v][0]&&a[i].w>dp[a[i].u][1]){ dp[a[i].v][2]=dp[a[i].v][0]; dp[a[i].v][0]=dp[a[i].u][0]+1; dp[a[i].v][1]=a[i].w; s=max(dp[a[i].v][0],s); } else if(dp[a[i].u][2]+1>dp[a[i].v][0]&&a[i].w==dp[a[i].u][1]){ dp[a[i].v][2]=dp[a[i].v][0]; dp[a[i].v][0]=dp[a[i].u][2]+1; dp[a[i].v][1]=a[i].w; s=max(dp[a[i].v][0],s); }} printf("%d\n",s); }
[ "arun.yad96@gmail.com" ]
arun.yad96@gmail.com
17ebc2f4048cadefcab532ec4bb3f12b195b8e91
88137561a97490e0f9b453ee476430810bb65b46
/LightSource.cpp
41f6f24f325f16dce32bc0f2b4a0f1826d9d3737
[]
no_license
Euronia/LancerDeRayons
fc3f7819b832eef6e241e4918f6a2cfe532c7c0a
e0a259d43212fd8becda8469377c7a2379feb1ef
refs/heads/master
2021-01-01T17:22:41.260041
2014-06-04T12:50:31
2014-06-04T12:50:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
310
cpp
#include "LightSource.h" LightSource::LightSource(const Point& originPoint ,const Color& lightColor) : origin(originPoint) , color(lightColor) { } Point LightSource::getOrigin () const { return origin; } Color LightSource::getColor () const { return color; }
[ "mouton.thibault@gmail.com" ]
mouton.thibault@gmail.com
91e9b3a887291fa4a79ec1346fa9d2f3bfd71a11
232767d21db4e52a9f76c6023f7e0cbec739b5d7
/can/src/ServiceRequest.cc
819a62985c9efc29cb3440d5a605f0d8b53b855f
[ "Zlib" ]
permissive
Sourabh-Pandit/cc
27a73f1d565c5cd7149fe1eeaef9e814a2e3a79c
73a2eef31c21c624f1c77340b05cec0ac44793c4
refs/heads/master
2021-02-16T02:50:44.365556
2020-02-16T23:27:42
2020-02-16T23:27:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,065
cc
/* * Copyright (C) 2019 Frank Mertens. * * Distribution and use is allowed under the terms of the zlib license * (see cc/LICENSE-zlib). * */ #include <cc/can/ServiceRequest> #include <cc/can/ReadRequest> #include <cc/can/WriteRequest> #include <cc/can/ReadSegmentRequest> #include <cc/can/WriteSegmentRequest> #include <cc/can/AbortRequest> #include <cc/can/BlockRequest> namespace cc { namespace can { String ServiceRequest::Instance::toString() const { if (!isValid()) return String{}; String s; switch (specifier()) { case Specifier::Read: s = ReadRequest{frame_}; break; case Specifier::Write: s = WriteRequest{frame_}; break; case Specifier::ReadSegment: s = ReadSegmentRequest{frame_}; break; case Specifier::WriteSegment: s = WriteSegmentRequest{frame_}; break; case Specifier::Abort: s = AbortRequest{frame_}; break; case Specifier::BlockRead: case Specifier::BlockWrite: s = BlockRequest{frame_}; break; }; return s; } }} // namespace cc::can
[ "frank@cyblogic.de" ]
frank@cyblogic.de
1818f18b558e66d09f8be62d025b0cb87f6d9f44
c83031e047a315807f5bfbd33d93ee3f3b07b860
/src/Swarm.cpp
cb42d635f452876ae840699a03eb17a173963bad
[]
no_license
kdloney/PriestFinalData_PhaedrasLove
ce036703901483a4c93d8bc4becdbbfa184b01ca
3d6839a4045bd361bec91501a0ef1f3a067148a1
refs/heads/master
2020-03-30T18:24:05.725365
2014-03-04T12:26:46
2014-03-04T12:26:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,743
cpp
#include "Swarm.h" // This 'swarm' object demonstrates a simple particle system // with 'simple harmonic motion' swarm::swarm(){ light.setAmbientColor(ofColor(0, 0, 0)); } void swarm::init(int nParticles, float xDis, float yDis, float zDis, float velocityDispersion, float rVal, float gVal, float bVal, float aVal){ // Check if we've already initialised if(particles.size() != 0){ // clear out old data ofLogWarning("swarm") << "Swarm: Already initialised"; particles.clear(); } ofSeedRandom(); // ofVec3f position, velocity; ofColor color; for(int i = 0; i < nParticles; i++){ position.x = (ofRandom(1.0f) - 0.5f) * xDis; position.y = (ofRandom(1.0f) - 0.5f) * yDis; position.z = (ofRandom(1.0f) - 0.5f) * zDis; velocity.x = (ofRandom(1.0f) - 0.5f) * velocityDispersion; velocity.y = (ofRandom(1.0f) - 0.5f) * velocityDispersion; velocity.z = (ofRandom(1.0f) - 0.5f) * velocityDispersion; color.r = rVal; color.g = gVal; color.b = bVal; color.a = aVal; particle newParticle; newParticle.position = position; newParticle.velocity = velocity; newParticle.color = color; // add our new particle to the vector particles.push_back(newParticle); } } void swarm::customDraw(){ // We run the update ourselves manually. ofNode does // not do this for us. update(); //-- // Draw particles // We use the position of the first // particle as the position of the // light. /* ofPushStyle(); light.enable(); light.setPosition(particles[0].position*.02); for(int i = 0; i < particles.size(); i++){ ofPushStyle(); ofSetColor(particles[i].color); ofSphere(particles[i].position, .7); ofPopStyle(); } light.disable(); ofDisableLighting(); */ for(int i = 0; i < particles.size(); i++){ ofPushStyle(); ofSetColor(particles[i].color); ofSphere(particles[i].position, .7); ofPopStyle(); } // //-- //______________________LOOK HERE__________________________________ // Render light as white sphere //ofSetColor(255, 255, 255); //ofSphere(light.getPosition(), 2.0); //ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL); //ofDrawBitmapString(" light", particles[0].position); //ofPopStyle(); } void swarm::update(){ // Calculate time past per frame float dt = ofGetLastFrameTime(); // Update positions, velocities for(int i = 0; i < particles.size(); i++){ // ----------- // // MOTION MATHS // // 'Simple Harmonic Motion' + a little extra // ---- // // [1] apply velocity to postion // (i.e. integrate velocity) // // v = dx / dt (*) // x = x + dx [every frame] // // therefore // x = x + v * dt (*) // // (velcotity is taken from previous frame) particles[i].position += particles[i].velocity * dt; // [2] apply spring force to velocity // (i.e. integrate acceleration) // // a = -k * x (this is the shm restoring force, aka spring force) // a = dv / dt // // therefore from (*)s above // (v = v + dv) // // v = v + (dt * a) // v = v + (dt * -k * x) // //particles[i].velocity += -SPRING_CONSTANT * particles[i].position * dt; particles[i].velocity += -SPRING_CONSTANT / particles[i].position; // [3] to get a super simple kind of 'flocking' behaviour // we add a second spring force to velocity relative // to the position of the light // NOTICE: THIS ISN'T REAL FLOCKING! particles[i].velocity += -SPRING_CONSTANT * (particles[i].position - light.getPosition()) * dt; // [4] Force a maximum velocity if(particles[i].velocity.length() > MAX_VELOCITY){ particles[i].velocity /= particles[i].velocity.length() * MAX_VELOCITY; } // // ----------- } }
[ "kdloney@gmail.com" ]
kdloney@gmail.com
41f148ef3f18d87dec33018d26c1dab40bebfae4
e0d41578eb105e9d3663ac17e841963e6cfb9f1b
/client/sdl/texture_cache.cpp
01a0fd08249e0526ad97d08fdb61300cf31cd34d
[]
no_license
azhi/Bomberman-Clone
e19b91209b7599dd5e722fc6841c2c695415c303
1611ea30add14b0668cf8c0b4341954228f29857
refs/heads/master
2020-06-04T10:57:52.141308
2014-05-05T23:03:03
2014-05-05T23:03:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,696
cpp
#include "texture_cache.h" #include <string> SDL_Texture *TextureCache::destructible_texture = NULL; SDL_Texture *TextureCache::indestructible_texture = NULL; SDL_Texture *TextureCache::grass_texture = NULL; SDL_Texture *TextureCache::mc_front_texture = NULL; SDL_Texture *TextureCache::mc_back_texture = NULL; SDL_Texture *TextureCache::mc_left_texture = NULL; SDL_Texture *TextureCache::mc_right_texture = NULL; SDL_Texture *TextureCache::ec_front_texture = NULL; SDL_Texture *TextureCache::ec_back_texture = NULL; SDL_Texture *TextureCache::ec_left_texture = NULL; SDL_Texture *TextureCache::ec_right_texture = NULL; SDL_Texture *TextureCache::killed_character_texture = NULL; SDL_Texture *TextureCache::big_bomb_texture = NULL; SDL_Texture *TextureCache::medium_bomb_texture = NULL; SDL_Texture *TextureCache::small_bomb_texture = NULL; SDL_Texture *TextureCache::explosion_center_texture = NULL; SDL_Texture *TextureCache::explosion_left_texture = NULL; SDL_Texture *TextureCache::explosion_left_end_texture = NULL; SDL_Texture *TextureCache::explosion_right_texture = NULL; SDL_Texture *TextureCache::explosion_right_end_texture = NULL; SDL_Texture *TextureCache::explosion_top_texture = NULL; SDL_Texture *TextureCache::explosion_top_end_texture = NULL; SDL_Texture *TextureCache::explosion_bottom_texture = NULL; SDL_Texture *TextureCache::explosion_bottom_end_texture = NULL; void TextureCache::init(SDLWrapper *sdl_wrapper) { init_map(sdl_wrapper); init_character(sdl_wrapper); init_bomb(sdl_wrapper); init_explosion(sdl_wrapper); } void TextureCache::init_map(SDLWrapper *sdl_wrapper) { std::string texture_path = BASE_TEXTURE_PATH; texture_path.append(DESTRUCTIBLE_TEXTURE_PATH); destructible_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(INDESTRUCTIBLE_TEXTURE_PATH); indestructible_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(GRASS_TEXTURE_PATH); grass_texture = sdl_wrapper->load_texture(texture_path.c_str()); } void TextureCache::init_character(SDLWrapper *sdl_wrapper) { std::string texture_path = BASE_TEXTURE_PATH; texture_path.append(MC_FRONT_TEXTURE_PATH); mc_front_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(MC_BACK_TEXTURE_PATH); mc_back_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(MC_LEFT_TEXTURE_PATH); mc_left_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(MC_RIGHT_TEXTURE_PATH); mc_right_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EC_FRONT_TEXTURE_PATH); ec_front_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EC_BACK_TEXTURE_PATH); ec_back_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EC_LEFT_TEXTURE_PATH); ec_left_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EC_RIGHT_TEXTURE_PATH); ec_right_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(KILLED_CHARACTER_TEXTURE); killed_character_texture = sdl_wrapper->load_texture(texture_path.c_str()); } void TextureCache::init_bomb(SDLWrapper *sdl_wrapper) { std::string texture_path = BASE_TEXTURE_PATH; texture_path.append(SMALL_BOMB_TEXTURE_PATH); small_bomb_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(MEDIUM_BOMB_TEXTURE_PATH); medium_bomb_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(BIG_BOMB_TEXTURE_PATH); big_bomb_texture = sdl_wrapper->load_texture(texture_path.c_str()); } void TextureCache::init_explosion(SDLWrapper *sdl_wrapper) { std::string texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_CENTER_TEXTURE_PATH); explosion_center_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_LEFT_TEXTURE_PATH); explosion_left_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_LEFT_END_TEXTURE_PATH); explosion_left_end_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_RIGHT_TEXTURE_PATH); explosion_right_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_RIGHT_END_TEXTURE_PATH); explosion_right_end_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_TOP_TEXTURE_PATH); explosion_top_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_TOP_END_TEXTURE_PATH); explosion_top_end_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_BOTTOM_TEXTURE_PATH); explosion_bottom_texture = sdl_wrapper->load_texture(texture_path.c_str()); texture_path = BASE_TEXTURE_PATH; texture_path.append(EXPLOSION_BOTTOM_END_TEXTURE_PATH); explosion_bottom_end_texture = sdl_wrapper->load_texture(texture_path.c_str()); }
[ "astzhe@gmail.com" ]
astzhe@gmail.com
4bc6c3645708f41ebf23ed954c55472e2577a86b
f6f0f87647e23507dca538760ab70e26415b8313
/6.1.0/msvc2019_64/include/QtGui/6.1.0/QtGui/private/qimage_p.h
6936663f666419fcd8cb6485752fc396e6bc259b
[]
no_license
stenzek/duckstation-ext-qt-minimal
a942c62adc5654c03d90731a8266dc711546b268
e5c412efffa3926f7a4d5bf0ae0333e1d6784f30
refs/heads/master
2023-08-17T16:50:21.478373
2023-08-15T14:53:43
2023-08-15T14:53:43
233,179,313
3
1
null
2021-11-16T15:34:28
2020-01-11T05:05:34
C++
UTF-8
C++
false
false
13,934
h
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QIMAGE_P_H #define QIMAGE_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include <QtGui/private/qtguiglobal_p.h> #include <QtGui/qcolorspace.h> #include <QtGui/qimage.h> #include <QtCore/private/qnumeric_p.h> #include <QtCore/qlist.h> #include <QtCore/qmap.h> QT_BEGIN_NAMESPACE class QImageWriter; struct Q_GUI_EXPORT QImageData { // internal image data QImageData(); ~QImageData(); static QImageData *create(const QSize &size, QImage::Format format); static QImageData *create(uchar *data, int w, int h, qsizetype bpl, QImage::Format format, bool readOnly, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr); static QImageData *get(QImage &img) noexcept { return img.d; } static const QImageData *get(const QImage &img) noexcept { return img.d; } QAtomicInt ref; int width; int height; int depth; qsizetype nbytes; // number of bytes data qreal devicePixelRatio; QList<QRgb> colortable; uchar *data; QImage::Format format; qsizetype bytes_per_line; int ser_no; // serial number int detach_no; qreal dpmx; // dots per meter X (or 0) qreal dpmy; // dots per meter Y (or 0) QPoint offset; // offset in pixels uint own_data : 1; uint ro_data : 1; uint has_alpha_clut : 1; uint is_cached : 1; uint is_locked : 1; QImageCleanupFunction cleanupFunction; void* cleanupInfo; bool checkForAlphaPixels() const; // Convert the image in-place, minimizing memory reallocation // Return false if the conversion cannot be done in-place. bool convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags); QMap<QString, QString> text; bool doImageIO(const QImage *image, QImageWriter* io, int quality) const; QPaintEngine *paintEngine; QColorSpace colorSpace; struct ImageSizeParameters { qsizetype bytesPerLine; qsizetype totalSize; bool isValid() const { return bytesPerLine > 0 && totalSize > 0; } }; static ImageSizeParameters calculateImageParameters(qsizetype width, qsizetype height, qsizetype depth); }; inline QImageData::ImageSizeParameters QImageData::calculateImageParameters(qsizetype width, qsizetype height, qsizetype depth) { ImageSizeParameters invalid = { -1, -1 }; if (height <= 0) return invalid; // calculate the size, taking care of overflows qsizetype bytes_per_line; if (mul_overflow(width, depth, &bytes_per_line)) return invalid; if (add_overflow(bytes_per_line, qsizetype(31), &bytes_per_line)) return invalid; // bytes per scanline (must be multiple of 4) bytes_per_line = (bytes_per_line >> 5) << 2; // can't overflow qsizetype total_size; if (mul_overflow(height, bytes_per_line, &total_size)) return invalid; qsizetype dummy; if (mul_overflow(height, qsizetype(sizeof(uchar *)), &dummy)) return invalid; // why is this here? #if 1 || QT_VERSION < QT_VERSION_CHECK(6,0,0) // ### can only fix this if QImage dimensions are not int anymore // Disallow images where width * depth calculations might overflow if (width > (INT_MAX - 31) / depth) return invalid; #endif return { bytes_per_line, total_size }; } typedef void (*Image_Converter)(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFlags); extern Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats]; extern InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats]; void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); void convert_generic_over_rgb64(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags); bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags); bool convert_generic_inplace_over_rgb64(QImageData *data, QImage::Format dst_format, Qt::ImageConversionFlags); void dither_to_Mono(QImageData *dst, const QImageData *src, Qt::ImageConversionFlags flags, bool fromalpha); const uchar *qt_get_bitflip_array(); Q_GUI_EXPORT void qGamma_correct_back_to_linear_cs(QImage *image); #if defined(_M_ARM) && defined(_MSC_VER) // QTBUG-42038 #pragma optimize("", off) #endif inline int qt_depthForFormat(QImage::Format format) { int depth = 0; switch(format) { case QImage::Format_Invalid: case QImage::NImageFormats: Q_UNREACHABLE(); case QImage::Format_Mono: case QImage::Format_MonoLSB: depth = 1; break; case QImage::Format_Indexed8: case QImage::Format_Alpha8: case QImage::Format_Grayscale8: depth = 8; break; case QImage::Format_RGB32: case QImage::Format_ARGB32: case QImage::Format_ARGB32_Premultiplied: case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: case QImage::Format_BGR30: case QImage::Format_A2BGR30_Premultiplied: case QImage::Format_RGB30: case QImage::Format_A2RGB30_Premultiplied: depth = 32; break; case QImage::Format_RGB555: case QImage::Format_RGB16: case QImage::Format_RGB444: case QImage::Format_ARGB4444_Premultiplied: case QImage::Format_Grayscale16: depth = 16; break; case QImage::Format_RGB666: case QImage::Format_ARGB6666_Premultiplied: case QImage::Format_ARGB8565_Premultiplied: case QImage::Format_ARGB8555_Premultiplied: case QImage::Format_RGB888: case QImage::Format_BGR888: depth = 24; break; case QImage::Format_RGBX64: case QImage::Format_RGBA64: case QImage::Format_RGBA64_Premultiplied: depth = 64; break; } return depth; } #if defined(_M_ARM) && defined(_MSC_VER) #pragma optimize("", on) #endif inline QImage::Format qt_opaqueVersion(QImage::Format format) { switch (format) { case QImage::Format_ARGB8565_Premultiplied: return QImage::Format_RGB16; case QImage::Format_ARGB8555_Premultiplied: return QImage::Format_RGB555; case QImage::Format_ARGB6666_Premultiplied: return QImage::Format_RGB666; case QImage::Format_ARGB4444_Premultiplied: return QImage::Format_RGB444; case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: return QImage::Format_RGBX8888; case QImage::Format_A2BGR30_Premultiplied: return QImage::Format_BGR30; case QImage::Format_A2RGB30_Premultiplied: return QImage::Format_RGB30; case QImage::Format_RGBA64: case QImage::Format_RGBA64_Premultiplied: return QImage::Format_RGBX64; case QImage::Format_ARGB32_Premultiplied: case QImage::Format_ARGB32: return QImage::Format_RGB32; case QImage::Format_RGB16: case QImage::Format_RGB32: case QImage::Format_RGB444: case QImage::Format_RGB555: case QImage::Format_RGB666: case QImage::Format_RGB888: case QImage::Format_BGR888: case QImage::Format_RGBX8888: case QImage::Format_BGR30: case QImage::Format_RGB30: case QImage::Format_RGBX64: case QImage::Format_Grayscale8: case QImage::Format_Grayscale16: return format; case QImage::Format_Mono: case QImage::Format_MonoLSB: case QImage::Format_Indexed8: case QImage::Format_Alpha8: case QImage::Format_Invalid: case QImage::NImageFormats: break; } return QImage::Format_RGB32; } inline QImage::Format qt_alphaVersion(QImage::Format format) { switch (format) { case QImage::Format_RGB32: case QImage::Format_ARGB32: return QImage::Format_ARGB32_Premultiplied; case QImage::Format_RGB16: return QImage::Format_ARGB8565_Premultiplied; case QImage::Format_RGB555: return QImage::Format_ARGB8555_Premultiplied; case QImage::Format_RGB666: return QImage::Format_ARGB6666_Premultiplied; case QImage::Format_RGB444: return QImage::Format_ARGB4444_Premultiplied; case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: return QImage::Format_RGBA8888_Premultiplied; case QImage::Format_BGR30: return QImage::Format_A2BGR30_Premultiplied; case QImage::Format_RGB30: return QImage::Format_A2RGB30_Premultiplied; case QImage::Format_RGBX64: case QImage::Format_RGBA64: case QImage::Format_Grayscale16: return QImage::Format_RGBA64_Premultiplied; case QImage::Format_ARGB32_Premultiplied: case QImage::Format_ARGB8565_Premultiplied: case QImage::Format_ARGB8555_Premultiplied: case QImage::Format_ARGB6666_Premultiplied: case QImage::Format_ARGB4444_Premultiplied: case QImage::Format_RGBA8888_Premultiplied: case QImage::Format_A2BGR30_Premultiplied: case QImage::Format_A2RGB30_Premultiplied: case QImage::Format_RGBA64_Premultiplied: return format; case QImage::Format_Mono: case QImage::Format_MonoLSB: case QImage::Format_Indexed8: case QImage::Format_RGB888: case QImage::Format_BGR888: case QImage::Format_Alpha8: case QImage::Format_Grayscale8: case QImage::Format_Invalid: case QImage::NImageFormats: break; } return QImage::Format_ARGB32_Premultiplied; } inline bool qt_highColorPrecision(QImage::Format format, bool opaque = false) { // Formats with higher color precision than ARGB32_Premultiplied. switch (format) { case QImage::Format_ARGB32: case QImage::Format_RGBA8888: return !opaque; case QImage::Format_BGR30: case QImage::Format_RGB30: case QImage::Format_A2BGR30_Premultiplied: case QImage::Format_A2RGB30_Premultiplied: case QImage::Format_RGBX64: case QImage::Format_RGBA64: case QImage::Format_RGBA64_Premultiplied: case QImage::Format_Grayscale16: return true; default: break; } return false; } inline QImage::Format qt_maybeAlphaVersionWithSameDepth(QImage::Format format) { const QImage::Format toFormat = qt_alphaVersion(format); return qt_depthForFormat(format) == qt_depthForFormat(toFormat) ? toFormat : format; } inline QImage::Format qt_opaqueVersionForPainting(QImage::Format format) { QImage::Format toFormat = qt_opaqueVersion(format); // If we are switching depth anyway upgrade to RGB32 if (qt_depthForFormat(format) != qt_depthForFormat(toFormat) && qt_depthForFormat(toFormat) <= 32) toFormat = QImage::Format_RGB32; return toFormat; } inline QImage::Format qt_alphaVersionForPainting(QImage::Format format) { QImage::Format toFormat = qt_alphaVersion(format); #if defined(__ARM_NEON__) || defined(__SSE2__) // If we are switching depth anyway and we have optimized ARGB32PM routines, upgrade to that. if (qt_depthForFormat(format) != qt_depthForFormat(toFormat) && qt_depthForFormat(toFormat) <= 32) toFormat = QImage::Format_ARGB32_Premultiplied; #endif return toFormat; } Q_GUI_EXPORT QMap<QString, QString> qt_getImageText(const QImage &image, const QString &description); Q_GUI_EXPORT QMap<QString, QString> qt_getImageTextFromDescription(const QString &description); QT_END_NAMESPACE #endif // QIMAGE_P_H
[ "stenzek@gmail.com" ]
stenzek@gmail.com
1b3ab716f7fc4ff5028fb5955f9d37a8fbcbfd8d
cb80a8562d90eb969272a7ff2cf52c1fa7aeb084
/inletTest3/0.132/Ma
c92fcdd9a7f8295391f1703d7b35b67d7438baf4
[]
no_license
mahoep/inletCFD
eb516145fad17408f018f51e32aa0604871eaa95
0df91e3fbfa60d5db9d52739e212ca6d3f0a28b2
refs/heads/main
2023-08-30T22:07:41.314690
2021-10-14T19:23:51
2021-10-14T19:23:51
314,657,843
0
0
null
null
null
null
UTF-8
C++
false
false
150,361
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v2006 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.132"; object Ma; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField nonuniform List<scalar> 16277 ( 0.139392 0.139393 0.139392 0.13939 0.13939 0.139385 0.13937 0.139325 0.139223 0.139061 0.138856 0.138629 0.138396 0.138162 0.137926 0.137685 0.137437 0.13718 0.136911 0.136632 0.13634 0.136038 0.135725 0.135401 0.135066 0.13472 0.134365 0.133998 0.133622 0.133236 0.13284 0.132435 0.132021 0.131598 0.131167 0.130728 0.130281 0.129828 0.129367 0.1289 0.128427 0.127949 0.127466 0.126978 0.126487 0.125992 0.125494 0.124994 0.124492 0.123989 0.123485 0.122981 0.122477 0.121975 0.121474 0.120976 0.12048 0.119988 0.1195 0.119016 0.118538 0.118066 0.1176 0.117142 0.116691 0.116249 0.115815 0.115391 0.114977 0.114573 0.114181 0.1138 0.113431 0.113075 0.112732 0.112403 0.112087 0.111782 0.111487 0.111196 0.110909 0.110633 0.11039 0.110219 0.110144 0.110142 0.110172 0.110207 0.110235 0.110232 0.110211 0.110141 0.109962 0.109665 0.10918 0.108622 0.106572 0.105257 0.108647 0.109316 0.109386 0.108499 0.103772 0.102304 0.108323 0.10945 0.109443 0.108053 0.100955 0.0997108 0.107767 0.109402 0.109289 0.107397 0.0985496 0.0975002 0.107061 0.10917 0.108998 0.106678 0.0965075 0.0956376 0.106347 0.108846 0.108639 0.105946 0.094795 0.0940428 0.105608 0.108453 0.108216 0.105199 0.0933007 0.0926301 0.104858 0.108009 0.107754 0.104448 0.0919647 0.0913631 0.104117 0.107539 0.107264 0.103704 0.0907494 0.0901906 0.103372 0.107034 0.106742 0.102953 0.0896135 0.0890909 0.102624 0.106503 0.106204 0.10221 0.0885513 0.0880588 0.101886 0.10596 0.105652 0.101472 0.0875445 0.0870736 0.10115 0.105401 0.105085 0.100735 0.0865788 0.0861248 0.100414 0.104828 0.104503 0.0999981 0.0856451 0.0852042 0.0996771 0.104239 0.103906 0.0992582 0.084736 0.0843048 0.0989356 0.103636 0.103294 0.0985132 0.0838451 0.0834208 0.0981878 0.103016 0.102664 0.0977609 0.082967 0.0825475 0.0974316 0.102379 0.102018 0.0969995 0.0820977 0.0816811 0.0966655 0.101724 0.101353 0.0962276 0.0812337 0.0808185 0.0958878 0.101051 0.100669 0.0954433 0.0803721 0.0799568 0.0950968 0.100357 0.0999649 0.0946449 0.07951 0.0790936 0.0942909 0.0996428 0.099239 0.0938311 0.0786454 0.0782264 0.0934689 0.0989061 0.0984902 0.0930002 0.0777754 0.0773529 0.0926292 0.098146 0.0977174 0.0921508 0.076898 0.0764709 0.09177 0.0973612 0.0969193 0.0912811 0.0760111 0.0755782 0.0908896 0.0965504 0.0960944 0.0903894 0.0751124 0.0746728 0.0899864 0.0957121 0.0952415 0.0894741 0.0742 0.0737526 0.0890587 0.094845 0.0943591 0.0885336 0.0732718 0.0728158 0.088105 0.0939477 0.093446 0.0875664 0.0723261 0.0718607 0.0871239 0.0930191 0.0925009 0.0865711 0.0713613 0.0708857 0.086114 0.0920579 0.0915229 0.0855466 0.070376 0.0698897 0.0850745 0.0910634 0.0905111 0.084492 0.0693693 0.0688719 0.0840046 0.0900349 0.0894653 0.083407 0.0683406 0.0678323 0.0829042 0.0889722 0.0883855 0.0822918 0.0672904 0.0667717 0.081774 0.087876 0.0872728 0.0811475 0.0662198 0.0656918 0.0806157 0.0867476 0.086129 0.0799763 0.0651311 0.064595 0.0794317 0.0855894 0.0849569 0.0787812 0.0640273 0.0634854 0.0782261 0.0844048 0.0837608 0.0775668 0.062913 0.0623683 0.077004 0.0831987 0.0825463 0.0763394 0.0617947 0.061251 0.0757727 0.0819779 0.0813211 0.0751073 0.0606807 0.0601433 0.074542 0.080751 0.0800954 0.0738817 0.0595821 0.0590576 0.0733243 0.0795298 0.0788821 0.0726764 0.058513 0.0580097 0.0721352 0.0783288 0.0776977 0.0715089 0.0574906 0.0570187 0.0709941 0.0771661 0.0765622 0.0704006 0.0565363 0.0561078 0.0699246 0.076064 0.0755 0.0693773 0.0556752 0.0553043 0.0689545 0.0750488 0.0745389 0.0684684 0.054936 0.0546416 0.0681128 0.0741499 0.0737104 0.0677057 0.0543528 0.0541648 0.0674346 0.0733978 0.0730466 0.0671244 0.053967 0.0538988 0.0669587 0.072834 0.0725834 0.0667597 0.0538019 0.0538648 0.0667134 0.0724851 0.0723465 0.0666363 0.0538768 0.0540746 0.0667166 0.0723707 0.0723518 0.0667673 0.0541982 0.054517 0.066966 0.0724917 0.072585 0.0671326 0.0547484 0.055201 0.0674659 0.0728579 0.0730784 0.0677648 0.0555622 0.0561427 0.0682363 0.0734899 0.0738315 0.0686549 0.0566069 0.0572519 0.0692138 0.0743336 0.0747587 0.0697101 0.05777 0.0584527 0.0703321 0.0753303 0.0758153 0.0708801 0.0589971 0.059693 0.0715393 0.0764333 0.0769582 0.0721171 0.0602424 0.0609336 0.0727939 0.0776041 0.0781504 0.0733821 0.0614706 0.0621403 0.0740575 0.0788055 0.0793553 0.074638 0.0626479 0.0632818 0.0752953 0.0800028 0.08054 0.0758523 0.0637465 0.0643332 0.0764777 0.0811654 0.0816764 0.076998 0.0647452 0.0652763 0.0775806 0.0822675 0.0827413 0.078054 0.0656284 0.0660988 0.0785851 0.0832888 0.0837166 0.0790022 0.0663896 0.0667965 0.0794765 0.0842136 0.0845878 0.0798313 0.06703 0.0673702 0.080247 0.0850304 0.0853506 0.0805414 0.067547 0.0678229 0.0808983 0.0857375 0.0860039 0.0811337 0.0679461 0.0681625 0.0814342 0.0863358 0.0865502 0.0816138 0.0682373 0.0684009 0.0818619 0.08683 0.0869961 0.0819908 0.0684339 0.0685533 0.0821927 0.0872294 0.0873528 0.0822777 0.0685523 0.0686363 0.0824401 0.0875457 0.0876323 0.0824882 0.0686085 0.0686652 0.0826178 0.0877912 0.087847 0.0826356 0.0686172 0.0686536 0.0827388 0.0879779 0.0880086 0.0827323 0.0685908 0.0686124 0.0828145 0.0881168 0.0881269 0.0827889 0.0685392 0.0685498 0.0828543 0.0882164 0.0882099 0.0828137 0.0684692 0.068473 0.0828667 0.0882853 0.0882663 0.0828153 0.0683879 0.0683868 0.0828586 0.0883302 0.0883007 0.0827987 0.0682986 0.068295 0.0828347 0.0883558 0.0883183 0.0827684 0.0682052 0.0682003 0.0827991 0.0883666 0.0883227 0.082728 0.0681097 0.068105 0.0827555 0.0883664 0.0883179 0.0826814 0.0680147 0.0680099 0.082706 0.0883577 0.0883055 0.0826292 0.0679197 0.0679161 0.0826529 0.0883433 0.0882881 0.0825744 0.0678264 0.0678231 0.0825964 0.0883233 0.0882663 0.0825171 0.0677341 0.0677325 0.0825394 0.0883011 0.0882442 0.0824614 0.0676458 0.0676453 0.0824833 0.0882778 0.0882199 0.0824051 0.06756 0.0675684 0.0824342 0.0882595 0.0882023 0.0823578 0.0674863 0.0674944 0.0823882 0.0882551 0.0882169 0.0823291 0.0674156 0.0675144 0.0824019 0.0883004 0.0882853 0.0824083 0.0674923 0.0677138 0.0826172 0.088476 0.0886376 0.0828534 0.0681349 0.0689741 0.0834254 0.0891694 0.0907145 0.0857251 0.072287 0.0715778 0.0829924 0.0881999 0.0916132 0.0941264 0.0955829 0.0960835 0.0963894 0.0969934 0.0972358 0.0975018 0.0976213 0.0977234 0.0977458 0.0977139 0.09764 0.0974453 0.0972435 0.0967372 0.0964488 0.0961266 0.0957311 0.0950541 0.0933224 0.089584 0.0817501 0.0717717 0.0512105 0.0496149 0.0707502 0.0809487 0.0800908 0.0697903 0.0483573 0.0475436 0.0691494 0.0795538 0.0792935 0.0688843 0.0469408 0.0468563 0.068764 0.0791853 0.0790779 0.0686546 0.0465282 0.0465197 0.0685866 0.0790858 0.0790982 0.0685983 0.0465348 0.0465631 0.0686226 0.0791203 0.0791484 0.0686582 0.0466039 0.0466493 0.0687013 0.0791841 0.079217 0.0687445 0.0466973 0.0467481 0.0687926 0.079257 0.0792953 0.0688411 0.0468018 0.0468567 0.0688935 0.079339 0.0793783 0.0689443 0.0469119 0.0469702 0.0689985 0.0794237 0.0794673 0.0690539 0.0470308 0.0470925 0.0691112 0.079515 0.079558 0.0691652 0.0471516 0.0472133 0.0692225 0.0796048 0.0796509 0.0692802 0.047277 0.0473412 0.0693398 0.0797001 0.0797462 0.0693976 0.0474045 0.0474688 0.0694573 0.0797957 0.0798425 0.0695169 0.0475353 0.0476009 0.0695786 0.0798941 0.0799412 0.0696382 0.0476672 0.0477356 0.069701 0.0799931 0.0800431 0.0697635 0.0478056 0.0478745 0.0698277 0.0800965 0.0801453 0.0698883 0.0479415 0.0480112 0.0699522 0.0801975 0.0802493 0.0700162 0.0480823 0.0481535 0.0700819 0.0803039 0.0803561 0.0701462 0.0482248 0.0482977 0.070213 0.080412 0.0804653 0.0702791 0.0483703 0.048443 0.0703465 0.0805225 0.080576 0.0704124 0.0485155 0.0485891 0.0704808 0.0806341 0.0806906 0.0705497 0.0486645 0.0487399 0.0706198 0.0807505 0.0808063 0.0706868 0.0488118 0.0488855 0.0707571 0.0808674 0.0809263 0.0708281 0.0489607 0.0490359 0.0709005 0.0809902 0.0810508 0.0709715 0.0491099 0.0491847 0.0710453 0.0811161 0.08118 0.0711183 0.0492578 0.0493324 0.071194 0.0812478 0.0813143 0.0712682 0.0494039 0.0494775 0.0713457 0.0813852 0.0814566 0.0714244 0.0495504 0.0496235 0.071505 0.0815322 0.0816064 0.0715851 0.0496936 0.0497648 0.0716689 0.0816868 0.0817674 0.0717544 0.0498351 0.0499044 0.0718422 0.0818538 0.0819398 0.0719306 0.0499706 0.0500379 0.0720236 0.0820328 0.0821271 0.0721189 0.0501029 0.0501665 0.0722172 0.0822275 0.0823291 0.0723174 0.0502264 0.0502876 0.0724234 0.0824392 0.0825515 0.0725334 0.0503486 0.0504059 0.0726476 0.0826724 0.0827945 0.072765 0.0504614 0.0505174 0.0728903 0.0829274 0.0830646 0.0730217 0.0505747 0.0506305 0.07316 0.0832113 0.083363 0.073305 0.0506871 0.0507481 0.0734618 0.0835281 0.0836994 0.0736284 0.0508147 0.0508845 0.0738057 0.0838832 0.0840755 0.0739936 0.0509593 0.0510456 0.0741989 0.0842837 0.0845009 0.0744198 0.0511481 0.0512658 0.0746572 0.0847333 0.0849776 0.0749116 0.0514012 0.0515659 0.0751914 0.0852409 0.0855161 0.0754921 0.0517615 0.0519947 0.0758221 0.0858116 0.086127 0.0761794 0.0522689 0.0525943 0.0765709 0.0864613 0.0868132 0.0769962 0.0529782 0.0534331 0.0774625 0.087191 0.0875939 0.0779735 0.053961 0.05458 0.0785347 0.0880263 0.088488 0.0791532 0.0553007 0.0561524 0.0798545 0.0890078 0.0896017 0.0806778 0.0572113 0.0585421 0.0816288 0.0902702 0.0909396 0.0826119 0.0598755 0.0611399 0.0835566 0.0915438 0.0920284 0.0843377 0.062363 0.0634314 0.0847804 0.0923506 0.0926089 0.0854219 0.0644801 0.0654485 0.0857943 0.092818 0.092966 0.0862072 0.0665297 0.0676793 0.0866186 0.0931258 0.0931516 0.086905 0.0687162 0.0696106 0.0871623 0.093137 0.0931281 0.0874458 0.0705878 0.0716411 0.0877156 0.0931224 0.0930608 0.0879254 0.0727047 0.073313 0.0881243 0.0928812 0.0922857 0.0877597 0.0733143 0.0583799 0.0808858 0.0891841 0.0916353 0.0839816 0.0620562 0.0621012 0.0843419 0.0917692 0.0916415 0.0845178 0.063039 0.064283 0.0845963 0.0914576 0.0915262 0.0850719 0.0658005 0.067464 0.08542 0.0914927 0.0915646 0.0859336 0.0690333 0.070529 0.0861919 0.0914507 0.0914434 0.0866336 0.0720338 0.0734348 0.086964 0.0913811 0.091265 0.0872579 0.0746852 0.0751327 0.0871 0.0907103 0.0882971 0.0819049 0.0646127 0.0686391 0.0847583 0.09031 0.0904079 0.0851523 0.0695764 0.0711676 0.0857499 0.0904103 0.0904057 0.0860897 0.0724136 0.0735575 0.0862957 0.0902947 0.0901774 0.0865762 0.0747327 0.0753598 0.086604 0.0898782 0.0892561 0.0862232 0.0755902 0.0666425 0.081711 0.087184 0.0886153 0.0841886 0.0700885 0.0709565 0.0843974 0.0884418 0.0881064 0.0844559 0.0721208 0.0732621 0.0843877 0.0877209 0.0873594 0.0844829 0.0744739 0.0748427 0.0840794 0.0865147 0.0845853 0.0802557 0.067116 0.0710499 0.0822594 0.0858407 0.0855848 0.0824744 0.0721242 0.0731124 0.0823722 0.0851239 0.0845662 0.0822906 0.0737965 0.073774 0.081522 0.0835204 0.0818527 0.0783833 0.0672059 0.0702818 0.079734 0.0824933 0.0816408 0.0792868 0.0707476 0.0715941 0.0788429 0.0806967 0.0793285 0.0778718 0.0714454 0.0660991 0.07512 0.0776843 0.077757 0.0757289 0.0687744 0.0688973 0.0747982 0.0764055 0.0747658 0.0736538 0.0688246 0.0677185 0.0717601 0.0724587 0.0701353 0.0686854 0.0630941 0.0635402 0.0675695 0.068436 0.0650165 0.0647204 0.0615761 0.056833 0.0607818 0.0618596 0.0586798 0.0581589 0.0559287 0.0517664 0.0526367 0.0525437 0.0452062 0.0449194 0.0437164 0.0348566 0.0347526 0.0351812 0.0239795 0.0220371 0.020615 0.00593327 0.00913311 0.0150049 0.0295593 0.0279373 0.0283298 0.0536066 0.0519378 0.0512216 0.0693128 0.0707704 0.0721998 0.0833237 0.0831549 0.0822571 0.0866971 0.0866284 0.0854392 0.089033 0.0917222 0.0917619 0.0932245 0.0924454 0.0889933 0.0908973 0.095238 0.0959019 0.0968469 0.0953746 0.09039 0.087362 0.0944695 0.0965346 0.0984302 0.0968313 0.0896479 0.0867847 0.0949361 0.0974777 0.0994142 0.0976558 0.0904469 0.0893953 0.0969945 0.0994403 0.0981604 0.0950479 0.0864611 0.0896809 0.0977183 0.0998865 0.0995499 0.0966875 0.0881387 0.0851825 0.0945488 0.0980184 0.0998252 0.0975359 0.088879 0.08726 0.0964509 0.0995287 0.0977494 0.0938772 0.0837764 0.0877438 0.0969076 0.0994955 0.099281 0.0961599 0.086708 0.0832453 0.0934678 0.0973556 0.0991356 0.0965229 0.0875372 0.0866635 0.0959513 0.0991625 0.0972521 0.0932458 0.0830361 0.0868011 0.096192 0.0989497 0.0988688 0.0955701 0.0859391 0.0827668 0.0930326 0.0970049 0.0988399 0.096067 0.0867058 0.0856235 0.0953392 0.0987083 0.0968207 0.0927741 0.0823082 0.0865289 0.0958427 0.0986476 0.0986466 0.0953292 0.0854617 0.0837169 0.0940475 0.0979831 0.0955525 0.0910932 0.0792094 0.0839804 0.094663 0.0976765 0.0977516 0.0940006 0.0828921 0.0790131 0.0909062 0.0956814 0.0978041 0.0945708 0.0836719 0.0822856 0.0935949 0.0976089 0.0953608 0.0908081 0.0783929 0.083571 0.0945577 0.097637 0.0977119 0.093905 0.082634 0.078878 0.0908129 0.0955592 0.0977293 0.0944282 0.0833157 0.082197 0.0936671 0.0976112 0.0955618 0.0907277 0.0787835 0.0836752 0.0946408 0.0979318 0.0978467 0.0939366 0.0825944 0.0788987 0.0909152 0.0955572 0.0978719 0.0945973 0.0836811 0.0825179 0.093789 0.097925 0.0958421 0.0911048 0.0789616 0.0840827 0.0950787 0.0983333 0.0983207 0.0942521 0.0829476 0.0788013 0.0911969 0.0958173 0.098304 0.0950122 0.0835181 0.0811345 0.0929538 0.0971113 0.099613 0.0966885 0.0863599 0.0857744 0.0961003 0.0997169 0.0976864 0.0933909 0.0826325 0.0867207 0.0968053 0.0998922 0.0997675 0.096012 0.0854849 0.0824141 0.0934909 0.0979126 0.10039 0.0974435 0.0873664 0.0866193 0.0970166 0.100634 0.0987087 0.0943485 0.0834604 0.0876602 0.0978986 0.100901 0.100747 0.0969634 0.0862214 0.082634 0.0939952 0.0987269 0.101186 0.0980124 0.0876249 0.0870827 0.0976872 0.101432 0.0992686 0.0951047 0.0835965 0.0877521 0.0987454 0.101733 0.100338 0.0964514 0.0851667 0.0889123 0.0995274 0.102498 0.102443 0.0987375 0.087887 0.0851994 0.0963058 0.100645 0.103075 0.100241 0.0899669 0.0889813 0.099661 0.103335 0.101282 0.0969136 0.0854006 0.0896815 0.100691 0.103649 0.102196 0.0982501 0.0869818 0.0911026 0.101371 0.10435 0.10461 0.101059 0.0907834 0.0881085 0.0987323 0.102936 0.105245 0.102327 0.0923251 0.0914529 0.101738 0.105297 0.103237 0.0991524 0.0879765 0.0918448 0.102749 0.105633 0.104121 0.100176 0.0889179 0.0930191 0.10328 0.106189 0.106584 0.10306 0.0927616 0.0900222 0.100825 0.104955 0.10725 0.104414 0.0942084 0.0932992 0.103809 0.107377 0.105344 0.100824 0.0898517 0.0934848 0.104648 0.107631 0.106184 0.102224 0.0906682 0.0950109 0.105486 0.108411 0.108635 0.10499 0.0945429 0.0914334 0.102575 0.106793 0.109324 0.106464 0.0955916 0.0934643 0.104522 0.108313 0.110636 0.107929 0.0978064 0.0966481 0.107017 0.110483 0.1083 0.103903 0.0932229 0.0965083 0.107397 0.11047 0.109393 0.105395 0.0942647 0.0992502 0.1092 0.111966 0.112104 0.108621 0.0985078 0.0953954 0.105823 0.110211 0.112597 0.109735 0.0991988 0.0968556 0.107728 0.11148 0.113665 0.110967 0.100919 0.0997619 0.109926 0.113452 0.111205 0.106977 0.0959069 0.0998246 0.110641 0.113443 0.112721 0.109052 0.0981284 0.102494 0.112626 0.115236 0.115381 0.112054 0.101789 0.0984516 0.109081 0.113428 0.115676 0.112893 0.10183 0.0994519 0.110626 0.11448 0.116793 0.114034 0.103297 0.100665 0.111523 0.115308 0.117166 0.11442 0.104327 0.103964 0.114019 0.117459 0.115831 0.111684 0.101198 0.104965 0.115505 0.118289 0.117296 0.113583 0.102788 0.106809 0.116962 0.119572 0.119506 0.116063 0.105752 0.102361 0.113079 0.117505 0.119702 0.116858 0.105526 0.102643 0.114263 0.118207 0.120421 0.117605 0.106385 0.104705 0.115841 0.119553 0.121986 0.119416 0.109345 0.108556 0.118741 0.122149 0.120346 0.116264 0.105471 0.109008 0.119959 0.122702 0.121423 0.117648 0.106461 0.110364 0.121144 0.123756 0.122586 0.119024 0.108308 0.111712 0.121873 0.124528 0.124288 0.120763 0.110416 0.107254 0.117995 0.122411 0.124913 0.122153 0.111246 0.109166 0.120263 0.124 0.126424 0.123881 0.113176 0.111218 0.1219 0.12543 0.127573 0.125067 0.115178 0.114348 0.124284 0.127614 0.12578 0.121725 0.111139 0.114363 0.125198 0.127955 0.126547 0.122729 0.111688 0.115036 0.125983 0.128732 0.127749 0.12403 0.113184 0.117399 0.127415 0.129979 0.130167 0.126728 0.116672 0.113306 0.124363 0.128375 0.13071 0.128062 0.116794 0.114389 0.125925 0.129593 0.131844 0.129389 0.118241 0.116096 0.127185 0.130718 0.132783 0.130246 0.120039 0.118978 0.129225 0.132666 0.130546 0.126365 0.115145 0.118565 0.12989 0.132772 0.13183 0.12789 0.116538 0.120924 0.13186 0.13449 0.133469 0.129803 0.118995 0.122688 0.133285 0.135794 0.134741 0.131277 0.120712 0.124457 0.134348 0.136811 0.136795 0.133497 0.123577 0.120473 0.130673 0.134948 0.137158 0.134404 0.123314 0.120665 0.132084 0.135891 0.138123 0.135369 0.123942 0.121635 0.132996 0.136881 0.139218 0.136598 0.125846 0.124077 0.1347 0.138304 0.140558 0.138106 0.128206 0.127424 0.137401 0.140717 0.138967 0.134927 0.124116 0.127497 0.138624 0.141292 0.140165 0.136379 0.125066 0.12877 0.139905 0.142516 0.14128 0.137599 0.126559 0.130194 0.14091 0.14344 0.142228 0.138632 0.128038 0.131524 0.141594 0.144204 0.144296 0.14088 0.130777 0.127636 0.138477 0.142594 0.145029 0.142303 0.131102 0.128722 0.14015 0.143992 0.146433 0.143881 0.132658 0.130544 0.141647 0.14531 0.14746 0.144927 0.134101 0.131989 0.142779 0.146375 0.148468 0.145946 0.13593 0.135071 0.145115 0.148486 0.146588 0.142265 0.131753 0.13455 0.146002 0.148788 0.147594 0.143694 0.131909 0.136117 0.147566 0.15021 0.149171 0.14537 0.13421 0.137977 0.149008 0.151606 0.150484 0.14683 0.135908 0.139422 0.150156 0.152718 0.151682 0.148119 0.137514 0.141269 0.151342 0.15382 0.153889 0.150478 0.140351 0.136816 0.147964 0.152104 0.154455 0.15165 0.14024 0.137576 0.149255 0.153184 0.155455 0.152756 0.141159 0.138801 0.150277 0.154194 0.156607 0.153923 0.142774 0.140923 0.151854 0.155592 0.157944 0.155364 0.144582 0.14278 0.15346 0.157045 0.159336 0.156855 0.146913 0.146038 0.156091 0.15945 0.157674 0.153539 0.142664 0.146157 0.157323 0.160055 0.158935 0.155027 0.143812 0.147734 0.158878 0.161497 0.16033 0.156582 0.145521 0.148978 0.159988 0.162609 0.161352 0.157608 0.146757 0.150344 0.161 0.163606 0.162686 0.15914 0.148576 0.152368 0.162425 0.1649 0.165058 0.161676 0.151582 0.148174 0.159236 0.163358 0.165697 0.162949 0.151365 0.148974 0.160671 0.164628 0.167133 0.16452 0.152858 0.150535 0.162182 0.165967 0.168321 0.165742 0.154349 0.152317 0.163519 0.167193 0.169418 0.166834 0.155833 0.15395 0.16478 0.168412 0.170703 0.168206 0.158065 0.1572 0.16743 0.170871 0.169148 0.164933 0.153874 0.157315 0.168826 0.171598 0.170602 0.166666 0.155074 0.159102 0.170642 0.173251 0.172098 0.168292 0.156781 0.160632 0.171911 0.174515 0.17344 0.169765 0.158698 0.162228 0.17319 0.17578 0.174806 0.171169 0.160345 0.164334 0.174557 0.177061 0.177198 0.173721 0.163389 0.159775 0.171262 0.175494 0.177983 0.175188 0.16337 0.160919 0.172813 0.176877 0.179424 0.176704 0.164894 0.162575 0.174345 0.178272 0.180815 0.178157 0.166448 0.164399 0.1759 0.179715 0.182136 0.179489 0.168079 0.166075 0.177264 0.181056 0.183552 0.180963 0.17003 0.168225 0.17904 0.182669 0.184997 0.182477 0.172404 0.171562 0.181824 0.185291 0.183626 0.179348 0.16859 0.172064 0.18335 0.186153 0.18515 0.18125 0.169756 0.173909 0.185297 0.187896 0.186838 0.183069 0.171821 0.175574 0.186701 0.189313 0.188254 0.184506 0.173633 0.177322 0.188077 0.190669 0.18973 0.186137 0.175445 0.179412 0.18956 0.192057 0.19226 0.188788 0.178422 0.175324 0.186399 0.190645 0.193158 0.190422 0.178846 0.176312 0.188005 0.19203 0.194647 0.191989 0.180309 0.178269 0.189822 0.193639 0.196132 0.193522 0.182043 0.180185 0.191426 0.195198 0.197823 0.1953 0.184249 0.182537 0.19349 0.197064 0.199447 0.197025 0.186777 0.185527 0.196131 0.199637 0.197938 0.193542 0.182561 0.186234 0.197697 0.2006 0.199484 0.195441 0.183697 0.187882 0.199549 0.202282 0.201207 0.197264 0.185745 0.189839 0.201186 0.203865 0.202922 0.199143 0.188011 0.191873 0.202878 0.205492 0.204702 0.201013 0.190051 0.194434 0.204733 0.207255 0.207737 0.204198 0.193647 0.190714 0.201916 0.206278 0.209005 0.206263 0.19465 0.192399 0.204071 0.208044 0.210713 0.20802 0.19628 0.193904 0.205561 0.209537 0.212011 0.209281 0.197726 0.195635 0.207061 0.210962 0.213659 0.211028 0.199838 0.197895 0.209113 0.212836 0.215337 0.21278 0.202205 0.201457 0.212289 0.21588 0.214353 0.209956 0.1986 0.202382 0.214178 0.217055 0.216162 0.212091 0.200224 0.204774 0.216485 0.219193 0.218459 0.21455 0.20292 0.207884 0.218994 0.221466 0.220723 0.217166 0.206101 0.209648 0.220465 0.223009 0.223061 0.219404 0.208183 0.204819 0.216793 0.221347 0.224066 0.221195 0.208673 0.206218 0.218796 0.223042 0.225926 0.223145 0.210785 0.208508 0.220823 0.224914 0.227774 0.225005 0.213153 0.211033 0.22294 0.226926 0.229691 0.227007 0.215886 0.215119 0.226609 0.230403 0.228893 0.224202 0.212449 0.216781 0.228969 0.232027 0.231332 0.227176 0.214637 0.220184 0.232246 0.234814 0.233829 0.229911 0.217831 0.221554 0.233573 0.236354 0.235214 0.231198 0.219104 0.223627 0.235065 0.237871 0.238105 0.234133 0.222234 0.218979 0.231579 0.236498 0.239595 0.236621 0.223649 0.22105 0.234151 0.238612 0.241689 0.238785 0.226067 0.224005 0.236632 0.240871 0.244197 0.241351 0.229054 0.226982 0.23943 0.243565 0.246637 0.243927 0.232268 0.231792 0.243851 0.247741 0.246651 0.241985 0.229528 0.234218 0.247122 0.249949 0.248527 0.244145 0.230887 0.235317 0.248282 0.251273 0.250069 0.245782 0.232831 0.237496 0.250155 0.253102 0.252144 0.247887 0.235178 0.240132 0.25214 0.255041 0.255628 0.251499 0.239089 0.236056 0.249002 0.254051 0.257266 0.25412 0.240978 0.238582 0.251952 0.256492 0.260101 0.25722 0.244335 0.242265 0.255409 0.259666 0.263154 0.260458 0.248305 0.248495 0.260888 0.26469 0.263262 0.258463 0.24571 0.24955 0.26298 0.2661 0.264548 0.259893 0.246119 0.251034 0.264512 0.267696 0.266592 0.262039 0.248555 0.253793 0.266885 0.269934 0.269188 0.264787 0.251656 0.257088 0.269449 0.272453 0.273337 0.269061 0.256217 0.253491 0.266594 0.271822 0.275303 0.271957 0.258821 0.256482 0.270042 0.274658 0.278719 0.275829 0.262696 0.261034 0.274431 0.278728 0.282603 0.280281 0.26885 0.268615 0.280403 0.28385 0.281762 0.276988 0.26417 0.267586 0.281119 0.284468 0.283171 0.278421 0.264423 0.269922 0.283573 0.286755 0.286 0.281419 0.267496 0.273361 0.286385 0.289453 0.290456 0.28601 0.272418 0.269534 0.283437 0.288933 0.292516 0.28905 0.275339 0.272828 0.287071 0.291948 0.296168 0.293084 0.279752 0.279654 0.293754 0.298305 0.297629 0.292243 0.277911 0.28528 0.299055 0.301994 0.300743 0.296177 0.281964 0.285966 0.30039 0.303803 0.302268 0.297278 0.282428 0.288125 0.302128 0.305545 0.306235 0.301343 0.286804 0.283535 0.298655 0.304587 0.308593 0.304898 0.289829 0.28717 0.302768 0.307962 0.312315 0.30903 0.294549 0.294056 0.309288 0.314172 0.312897 0.306934 0.291204 0.298466 0.313787 0.317407 0.317747 0.312683 0.297146 0.306645 0.320379 0.323022 0.323937 0.319657 0.305093 0.299523 0.315355 0.321192 0.324457 0.320429 0.304513 0.300806 0.31741 0.32304 0.327225 0.323522 0.308178 0.307103 0.323251 0.328604 0.327101 0.320566 0.303838 0.31113 0.327743 0.331795 0.331249 0.325456 0.308364 0.31718 0.3329 0.336402 0.339051 0.333731 0.317116 0.314968 0.332116 0.338475 0.344244 0.341252 0.326196 0.324033 0.339216 0.343983 0.34775 0.344292 0.328894 0.325639 0.342323 0.347554 0.344946 0.338352 0.320877 0.327976 0.345022 0.349517 0.348405 0.342418 0.324595 0.333029 0.349432 0.353316 0.355308 0.349618 0.332325 0.32938 0.347106 0.354117 0.359513 0.355521 0.338341 0.336664 0.354351 0.360205 0.36668 0.363858 0.349021 0.352156 0.367261 0.371074 0.369754 0.364514 0.348802 0.352365 0.368829 0.372961 0.372461 0.366676 0.348615 0.343785 0.362734 0.369927 0.375246 0.370604 0.352362 0.349161 0.368299 0.374553 0.380262 0.376277 0.358953 0.359069 0.377405 0.383212 0.382683 0.375614 0.356739 0.367385 0.384604 0.388588 0.393189 0.387845 0.36938 0.369153 0.387611 0.393759 0.399754 0.395906 0.37798 0.372945 0.393145 0.399334 0.395808 0.38784 0.366544 0.375251 0.395578 0.400867 0.399597 0.392471 0.371501 0.382484 0.401278 0.405809 0.409085 0.40268 0.382924 0.381063 0.401259 0.408911 0.415669 0.41152 0.393706 0.397268 0.416209 0.421455 0.422747 0.416816 0.398141 0.407067 0.425262 0.428969 0.42823 0.422104 0.401368 0.394533 0.416553 0.424862 0.429936 0.424564 0.404288 0.402672 0.424528 0.431608 0.430755 0.422151 0.399621 0.413674 0.43373 0.438646 0.444291 0.437647 0.415851 0.418279 0.439747 0.446989 0.456319 0.4536 0.436067 0.432625 0.453023 0.457997 0.456786 0.449009 0.425333 0.41624 0.442697 0.452805 0.45873 0.45265 0.428603 0.427169 0.453331 0.461439 0.461632 0.452029 0.425138 0.446143 0.467664 0.472263 0.482289 0.477917 0.455317 0.458997 0.481811 0.487742 0.483712 0.474419 0.447681 0.45554 0.48096 0.487744 0.486899 0.478662 0.449641 0.446751 0.477663 0.48801 0.488038 0.475484 0.443587 0.471228 0.495261 0.499769 0.511104 0.506313 0.481699 0.481564 0.508266 0.51526 0.509375 0.49811 0.465851 0.476664 0.50568 0.513288 0.513733 0.505261 0.47256 0.472284 0.508098 0.518077 0.528603 0.518614 0.483042 0.48158 0.517486 0.528238 0.536104 0.527084 0.493633 0.481943 0.521265 0.532622 0.532205 0.519357 0.47588 0.478702 0.52497 0.536944 0.542049 0.528503 0.480098 0.468971 0.523176 0.540604 0.529022 0.508546 0.450989 0.483307 0.523682 0.53623 0.533466 0.521908 0.480633 0.46998 0.516582 0.530755 0.524418 0.507849 0.451952 0.434173 0.495752 0.514329 0.502225 0.48131 0.41408 0.391067 0.465942 0.490052 0.478883 0.451874 0.371162 0.355192 0.440145 0.469604 0.461814 0.430027 0.341547 0.329417 0.420846 0.454875 0.448495 0.412313 0.31848 0.308623 0.40432 0.442549 0.436952 0.396803 0.299637 0.291456 0.389718 0.431637 0.426573 0.383037 0.284013 0.277204 0.376713 0.421732 0.4171 0.370736 0.27099 0.265343 0.365101 0.412662 0.408399 0.359789 0.260212 0.255556 0.354788 0.404291 0.40033 0.350076 0.251322 0.247491 0.345648 0.396508 0.392821 0.341487 0.244037 0.240936 0.337588 0.389263 0.385826 0.333924 0.23815 0.235656 0.330487 0.382499 0.379279 0.327258 0.233425 0.231441 0.324238 0.376165 0.373158 0.32141 0.229681 0.228124 0.318768 0.370254 0.36745 0.316294 0.226747 0.225538 0.313982 0.364742 0.362129 0.311818 0.224477 0.223552 0.309795 0.359609 0.357182 0.307895 0.222747 0.222053 0.306117 0.35485 0.352609 0.304447 0.221457 0.220949 0.302882 0.350459 0.348392 0.301412 0.220518 0.220158 0.300034 0.346413 0.344514 0.298738 0.219857 0.219609 0.297525 0.342704 0.340971 0.296384 0.219408 0.219248 0.295312 0.339323 0.33775 0.294305 0.219122 0.219028 0.29336 0.336257 0.334833 0.292465 0.218968 0.218929 0.291625 0.333483 0.332198 0.29083 0.218917 0.218917 0.290085 0.330982 0.329826 0.28938 0.218935 0.218956 0.288721 0.328733 0.327696 0.288095 0.218987 0.219018 0.287514 0.326717 0.325787 0.286961 0.219055 0.219086 0.286446 0.324909 0.324074 0.285956 0.219122 0.219153 0.285501 0.323291 0.322545 0.285069 0.219187 0.219211 0.284666 0.321842 0.321174 0.284283 0.21924 0.219265 0.28393 0.320549 0.319953 0.283597 0.219293 0.219311 0.283287 0.319393 0.318858 0.282991 0.21933 0.219343 0.282718 0.318357 0.317879 0.282459 0.219359 0.219365 0.282218 0.317429 0.316998 0.281989 0.219373 0.219376 0.281777 0.316596 0.316211 0.281576 0.219382 0.21938 0.281385 0.315846 0.315496 0.281202 0.219381 0.219378 0.281031 0.315168 0.314852 0.280868 0.219378 0.21937 0.280713 0.314553 0.314264 0.280563 0.219365 0.219356 0.280424 0.313994 0.313733 0.280292 0.219351 0.219339 0.280166 0.313485 0.313246 0.280044 0.219328 0.219316 0.279932 0.313023 0.312806 0.279825 0.219307 0.219292 0.279722 0.312601 0.312402 0.279623 0.219278 0.219264 0.279532 0.312216 0.312037 0.279446 0.219251 0.219236 0.279363 0.311866 0.311704 0.279283 0.21922 0.219204 0.279209 0.311549 0.311407 0.279141 0.219192 0.219179 0.279077 0.311266 0.311138 0.279017 0.219168 0.219154 0.278959 0.311007 0.310894 0.278906 0.219145 0.219135 0.278858 0.310776 0.310675 0.278814 0.219128 0.21912 0.278772 0.310567 0.310479 0.278735 0.219117 0.219113 0.278702 0.310382 0.310304 0.278672 0.219113 0.219112 0.278644 0.310215 0.310148 0.278621 0.219116 0.219119 0.278599 0.310068 0.31001 0.278583 0.219128 0.219136 0.278566 0.309938 0.309889 0.278557 0.21915 0.219163 0.278547 0.309825 0.309785 0.278544 0.219182 0.2192 0.27854 0.309727 0.309697 0.278543 0.219224 0.219247 0.278545 0.309647 0.309624 0.278554 0.219276 0.219304 0.278561 0.30958 0.309565 0.278576 0.219337 0.219371 0.278589 0.309528 0.309521 0.278609 0.219408 0.219446 0.278627 0.309489 0.30949 0.278651 0.219488 0.21953 0.278675 0.309464 0.309472 0.278704 0.219575 0.219621 0.278731 0.309451 0.309466 0.278765 0.219671 0.219721 0.278797 0.30945 0.309471 0.278834 0.219773 0.219826 0.27887 0.309459 0.309486 0.278912 0.219882 0.219938 0.278952 0.30948 0.309512 0.278997 0.219997 0.220056 0.27904 0.30951 0.309547 0.279088 0.220117 0.220179 0.279135 0.30955 0.309591 0.279187 0.220242 0.220306 0.279237 0.309598 0.309643 0.279291 0.220372 0.220438 0.279344 0.309655 0.309704 0.279402 0.220505 0.220574 0.279457 0.309719 0.309773 0.279518 0.220644 0.220714 0.279577 0.309792 0.30985 0.27964 0.220786 0.220858 0.279701 0.309871 0.309934 0.279767 0.220932 0.221006 0.279832 0.309959 0.310025 0.2799 0.221081 0.221157 0.279967 0.310053 0.310123 0.280037 0.221233 0.221311 0.280106 0.310154 0.310227 0.280179 0.221388 0.221466 0.28025 0.31026 0.310336 0.280324 0.221545 0.221624 0.280397 0.310372 0.31045 0.280473 0.221703 0.221783 0.280547 0.310488 0.310569 0.280625 0.221862 0.221942 0.2807 0.310609 0.310692 0.280779 0.222022 0.222103 0.280856 0.310734 0.310819 0.280936 0.222183 0.222263 0.281013 0.310863 0.310949 0.281094 0.222343 0.222424 0.281172 0.310994 0.311082 0.281254 0.222504 0.222584 0.281333 0.311129 0.311218 0.281416 0.222664 0.222745 0.281496 0.311266 0.311357 0.281579 0.222825 0.222906 0.28166 0.311406 0.311498 0.281744 0.222987 0.223068 0.281826 0.311549 0.311644 0.281911 0.223149 0.223231 0.281995 0.311696 0.311792 0.282081 0.223313 0.223395 0.282166 0.311846 0.311945 0.282254 0.223478 0.223561 0.28234 0.312001 0.312101 0.282429 0.223645 0.223729 0.282517 0.312159 0.312262 0.282608 0.223814 0.223899 0.282697 0.312322 0.312426 0.28279 0.223985 0.224071 0.282881 0.312489 0.312596 0.282976 0.224158 0.224245 0.283068 0.312661 0.312769 0.283164 0.224332 0.224418 0.283258 0.312835 0.312944 0.283354 0.224505 0.22459 0.283447 0.313011 0.313119 0.283542 0.224675 0.224758 0.283635 0.313186 0.313294 0.283729 0.224842 0.224923 0.28382 0.313359 0.313466 0.283912 0.225003 0.225082 0.284001 0.313532 0.31364 0.284095 0.225159 0.225239 0.284185 0.313706 0.313814 0.284278 0.225322 0.225397 0.284365 0.313877 0.314 0.284454 0.225471 0.225539 0.284534 0.314055 0.314169 0.284637 0.225667 0.225749 0.284729 0.314247 0.314324 0.284841 0.225865 0.225988 0.284887 0.314344 0.314242 0.284793 0.22607 0.225973 0.284561 0.314035 0.314613 0.284757 0.226105 0.227129 0.285913 0.316503 0.31761 0.286857 0.227992 0.357557 0.393104 0.414594 0.419388 0.421567 0.428658 0.432127 0.434362 0.43635 0.440736 0.443426 0.446723 0.449286 0.451108 0.452446 0.453381 0.454039 0.454504 0.454839 0.455086 0.455272 0.455417 0.455531 0.455623 0.455698 0.45576 0.455811 0.455853 0.455885 0.455911 0.455927 0.455938 0.455942 0.455931 0.455927 0.455922 0.455914 0.455904 0.45589 0.455872 0.455849 0.455821 0.455789 0.455755 0.455723 0.455688 0.455639 0.455568 0.455478 0.455373 0.455257 0.45513 0.45499 0.454837 0.454667 0.45448 0.454273 0.454043 0.453787 0.453501 0.453181 0.452821 0.452417 0.451962 0.45145 0.450874 0.450226 0.4495 0.448684 0.44777 0.446747 0.445605 0.444329 0.442909 0.441332 0.439584 0.437654 0.435528 0.433197 0.43065 0.42788 0.424882 0.421653 0.418192 0.414504 0.410593 0.406471 0.402147 0.397637 0.392954 0.388121 0.38315 0.378066 0.372885 0.367629 0.362314 0.356963 0.351588 0.346208 0.34084 0.335493 0.330183 0.324921 0.319714 0.314575 0.309508 0.30452 0.299619 0.294807 0.290087 0.285466 0.280941 0.276517 0.272193 0.267972 0.263852 0.259834 0.255916 0.252099 0.24838 0.244759 0.241236 0.237806 0.234471 0.231225 0.228071 0.225004 0.222023 0.219126 0.216311 0.213577 0.21092 0.20834 0.205835 0.203402 0.20104 0.198747 0.19652 0.19436 0.192264 0.190229 0.188255 0.18634 0.184482 0.18268 0.180932 0.179238 0.177595 0.176001 0.174457 0.172961 0.171511 0.170106 0.168745 0.167427 0.166151 0.164915 0.163719 0.162562 0.161442 0.16036 0.159313 0.1583 0.157322 0.156378 0.155466 0.154585 0.153735 0.152916 0.152126 0.151365 0.150632 0.149927 0.149249 0.148597 0.14797 0.147369 0.146793 0.146241 0.145713 0.145208 0.144727 0.144267 0.14383 0.143415 0.143021 0.142648 0.142296 0.141964 0.141653 0.141362 0.141092 0.140841 0.14061 0.140398 0.140207 0.140035 0.139884 0.139753 0.139644 0.139557 0.139491 0.139446 0.139417 0.139403 0.139398 0.139396 0.139395 0.139393 0.139391 0.139388 0.139377 0.139342 0.139257 0.139112 0.138916 0.138691 0.138456 0.138218 0.137979 0.137736 0.137487 0.137228 0.136958 0.136677 0.136384 0.13608 0.135766 0.13544 0.135104 0.134758 0.134401 0.134034 0.133657 0.13327 0.132873 0.132467 0.132052 0.131628 0.131196 0.130756 0.130308 0.129853 0.129392 0.128923 0.128449 0.12797 0.127485 0.126996 0.126503 0.126007 0.125508 0.125006 0.124502 0.123997 0.123492 0.122986 0.12248 0.121976 0.121473 0.120973 0.120475 0.119981 0.119491 0.119006 0.118525 0.118051 0.117583 0.117122 0.116669 0.116225 0.115789 0.115362 0.114946 0.11454 0.114144 0.11376 0.113388 0.113029 0.112683 0.11235 0.11203 0.11172 0.111417 0.111117 0.110818 0.110535 0.110298 0.110151 0.110106 0.110129 0.110176 0.11022 0.110248 0.11024 0.110216 0.110096 0.11012 0.110122 0.110092 0.110054 0.109983 0.109914 0.109813 0.109721 0.109596 0.109489 0.109337 0.109209 0.109035 0.108893 0.108704 0.108553 0.108347 0.108185 0.107964 0.107791 0.107555 0.107372 0.107123 0.10693 0.106666 0.106463 0.106185 0.105972 0.10568 0.105457 0.105151 0.104917 0.104597 0.104352 0.104016 0.10376 0.10341 0.103141 0.102776 0.102494 0.102113 0.101819 0.101421 0.101113 0.100699 0.100376 0.0999457 0.0996075 0.0991595 0.0988056 0.0983396 0.0979694 0.0974851 0.097098 0.096595 0.0961906 0.0956687 0.0952466 0.0947057 0.094266 0.0937062 0.093249 0.092671 0.0921971 0.0916017 0.0911122 0.0905007 0.0899974 0.0893718 0.0888569 0.0882199 0.0876966 0.0870517 0.0865244 0.0858763 0.0853505 0.0847049 0.0841879 0.0835524 0.0830528 0.0824365 0.0819653 0.0813793 0.0809494 0.0804062 0.0800321 0.0795458 0.0792419 0.0788277 0.0786069 0.0782816 0.0781583 0.0779344 0.0779184 0.0778066 0.0778932 0.0778848 0.0780955 0.0782074 0.0785579 0.0787858 0.0792305 0.0795434 0.080066 0.0804433 0.0810226 0.0814481 0.0820662 0.0825233 0.0831616 0.0836331 0.0842739 0.0847444 0.085372 0.085828 0.086429 0.0868588 0.087422 0.0878164 0.0883335 0.0886858 0.0891517 0.0894566 0.089869 0.090125 0.0904847 0.0906934 0.091003 0.0911676 0.0914325 0.091558 0.0917841 0.0918761 0.0920694 0.0921331 0.0922994 0.0923399 0.0924839 0.0925055 0.0926308 0.0926367 0.0927482 0.0927416 0.0928414 0.0928246 0.0929153 0.0928903 0.0929739 0.0929424 0.0930208 0.0929843 0.0930584 0.0930178 0.0930891 0.093045 0.0931133 0.093067 0.0931347 0.0930871 0.0931527 0.0931045 0.0931733 0.093124 0.0931959 0.0931509 0.0932344 0.0932001 0.0932991 0.0932446 0.0934149 0.0936574 0.0942381 0.0954919 0.0953813 0.0953268 0.0960219 0.0952103 0.0953045 0.0959786 0.0951595 0.0952655 0.0959454 0.0951144 0.0952247 0.0959146 0.0950775 0.0951905 0.0958867 0.0950459 0.0951586 0.095859 0.0950155 0.0951275 0.0958296 0.0949823 0.0950922 0.0957977 0.094947 0.0950552 0.0957623 0.094907 0.0950121 0.0957219 0.0948612 0.094963 0.0956756 0.0948082 0.0949057 0.0956217 0.0947461 0.0948383 0.0955579 0.0946719 0.0947575 0.0954815 0.0945826 0.09466 0.0953893 0.094474 0.0945411 0.0952772 0.0943417 0.0943963 0.09514 0.0941793 0.0942184 0.0949715 0.09398 0.0940001 0.0947641 0.0937352 0.0937322 0.0945086 0.0934347 0.0934037 0.094194 0.0930673 0.0930033 0.0938086 0.0926212 0.0925195 0.0933403 0.0920845 0.0919421 0.0927792 0.0914519 0.0912669 0.0921191 0.0907203 0.0904934 0.091359 0.0898925 0.0896271 0.0905036 0.0889774 0.0886794 0.0895638 0.0879896 0.0876676 0.0885572 0.0869497 0.0866148 0.0875079 0.0858832 0.0855484 0.086445 0.0848189 0.0844996 0.0854016 0.0837904 0.0835033 0.0844144 0.0828332 0.0825944 0.0835187 0.0819791 0.081801 0.0827291 0.0812557 0.0811601 0.0820911 0.080712 0.0807356 0.0817119 0.0804382 0.0805883 0.0816185 0.0804194 0.080662 0.0817363 0.0805897 0.0809381 0.0820549 0.0809698 0.0814138 0.0825782 0.0815406 0.0820662 0.0832738 0.082273 0.0828659 0.0841076 0.0831378 0.0837815 0.0850476 0.0841036 0.0847837 0.0860652 0.0851423 0.085847 0.0871351 0.0862308 0.086949 0.0882356 0.0873484 0.0880715 0.0893496 0.0884787 0.0891998 0.0904641 0.0896088 0.0903223 0.0915685 0.0907281 0.0914299 0.0926547 0.0918288 0.0925156 0.0937165 0.0929048 0.0935741 0.0947493 0.0939515 0.0946017 0.0957498 0.0949659 0.0955957 0.0967159 0.0959456 0.0965542 0.0976459 0.0968891 0.0974761 0.0985388 0.0977957 0.0983608 0.0993943 0.0986651 0.0992085 0.100213 0.0994978 0.10002 0.100994 0.100294 0.100795 0.10174 0.101056 0.101535 0.102451 0.101783 0.102242 0.103127 0.102476 0.102916 0.103771 0.103138 0.103557 0.104382 0.103767 0.104168 0.104961 0.104367 0.104748 0.10551 0.104937 0.105299 0.106028 0.105478 0.105822 0.106517 0.105991 0.106317 0.106978 0.106477 0.106784 0.10741 0.106935 0.107224 0.107813 0.107367 0.107638 0.108188 0.107772 0.108024 0.108535 0.108151 0.108385 0.108853 0.108504 0.108718 0.109144 0.108829 0.109024 0.109405 0.109128 0.109302 0.109636 0.109397 0.10955 0.109835 0.109638 0.109772 0.110006 0.109851 0.10996 0.110141 0.110022 0.110102 0.110234 0.110151 0.110208 0.110291 0.110242 0.110271 0.110311 0.110282 0.110279 0.110291 0.110258 0.110259 0.110259 0.11024 0.110194 0.11012 0.110015 0.109881 0.109719 0.109527 0.109308 0.109061 0.108787 0.108486 0.108157 0.107801 0.107416 0.107003 0.106562 0.106091 0.10559 0.105059 0.104495 0.1039 0.10327 0.102607 0.101908 0.101173 0.100401 0.0995916 0.0987437 0.0978574 0.0969335 0.0959731 0.0949773 0.0939485 0.09289 0.0918067 0.0907054 0.0895948 0.0884863 0.0873958 0.0863456 0.0853628 0.0844803 0.083737 0.0831775 0.0828464 0.0827475 0.0829102 0.0834169 0.0842016 0.0851353 0.0861781 0.0872965 0.0884483 0.0895931 0.0906924 0.0917155 0.0926398 0.0934533 0.0941508 0.0947326 0.0952052 0.0955805 0.0958739 0.0961017 0.0962786 0.0964168 0.0965257 0.0966124 0.0966824 0.0967401 0.0967885 0.0968301 0.0968664 0.0968989 0.0969288 0.0969566 0.0969828 0.0970076 0.0970305 0.0970503 0.0970653 0.0970759 0.097095 0.0969893 0.0962385 0.0959861 0.0960273 0.0963251 0.0969867 0.0972279 0.0972015 0.0975088 0.0975049 0.0976181 0.0976084 0.0975613 0.0975468 0.0975391 0.0975273 0.0975119 0.0974937 0.0974735 0.0974521 0.09743 0.0974072 0.0973837 0.0973587 0.0973316 0.0973018 0.097268 0.0975257 0.0975414 0.0975575 0.0975743 0.0975915 0.0976089 0.0976266 0.0976447 0.0976627 0.0976801 0.0976962 0.09771 0.0977203 0.0977266 0.0977384 0.0977236 0.0977239 0.0977453 0.0977432 0.0977085 0.0977126 0.0976432 0.0976476 0.0976865 0.097678 0.0976751 0.0973401 0.0973377 0.0973408 0.0974178 0.0974368 0.0972332 0.0972404 0.0965794 0.0966618 0.0963372 0.096335 0.096386 0.09636 0.0963581 0.0963649 0.0973384 0.0976682 0.0976576 0.0976449 0.0976311 0.0973229 0.0973284 0.0973338 0.0963766 0.096391 0.0964078 0.0956123 0.0954961 0.0955901 0.0954742 0.0955711 0.0954557 0.0955556 0.0954411 0.0955457 0.0954325 0.0955453 0.0954288 0.0955673 0.0955705 0.0956831 0.095926 0.0955847 0.0955145 0.0947926 0.0948917 0.093039 0.092848 0.0926856 0.0947278 0.0945569 0.0925274 0.0925727 0.0946764 0.0945008 0.0924972 0.0925497 0.09463 0.0945199 0.0925041 0.0882113 0.0882114 0.088195 0.0882333 0.0882674 0.0883911 0.0886298 0.0889992 0.0882315 0.0925516 0.0946637 0.0944936 0.0924899 0.0925526 0.0946245 0.09452 0.0925155 0.0925758 0.094664 0.0945006 0.0925242 0.0925842 0.0946317 0.0945327 0.0925522 0.0883529 0.0883346 0.0883004 0.0882952 0.0882645 0.0882623 0.0882323 0.0883869 0.0926142 0.094677 0.0945175 0.0925659 0.0926277 0.0946488 0.0945527 0.0925982 0.0926612 0.0946966 0.0945398 0.0926148 0.0926773 0.0946705 0.0945769 0.0926499 0.0885645 0.0885412 0.0885027 0.0884909 0.0884551 0.0884341 0.0883971 0.0886018 0.0927136 0.0947203 0.0945664 0.0926691 0.0927322 0.0946964 0.0946052 0.0927066 0.0927709 0.0947479 0.0945972 0.0927287 0.0927926 0.0947265 0.0955213 0.0946376 0.0927686 0.0888024 0.0887765 0.0887351 0.088719 0.08868 0.0886552 0.0886155 0.0888428 0.0928334 0.0947794 0.0956375 0.0964268 0.097318 0.0976173 0.097604 0.0975915 0.0975801 0.0973114 0.0973118 0.0973141 0.0964486 0.0964736 0.096502 0.0965325 0.0973135 0.0975703 0.097563 0.0975592 0.0975597 0.097352 0.0973317 0.0973196 0.096569 0.0966193 0.0966851 0.0959704 0.0958405 0.0958913 0.0957668 0.0958288 0.0957084 0.0957791 0.0956609 0.0957367 0.0956192 0.0956994 0.0955823 0.0956665 0.0955498 0.0947604 0.0946319 0.0927933 0.0928579 0.0928366 0.0946745 0.0948156 0.0946717 0.0928648 0.0929025 0.0889751 0.0889325 0.0889034 0.0888602 0.0889951 0.0890402 0.0929304 0.0947994 0.0947163 0.0929112 0.0890712 0.0891157 0.092978 0.0948566 0.0947168 0.0929435 0.0930103 0.0948439 0.0947639 0.0929937 0.0930618 0.0949033 0.0947679 0.0930304 0.0930988 0.0948942 0.0948181 0.093086 0.0893839 0.0893455 0.0892946 0.0892678 0.0892204 0.0891869 0.0891392 0.0894354 0.0931561 0.0949569 0.0948266 0.0931287 0.0931994 0.0949525 0.0948812 0.093191 0.0932641 0.0950201 0.0948968 0.0932427 0.0933171 0.0950234 0.0949582 0.0933146 0.0897736 0.0897226 0.0896606 0.0896224 0.0895654 0.0895221 0.0894665 0.089838 0.0933919 0.0950979 0.0949832 0.0933776 0.0934568 0.095111 0.0950535 0.0934619 0.0935445 0.0951943 0.0950891 0.0935385 0.0936231 0.0952184 0.0959314 0.0951691 0.0936365 0.0903006 0.0902281 0.090148 0.0900902 0.0900161 0.0899551 0.089885 0.0903863 0.0937253 0.0953112 0.096067 0.0967653 0.0973848 0.0975656 0.0975099 0.0972283 0.0971797 0.0971182 0.0970382 0.0969315 0.0967859 0.0965846 0.0963073 0.0959326 0.0954434 0.0948292 0.0940853 0.0932107 0.0922095 0.0910924 0.0898798 0.0911397 0.0923782 0.0934605 0.0944003 0.095199 0.0958596 0.0963843 0.0967775 0.0970512 0.0972278 0.097336 0.0974017 0.0974431 0.0974714 0.0974925 0.0975772 0.0975942 0.0976163 0.0975753 0.0974939 0.097432 0.0968659 0.0969962 0.0971652 0.0973889 0.0976857 0.0976421 0.0976626 0.0976573 0.0975921 0.0980223 0.0979445 0.0978167 0.0976893 0.0980463 0.0983592 0.0982255 0.0978869 0.0976104 0.0973031 0.097134 0.0968823 0.0967845 0.0965776 0.0965288 0.0963511 0.0963351 0.0961783 0.0961852 0.0960417 0.0953484 0.0952167 0.0937293 0.093821 0.0938448 0.0953095 0.0954539 0.0953721 0.0939574 0.0939413 0.0907377 0.090638 0.090551 0.0904579 0.0908259 0.090935 0.0940579 0.095508 0.0954826 0.0940951 0.0910406 0.0911589 0.0942019 0.0956314 0.0955661 0.094234 0.0943469 0.0957087 0.0957009 0.0944022 0.0945242 0.0958573 0.0958155 0.0945777 0.094707 0.0959679 0.0959823 0.0947861 0.0921261 0.0919673 0.0918098 0.0916712 0.0915288 0.0913995 0.091269 0.0922988 0.094929 0.0961519 0.0961409 0.0950112 0.0951653 0.0963105 0.0963564 0.0952789 0.0954536 0.0965485 0.0965819 0.0955785 0.0957704 0.0967797 0.09687 0.0959355 0.0938036 0.0935476 0.0933039 0.0930808 0.092866 0.092667 0.0924733 0.0940836 0.0961618 0.0970969 0.0971979 0.0963599 0.0966276 0.097447 0.0976174 0.096894 0.0972094 0.0978875 0.0980408 0.0974804 0.0977492 0.0982683 0.0984465 0.0983724 0.0979334 0.0965843 0.0963087 0.0959448 0.0955385 0.095113 0.0947254 0.0943846 0.0967833 0.0980843 0.0985259 0.0986359 0.0984855 0.0979756 0.0974244 0.097123 0.0966777 0.0960916 0.0968114 0.097363 0.097757 0.0983555 0.0979819 0.0974181 0.0966939 0.0961181 0.0953687 0.0945093 0.0935081 0.0923344 0.0932107 0.0943267 0.0952926 0.095825 0.0948055 0.0936126 0.09391 0.0945201 0.0951752 0.0956685 0.0961929 0.0966099 0.0970746 0.0974168 0.0977998 0.0980399 0.0983084 0.0984647 0.0986448 0.0986563 0.0986208 0.0985484 0.0981551 0.0982077 0.0982064 0.0985778 0.0986017 0.098494 0.0981113 0.0981919 0.0970176 0.0970149 0.0969769 0.0969033 0.0969633 0.0968721 0.0980279 0.0984486 0.0983039 0.097916 0.0967804 0.0966907 0.0978141 0.0982442 0.0980757 0.0976618 0.0975711 0.0979987 0.0978929 0.0975914 0.097709 0.0978458 0.0976198 0.097426 0.0975899 0.0972628 0.0972662 0.0965173 0.0964158 0.0965373 0.0944465 0.09588 0.0960001 0.0957757 0.0970959 0.0967731 0.09547 0.0953326 0.096676 0.0969715 0.0965148 0.0960718 0.0956034 0.095236 0.095371 0.0957289 0.095859 0.0962163 0.0963228 0.0951085 0.0949569 0.0947191 0.0945516 0.0943058 0.0941381 0.0940817 0.0950553 0.0950501 0.0951348 0.0944916 0.0938337 0.0931052 0.0931578 0.0924809 0.0922538 0.0918798 0.0909264 0.0897601 0.0886145 0.087348 0.086132 0.0850086 0.0840201 0.0833221 0.0830356 0.0830827 0.0834167 0.0840238 0.084837 0.0857939 0.0868447 0.0879518 0.0890867 0.0902285 0.0905822 0.0893945 0.0882036 0.0870229 0.0858835 0.0848317 0.0839327 0.0832719 0.0829441 0.0829743 0.0834141 0.084328 0.0855573 0.086905 0.0883187 0.0893194 0.0876323 0.0859485 0.0861161 0.0882715 0.0902251 0.0906184 0.0885016 0.0857718 0.0828286 0.0840129 0.0843852 0.0832382 0.0826641 0.0825738 0.0816289 0.0817138 0.0824761 0.0806206 0.0796182 0.0796954 0.0766084 0.0760617 0.0773101 0.0807943 0.0849154 0.0880741 0.0904768 0.0915486 0.0914809 0.092381 0.0925081 0.0928101 0.0931572 0.0934669 0.0938562 0.0941441 0.0944995 0.0947452 0.0943572 0.0945404 0.0934229 0.0923816 0.0934091 0.0932426 0.0941238 0.0938343 0.0930264 0.0927735 0.0935417 0.0931942 0.0928784 0.0926013 0.0919346 0.0921735 0.0924862 0.0905115 0.0911329 0.09208 0.0923909 0.0919821 0.0920461 0.0915156 0.0912799 0.0917463 0.0908798 0.0903596 0.0898007 0.0906285 0.0901678 0.0904553 0.0892249 0.089164 0.0895886 0.0888228 0.089328 0.088697 0.0881136 0.088495 0.087851 0.0880223 0.0864909 0.0863676 0.0870556 0.0867109 0.0874455 0.086851 0.0874711 0.0878691 0.0874608 0.0861894 0.0854755 0.0860438 0.0852532 0.0854937 0.0843282 0.0850321 0.0830085 0.0821353 0.0817154 0.0827575 0.08395 0.0849066 0.0840673 0.0841863 0.0831377 0.0820276 0.0809308 0.079864 0.0805027 0.0792556 0.0798273 0.0807657 0.0775916 0.0769529 0.0736424 0.0748503 0.0721124 0.0697837 0.0702736 0.066186 0.0712731 0.0743289 0.076425 0.0778046 0.0770513 0.0785383 0.0776612 0.0790302 0.0796161 0.0759894 0.074097 0.0755718 0.0735761 0.0719134 0.0698056 0.0719434 0.0670298 0.0693237 0.0663186 0.0638945 0.0605515 0.0634202 0.0606547 0.0575991 0.0526125 0.0564688 0.0606816 0.0639661 0.0505118 0.0453028 0.0336119 0.0329811 0.0443711 0.0510568 0.0561581 0.0591774 0.0638267 0.0649937 0.05889 0.0589481 0.0562879 0.0516165 0.0469987 0.0508911 0.0533315 0.0566482 0.0596323 0.0550088 0.053676 0.0480658 0.0412396 0.0372527 0.023453 0.0343789 0.0433026 0.054257 0.0514146 0.0674001 0.0660579 0.0756921 0.0799987 0.0866316 0.0902097 0.0937249 0.0953966 0.0973434 0.0984745 0.0987404 0.100084 0.100065 0.101413 0.101503 0.100851 0.102045 0.101848 0.100997 0.102288 0.101935 0.100809 0.102281 0.101826 0.100608 0.102241 0.10178 0.100481 0.102146 0.101637 0.100381 0.102105 0.101567 0.100269 0.102106 0.101688 0.101008 0.0994686 0.101529 0.101012 0.0995649 0.101597 0.100939 0.0994091 0.101652 0.101108 0.0995643 0.101762 0.101163 0.0997226 0.102017 0.10141 0.0998353 0.102126 0.101538 0.100087 0.102478 0.101879 0.100166 0.102488 0.101259 0.103698 0.103169 0.101745 0.103967 0.103392 0.102092 0.104407 0.104007 0.102656 0.104794 0.104221 0.102817 0.105221 0.104821 0.103415 0.105532 0.104251 0.10636 0.10589 0.104698 0.106947 0.106596 0.1052 0.107426 0.106139 0.108322 0.10794 0.106789 0.108973 0.108597 0.107209 0.109211 0.10791 0.110111 0.109832 0.108757 0.110902 0.11059 0.10922 0.111415 0.110168 0.112349 0.111989 0.110759 0.112992 0.112072 0.114022 0.113571 0.112128 0.114358 0.113406 0.115546 0.115232 0.114015 0.116076 0.115115 0.116973 0.116493 0.115033 0.117399 0.116573 0.118666 0.118398 0.117144 0.119191 0.118131 0.119904 0.118751 0.12092 0.120708 0.119649 0.121723 0.120909 0.122799 0.122488 0.1212 0.123074 0.121868 0.124019 0.123253 0.125308 0.125132 0.124032 0.126086 0.12509 0.126934 0.125963 0.127761 0.127397 0.126258 0.128368 0.127573 0.12962 0.128861 0.130727 0.130501 0.129326 0.13126 0.130163 0.13204 0.131233 0.133157 0.133027 0.13197 0.133892 0.133023 0.134953 0.134105 0.135902 0.135568 0.134233 0.136479 0.135663 0.137716 0.136957 0.138826 0.138089 0.139876 0.139648 0.138528 0.14042 0.139442 0.141233 0.14037 0.142393 0.141755 0.143667 0.143573 0.14255 0.144582 0.143721 0.145535 0.14466 0.14644 0.145578 0.147419 0.147254 0.146235 0.148287 0.147528 0.149381 0.148579 0.150428 0.149697 0.151524 0.151364 0.150236 0.152311 0.151424 0.153471 0.15273 0.154674 0.153906 0.1557 0.154998 0.156825 0.156728 0.155673 0.157589 0.156682 0.158714 0.157845 0.159824 0.15909 0.161102 0.160498 0.162404 0.162346 0.161338 0.163435 0.16267 0.164591 0.163806 0.165677 0.164853 0.166714 0.166068 0.167936 0.167906 0.166916 0.168899 0.168182 0.170266 0.169496 0.171375 0.170591 0.172525 0.171911 0.173836 0.173837 0.172846 0.175082 0.17438 0.176413 0.175679 0.177678 0.176963 0.178844 0.178225 0.180159 0.180161 0.179179 0.181271 0.180548 0.182737 0.182 0.184015 0.183297 0.185373 0.184715 0.186689 0.186159 0.188258 0.188383 0.187483 0.189608 0.188989 0.191119 0.190466 0.192424 0.1918 0.193761 0.193235 0.195171 0.19525 0.194366 0.196451 0.195764 0.197826 0.197226 0.199394 0.198878 0.20091 0.200514 0.202653 0.202794 0.201915 0.204092 0.203432 0.205642 0.20502 0.207144 0.206612 0.208778 0.208393 0.210554 0.210849 0.210125 0.212333 0.211776 0.213794 0.213155 0.215367 0.214802 0.21694 0.216519 0.218819 0.21916 0.218369 0.220712 0.220269 0.222728 0.222393 0.224584 0.224149 0.226106 0.226258 0.225366 0.227611 0.227014 0.229491 0.22896 0.231264 0.230883 0.233435 0.233955 0.233317 0.235892 0.235669 0.238165 0.237605 0.23969 0.239132 0.241416 0.24166 0.240861 0.243394 0.242851 0.245682 0.24533 0.247958 0.247766 0.250552 0.251385 0.251009 0.253326 0.252624 0.255005 0.25439 0.256809 0.256346 0.258836 0.2593 0.258596 0.261315 0.261098 0.264151 0.264189 0.266986 0.268021 0.267437 0.269855 0.269107 0.271641 0.271182 0.274014 0.273768 0.276562 0.277266 0.276691 0.279667 0.279691 0.282815 0.283244 0.286294 0.287097 0.286097 0.288619 0.28808 0.290984 0.290778 0.293618 0.294456 0.293923 0.297017 0.297235 0.300754 0.302457 0.302689 0.305673 0.305306 0.307678 0.307107 0.310012 0.310749 0.310135 0.313518 0.313592 0.317523 0.319001 0.318809 0.322514 0.323447 0.326654 0.327616 0.326339 0.329284 0.328818 0.332639 0.333897 0.333438 0.337312 0.337598 0.34193 0.344172 0.344787 0.34868 0.349096 0.352075 0.3526 0.351448 0.355021 0.354832 0.358866 0.360724 0.360873 0.365482 0.367023 0.371854 0.37479 0.374746 0.377419 0.378086 0.377105 0.381348 0.381673 0.386458 0.389019 0.389748 0.39461 0.398404 0.400247 0.403362 0.404745 0.403244 0.407435 0.407507 0.412436 0.415378 0.416596 0.421858 0.426633 0.429155 0.432142 0.433677 0.432403 0.436677 0.439067 0.440019 0.446366 0.451328 0.4552 0.459077 0.462552 0.462983 0.461477 0.466994 0.470283 0.472559 0.479312 0.486643 0.491405 0.490814 0.493619 0.495304 0.497705 0.499891 0.507198 0.515284 0.519191 0.51713 0.520382 0.522667 0.527226 0.535327 0.538458 0.538535 0.540536 0.540976 0.544447 0.548667 0.548749 0.542358 0.542945 0.540611 0.537518 0.532265 0.524368 0.514979 0.50557 0.496816 0.489294 0.482942 0.477399 0.472436 0.467881 0.463691 0.459771 0.456124 0.452688 0.449492 0.446466 0.443646 0.440947 0.438421 0.435983 0.433696 0.431476 0.42939 0.427349 0.425427 0.423535 0.421749 0.419977 0.418301 0.416628 0.415041 0.413447 0.411935 0.410412 0.408969 0.407511 0.406127 0.404722 0.403389 0.402034 0.400748 0.399439 0.398198 0.396937 0.395739 0.394517 0.393358 0.392177 0.391056 0.389913 0.38883 0.387729 0.386684 0.385619 0.384608 0.383585 0.382609 0.38162 0.380677 0.379729 0.378824 0.377909 0.377039 0.376161 0.375332 0.374485 0.373692 0.372882 0.372131 0.371353 0.370641 0.369901 0.369232 0.368523 0.36789 0.367217 0.366626 0.365983 0.365426 0.364818 0.364301 0.36372 0.363235 0.362687 0.36224 0.361719 0.3613 0.360807 0.36042 0.359958 0.3596 0.359158 0.358828 0.358414 0.358111 0.357718 0.357441 0.357071 0.356819 0.356467 0.356238 0.355908 0.3557 0.355388 0.355201 0.354908 0.354741 0.354463 0.354315 0.354054 0.353923 0.353676 0.353561 0.35333 0.35323 0.353011 0.352926 0.352721 0.35265 0.352456 0.352397 0.352216 0.352169 0.351998 0.351962 0.351801 0.351775 0.351623 0.351606 0.351464 0.351456 0.351321 0.351322 0.351194 0.351202 0.351082 0.351098 0.350985 0.351007 0.3509 0.35093 0.35083 0.350865 0.350771 0.350812 0.350724 0.35077 0.350687 0.350738 0.35066 0.350716 0.350642 0.350703 0.350634 0.350698 0.350633 0.350701 0.35064 0.35071 0.350653 0.350727 0.350673 0.35075 0.350699 0.350779 0.350732 0.350814 0.35077 0.350856 0.350815 0.350903 0.350866 0.350958 0.350924 0.351018 0.350988 0.351086 0.351059 0.35116 0.351136 0.35124 0.351219 0.351325 0.351307 0.351416 0.3514 0.351509 0.351494 0.351605 0.351591 0.351709 0.351696 0.351806 0.351795 0.351906 0.351895 0.352013 0.351998 0.352136 0.352124 0.352244 0.352196 0.352059 0.351872 0.352762 0.354583 0.392307 0.41407 0.413814 0.391505 0.390381 0.412107 0.419325 0.419222 0.41945 0.431082 0.434139 0.434309 0.434637 0.430879 0.417632 0.412652 0.390884 0.390587 0.411233 0.412111 0.391113 0.390686 0.411017 0.41594 0.429402 0.429673 0.415453 0.411821 0.391068 0.390664 0.410818 0.411641 0.39106 0.390703 0.410865 0.414763 0.428821 0.4324 0.431458 0.429111 0.415033 0.411723 0.39111 0.390767 0.410887 0.411748 0.391181 0.390847 0.411012 0.414803 0.428497 0.428951 0.41509 0.411883 0.391276 0.390944 0.411091 0.411959 0.391372 0.391049 0.411237 0.41498 0.428437 0.431098 0.44063 0.440858 0.441276 0.441928 0.446041 0.445786 0.445626 0.445531 0.445492 0.440545 0.43096 0.428924 0.415264 0.412103 0.391477 0.391155 0.411324 0.412189 0.391589 0.391271 0.411471 0.415184 0.428448 0.428936 0.415466 0.412335 0.391707 0.391386 0.411563 0.412431 0.391828 0.391515 0.411719 0.415397 0.428476 0.43092 0.430915 0.428969 0.415681 0.412584 0.391959 0.391646 0.411821 0.41269 0.392097 0.391793 0.411989 0.415624 0.428529 0.429025 0.415915 0.412853 0.392247 0.391944 0.412099 0.412967 0.392404 0.39211 0.412274 0.415869 0.4286 0.430952 0.440461 0.440482 0.440507 0.44548 0.445473 0.445464 0.448641 0.448644 0.448644 0.448644 0.448656 0.448689 0.44875 0.448876 0.450874 0.450806 0.450775 0.45076 0.452187 0.452203 0.452232 0.452287 0.453264 0.453215 0.453184 0.45316 0.453139 0.452177 0.450755 0.450754 0.450751 0.450744 0.45214 0.452154 0.452167 0.453119 0.453097 0.453075 0.453717 0.453747 0.453776 0.453804 0.453833 0.453864 0.453899 0.453943 0.454422 0.454382 0.454347 0.454312 0.454662 0.454698 0.454732 0.454768 0.455025 0.454992 0.454961 0.454926 0.45489 0.454626 0.454278 0.454245 0.454211 0.454176 0.454516 0.454554 0.45459 0.454854 0.454816 0.454777 0.454735 0.454476 0.454139 0.453686 0.453051 0.452126 0.450737 0.448636 0.445454 0.440448 0.431003 0.429096 0.416163 0.413136 0.392573 0.392278 0.412393 0.413259 0.392747 0.392461 0.412575 0.416125 0.428683 0.429177 0.416422 0.413434 0.392932 0.392645 0.4127 0.413562 0.393122 0.392845 0.412887 0.41639 0.428773 0.431065 0.43113 0.429263 0.416686 0.413741 0.393323 0.393045 0.413016 0.413872 0.39353 0.39326 0.413205 0.416659 0.428865 0.42935 0.416954 0.414053 0.393747 0.393476 0.413337 0.414187 0.393971 0.393707 0.41353 0.416931 0.428957 0.431197 0.440466 0.440453 0.440445 0.445448 0.445451 0.445462 0.445478 0.440481 0.431264 0.429437 0.417225 0.41437 0.394204 0.393938 0.413665 0.414507 0.394442 0.394183 0.41386 0.417205 0.42905 0.429525 0.417497 0.414692 0.394691 0.39443 0.413998 0.414831 0.394947 0.394695 0.414195 0.417481 0.429145 0.431331 0.431403 0.429617 0.417771 0.415018 0.395213 0.394961 0.414335 0.415159 0.395485 0.395243 0.414535 0.417759 0.429245 0.429715 0.418048 0.415348 0.395767 0.395526 0.414678 0.415493 0.396056 0.395825 0.414881 0.41804 0.429351 0.431481 0.440552 0.440522 0.440499 0.445497 0.445522 0.445554 0.445596 0.44059 0.431566 0.429818 0.418327 0.415684 0.396355 0.396126 0.415027 0.415831 0.396661 0.396443 0.415233 0.418323 0.429463 0.429928 0.41861 0.416023 0.396979 0.396763 0.41538 0.416173 0.397303 0.397097 0.415589 0.418609 0.429582 0.431659 0.43176 0.430046 0.418895 0.416367 0.397637 0.397432 0.415739 0.416519 0.397976 0.397782 0.41595 0.418898 0.429709 0.430172 0.419182 0.416715 0.398325 0.398133 0.416102 0.416869 0.398682 0.3985 0.416315 0.419188 0.429844 0.43187 0.44076 0.440693 0.440636 0.445646 0.445707 0.44578 0.445864 0.440838 0.43199 0.430307 0.419471 0.417065 0.399048 0.398869 0.416469 0.417222 0.39942 0.399252 0.416685 0.419481 0.429987 0.43045 0.419763 0.417421 0.399802 0.399636 0.416842 0.417581 0.40019 0.400035 0.417061 0.419777 0.43014 0.432122 0.432268 0.430606 0.42006 0.417783 0.400588 0.400435 0.417222 0.417948 0.400992 0.40085 0.417447 0.42008 0.430308 0.430779 0.420364 0.418153 0.401406 0.401266 0.417612 0.418323 0.401828 0.401699 0.417841 0.420389 0.430493 0.432431 0.441162 0.441037 0.44093 0.445962 0.446076 0.446208 0.44938 0.449252 0.44914 0.449044 0.44896 0.448888 0.448827 0.448777 0.448735 0.448703 0.448677 0.448657 0.448641 0.448631 0.448631 0.450731 0.450726 0.450727 0.45209 0.4521 0.452112 0.453028 0.453006 0.452987 0.45297 0.452085 0.450735 0.450751 0.450771 0.450797 0.452108 0.452094 0.452086 0.452956 0.452947 0.452944 0.453504 0.453522 0.453543 0.453568 0.453595 0.453625 0.453655 0.454103 0.454066 0.454029 0.454354 0.454395 0.454436 0.454693 0.454649 0.454605 0.454561 0.454313 0.453994 0.453961 0.45393 0.453901 0.454199 0.454235 0.454274 0.454518 0.454475 0.454434 0.454395 0.454165 0.453875 0.45349 0.452947 0.452127 0.450831 0.450874 0.450926 0.450989 0.452234 0.452189 0.452154 0.452956 0.45297 0.452993 0.453024 0.452289 0.451063 0.45115 0.45125 0.451366 0.452526 0.452434 0.452355 0.453064 0.453114 0.453176 0.453557 0.453525 0.453502 0.453487 0.45348 0.453478 0.453481 0.453853 0.453834 0.45382 0.454078 0.454104 0.454133 0.454357 0.45432 0.454285 0.454252 0.454054 0.453809 0.453804 0.453804 0.45381 0.454003 0.454016 0.454033 0.45422 0.45419 0.454162 0.4543 0.454339 0.454379 0.454419 0.454459 0.454499 0.454541 0.454583 0.454626 0.454671 0.454716 0.454762 0.454807 0.454853 0.454898 0.454941 0.454983 0.455022 0.45506 0.455095 0.455129 0.455162 0.45519 0.45522 0.455372 0.455346 0.455321 0.45529 0.45542 0.455447 0.45547 0.455492 0.45559 0.45557 0.455551 0.455527 0.4555 0.455391 0.455258 0.455224 0.455188 0.455149 0.455287 0.455324 0.455359 0.45547 0.455438 0.455402 0.4555 0.455534 0.455564 0.455591 0.455615 0.455636 0.455653 0.455669 0.455735 0.455722 0.455707 0.455689 0.455751 0.455767 0.455779 0.45579 0.455835 0.455826 0.455816 0.455802 0.455786 0.455732 0.455667 0.455643 0.455615 0.455583 0.455655 0.455684 0.45571 0.455766 0.455742 0.455715 0.455764 0.45579 0.455812 0.455829 0.455844 0.455856 0.455864 0.455871 0.455898 0.455892 0.455886 0.455875 0.455896 0.455906 0.455911 0.455916 0.455926 0.455922 0.455917 0.455909 0.455898 0.455885 0.455863 0.455846 0.455826 0.455802 0.455827 0.455851 0.45587 0.455884 0.455865 0.455842 0.455814 0.455799 0.455772 0.455734 0.455683 0.455621 0.455548 0.455463 0.455364 0.455247 0.455108 0.455065 0.45502 0.454974 0.455114 0.45516 0.455204 0.455322 0.455279 0.455233 0.455186 0.455067 0.454927 0.45488 0.454833 0.454787 0.454925 0.454972 0.455019 0.455139 0.455092 0.455045 0.455149 0.455196 0.455243 0.45529 0.455336 0.45538 0.455423 0.45551 0.455468 0.455425 0.455501 0.455544 0.455584 0.455647 0.455608 0.455567 0.455525 0.455458 0.45538 0.455334 0.455288 0.455242 0.455325 0.455369 0.455413 0.455483 0.455441 0.455397 0.455342 0.455278 0.455195 0.455102 0.454997 0.454878 0.454742 0.454697 0.454652 0.454607 0.454736 0.454784 0.454831 0.454949 0.4549 0.45485 0.454799 0.454687 0.454562 0.454516 0.45447 0.454423 0.454533 0.454587 0.454637 0.454746 0.454684 0.454602 0.454596 0.454724 0.454822 0.454895 0.454953 0.455004 0.455053 0.455147 0.455095 0.455032 0.455065 0.455157 0.455225 0.455271 0.455176 0.455057 0.454917 0.454948 0.454949 0.454838 0.454699 0.454538 0.45447 0.454645 0.454806 0.454762 0.454594 0.454412 0.454364 0.454553 0.454725 0.454885 0.455032 0.455166 0.455282 0.455376 0.455448 0.455501 0.455543 0.455583 0.455622 0.455662 0.455699 0.455739 0.455703 0.455665 0.455696 0.455731 0.455766 0.455782 0.455748 0.455714 0.45568 0.455661 0.455629 0.45559 0.45554 0.455473 0.45548 0.45556 0.455619 0.455633 0.455567 0.455479 0.455376 0.45538 0.455384 0.455275 0.45515 0.455012 0.454999 0.455138 0.455265 0.455259 0.455132 0.454993 0.45484 0.454848 0.454862 0.4547 0.454522 0.454325 0.454298 0.4545 0.454682 0.454672 0.454486 0.454281 0.454053 0.454073 0.454108 0.454155 0.454213 0.45428 0.454359 0.45444 0.454491 0.454469 0.454378 0.454261 0.454136 0.453994 0.453824 0.453599 0.453251 0.452633 0.451498 0.449526 0.446359 0.441308 0.432616 0.43097 0.420676 0.418533 0.402259 0.402133 0.418012 0.418709 0.402698 0.402582 0.418249 0.420709 0.430698 0.431183 0.421 0.418925 0.403146 0.403034 0.418426 0.419109 0.403602 0.403502 0.418669 0.421042 0.430926 0.432825 0.433063 0.431422 0.421338 0.41933 0.404067 0.403969 0.418852 0.419521 0.404539 0.404453 0.419105 0.42139 0.431181 0.431691 0.421694 0.419752 0.405019 0.404937 0.419297 0.419954 0.405508 0.405437 0.419562 0.421759 0.431469 0.433335 0.441904 0.441674 0.441477 0.446534 0.446734 0.446966 0.447232 0.442171 0.433646 0.431996 0.422073 0.420194 0.406005 0.405938 0.419767 0.420415 0.406511 0.406454 0.420047 0.422155 0.431797 0.432344 0.422485 0.420663 0.407021 0.406973 0.420265 0.420911 0.407552 0.407511 0.420572 0.422589 0.432171 0.434003 0.434416 0.432743 0.422937 0.421172 0.408077 0.408046 0.420803 0.421445 0.408625 0.408603 0.421136 0.423067 0.432598 0.4332 0.423439 0.421731 0.40917 0.409156 0.421394 0.422032 0.409738 0.409734 0.421757 0.4236 0.433091 0.434894 0.44327 0.442846 0.442482 0.447539 0.447894 0.448304 0.448779 0.443765 0.43545 0.433732 0.424008 0.422351 0.410305 0.410312 0.422049 0.422687 0.410898 0.410916 0.422449 0.424208 0.433662 0.434348 0.424656 0.423047 0.411493 0.411523 0.422784 0.423426 0.412117 0.41216 0.423228 0.424903 0.434323 0.436098 0.436853 0.435062 0.4254 0.423834 0.412747 0.412804 0.423614 0.424266 0.41341 0.413482 0.424112 0.425705 0.435092 0.435894 0.426262 0.424732 0.414085 0.414175 0.42456 0.425229 0.414799 0.414907 0.425126 0.426637 0.435985 0.437733 0.445809 0.445019 0.444343 0.449328 0.449963 0.450698 0.451548 0.446733 0.438762 0.436863 0.427268 0.425767 0.415528 0.415661 0.42565 0.426343 0.416307 0.416468 0.426301 0.427729 0.437027 0.437994 0.428452 0.426981 0.417115 0.417303 0.426921 0.427645 0.417975 0.418196 0.427673 0.429019 0.438241 0.439966 0.44138 0.439313 0.429851 0.428399 0.418879 0.41913 0.428411 0.429182 0.419841 0.420133 0.429287 0.430546 0.439656 0.440852 0.43151 0.430071 0.420863 0.421192 0.430167 0.431 0.421957 0.422334 0.431196 0.432362 0.441306 0.443042 0.45056 0.449078 0.447813 0.45253 0.453665 0.454978 0.45725 0.456113 0.45512 0.454254 0.453499 0.452842 0.45227 0.451773 0.451341 0.450965 0.450637 0.450352 0.450102 0.449884 0.449693 0.451648 0.45182 0.452015 0.453059 0.452897 0.452756 0.45334 0.453444 0.453566 0.453709 0.453245 0.452238 0.452492 0.452782 0.453113 0.453981 0.453702 0.453458 0.453876 0.454069 0.454291 0.454325 0.454156 0.454014 0.453895 0.453798 0.453718 0.453652 0.453846 0.453877 0.453916 0.453998 0.453991 0.45399 0.454112 0.454092 0.454079 0.454068 0.454019 0.453969 0.454044 0.454142 0.454251 0.454136 0.454095 0.454052 0.454053 0.454025 0.45398 0.453915 0.454167 0.454376 0.454522 0.454546 0.4543 0.453493 0.453927 0.454424 0.454992 0.455546 0.455077 0.454664 0.454837 0.455173 0.455551 0.455964 0.456077 0.455638 0.45637 0.4572 0.458139 0.458092 0.457352 0.456679 0.45642 0.45692 0.457448 0.456385 0.456114 0.45583 0.455541 0.455254 0.454984 0.45474 0.454513 0.454646 0.454772 0.454186 0.454195 0.454189 0.453829 0.453723 0.453595 0.453442 0.454159 0.454891 0.454999 0.455088 0.455158 0.453935 0.454038 0.454111 0.45326 0.453041 0.452778 0.452463 0.453804 0.455221 0.456644 0.457974 0.458898 0.459199 0.45855 0.456498 0.452302 0.445001 0.442656 0.433489 0.432056 0.423129 0.423555 0.432255 0.433167 0.424395 0.424881 0.433474 0.434535 0.443243 0.444778 0.435864 0.434431 0.425765 0.426313 0.434754 0.435769 0.427251 0.427872 0.436211 0.437152 0.445526 0.447318 0.450064 0.447282 0.438732 0.43729 0.42887 0.429572 0.437766 0.438913 0.430641 0.431438 0.439524 0.440324 0.448229 0.45026 0.442222 0.440757 0.432589 0.433488 0.441424 0.442739 0.434728 0.435747 0.44356 0.444202 0.451462 0.453309 0.459541 0.456766 0.454356 0.458258 0.460263 0.462471 0.464887 0.462649 0.457126 0.453846 0.446513 0.444992 0.4371 0.438256 0.445906 0.447443 0.439734 0.441057 0.448545 0.449014 0.455425 0.458313 0.451902 0.450251 0.442701 0.444217 0.451499 0.453351 0.446046 0.447793 0.45482 0.455121 0.46048 0.461661 0.467341 0.46399 0.45879 0.456892 0.449852 0.451873 0.458573 0.460887 0.454213 0.456571 0.462865 0.462962 0.466947 0.471206 0.467739 0.465475 0.459258 0.462044 0.467808 0.470815 0.465184 0.468483 0.47359 0.47335 0.475513 0.475125 0.478746 0.471136 0.466235 0.4679 0.472471 0.478293 0.482989 0.486887 0.485902 0.481518 0.479727 0.476984 0.472116 0.475994 0.480187 0.484054 0.480293 0.484986 0.487894 0.487054 0.487539 0.494609 0.495598 0.49249 0.490339 0.496379 0.49756 0.503501 0.503229 0.510814 0.509975 0.506127 0.502856 0.496648 0.503154 0.508842 0.516027 0.516385 0.518545 0.525838 0.52304 0.527459 0.531542 0.535416 0.531096 0.52231 0.512657 0.515874 0.524847 0.533855 0.538115 0.539837 0.53568 0.536964 0.541312 0.547026 0.546644 0.540909 0.538298 0.537256 0.524499 0.516314 0.505497 0.495662 0.494916 0.492227 0.485451 0.486593 0.486262 0.483525 0.493467 0.503367 0.515819 0.522792 0.519506 0.533201 0.540478 0.540982 0.543895 0.537093 0.53367 0.53479 0.528008 0.526872 0.526964 0.511607 0.517116 0.523282 0.523676 0.520418 0.518738 0.515698 0.517308 0.519993 0.515632 0.510022 0.505465 0.503189 0.501795 0.498087 0.495184 0.494897 0.495546 0.499343 0.487074 0.491616 0.492265 0.492449 0.487683 0.486994 0.481297 0.485587 0.482004 0.476229 0.474629 0.47077 0.467419 0.466153 0.463932 0.463542 0.460125 0.456247 0.454656 0.450022 0.451376 0.454454 0.453936 0.459349 0.463347 0.471069 0.472269 0.467171 0.469093 0.479018 0.476824 0.470331 0.466295 0.483881 0.493952 0.501052 0.497188 0.510991 0.509174 0.511804 0.488537 0.497683 0.487792 0.478169 0.4708 0.479724 0.469897 0.477598 0.46553 0.452759 0.457166 0.443098 0.443645 0.447079 0.447118 0.447618 0.446519 0.443572 0.440268 0.437605 0.436025 0.433845 0.434429 0.438761 0.442478 0.44279 0.430639 0.431331 0.43093 0.429295 0.425006 0.421377 0.419046 0.416039 0.418024 0.423331 0.426812 0.426888 0.423814 0.431098 0.439196 0.43794 0.431475 0.418307 0.416795 0.417431 0.416342 0.415232 0.413804 0.410936 0.409106 0.407369 0.405558 0.402834 0.400969 0.397446 0.399917 0.394682 0.392613 0.390151 0.388112 0.385067 0.383413 0.381121 0.380051 0.38175 0.386369 0.389168 0.393785 0.391996 0.395349 0.402971 0.401562 0.4082 0.406449 0.403049 0.411058 0.411644 0.409731 0.409479 0.390572 0.390095 0.388844 0.383127 0.380699 0.379776 0.378674 0.376654 0.374119 0.37152 0.369652 0.367463 0.364055 0.361771 0.365802 0.360607 0.358325 0.357518 0.355075 0.354122 0.352828 0.351514 0.349825 0.347163 0.344807 0.348301 0.350703 0.355136 0.356187 0.35714 0.360735 0.359076 0.364362 0.368776 0.374157 0.368625 0.376228 0.376915 0.375577 0.378117 0.369615 0.383535 0.38086 0.382596 0.393428 0.405477 0.406382 0.394554 0.383462 0.383335 0.394176 0.405481 0.417275 0.430068 0.427346 0.439893 0.435473 0.447244 0.458887 0.451911 0.46188 0.454069 0.462196 0.469035 0.474248 0.477539 0.478851 0.478767 0.477846 0.475784 0.472061 0.468109 0.465385 0.46341 0.461653 0.460024 0.460365 0.461598 0.462944 0.461676 0.460638 0.459751 0.458496 0.459089 0.459924 0.460823 0.463177 0.464652 0.467132 0.469718 0.471321 0.466301 0.465853 0.464798 0.461403 0.461638 0.461575 0.457211 0.457771 0.457949 0.457895 0.457701 0.457329 0.456935 0.455281 0.455324 0.45531 0.453078 0.453406 0.453636 0.452083 0.451611 0.45101 0.450235 0.452595 0.455156 0.454803 0.454185 0.453208 0.449599 0.450918 0.451895 0.449238 0.447965 0.446363 0.444375 0.447868 0.451792 0.456189 0.461064 0.466348 0.47201 0.472139 0.471413 0.46933 0.461803 0.464364 0.465814 0.459915 0.457972 0.455111 0.451275 0.458041 0.465719 0.460631 0.454243 0.446805 0.440256 0.447117 0.453105 0.446486 0.440828 0.434431 0.429275 0.4353 0.440694 0.44536 0.449236 0.4523 0.45459 0.449851 0.447303 0.444093 0.439593 0.442914 0.445659 0.441951 0.439049 0.435642 0.431723 0.435683 0.440196 0.435632 0.430449 0.424721 0.420693 0.426185 0.431201 0.427307 0.422425 0.417124 0.411459 0.414795 0.418536 0.422732 0.427446 0.432723 0.438594 0.445042 0.435464 0.441352 0.430581 0.41984 0.423827 0.412489 0.415224 0.403702 0.392763 0.382303 0.380985 0.391056 0.401533 0.399014 0.409288 0.405937 0.415735 0.425625 0.420863 0.429873 0.424716 0.420023 0.412304 0.416409 0.407946 0.411738 0.402627 0.393623 0.396326 0.386968 0.389093 0.37951 0.370332 0.371426 0.372397 0.372976 0.372776 0.371892 0.37034 0.367774 0.358174 0.354507 0.352549 0.350969 0.346612 0.343803 0.341773 0.339886 0.336846 0.33553 0.338505 0.337848 0.339901 0.334399 0.332453 0.331883 0.329571 0.328457 0.331124 0.327251 0.325494 0.324265 0.32173 0.320195 0.318949 0.316979 0.316315 0.313337 0.31237 0.316006 0.317697 0.322097 0.322774 0.323915 0.32718 0.325698 0.330932 0.324174 0.320636 0.31882 0.315613 0.31293 0.31119 0.30979 0.307674 0.306678 0.304993 0.303585 0.302523 0.299839 0.298764 0.296834 0.296084 0.297925 0.301916 0.303702 0.308005 0.305116 0.308755 0.309789 0.304886 0.302535 0.306232 0.312984 0.309699 0.316772 0.323072 0.316547 0.309541 0.306208 0.299771 0.296075 0.293699 0.292099 0.289694 0.29013 0.28819 0.288917 0.290887 0.291144 0.292992 0.293404 0.295622 0.294971 0.294663 0.292159 0.291137 0.296028 0.298789 0.297048 0.296558 0.287274 0.285668 0.284935 0.282265 0.281451 0.279593 0.278995 0.280822 0.284749 0.286231 0.286924 0.289395 0.287247 0.290528 0.284053 0.282301 0.280026 0.278647 0.276475 0.276185 0.274195 0.274038 0.271884 0.271557 0.270037 0.269295 0.268772 0.266533 0.265809 0.264076 0.263876 0.261365 0.260767 0.264096 0.265169 0.268562 0.269844 0.273389 0.270648 0.273577 0.274689 0.277729 0.27548 0.278079 0.279103 0.275059 0.278338 0.272595 0.271198 0.269612 0.266161 0.2644 0.262543 0.260388 0.259089 0.257122 0.257034 0.255396 0.255186 0.253303 0.252593 0.252027 0.250457 0.250314 0.248027 0.247729 0.245986 0.246101 0.243634 0.243246 0.246574 0.243413 0.24179 0.241836 0.240064 0.239915 0.238204 0.238017 0.235946 0.235448 0.235103 0.23357 0.233649 0.231543 0.231405 0.229874 0.230093 0.227993 0.227739 0.230593 0.227912 0.22645 0.226465 0.224705 0.2246 0.222915 0.222895 0.220981 0.220689 0.220528 0.219073 0.219281 0.217308 0.217342 0.215861 0.216124 0.214112 0.214004 0.212609 0.212441 0.213891 0.2167 0.217357 0.219814 0.220466 0.223087 0.222716 0.223862 0.226368 0.226288 0.22726 0.229582 0.227629 0.231212 0.235573 0.232399 0.23403 0.231287 0.234851 0.237958 0.237668 0.238873 0.241486 0.239381 0.241571 0.242504 0.245158 0.243036 0.243702 0.242569 0.244919 0.249715 0.246712 0.248673 0.250548 0.251549 0.25468 0.254665 0.255762 0.258644 0.258791 0.259794 0.256424 0.256545 0.258763 0.260811 0.262264 0.264603 0.259886 0.257213 0.254325 0.252832 0.251008 0.252219 0.25283 0.248542 0.245614 0.241571 0.238659 0.23482 0.231808 0.229606 0.228302 0.226809 0.22482 0.223168 0.221814 0.220517 0.218497 0.216973 0.215598 0.213628 0.212481 0.210734 0.210806 0.209153 0.209323 0.207514 0.207633 0.206078 0.206257 0.204538 0.204457 0.204424 0.202969 0.20324 0.201226 0.201264 0.199853 0.200183 0.19824 0.198291 0.196911 0.196946 0.198355 0.200849 0.20136 0.203916 0.204454 0.206626 0.206245 0.207257 0.209733 0.207427 0.209373 0.210417 0.212545 0.21058 0.2124 0.213334 0.211075 0.213769 0.209909 0.208695 0.208127 0.205363 0.204353 0.203053 0.202658 0.199871 0.198283 0.197153 0.195515 0.19572 0.194255 0.19453 0.192892 0.193084 0.191564 0.191783 0.190061 0.189988 0.190027 0.188664 0.189027 0.187189 0.187396 0.185996 0.186467 0.184568 0.184757 0.18335 0.183807 0.18181 0.181759 0.184539 0.184965 0.187225 0.187642 0.189702 0.190156 0.192359 0.191829 0.192897 0.19497 0.194636 0.195575 0.197679 0.19564 0.197258 0.198206 0.199071 0.197866 0.196707 0.195654 0.193889 0.192683 0.191497 0.190596 0.188797 0.187707 0.186477 0.185719 0.183907 0.182229 0.18106 0.179403 0.179708 0.178257 0.178591 0.176928 0.177203 0.175668 0.175783 0.176187 0.174288 0.174527 0.173215 0.173729 0.171989 0.172218 0.170875 0.171359 0.169466 0.16947 0.172143 0.169918 0.168511 0.168964 0.167384 0.167795 0.166367 0.166783 0.16517 0.165486 0.164072 0.16423 0.164634 0.162884 0.163153 0.16178 0.162363 0.16052 0.160882 0.159532 0.160145 0.158278 0.158367 0.160998 0.161257 0.163232 0.163506 0.165335 0.16567 0.16757 0.165472 0.167051 0.167985 0.169735 0.169246 0.170172 0.171869 0.170059 0.173134 0.176225 0.173695 0.174467 0.172461 0.174805 0.176946 0.177313 0.179184 0.177133 0.178783 0.179692 0.181767 0.179686 0.18128 0.182261 0.181034 0.180719 0.182137 0.185278 0.182967 0.186792 0.190042 0.191649 0.194973 0.196677 0.199836 0.197384 0.194733 0.192425 0.189902 0.187626 0.18523 0.183005 0.180698 0.178512 0.176266 0.17403 0.172276 0.17128 0.170506 0.168945 0.168035 0.166962 0.166318 0.164703 0.16391 0.162769 0.162275 0.160664 0.15905 0.157943 0.156359 0.156761 0.155324 0.155784 0.154153 0.154597 0.153107 0.153402 0.153927 0.152117 0.152443 0.151168 0.151734 0.149982 0.150241 0.1489 0.149177 0.150536 0.152606 0.152804 0.154747 0.154998 0.156663 0.154697 0.156124 0.157021 0.158843 0.156869 0.158264 0.159204 0.158357 0.158243 0.159391 0.162047 0.159979 0.163272 0.165987 0.167289 0.170052 0.171434 0.168062 0.166085 0.1641 0.16221 0.160265 0.15844 0.156519 0.154519 0.152237 0.150728 0.149658 0.148121 0.148627 0.147253 0.147784 0.146263 0.14668 0.145283 0.145515 0.145998 0.144205 0.144551 0.143167 0.143872 0.142082 0.142509 0.141214 0.141572 0.142898 0.144854 0.14501 0.146816 0.147051 0.148717 0.148146 0.149028 0.150668 0.148823 0.150029 0.150919 0.151865 0.151186 0.150196 0.149674 0.148213 0.147569 0.14649 0.146132 0.14465 0.143111 0.142062 0.140516 0.140956 0.139538 0.140037 0.138404 0.138923 0.137391 0.137805 0.138437 0.136649 0.137054 0.135782 0.136426 0.134605 0.134744 0.137329 0.13533 0.133908 0.134536 0.132963 0.133551 0.132173 0.13255 0.133145 0.131421 0.131816 0.130433 0.131145 0.129133 0.129404 0.132187 0.130139 0.128727 0.129405 0.127841 0.128414 0.12694 0.127303 0.127944 0.126013 0.126517 0.125102 0.125973 0.124085 0.124406 0.127046 0.125074 0.123635 0.124226 0.122516 0.122895 0.123414 0.121947 0.122851 0.120974 0.121552 0.120142 0.120621 0.122083 0.124029 0.124019 0.125723 0.124739 0.125779 0.127088 0.125415 0.129437 0.127084 0.126794 0.125691 0.125655 0.124173 0.122432 0.121248 0.119451 0.12008 0.118443 0.118998 0.119803 0.117917 0.118433 0.117008 0.117511 0.118966 0.120884 0.120896 0.122659 0.120381 0.121803 0.122786 0.122754 0.123252 0.120987 0.119359 0.11819 0.116431 0.117141 0.115508 0.116098 0.11693 0.114962 0.115487 0.113949 0.114517 0.116083 0.118066 0.118047 0.119708 0.117495 0.118806 0.119756 0.121063 0.12087 0.119766 0.119834 0.118327 0.116518 0.115296 0.113441 0.11417 0.112572 0.113119 0.113907 0.111761 0.11207 0.115022 0.112953 0.111322 0.112178 0.110359 0.110909 0.111441 0.109899 0.110478 0.112024 0.114056 0.112905 0.113982 0.115337 0.113467 0.117803 0.11709 0.11685 0.114499 0.115002 0.115937 0.116929 0.118211 0.120202 0.118261 0.120782 0.122491 0.121743 0.123132 0.124015 0.124938 0.125893 0.126598 0.128445 0.130074 0.131207 0.132337 0.130242 0.128927 0.12708 0.129036 0.130581 0.128622 0.129899 0.130783 0.132275 0.130483 0.13217 0.133129 0.135276 0.133382 0.133759 0.133988 0.134148 0.135777 0.133766 0.135031 0.135938 0.137212 0.135641 0.139487 0.139194 0.139314 0.137464 0.139492 0.141073 0.139108 0.140447 0.14134 0.143009 0.142409 0.1433 0.141116 0.142697 0.142731 0.140589 0.140336 0.143685 0.146042 0.147076 0.149454 0.150569 0.152815 0.151307 0.153094 0.154757 0.156613 0.154863 0.153139 0.151416 0.149681 0.147899 0.146341 0.14458 0.143093 0.141343 0.139937 0.138179 0.136559 0.135518 0.135238 0.136165 0.13703 0.136986 0.135679 0.134057 0.132834 0.131624 0.133176 0.134404 0.135972 0.137266 0.138598 0.140218 0.14162 0.143287 0.144794 0.146475 0.14806 0.149759 0.151454 0.149827 0.14815 0.146604 0.144946 0.143484 0.141849 0.140465 0.138859 0.137549 0.136301 0.134733 0.133564 0.132022 0.130494 0.128988 0.1275 0.126464 0.127931 0.126923 0.125464 0.124545 0.125987 0.12511 0.123686 0.122291 0.120928 0.119485 0.118805 0.117363 0.115633 0.114443 0.11248 0.111289 0.109486 0.110283 0.108644 0.109252 0.110113 0.107908 0.108332 0.111319 0.109294 0.107668 0.108574 0.106721 0.107307 0.109322 0.110462 0.110389 0.111959 0.109854 0.113301 0.115289 0.114683 0.112879 0.110668 0.111228 0.111967 0.112913 0.112987 0.115711 0.114936 0.113342 0.112238 0.112476 0.110901 0.109003 0.107776 0.105896 0.106463 0.10845 0.109544 0.109469 0.107061 0.105477 0.106169 0.107717 0.108219 0.107011 0.105168 0.105845 0.10773 0.108809 0.108721 0.110097 0.11132 0.113092 0.111045 0.113443 0.112854 0.111387 0.110387 0.11064 0.109193 0.10744 0.104442 0.10387 0.106098 0.104979 0.106521 0.107243 0.105358 0.103765 0.104496 0.105487 0.103411 0.10395 0.106704 0.104853 0.10331 0.104047 0.105026 0.103017 0.103522 0.106225 0.104396 0.102938 0.103677 0.104587 0.102769 0.103236 0.105669 0.10402 0.10271 0.103275 0.103821 0.104953 0.106139 0.104471 0.108191 0.10666 0.105378 0.104502 0.10312 0.103684 0.10421 0.103104 0.103681 0.104714 0.105853 0.105055 0.105766 0.106196 0.105093 0.104324 0.103139 0.103633 0.104782 0.105429 0.105395 0.104045 0.103106 0.103541 0.104393 0.104603 0.103996 0.103075 0.103377 0.10422 0.104554 0.1047 0.105471 0.105203 0.106024 0.104808 0.104267 0.103558 0.103085 0.102356 0.102194 0.102878 0.102768 0.103347 0.101844 0.101268 0.100661 0.0996388 0.0985756 0.0998445 0.0971308 0.0958399 0.093337 0.0905303 0.0866751 0.0825199 0.0790779 0.0731424 0.065843 0.0575604 0.0504369 0.0467562 0.0535839 0.0587152 0.057991 0.0625812 0.0666468 0.0630583 0.06478 0.060765 0.0561902 0.0610514 0.0668555 0.0722868 0.0718636 0.0682795 0.0641797 0.0671924 0.0695669 0.076176 0.0738772 0.0703108 0.0732525 0.078945 0.0777057 0.0809092 0.0873014 0.0827716 0.0898082 0.0909791 0.0956192 0.0946627 0.0917355 0.0906144 0.0837409 0.0837427 0.0798421 0.0832632 0.0857848 0.0815364 0.0790709 0.0786679 0.0795677 0.0808814 0.0821526 0.0831078 0.0836422 0.0829189 0.0821498 0.0806823 0.0785738 0.0760336 0.0718298 0.0669779 0.0702884 0.0732181 0.0683897 0.0636943 0.0666432 0.0722217 0.0846349 0.0857997 0.0856701 0.084321 0.0837952 0.0854615 0.0870839 0.0870741 0.0870543 0.0883391 0.089617 0.0908668 0.0911501 0.0898421 0.088477 0.0886308 0.09009 0.0914575 0.0918209 0.0903977 0.0888403 0.0871247 0.0852281 0.0831385 0.0825626 0.0851223 0.0853612 0.0824184 0.0831203 0.0861562 0.0885505 0.0877302 0.0872971 0.0891692 0.090812 0.092275 0.0928511 0.0913826 0.0896996 0.0905049 0.0921497 0.0935718 0.0948283 0.0941564 0.0935942 0.0931278 0.0927365 0.0923942 0.0920748 0.0917533 0.0913623 0.0924763 0.0935629 0.0946168 0.0956344 0.0966136 0.0975532 0.0984529 0.0993127 0.100133 0.100915 0.10166 0.102367 0.103038 0.103674 0.104276 0.104506 0.103923 0.103306 0.102654 0.101966 0.101241 0.100478 0.0996782 0.0988394 0.0979577 0.0970325 0.096063 0.0950493 0.0939917 0.0928919 0.0932344 0.0943436 0.095402 0.0957495 0.0946916 0.0935741 0.0939334 0.0950552 0.0961088 0.0971001 0.0967512 0.0964103 0.09737 0.0982828 0.0991508 0.0994515 0.0985991 0.0976999 0.0980345 0.0989163 0.0997492 0.100055 0.0992451 0.0983852 0.0974706 0.0964956 0.095453 0.0943341 0.0947961 0.0959006 0.0969226 0.0973991 0.096409 0.095334 0.0959575 0.0969857 0.0979315 0.0988082 0.0983174 0.0978736 0.0987623 0.0995955 0.100379 0.100728 0.0999752 0.0991736 0.0996254 0.100391 0.10111 0.101786 0.101436 0.101116 0.100818 0.100536 0.10026 0.0999759 0.10076 0.101505 0.102212 0.102435 0.101749 0.101025 0.10128 0.101983 0.102647 0.103274 0.103083 0.102881 0.103514 0.104112 0.104677 0.104818 0.104273 0.103695 0.103866 0.104424 0.10495 0.105083 0.104576 0.104037 0.103466 0.10286 0.102218 0.101538 0.10181 0.102466 0.103084 0.103327 0.102733 0.102103 0.102424 0.103027 0.103596 0.104133 0.103887 0.103667 0.104218 0.104736 0.105224 0.105383 0.104914 0.104415 0.10464 0.105119 0.10557 0.105806 0.105369 0.104907 0.104418 0.103903 0.103358 0.102783 0.102175 0.101531 0.100849 0.100124 0.0993511 0.0985243 0.0976345 0.0966699 0.0956139 0.0944436 0.093126 0.0916133 0.0898333 0.0876753 0.0849821 0.0879046 0.0898224 0.0922072 0.09105 0.0901139 0.08957 0.0940307 0.0952966 0.0987023 0.101535 0.100751 0.0971244 0.0935179 0.103537 0.103848 0.104015 0.101601 0.105205 0.106941 0.107781 0.10687 0.106301 0.106173 0.10669 0.106944 0.108123 0.106829 0.109234 0.109521 0.109648 0.10801 0.106887 0.104922 0.105485 0.107401 0.108311 0.107739 0.109573 0.107234 0.105392 0.106005 0.10867 0.108114 0.105893 0.106516 0.109385 0.111245 0.111519 0.109707 0.111074 0.112229 0.112559 0.113669 0.114092 0.114519 0.115729 0.116272 0.116826 0.118137 0.117511 0.116942 0.11642 0.115235 0.114778 0.114338 0.113271 0.112866 0.111875 0.110848 0.110555 0.11014 0.109495 0.108712 0.10773 0.106182 0.107119 0.10847 0.10925 0.110253 0.110979 0.111482 0.112408 0.111827 0.111059 0.111945 0.112721 0.113356 0.113879 0.114923 0.115438 0.115926 0.117106 0.117641 0.118196 0.118791 0.119438 0.120144 0.121499 0.120774 0.120105 0.121445 0.122139 0.122882 0.124291 0.123525 0.122806 0.122121 0.120791 0.119482 0.11889 0.118314 0.117735 0.11657 0.116006 0.115391 0.114347 0.113679 0.112921 0.112117 0.11107 0.110113 0.109101 0.108082 0.106944 0.105731 0.104451 0.102992 0.101162 0.0985642 0.100982 0.10289 0.104502 0.103529 0.101743 0.0996821 0.0972022 0.0966438 0.0937485 0.0939711 0.0945605 0.0953162 0.0933883 0.0915079 0.0929838 0.0942879 0.095453 0.0965722 0.0955841 0.0945216 0.0961349 0.0969628 0.097773 0.099034 0.0983856 0.0977616 0.0971986 0.0967571 0.0965335 0.0987666 0.0990288 0.101068 0.102878 0.102524 0.100738 0.100635 0.0987734 0.0990006 0.0993709 0.0998299 0.10034 0.101681 0.101283 0.100952 0.10072 0.102367 0.102369 0.104002 0.104182 0.104541 0.105137 0.10595 0.107322 0.108149 0.109373 0.110187 0.111337 0.110626 0.110008 0.108667 0.108082 0.10664 0.106108 0.105753 0.105561 0.107063 0.107268 0.107611 0.109069 0.10949 0.110878 0.111351 0.111907 0.112542 0.113243 0.113982 0.114712 0.115815 0.116494 0.117133 0.118305 0.118935 0.119551 0.120164 0.121462 0.120815 0.120171 0.121441 0.122108 0.122783 0.123472 0.124185 0.124931 0.125719 0.126557 0.12745 0.128401 0.129419 0.13093 0.129899 0.128932 0.13043 0.131414 0.132458 0.134 0.135119 0.136685 0.13788 0.13914 0.140744 0.142083 0.143708 0.145124 0.146769 0.148264 0.149929 0.151506 0.153151 0.15486 0.156622 0.158429 0.160302 0.16213 0.164096 0.165946 0.168 0.170076 0.172137 0.174159 0.172011 0.169872 0.17172 0.173911 0.176135 0.17837 0.180401 0.182799 0.18484 0.187361 0.189424 0.192066 0.194149 0.196913 0.199688 0.202407 0.205267 0.207796 0.210784 0.213347 0.216473 0.219627 0.21567 0.214541 0.221651 0.225766 0.227898 0.222398 0.21909 0.215763 0.212473 0.210188 0.207079 0.2048 0.201907 0.204055 0.20614 0.209263 0.211373 0.214672 0.218067 0.221538 0.225054 0.228565 0.231201 0.227507 0.223852 0.226066 0.229832 0.233678 0.237547 0.240077 0.244258 0.246768 0.251228 0.255786 0.260365 0.263272 0.268025 0.27309 0.276299 0.281692 0.28486 0.290669 0.293713 0.287616 0.290056 0.296347 0.302784 0.305324 0.312302 0.319599 0.326911 0.334699 0.343044 0.339697 0.335263 0.334023 0.347549 0.346519 0.337972 0.329812 0.322097 0.314617 0.307495 0.300693 0.298663 0.292235 0.29416 0.28792 0.286076 0.284009 0.281707 0.279151 0.273641 0.27099 0.265912 0.260898 0.258445 0.253712 0.249121 0.251334 0.256033 0.258209 0.263185 0.268341 0.270582 0.276039 0.278214 0.280176 0.281953 0.276249 0.274518 0.272636 0.267277 0.265313 0.260237 0.255361 0.25341 0.248786 0.246794 0.244682 0.242446 0.238263 0.236027 0.232058 0.228199 0.224457 0.222403 0.220275 0.216794 0.213421 0.210149 0.208171 0.205056 0.203089 0.201077 0.199021 0.196179 0.193404 0.191434 0.188786 0.186832 0.184311 0.182376 0.179982 0.178075 0.175787 0.173553 0.175375 0.177646 0.179487 0.181864 0.183725 0.186216 0.188094 0.190707 0.192598 0.195341 0.198168 0.200121 0.197244 0.194459 0.191769 0.189944 0.187379 0.185563 0.183117 0.181311 0.178978 0.177184 0.174959 0.173178 0.171386 0.169584 0.167773 0.165731 0.163938 0.161993 0.160218 0.158372 0.160115 0.161855 0.163758 0.165517 0.167515 0.16929 0.167269 0.165323 0.163591 0.161737 0.160021 0.158301 0.156581 0.154851 0.153191 0.151599 0.15327 0.154877 0.156554 0.158256 0.156563 0.15494 0.156605 0.158246 0.159956 0.16165 0.16345 0.165155 0.167047 0.169014 0.171057 0.172814 0.170749 0.168761 0.166848 0.165008 0.163336 0.161586 0.159922 0.158261 0.159904 0.161532 0.163236 0.164869 0.166664 0.168527 0.170463 0.172472 0.174559 0.176727 0.178481 0.180756 0.182517 0.184904 0.18667 0.189173 0.190944 0.193569 0.196291 0.199113 0.202035 0.20391 0.206977 0.208855 0.212075 0.215406 0.218849 0.220834 0.217333 0.213952 0.215784 0.219205 0.222755 0.226437 0.23025 0.234194 0.236235 0.240392 0.242413 0.244336 0.240054 0.238185 0.234113 0.232219 0.228348 0.224619 0.221028 0.217572 0.219315 0.222802 0.226427 0.230195 0.231984 0.235939 0.2377 0.24185 0.246173 0.250673 0.252467 0.257199 0.262132 0.263907 0.269098 0.270794 0.265576 0.260583 0.258937 0.254175 0.249611 0.24793 0.243576 0.239397 0.241026 0.24523 0.246812 0.251214 0.255798 0.257337 0.262137 0.267145 0.272376 0.277848 0.283573 0.289571 0.295852 0.30244 0.309338 0.316559 0.324152 0.332073 0.340432 0.34927 0.351215 0.360499 0.361945 0.362772 0.353372 0.352554 0.343601 0.342271 0.333829 0.325805 0.31815 0.310878 0.312166 0.319433 0.327082 0.335132 0.336054 0.344475 0.34498 0.353773 0.363101 0.362932 0.353859 0.345222 0.345253 0.35362 0.362312 0.361524 0.35313 0.345068 0.337312 0.337263 0.337065 0.336679 0.328786 0.328055 0.320466 0.313248 0.314152 0.321292 0.321938 0.329315 0.329669 0.329871 0.322781 0.322428 0.315504 0.314898 0.308185 0.307355 0.306381 0.305249 0.303945 0.297346 0.291054 0.285055 0.286408 0.292393 0.298669 0.299839 0.293597 0.287638 0.281941 0.28069 0.279328 0.273852 0.268614 0.2636 0.264973 0.269987 0.275221 0.276488 0.271265 0.266257 0.267453 0.272449 0.277655 0.283086 0.288753 0.294673 0.300867 0.301765 0.295631 0.289756 0.290653 0.296475 0.302545 0.308883 0.309464 0.315982 0.316346 0.323019 0.329967 0.337218 0.344716 0.352524 0.360648 0.369114 0.377883 0.376174 0.384792 0.38264 0.390985 0.399443 0.396433 0.404407 0.40114 0.408558 0.415789 0.411984 0.405157 0.398141 0.395398 0.402075 0.408563 0.405492 0.399286 0.392897 0.386386 0.388601 0.39101 0.393621 0.386071 0.38846 0.380552 0.372753 0.374451 0.366455 0.367802 0.359685 0.351845 0.344274 0.34377 0.351104 0.358666 0.357614 0.365102 0.363762 0.3711 0.37855 0.376647 0.383828 0.381736 0.379796 0.373177 0.374855 0.367995 0.36951 0.362455 0.3555 0.356553 0.349504 0.350319 0.343214 0.336322 0.336683 0.336994 0.329949 0.323153 0.316606 0.316774 0.323198 0.329831 0.329634 0.323157 0.316869 0.316896 0.323054 0.329385 0.335911 0.342616 0.341992 0.348677 0.347854 0.354471 0.361194 0.359989 0.366563 0.36522 0.371617 0.378007 0.38436 0.390626 0.396771 0.402742 0.40849 0.413962 0.419106 0.423878 0.428239 0.432164 0.435637 0.438662 0.441259 0.443458 0.445295 0.446818 0.448069 0.449093 0.449931 0.450622 0.451199 0.451686 0.452101 0.452456 0.452761 0.453025 0.453255 0.453457 0.453633 0.453785 0.453913 0.454016 0.454094 0.454152 0.454191 0.454226 0.454328 0.454263 0.454174 0.454115 0.454262 0.45438 0.45435 0.454183 0.453994 0.453783 0.453943 0.454057 0.453912 0.453742 0.453545 0.453273 0.453522 0.453745 0.453548 0.453286 0.452993 0.452719 0.453054 0.453351 0.453616 0.453853 0.454067 0.454263 0.454164 0.453952 0.453717 0.453592 0.453846 0.454074 0.453994 0.45375 0.453476 0.453168 0.453307 0.453456 0.453163 0.452832 0.452458 0.452213 0.452622 0.452985 0.452822 0.452431 0.45199 0.451494 0.451751 0.452036 0.452341 0.452662 0.452993 0.453322 0.453071 0.452789 0.452468 0.451921 0.452323 0.452679 0.45229 0.451868 0.45139 0.450847 0.451463 0.452103 0.451684 0.451202 0.450645 0.449655 0.450342 0.45094 0.450229 0.449526 0.448725 0.447862 0.448766 0.449562 0.450264 0.450884 0.451431 0.451914 0.451559 0.45102 0.450411 0.449978 0.450642 0.451229 0.450934 0.450304 0.449593 0.448795 0.449231 0.449723 0.448946 0.448067 0.447075 0.446369 0.447438 0.448388 0.447896 0.446886 0.445753 0.445237 0.446423 0.447481 0.448426 0.449267 0.450015 0.450681 0.451273 0.451798 0.452265 0.452679 0.453046 0.453373 0.453664 0.453923 0.453865 0.453594 0.45329 0.453231 0.453544 0.453823 0.453799 0.453515 0.453197 0.45284 0.45288 0.452949 0.452565 0.452132 0.451646 0.45154 0.45204 0.452485 0.452438 0.451986 0.451478 0.450906 0.450977 0.451098 0.450482 0.449789 0.449011 0.448834 0.449633 0.450344 0.450263 0.449541 0.44873 0.447822 0.447939 0.448138 0.447158 0.446062 0.444837 0.444562 0.445814 0.446936 0.446805 0.445669 0.444401 0.442988 0.443165 0.443468 0.44391 0.444482 0.445167 0.445954 0.446837 0.447811 0.448867 0.449999 0.449246 0.448362 0.447318 0.445686 0.446906 0.447958 0.446765 0.445568 0.444197 0.442625 0.444267 0.446081 0.444616 0.442884 0.440853 0.438525 0.440717 0.442622 0.440828 0.43878 0.436455 0.434628 0.437061 0.439228 0.441152 0.442852 0.444352 0.445673 0.444689 0.443261 0.441653 0.4406 0.442298 0.443815 0.443058 0.441468 0.439695 0.437723 0.438702 0.439845 0.437816 0.43555 0.433029 0.431646 0.43424 0.436587 0.435538 0.433125 0.430474 0.427574 0.428795 0.430238 0.431913 0.433833 0.436016 0.438483 0.435748 0.432625 0.4291 0.426403 0.429968 0.433169 0.430896 0.427633 0.424037 0.42011 0.422476 0.425173 0.420858 0.416177 0.411161 0.408685 0.413594 0.418201 0.415869 0.411323 0.406504 0.404594 0.409339 0.413832 0.418045 0.42197 0.42559 0.428903 0.427169 0.423817 0.420177 0.41864 0.422294 0.425679 0.424421 0.421011 0.417345 0.413428 0.414721 0.416255 0.412065 0.407616 0.402933 0.401503 0.406136 0.41055 0.409274 0.404889 0.400297 0.399315 0.403875 0.408237 0.412379 0.416294 0.419967 0.423396 0.426579 0.429516 0.432214 0.434677 0.436918 0.438947 0.44078 0.442429 0.441944 0.440251 0.438375 0.437984 0.43989 0.441613 0.441419 0.439678 0.437755 0.435636 0.435882 0.436301 0.434021 0.431519 0.428789 0.428295 0.431048 0.433573 0.433312 0.430772 0.428007 0.425014 0.425313 0.425824 0.422621 0.419177 0.415497 0.414958 0.418641 0.422096 0.421789 0.418329 0.414643 0.410732 0.411046 0.411584 0.407452 0.403106 0.39857 0.398064 0.402585 0.40692 0.406609 0.402281 0.397769 0.39308 0.393364 0.393851 0.394566 0.395509 0.396664 0.398031 0.399617 0.401436 0.403507 0.405849 0.400285 0.394512 0.388573 0.386725 0.392489 0.398095 0.396153 0.390687 0.385071 0.379338 0.380843 0.382515 0.376368 0.370176 0.36397 0.362813 0.368853 0.374873 0.373521 0.367648 0.361751 0.360786 0.36656 0.372307 0.377993 0.383599 0.389089 0.394441 0.392944 0.387689 0.382304 0.381177 0.386477 0.39165 0.390554 0.385446 0.380217 0.374881 0.375768 0.376805 0.371228 0.365588 0.359919 0.359153 0.364734 0.370281 0.369468 0.363998 0.358489 0.35296 0.353552 0.354233 0.354998 0.355844 0.35677 0.357771 0.358846 0.35252 0.353476 0.347047 0.340722 0.341357 0.334995 0.335466 0.329095 0.322897 0.316862 0.31678 0.322698 0.328771 0.328423 0.33451 0.334018 0.340091 0.34626 0.345505 0.351613 0.350758 0.349962 0.34411 0.344787 0.338883 0.339476 0.333529 0.327685 0.328059 0.322218 0.322471 0.316657 0.310983 0.311013 0.310995 0.310922 0.31079 0.310589 0.310307 0.309935 0.303771 0.303211 0.29721 0.291446 0.285905 0.285065 0.284126 0.278723 0.27354 0.268558 0.269577 0.274538 0.279696 0.280576 0.275447 0.270511 0.265753 0.2648 0.263767 0.26265 0.26145 0.260164 0.258792 0.254182 0.252737 0.24832 0.24408 0.242587 0.238529 0.236987 0.235382 0.233714 0.229882 0.228182 0.224526 0.22101 0.222653 0.226197 0.227814 0.231524 0.233106 0.234626 0.230872 0.229373 0.225779 0.224244 0.220804 0.219239 0.217623 0.215957 0.214245 0.212489 0.210692 0.207551 0.205748 0.202753 0.200949 0.198094 0.199867 0.201609 0.204524 0.20626 0.209316 0.211042 0.207956 0.204982 0.203314 0.200477 0.198799 0.197086 0.195341 0.192688 0.190131 0.188413 0.185975 0.184257 0.181932 0.180217 0.178001 0.176289 0.174179 0.172146 0.173809 0.175866 0.177532 0.179692 0.181358 0.183625 0.18529 0.187666 0.189328 0.19182 0.194405 0.19609 0.193477 0.190958 0.188527 0.186924 0.184605 0.182996 0.180784 0.179172 0.177064 0.17545 0.17344 0.171825 0.170187 0.1683 0.16648 0.164727 0.16314 0.161473 0.159889 0.158286 0.156665 0.15503 0.153384 0.151731 0.150075 0.14842 0.146978 0.14534 0.143976 0.142357 0.141071 0.139471 0.138263 0.137116 0.135553 0.134479 0.132941 0.131941 0.133462 0.134991 0.136026 0.137579 0.138686 0.139848 0.141439 0.142677 0.144286 0.1456 0.147225 0.148618 0.150258 0.151893 0.150462 0.148847 0.147496 0.145893 0.144619 0.143031 0.141831 0.140259 0.139133 0.138056 0.136524 0.135515 0.134004 0.132496 0.130994 0.129502 0.128022 0.127164 0.126353 0.125581 0.126993 0.127789 0.128623 0.130095 0.129238 0.128418 0.127629 0.126228 0.124842 0.124126 0.123427 0.12274 0.124064 0.124768 0.125488 0.126866 0.126126 0.125406 0.12676 0.127495 0.128255 0.12904 0.129852 0.130696 0.131575 0.133062 0.132159 0.131291 0.132733 0.133624 0.13455 0.136036 0.137025 0.13853 0.139584 0.140684 0.142228 0.143398 0.144957 0.1462 0.147771 0.149089 0.150671 0.152066 0.153519 0.155132 0.153656 0.152237 0.153787 0.15523 0.156729 0.158309 0.156784 0.155317 0.153902 0.152396 0.150871 0.149329 0.148039 0.146505 0.145287 0.143764 0.142617 0.141106 0.140027 0.138991 0.137517 0.136543 0.135086 0.134172 0.133293 0.131875 0.130456 0.12965 0.128872 0.128121 0.129484 0.130252 0.131048 0.132445 0.13163 0.130845 0.132201 0.133003 0.133838 0.134706 0.135607 0.137035 0.137994 0.139434 0.140455 0.141515 0.14299 0.144116 0.145602 0.146797 0.148291 0.149557 0.151058 0.15254 0.151226 0.149767 0.148525 0.147072 0.145898 0.144452 0.143345 0.141907 0.140863 0.13986 0.138453 0.137509 0.136112 0.135224 0.13437 0.13355 0.134888 0.135727 0.1366 0.137965 0.138894 0.140267 0.141254 0.142279 0.143681 0.144768 0.146175 0.147328 0.14874 0.14996 0.151375 0.152664 0.154001 0.155388 0.156827 0.158319 0.159868 0.161405 0.163035 0.164574 0.16629 0.168069 0.169913 0.171502 0.169633 0.167829 0.169341 0.17117 0.173065 0.175028 0.176589 0.17865 0.180206 0.182366 0.183916 0.186182 0.187724 0.190096 0.192554 0.195099 0.19774 0.199352 0.202116 0.203716 0.206608 0.20961 0.212725 0.214363 0.211221 0.208192 0.205273 0.202455 0.200925 0.198232 0.196685 0.194112 0.195632 0.197112 0.199737 0.201199 0.203943 0.206786 0.209731 0.212786 0.215953 0.217494 0.214301 0.211221 0.212662 0.215765 0.218982 0.222316 0.223772 0.227257 0.228674 0.232309 0.236083 0.240004 0.24141 0.245501 0.249755 0.251113 0.255548 0.256832 0.252393 0.248123 0.246849 0.242747 0.238797 0.237473 0.233682 0.230031 0.231327 0.234993 0.236239 0.240053 0.244013 0.245208 0.249323 0.253597 0.258036 0.259159 0.254723 0.25045 0.251505 0.255774 0.260203 0.26117 0.25675 0.252487 0.248374 0.247388 0.246333 0.242363 0.241242 0.237419 0.23373 0.23256 0.22901 0.227789 0.226509 0.22517 0.221794 0.220415 0.217177 0.214053 0.211039 0.20967 0.208251 0.205385 0.202618 0.199946 0.198551 0.195993 0.194579 0.193123 0.191629 0.189231 0.186915 0.185433 0.183222 0.181731 0.179619 0.178119 0.176106 0.1746 0.17268 0.170826 0.172282 0.17416 0.175611 0.17758 0.179023 0.181085 0.182518 0.184679 0.1861 0.18836 0.1907 0.192131 0.189768 0.187484 0.185278 0.183916 0.181806 0.180432 0.178415 0.177029 0.175104 0.173709 0.171871 0.170468 0.169036 0.167576 0.166088 0.164408 0.162919 0.161321 0.159832 0.158316 0.159781 0.161222 0.162786 0.164226 0.165872 0.167309 0.16564 0.164029 0.162639 0.161106 0.159712 0.158294 0.156852 0.155442 0.154081 0.15277 0.154143 0.155477 0.156861 0.158256 0.15685 0.155494 0.156822 0.158199 0.159627 0.160973 0.162474 0.163815 0.165393 0.167026 0.168718 0.170098 0.168383 0.166729 0.16513 0.163586 0.162293 0.160823 0.159523 0.158125 0.159404 0.160656 0.162095 0.163341 0.164852 0.166416 0.168036 0.169712 0.171448 0.173244 0.174586 0.176467 0.177798 0.179768 0.181085 0.183146 0.184449 0.186603 0.188831 0.191137 0.193523 0.194874 0.197366 0.198696 0.201298 0.203991 0.20678 0.208128 0.205318 0.202604 0.199982 0.197449 0.196183 0.193754 0.192466 0.190139 0.191407 0.192634 0.195 0.196204 0.198671 0.201223 0.203864 0.206598 0.209428 0.212358 0.215391 0.218536 0.219839 0.223116 0.22438 0.225586 0.222279 0.221088 0.21791 0.216677 0.213625 0.210678 0.20783 0.205078 0.206244 0.209012 0.211876 0.21484 0.216004 0.219087 0.22021 0.223415 0.226735 0.23017 0.231269 0.234838 0.238534 0.239584 0.243416 0.244403 0.24057 0.236865 0.235883 0.232307 0.228855 0.227824 0.224495 0.221278 0.222291 0.225517 0.226481 0.229827 0.233285 0.234201 0.237785 0.241491 0.245323 0.249291 0.253399 0.257653 0.26206 0.266627 0.271363 0.276272 0.281367 0.286653 0.292142 0.297846 0.298387 0.304234 0.30461 0.304906 0.299218 0.298842 0.293271 0.292748 0.287315 0.282073 0.277015 0.272136 0.272834 0.27768 0.282699 0.287893 0.288394 0.293715 0.294087 0.299522 0.305131 0.305294 0.299761 0.294394 0.294639 0.299942 0.305399 0.305453 0.300069 0.294828 0.289732 0.289489 0.289188 0.288824 0.283727 0.283249 0.278271 0.273458 0.274012 0.278791 0.279244 0.284139 0.284489 0.284779 0.279965 0.279635 0.274925 0.2745 0.269901 0.269385 0.268802 0.268149 0.267424 0.262877 0.258484 0.254241 0.255015 0.259246 0.263621 0.264296 0.259938 0.255721 0.251641 0.250924 0.250141 0.246178 0.242347 0.238642 0.239437 0.243141 0.246967 0.247692 0.24387 0.240169 0.240839 0.244537 0.248352 0.252293 0.256362 0.260564 0.264903 0.265444 0.261125 0.256938 0.25745 0.261622 0.265921 0.270354 0.270745 0.275289 0.275595 0.280239 0.285013 0.289923 0.294968 0.300149 0.305468 0.310918 0.316504 0.316324 0.321946 0.321665 0.327311 0.333051 0.332587 0.338317 0.337785 0.343481 0.349227 0.348558 0.342903 0.337293 0.336844 0.342383 0.347959 0.347434 0.341925 0.336446 0.331009 0.33135 0.331731 0.332145 0.326581 0.32694 0.321377 0.315916 0.316127 0.310697 0.31082 0.305442 0.300187 0.295062 0.295116 0.300188 0.305385 0.305304 0.310553 0.310398 0.315699 0.321093 0.320817 0.326239 0.32592 0.325631 0.32032 0.320557 0.315275 0.315484 0.310236 0.30509 0.305203 0.30011 0.300161 0.295136 0.290227 0.290166 0.290067 0.285198 0.280459 0.275847 0.27605 0.280631 0.285338 0.285437 0.280761 0.276208 0.276327 0.280855 0.2855 0.290258 0.295127 0.295097 0.300041 0.299963 0.304972 0.310077 0.309925 0.315079 0.314907 0.32011 0.325383 0.330719 0.336108 0.341537 0.346994 0.352465 0.357935 0.363386 0.368797 0.374151 0.379429 0.384602 0.389658 0.388977 0.383959 0.378827 0.378416 0.383521 0.388513 0.388242 0.383264 0.378175 0.372985 0.37321 0.373592 0.368283 0.362913 0.357508 0.357216 0.36259 0.367931 0.367724 0.3624 0.357042 0.351659 0.351815 0.352081 0.346651 0.341235 0.335841 0.335654 0.341023 0.346413 0.346272 0.340898 0.335543 0.330227 0.330325 0.330489 0.325186 0.31994 0.314765 0.314665 0.31982 0.325045 0.324961 0.319748 0.314605 0.309534 0.309585 0.309668 0.309784 0.304745 0.304855 0.299879 0.294998 0.295053 0.290247 0.290263 0.285535 0.280916 0.276411 0.276467 0.280952 0.285547 0.285541 0.290218 0.290182 0.29494 0.299796 0.299724 0.304651 0.304583 0.304541 0.299637 0.299671 0.294847 0.294887 0.290147 0.285506 0.285525 0.28097 0.280969 0.276502 0.272141 0.27209 0.272015 0.271909 0.271769 0.271587 0.271358 0.271079 0.266695 0.266337 0.262057 0.257902 0.25387 0.253406 0.252881 0.24895 0.24514 0.241447 0.241994 0.245682 0.249484 0.249959 0.246164 0.242481 0.24291 0.246587 0.250374 0.254275 0.258294 0.262432 0.262753 0.266996 0.267246 0.267449 0.263242 0.263022 0.258913 0.25863 0.254624 0.250733 0.246954 0.243283 0.243604 0.247268 0.251039 0.25492 0.255167 0.259148 0.259339 0.263418 0.267608 0.267731 0.263555 0.25949 0.259606 0.26366 0.267822 0.267886 0.263737 0.259693 0.255754 0.255657 0.25553 0.255368 0.251507 0.251296 0.247533 0.243875 0.244101 0.247753 0.247931 0.251678 0.251813 0.251917 0.248183 0.248073 0.244433 0.244286 0.24074 0.240549 0.240319 0.240043 0.239718 0.23934 0.238907 0.238417 0.237866 0.237256 0.236584 0.235851 0.235057 0.231591 0.230739 0.227388 0.224147 0.223247 0.22012 0.219172 0.21817 0.217114 0.214121 0.213024 0.210145 0.207362 0.20843 0.211228 0.21226 0.215165 0.216157 0.217095 0.214168 0.21324 0.210419 0.20945 0.206732 0.205726 0.204671 0.203569 0.202419 0.19985 0.197365 0.194963 0.193819 0.191513 0.190345 0.189137 0.187889 0.185715 0.183614 0.182368 0.180356 0.179094 0.17717 0.175895 0.174056 0.172767 0.17101 0.169313 0.17056 0.172278 0.173513 0.175311 0.176533 0.178412 0.179619 0.181583 0.182773 0.184823 0.186944 0.188132 0.185993 0.183925 0.181925 0.18079 0.178874 0.177721 0.175885 0.174716 0.172959 0.171776 0.170097 0.1689 0.167673 0.166089 0.164559 0.163081 0.161882 0.160473 0.159267 0.158034 0.156776 0.155493 0.154187 0.152857 0.151506 0.150133 0.148935 0.147565 0.146433 0.145065 0.143996 0.142633 0.141625 0.140655 0.139318 0.138405 0.137073 0.136215 0.137529 0.138828 0.139723 0.141026 0.141978 0.142968 0.144293 0.145343 0.146671 0.147782 0.149112 0.150286 0.151616 0.152925 0.151709 0.150421 0.149269 0.14798 0.14689 0.145601 0.144571 0.143283 0.142312 0.141378 0.140111 0.139233 0.137968 0.136687 0.135392 0.134084 0.132763 0.131432 0.130092 0.128746 0.127398 0.126049 0.124707 0.123376 0.122063 0.120775 0.11952 0.118862 0.117652 0.116983 0.116314 0.115117 0.114432 0.113791 0.11321 0.112697 0.114041 0.114527 0.115071 0.11567 0.116943 0.117557 0.118202 0.119463 0.120114 0.121399 0.120753 0.120134 0.118834 0.118239 0.117685 0.116372 0.115851 0.115381 0.114965 0.113616 0.112253 0.111881 0.110489 0.110178 0.108742 0.10852 0.1084 0.106964 0.105483 0.103952 0.104018 0.102501 0.102736 0.103042 0.104409 0.104178 0.105601 0.105499 0.106944 0.108353 0.108365 0.106997 0.107113 0.10577 0.105991 0.104694 0.103398 0.102121 0.100878 0.0996862 0.0985542 0.0974908 0.0965062 0.0974685 0.0983559 0.0991805 0.0999037 0.0991495 0.0983474 0.0993023 0.100017 0.1007 0.101352 0.100615 0.0999513 0.100675 0.101358 0.102003 0.102537 0.101929 0.101289 0.101977 0.102574 0.103147 0.103842 0.103303 0.102746 0.10217 0.101575 0.100961 0.100331 0.101428 0.10198 0.102528 0.10355 0.103065 0.102586 0.103788 0.1042 0.104625 0.105056 0.104036 0.103068 0.103597 0.104114 0.104618 0.105458 0.104992 0.104517 0.105488 0.105918 0.106343 0.106761 0.105914 0.105108 0.104363 0.103697 0.103116 0.102613 0.103192 0.103742 0.104265 0.104699 0.104195 0.103668 0.104225 0.104732 0.105219 0.105688 0.105181 0.104762 0.105234 0.105685 0.106114 0.106508 0.106085 0.105642 0.106139 0.106573 0.106991 0.107543 0.107136 0.106714 0.106276 0.105823 0.105353 0.104867 0.105585 0.106047 0.106495 0.107213 0.106792 0.106359 0.10717 0.10757 0.107959 0.108336 0.10762 0.106928 0.107346 0.10775 0.108139 0.108759 0.108393 0.108014 0.108702 0.109055 0.109395 0.110044 0.10973 0.109404 0.109068 0.108722 0.108367 0.108003 0.107632 0.107254 0.106873 0.106489 0.106107 0.105731 0.105365 0.105016 0.106252 0.106541 0.106851 0.107973 0.107717 0.107483 0.107279 0.108549 0.108434 0.109729 0.109702 0.109723 0.109798 0.109946 0.111341 0.111579 0.112948 0.113251 0.114602 0.114292 0.114035 0.112703 0.112512 0.111167 0.111061 0.111009 0.111 0.112247 0.112288 0.112373 0.113665 0.113828 0.115116 0.115342 0.115614 0.115933 0.1163 0.116714 0.117176 0.1185 0.119004 0.119549 0.120866 0.121447 0.122062 0.122708 0.124032 0.123384 0.122767 0.122184 0.121637 0.120322 0.119817 0.119352 0.118038 0.117621 0.117246 0.116916 0.116628 0.117893 0.118198 0.118542 0.118927 0.120218 0.120653 0.121126 0.122426 0.122945 0.123499 0.124088 0.124711 0.125366 0.126703 0.126039 0.125407 0.12672 0.127363 0.128039 0.129371 0.128681 0.128025 0.127401 0.12611 0.124808 0.124244 0.123713 0.123218 0.121942 0.121495 0.121084 0.119821 0.119462 0.11914 0.118854 0.117627 0.116381 0.116175 0.114932 0.114787 0.113546 0.113471 0.113433 0.112242 0.11103 0.1098 0.109906 0.108702 0.108885 0.109091 0.109316 0.108245 0.107174 0.107506 0.107842 0.10818 0.109114 0.108819 0.108529 0.109553 0.1098 0.110053 0.110997 0.110783 0.110577 0.110382 0.110203 0.110043 0.111188 0.111094 0.112268 0.113426 0.113445 0.112322 0.112401 0.111306 0.111445 0.111599 0.111766 0.111944 0.112891 0.112749 0.112618 0.112501 0.113551 0.113488 0.114564 0.114555 0.114568 0.114607 0.114679 0.115872 0.116006 0.117205 0.117398 0.118603 0.118386 0.118201 0.117045 0.116915 0.115768 0.115695 0.115651 0.11563 0.116685 0.116737 0.116813 0.117917 0.118045 0.11916 0.119341 0.119551 0.119791 0.120063 0.120368 0.120708 0.121938 0.12233 0.122757 0.124003 0.124479 0.124989 0.125532 0.12681 0.126252 0.125727 0.125236 0.124777 0.123561 0.123152 0.122775 0.12158 0.121255 0.120962 0.1207 0.120467 0.121577 0.121833 0.122117 0.122431 0.123591 0.123955 0.12435 0.125532 0.125977 0.126453 0.126961 0.127501 0.128074 0.12868 0.129319 0.129991 0.130695 0.13201 0.131289 0.130602 0.131872 0.132576 0.133313 0.134604 0.13385 0.133129 0.132441 0.131201 0.129947 0.129326 0.128737 0.12818 0.129384 0.129958 0.130563 0.131786 0.131163 0.130572 0.131745 0.132354 0.132994 0.133666 0.134371 0.135109 0.135881 0.137144 0.136354 0.135598 0.136809 0.137582 0.13839 0.13962 0.140481 0.141712 0.142627 0.14358 0.14483 0.14584 0.14709 0.148159 0.149407 0.150537 0.151783 0.152975 0.154211 0.155474 0.154218 0.153006 0.154206 0.155437 0.156712 0.157926 0.156631 0.155382 0.154177 0.153019 0.151838 0.150634 0.149527 0.148319 0.147271 0.146061 0.14507 0.143858 0.142924 0.142027 0.140832 0.139989 0.138794 0.138003 0.137245 0.136068 0.134875 0.134186 0.133528 0.132902 0.134043 0.134686 0.135361 0.13652 0.135828 0.135167 0.134537 0.133431 0.132308 0.131168 0.130013 0.128842 0.127655 0.127161 0.126699 0.126266 0.125118 0.124735 0.124381 0.123257 0.122951 0.122673 0.123755 0.124054 0.125143 0.125489 0.125864 0.126977 0.127399 0.12785 0.12833 0.129484 0.128985 0.128516 0.128075 0.127662 0.126583 0.126217 0.125876 0.124823 0.124528 0.123482 0.122422 0.121349 0.120261 0.120082 0.119006 0.118876 0.117813 0.117732 0.117672 0.116655 0.115629 0.114594 0.114643 0.113633 0.11373 0.113839 0.113958 0.113043 0.112128 0.111217 0.11031 0.109409 0.108516 0.108849 0.109176 0.109498 0.110286 0.109997 0.109704 0.110569 0.110827 0.111084 0.111338 0.110569 0.109813 0.110119 0.110418 0.110707 0.111384 0.11112 0.110848 0.111588 0.111834 0.112075 0.112776 0.11256 0.11234 0.112117 0.111892 0.111666 0.111441 0.112319 0.112512 0.112708 0.11353 0.113364 0.113201 0.114085 0.114218 0.114356 0.114498 0.113699 0.112905 0.113101 0.113295 0.113487 0.114206 0.114038 0.113869 0.114642 0.114787 0.114932 0.115662 0.11554 0.115419 0.115301 0.115185 0.115075 0.11497 0.114872 0.114784 0.114707 0.11568 0.115647 0.116643 0.117631 0.117608 0.116647 0.116665 0.115727 0.115785 0.115854 0.115932 0.116016 0.116847 0.116788 0.116737 0.116696 0.117603 0.117599 0.118526 0.118562 0.118613 0.118681 0.118768 0.119793 0.119926 0.120965 0.121145 0.122195 0.121992 0.12181 0.120807 0.12067 0.119681 0.119587 0.11951 0.119449 0.120365 0.12045 0.120551 0.121507 0.121649 0.122618 0.122802 0.123007 0.123233 0.124257 0.124009 0.123783 0.124751 0.124999 0.125268 0.12556 0.126579 0.126915 0.127275 0.12832 0.128725 0.129157 0.129617 0.130105 0.130622 0.131743 0.131208 0.130702 0.131771 0.132296 0.132848 0.133937 0.133366 0.132824 0.13231 0.131275 0.130224 0.129773 0.129349 0.128949 0.127939 0.127584 0.127251 0.126267 0.125977 0.125708 0.12546 0.124524 0.123576 0.123389 0.122453 0.122305 0.121382 0.121273 0.121179 0.120294 0.119402 0.118505 0.118495 0.117618 0.117643 0.117677 0.117718 0.116912 0.116106 0.1162 0.116297 0.116397 0.117135 0.117057 0.116982 0.117765 0.117817 0.117874 0.118615 0.118579 0.118548 0.118523 0.118505 0.118495 0.119344 0.119367 0.120236 0.121098 0.12103 0.120189 0.120153 0.119331 0.119326 0.11933 0.119339 0.119355 0.120095 0.120099 0.120109 0.120127 0.120925 0.120972 0.121787 0.121865 0.121955 0.122058 0.122174 0.123066 0.123219 0.124124 0.124315 0.125231 0.12502 0.124825 0.12395 0.123792 0.122929 0.122805 0.122694 0.122596 0.123399 0.123517 0.123648 0.124483 0.124646 0.125492 0.12569 0.125904 0.126136 0.126385 0.126653 0.126942 0.127894 0.128223 0.128574 0.129551 0.129945 0.130363 0.130806 0.131823 0.131361 0.130925 0.130513 0.130124 0.12918 0.128832 0.128505 0.127586 0.127298 0.127029 0.126779 0.126546 0.127391 0.127642 0.127911 0.128199 0.129087 0.129412 0.129757 0.130669 0.131053 0.13146 0.13189 0.132344 0.132824 0.133329 0.133861 0.13442 0.135008 0.135626 0.136273 0.136951 0.137662 0.138404 0.139179 0.140338 0.141165 0.142322 0.143202 0.144118 0.145291 0.146262 0.147433 0.14846 0.149628 0.150712 0.151875 0.153015 0.151895 0.150773 0.14971 0.148582 0.147576 0.146444 0.145493 0.144357 0.14346 0.142598 0.141478 0.140667 0.139545 0.138785 0.138058 0.137362 0.138433 0.139145 0.13989 0.140976 0.14177 0.142854 0.143699 0.144578 0.145675 0.146607 0.1477 0.148685 0.149773 0.150814 0.151895 0.152993 0.15413 0.15531 0.156533 0.1578 0.159113 0.160274 0.161653 0.162804 0.164251 0.165747 0.167296 0.168474 0.166906 0.165392 0.166503 0.168035 0.169621 0.171262 0.172395 0.174111 0.175228 0.17702 0.17812 0.179991 0.181072 0.183022 0.18504 0.187125 0.189282 0.190391 0.192639 0.193723 0.196063 0.198481 0.200983 0.20207 0.199553 0.197119 0.194764 0.192486 0.19146 0.189271 0.188218 0.186116 0.187153 0.188149 0.190282 0.191251 0.193469 0.195762 0.198131 0.200579 0.20311 0.204102 0.201558 0.199097 0.200017 0.202491 0.205047 0.207689 0.208596 0.211336 0.212201 0.215043 0.217979 0.221013 0.221849 0.22499 0.228235 0.229025 0.232384 0.233116 0.229754 0.226501 0.225775 0.222627 0.21958 0.218807 0.215864 0.213013 0.213771 0.216629 0.217338 0.220295 0.223348 0.224012 0.227169 0.230425 0.233788 0.234399 0.231035 0.227777 0.228327 0.231586 0.23495 0.235443 0.232079 0.228819 0.225654 0.225164 0.224617 0.221555 0.220954 0.217991 0.215119 0.214473 0.211697 0.211003 0.210254 0.209451 0.206787 0.205942 0.203375 0.20089 0.198483 0.197622 0.196715 0.194409 0.192177 0.190017 0.189104 0.187027 0.186085 0.185103 0.184082 0.182116 0.180212 0.179184 0.177359 0.176311 0.174561 0.173495 0.171819 0.170736 0.169133 0.167584 0.168634 0.170199 0.171233 0.172869 0.173886 0.175593 0.17659 0.178371 0.179347 0.181203 0.183121 0.184088 0.182156 0.180286 0.178476 0.177551 0.175814 0.174868 0.173201 0.172234 0.170637 0.169652 0.168122 0.167119 0.166086 0.165022 0.163928 0.162514 0.161408 0.160059 0.158943 0.157658 0.158757 0.159829 0.161148 0.162208 0.163591 0.164638 0.163239 0.161888 0.160873 0.159582 0.158555 0.1575 0.156418 0.155221 0.154066 0.152952 0.153984 0.155115 0.156286 0.157325 0.156137 0.154991 0.155972 0.157134 0.158336 0.159321 0.160582 0.161554 0.162875 0.164241 0.165656 0.166643 0.165213 0.163832 0.162496 0.161205 0.160277 0.159044 0.158103 0.156926 0.157854 0.158753 0.159958 0.160843 0.162104 0.163408 0.164758 0.166154 0.167598 0.169092 0.17003 0.171589 0.172507 0.174133 0.17503 0.176725 0.177599 0.179363 0.181186 0.18307 0.185016 0.185903 0.187927 0.188784 0.190887 0.19306 0.195304 0.196153 0.193897 0.191712 0.192491 0.194687 0.196954 0.199295 0.201713 0.204209 0.204992 0.20758 0.20832 0.209006 0.206401 0.205723 0.203208 0.202486 0.200058 0.197706 0.195428 0.193222 0.193903 0.19612 0.198408 0.20077 0.201429 0.203876 0.204491 0.207025 0.209638 0.212336 0.21292 0.215709 0.218587 0.219126 0.222098 0.222586 0.219609 0.216723 0.216243 0.213449 0.210738 0.210215 0.207595 0.205053 0.205563 0.20811 0.208574 0.211207 0.213923 0.214345 0.217149 0.220039 0.223019 0.226089 0.229254 0.232515 0.235878 0.236258 0.232897 0.229636 0.229967 0.233228 0.236587 0.236866 0.23351 0.230251 0.227086 0.226802 0.226471 0.223399 0.220417 0.217524 0.21785 0.220746 0.223729 0.224012 0.221028 0.218131 0.21837 0.221268 0.224252 0.227325 0.230491 0.233747 0.237101 0.237294 0.233943 0.230689 0.230851 0.234103 0.23745 0.240893 0.241013 0.244548 0.244635 0.248264 0.251993 0.255823 0.259755 0.26379 0.267928 0.272171 0.276519 0.276525 0.280963 0.280954 0.285488 0.290117 0.290098 0.294822 0.285475 0.280946 0.276521 0.276524 0.272193 0.272187 0.267954 0.263823 0.259796 0.25982 0.263841 0.267967 0.267972 0.272194 0.263849 0.259831 0.255911 0.255897 0.25587 0.252046 0.248321 0.244695 0.244732 0.248356 0.252078 0.252094 0.248374 0.244752 0.241228 0.241207 0.241167 0.241104 0.237668 0.237574 0.23423 0.23098 0.227819 0.227688 0.227525 0.224452 0.221468 0.218569 0.218734 0.221632 0.224617 0.224748 0.221765 0.218866 0.21605 0.215919 0.215755 0.215556 0.215319 0.21504 0.214716 0.211992 0.211624 0.208986 0.206427 0.20602 0.203543 0.203092 0.20259 0.202036 0.199656 0.199058 0.196761 0.194535 0.195115 0.197349 0.197887 0.200203 0.200697 0.201141 0.198811 0.198374 0.196122 0.195644 0.193468 0.192948 0.192377 0.191755 0.191084 0.190364 0.189597 0.187549 0.186748 0.184776 0.183944 0.182047 0.182867 0.183645 0.185566 0.186311 0.188305 0.189015 0.187009 0.185067 0.184379 0.182509 0.181786 0.181019 0.180211 0.178435 0.176715 0.175891 0.174239 0.173391 0.171804 0.170934 0.169413 0.168522 0.167064 0.165654 0.166518 0.167941 0.168786 0.17027 0.171093 0.17264 0.173439 0.175051 0.175824 0.177499 0.179231 0.179986 0.178243 0.176556 0.174923 0.174201 0.172631 0.171881 0.170373 0.169597 0.168149 0.16735 0.165961 0.165141 0.16429 0.162973 0.161698 0.160468 0.159625 0.158448 0.15759 0.156704 0.155791 0.154851 0.153885 0.152894 0.151878 0.150837 0.149818 0.14877 0.147805 0.146751 0.145838 0.144779 0.143917 0.143089 0.142043 0.141264 0.140214 0.139485 0.140518 0.141532 0.142294 0.143304 0.144115 0.144959 0.145981 0.146875 0.147891 0.148836 0.149845 0.150842 0.151843 0.152819 0.15179 0.150829 0.149853 0.148883 0.147957 0.14698 0.146104 0.14512 0.144294 0.143499 0.142525 0.141778 0.1408 0.139803 0.138786 0.137751 0.136697 0.136063 0.135457 0.13488 0.135883 0.136477 0.137099 0.138118 0.137478 0.136868 0.136284 0.135316 0.134331 0.133808 0.133312 0.13284 0.133774 0.134263 0.134777 0.135728 0.135198 0.134692 0.135594 0.136116 0.136662 0.137235 0.137835 0.138462 0.139118 0.140099 0.139427 0.138784 0.139714 0.140373 0.141061 0.142003 0.142736 0.143673 0.144452 0.145262 0.146208 0.147066 0.148005 0.148912 0.149843 0.150799 0.15172 0.152726 0.15377 0.154695 0.153637 0.152617 0.153489 0.154522 0.155594 0.156467 0.155382 0.154334 0.153323 0.152491 0.151633 0.15075 0.149815 0.148922 0.148035 0.147133 0.146293 0.145383 0.144589 0.143827 0.142925 0.142207 0.1413 0.140625 0.139979 0.139083 0.138168 0.137579 0.137017 0.136479 0.137347 0.1379 0.138478 0.139359 0.138766 0.138198 0.139031 0.139614 0.140222 0.140856 0.141517 0.14239 0.143094 0.14396 0.144707 0.145485 0.146358 0.14718 0.148045 0.148914 0.149769 0.150684 0.151529 0.152348 0.151408 0.1506 0.149706 0.148888 0.148038 0.147209 0.146405 0.145567 0.144806 0.144074 0.143242 0.142552 0.141714 0.141065 0.140443 0.139846 0.140643 0.141253 0.141889 0.142694 0.14337 0.144168 0.144885 0.14563 0.146432 0.14722 0.148013 0.148844 0.149626 0.150501 0.151271 0.15219 0.153142 0.15413 0.155154 0.156214 0.157312 0.158129 0.159278 0.160079 0.161281 0.162524 0.163811 0.164618 0.163319 0.162064 0.162816 0.164083 0.165393 0.166748 0.167501 0.168913 0.169641 0.171112 0.171812 0.173342 0.174012 0.175602 0.177247 0.178944 0.180698 0.181365 0.183186 0.183816 0.185708 0.18766 0.189676 0.190287 0.188262 0.1863 0.184399 0.182558 0.181985 0.180211 0.1796 0.177893 0.178493 0.179046 0.180774 0.181289 0.183083 0.184933 0.186843 0.188814 0.190849 0.191361 0.189317 0.187338 0.187784 0.189772 0.191824 0.193939 0.194362 0.196552 0.196934 0.1992 0.201535 0.203944 0.204298 0.206785 0.209349 0.209666 0.212312 0.212589 0.209939 0.207367 0.207098 0.204606 0.202187 0.201883 0.199543 0.197271 0.197565 0.199842 0.2001 0.202449 0.204872 0.2051 0.207597 0.210173 0.212824 0.213021 0.210368 0.207791 0.207952 0.21053 0.213184 0.213316 0.210661 0.208082 0.205578 0.205449 0.205291 0.202863 0.202674 0.200321 0.198037 0.19782 0.195608 0.195358 0.195069 0.194737 0.192608 0.192239 0.19018 0.188184 0.186249 0.185857 0.185419 0.183559 0.181757 0.180012 0.179553 0.17787 0.177373 0.176829 0.176238 0.174638 0.173087 0.172471 0.17098 0.170331 0.168898 0.168219 0.166842 0.166135 0.164814 0.163536 0.164223 0.165511 0.166171 0.167511 0.168141 0.169538 0.170134 0.171586 0.172148 0.173658 0.175218 0.175752 0.174183 0.172664 0.171194 0.170687 0.169272 0.168729 0.167369 0.166791 0.165484 0.164873 0.163618 0.162977 0.162301 0.161591 0.16085 0.159677 0.158917 0.157795 0.157018 0.155946 0.156711 0.157448 0.158543 0.159263 0.160407 0.161107 0.159952 0.158836 0.158157 0.157088 0.15639 0.155664 0.154911 0.153911 0.152946 0.152015 0.152735 0.153677 0.154653 0.155368 0.154381 0.153429 0.154096 0.155059 0.156056 0.156715 0.157757 0.158395 0.159483 0.160609 0.161773 0.162404 0.161231 0.160097 0.159 0.157941 0.157344 0.156329 0.155708 0.154736 0.155347 0.155928 0.156917 0.15747 0.158501 0.159568 0.160673 0.161816 0.162997 0.16422 0.164781 0.166053 0.166579 0.167903 0.168392 0.16977 0.170223 0.171655 0.173135 0.174663 0.176241 0.176683 0.178321 0.178726 0.180426 0.182179 0.18399 0.184374 0.182556 0.180796 0.179088 0.177435 0.17708 0.175486 0.175096 0.17356 0.173942 0.174282 0.175834 0.176141 0.17775 0.17941 0.181124 0.182891 0.184716 0.186598 0.188539 0.190542 0.190861 0.192933 0.193217 0.193463 0.191382 0.19114 0.189126 0.188853 0.186905 0.185017 0.183186 0.181412 0.181664 0.183443 0.18528 0.187173 0.187405 0.189362 0.189565 0.191588 0.193673 0.195822 0.196002 0.198221 0.200507 0.200662 0.20302 0.203148 0.200788 0.198498 0.198374 0.196153 0.193998 0.193851 0.191762 0.189736 0.189878 0.191907 0.192025 0.194118 0.196275 0.196371 0.198595 0.200886 0.203247 0.205678 0.208183 0.210762 0.213419 0.216153 0.218969 0.221868 0.22485 0.22792 0.231078 0.234327 0.234396 0.237733 0.237775 0.237797 0.234462 0.234438 0.231191 0.231147 0.227992 0.224922 0.22194 0.219043 0.21909 0.221986 0.224968 0.228037 0.228061 0.231216 0.224993 0.222012 0.219116 0.2163 0.216274 0.216227 0.213493 0.210835 0.208256 0.208303 0.210883 0.21354 0.213566 0.210909 0.20833 0.205824 0.205798 0.20575 0.203318 0.200958 0.198665 0.198711 0.201004 0.203365 0.203391 0.20103 0.198736 0.19651 0.196484 0.19644 0.194281 0.194213 0.192118 0.190085 0.189994 0.188024 0.18791 0.187771 0.187603 0.185701 0.185507 0.183666 0.181882 0.182068 0.183856 0.184017 0.185866 0.186002 0.186113 0.18426 0.184151 0.182356 0.182225 0.180487 0.180333 0.180151 0.179938 0.179692 0.178026 0.176411 0.174847 0.174583 0.173073 0.172779 0.172446 0.172072 0.170632 0.169238 0.168837 0.167496 0.16706 0.16577 0.165297 0.164059 0.16355 0.16236 0.161209 0.161702 0.16286 0.163317 0.164523 0.164944 0.166199 0.166584 0.167889 0.16824 0.169597 0.170998 0.171324 0.169915 0.168551 0.167231 0.166927 0.165657 0.165321 0.164099 0.16373 0.162556 0.162151 0.161024 0.160582 0.160097 0.159022 0.157983 0.15698 0.156473 0.155511 0.154972 0.1544 0.153797 0.153166 0.152509 0.151826 0.151117 0.150384 0.149529 0.148783 0.147971 0.147213 0.146442 0.145674 0.144945 0.144243 0.143479 0.142817 0.142045 0.141421 0.14218 0.14292 0.143568 0.1443 0.144987 0.1457 0.146434 0.147188 0.147911 0.148705 0.149416 0.150251 0.150949 0.151622 0.150765 0.150103 0.149287 0.148611 0.147835 0.147146 0.146409 0.145709 0.14501 0.144338 0.143639 0.143004 0.142296 0.141569 0.140823 0.140058 0.139275 0.138473 0.137655 0.136819 0.135966 0.135097 0.134211 0.13331 0.132393 0.131968 0.131566 0.131186 0.130306 0.129963 0.12964 0.128782 0.128495 0.128225 0.127973 0.127156 0.126329 0.126127 0.125309 0.12514 0.124332 0.124195 0.12407 0.123292 0.122508 0.121719 0.12166 0.120887 0.120856 0.120833 0.121569 0.121611 0.122362 0.12243 0.123195 0.123955 0.123851 0.123109 0.123031 0.122302 0.122249 0.121534 0.120816 0.120096 0.119376 0.118655 0.117934 0.117215 0.116498 0.115785 0.115076 0.114373 0.113676 0.112988 0.112309 0.111642 0.110988 0.110348 0.109723 0.109111 0.108513 0.107934 0.107394 0.106916 0.106523 0.106221 0.105996 0.105824 0.105683 0.10556 0.105445 0.10533 0.105208 0.105055 0.104844 0.10538 0.105884 0.106357 0.1068 0.107214 0.1076 0.107958 0.108288 0.10859 0.108866 0.109116 0.10934 0.109538 0.10971 0.109855 0.109807 0.109673 0.109514 0.109331 0.109123 0.10889 0.108631 0.108346 0.108034 0.107696 0.10733 0.106935 0.106511 0.106057 0.105572 0.105707 0.106175 0.106613 0.106684 0.106263 0.105812 0.105909 0.106344 0.10675 0.107129 0.107077 0.10702 0.107399 0.107748 0.10807 0.108091 0.10778 0.107442 0.107481 0.107806 0.108105 0.108116 0.10783 0.107519 0.107181 0.106817 0.106426 0.106007 0.106113 0.106516 0.106892 0.106988 0.106625 0.106238 0.106396 0.106773 0.107127 0.107461 0.107326 0.107242 0.107566 0.107865 0.10814 0.108206 0.107934 0.107641 0.107774 0.10807 0.10835 0.108615 0.10846 0.108393 0.108376 0.108377 0.108377 0.108367 0.108639 0.108885 0.109106 0.10908 0.108871 0.108637 0.108624 0.108846 0.109043 0.109217 0.109264 0.109302 0.109474 0.109621 0.109747 0.109678 0.10956 0.109423 0.109369 0.109501 0.109617 0.109602 0.109477 0.109339 0.109186 0.109015 0.108824 0.108612 0.108623 0.108835 0.10903 0.10913 0.108919 0.108697 0.108868 0.10911 0.109343 0.109566 0.10933 0.109209 0.109377 0.109534 0.109683 0.109882 0.109705 0.109522 0.10978 0.109984 0.110176 0.110356 0.11005 0.109825 0.109718 0.109718 0.109778 0.109851 0.109917 0.109974 0.110067 0.110135 0.11018 0.110206 0.110219 0.110169 0.110149 0.110117 0.110071 0.110004 0.109935 0.11 0.11005 0.109983 0.109927 0.109861 0.109806 0.109885 0.109959 0.110031 0.110033 0.110087 0.110114 0.110073 0.110096 0.110223 0.110133 0.110033 0.109931 0.109826 0.109963 0.110095 0.110224 0.1105 0.110359 0.110209 0.110522 0.110674 0.110814 0.110939 0.110628 0.110345 0.11045 0.110735 0.11104 0.111347 0.111254 0.111137 0.111004 0.110858 0.110696 0.110518 0.110324 0.110114 0.109891 0.109655 0.109407 0.109148 0.108877 0.108596 0.108302 0.107996 0.107676 0.10734 0.106986 0.106614 0.106914 0.107287 0.107645 0.108044 0.107682 0.107307 0.107781 0.108153 0.108511 0.108854 0.108391 0.107989 0.108319 0.108635 0.10894 0.109349 0.109044 0.108725 0.109181 0.109493 0.10979 0.110243 0.10996 0.109662 0.109347 0.109017 0.108672 0.108311 0.108871 0.109215 0.109543 0.11008 0.109772 0.109448 0.110038 0.11034 0.11063 0.110907 0.110375 0.109856 0.110154 0.110437 0.110705 0.111177 0.110923 0.110656 0.111171 0.111423 0.111663 0.11189 0.111417 0.110958 0.11051 0.110071 0.109639 0.109231 0.10951 0.109775 0.110026 0.110418 0.110174 0.109915 0.110335 0.110583 0.110816 0.111032 0.110645 0.110261 0.110481 0.110685 0.110872 0.111228 0.11105 0.110855 0.111232 0.111417 0.111587 0.111955 0.111793 0.111616 0.111425 0.111219 0.110998 0.110762 0.111197 0.111421 0.111632 0.112058 0.111857 0.111644 0.112106 0.112308 0.112499 0.112678 0.112246 0.111828 0.112011 0.11218 0.112336 0.11273 0.112582 0.11242 0.112844 0.112998 0.113139 0.113561 0.113427 0.113282 0.113124 0.112955 0.112775 0.112583 0.112379 0.112165 0.111939 0.111702 0.111453 0.111194 0.110923 0.110641 0.111259 0.111521 0.111773 0.112366 0.112133 0.111892 0.112537 0.112759 0.112973 0.11318 0.112591 0.112015 0.112247 0.112469 0.112681 0.113211 0.113013 0.112807 0.113379 0.11357 0.113753 0.114305 0.114137 0.113962 0.11378 0.113591 0.113396 0.113195 0.113862 0.114043 0.114219 0.114855 0.114698 0.114537 0.115219 0.11536 0.115499 0.115634 0.115008 0.11439 0.114555 0.114714 0.114867 0.115438 0.1153 0.115156 0.115766 0.115893 0.116016 0.116135 0.11557 0.115014 0.114466 0.113927 0.113399 0.112883 0.113074 0.113254 0.113424 0.113905 0.113746 0.113578 0.114093 0.11425 0.114397 0.114536 0.114054 0.113583 0.113732 0.113869 0.113994 0.114439 0.114321 0.114193 0.114665 0.114784 0.114894 0.115358 0.115257 0.115147 0.115027 0.114899 0.114763 0.114618 0.115153 0.115286 0.115411 0.11593 0.115817 0.115697 0.116248 0.116356 0.116458 0.116554 0.116037 0.115528 0.115637 0.115738 0.115831 0.116313 0.116228 0.116136 0.116643 0.116726 0.116802 0.116871 0.116389 0.115915 0.115449 0.114993 0.114546 0.114109 0.113682 0.113268 0.112866 0.112477 0.112103 0.111741 0.111389 0.111042 0.111196 0.111335 0.111461 0.111787 0.111667 0.111536 0.111881 0.112007 0.112121 0.112218 0.111889 0.11157 0.111656 0.11197 0.112294 0.11263 0.112558 0.112466 0.112357 0.112236 0.112605 0.112721 0.112825 0.113197 0.113098 0.112988 0.113384 0.113488 0.113581 0.113658 0.113279 0.112912 0.11298 0.113343 0.113718 0.114105 0.11405 0.113977 0.11389 0.113792 0.114211 0.114304 0.114385 0.114803 0.114727 0.114641 0.115082 0.115161 0.115231 0.115288 0.114865 0.114452 0.114503 0.114912 0.115332 0.115761 0.115721 0.115669 0.115605 0.115531 0.11599 0.116057 0.116115 0.116571 0.116518 0.116457 0.116932 0.116986 0.117034 0.117073 0.116614 0.116163 0.116199 0.116647 0.117102 0.117565 0.117539 0.117504 0.117462 0.117414 0.11736 0.117298 0.117231 0.117157 0.117077 0.116992 0.116902 0.116806 0.116706 0.116601 0.116493 0.116381 0.116266 0.116149 0.116029 0.115907 0.1166 0.116702 0.116804 0.117464 0.11738 0.117297 0.117997 0.118061 0.118127 0.118193 0.117547 0.116904 0.117003 0.117099 0.117193 0.117789 0.11771 0.117629 0.118259 0.118325 0.118389 0.118993 0.118943 0.118892 0.118842 0.118792 0.118744 0.118698 0.1194 0.119429 0.11946 0.120128 0.120114 0.120103 0.120805 0.120799 0.120797 0.120798 0.120145 0.119493 0.119528 0.119564 0.1196 0.120209 0.120186 0.120165 0.120803 0.12081 0.120819 0.12083 0.120233 0.119637 0.119043 0.118453 0.117866 0.117283 0.11737 0.117454 0.117533 0.118079 0.118011 0.11794 0.118514 0.118573 0.11863 0.118684 0.118143 0.117607 0.117677 0.117742 0.117801 0.11831 0.118259 0.118203 0.118734 0.118781 0.118824 0.119343 0.119308 0.11927 0.119229 0.119185 0.11914 0.119092 0.119673 0.119709 0.119744 0.120305 0.120281 0.120257 0.120843 0.120856 0.120869 0.120883 0.120329 0.119777 0.119809 0.119839 0.119866 0.120392 0.120373 0.120351 0.120896 0.120909 0.120921 0.121452 0.121448 0.121443 0.121438 0.121434 0.121431 0.121429 0.121429 0.12143 0.121434 0.121441 0.12145 0.121464 0.121483 0.121506 0.122204 0.122165 0.122131 0.122796 0.122845 0.1229 0.122962 0.12367 0.123756 0.124476 0.124588 0.124709 0.124841 0.124985 0.125767 0.12594 0.126732 0.126936 0.127736 0.127514 0.127306 0.126541 0.126363 0.125606 0.125457 0.125319 0.125191 0.1259 0.126043 0.126197 0.12693 0.127112 0.127853 0.128063 0.128287 0.128525 0.128779 0.129049 0.129335 0.130164 0.130486 0.130826 0.131675 0.132052 0.132449 0.132868 0.133753 0.133318 0.132904 0.132511 0.132138 0.131318 0.130981 0.130661 0.129861 0.129574 0.129304 0.12905 0.12881 0.129548 0.129803 0.130073 0.130358 0.131131 0.131449 0.131784 0.132575 0.132944 0.133333 0.133742 0.134171 0.134623 0.135476 0.135009 0.134564 0.135372 0.135832 0.136314 0.137135 0.136638 0.136164 0.135711 0.134933 0.13414 0.133736 0.133352 0.132987 0.132224 0.131891 0.131575 0.13083 0.130545 0.130275 0.13002 0.129307 0.128585 0.128372 0.127656 0.127471 0.126761 0.126602 0.126455 0.125767 0.125073 0.124374 0.124281 0.123592 0.123522 0.123458 0.1234 0.122752 0.122102 0.122078 0.122058 0.122041 0.122651 0.122681 0.122714 0.123349 0.123302 0.12326 0.123867 0.123921 0.12398 0.124045 0.124117 0.124195 0.124865 0.124965 0.125644 0.126317 0.126189 0.125529 0.125423 0.124772 0.124687 0.124609 0.124537 0.124472 0.125073 0.12515 0.125234 0.125325 0.125958 0.126069 0.12671 0.126842 0.126984 0.127136 0.127298 0.127986 0.128173 0.128867 0.129081 0.129779 0.129552 0.129337 0.128665 0.128476 0.12781 0.127644 0.12749 0.127345 0.127973 0.12813 0.128298 0.128944 0.129134 0.129784 0.13 0.130227 0.130468 0.130723 0.130992 0.131276 0.131995 0.132309 0.132639 0.133374 0.133736 0.134116 0.134515 0.135278 0.134865 0.134472 0.134096 0.133739 0.13303 0.132703 0.132392 0.131698 0.131415 0.131147 0.130894 0.130653 0.131297 0.131549 0.131816 0.132096 0.132766 0.133075 0.133399 0.134081 0.134435 0.134805 0.135193 0.1356 0.136027 0.136473 0.13694 0.137429 0.137939 0.138727 0.138202 0.1377 0.138443 0.138959 0.139497 0.140249 0.139698 0.13917 0.138664 0.13795 0.137219 0.13676 0.13632 0.135901 0.136593 0.137026 0.137478 0.138179 0.137715 0.137271 0.137933 0.138389 0.138864 0.139361 0.139879 0.140419 0.140982 0.141698 0.141123 0.140571 0.141244 0.141807 0.142394 0.143071 0.143692 0.14436 0.145017 0.1457 0.146368 0.147088 0.147743 0.148501 0.149143 0.14994 0.150568 0.151403 0.152269 0.15289 0.152015 0.151171 0.151749 0.152601 0.153485 0.15405 0.153159 0.152299 0.151468 0.150926 0.150356 0.149762 0.148985 0.148376 0.147636 0.147013 0.14631 0.145674 0.145007 0.144364 0.143728 0.14312 0.142473 0.141899 0.141348 0.140703 0.140041 0.139533 0.139046 0.138579 0.139209 0.139686 0.140184 0.140818 0.14031 0.139822 0.139354 0.138751 0.138132 0.137496 0.136846 0.13618 0.1355 0.135117 0.134751 0.134403 0.133745 0.133425 0.13312 0.132473 0.132195 0.131931 0.132554 0.13283 0.133453 0.133754 0.134071 0.134704 0.135048 0.135408 0.135785 0.136439 0.136051 0.135679 0.135325 0.134987 0.134377 0.134064 0.133767 0.133166 0.132894 0.132292 0.13168 0.131058 0.130426 0.130211 0.129581 0.12939 0.128764 0.128595 0.128436 0.127826 0.127209 0.126586 0.126471 0.125855 0.12576 0.125671 0.125589 0.125002 0.124411 0.123818 0.123223 0.122625 0.122027 0.122016 0.122007 0.122 0.122566 0.122583 0.122603 0.123189 0.123159 0.123132 0.123109 0.122552 0.121995 0.121991 0.121987 0.121985 0.122519 0.122528 0.122539 0.123088 0.123069 0.123053 0.123586 0.12361 0.123636 0.123665 0.123697 0.123734 0.123774 0.124356 0.124306 0.124261 0.124822 0.124877 0.124937 0.125514 0.125445 0.125381 0.125323 0.124773 0.12422 0.124183 0.124149 0.124119 0.124651 0.124687 0.124728 0.125271 0.125223 0.125181 0.125143 0.124619 0.124093 0.123566 0.123038 0.12251 0.121983 0.121457 0.120932 0.12041 0.119891 0.119375 0.118863 0.118357 0.117855 0.117903 0.117945 0.117982 0.118466 0.118434 0.118398 0.118898 0.118929 0.118956 0.118978 0.118492 0.118013 0.118035 0.118512 0.118994 0.119482 0.119468 0.11945 0.119429 0.119404 0.119913 0.119933 0.11995 0.120453 0.120441 0.120426 0.120943 0.120951 0.120959 0.120965 0.120463 0.119964 0.119974 0.12047 0.12097 0.121473 0.121471 0.121468 0.121465 0.121461 0.121982 0.12198 0.121979 0.122492 0.122497 0.122503 0.123025 0.123014 0.123005 0.122997 0.122487 0.121978 0.121977 0.122484 0.122991 0.123498 0.123508 0.123519 0.123532 0.123548 0.12407 0.124049 0.124032 0.124544 0.124565 0.12459 0.125109 0.12508 0.125055 0.125034 0.124527 0.124018 0.124006 0.124513 0.125018 0.125521 0.12554 0.125564 0.125593 0.125626 0.125665 0.125708 0.125757 0.125811 0.125871 0.125937 0.126009 0.126088 0.126173 0.126265 0.126364 0.126964 0.127082 0.127688 0.128287 0.128147 0.127559 0.127438 0.126854 0.126752 0.126657 0.12657 0.126489 0.127037 0.127126 0.127222 0.127326 0.127895 0.128017 0.12859 0.12873 0.12888 0.129039 0.129209 0.129816 0.130007 0.130617 0.130831 0.131442 0.131217 0.131004 0.130414 0.130223 0.129635 0.129465 0.129306 0.129156 0.129715 0.129874 0.130043 0.130613 0.130803 0.131374 0.131585 0.131808 0.132044 0.132635 0.132389 0.132157 0.132718 0.13296 0.133216 0.133484 0.134064 0.134357 0.134664 0.135251 0.135584 0.135932 0.136297 0.136679 0.137079 0.137703 0.137293 0.136901 0.13749 0.137892 0.138312 0.138906 0.138476 0.138065 0.137671 0.137106 0.136526 0.136168 0.135826 0.135499 0.134934 0.134632 0.134344 0.133786 0.133521 0.13327 0.133032 0.132489 0.131936 0.131728 0.131175 0.130988 0.130435 0.130267 0.13011 0.129566 0.129016 0.128459 0.128337 0.127782 0.127677 0.127581 0.127492 0.126956 0.126415 0.126348 0.126287 0.126232 0.126753 0.126814 0.126881 0.12741 0.127336 0.12727 0.127782 0.127854 0.127934 0.128023 0.128119 0.128224 0.128764 0.128885 0.129427 0.129963 0.129826 0.129298 0.129178 0.128652 0.128548 0.128453 0.128367 0.12829 0.128792 0.128875 0.128967 0.129068 0.129582 0.129699 0.130212 0.130346 0.130491 0.130646 0.130811 0.131347 0.131532 0.132067 0.132272 0.132807 0.132594 0.132393 0.131875 0.131693 0.131174 0.131011 0.13086 0.130719 0.131217 0.131365 0.131523 0.132027 0.132204 0.132706 0.132902 0.13311 0.133331 0.133565 0.133811 0.134071 0.134609 0.134891 0.135188 0.135731 0.136051 0.136387 0.136738 0.137294 0.136934 0.13659 0.137116 0.137468 0.137837 0.138222 0.138624 0.139045 0.139484 0.139941 0.140419 0.140916 0.141434 0.141974 0.142535 0.143152 0.143747 0.144353 0.14498 0.145632 0.146236 0.146923 0.147514 0.148236 0.148813 0.14957 0.150132 0.150667 0.149894 0.149366 0.148628 0.148082 0.147378 0.146818 0.146148 0.145575 0.144939 0.144326 0.143749 0.143169 0.142581 0.142032 0.141504 0.140998 0.141559 0.142074 0.142611 0.14317 0.143737 0.144285 0.144882 0.145503 0.146046 0.1467 0.147229 0.147916 0.14843 0.149149 0.149643 0.150394 0.151173 0.15198 0.152817 0.153683 0.154581 0.155075 0.156011 0.156469 0.157444 0.158454 0.1595 0.159934 0.158882 0.157865 0.158242 0.159265 0.160325 0.161421 0.161777 0.162918 0.16324 0.164428 0.164719 0.165954 0.166215 0.167499 0.168825 0.170196 0.171611 0.171863 0.173331 0.173556 0.175077 0.176646 0.178267 0.178475 0.176849 0.175275 0.173749 0.17227 0.172082 0.170655 0.170442 0.169065 0.169273 0.169452 0.170839 0.170996 0.172431 0.173914 0.175444 0.177023 0.178653 0.178803 0.17717 0.175587 0.175707 0.177292 0.178928 0.180615 0.180719 0.182463 0.182546 0.184345 0.186201 0.188114 0.188179 0.190151 0.192185 0.192229 0.194325 0.19435 0.192254 0.190219 0.190194 0.188222 0.186307 0.186265 0.184408 0.182608 0.182648 0.184449 0.184472 0.18633 0.188245 0.182671 0.180923 0.180901 0.180862 0.180801 0.17911 0.17903 0.177391 0.175804 0.174265 0.17417 0.174054 0.172567 0.171128 0.169733 0.169605 0.168258 0.16811 0.167935 0.167733 0.166443 0.165196 0.164974 0.163772 0.163524 0.162368 0.162091 0.160981 0.160673 0.159607 0.158576 0.158871 0.159908 0.160172 0.161251 0.161487 0.16261 0.162821 0.163989 0.164176 0.165388 0.166641 0.166811 0.165553 0.164336 0.163158 0.163002 0.161868 0.161692 0.160601 0.160402 0.159353 0.159129 0.158121 0.15787 0.157582 0.157254 0.156883 0.155935 0.155527 0.154618 0.154171 0.153299 0.15374 0.154138 0.155021 0.155379 0.1563 0.156621 0.155695 0.154801 0.154491 0.153634 0.153286 0.152894 0.152457 0.151645 0.150861 0.150105 0.150529 0.151289 0.152077 0.152465 0.151673 0.15091 0.151245 0.152012 0.152808 0.153107 0.153939 0.154203 0.15507 0.15597 0.156903 0.157148 0.15621 0.155304 0.15443 0.153588 0.153366 0.15256 0.152307 0.151535 0.151784 0.151995 0.152777 0.152961 0.153778 0.154626 0.155505 0.156416 0.157361 0.158339 0.158527 0.159546 0.159712 0.160772 0.160918 0.162019 0.162147 0.16329 0.164472 0.165693 0.166955 0.167077 0.168384 0.168487 0.169841 0.171238 0.17268 0.172773 0.171328 0.169928 0.169997 0.171399 0.172846 0.174339 0.17588 0.17747 0.177527 0.179169 0.179207 0.179229 0.177586 0.177565 0.175972 0.175936 0.174394 0.172899 0.17145 0.170047 0.17008 0.171484 0.172933 0.174429 0.174449 0.175993 0.172953 0.171503 0.170098 0.168737 0.168719 0.168687 0.168639 0.168572 0.167259 0.167177 0.165909 0.165811 0.164586 0.164681 0.164758 0.165988 0.166051 0.167324 0.167371 0.166097 0.164863 0.164818 0.163626 0.163567 0.163493 0.163401 0.162255 0.161146 0.161042 0.159974 0.159854 0.158826 0.158689 0.1577 0.157543 0.156593 0.155677 0.155823 0.156745 0.156873 0.157832 0.157944 0.158941 0.159038 0.160074 0.160157 0.161232 0.162343 0.162415 0.161301 0.160224 0.159182 0.159118 0.158113 0.158037 0.15707 0.15698 0.15605 0.155946 0.155053 0.154934 0.154792 0.153939 0.153118 0.152326 0.152175 0.151417 0.151243 0.151037 0.150793 0.150506 0.150175 0.149797 0.149376 0.148918 0.14822 0.147737 0.147069 0.146568 0.145932 0.145417 0.144812 0.144229 0.14371 0.143157 0.142625 0.142102 0.142626 0.14313 0.143669 0.144161 0.144729 0.145319 0.145805 0.146425 0.146897 0.147546 0.147995 0.148673 0.149091 0.149466 0.148783 0.14841 0.147754 0.147342 0.146712 0.146271 0.145668 0.145208 0.144634 0.144082 0.143615 0.143091 0.142612 0.142115 0.141599 0.141064 0.140511 0.140045 0.139597 0.139168 0.139696 0.140133 0.140589 0.141116 0.140653 0.140208 0.139782 0.139278 0.138757 0.138364 0.137988 0.137628 0.138125 0.138492 0.138876 0.139373 0.138982 0.138608 0.139076 0.139457 0.139854 0.140269 0.140702 0.141154 0.141625 0.142115 0.141638 0.141179 0.141638 0.142103 0.142587 0.14304 0.14355 0.143992 0.144529 0.145088 0.14552 0.146105 0.146512 0.147122 0.147492 0.148126 0.148451 0.14911 0.149795 0.150078 0.14939 0.148729 0.148962 0.149626 0.150318 0.15052 0.149824 0.149155 0.148513 0.148324 0.148094 0.147817 0.147207 0.146882 0.146295 0.145925 0.14536 0.144957 0.144415 0.143894 0.143476 0.142979 0.142549 0.142079 0.141627 0.141192 0.14074 0.140318 0.139915 0.139528 0.139964 0.140356 0.140765 0.141194 0.140779 0.140382 0.140784 0.141186 0.141607 0.142045 0.142503 0.14291 0.143392 0.143786 0.144291 0.144815 0.145185 0.145729 0.146056 0.146621 0.146897 0.147483 0.147711 0.147898 0.147307 0.147124 0.14656 0.146333 0.145792 0.145513 0.14499 0.14466 0.144155 0.143668 0.143301 0.142834 0.142448 0.142004 0.141578 0.141171 0.141543 0.141956 0.142386 0.14275 0.1432 0.143537 0.144003 0.144487 0.144773 0.145272 0.145501 0.146019 0.146199 0.146741 0.146885 0.147454 0.148049 0.148669 0.149315 0.149988 0.150689 0.15083 0.151563 0.151686 0.152453 0.153249 0.154076 0.154191 0.153359 0.152559 0.152646 0.153451 0.154286 0.155152 0.155235 0.156136 0.156207 0.157143 0.157203 0.158175 0.158224 0.159233 0.160276 0.161356 0.162472 0.162513 0.163669 0.163697 0.164892 0.166127 0.167402 0.16742 0.166143 0.164908 0.163713 0.162555 0.16254 0.161421 0.161396 0.160315 0.160339 0.160353 0.161436 0.159307 0.159293 0.159269 0.158259 0.157283 0.157249 0.156308 0.156264 0.155357 0.155302 0.15443 0.154365 0.153527 0.152718 0.152777 0.153588 0.153638 0.154482 0.154522 0.155399 0.15543 0.15634 0.156361 0.157305 0.158282 0.158295 0.157317 0.156373 0.155461 0.15545 0.15457 0.154551 0.153703 0.153676 0.15286 0.152824 0.152039 0.151995 0.151939 0.151871 0.151787 0.151045 0.150947 0.150237 0.150125 0.149447 0.149555 0.149643 0.15033 0.150406 0.151124 0.15119 0.150468 0.149774 0.149715 0.149052 0.148984 0.148899 0.148796 0.148171 0.147572 0.146999 0.147089 0.147667 0.14827 0.14835 0.147743 0.147161 0.147217 0.147803 0.148414 0.148466 0.149106 0.14915 0.14982 0.150517 0.151242 0.151284 0.150556 0.149856 0.149184 0.148537 0.148506 0.147888 0.147851 0.147261 0.147295 0.147321 0.147917 0.147938 0.148561 0.149209 0.149884 0.150586 0.151316 0.152073 0.152098 0.152886 0.152903 0.153721 0.153731 0.15458 0.152912 0.152122 0.152113 0.151353 0.151338 0.150608 0.149904 0.149917 0.150621 0.150629 0.151362 0.149924 0.149246 0.149239 0.149228 0.148578 0.147953 0.147354 0.147341 0.146768 0.146751 0.146728 0.146696 0.146656 0.146603 0.146536 0.14645 0.14634 0.145819 0.145681 0.145185 0.145005 0.144529 0.144293 0.143832 0.143388 0.143089 0.142657 0.142318 0.141902 0.142242 0.14255 0.142961 0.143216 0.143636 0.144073 0.144259 0.144712 0.144848 0.145322 0.145425 0.145926 0.146008 0.146071 0.145562 0.145503 0.145022 0.144948 0.144494 0.144396 0.143965 0.143827 0.143413 0.143018 0.142813 0.142425 0.142155 0.141842 0.141504 0.141149 0.140781 0.140399 0.140002 0.139589 0.139158 0.138712 0.13825 0.137774 0.137284 0.13678 0.136262 0.135949 0.135426 0.135136 0.13486 0.134341 0.134087 0.133845 0.133617 0.133402 0.133891 0.134114 0.134349 0.134598 0.135097 0.135367 0.135651 0.136153 0.136459 0.136956 0.136643 0.136345 0.135862 0.135586 0.135323 0.134842 0.134599 0.13437 0.134154 0.133682 0.133199 0.133008 0.132522 0.13235 0.131862 0.131708 0.131565 0.131081 0.130588 0.130089 0.129975 0.129474 0.129376 0.129288 0.129777 0.129871 0.130359 0.130469 0.130955 0.131434 0.131314 0.13084 0.130737 0.130261 0.130172 0.129694 0.129209 0.128717 0.12822 0.127718 0.127211 0.126699 0.126184 0.12614 0.126102 0.12607 0.126573 0.126609 0.126651 0.127158 0.127112 0.127072 0.12704 0.126544 0.126043 0.126022 0.12652 0.127015 0.127505 0.127533 0.127568 0.127611 0.127661 0.128159 0.128105 0.128058 0.128544 0.128594 0.128652 0.129139 0.129077 0.129024 0.128981 0.128504 0.128021 0.127991 0.128472 0.128948 0.129417 0.129453 0.129498 0.129554 0.129619 0.130094 0.130024 0.129965 0.130426 0.130488 0.130561 0.130644 0.131108 0.131205 0.131666 0.13178 0.131905 0.132042 0.13219 0.132664 0.13283 0.1333 0.133485 0.133951 0.133761 0.133583 0.133128 0.132968 0.13251 0.132367 0.132237 0.132119 0.132563 0.132686 0.132821 0.133265 0.133418 0.133858 0.134029 0.134212 0.134408 0.134617 0.134839 0.135074 0.135537 0.135792 0.136062 0.136525 0.136815 0.13712 0.137439 0.137909 0.137583 0.137272 0.136976 0.136695 0.13625 0.135989 0.135742 0.135296 0.135068 0.134853 0.134652 0.134464 0.134888 0.135082 0.135288 0.135508 0.135937 0.136176 0.136428 0.136856 0.137128 0.137414 0.137716 0.138032 0.138364 0.138805 0.138467 0.138146 0.138561 0.138887 0.13923 0.139639 0.139292 0.13896 0.138645 0.138249 0.137839 0.137547 0.13727 0.137008 0.136598 0.136354 0.136124 0.135712 0.135501 0.135303 0.135118 0.134708 0.134288 0.134126 0.133701 0.133556 0.133125 0.132998 0.132883 0.132452 0.132012 0.131564 0.131473 0.131021 0.130944 0.130879 0.130827 0.130376 0.129918 0.129881 0.130337 0.130786 0.131227 0.13127 0.131325 0.131393 0.131833 0.131917 0.132353 0.13278 0.132689 0.132266 0.132192 0.131763 0.131706 0.131661 0.132086 0.132132 0.132551 0.132613 0.133025 0.133104 0.133198 0.133305 0.133424 0.133841 0.133977 0.134388 0.134542 0.134947 0.134789 0.134645 0.134248 0.134121 0.133718 0.133607 0.133509 0.133427 0.13382 0.133905 0.134007 0.134397 0.134515 0.134898 0.135032 0.13518 0.135342 0.135517 0.135706 0.135908 0.136304 0.136525 0.136759 0.137152 0.137404 0.137671 0.137953 0.138344 0.138059 0.137788 0.137531 0.137289 0.136913 0.136689 0.136478 0.136098 0.135905 0.135726 0.13556 0.135409 0.135775 0.13593 0.136099 0.136281 0.136647 0.136847 0.137061 0.13742 0.137651 0.137897 0.138157 0.138431 0.13872 0.139025 0.139344 0.13968 0.140031 0.140408 0.140052 0.139712 0.140067 0.14041 0.140771 0.141122 0.140757 0.140409 0.140077 0.139739 0.139389 0.139081 0.138788 0.138511 0.13885 0.139131 0.139427 0.139761 0.139461 0.139176 0.139492 0.13978 0.140085 0.140405 0.14074 0.141092 0.141459 0.141774 0.141408 0.141057 0.141348 0.141693 0.142052 0.142277 0.14264 0.142794 0.143165 0.143555 0.143652 0.144062 0.144129 0.144564 0.144615 0.145077 0.145117 0.145606 0.146119 0.146156 0.14564 0.145147 0.145169 0.145665 0.146184 0.146205 0.145683 0.145184 0.144708 0.144696 0.144677 0.144651 0.144208 0.144175 0.143759 0.143716 0.143325 0.143263 0.142894 0.142546 0.14244 0.142103 0.141929 0.141594 0.141272 0.141015 0.140721 0.140399 0.140091 0.139799 0.140097 0.14039 0.140696 0.140962 0.140663 0.140376 0.1401 0.139819 0.139523 0.139219 0.138907 0.138584 0.138248 0.137999 0.137765 0.137545 0.137203 0.136999 0.13681 0.13646 0.136288 0.13613 0.136474 0.136635 0.136969 0.137147 0.137339 0.137666 0.137874 0.138096 0.138333 0.138653 0.138414 0.138189 0.137978 0.137782 0.137471 0.137291 0.137125 0.136806 0.136656 0.136327 0.135986 0.135634 0.135271 0.135146 0.134776 0.134668 0.134292 0.134203 0.134131 0.13375 0.13336 0.13296 0.132909 0.132502 0.133307 0.133695 0.134074 0.134442 0.134502 0.134577 0.13494 0.135035 0.135391 0.135505 0.135854 0.135737 0.135636 0.135293 0.135213 0.134862 0.134801 0.135149 0.135487 0.135553 0.135882 0.135968 0.136072 0.136192 0.136519 0.136396 0.13629 0.1366 0.136709 0.136835 0.136973 0.137278 0.137432 0.1376 0.137895 0.138079 0.138278 0.138491 0.138719 0.138961 0.139261 0.139015 0.138783 0.13907 0.139304 0.139554 0.139837 0.139587 0.13935 0.139127 0.13885 0.138567 0.138366 0.138179 0.138007 0.137726 0.13757 0.137428 0.137138 0.13701 0.136898 0.136805 0.136509 0.136201 0.13613 0.135814 0.136436 0.13673 0.137013 0.13709 0.137185 0.137298 0.137575 0.137706 0.13785 0.13812 0.13828 0.138455 0.138645 0.138919 0.138725 0.138547 0.138384 0.138235 0.137974 0.137841 0.137723 0.13746 0.137363 0.137284 0.137545 0.137625 0.137878 0.137979 0.138099 0.138352 0.138492 0.138644 0.13881 0.138992 0.139188 0.139397 0.139618 0.139852 0.140096 0.140351 0.140616 0.14089 0.141176 0.141472 0.141781 0.141903 0.142215 0.142279 0.142608 0.142956 0.142992 0.143364 0.143389 0.143787 0.143806 0.14423 0.144245 0.144255 0.143824 0.143817 0.143411 0.143403 0.143023 0.143012 0.142657 0.142641 0.142311 0.142002 0.141971 0.141681 0.141606 0.141324 0.141054 0.140796 0.140908 0.141151 0.141408 0.141444 0.141713 0.141721 0.142012 0.142324 0.142326 0.142664 0.142665 0.143027 0.143028 0.143415 0.143417 0.143828 0.144261 0.144717 0.145195 0.145696 0.14622 0.14623 0.14678 0.146787 0.147363 0.147963 0.148588 0.148594 0.147968 0.147367 0.146792 0.14624 0.146236 0.145709 0.145704 0.145201 0.145205 0.145208 0.145712 0.144726 0.144725 0.144722 0.144264 0.143829 0.143416 0.143416 0.14383 0.144266 0.144267 0.14383 0.143415 0.143021 0.143023 0.143025 0.143027 0.142658 0.142662 0.142317 0.142323 0.142003 0.14201 0.141715 0.141441 0.14145 0.141199 0.141193 0.140959 0.140968 0.140954 0.141187 0.141168 0.141426 0.141704 0.141691 0.141994 0.141984 0.142311 0.142305 0.142654 0.142651 0.142649 0.142297 0.1423 0.14197 0.141976 0.141668 0.141678 0.141393 0.141409 0.141147 0.140906 0.140931 0.140715 0.140741 0.140754 0.14074 0.140677 0.140548 0.140309 0.140079 0.139857 0.140043 0.140246 0.140457 0.140535 0.140342 0.140159 0.139984 0.139847 0.139644 0.139441 0.139249 0.139068 0.139306 0.139478 0.139659 0.139817 0.139656 0.139501 0.139632 0.139764 0.139904 0.140051 0.140208 0.140376 0.140558 0.140546 0.140369 0.140209 0.140183 0.140342 0.140519 0.140486 0.140686 0.140659 0.140883 0.141128 0.141112 0.14138 0.14137 0.14166 0.141655 0.141966 0.141365 0.141094 0.141101 0.140852 0.140864 0.140637 0.14043 0.140455 0.140272 0.140306 0.140147 0.140006 0.140042 0.140063 0.139929 0.139807 0.139694 0.139703 0.139803 0.139916 0.139882 0.139775 0.139682 0.139648 0.139737 0.139843 0.139966 0.140109 0.140077 0.140243 0.140223 0.140413 0.140622 0.140613 0.140844 0.140403 0.140212 0.140041 0.140054 0.139906 0.139932 0.139806 0.139701 0.139614 0.139585 0.139672 0.139779 0.139761 0.139891 0.139653 0.139566 0.1395 0.139517 0.139543 0.139574 0.139602 0.139613 0.139589 0.139506 0.139353 0.139143 0.1389 0.138746 0.138603 0.138476 0.138228 0.138125 0.138041 0.137796 0.138282 0.138369 0.138612 0.138721 0.13885 0.138992 0.139213 0.139079 0.138955 0.138848 0.138759 0.138522 0.13898 0.139062 0.139158 0.139268 0.139385 0.139491 0.139396 0.139308 0.139393 0.139459 0.139533 0.139533 0.139473 0.139424 0.139387 0.139338 0.139231 0.139165 0.139293 0.13936 0.139386 0.1394 0.139425 0.139463 0.139512 0.139487 0.139445 0.139416 0.139409 0.13943 0.139466 0.139452 0.139421 0.139405 0.139398 0.139399 0.1394 0.139392 0.139394 0.139395 0.101248 0.10299 0.102852 0.103552 0.103615 0.106977 0.1063 0.1079 0.108537 0.115617 0.144108 0.132288 0.128976 0.130129 0.123937 0.123858 0.146761 0.154444 0.155587 0.156014 0.157461 0.15888 0.178272 0.177598 0.1764 0.167876 0.180688 0.182179 0.192964 0.247478 0.239525 0.23787 0.236486 0.224189 0.259099 0.26083 0.280149 0.281371 0.310202 0.312149 0.333034 0.340973 0.343434 0.356879 0.483959 0.512583 0.110025 0.11015 0.110086 0.109929 0.109803 0.110004 0.110216 0.110241 0.110214 0.110175 0.110138 0.110129 0.110192 0.110354 0.110596 0.110876 0.111168 0.111463 0.111761 0.112067 0.112385 0.112715 0.113059 0.113416 0.113786 0.114168 0.114562 0.114966 0.115381 0.115806 0.11624 0.116683 0.117135 0.117594 0.118061 0.118533 0.119012 0.119496 0.119985 0.120478 0.120975 0.121474 0.121975 0.122478 0.122983 0.123487 0.123992 0.124496 0.124998 0.125499 0.125997 0.126493 0.126985 0.127473 0.127956 0.128435 0.128908 0.129376 0.129837 0.130291 0.130738 0.131177 0.131609 0.132032 0.132446 0.132851 0.133247 0.133634 0.13401 0.134376 0.134732 0.135078 0.135413 0.135738 0.136052 0.136354 0.136646 0.136926 0.137195 0.137453 0.137701 0.137942 0.13818 0.138416 0.13865 0.138876 0.139078 0.139234 0.13933 0.139373 0.139385 0.13939 0.110149 0.109986 0.109728 0.11022 ) ; boundaryField { bottomEmptyFaces { type empty; } topEmptyFaces { type empty; } inlet { type calculated; value nonuniform List<scalar> 95 ( 0.13939 0.13939 0.139385 0.13937 0.139325 0.139223 0.139061 0.138856 0.138629 0.138396 0.138162 0.137925 0.137685 0.137437 0.137179 0.136911 0.136631 0.13634 0.136038 0.135725 0.1354 0.135066 0.13472 0.134364 0.133998 0.133622 0.133236 0.13284 0.132435 0.132021 0.131598 0.131167 0.130728 0.130281 0.129827 0.129366 0.1289 0.128427 0.127948 0.127465 0.126978 0.126486 0.125991 0.125494 0.124993 0.124491 0.123988 0.123484 0.12298 0.122477 0.121974 0.121474 0.120975 0.120479 0.119987 0.119499 0.119016 0.118538 0.118065 0.1176 0.117141 0.116691 0.116248 0.115815 0.115391 0.114977 0.114573 0.11418 0.113799 0.113431 0.113074 0.112732 0.112403 0.112087 0.111782 0.111486 0.111196 0.110909 0.110633 0.11039 0.110219 0.110144 0.110142 0.110172 0.110211 0.110232 0.110141 0.109962 0.109664 0.110207 0.110235 0.139392 0.10657 0.108622 0.109179 ) ; } outlet { type calculated; value nonuniform List<scalar> 36 ( 0.455938 0.455927 0.455911 0.455885 0.455853 0.455811 0.45576 0.455698 0.455623 0.455531 0.455417 0.455272 0.455086 0.454839 0.454504 0.454039 0.453381 0.452446 0.451108 0.449286 0.446723 0.443426 0.43635 0.440736 0.434362 0.432127 0.421567 0.428658 0.419388 0.414594 0.393104 0.357557 0.227992 0.286857 0.31761 0.455942 ) ; } walls { type calculated; value uniform 0; } rightWall { type calculated; value nonuniform List<scalar> 28 ( 0.089584 0.0933224 0.0950541 0.0957311 0.0961266 0.0964488 0.0967372 0.0972435 0.0974453 0.09764 0.0977139 0.0977458 0.0977234 0.0976213 0.0975018 0.0972358 0.0969934 0.0963894 0.0960835 0.0955829 0.0941264 0.0916132 0.0715778 0.0829924 0.0881999 0.0512105 0.0717717 0.0817501 ) ; } symmetryLine { type symmetryPlane; } } // ************************************************************************* //
[ "mhoeper3234@gmail.com" ]
mhoeper3234@gmail.com
80001fa9dcaa70301d86206a1a0a3c840c716d11
bfa4a77fe5ccc95c6417642da7d6f886d49bd797
/src/integrators.cpp
cf589145c9daa39df6b989b78928c910ab57b4cc
[ "MIT" ]
permissive
FerryT/SiCGp2
d3b73e0ce114217efd6aba71b88837b2dc10deb3
45a2c821c61a46fe4efe8d30f883b774abf45cec
refs/heads/master
2021-01-17T19:52:44.070766
2016-07-11T00:39:30
2016-07-11T00:39:30
60,373,381
0
0
null
null
null
null
UTF-8
C++
false
false
2,707
cpp
/********************************************************************** * Integration functionality -- See header file for more information. * **********************************************************************/ #include "integrators.h" namespace Sim { //------------------------------------------------------------------------------ void Euler::integrate(unit h) { for (size_t i = 0; i < system.size; ++i) { system.v[i] += h * system.f[i] / system.m[i]; system.x[i] += h * system.v[i]; } for (size_t i = 0; i < system2.size; ++i) { system2.v[i] += h * system2.f[i] / system2.m[i]; system2.x[i] += h * system2.v[i]; system2.w[i] += h * system2.t[i] / (system2.i[i] * system2.m[i]); system2.o[i] += h * system2.w[i]; } } //------------------------------------------------------------------------------ void Verlet::integrate(unit h) { for (size_t i = 0; i < system.size; ++i) { Vec oldX = system.x[i]; system.x[i] += (h * system.v[i]) + (h * h * system.f[i] / system.m[i]); system.v[i] = (system.x[i] - oldX) / h; } for (size_t i = 0; i < system2.size; ++i) { Vec oldX = system2.x[i]; system2.x[i] += (h * system2.v[i]) + (h * h * system2.f[i] / system2.m[i]); system2.v[i] = (system2.x[i] - oldX) / h; unit inertia = system2.i[i] * system2.m[i]; unit oldO = system2.o[i]; system2.o[i] += (h * system2.w[i]) + (h * h * system2.t[i] / inertia); system2.w[i] = (system2.o[i] - oldO) / h; } } //------------------------------------------------------------------------------ void MidPointBase::integrate(unit h) { saveState(); subint->integrate(h / 2.0); calcForces(); restoreState(); subint->integrate(h); } //------------------------------------------------------------------------------ void RungeKutta4Base::integrate(unit h) { Vecs k1 = system.f; Vecs u1 = system2.f; auto v1 = system2.t; saveState(); subint->integrate(h / 2.0); calcForces(); restoreState(); Vecs k2 = system.f; Vecs u2 = system2.f; auto v2 = system2.t; saveState(); subint->integrate(h / 2.0); calcForces(); restoreState(); Vecs k3 = system.f; Vecs u3 = system2.f; auto v3 = system2.t; saveState(); subint->integrate(h); calcForces(); restoreState(); Vecs k4 = system.f; Vecs u4 = system2.f; auto v4 = system2.t; for (size_t i = 0; i < system.size; ++i) { system.f[i] = k1[i]/6 + k2[i]/3 + k3[i]/3 + k4[i]/6; system2.f[i] = u1[i]/6 + u2[i]/3 + u3[i]/3 + u4[i]/6; system2.t[i] = v1[i]/6 + v2[i]/3 + v3[i]/3 + v4[i]/6; } subint->integrate(h); } //------------------------------------------------------------------------------ } /* namespace Sim */ //..............................................................................
[ "f.timmers@student.tue.nl" ]
f.timmers@student.tue.nl
5e7accd26d336867e70d445869db815288a3397c
98b6001550c19fad60975e5dac262dde561e887b
/WinAPI/lessons/lesson7_slider progress bar/main2.cpp
945745a9a0a37d85959c17c3d5ad525a57f0a43e
[]
no_license
ArBond/ITStep
eee3998d7292ea110ee5f6fd39723cc5d7a095d8
8d013e349648e52c8753f94331dfe611086e57b5
refs/heads/master
2020-04-05T11:44:03.579526
2018-02-23T09:08:03
2018-02-23T09:08:03
81,499,847
1
2
null
null
null
null
UTF-8
C++
false
false
2,782
cpp
#include <Windows.h> #include "commctrl.h" #pragma comment(lib, "comctl32") #include "resource.h" #define ID_TIMER1 123 #define ID_TIMER2 124 #define ID_STATUSBAR 234 BOOL CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static HWND hPrBar; static HWND hStatusBar; static HWND hSlider; static HWND hTimerInSec; static int seconds = 0; static int parts[3] = { 150, 250, -1 }; switch (uMsg) { case WM_INITDIALOG: hPrBar = GetDlgItem(hWnd, IDC_PROGRESS1); hSlider = GetDlgItem(hWnd, IDC_SLIDER1); hStatusBar = CreateWindowEx(NULL, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_TOOLTIPS | SBARS_SIZEGRIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hWnd, (HMENU)ID_STATUSBAR, GetModuleHandle(NULL), NULL); SendMessage(hStatusBar, SB_SIMPLE, false, 0); SendMessage(hStatusBar, SB_SETPARTS, 3, (LPARAM)parts); SendMessage(hStatusBar, SB_SETTEXT, 0, LPARAM(L" User: Bondarenko Artemi")); SendMessage(hStatusBar, SB_SETTEXT, 2, LPARAM(L" Time: 0 sec")); SendMessage(hPrBar, PBM_SETBKCOLOR, 0, LPARAM(RGB(100, 200, 100))); SendMessage(hPrBar, PBM_SETBARCOLOR, 0, LPARAM(RGB(55, 50, 200))); SendMessage(hPrBar, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); SendMessage(hSlider, TBM_SETRANGE, true, MAKELPARAM(0, 255)); SendMessage(hSlider, TBM_SETPOS, true, 200); SetTimer(hWnd, ID_TIMER1, 100, NULL); SetTimer(hWnd, ID_TIMER2, 1000, NULL); hTimerInSec = GetDlgItem(hWnd, ID_TIMER2); return true; case WM_TIMER: SendMessage(hPrBar, PBM_DELTAPOS, 1, 0); wchar_t buff[50]; memset(buff, 0, 50); wsprintf(buff, L" Progress: %i %%", (LPCWSTR)SendMessage(hPrBar, PBM_GETPOS, 1, 0)); SendMessage(hStatusBar, SB_SETTEXT, 1, LPARAM(buff)); if (LOWORD(wParam) == ID_TIMER2) { seconds++; memset(buff, 0, 50); wsprintf(buff, L" Time: %i sec", seconds); SendMessage(hStatusBar, SB_SETTEXT, 2, LPARAM(buff)); } if (SendMessage(hPrBar, PBM_GETPOS, 0, 0) == 100) { SendMessage(hWnd, WM_CLOSE, 0, 0); } return true; case WM_HSCROLL: SendMessage(hPrBar, PBM_SETBARCOLOR, 0, LPARAM(RGB(255 - SendMessage(hSlider, TBM_GETPOS, 0, 0), 50, SendMessage(hSlider, TBM_GETPOS, 0, 0)))); return true; case WM_CLOSE: KillTimer(hWnd, ID_TIMER1); DestroyWindow(hWnd); PostQuitMessage(0); return true; default: return false; } } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) { INITCOMMONCONTROLSEX cc; cc.dwSize = sizeof(cc); cc.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&cc); HWND hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DlgProc); ShowWindow(hWnd, SW_NORMAL); UpdateWindow(hWnd); MSG msg; while (GetMessage(&msg, 0, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; }
[ "bonartembon@gmail.com" ]
bonartembon@gmail.com
17f77c042acd044e8bb4cc924e65a8ea33e89715
3b38e11bd517ba7825bc23ad890fe0150cfd2bf2
/src/vartypes/primitives/VarQWidget.cpp
64037538471f0771ec4140e72e2bf0acbddac2e5
[]
no_license
eschneeweiss/Umass_RoboCup_Logger
a1b9a7f265f8dce139e92ebb1a0c8964803ceb1c
cc2ced98c75f4c44e96754d619be5e17810c6f88
refs/heads/master
2020-09-21T05:42:59.737244
2016-10-12T19:48:53
2016-10-12T19:48:53
67,076,577
0
0
null
null
null
null
UTF-8
C++
false
false
953
cpp
//======================================================================== // This software is free: you can redistribute it and/or modify // it under the terms of the GNU General Public License Version 3, // as published by the Free Software Foundation. // // This software is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // Version 3 in the file COPYING that came with this distribution. // If not, see <http://www.gnu.org/licenses/>. //======================================================================== /*! \file VarQWidget.cpp \brief C++ Implementation: VarQWidget \author Stefan Zickler, (C) 2008 */ #include "vartypes/primitives/VarQWidget.h"
[ "eschneeweiss@umass.edu" ]
eschneeweiss@umass.edu
ac892e2d4298a4cf99f4948332d4056baacc2be0
0b69a011c9ffee099841c140be95ed93c704fb07
/problemsets/SPOJ/SPOJ - BR/BALE11.cpp
fa62023f937b8bd31b1dcc4d112d52ce1986d025
[ "Apache-2.0" ]
permissive
juarezpaulino/coderemite
4bd03f4f2780eb6013f07c396ba16aa7dbbceea8
a4649d3f3a89d234457032d14a6646b3af339ac1
refs/heads/main
2023-01-31T11:35:19.779668
2020-12-18T01:33:46
2020-12-18T01:33:46
320,931,351
0
0
null
null
null
null
UTF-8
C++
false
false
919
cpp
/** * * Author: Juarez Paulino(coderemite) * Email: juarez.paulino@gmail.com * */ #include <cstdio> #include <algorithm> #include <vector> using namespace std; long long mergecount (vector<int> &a) { long long count = 0; int i, j, k, n = a.size(); if (n <= 1) return 0; vector<int> b(a.begin(), a.begin()+n/2); vector<int> c(a.begin()+n/2, a.end()); count += mergecount(b); count += mergecount(c); for (i = j = k = 0 ; i < n; ++i) if (k == c.size()) a[i] = b[j++]; else if (j == b.size()) a[i] = c[k++]; else if (b[j] <= c[k]) a[i] = b[j++]; else a[i] = c[k++], count += n/2-j; return count; } int main() { int N; scanf("%d", &N); vector<int> A(N,0); for (int i = 0; i < N; i++) { int x; scanf("%d", &x); A[i] = x; } long long ret = mergecount(A); printf("%lld\n", ret); return 0; }
[ "juarez.paulino@gmail.com" ]
juarez.paulino@gmail.com
b6c9ec35c92977dc7f37ece852dcadb83b43a37a
6ced41da926682548df646099662e79d7a6022c5
/aws-cpp-sdk-eks/include/aws/eks/model/UpdateNodegroupConfigRequest.h
19b88ee5ed133de7d9b8cdd0c6bdab4bb1a7364a
[ "Apache-2.0", "MIT", "JSON" ]
permissive
irods/aws-sdk-cpp
139104843de529f615defa4f6b8e20bc95a6be05
2c7fb1a048c96713a28b730e1f48096bd231e932
refs/heads/main
2023-07-25T12:12:04.363757
2022-08-26T15:33:31
2022-08-26T15:33:31
141,315,346
0
1
Apache-2.0
2022-08-26T17:45:09
2018-07-17T16:24:06
C++
UTF-8
C++
false
false
13,481
h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/eks/EKS_EXPORTS.h> #include <aws/eks/EKSRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/eks/model/UpdateLabelsPayload.h> #include <aws/eks/model/UpdateTaintsPayload.h> #include <aws/eks/model/NodegroupScalingConfig.h> #include <aws/eks/model/NodegroupUpdateConfig.h> #include <utility> #include <aws/core/utils/UUID.h> namespace Aws { namespace EKS { namespace Model { /** */ class AWS_EKS_API UpdateNodegroupConfigRequest : public EKSRequest { public: UpdateNodegroupConfigRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "UpdateNodegroupConfig"; } Aws::String SerializePayload() const override; /** * <p>The name of the Amazon EKS cluster that the managed node group resides * in.</p> */ inline const Aws::String& GetClusterName() const{ return m_clusterName; } /** * <p>The name of the Amazon EKS cluster that the managed node group resides * in.</p> */ inline bool ClusterNameHasBeenSet() const { return m_clusterNameHasBeenSet; } /** * <p>The name of the Amazon EKS cluster that the managed node group resides * in.</p> */ inline void SetClusterName(const Aws::String& value) { m_clusterNameHasBeenSet = true; m_clusterName = value; } /** * <p>The name of the Amazon EKS cluster that the managed node group resides * in.</p> */ inline void SetClusterName(Aws::String&& value) { m_clusterNameHasBeenSet = true; m_clusterName = std::move(value); } /** * <p>The name of the Amazon EKS cluster that the managed node group resides * in.</p> */ inline void SetClusterName(const char* value) { m_clusterNameHasBeenSet = true; m_clusterName.assign(value); } /** * <p>The name of the Amazon EKS cluster that the managed node group resides * in.</p> */ inline UpdateNodegroupConfigRequest& WithClusterName(const Aws::String& value) { SetClusterName(value); return *this;} /** * <p>The name of the Amazon EKS cluster that the managed node group resides * in.</p> */ inline UpdateNodegroupConfigRequest& WithClusterName(Aws::String&& value) { SetClusterName(std::move(value)); return *this;} /** * <p>The name of the Amazon EKS cluster that the managed node group resides * in.</p> */ inline UpdateNodegroupConfigRequest& WithClusterName(const char* value) { SetClusterName(value); return *this;} /** * <p>The name of the managed node group to update.</p> */ inline const Aws::String& GetNodegroupName() const{ return m_nodegroupName; } /** * <p>The name of the managed node group to update.</p> */ inline bool NodegroupNameHasBeenSet() const { return m_nodegroupNameHasBeenSet; } /** * <p>The name of the managed node group to update.</p> */ inline void SetNodegroupName(const Aws::String& value) { m_nodegroupNameHasBeenSet = true; m_nodegroupName = value; } /** * <p>The name of the managed node group to update.</p> */ inline void SetNodegroupName(Aws::String&& value) { m_nodegroupNameHasBeenSet = true; m_nodegroupName = std::move(value); } /** * <p>The name of the managed node group to update.</p> */ inline void SetNodegroupName(const char* value) { m_nodegroupNameHasBeenSet = true; m_nodegroupName.assign(value); } /** * <p>The name of the managed node group to update.</p> */ inline UpdateNodegroupConfigRequest& WithNodegroupName(const Aws::String& value) { SetNodegroupName(value); return *this;} /** * <p>The name of the managed node group to update.</p> */ inline UpdateNodegroupConfigRequest& WithNodegroupName(Aws::String&& value) { SetNodegroupName(std::move(value)); return *this;} /** * <p>The name of the managed node group to update.</p> */ inline UpdateNodegroupConfigRequest& WithNodegroupName(const char* value) { SetNodegroupName(value); return *this;} /** * <p>The Kubernetes labels to be applied to the nodes in the node group after the * update.</p> */ inline const UpdateLabelsPayload& GetLabels() const{ return m_labels; } /** * <p>The Kubernetes labels to be applied to the nodes in the node group after the * update.</p> */ inline bool LabelsHasBeenSet() const { return m_labelsHasBeenSet; } /** * <p>The Kubernetes labels to be applied to the nodes in the node group after the * update.</p> */ inline void SetLabels(const UpdateLabelsPayload& value) { m_labelsHasBeenSet = true; m_labels = value; } /** * <p>The Kubernetes labels to be applied to the nodes in the node group after the * update.</p> */ inline void SetLabels(UpdateLabelsPayload&& value) { m_labelsHasBeenSet = true; m_labels = std::move(value); } /** * <p>The Kubernetes labels to be applied to the nodes in the node group after the * update.</p> */ inline UpdateNodegroupConfigRequest& WithLabels(const UpdateLabelsPayload& value) { SetLabels(value); return *this;} /** * <p>The Kubernetes labels to be applied to the nodes in the node group after the * update.</p> */ inline UpdateNodegroupConfigRequest& WithLabels(UpdateLabelsPayload&& value) { SetLabels(std::move(value)); return *this;} /** * <p>The Kubernetes taints to be applied to the nodes in the node group after the * update. For more information, see <a * href="https://docs.aws.amazon.com/eks/latest/userguide/node-taints-managed-node-groups.html">Node * taints on managed node groups</a>.</p> */ inline const UpdateTaintsPayload& GetTaints() const{ return m_taints; } /** * <p>The Kubernetes taints to be applied to the nodes in the node group after the * update. For more information, see <a * href="https://docs.aws.amazon.com/eks/latest/userguide/node-taints-managed-node-groups.html">Node * taints on managed node groups</a>.</p> */ inline bool TaintsHasBeenSet() const { return m_taintsHasBeenSet; } /** * <p>The Kubernetes taints to be applied to the nodes in the node group after the * update. For more information, see <a * href="https://docs.aws.amazon.com/eks/latest/userguide/node-taints-managed-node-groups.html">Node * taints on managed node groups</a>.</p> */ inline void SetTaints(const UpdateTaintsPayload& value) { m_taintsHasBeenSet = true; m_taints = value; } /** * <p>The Kubernetes taints to be applied to the nodes in the node group after the * update. For more information, see <a * href="https://docs.aws.amazon.com/eks/latest/userguide/node-taints-managed-node-groups.html">Node * taints on managed node groups</a>.</p> */ inline void SetTaints(UpdateTaintsPayload&& value) { m_taintsHasBeenSet = true; m_taints = std::move(value); } /** * <p>The Kubernetes taints to be applied to the nodes in the node group after the * update. For more information, see <a * href="https://docs.aws.amazon.com/eks/latest/userguide/node-taints-managed-node-groups.html">Node * taints on managed node groups</a>.</p> */ inline UpdateNodegroupConfigRequest& WithTaints(const UpdateTaintsPayload& value) { SetTaints(value); return *this;} /** * <p>The Kubernetes taints to be applied to the nodes in the node group after the * update. For more information, see <a * href="https://docs.aws.amazon.com/eks/latest/userguide/node-taints-managed-node-groups.html">Node * taints on managed node groups</a>.</p> */ inline UpdateNodegroupConfigRequest& WithTaints(UpdateTaintsPayload&& value) { SetTaints(std::move(value)); return *this;} /** * <p>The scaling configuration details for the Auto Scaling group after the * update.</p> */ inline const NodegroupScalingConfig& GetScalingConfig() const{ return m_scalingConfig; } /** * <p>The scaling configuration details for the Auto Scaling group after the * update.</p> */ inline bool ScalingConfigHasBeenSet() const { return m_scalingConfigHasBeenSet; } /** * <p>The scaling configuration details for the Auto Scaling group after the * update.</p> */ inline void SetScalingConfig(const NodegroupScalingConfig& value) { m_scalingConfigHasBeenSet = true; m_scalingConfig = value; } /** * <p>The scaling configuration details for the Auto Scaling group after the * update.</p> */ inline void SetScalingConfig(NodegroupScalingConfig&& value) { m_scalingConfigHasBeenSet = true; m_scalingConfig = std::move(value); } /** * <p>The scaling configuration details for the Auto Scaling group after the * update.</p> */ inline UpdateNodegroupConfigRequest& WithScalingConfig(const NodegroupScalingConfig& value) { SetScalingConfig(value); return *this;} /** * <p>The scaling configuration details for the Auto Scaling group after the * update.</p> */ inline UpdateNodegroupConfigRequest& WithScalingConfig(NodegroupScalingConfig&& value) { SetScalingConfig(std::move(value)); return *this;} /** * <p>The node group update configuration.</p> */ inline const NodegroupUpdateConfig& GetUpdateConfig() const{ return m_updateConfig; } /** * <p>The node group update configuration.</p> */ inline bool UpdateConfigHasBeenSet() const { return m_updateConfigHasBeenSet; } /** * <p>The node group update configuration.</p> */ inline void SetUpdateConfig(const NodegroupUpdateConfig& value) { m_updateConfigHasBeenSet = true; m_updateConfig = value; } /** * <p>The node group update configuration.</p> */ inline void SetUpdateConfig(NodegroupUpdateConfig&& value) { m_updateConfigHasBeenSet = true; m_updateConfig = std::move(value); } /** * <p>The node group update configuration.</p> */ inline UpdateNodegroupConfigRequest& WithUpdateConfig(const NodegroupUpdateConfig& value) { SetUpdateConfig(value); return *this;} /** * <p>The node group update configuration.</p> */ inline UpdateNodegroupConfigRequest& WithUpdateConfig(NodegroupUpdateConfig&& value) { SetUpdateConfig(std::move(value)); return *this;} /** * <p>Unique, case-sensitive identifier that you provide to ensure the idempotency * of the request.</p> */ inline const Aws::String& GetClientRequestToken() const{ return m_clientRequestToken; } /** * <p>Unique, case-sensitive identifier that you provide to ensure the idempotency * of the request.</p> */ inline bool ClientRequestTokenHasBeenSet() const { return m_clientRequestTokenHasBeenSet; } /** * <p>Unique, case-sensitive identifier that you provide to ensure the idempotency * of the request.</p> */ inline void SetClientRequestToken(const Aws::String& value) { m_clientRequestTokenHasBeenSet = true; m_clientRequestToken = value; } /** * <p>Unique, case-sensitive identifier that you provide to ensure the idempotency * of the request.</p> */ inline void SetClientRequestToken(Aws::String&& value) { m_clientRequestTokenHasBeenSet = true; m_clientRequestToken = std::move(value); } /** * <p>Unique, case-sensitive identifier that you provide to ensure the idempotency * of the request.</p> */ inline void SetClientRequestToken(const char* value) { m_clientRequestTokenHasBeenSet = true; m_clientRequestToken.assign(value); } /** * <p>Unique, case-sensitive identifier that you provide to ensure the idempotency * of the request.</p> */ inline UpdateNodegroupConfigRequest& WithClientRequestToken(const Aws::String& value) { SetClientRequestToken(value); return *this;} /** * <p>Unique, case-sensitive identifier that you provide to ensure the idempotency * of the request.</p> */ inline UpdateNodegroupConfigRequest& WithClientRequestToken(Aws::String&& value) { SetClientRequestToken(std::move(value)); return *this;} /** * <p>Unique, case-sensitive identifier that you provide to ensure the idempotency * of the request.</p> */ inline UpdateNodegroupConfigRequest& WithClientRequestToken(const char* value) { SetClientRequestToken(value); return *this;} private: Aws::String m_clusterName; bool m_clusterNameHasBeenSet; Aws::String m_nodegroupName; bool m_nodegroupNameHasBeenSet; UpdateLabelsPayload m_labels; bool m_labelsHasBeenSet; UpdateTaintsPayload m_taints; bool m_taintsHasBeenSet; NodegroupScalingConfig m_scalingConfig; bool m_scalingConfigHasBeenSet; NodegroupUpdateConfig m_updateConfig; bool m_updateConfigHasBeenSet; Aws::String m_clientRequestToken; bool m_clientRequestTokenHasBeenSet; }; } // namespace Model } // namespace EKS } // namespace Aws
[ "aws-sdk-cpp-automation@github.com" ]
aws-sdk-cpp-automation@github.com
565a90c1328ab3aa59df950c8de74769b211d6b1
536656cd89e4fa3a92b5dcab28657d60d1d244bd
/third_party/skia/modules/skottie/src/layers/shapelayer/ShapeLayer.h
6a89efa4e523ce9e3a913197af7e1a40db947489
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "BSD-3-Clause" ]
permissive
ECS-251-W2020/chromium
79caebf50443f297557d9510620bf8d44a68399a
ac814e85cb870a6b569e184c7a60a70ff3cb19f9
refs/heads/master
2022-08-19T17:42:46.887573
2020-03-18T06:08:44
2020-03-18T06:08:44
248,141,336
7
8
BSD-3-Clause
2022-07-06T20:32:48
2020-03-18T04:52:18
null
UTF-8
C++
false
false
3,727
h
/* * Copyright 2020 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkottieShapeLayer_DEFINED #define SkottieShapeLayer_DEFINED #include "include/private/SkNoncopyable.h" #include "modules/skottie/src/Animator.h" #include "modules/sksg/include/SkSGMerge.h" #include <vector> namespace skjson { class ObjectValue; } // namespace skjson namespace sksg { class GeometryNode; class PaintNode; class RenderNode; } // namespace sksg namespace skottie { namespace internal { class AnimationBuilder; // TODO/TRANSITIONAL: not much state here yet, but will eventually hold ShapeLayer-related stuff. class ShapeBuilder final : SkNoncopyable { public: static sk_sp<sksg::Merge> MergeGeometry(std::vector<sk_sp<sksg::GeometryNode>>&&, sksg::Merge::Mode); static sk_sp<sksg::GeometryNode> AttachPathGeometry(const skjson::ObjectValue&, const AnimationBuilder*); static sk_sp<sksg::GeometryNode> AttachRRectGeometry(const skjson::ObjectValue&, const AnimationBuilder*); static sk_sp<sksg::GeometryNode> AttachEllipseGeometry(const skjson::ObjectValue&, const AnimationBuilder*); static sk_sp<sksg::GeometryNode> AttachPolystarGeometry(const skjson::ObjectValue&, const AnimationBuilder*); static sk_sp<sksg::PaintNode> AttachColorFill(const skjson::ObjectValue&, const AnimationBuilder*); static sk_sp<sksg::PaintNode> AttachColorStroke(const skjson::ObjectValue&, const AnimationBuilder*); static sk_sp<sksg::PaintNode> AttachGradientFill(const skjson::ObjectValue&, const AnimationBuilder*); static sk_sp<sksg::PaintNode> AttachGradientStroke(const skjson::ObjectValue&, const AnimationBuilder*); static std::vector<sk_sp<sksg::GeometryNode>> AttachMergeGeometryEffect( const skjson::ObjectValue&, const AnimationBuilder*, std::vector<sk_sp<sksg::GeometryNode>>&&); static std::vector<sk_sp<sksg::GeometryNode>> AttachTrimGeometryEffect( const skjson::ObjectValue&, const AnimationBuilder*, std::vector<sk_sp<sksg::GeometryNode>>&&); static std::vector<sk_sp<sksg::GeometryNode>> AttachRoundGeometryEffect( const skjson::ObjectValue&, const AnimationBuilder*, std::vector<sk_sp<sksg::GeometryNode>>&&); static std::vector<sk_sp<sksg::RenderNode>> AttachRepeaterDrawEffect( const skjson::ObjectValue&, const AnimationBuilder*, std::vector<sk_sp<sksg::RenderNode>>&&); private: static sk_sp<sksg::PaintNode> AttachFill(const skjson::ObjectValue&, const AnimationBuilder*, sk_sp<sksg::PaintNode>, sk_sp<AnimatablePropertyContainer> = nullptr); static sk_sp<sksg::PaintNode> AttachStroke(const skjson::ObjectValue&, const AnimationBuilder*, sk_sp<sksg::PaintNode>, sk_sp<AnimatablePropertyContainer> = nullptr); }; } // namespace internal } // namespace skottie #endif // SkottieShapeLayer_DEFINED
[ "pcding@ucdavis.edu" ]
pcding@ucdavis.edu
882f535e71b4e6e6c6f70219651481f04fcd29c1
fbbc663c607c9687452fa3192b02933b9eb3656d
/tags/1.22.02.00/unarchiver/unzip.cpp
a74bec4f2054fa517a87470d11f53c8e6749790e
[ "BSD-3-Clause" ]
permissive
svn2github/OpenMPT
594837f3adcb28ba92a324e51c6172a8c1e8ea9c
a2943f028d334a8751b9f16b0512a5e0b905596a
refs/heads/master
2021-07-10T05:07:18.298407
2019-01-19T10:27:21
2019-01-19T10:27:21
106,434,952
2
1
null
null
null
null
UTF-8
C++
false
false
5,469
cpp
/* * unzip.cpp * --------- * Purpose: Implementation file for extracting modules from .zip archives, making use of MiniZip (from the zlib contrib package) * Notes : (currently none) * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ #include "../soundlib/FileReader.h" #include <vector> #include "unzip.h" #include "../common/misc_util.h" #include <algorithm> #ifndef ZLIB_WINAPI #define ZLIB_WINAPI #endif // ZLIB_WINAPI #include <contrib/minizip/unzip.h> // Low-level file abstractions for in-memory file handling struct ZipFileAbstraction { static voidpf ZCALLBACK fopen_mem(voidpf opaque, const char *, int mode) { FileReader &file = *static_cast<FileReader *>(opaque); if((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER) == ZLIB_FILEFUNC_MODE_WRITE) { return nullptr; } else { file.Rewind(); return opaque; } } static uLong ZCALLBACK fread_mem(voidpf opaque, voidpf, void *buf, uLong size) { FileReader &file = *static_cast<FileReader *>(opaque); if(size > file.BytesLeft()) { size = file.BytesLeft(); } memcpy(buf, file.GetRawData(), size); file.Skip(size); return size; } static uLong ZCALLBACK fwrite_mem(voidpf, voidpf, const void *, uLong) { return 0; } static long ZCALLBACK ftell_mem(voidpf opaque, voidpf) { FileReader &file = *static_cast<FileReader *>(opaque); return file.GetPosition(); } static long ZCALLBACK fseek_mem(voidpf opaque, voidpf, uLong offset, int origin) { FileReader &file = *static_cast<FileReader *>(opaque); switch(origin) { case ZLIB_FILEFUNC_SEEK_CUR: offset += file.GetPosition(); break; case ZLIB_FILEFUNC_SEEK_END: offset += file.GetLength(); break; case ZLIB_FILEFUNC_SEEK_SET: break; default: return -1; } return (file.Seek(offset) ? 0 : 1); } static int ZCALLBACK fclose_mem(voidpf, voidpf) { return 0; } static int ZCALLBACK ferror_mem(voidpf, voidpf) { return 0; } }; CZipArchive::CZipArchive(FileReader &file, const std::vector<const char *> &ext) : inFile(file), extensions(ext) //-------------------------------------------------------------------------------------------------------------- { zlib_filefunc_def functions = { ZipFileAbstraction::fopen_mem, ZipFileAbstraction::fread_mem, ZipFileAbstraction::fwrite_mem, ZipFileAbstraction::ftell_mem, ZipFileAbstraction::fseek_mem, ZipFileAbstraction::fclose_mem, ZipFileAbstraction::ferror_mem, &inFile }; zipFile = unzOpen2(nullptr, &functions); } CZipArchive::~CZipArchive() //------------------------- { unzClose(zipFile); delete[] outFile.GetRawData(); } bool CZipArchive::IsArchive() const //--------------------------------- { return (zipFile != nullptr); } struct find_str { find_str(const char *str): s1(str) { } bool operator() (const char *s2) const { return !strcmp(s1, s2); } const char *s1; }; bool CZipArchive::ExtractFile() //----------------------------- { unz_file_pos bestFile; unz_file_info info; uLong biggestFile = 0; int status = unzGoToFirstFile(zipFile); unzGetFilePos(zipFile, &bestFile); while(status == UNZ_OK) { char name[256]; unzGetCurrentFileInfo(zipFile, &info, name, sizeof(name), nullptr, 0, nullptr, 0); // Extract file extension char *ext = name + info.size_filename; while(ext > name) { ext--; *ext = tolower(*ext); if(*ext == '.') { ext++; break; } } // Compare with list of preferred extensions if(std::find_if(extensions.begin(), extensions.end(), find_str(ext)) != extensions.end()) { // File has a preferred extension: use it. unzGetFilePos(zipFile, &bestFile); break; } if(strcmp(ext, "diz") && strcmp(ext, "nfo") && strcmp(ext, "txt") && info.uncompressed_size >= biggestFile) { // If this isn't some kind of info file, we should maybe pick it. unzGetFilePos(zipFile, &bestFile); biggestFile = info.uncompressed_size; } status = unzGoToNextFile(zipFile); } if(unzGoToFilePos(zipFile, &bestFile) == UNZ_OK && unzOpenCurrentFile(zipFile) == UNZ_OK) { unzGetCurrentFileInfo(zipFile, &info, nullptr, 0, nullptr, 0, nullptr, 0); delete[] outFile.GetRawData(); char *data = new (std::nothrow) char[info.uncompressed_size]; if(data != nullptr) { unzReadCurrentFile(zipFile, data, info.uncompressed_size); outFile = FileReader(data, info.uncompressed_size); } unzCloseCurrentFile(zipFile); return (data != nullptr); } return false; } const char *CZipArchive::GetComments(bool get) //-------------------------------------------- { unz_global_info info; if(zipFile == nullptr || unzGetGlobalInfo(zipFile, &info) != UNZ_OK) { return nullptr; } if(!get) { return reinterpret_cast<char *>((info.size_comment > 0) ? 1 : 0); } else if(info.size_comment > 0) { if(info.size_comment < Util::MaxValueOfType(info.size_comment)) { info.size_comment++; } char *comment = new (std::nothrow) char[info.size_comment]; if(comment != nullptr && unzGetGlobalComment(zipFile, comment, info.size_comment) >= 0) { comment[info.size_comment - 1] = '\0'; return comment; } else { delete[] comment; } } return nullptr; }
[ "saga-games@56274372-70c3-4bfc-bfc3-4c3a0b034d27" ]
saga-games@56274372-70c3-4bfc-bfc3-4c3a0b034d27
03f351872454aeab4fc2e1d090cae7afc9302ef8
795ed2f56f2b8b0e3b32b4ef796526233a8ce060
/funcPointer/Source.cpp
46af94c63dc68296a9cf7feb0f3034ffc5e23c2b
[]
no_license
windo-developer/CPP_Study
d436883b499d2ab8f7d530c3cea461da98d99643
369211ff67bd78a35fec8b246001d2e40723d65e
refs/heads/master
2023-04-24T00:11:05.598137
2021-05-10T08:09:02
2021-05-10T08:09:02
346,973,279
0
0
null
null
null
null
UTF-8
C++
false
false
778
cpp
#include <iostream> using namespace std; template<typename T, int SIZE = 10> class RandomBox { public: T GetRnadomData() { int index = rand() % SIZE; return _data[index]; } public: T _data[SIZE]; private: }; template<int SIZE> class RandomBox<double, SIZE> { public: double GetRnadomData() { int index = rand() % SIZE; return _data[index]; } public: double _data[SIZE]; private: }; int main() { srand(static_cast<unsigned int>(time(nullptr))); RandomBox<int, 10> rb1; for (int i = 0; i < 10; i++) { rb1._data[i] = i; } int value1 = rb1.GetRnadomData(); RandomBox<double, 20> rb2; for (int i = 0; i < 20; i++) { rb2._data[i] = i + 0.5f; } float value2 = rb2.GetRnadomData(); cout << value1 << endl; cout << value2 << endl; return 0; }
[ "yui050505@gmail.com" ]
yui050505@gmail.com
d6c6b4638206384ff47b3b212bb1bd568808df55
2dbbcbdceb9c3e1647a401103bf55afabe156eac
/sca/tools/scagen/junit/testinput/modules/MyValueServiceModule/StockQuoteService.h
d96115fb3fe75eec029f88459ae0ff13a986e84a
[ "Apache-2.0" ]
permissive
lelou13/tuscany-sca-cpp
bd30f5967f0c3a95382d80f38ee41a16ec7420ca
b06cb5b2608c0802c15c75c708589e82a9c60e2d
refs/heads/cpp-M1
2021-01-15T08:04:32.276885
2009-11-16T06:23:13
2009-11-16T06:23:13
49,079,719
0
0
null
2016-01-05T16:58:49
2016-01-05T16:58:49
null
UTF-8
C++
false
false
1,022
h
/* * * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // ////////////////////////////////////////////////////////////////////// #ifndef StockQuoteService_h #define StockQuoteService_h #include <string> #include "commonj/sdo/sdo.h" using std::string; class StockQuoteService { public: virtual commonj::sdo::DataObjectPtr GetStockQuotes(commonj::sdo::DataObjectPtr request) = 0; }; #endif // StockQuoteService_h
[ "robbinspg@apache.org" ]
robbinspg@apache.org
e99ea7eb247dd12df06b7334fd2cd2f7d9a73cf5
5776c02b86d6b1ddf086d7918942ef25e66e153b
/Practice/Concepts/Bitmasks/2_mul_and_div_by2.cpp
db8d8af594388144bf4f05f39e9f89a8a53bad36
[]
no_license
DaKidReturns/CP
11282b018060b06e82a6114d0c3e13feae61d801
4786a08a4a20b2c7c6f762abfd01a3b53adb6ff2
refs/heads/master
2023-07-10T18:18:20.002544
2021-08-21T14:24:10
2021-08-21T14:24:10
317,222,217
0
0
null
null
null
null
UTF-8
C++
false
false
237
cpp
#include<iostream> int main(){ int n; std::cout<<"Enter an intege: "; std::cin>>n; int p = n<<1; int q = n>>1; std::cout<<n<<" * 2 = "<< p<<std::endl; std::cout<<n<<" / 2 = "<< q<<std::endl; return 0; }
[ "rohitkarun@gmail.com" ]
rohitkarun@gmail.com
9b5839ac141839f42142ef616a0b0139309fe86e
e006fa41b367201c1772a2cdf5f99deccf5ff45f
/src/plato/DynamicCompliance.hpp
afe1d0242da76efb8734f306cd0d7660526afbc3
[ "BSD-2-Clause" ]
permissive
overfelt/lgrtk
9ed00dc9e4d3dac82426c5a0de0b7e84c4a4fc63
d359cc17f69c8742c5375adfe6811984b1693410
refs/heads/master
2020-03-31T10:12:04.527791
2019-01-17T00:06:26
2019-01-17T00:06:43
152,126,312
0
0
NOASSERTION
2018-10-08T18:22:33
2018-10-08T18:22:33
null
UTF-8
C++
false
false
9,047
hpp
/* * DynamicCompliance.hpp * * Created on: Apr 25, 2018 */ #ifndef DYNAMICCOMPLIANCE_HPP_ #define DYNAMICCOMPLIANCE_HPP_ #include <memory> #include <Omega_h_mesh.hpp> #include <Omega_h_matrix.hpp> #include <Teuchos_ParameterList.hpp> #include "ImplicitFunctors.hpp" #include "LinearElasticMaterial.hpp" #include "plato/StateValues.hpp" #include "plato/ApplyPenalty.hpp" #include "plato/ComplexStrain.hpp" #include "plato/SimplexFadTypes.hpp" #include "plato/ApplyProjection.hpp" #include "plato/PlatoStaticsTypes.hpp" #include "plato/ComplexLinearStress.hpp" #include "plato/ComplexElasticEnergy.hpp" #include "plato/ComplexInertialEnergy.hpp" #include "plato/AbstractScalarFunction.hpp" #include "plato/LinearTetCubRuleDegreeOne.hpp" #include "plato/SimplexStructuralDynamics.hpp" namespace Plato { template<typename EvaluationType, class PenaltyFuncType, class ProjectionFuncType> class DynamicCompliance: public Plato::SimplexStructuralDynamics<EvaluationType::SpatialDim, EvaluationType::NumControls>, public AbstractScalarFunction<EvaluationType> { private: using Plato::SimplexStructuralDynamics<EvaluationType::SpatialDim>::m_numVoigtTerms; using Plato::SimplexStructuralDynamics<EvaluationType::SpatialDim>::mComplexSpaceDim; using Plato::SimplexStructuralDynamics<EvaluationType::SpatialDim>::m_numDofsPerNode; using Plato::SimplexStructuralDynamics<EvaluationType::SpatialDim>::m_numDofsPerCell; using Plato::SimplexStructuralDynamics<EvaluationType::SpatialDim>::m_numNodesPerCell; using StateScalarType = typename EvaluationType::StateScalarType; using ControlScalarType = typename EvaluationType::ControlScalarType; using ConfigScalarType = typename EvaluationType::ConfigScalarType; using ResultScalarType = typename EvaluationType::ResultScalarType; private: Plato::Scalar mDensity; PenaltyFuncType mPenaltyFunction; ProjectionFuncType mProjectionFunction; Plato::ApplyPenalty<PenaltyFuncType> mApplyPenalty; Plato::ApplyProjection<ProjectionFuncType> mApplyProjection; Omega_h::Matrix<m_numVoigtTerms, m_numVoigtTerms> mCellStiffness; std::shared_ptr<Plato::LinearTetCubRuleDegreeOne<EvaluationType::SpatialDim>> mCubatureRule; public: /**************************************************************************/ DynamicCompliance(Omega_h::Mesh& aMesh, Omega_h::MeshSets& aMeshSets, Plato::DataMap& aDataMap, Teuchos::ParameterList& aProblemParams, Teuchos::ParameterList& aPenaltyParams) : AbstractScalarFunction<EvaluationType>(aMesh, aMeshSets, aDataMap, "Dynamic Energy"), mDensity(aProblemParams.get<double>("Material Density", 1.0)), mProjectionFunction(), mPenaltyFunction(aPenaltyParams), mApplyPenalty(mPenaltyFunction), mApplyProjection(mProjectionFunction), mCellStiffness(), mCubatureRule(std::make_shared<Plato::LinearTetCubRuleDegreeOne<EvaluationType::SpatialDim>>()) /**************************************************************************/ { // Create material model and get stiffness Plato::ElasticModelFactory<EvaluationType::SpatialDim> tElasticModelFactory(aProblemParams); auto tMaterialModel = tElasticModelFactory.create(); mCellStiffness = tMaterialModel->getStiffnessMatrix(); } /**************************************************************************/ DynamicCompliance(Omega_h::Mesh& aMesh, Omega_h::MeshSets& aMeshSets, Plato::DataMap& aDataMap) : AbstractScalarFunction<EvaluationType>(aMesh, aMeshSets, aDataMap, "Dynamic Energy"), mDensity(1.0), mProjectionFunction(), mPenaltyFunction(), mApplyPenalty(mPenaltyFunction), mApplyProjection(mProjectionFunction), mCellStiffness(), mCubatureRule(std::make_shared<Plato::LinearTetCubRuleDegreeOne<EvaluationType::SpatialDim>>()) /**************************************************************************/ { // Create material model and get stiffness Teuchos::ParameterList tParamList; tParamList.set < Plato::Scalar > ("Poissons Ratio", 1.0); tParamList.set < Plato::Scalar > ("Youngs Modulus", 0.3); Plato::IsotropicLinearElasticMaterial<EvaluationType::SpatialDim> tDefaultMaterialModel(tParamList); mCellStiffness = tDefaultMaterialModel.getStiffnessMatrix(); } /**************************************************************************/ virtual ~DynamicCompliance() { } /**************************************************************************/ /************************************************************************* * Evaluate f(u,z)=\frac{1}{2}u^{T}(K(z) - \omega^2 M(z))u, where u denotes * states, z denotes controls, K denotes the stiffness matrix and M denotes * the mass matrix. **************************************************************************/ void evaluate(const Plato::ScalarMultiVectorT<StateScalarType> & aState, const Plato::ScalarMultiVectorT<ControlScalarType> & aControl, const Plato::ScalarArray3DT<ConfigScalarType> & aConfig, Plato::ScalarVectorT<ResultScalarType> & aResult, Plato::Scalar aTimeStep = 0.0) const /**************************************************************************/ { using StrainScalarType = typename Plato::fad_type_t<Plato::SimplexStructuralDynamics<EvaluationType::SpatialDim>, StateScalarType, ConfigScalarType>; // Elastic forces functors Plato::ComplexElasticEnergy<m_numVoigtTerms> tComputeElasticEnergy; Plato::ComputeGradientWorkset<EvaluationType::SpatialDim> tComputeGradientWorkset; Plato::ComplexStrain<EvaluationType::SpatialDim, m_numDofsPerNode> tComputeVoigtStrain; Plato::ComplexLinearStress<EvaluationType::SpatialDim, m_numVoigtTerms> tComputeVoigtStress(mCellStiffness); // Inertial forces functors Plato::StateValues tComputeStateValues; Plato::ComplexInertialEnergy<EvaluationType::SpatialDim> tComputeInertialEnergy(aTimeStep, mDensity); // Elastic forces containers auto tNumCells = aControl.extent(0); Plato::ScalarVectorT<ConfigScalarType> tCellVolume("CellWeight", tNumCells); Plato::ScalarArray3DT<StrainScalarType> tCellStrain("CellStrain", tNumCells, mComplexSpaceDim, m_numVoigtTerms); Plato::ScalarArray3DT<ResultScalarType> tCellStress("CellStress", tNumCells, mComplexSpaceDim, m_numVoigtTerms); Plato::ScalarArray3DT<ConfigScalarType> tCellGradient("Gradient", tNumCells, m_numNodesPerCell, EvaluationType::SpatialDim); // Inertial forces containers Plato::ScalarVectorT<ResultScalarType> tElasticEnergy("ElasticEnergy", tNumCells); Plato::ScalarVectorT<ResultScalarType> tInertialEnergy("InertialEnergy", tNumCells); Plato::ScalarMultiVectorT<StateScalarType> tStateValues("StateValues", tNumCells, m_numDofsPerNode); auto & tApplyPenalty = mApplyPenalty; auto & tApplyProjection = mApplyProjection; auto & tPenaltyFunction = mPenaltyFunction; auto tQuadratureWeight = mCubatureRule->getCubWeight(); auto tBasisFunctions = mCubatureRule->getBasisFunctions(); Kokkos::parallel_for(Kokkos::RangePolicy<>(0, tNumCells), LAMBDA_EXPRESSION(const Plato::OrdinalType & aCellOrdinal) { // Internal forces contribution tComputeGradientWorkset(aCellOrdinal, tCellGradient, aConfig, tCellVolume); tCellVolume(aCellOrdinal) *= tQuadratureWeight; tComputeVoigtStrain(aCellOrdinal, aState, tCellGradient, tCellStrain); tComputeVoigtStress(aCellOrdinal, tCellStrain, tCellStress); // Apply penalty to internal forces ControlScalarType tCellDensity = tApplyProjection(aCellOrdinal, aControl); tApplyPenalty(aCellOrdinal, tCellDensity, tCellStress); tComputeElasticEnergy(aCellOrdinal, tCellStress, tCellStrain, tElasticEnergy); tElasticEnergy(aCellOrdinal) *= tCellVolume(aCellOrdinal); // Inertial forces contribution tComputeStateValues(aCellOrdinal, tBasisFunctions, aState, tStateValues); tComputeInertialEnergy(aCellOrdinal, tCellVolume, tStateValues, tInertialEnergy); ControlScalarType tPenaltyValue = tPenaltyFunction(tCellDensity); tInertialEnergy(aCellOrdinal) *= tPenaltyValue; // Add inertial forces contribution aResult(aCellOrdinal) = static_cast<Plato::Scalar>(0.5) * ( tElasticEnergy(aCellOrdinal) + tInertialEnergy(aCellOrdinal) ); }, "Dynamic Compliance Calculation"); } }; // class DynamicCompliance }//namespace Plato #endif /* DYNAMICCOMPLIANCE_HPP_ */
[ "daibane@sandia.gov" ]
daibane@sandia.gov
06a0c641b7179d15f14c4864b479f7ff277022d7
b297b80f99532e6aff0cb6500a1079a54b830901
/src/Ventana.h
c93b816cfc193d8681ea1af4fe4364b946a73544
[]
no_license
alejandro2014/game
e8076a9980d5f0b95a58dd6077b8c511ab7135f5
14d44dc6b0ab04fb7757574725ef47f59a314710
refs/heads/master
2016-09-12T23:32:24.993008
2016-04-14T19:27:01
2016-04-14T19:27:01
56,264,395
0
0
null
null
null
null
UTF-8
C++
false
false
728
h
/* * Juego.h * * Created on: 22 Nov 2009 * Author: alejandro */ #ifndef VENTANA_H_ #define VENTANA_H_ #include "cabecera.h" #include "Dcel.h" #include "Ventana.h" #include <sys/time.h> class Ventana { private: GLfloat angAlfa, angBeta; //GLfloat distancia; SDL_Surface *screen; int done; //Variables relacionadas con la medición de los fps struct timeval tiempo0, tiempo1; float frameRate; public: Ventana(); ~Ventana(); void reshape(int width, int height); void dibujarEscena(GLfloat angAlfa, GLfloat angBeta, GLfloat distancia, Dcel *dcel); void dibujarEjes(void); SDL_Surface* getSurface() {return screen;} //void setDistancia(GLfloat increm) {distancia -= increm;} }; #endif /* VENTANA_H_ */
[ "you@fakemail.com" ]
you@fakemail.com
57eb5a76eae0f7ea9db352f097046b6eeb6a62a1
83b0434238f6aac2a37cd7ae10df270636f63618
/lab6/lab6v13.cpp
0d74af09f6133dd1adc67d598b609047611a521c
[]
no_license
hickeym2/object-oriented-programming
0a0a5ef13f3653e94e7a152b00ab2783e97a8c15
085367b4dd550c41e0375dda5740936e61d2a610
refs/heads/master
2020-03-25T09:14:07.574806
2018-08-05T23:36:43
2018-08-05T23:36:43
143,655,309
0
0
null
null
null
null
UTF-8
C++
false
false
16,432
cpp
/* * Mike Hickey * Professor Carpenter * Lab 6 Linked List * Due Date 10/21/16 */ #include <iostream> #include <cstdlib> #include <string> #include <fstream> #include <sstream> using namespace std; //=== Struct === struct entry_qb{ string firstName; string lastName; string entryName; int arrayYear[4]; int yearWon; int numWins; int wins;// not used int yesHead;//not used entry_qb *next; //points to the next struct in the list entry_qb *prev; //points to the previous struct in the list }; entry_qb *list = NULL; //=== Function Prototype === void menu(int &menuSel); void clearScreen(); void exitProgram(); void testPrint(int menuSel); void makeEntry(entry_qb *list);//case 1 int readList(entry_qb *list, entry_qb *head);//case 2 void searchNameYearNum(entry_qb *list, entry_qb *head);//case 3 void deleteEntry(entry_qb *list, entry_qb *head);//case 5 void deleteList(entry_qb *&list, entry_qb *head);//case 6 void populateList(entry_qb *&list, entry_qb *&head);//case 7 entry_qb *search(entry_qb *list, entry_qb *head, string fName, string lName, int yrWon); int main(){ int menuSel = 0; clearScreen(); entry_qb *head = NULL; //initially the first time you run the program, you want a list to be there. populateList(list, head); menu(menuSel); do{ /* Just because you don't like do-while. */ switch (menuSel){ case 1: makeEntry(list); cout << endl; menu(menuSel); break; //case 1 add an entry. case 2: readList(list, head); cout << endl; menu(menuSel); break; //case 2 read full list to screen case 3: searchNameYearNum(list, head); cout << endl << endl; menu(menuSel); break; //case 3 search for year, name, or number case 4: cout << endl << endl; menu(menuSel); break; //case 4 sort alphabetically case 5: deleteEntry(list, head); cout << endl << endl; menu(menuSel); break; //case 5 delete an entry case 6: deleteList(list, head); cout << endl; menu(menuSel); break; //case 6 remove all entries case 7: populateList(list, head); cout << "The list has been reset." << endl << endl; menu(menuSel); break; //case 7 reset list to original default:cout << "Exiting Program. . . " << endl; return 0; break; //default will exit the program. }//end of switch(menuSel) }while(menuSel != 0);//end of do-while loop }//End of main void menu(int &menuSel){ cout << "Select 1 to add an entry to the list.\nSelect 2 to read the list.\nSelect 3 to search for a year, name, or number.\nSelect 4 to sort the list in alphabetical order.\nSelect 5 to delete an entry.\nSelect 6 to remove all entries.\nSelect 7 to reset the list.\nSelect 8 to exit the program.\nSelecting: "; cin >> menuSel; }//end of menu() void clearScreen(){ for (int i = 0; i < 50; i++){ cout << endl; } }//end of clearScreen() void exitProgram(){ cout << "Exiting Program. . ." << endl; exit(0); }//end of exitProgram() void testPrint(int menuSel){ cout << "Testing. . . " << endl << "menuSel = " << menuSel << endl; }//end of testPrint() void populateList(entry_qb *&list, entry_qb *&head){ string line, fName, lName; int yrWon = 0; static int checkRan = 0; //entry_qb head;//maybe make head a pointer list = NULL; //You will be inside the file qbList.txt referened to as infile. ifstream infile; infile.open("qbListv2.txt"); //Can you open the file? This will check if it's there or corrupted. if (infile.fail()){ cerr << "Error Opening File." << endl << "File not found, HTTP 404." << endl; exit(1); } entry_qb *temp; //Nothing is wrong with qbListv2.txt while(infile >> fName >> lName >> yrWon){ //While there is a line get it. if(list == NULL){ //This is making the head struct as the first entry from reading the qbListv2.txt head = new entry_qb; head -> firstName = fName; head -> lastName = lName; //iniializing the arrayYear to 0 and what the file said. head -> arrayYear[0] = yrWon; head -> arrayYear[1] = 0; head -> arrayYear[2] = 0; head -> arrayYear[3] = 0; head -> next = head; head -> prev = head; head -> numWins = 1; list = head; //list is a pointer, and its now storing the address of head in it. so its pointing to head. //Seriously list and head are the same thing so its redundant. //already making a temp pointer to set up the rest of the list. temp = head; }else{ //Now dynamically create entry_qb and store the lines in it. Only if the person was not created before. entry_qb *return_qb;//this equals NULL at the start of search() funciton. return_qb = search(list, head, fName, lName, yrWon); if(return_qb){ return_qb -> numWins = (return_qb -> numWins) + 1; return_qb -> arrayYear[return_qb -> numWins -1] = yrWon; //because array starts at 0, and everyone initially has a numWin value of 1. temp = head -> prev;// so you can start at the end of the "tail" }else{ temp -> next = new entry_qb; temp -> next -> firstName = fName; temp -> next -> lastName = lName; temp -> next -> yearWon = yrWon; //initializing my arrayYear to store yrWon temp -> next -> arrayYear[0] = yrWon; temp -> next -> arrayYear[1] = 0; temp -> next -> arrayYear[2] = 0; temp -> next -> arrayYear[3] = 0; temp -> next -> next = head; temp -> next -> prev = temp; temp -> next -> numWins = 1; temp = temp -> next; head -> prev = temp; }//end of else where if asks if a qb was found }//end of else statement }//end of while loop cout << endl; }//end of populateList() void deleteList(entry_qb *&list, entry_qb *head){ //not really deleting the list, its just orphaning the list. //so loop backwards and do a delete entry function from if head and while temp != head int ran = 0; for(entry_qb *temp = head; temp != head -> prev; temp = temp -> next){ if(ran == 0){ entry_qb *holder1 = head -> prev; entry_qb *holder2 = head -> next; head -> prev -> next = holder2; head -> next -> prev = holder1; ran = 1; temp = temp -> prev;//this is so it prints out trentDilfer2001 delete head; }else{ entry_qb *holder1 = temp -> prev; entry_qb *holder2 = temp -> next; temp -> prev -> next = holder2; temp -> next -> prev = holder1; delete temp; } list = NULL; }//end of for loop cout << endl << "The list has been deleted." << endl; }//end of deleteList() void deleteEntry(entry_qb *list, entry_qb *head){ string delFirstName; string delLastName; entry_qb *temp; int check = 0; cout << endl; if(list == NULL){ cout << "There is no list, so you can not delete an entry." << endl; }else{ cout << "Enter the first name of the QB that you want to delete." << endl; cout << "First Name: "; cin >> delFirstName; cout << "Enter the last name of the QB that you want to delete." << endl; cout << "Last Name: "; cin >> delLastName; if(!(head -> firstName.compare(delFirstName)) && !(head -> lastName.compare(delLastName))){ entry_qb *holder1 = head -> prev; entry_qb *holder2 = head -> next; head -> prev -> next = holder2; head -> next -> prev = holder1; delete head; check = 1; cout << endl << delFirstName << " " << delLastName << " was deleted."; }//end of if statement temp = head -> next; while(temp != head){ if(!(temp -> firstName.compare(delFirstName)) && !(temp -> lastName.compare(delLastName))){ entry_qb *holder1 = temp -> prev; entry_qb *holder2 = temp -> next; temp -> prev -> next = holder2; temp -> next -> prev = holder1; delete temp; check = 1; cout << endl << delFirstName << " " << delLastName << " was deleted."; } temp = temp -> next; }//end of while }//end of if else list = null if(check == 0){ cout << "No QB of " << delFirstName << " " << delLastName << " was found in the list."; } }//end of deleteEntry() int readList(entry_qb *list, entry_qb *head){ if(list == NULL){ cout << endl << "No available list." << endl; }else{ int ran = 0; for(entry_qb *temp = head; temp != head -> prev; temp = temp -> next){ if(ran == 0){ cout << endl; cout << head -> firstName << " "; cout << head -> lastName << " "; for(int i = 0; i != head -> numWins; i++){ cout << (head -> arrayYear[i]); cout << " "; } cout << endl; ran = 1; temp = temp -> prev;//this is so it prints out trentDilfer2001 }else{ cout << temp -> next -> firstName << " "; cout << temp -> next -> lastName << " "; for(int i = 0; i != temp -> next -> numWins; i++){ cout << (temp -> next -> arrayYear[i]); cout << " "; }//end of for loop cout << endl; }//end of if else }//end of for loop }//end of if else }//end of readList() //How do i ask if a previous entry of the same name was made? entry_qb *search(entry_qb *list, entry_qb *head, string fName, string lName, int yrWon){ entry_qb *return_qb; return_qb = NULL; entry_qb *temp; //hey this is a specific check just for head since you cant really //start a loop at head and end at head since it a circle. if(!(head -> firstName.compare(fName)) && !(head -> lastName.compare(lName))){ //bryon helped me with the .compare because you can not do == for string. //he showed my why you use this to compare strings and need the ! //This is why i am in comp sci 1 return_qb = temp; return return_qb;//returns head if it was found. }//end of if statement to check for head. temp = head -> next; //This temp = head -> next is here so the while loop will start checking //at the second position of the list. while (temp != head){ //Heyyy this entry you just made, does it match a name of a previous entry? //if it does match an entry, return that qb inside return_qb //hey does temp -> lastName have any differences from lName? if yes, return 1. //in our situation, there are no differences in the strings so the compare results in a 0 //then we do the NOT of 0 and get a 1. if(!(temp -> firstName.compare(fName)) && !(temp -> lastName.compare(lName))){ return_qb = temp; return return_qb;//returns the entry that matched to populate list. } temp = temp -> next; }//end of while loop return return_qb;//returns NULL }//end of checkDuplicate() void makeEntry(entry_qb *list){ string entFirstName; string entLastName; int entYearWon; entry_qb *temp; entry_qb *head = list; //First gather the info to input. cout << "Enter the first name of the QB you would like to enter to the list." << endl; cout << "First Name: "; cin >> entFirstName; cout << "Enter the last name of thr QB you would like to enter to the list." << endl; cout << "Last Name: "; cin >> entLastName; cout << "Enter the year the QB won the super bowl." << endl; cout << "Year Won: "; cin >> entYearWon; if(list == NULL){ //this will make the head if there is no head. //Now fill the struct with your input. head = new entry_qb; head -> firstName = entFirstName; head -> lastName = entLastName; head -> arrayYear[0] = entYearWon; head -> next = head; head -> prev = head; head -> numWins = 1; list = head; temp = head;//starting the list at the head. }else{ //Now dynamically create entry_qb and store the lines in it. Only if the person was not created before. entry_qb *return_qb = NULL;//this equals NULL at the start of search() funciton. return_qb = search(list, head, entFirstName, entLastName, entYearWon); //we are changing the arguments in this function to be different from the prototype. //if(return_qb) == NULL skip the if statement code block if(return_qb){ return_qb -> numWins = (return_qb -> numWins) + 1; return_qb -> arrayYear[return_qb -> numWins -1] = entYearWon; //because array starts at 0, and everyone initially has a numWin value of 1. temp = head -> prev;// so you can start at the end of the "tail" }else{ //if the list is not null lets add on an entry. temp = head -> prev; temp -> next = new entry_qb; temp -> firstName = entFirstName; temp -> lastName = entLastName; temp -> yearWon = entYearWon; temp -> arrayYear[0] = entYearWon; temp -> next -> next = head; temp -> next -> prev = temp; temp -> numWins = 1; //this says //temp = head //head ->prev = head; //temp = temp -> next;//pushes temp to the next entry_qb, which is head head -> prev = temp -> next;//links head to the tail }//end of if else }//end of if else to make new entries cout << endl; cout << entFirstName << " " << entLastName << " " << entYearWon << " has been added to the list." << endl; cout << endl; }//end of makeEntry() void searchNameYearNum(entry_qb *list, entry_qb *head){ int menuSel = 0; string fName, lName; int yrWon; bool menuLoop = 1; if(list == NULL){ cout << endl << "No available list, you should reset the list or add an entry."; }else{ cout << endl; cout << "Select 1 to search for a QB's name." << endl; cout << "Select 2 to seach for a QB by year." << endl; cout << "Select 3 to search for a QB by number of wins." << endl; cout << "Selecting: "; cin >> menuSel; cout << endl; while(menuLoop){ if(menuSel == 1){ //Search for a name. cout << "Enter the QB's first name." << endl << "First Name: "; cin >> fName; cout << "Enter the QB's last name." << endl << "Last Name: "; cin >> lName; cout << endl; //making return_qb so I can store the output of the function. entry_qb *return_qb; //the 1 in the function search is here so i can just pass 1, its not used, but the parameters are there so i can search by year won later. return_qb = search(list, head, fName, lName, 1); if(return_qb){ cout << fName << " " << lName << " " << "was found in the list."; }else{ cout << "No QB of name " << fName << " " << lName << " exists in the list."; } menuLoop = 0; }else if(menuSel == 2){ //search for a year cout << "Enter the year you would like to search for." << endl << "Year: "; cin >> yrWon; entry_qb *return_qb; return_qb = NULL; entry_qb *temp; if(head -> arrayYear[0] == yrWon || head -> arrayYear[1] == yrWon || head -> arrayYear[2] == yrWon || head -> arrayYear[3] == yrWon){ return_qb = temp; }//end of if statement to check for head. temp = head -> next; while (temp != head){ if(temp -> arrayYear[0] == yrWon || temp -> arrayYear[1] == yrWon || temp -> arrayYear[2] == yrWon || temp -> arrayYear[3] == yrWon){ return_qb = temp; } temp = temp -> next; }//end of while loop //return_qb will be NULL here if nothing is found if(return_qb){ cout << endl << return_qb -> firstName << " " << return_qb -> lastName << " won the super bowl in " << yrWon << "."; }else{ cout << endl << "No QB in the list has won in the year " << yrWon << "."; } menuLoop = 0; }else if(menuSel == 3){ //search by number of wins. int wins = 0; entry_qb *return_qb = NULL; entry_qb *temp; cout << "Enter the number of times that a QB might have won the super bowl." << endl << "Number of Wins: "; cin >> wins; cout << endl; if(head -> numWins >= wins){ return_qb = temp; cout << head -> firstName << " " << head -> lastName << endl; } temp = head -> next; while (temp != head){ if(temp -> numWins >= wins){ return_qb = temp; cout << temp -> firstName << " " << temp -> lastName << endl; } temp = temp -> next; }//end of while loop if(return_qb){ if(wins == 1){ cout << endl << "These QBs were found in the list with at least " << wins << " win."; }else{ cout << endl << "These QBs were found in the list with at least " << wins << " wins."; } }else{ if(wins == 1){ cout << "No QBs were found in the list with at least " << wins << " win." << endl; cout << "Because the list is empty"; }else{ cout << "No QBs were found in the list with at least " << wins << " wins."; } } menuLoop = 0; }else{ cout << endl << "You did not select an option." << endl << "Selecting: "; cin >> menuSel; menuLoop = 1; } }//end of while loop }//end of big if else where if(list == NULL) }//end of searchNameYearNum()
[ "mikehickey95@gmail.com" ]
mikehickey95@gmail.com
c5fab90689a4f8592a11737d201e0400eaeeaa42
5aa0551354d442ef3c531802775ac4eab96c3b01
/Source/ui/longitudinalwidget.h
05a2735983e54d1f27701c65ab50561f42feee96
[]
no_license
rafaelppires/weldway
404e26d0676720b2e6c7a168c925654dc7f96f14
ea421cb4879420ca691265aa0dde979b5ce6bbd8
refs/heads/master
2016-08-03T08:42:48.467688
2015-09-21T13:14:29
2015-09-21T13:14:29
31,918,598
0
0
null
null
null
null
UTF-8
C++
false
false
882
h
#ifndef LONGITUDINALWIDGET_H #define LONGITUDINALWIDGET_H #include <oscillation_widget.h> #include <slider_spin.h> #include <trajectory.h> namespace Ui { class LongitudinalWidget; } //----------------------------------------------------------------------------- class LongitudinalWidget : public OscillationWidget { Q_OBJECT public: explicit LongitudinalWidget(QWidget *parent = 0); ~LongitudinalWidget(); virtual AbsTrajectoryPtr trajectory(TrajectoryTransformPtr tt); virtual void draft(PositionVector&) {} private slots: void on_longTrajectoryComboBox_currentTextChanged(const QString &arg1); void changeRatios(); private: Ui::LongitudinalWidget *ui; SliderSpin *sbWeldSpeedSliderSpin, *fwSpeedSliderSpin, *fwLengthSliderSpin, *bwSpeedSliderSpin, *bwLengthSliderSpin, *spdratioSliderSpin; }; #endif // LONGITUDINALWIDGET_H
[ "Rafael@5480589f-094f-1b4a-8096-6e62e98e9fcd" ]
Rafael@5480589f-094f-1b4a-8096-6e62e98e9fcd
476b427a7993fa35effae3c37e1216dabf090c8a
1a1155a3e9535206d692fe2c7ddff27ca7e712c5
/8_Program.cpp
14bf01370004208a5656105c46d38a8ac0fc64f1
[]
no_license
anuragbisht12/CPP-Revisited
e080c9073514500a56db2f7de1b8608f0062d3ea
f35c015b8e34b13395c885e6d3ac83f5fad7a604
refs/heads/master
2023-02-10T04:24:26.378913
2020-12-28T14:16:52
2020-12-28T14:16:52
278,111,349
0
0
null
null
null
null
UTF-8
C++
false
false
2,908
cpp
/* C++ Strings C++ provides following two types of string representations − The C-style character string. The string class type introduced with Standard C++. The C-Style Character String The C-style character string originated within the C language and continues to be supported within C++. This string is actually a one-dimensional array of characters which is terminated by a null character '\0'. Thus a null-terminated string contains the characters that comprise the string followed by a null. The following declaration and initialization create a string consisting of the word "Hello". To hold the null character at the end of the array, the size of the character array containing the string is one more than the number of characters in the word "Hello." */ #include <iostream> using namespace std; int main() { char greeting[6] = {'H', 'e', 'l', 'l', 'o', '\0'}; char greeting2[] = "Hello"; cout << "Greeting message: "; cout << greeting << endl; cout << greeting2 << endl; return 0; } /* Function & Purpose 1 strcpy(s1, s2); Copies string s2 into string s1. 2 strcat(s1, s2); Concatenates string s2 onto the end of string s1. 3 strlen(s1); Returns the length of string s1. 4 strcmp(s1, s2); Returns 0 if s1 and s2 are the same; less than 0 if s1<s2; greater than 0 if s1>s2. 5 strchr(s1, ch); Returns a pointer to the first occurrence of character ch in string s1. 6 strstr(s1, s2); Returns a pointer to the first occurrence of string s2 in string s1. */ Live Demo #include <iostream> #include <cstring> using namespace std; int main() { char str1[10] = "Hello"; char str2[10] = "World"; char str3[10]; int len; // copy str1 into str3 strcpy(str3, str1); cout << "strcpy( str3, str1) : " << str3 << endl; // concatenates str1 and str2 strcat(str1, str2); cout << "strcat( str1, str2): " << str1 << endl; // total lenghth of str1 after concatenation len = strlen(str1); cout << "strlen(str1) : " << len << endl; return 0; } // strcpy( str3, str1) : Hello // strcat( str1, str2): HelloWorld // strlen(str1) : 10 /* The String Class in C++ The standard C++ library provides a string class type that supports all the operations mentioned above, additionally much more functionality. Let us check the following example − */ #include <iostream> #include <string> using namespace std; int main() { string str1 = "Hello"; string str2 = "World"; string str3; int len; // copy str1 into str3 str3 = str1; cout << "str3 : " << str3 << endl; // concatenates str1 and str2 str3 = str1 + str2; cout << "str1 + str2 : " << str3 << endl; // total length of str3 after concatenation len = str3.size(); cout << "str3.size() : " << len << endl; return 0; } // str3 : Hello // str1 + str2 : HelloWorld // str3.size() : 10
[ "anuragbisht12@gmail.com" ]
anuragbisht12@gmail.com
903303ed04c4ab0ef3a5237627e98086534ee01e
ec494526ff8a0105a4ab2738f2cfe9668977680d
/BalloonMan/BackGround.cpp
19d81b2657c4084aacf17b8c1b8d2848d77e06e5
[]
no_license
aoyamashunta/BalloonMan
e952cec5f15d31870d4b473805915316592a7d9c
46d85f3eee9c396ff866a001a2aa2eb959472070
refs/heads/master
2023-02-26T15:50:27.387870
2021-02-01T01:43:23
2021-02-01T01:43:23
319,378,049
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
5,504
cpp
#include "BackGround.h" #include "stdio.h" #include <stdlib.h> #include "DxLib.h" extern enum blocknum{ NONE, BLOCK, PLAYER, GOAL, SPINE }; //extern int WIN_WIDTH; //ウィンドウ横幅 //extern int WIN_HEIGHT; //ウィンドウ縦幅 BackGround::BackGround(const char *mapName) : mapXSize(32), mapYSize(32), mapChipMax(4), map() { whiteColor = GetColor(108,103,110); fname = mapName; error = false; if(!MapLoad()) { //実行しない error = true; } } bool BackGround::MapLoad() { char buf[1000], *p, *end; FILE *fp; errno_t error; error = fopen_s(&fp, fname, "r"); if(error != 0) { return false; } else { for(int i = 0; i < 200; i++) { if(fgets(buf, sizeof(buf), fp) == NULL) { break; } p = buf; for(int j = 0; j < 30; j++) { long num = strtol(p, &end, 10); // 10進数を読み取る if(p == end) break; // 読み取り終了 if(num < 0 || num > mapChipMax) { fclose(fp); return false; // 異常終了 } map[i][j] = num; p = end + 1; // ',' をスキップする } } fclose(fp); } return true; } void BackGround::MapChip() { //背景 for(int i = 0; i < 480; i++) { DrawBox(0, i, 960, i + 1, GetColor(105 + 114 * i / 480, 179 + 57 * i / 480, 255), 1); } //map chip for(int i = 0; i < 30; i++) { for(int j = 0; j < 200; j++) { if(map[j][i] == BLOCK) { DrawBlock(i,j); } else if(map[j][i] == GOAL) { DrawGoal(i,j); } else if(map[j][i] == SPINE) { DrawSpine(i,j); } } } } void BackGround::LoadPlayerIni() { for(int i = 0; i < 30; i++) { for(int j = 0; j < 200; j++) { if(map[j][i] == PLAYER) { playerXIni = i * mapXSize; playerYIni = j * mapYSize; } } } } void BackGround::DrawBlock(int i,int j) { //内側の塗りつぶし DrawBox((int)((i + 0.125) * mapXSize), (int)((j + 0.25) * mapYSize), (int)((i + 0.875) * mapXSize), (int)((j + 0.75) * mapYSize), GetColor(255,255,255), 1); //下段の雲 DrawOval((int)((i + 0.25) * mapXSize), (int)((j + 0.8125) * mapYSize), 10,5, GetColor(255,255,255),1); DrawOval((int)((i + 0.5) * mapXSize), (int)((j + 0.8125) * mapYSize), 10,4, GetColor(255,255,255),1); DrawOval((int)((i + 0.75) * mapXSize), (int)((j + 0.8125) * mapYSize), 10,5, GetColor(255,255,255),1); //中段の雲 DrawOval((int)((i + 0.25) * mapXSize), (int)((j + 0.5) * mapYSize), 8,5, GetColor(255,255,255),1); DrawOval((int)((i + 0.375) * mapXSize), (int)((j + 0.5) * mapYSize), 10,4, GetColor(255,255,255),1); DrawOval((int)((i + 0.625) * mapXSize), (int)((j + 0.5) * mapYSize), 10,4, GetColor(255,255,255),1); DrawOval((int)((i + 0.75) * mapXSize), (int)((j + 0.5) * mapYSize), 8,5, GetColor(255,255,255),1); //上段の雲 DrawOval((int)((i + 0.75) * mapXSize), (int)((j + 0.25) * mapYSize), 10,8, GetColor(255,255,255),1); DrawCircle((int)((i + 0.375) * mapXSize), (int)((j + 0.1875) * mapYSize), 6, GetColor(255,255,255)); } void BackGround::DrawGoal(int i, int j) { //goal flagの棒の部分 DrawLine((int)((i + 0.25) * mapXSize), j * mapYSize, (int)((i + 0.25) * mapXSize), (j + 1) * mapYSize, whiteColor); //goal flagの旗の部分 DrawTriangle((int)((i + 0.25) * mapXSize), j * mapYSize, (int)((i + 0.25) * mapXSize), (int)((j + 0.5) * mapYSize), (i + 1) * mapXSize, (int)((j + 0.25) * mapYSize), GetColor(255, 0, 0), 1); } void BackGround::DrawSpine(int i, int j) { //中心円 DrawCircle((int)((i + 0.5) * mapXSize), (int)((j + 0.5) * mapYSize), mapXSize / 2 - 5, GetColor(0, 0, 0)); //上三角 DrawTriangle((int)((i + 0.5) * mapXSize), j * mapYSize, (int)((i + 0.5) * mapXSize - 2), j * mapYSize + 4, (int)((i + 0.5) * mapXSize + 2), j * mapYSize + 4, whiteColor, 1); //右上三角 DrawTriangle((i + 1) * mapXSize, j * mapYSize, (int)((i + 0.5) * mapXSize + 2), j * mapYSize + 4, (i + 1) * mapXSize - 4, (int)((j + 0.5) * mapYSize - 2), whiteColor, 1); //右三角 DrawTriangle((i + 1) * mapXSize, (int)((j + 0.5) * mapYSize), (i + 1) * mapXSize - 4, (int)((j + 0.5) * mapYSize - 2), (i + 1) * mapXSize - 4, (int)((j + 0.5) * mapYSize + 2), whiteColor, 1); //右下三角 DrawTriangle((i + 1) * mapXSize, (j + 1) * mapYSize, (i + 1) * mapXSize - 4, (int)((j + 0.5) * mapYSize + 2), (int)((i + 0.5) * mapXSize + 2), (j + 1) * mapYSize - 4, whiteColor, 1); //下三角 DrawTriangle((int)((i + 0.5) * mapXSize), (j + 1) * mapYSize, (int)((i + 0.5) * mapXSize + 2), (j + 1) * mapYSize - 4, (int)((i + 0.5) * mapXSize - 2), (j + 1) * mapYSize - 4, whiteColor, 1); //左下三角 DrawTriangle(i * mapXSize, (j + 1) * mapYSize, (int)((i + 0.5) * mapXSize - 2), (j + 1) * mapYSize - 4, i * mapXSize + 4, (int)((j + 0.5) * mapYSize + 2), whiteColor, 1); //左三角 DrawTriangle(i * mapXSize, (int)((j + 0.5) * mapYSize), i * mapXSize + 4, (int)((j + 0.5) * mapYSize + 2), i * mapXSize + 4, (int)((j + 0.5) * mapYSize - 2), whiteColor, 1); //左上三角 DrawTriangle(i * mapXSize, j * mapYSize, (int)((i + 0.5) * mapXSize - 2), j * mapYSize + 4, i * mapXSize + 4, (int)((j + 0.5) * mapYSize - 2), whiteColor, 1); }
[ "k020g1114@g.neec.ac.jp" ]
k020g1114@g.neec.ac.jp
86240172fc5b889d6d1c179f8fec33e8e54abd1d
a2111a80faf35749d74a533e123d9da9da108214
/raw/workshop11/workshop2011-data-20110925/sources/u35c5glxw45elmls/81/sandbox/my_sandbox/apps/ministellar/ministellar.cpp
51a0c8bf286ecbcbd9ac005ebd965f94b7bae669
[ "MIT" ]
permissive
bkahlert/seqan-research
f2c550d539f511825842a60f6b994c1f0a3934c2
21945be863855077eec7cbdb51c3450afcf560a3
refs/heads/master
2022-12-24T13:05:48.828734
2015-07-01T01:56:22
2015-07-01T01:56:22
21,610,669
1
0
null
null
null
null
UTF-8
C++
false
false
5,845
cpp
#include <seqan/stream.h> #include <seqan/index.h> #include <seqan/align.h> #include <seqan/seeds2.h> using namespace seqan; // set parameters unsigned const minimalLength = 12; float const errorRate = 0.05; //unsigned const qGramLength = 8; CharString const filename = "ministellar.out"; typedef int TScoreValue; TScoreValue const matchScore = 1; TScoreValue const mismatchScore = -2; TScoreValue const gapScore = -2; TScoreValue const minScore = 9; TScoreValue const xDrop = 3; int main(int argc, char const ** argv) { if (argc != 3) { std::cerr << "ERROR: Invalid argument count!" << std::endl; std::cerr << "USAGE: ministallar IN1.fa IN2.fa" << std::endl; return 1; } typedef Score<TScoreValue, Simple> TScoreScheme; TScoreScheme scoring = TScoreScheme(matchScore, mismatchScore, gapScore); // DONE: Define a scoring scheme 'score' with linear gap costs using the above defined // score values for scoring matches, mismatches, and gaps. // HINT: You can find a section on Schoring Schemes in the Alignments tutorial. // read sequences from fasta files typedef Dna5String TSequence; StringSet<CharString> ids1, ids2; StringSet<TSequence> seqs1, seqs2; std::ifstream streamIn1(argv[1], std::ios::in | std::ios::binary); RecordReader<std::ifstream, SinglePass<> > reader1(streamIn1); if (read2(ids1, seqs1, reader1, Fasta()) != 0) { std::cerr << "Could not read file " << argv[1] << std::endl; return 1; } // DONE: Do the same for the second file. std::ifstream streamIn2(argv[2], std::ios::in | std::ios::binary); RecordReader<std::ifstream, SinglePass<> > reader2(streamIn2); if (read2(ids2, seqs2, reader2, Fasta()) != 0) { std::cerr << "Could not read file " << argv[2] << std::endl; return 1; } // prepare output file std::ofstream outFile; outFile.open(toCString(filename)); // define finder and pattern // TODO: Define types for finder and pattern using SeqAn's find interface from the index // module. Both should be specialized for the approproiate swift filter algorithm. // The pattern will need the definition of a q-gram-index. Use q-grams of length 8 // for now, and open addressing. // HINT: The tutorial on Pattern Matching describes the find interface. At the end of that // tutorial page, you will find a link to a Swift HowTo page. typedef Index<TSequence, IndexQGram<UngappedShape<8> > > TQIndex; typedef Finder<TSequence, Swift<SwiftLocal> > TFinder; typedef Pattern<TQIndex, Swift<SwiftLocal> > TPattern; // TODO: Define variables of your pattern and finder types, and initialize them with the // first sequences in the sequence sets seqs1 and seqs2. TQIndex index1 = TQIndex(seqs2[0]); TPattern pattern = TPattern(index1); TFinder finder = TFinder(seqs1[0]); // TODO: Repeat the following steps for all hits of the finder. //typedef Iterator<TFinder> TFinderIt; //TFinderIt it = TFinderIt(finder); // call the function find to obtain a swift hit // TODO: uncomment the following line while (find(finder, pattern, errorRate, int(minimalLength))) { // extract infixes from hit // TODO: uncomment the following three lines typedef Infix<TSequence>::Type TInfix; TInfix fInfix = infix(finder, seqs1[0]); TInfix pInfix = infix(pattern, seqs2[0]); // find best local alignment of infixes, and check for minimal score // TODO: Define an align object and initialize it with the infixes. Find the best local // alignment of the infixes. Use the above defined scoring scheme. Make sure that // it reaches the minimal score minScore. std::cout << fInfix << std::endl; std::cout << pInfix << std::endl; typedef Align<TSequence> TAlign; typedef Row<TAlign> TRow; TAlign aln = TAlign(); resize(rows(aln), 2); assignSource(row(aln, 0), fInfix); assignSource(row(aln, 1), pInfix); int scr = localAlignment(aln, scoring); std::cout << aln <<std::endl; // std::cout << "Score:" << scr <<std::endl; if (scr < minScore) { continue; } // create a seed for the local alignment, and conduct gapped X-drop extension // TODO: Define a seed on the original sequences but for the subsequences of the local // alignment. Extend this seed in both directions using gapped X-drop extension. // Check that the extended seed has a length of at least minimalLength. // HINT: Have a look at the Seed-and-Extend tutorial. typedef Seed<Simple> TSeed; TSeed seed = TSeed(beginPosition(fInfix) + clippedBeginPosition(row(aln, 0)), beginPosition(pInfix) + clippedBeginPosition(row(aln, 1)), beginPosition(fInfix) + clippedEndPosition(row(aln, 0)), beginPosition(pInfix) + clippedEndPosition(row(aln, 1))); std::cout << "Seed: " << seed << std::endl; extendSeed(seed, seqs2[0], seqs1[0], EXTEND_BOTH, scoring, xDrop, GappedXDrop()); std::cout << "Extendeed Seed: " <<seed << std::endl; // find best global alignment of extended seed // TODO: Compute the best global alignment of extended seed and its score. // HINT: Create an align object on infixes of the sequences. TInfix subseq1 = TInfix(seqs1[0], getBeginDim0(seed), getEndDim0(seed)); TInfix subseq2 = TInfix(seqs2[0], getBeginDim1(seed), getEndDim1(seed)); TAlign gAln; resize(rows(gAln), 2); assignSource(row(gAln, 0), subseq1); assignSource(row(gAln, 1), subseq2); globalAlignment(gAln, scoring); outFile << gAln << std::endl; // TODO: Output the alignment as a match to the output file. } outFile.close(); return 0; }
[ "mail@bkahlert.com" ]
mail@bkahlert.com
1b7460b87d8f1a9e4300650b2f0264a8b56ea67b
d747c7cedffa13171b2793aa3b3ad2c35f111032
/typeconversion.cpp
0c41e7c10b5523f65e8ed465e7f1e5bc379b08e2
[]
no_license
shubhamguptaji/CPP
213556c39f6f2e9d17714cc0768cec293bfa317f
2320c4d1e52e1022b678ebe9218babc744a67119
refs/heads/master
2020-03-08T02:29:13.111784
2018-04-03T14:20:05
2018-04-03T14:20:05
127,861,013
3
0
null
null
null
null
UTF-8
C++
false
false
680
cpp
#include<iostream> using namespace std; class Time { int hours,mins; public: Time() {hours=0;mins=0;} Time(int d) { hours = d/60; mins = d%60; } Time(int h, int m) { hours = h; mins = m; } operator int() { return (hours*60 + mins); } void show() { cout << hours << ":" << mins << endl; } }; int main() { Time T1; int duration,h,m; cout << "Enter Duration: "; cin >> duration; cout << "Enter hours and minutes: "; cin >> h >> m; Time T2(h,m); T1 = duration; T1.show(); duration = T2; cout << duration << endl; return 0; }
[ "shubham2604gupta@gmail.com" ]
shubham2604gupta@gmail.com
15db7f3f8cce1613f6aa679cfb2a409cc61cdcd6
185c0d00de7364d90ae76d19c14d14d336f5fbfe
/Chapter5/Labs 5.3/Lab 5.3.13 (8)/Lab 5.3.13 (6).cpp
e8fa590ae551b35a58c15e10ae98a260b180c56d
[]
no_license
romanvorozhbyt/CompPractice2017
c186886f184d55a77aab6665f08d48fdc4f2fdcb
1cba4f11b7201b89332b31ce9e5ad64d39428c4a
refs/heads/master
2021-04-26T00:41:20.136496
2017-12-19T12:11:10
2017-12-19T12:11:10
107,325,376
0
0
null
null
null
null
UTF-8
C++
false
false
3,085
cpp
#include <iostream> using namespace std; class Node { public: Node(int val); ~Node(); int value; Node* next; }; Node::Node(int val) : value(val), next(nullptr) { //cout << "+Node" << endl; } Node::~Node() { //cout << "-Node" << endl; } class List { public: List(); void push_front(int value); bool pop_front(int &value); void push_back(int value); bool pop_back(int &value); int at(int index); void insert_at(int index, int value); void remove_at(int index); int size(); private: // other members you may have used Node* head; Node* tail; }; List::List() : head(nullptr),tail(nullptr) { } int List::size() { Node* memento = head; int size = 0; while (memento != nullptr) { size++; memento = memento->next; } delete memento; return size; } void List::push_front(int value) { Node* new_head = new Node(value); new_head->next = head; head = new_head; } bool List::pop_back(int &value) { if (tail != nullptr) { Node* popped = tail; tail = popped->next; value = popped->value; delete popped; return true; } return false; } bool List::pop_front(int &value) { if (head != nullptr) { Node* popped = tail; head = popped->next; tail = tail->next; value = popped->value; delete popped; return true; } return false; } void List::push_back(int value) { Node* new_head = new Node(value); if (head == nullptr) { head = new_head; tail = head; } else { tail->next = new_head; tail = new_head; } } int List::at(int i) { Node* pointer = head; int position = 0; while (pointer != nullptr) { if (position == i) return pointer->value; position++; pointer = pointer->next; } delete pointer; return -1; } void List::remove_at(int n) { if ((head != NULL) && (n < size()) && (n >= 0)) { Node *temp = head, *helping = head; for (int i = 0; i < n; i++) { helping = temp; temp = temp->next; } if (temp == head) { head = temp->next; } else { helping->next = temp->next; } free(temp); } } void List::insert_at(int pos, int val) { Node* inserted = new Node(val); Node* temp = head; Node* helping = head; if (pos == 0) { inserted->next = temp; head = inserted; } else { for (int i = 0; i < pos; i++) { helping = temp; temp = temp->next; } helping->next = inserted; inserted->next = temp; } } void printList(List &list) { for (int i = 0; i < list.size(); i++) { cout << "list[" << i << "] == "<< list.at(i) << endl; } } //List::~List() //{ // while (head != nullptr) // { // Node* deleted = head; // head = head->next; // delete deleted; // } //} // ... int main() { List list; list.push_back(1); list.push_back(2); list.push_back(3); list.push_back(4); printList(list); cout << endl; list.remove_at(2); printList(list); cout << endl; list.insert_at(1, 6); printList(list); return 0; }
[ "noreply@github.com" ]
romanvorozhbyt.noreply@github.com
75070004695fc0ac4af69bbbb61287ef36128b64
91ba0c0c42b3fcdbc2a7778e4a4684ab1942714b
/Cpp/SDK/BP_RB_Rank03_RankDesc_classes.h
49505848bd3a10a357f090e5ac2e8bfdc31583bb
[]
no_license
zH4x/SoT-SDK-2.1.1
0f8c1ec3ad8821de82df3f75a0356642b581b8c6
35144dfc629aeddf96c1741e9e27e5113a2b1bb3
refs/heads/main
2023-05-12T09:03:32.050860
2021-06-05T01:54:15
2021-06-05T01:54:15
373,997,263
0
0
null
null
null
null
UTF-8
C++
false
false
740
h
#pragma once // Name: SoT, Version: 2.1.1 /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Classes //--------------------------------------------------------------------------- // BlueprintGeneratedClass BP_RB_Rank03_RankDesc.BP_RB_Rank03_RankDesc_C // 0x0000 (FullSize[0x00E0] - InheritedSize[0x00E0]) class UBP_RB_Rank03_RankDesc_C : public URankDesc { public: static UClass* StaticClass() { static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_RB_Rank03_RankDesc.BP_RB_Rank03_RankDesc_C"); return ptr; } }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "Massimo.linker@gmail.com" ]
Massimo.linker@gmail.com
3003b7a455fd464e95600da552baebd45192331b
fe18014a36e9044e6b35dd277a079d23fec38ef1
/Utils/Histogram.cc
500badb5936a09f71b4e8f2f0f2ff6a67035e864
[]
no_license
mlamarre/ACG
b8127d91155fd00bddd0f7e7c3d56b603b4125dc
80f116e53a5af15993dddec919d70a0f995ef8ea
refs/heads/master
2021-05-16T15:56:36.625825
2018-01-31T02:55:14
2018-01-31T02:55:14
119,601,050
0
0
null
null
null
null
UTF-8
C++
false
false
3,413
cc
/*===========================================================================*\ * * * OpenFlipper * * Copyright (c) 2001-2015, RWTH-Aachen University * * Department of Computer Graphics and Multimedia * * All rights reserved. * * www.openflipper.org * * * *---------------------------------------------------------------------------* * This file is part of OpenFlipper. * *---------------------------------------------------------------------------* * * * Redistribution and use in source and binary forms, with or without * * modification, are permitted provided that the following conditions * * are met: * * * * 1. Redistributions of source code must retain the above copyright notice, * * this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. Neither the name of the copyright holder nor the names of its * * contributors may be used to endorse or promote products derived from * * this software without specific prior written permission. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * \*===========================================================================*/ #include "Histogram.hh" namespace ACG { template<> QString HistogramT<double>::getBoundaryLabel(size_t idx) const { // TODO: choose accuracy based on avg_bin_size_ return QString::number(bin_boundaries_[idx], 'g', 2); } } // namespace ACG
[ "mlamarre@ea.com" ]
mlamarre@ea.com
58943f73cdd239a2fd7ae754c21c2a678c425c9a
ee6d19e7976f4c07b17004d326a4e1be4306990c
/codechef/contests/2021/august/algomaniac/old_saint.cpp
027ce0f9cc8c88d9dd2b5dcc4d0d0c3ce07fd1f1
[]
no_license
samahuja642/competitive-programming
b37eab547ac59ba6f4cdd9f4173fbfac9b46e292
031a7d38db557b4b6058af5d5e246543821011b5
refs/heads/main
2023-09-03T08:14:09.558871
2021-10-20T17:55:29
2021-10-20T17:55:29
350,995,005
0
1
null
null
null
null
UTF-8
C++
false
false
451
cpp
#include<iostream> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); int t; cin>>t; while(t--){ int a[3],b[3]; int ans1=0,hero1=0; for(int i=0;i<3;i++){cin>>a[i];if(a[i]==1)ans1++;} for(int i=0;i<3;i++){cin>>b[i];if(b[i]==1)hero1++;} if(hero1==ans1){ cout<<"Pass"<<endl; } else cout<<"Fail"<<endl; } return 0; }
[ "samahuja642@gmail.com" ]
samahuja642@gmail.com
951776af12a4e063cdb38c65765be816289e521f
8c9575a3582289157af75f08b08f3d17237879c8
/src/hash/system-test/system_test.cpp
992a69443044d1c3f7dbaa46c10629d3483735d8
[]
no_license
babky/hashing
a7c4a2ef1a9fb1bc33e3ea82ac7c140bde6cc42a
e520bd28901473fb812b7ffa888560974405c54b
refs/heads/master
2020-12-30T13:22:02.271181
2020-04-08T19:51:09
2020-04-08T19:51:09
91,207,567
0
0
null
2020-10-13T04:38:32
2017-05-13T23:02:42
TeX
UTF-8
C++
false
false
6,719
cpp
#include <iostream> #include <fstream> #include <vector> #include <string> #include "utils/boost_include.h" #include <boost/program_options.hpp> #include "systems/uniform/dietzfelbinger_woelfel.h" #include "systems/bit_string_system.h" #include "systems/polynomial_system.h" #include "systems/linear_map_system.h" #include "systems/cwlf_system.h" #include "systems/multiply_shift_system.h" #include "systems/cwlf_exponential_system.h" #include "systems/tabulation_system.h" #include "systems/polynomial_system.h" #include "systems/tr1_function.h" #include "systems/identity_function.h" #include "utils/time_vector.h" using namespace std; using namespace boost::posix_time; using namespace Hash::Utils; /** * Testing of the (time) peformance of various hash systems. */ struct Test { Test(string aName, size_t aLength, size_t aRepeats): name(aName), length(aLength), repeats(aRepeats) { } virtual ~Test(void) { } const string & getName(void) const { return name; } virtual void run(void) = 0; TimeVector & getTimes(void) { return times; } protected: string name; size_t length; size_t repeats; TimeVector times; }; template<class F, typename T> struct FunctionTest : public Test { FunctionTest(string aName, size_t aLength, size_t aRepeats): Test(aName, aLength, aRepeats) { } virtual void run() { cout << "Running " << name << " of length " << length << ".\n"; function.setTableSize(length); ptime start, finish; size_t hash = 0xdead; for (size_t j = 0; j < repeats; ++j) { start = microsec_clock::local_time(); function.reset(); hash = 0xdead; for (size_t i = 0; i < length; ++i) { hash ^= function.hash(i); } if (hash == 0) { cout << "Almost impossible :)!\n"; } finish = microsec_clock::local_time(); times.add(finish - start); } } private: F function; }; class CompleteTest { public: typedef vector<Test *> FunctionTestVector; CompleteTest(size_t aLength, size_t aRepeats): length(aLength), repeats(aRepeats) { } template<typename T> void runTest(void) { typedef size_t TestStorage; using namespace Hash::Systems; functions.push_back(new FunctionTest<IdentityFunction<T, TestStorage>, T>("ID", length, repeats)); functions.push_back(new FunctionTest<Tr1Function<T, TestStorage>, T>("TR1", length, repeats)); functions.push_back(new FunctionTest<UniversalFunctionCWLF<T, TestStorage>, T>("CWLF", length, repeats)); functions.push_back(new FunctionTest<CWLFExponentialSystem<T, TestStorage>, T>("CWLFExp", length, repeats)); functions.push_back(new FunctionTest<BitStringFunction<T, TestStorage>, T>("BitString", length, repeats)); functions.push_back(new FunctionTest<TabulationFunction<T, TestStorage>, T>("Tabulation", length, repeats)); functions.push_back(new FunctionTest<UniversalFunctionLinearMap<T, TestStorage>, T>("LinearMap", length, repeats)); functions.push_back(new FunctionTest<PolynomialSystem<T, TestStorage>, T>("Polynomial - deg 2", length, repeats)); functions.push_back(new FunctionTest<PolynomialSystem4<T, TestStorage>, T>("Polynomial - deg 4", length, repeats)); functions.push_back(new FunctionTest<Uniform::DietzfelbingerWoelfel<T, TestStorage, Hash::Systems::PolynomialSystem4>, T>("DW - deg 4", length, repeats)); functions.push_back(new FunctionTest<MultiplyShiftSystem<T, TestStorage>, T>("MultiplyShift", length, repeats)); for (FunctionTestVector::iterator b = functions.begin(), e = functions.end(); b != e; ++b) { (*b)->run(); } } size_t getLength(void) const { return length; } size_t getRepeats(void) const { return repeats; } FunctionTestVector & getFunctions(void) { return functions; } protected: FunctionTestVector functions; size_t length; size_t repeats; }; int main(int argc, char ** argv) { using namespace boost::program_options; size_t bits; const size_t DEFAULT_BITS = 32; size_t length; #ifdef HASH_DEBUG const size_t DEFAULT_LENGTH = 10; #else const size_t DEFAULT_LENGTH = 24; #endif size_t repeats; const size_t DEFAULT_REPEATS = 32; size_t step; const size_t DEFAULT_STEP = 1; size_t steps; const size_t DEFAULT_STEPS = 0; string output; string DEFAULT_OUTPUT = ""; bool help; options_description opts("Universal systems test options."); opts.add_options() ("bits", value<size_t>(&bits)->default_value(DEFAULT_BITS), "the number of bits used 32 or 64") ("length", value<size_t>(&length)->default_value(DEFAULT_LENGTH), "the logarithm of number of times the function is called and the size of the table") ("repeats", value<size_t>(&repeats)->default_value(DEFAULT_REPEATS), "the number of repetitions") ("step", value<size_t>(&step)->default_value(DEFAULT_STEP), "the iteration step") ("steps", value<size_t>(&steps)->default_value(DEFAULT_STEPS), "the number of steps") ("output", value<string>(&output)->default_value(DEFAULT_OUTPUT), "output file") ("help", "prints this help."); variables_map vm; store(parse_command_line(argc, argv, opts), vm); notify(vm); if (vm.count("help")) { cout << opts; return 0; } typedef vector<CompleteTest> TestVector; TestVector v; for (size_t s = 0; s < steps; ++s) { CompleteTest t(1 << (length + s * step), repeats); if (bits == 32) { t.runTest<boost::uint32_t>(); } else if (bits == 64) { t.runTest<boost::uint64_t>(); /*#ifdef __GNUC__ TODO: Not working in gcc 4.7. } else if (bits == 128) { t.runTest<__uint128_t>(); #endif*/ } else { std::cerr << opts; return 1; } v.push_back(t); } ofstream fout; if (output != "") { fout.open(output.c_str()); } ostream & out = output != "" ? fout : cout; for (TestVector::iterator b = v.begin(), e = v.end(); b != e; ++b) { out << "TEST: length = " << setw(10) << b->getLength() << ", repeats = " << setw(2) << b->getRepeats() << "\n"; for (CompleteTest::FunctionTestVector::iterator fb = b->getFunctions().begin(), fe = b->getFunctions().end(); fe != fb; ++fb) { out << setw(20) << (*fb)->getName() << " " << setw(6) << right << (*fb)->getTimes().getAverageTime().total_milliseconds() << " [(+/-) " << setw(12) << fixed << setprecision(3) << (*fb)->getTimes().getMillisVariance() << "] ms\n"; } out << "\n"; } if (output != "") { out << "\n\n---PRINTING WHOLE DATA SET---\n"; for (TestVector::iterator b = v.begin(), e = v.end(); b != e; ++b) { for (CompleteTest::FunctionTestVector::iterator fb = b->getFunctions().begin(), fe = b->getFunctions().end(); fe != fb; ++fb) { out << setw(20) << (*fb)->getName() << ", length = " << setw(10) << b->getLength() << ", repeats = " << setw(2) << b->getRepeats() << ": "; out << (*fb)->getTimes() << "\n"; } } fout.close(); } return 0; }
[ "babky@users.noreply.github.com" ]
babky@users.noreply.github.com
a3def3f90d29cbfb67ff728a88872e123b1ed3bd
50402cc4388dfee3a9dbe9e121ef217759ebdba8
/CSProj/cs236/proj4/src/Fact.h
dc744a7e917d386cc2c0563656c9b734a6c35fb8
[]
no_license
dqyi11/SVNBackup
bd46a69ec55e3a4f981a9bca4c8340944d8d5886
9ad38e38453ef8539011cf4d9a9c0a363e668759
refs/heads/master
2020-03-26T12:15:01.155873
2015-12-10T01:11:36
2015-12-10T01:11:36
144,883,382
2
1
null
null
null
null
UTF-8
C++
false
false
416
h
/* * Fact.h * * Created on: Feb 5, 2013 * Author: kyle */ #ifndef FACT_H_ #define FACT_H_ #include <vector> #include <string> #include <sstream> #include "Lex.h" #include "Domain.h" class Fact { friend class Relation; friend class Database; public: Fact(Lex* lex, Domain* domain); ~Fact(); string toString(); protected: string identifier; vector<string> identifierList; }; #endif /* FACT_H_ */
[ "walter@e224401c-0ce2-47f2-81f6-2da1fe30fd39" ]
walter@e224401c-0ce2-47f2-81f6-2da1fe30fd39
3b70f835c6f211fa298b823a533e3f3c9c6e3651
9c7584da436d9f44c966abe28105644aece6931c
/p3865.cpp
2bb5074f9c766a7cb7cde86f3d29fe598efe3792
[]
no_license
Leo-Ngok/UVa_solutions
c6b703c910fcc5e534b576394b8522a89701f642
c890ef4f33b66cff348c29eb2ca130edbc7417a8
refs/heads/master
2022-01-19T22:27:18.048148
2022-01-04T15:54:12
2022-01-04T15:54:12
202,375,424
0
0
null
null
null
null
UTF-8
C++
false
false
562
cpp
//p3865 #include <cstdio> #include <algorithm> #include <math.h> using namespace std; int st[20][100010],n,m,l,r; int main(){ scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) scanf("%d",&st[0][i]); int h=log(n)/log(2); for(int i=1;i<=h;i++) for(int j=1;j<=n-(1<<i)+1;j++) st[i][j]=max(st[i-1][j],st[i-1][j+(1<<(i-1))]); #ifdef DEBUG for(int i=1;i<=h;i++){ for(int j=1;j<=n;j++)printf("%d ",st[i][j]); printf("\n"); } #endif while(m--){ scanf("%d%d",&l,&r); int p=log(r-l+1)/log(2); printf("%d\n",max(st[p][l],st[p][r-(1<<p)+1])); } return 0; }
[ "z1023825@outlook.com" ]
z1023825@outlook.com
8469d9d97e48c7208db50680a2429d477b479bb9
05ebb6fdc62824c622dff9c6d1aadc1b39c0e41e
/sdk/cpp/samples/isis_xr_read.cpp
724d40a7639d53dbcb31223d8da9811647a30c1b
[ "Apache-2.0" ]
permissive
traveldan88/ydk-gen
32d322cd247e359193277ea2a9d8a5471c547b4f
d4f25bb51541f83fe7fa8b159cf50b63818fa3be
refs/heads/master
2021-01-21T21:22:14.217525
2019-05-23T21:19:51
2019-05-23T21:19:51
94,827,589
0
0
null
2017-06-19T22:53:14
2017-06-19T22:53:14
null
UTF-8
C++
false
false
3,745
cpp
/* ---------------------------------------------------------------- Copyright 2016 Cisco Systems Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ------------------------------------------------------------------*/ #include <iostream> #include "ydk/types.hpp" #include "ydk/netconf_provider.hpp" #include "ydk/crud_service.hpp" #include "ydk_cisco_ios_xr/Cisco_IOS_XR_clns_isis_cfg.hpp" #include "ydk_cisco_ios_xr/Cisco_IOS_XR_clns_isis_datatypes.hpp" #include <spdlog/spdlog.h> #include "args_parser.h" using namespace ydk; using namespace ydk::Cisco_IOS_XR_clns_isis_cfg; using namespace ydk::Cisco_IOS_XR_clns_isis_datatypes; using namespace std; int main(int argc, char* argv[]) { vector<string> args = parse_args(argc, argv); if(args.empty()) return 1; string host, username, password; int port; username = args[0]; password = args[1]; host = args[2]; port = stoi(args[3]); bool verbose=(args[4]=="--verbose"); if(verbose) { auto logger = spdlog::stdout_color_mt("ydk"); logger->set_level(spdlog::level::info); } NetconfServiceProvider provider{host, username, password, port}; CrudService crud{}; auto isis = make_unique<Isis>(); auto isis_read = crud.read_config(provider, *isis); if(isis_read == nullptr) { cout << "=================================================="<<endl; cout << "No entries found"<<endl<<endl; cout << "=================================================="<<endl; return 0; } Isis* isis_read_ptr = dynamic_cast<Isis*>(isis_read.get()); cout << "=================================================="<<endl; cout << "ISIS configuration: " << endl<<endl; for(size_t i=0; i < isis_read_ptr->instances->instance.size(); i++) { auto instance = dynamic_cast<Isis::Instances::Instance*>(isis_read_ptr->instances->instance[i].get()); cout << "Instance: " << instance->instance_name << endl; cout << "Running: " << ((instance->running.is_set)?"Yes":"No") << endl; cout << "IS type: " << instance->is_type << endl; for(size_t j=0; j < instance->nets->net.size(); j++) { cout << "Net name: " << instance->nets->net[j]->net_name << endl; } for(size_t j=0; j < instance->afs->af.size(); j++) { cout << "AF name: " << instance->afs->af[j]->af_name << endl; cout << "SAF name: " << instance->afs->af[j]->saf_name << endl; } for(size_t j=0; j < instance->interfaces->interface.size(); j++) { cout<<endl << "Interface name: " << instance->interfaces->interface[j]->interface_name << endl; cout << "Interface running: " << ((instance->interfaces->interface[j]->running.is_set)?"Yes":"No") << endl; cout<< "Interface state: " << instance->interfaces->interface[j]->state << endl; cout<< "Interface point-to-point: " << ((instance->interfaces->interface[j]->point_to_point.is_set)?"Yes":"No") << endl; for(size_t k=0; k < instance->interfaces->interface[j]->interface_afs->interface_af.size(); k++) { cout<< "Interface AF name: " << instance->interfaces->interface[j]->interface_afs->interface_af[k]->af_name << endl; cout<< "Interface SAF name: " << instance->interfaces->interface[j]->interface_afs->interface_af[k]->saf_name << endl; } } } cout << "=================================================="<<endl<<endl; }
[ "noreply@github.com" ]
traveldan88.noreply@github.com
3acb5a1c581effcf1184f5ece261eeb8adf3d360
91e885f46cb5d8add4c3ea101747311e4afafc0a
/practice/revesre.cpp
ef816dbe177822ddeba95044b381a9809ac5b54b
[]
no_license
CoderMayhem/namanDoesCP
25d4cef7b39d26483ec70dd5c8bb0c97325ba652
88c904091a5b72ec0339f1708ac2f920d18b6fbc
refs/heads/master
2023-05-10T12:49:53.911330
2021-06-03T20:48:19
2021-06-03T20:48:19
363,678,652
0
0
null
null
null
null
UTF-8
C++
false
false
226
cpp
#include<iostream> using namespace std; int main(){ int n; cin>>n; int reverse = 0; while(n>0){ int last = n%10; reverse = reverse*10 + last; n=n/10; } cout<<reverse<<endl; }
[ "namanmishra1900@gmail.com" ]
namanmishra1900@gmail.com
b74f5e4934e6311c0a0afff9f68dd0888f8c3f03
64589428b06258be0b9b82a7e7c92c0b3f0778f1
/Codeforces/Gym/101670 2017-2018 CTU Open Contest/H.cpp
2246efef20ebb062154e0269937b97ac11bfe45b
[]
no_license
splucs/Competitive-Programming
b6def1ec6be720c6fbf93f2618e926e1062fdc48
4f41a7fbc71aa6ab8cb943d80e82d9149de7c7d6
refs/heads/master
2023-08-31T05:10:09.573198
2023-08-31T00:40:32
2023-08-31T00:40:32
85,239,827
141
27
null
2023-01-08T20:31:49
2017-03-16T20:42:37
C++
UTF-8
C++
false
false
601
cpp
#include <bits/stdc++.h> using namespace std; #define MAXN 200009 #define FOR(i, n) for(int i = 0; i < n; i++) #define REP(i, n) for(int i = n-1; i >= 0; i--) #define FOR1(i, n) for(int i = 1; i <= n; i++) #define REP1(i, n) for(int i = n; i > 0; i--) typedef long long ll; int a[MAXN], inv[MAXN]; int main() { int n; while(scanf("%d", &n) != EOF) { FOR1(i, n) { scanf("%d", &a[i]); inv[a[i]] = i; } int ans = 0; FOR1(i, n) { if(a[i] != i) { int j = inv[i]; swap(a[i], a[j]); inv[a[i]] = i; inv[a[j]] = j; ans++; } } printf("%d\n", ans); } return 0; }
[ "lucas.fra.oli18@gmail.com" ]
lucas.fra.oli18@gmail.com
606357bca476d618cff122bf9f46a34655c863ee
5f2e1907411cf1f417bb7325395dcfdee199d1d9
/src/Pos.h
382bc01aa3e523e7a3eed4e26e282f10982ddb30
[ "Zlib", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
anthemEdge/Sudoku-Solver
33c2884515f3212aed64c3269557be1d37c98838
800796247175d0463ebffef40f8a2271722ac03c
refs/heads/master
2020-05-17T14:48:25.935610
2015-07-18T22:09:59
2015-07-18T22:09:59
39,303,112
2
0
null
null
null
null
UTF-8
C++
false
false
241
h
/* * Pos.h * * Created on: 14 Jul 2015 * Author: eva */ #ifndef POS_H_ #define POS_H_ #include <sstream> using namespace std; struct Pos { int row; int col; Pos(int row, int col); string toString(); }; #endif /* POS_H_ */
[ "d.mx.gibbs@gmail.com" ]
d.mx.gibbs@gmail.com
aee2739037e9ac4aada0defb65a7c70777c096bf
c43b0d1e041d004d1fa8e1469f57b62d4d4bea88
/zircon/system/ulib/blobfs/write-txn.cc
c6270845915c4f0dfae52b9fe23b4f859f342e9a
[ "BSD-3-Clause", "MIT" ]
permissive
ZVNexus/fuchsia
75122894e09c79f26af828d6132202796febf3f3
c5610ad15208208c98693618a79c705af935270c
refs/heads/master
2023-01-12T10:48:06.597690
2019-07-04T05:09:11
2019-07-04T05:09:11
195,169,207
0
0
BSD-3-Clause
2023-01-05T20:35:36
2019-07-04T04:34:33
C++
UTF-8
C++
false
false
3,782
cc
// Copyright 2017 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <blobfs/metrics.h> #include <blobfs/write-txn.h> namespace blobfs { WriteTxn::~WriteTxn() { ZX_DEBUG_ASSERT_MSG(operations_.is_empty(), "WriteTxn still has pending operations"); } void WriteTxn::Enqueue(const zx::vmo& vmo, uint64_t relative_block, uint64_t absolute_block, uint64_t nblocks) { ZX_DEBUG_ASSERT(vmo.is_valid()); ZX_DEBUG_ASSERT(!IsBuffered()); for (auto& operation : operations_) { if (operation.vmo->get() != vmo.get()) { continue; } if (operation.op.vmo_offset == relative_block) { // Take the longer of the operations (if operating on the same blocks). if (nblocks > operation.op.length) { block_count_ += (nblocks - operation.op.length); operation.op.length = nblocks; } return; } else if ((operation.op.vmo_offset + operation.op.length == relative_block) && (operation.op.dev_offset + operation.op.length == absolute_block)) { // Combine with the previous operation, if immediately following. operation.op.length += nblocks; block_count_ += nblocks; return; } } UnbufferedOperation operation; operation.vmo = zx::unowned_vmo(vmo.get()); operation.op.type = OperationType::kWrite; operation.op.vmo_offset = relative_block; operation.op.dev_offset = absolute_block; operation.op.length = nblocks; operations_.push_back(std::move(operation)); block_count_ += operation.op.length; } size_t WriteTxn::BlkStart() const { ZX_DEBUG_ASSERT(IsBuffered()); ZX_DEBUG_ASSERT(operations_.size() > 0); return operations_[0].op.vmo_offset; } size_t WriteTxn::BlkCount() const { return block_count_; } void WriteTxn::SetBuffer(vmoid_t vmoid) { ZX_DEBUG_ASSERT(vmoid_ == VMOID_INVALID || vmoid_ == vmoid); ZX_DEBUG_ASSERT(vmoid != VMOID_INVALID); vmoid_ = vmoid; } zx_status_t WriteTxn::Flush() { ZX_ASSERT(IsBuffered()); fs::Ticker ticker(transaction_manager_->Metrics().Collecting()); // Update all the outgoing transactions to be in disk blocks block_fifo_request_t blk_reqs[operations_.size()]; const uint32_t kDiskBlocksPerBlobfsBlock = kBlobfsBlockSize / transaction_manager_->DeviceBlockSize(); for (size_t i = 0; i < operations_.size(); i++) { blk_reqs[i].group = transaction_manager_->BlockGroupID(); blk_reqs[i].vmoid = vmoid_; blk_reqs[i].opcode = BLOCKIO_WRITE; blk_reqs[i].vmo_offset = operations_[i].op.vmo_offset * kDiskBlocksPerBlobfsBlock; blk_reqs[i].dev_offset = operations_[i].op.dev_offset * kDiskBlocksPerBlobfsBlock; uint64_t length = operations_[i].op.length * kDiskBlocksPerBlobfsBlock; // TODO(ZX-2253): Requests this long, although unlikely, should be // handled more gracefully. ZX_ASSERT_MSG(length < UINT32_MAX, "Request size too large"); blk_reqs[i].length = static_cast<uint32_t>(length); } // Actually send the operations to the underlying block device. zx_status_t status = transaction_manager_->Transaction(blk_reqs, operations_.size()); if (transaction_manager_->Metrics().Collecting()) { uint64_t sum = 0; for (const auto& blk_req : blk_reqs) { sum += blk_req.length * kBlobfsBlockSize; } transaction_manager_->Metrics().UpdateWriteback(sum, ticker.End()); } operations_.reset(); vmoid_ = VMOID_INVALID; block_count_ = 0; return status; } } // namespace blobfs
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
5901a93f85f931f9cbd60cc14ec66d9494477f3f
646748c063c3b4e8538db6e89d9e13461ce4396b
/CCPanel.cpp
dee87b5d6674b9244048d8797d0eba006142b33c
[]
no_license
kdar/ccrack
8c57c38a6729be43ddea2f8a450ada581fb3a7ad
bbd237922eccde8d298860e1ce6c0ff6df52ef39
refs/heads/master
2016-09-01T17:38:42.371987
2009-12-19T08:59:31
2009-12-19T08:59:31
442,634
1
0
null
null
null
null
UTF-8
C++
false
false
5,075
cpp
///////////////////////////////////////////////////////////////////////////// // Name: CCPanel.cpp // Purpose: // Author: crenix // Modified by: // Created: 12/30/03 15:40:49 // RCS-ID: // Copyright: // Licence: ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ #pragma implementation "CCPanel.cpp" #endif // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif ////@begin includes #include "wx/wx.h" #include "wx/listctrl.h" #include "wx/statline.h" ////@end includes #include "CCPanel.h" ////@begin XPM images ////@end XPM images /*! * CCPanel type definition */ IMPLEMENT_CLASS( CCPanel, wxPanel ) /*! * CCPanel event table definition */ BEGIN_EVENT_TABLE( CCPanel, wxPanel ) ////@begin CCPanel event table entries ////@end CCPanel event table entries END_EVENT_TABLE() /*! * CCPanel constructors */ CCPanel::CCPanel( ) { } CCPanel::CCPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) { Create(parent, id, pos, size, style); } /*! * CCPanel creator */ bool CCPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) { ////@begin CCPanel member initialisation ////@end CCPanel member initialisation ////@begin CCPanel creation wxPanel::Create( parent, id, pos, size, style ); CreateControls(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); Centre(); ////@end CCPanel creation return TRUE; } /*! * Control creation for CCPanel */ void CCPanel::CreateControls() { ////@begin CCPanel content construction CCPanel* item1 = this; wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL); item1->SetSizer(item2); item1->SetAutoLayout(TRUE); wxBoxSizer* item3 = new wxBoxSizer(wxHORIZONTAL); item2->Add(item3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 3); wxListCtrl* item4 = new wxListCtrl( item1, ID_ListCracks, wxDefaultPosition, wxSize(150, 100), wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_HRULES|wxSIMPLE_BORDER ); item3->Add(item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0); item3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); wxBoxSizer* item6 = new wxBoxSizer(wxVERTICAL); item3->Add(item6, 0, wxALIGN_TOP|wxALL, 0); wxBoxSizer* item7 = new wxBoxSizer(wxHORIZONTAL); item6->Add(item7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0); wxTextCtrl* item8 = new wxTextCtrl( item1, ID_TextPath, _T(""), wxDefaultPosition, wxSize(200, 20), wxTE_READONLY|wxSIMPLE_BORDER ); item8->SetHelpText(_("Path to the software executable.")); if (ShowToolTips()) item8->SetToolTip(_("Path to the software executable.")); item7->Add(item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0); item7->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); wxButton* item10 = new wxButton( item1, ID_ButtonBrowse, _("Browse..."), wxDefaultPosition, wxSize(-1, 20), 0 ); item10->SetHelpText(_("Find the program to crack...")); if (ShowToolTips()) item10->SetToolTip(_("Find the program to crack...")); item7->Add(item10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0); wxStaticLine* item11 = new wxStaticLine( item1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); item6->Add(item11, 0, wxGROW|wxALL, 5); wxBoxSizer* item12 = new wxBoxSizer(wxHORIZONTAL); item6->Add(item12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0); wxButton* item13 = new wxButton( item1, ID_ButtonCrack, _("Crack"), wxDefaultPosition, wxSize(-1, 20), 0 ); item13->SetHelpText(_("Crack the above program.")); if (ShowToolTips()) item13->SetToolTip(_("Crack the above program.")); item12->Add(item13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0); item12->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); wxButton* item15 = new wxButton( item1, ID_ButtonHelp, _("?"), wxDefaultPosition, wxSize(15, 20), 0 ); item15->SetHelpText(_("View the about.")); if (ShowToolTips()) item15->SetToolTip(_("View the about.")); item12->Add(item15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0); item12->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); wxButton* item17 = new wxButton( item1, ID_ButtonExit, _("Exit"), wxDefaultPosition, wxSize(-1, 20), 0 ); item17->SetHelpText(_("Exit the program.")); if (ShowToolTips()) item17->SetToolTip(_("Exit the program.")); item12->Add(item17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0); item6->Add(0, 27, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0); wxBoxSizer* item19 = new wxBoxSizer(wxHORIZONTAL); item6->Add(item19, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0); wxGauge* item20 = new wxGauge( item1, ID_Gauge, 100, wxDefaultPosition, wxSize(250, 20), wxGA_HORIZONTAL|wxGA_PROGRESSBAR|wxGA_SMOOTH|wxSIMPLE_BORDER ); item20->SetValue(0); item19->Add(item20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0); ////@end CCPanel content construction } /*! * Should we show tooltips? */ bool CCPanel::ShowToolTips() { return TRUE; }
[ "kdarlington@rxmanagement.net" ]
kdarlington@rxmanagement.net
b6340e47473287d348eccc8dc1a5261ec7ed9639
44748073e5254d85d0c6859a272bb1812f9da125
/practice/treap/givr awaay.cpp
e2309b3d0b94ce2b4007a3f0c409afa962a27b31
[]
no_license
shikharsrivastava/Competitive-Programming-code
b33c7132fac82b01a6dbb799ddf379b56a3e2559
73402bac6333f9b29a0d6c7ce1be09fb5dbc2f93
refs/heads/master
2021-04-29T05:27:46.734598
2017-01-04T05:04:56
2017-01-04T05:04:56
77,982,204
2
2
null
null
null
null
UTF-8
C++
false
false
3,196
cpp
//22:17 #include<bits/stdc++.h> #define cnt(t) (t ? t->count : 0) #define updatecnt(t) (t ? (t->count = cnt(t->l) + cnt(t->r) + 1) : 0) using namespace std; typedef struct node * pnode; int *arr; pnode nodes; int next; struct node { int p; int v; int count; pnode l,r; }; int scanint() { int num = 0; char c = getchar_unlocked(); while(c >= '0' && c<= '9') { num = num *10 + c - '0'; c = getchar_unlocked(); } return num; } struct Treap { pnode tp; void init(int n) { tp = NULL; } void split(pnode t,pnode &l,pnode &r,int key) { if(!t) return void(l=r=0); else if(key > t->v) split(t->r,t->r,r,key) , l = t; else split(t->l,l,t->l,key) , r =t; updatecnt(t); } void merge(pnode &t,pnode l,pnode r) { if(!l || !r) t = l ? l : r; else if(l->p > r->p) merge(l->r,l->r,r) , t = l; else merge(r->l,l,r->l) , t = r; updatecnt(t); } void insert(pnode &t,pnode it) { if(!t) t = it; else if(it->p > t->p) split(t,it->l,it->r,it->v) , t = it; else if(it->v >= t->v) insert(t->r,it); else insert(t->l,it); updatecnt(t); } int get(pnode &t,int key) { if(!t) return 0; else if(key > t->v) return get(t->r,key); else return get(t->l,key) + cnt(t->r) + 1; } void erase(pnode &t,int key) { int ic = cnt(t); if(!t) return; else if(t->v == key) merge(t,t->l,t->r); else if(key > t->v) erase(t->r,key); else erase(t->l,key); updatecnt(t); } void replace(pnode &t,int k1,int k2) { erase(t,k1); ins(t,k2); } void inss(pnode &t,int k1) { nodes[next].v = k1; nodes[next].p = rand(); nodes[next].count = 1; nodes[next].l = nodes[next].r = NULL; insert(t,&nodes[next]); next++; } }; struct snode { Treap treap; }; struct SegmentTree { snode * t; int n; SegmentTree(int s) { n = s; t = new snode[4*n]; } void build(int l,int r,int id = 1) { t[id].treap.init(r-l+1); for(int i=l;i<=r;i++) t[id].treap.ins(t[id].treap.tp,arr[i]); if(l == r) return; int m = (l+r)/2; build(l,m,id*2); build(m+1,r,id*2+1); } int get(int L,int R,int key,int l,int r,int id = 1) { int ans; if(r<L || l>R) return 0; else if(l>=L && r<=R) return t[id].treap.get(t[id].treap.tp,key); else { int m = (l+r)/2; return get(L,R,key,l,m,id*2) + get(L,R,key,m+1,r,id*2+1); } } void update(int p,int k1,int k2,int l,int r,int id=1) { t[id].treap.replace(t[id].treap.tp,k1,k2); if(l == r) return; int m = (l+r)/2; if(p>m) update(p,k1,k2,m+1,r,id*2+1); else update(p,k1,k2,l,m,id*2); } }; int main() { int n,q,t,a,b,c; //scanf("%d",&n); n = scanint(); arr = (int*)calloc(n+1,sizeof(int)); for(int i=1;i<=n;i++) arr[i] = scanint(); //scanf("%d",&arr[i]); q = scanint(); nodes = new node[21000000]; next = 0; SegmentTree st(n); st.build(1,st.n); //scanf("%d",&q); while(q--) { //scanf("%d",&t); t = scanint(); if(t == 0) { //scanf("%d %d %d",&a,&b,&c); a = scanint(); b = scanint(); c = scanint(); printf("%d\n",st.get(a,b,c,1,st.n)); } else if(t == 1) { //scanf("%d %d",&a,&b); a = scanint(); b = scanint(); st.update(a,arr[a],b,1,st.n); arr[a] = b; } } return 0; }
[ "shikharsri1996@gmail.com" ]
shikharsri1996@gmail.com
4410f54cebe0cbe6e51eb78d5651e8515216e2a6
0f79a15057a46aa107aebfde8d8033341958c617
/src/stack.h
5b7cd30b22eef0cef57f129b94598d8e489dfde7
[]
no_license
liuyuntian/AI-in-Maze
d9fd155ede0a73829b61f09169f741ee0d42b83c
f2c71619ca506d73151945ff0a41f40da5134242
refs/heads/master
2021-01-10T08:11:32.162562
2016-03-03T11:05:55
2016-03-03T11:05:55
53,043,763
0
0
null
null
null
null
UTF-8
C++
false
false
655
h
//Yuntian Liu //C00151315 #ifndef STACK_H #define STACK_H #include <iostream> #include <list> using namespace std; class CStack { public: void Push(void *pData) { m_dataList.push_back(pData); } void* Pop() { void *ptr = NULL; list<void *>::iterator it = m_dataList.end(); it--; ptr = *it; m_dataList.pop_back(); return ptr; } void Clear() { m_dataList.clear(); } bool IsEmpty() { return m_dataList.empty(); } size_t GetSize() { return m_dataList.size(); } protected: list<void *> m_dataList; }; #endif
[ "liuyuntian110@126.com" ]
liuyuntian110@126.com
3a87ecab8ab8356ab7c167b4f1ed01a3491cc943
fa7f77f470995a4bba077d0ce837e61ba545015c
/src/objects/audio_analysis/PitchExtractor.h
42472b69ba64582acafcb809711aacb2c3b71e6f
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
d3cod3/ofxVisualProgramming
b0d73c7e334c78a90d3dd7e73a8d9e03da38e05a
f152893238cffa070da69c54324b770f07ddeddb
refs/heads/master
2023-04-06T10:20:29.050546
2023-01-24T16:51:11
2023-01-24T16:51:11
137,724,379
154
19
MIT
2023-09-11T18:56:05
2018-06-18T07:56:31
C++
UTF-8
C++
false
false
2,645
h
/*============================================================================== ofxVisualProgramming: A visual programming patching environment for OF Copyright (c) 2018 Emanuele Mazza aka n3m3da <emanuelemazza@d3cod3.org> ofxVisualProgramming is distributed under the MIT License. This gives everyone the freedoms to use ofxVisualProgramming in any context: commercial or non-commercial, public or private, open or closed source. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. See https://github.com/d3cod3/ofxVisualProgramming for documentation ==============================================================================*/ #ifndef OFXVP_BUILD_WITH_MINIMAL_OBJECTS #pragma once #include "PatchObject.h" class PitchExtractor : public PatchObject { public: PitchExtractor(); void newObject() override; void setupObjectContent(shared_ptr<ofAppGLFWWindow> &mainWindow) override; void updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObjects) override; void drawObjectContent(ofTrueTypeFont *font, shared_ptr<ofBaseGLRenderer>& glRenderer) override; void drawObjectNodeGui( ImGuiEx::NodeCanvas& _nodeCanvas ) override; void drawObjectNodeConfig() override; void removeObjectContent(bool removeFileFromData=false) override; int bufferSize; int spectrumSize; int arrayPosition; bool isNewConnection; bool isConnectionRight; private: OBJECT_FACTORY_PROPS }; #endif
[ "n3m3da@d3cod3.org" ]
n3m3da@d3cod3.org
72d452631b02bf13b01ec166d9d04f24f9d62b13
65b074479e44c95ad179b09ebb4383e62f19c259
/Implementation/Core.Android/GLContext.h
29858ea2b71a57e78b6055756a7faa5a8105bede
[]
no_license
YevhenRezohlazov/Mogren
fcd622a0df39fd47074696462be69a14c3998d05
198805a60bef287ab43030f93be2d8c42951eae9
refs/heads/master
2020-06-03T00:40:00.246128
2019-01-03T10:43:13
2019-01-03T10:43:13
191,363,888
0
0
null
null
null
null
UTF-8
C++
false
false
3,293
h
/* * Copyright 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //-------------------------------------------------------------------------------- // GLContext.h //-------------------------------------------------------------------------------- #ifndef GLCONTEXT_H_ #define GLCONTEXT_H_ #include <EGL/egl.h> #include <GLES2/gl2.h> #include <android/log.h> #include <android/native_window.h> namespace ndk_helper { //-------------------------------------------------------------------------------- // Constants //-------------------------------------------------------------------------------- //-------------------------------------------------------------------------------- // Class //-------------------------------------------------------------------------------- /****************************************************************** * OpenGL context handler * The class handles OpenGL and EGL context based on Android activity life cycle * The caller needs to call corresponding methods for each activity life cycle *events as it's done in sample codes. * * Also the class initializes OpenGL ES3 when the compatible driver is installed *in the device. * getGLVersion() returns 3.0~ when the device supports OpenGLES3.0 * * Thread safety: OpenGL context is expecting used within dedicated single *thread, * thus GLContext class is not designed as a thread-safe */ class GLContext { private: // EGL configurations ANativeWindow* window_; EGLDisplay display_; EGLSurface surface_; EGLContext context_; EGLConfig config_; // Screen parameters int32_t screen_width_; int32_t screen_height_; int32_t color_size_; int32_t depth_size_; // Flags bool gles_initialized_; bool egl_context_initialized_; bool context_valid_; void InitGLES(); void Terminate(); bool InitEGLSurface(); bool InitEGLContext(); GLContext(GLContext const&); void operator=(GLContext const&); GLContext(); virtual ~GLContext(); public: static GLContext* GetInstance() { // Singleton static GLContext instance; return &instance; } bool Init(ANativeWindow* window); EGLint Swap(); bool Invalidate(); void Suspend(); EGLint Resume(ANativeWindow* window); ANativeWindow* GetANativeWindow(void) const { return window_; }; int32_t GetScreenWidth() const { return screen_width_; } int32_t GetScreenHeight() const { return screen_height_; } int32_t GetBufferColorSize() const { return color_size_; } int32_t GetBufferDepthSize() const { return depth_size_; } bool CheckExtension(const char* extension); EGLDisplay GetDisplay() const { return display_; } EGLSurface GetSurface() const { return surface_; } }; } // namespace ndkHelper #endif /* GLCONTEXT_H_ */
[ "yevhen.rezohlazov@gmail.com" ]
yevhen.rezohlazov@gmail.com
ac651b408faf9c2fa63d63094701a3522e84194a
7f9ea65b18627ea03e4357b5bae5f7baaa20a115
/LinearIndx.cpp
073c5c3eeb7e18fb7e4633332d0bcae29e58adb6
[]
no_license
BrightAugustt/LinearIndex
f1654a80431ae1ef438ff0c597b579cd2f1654f4
0b5dd87de1ea271a3f15ae0d03e37e47ed8f4f35
refs/heads/main
2023-03-25T18:02:14.878641
2021-03-26T23:43:22
2021-03-26T23:43:22
351,920,390
0
0
null
null
null
null
UTF-8
C++
false
false
651
cpp
#include <iostream> using namespace std; const int N = 3; int main() { /* 2D array declaration*/ int LinearIndx[4][5]; int i, j; for(i=0; i<4; i++) { for(j=0;j<5;j++) { //cout << LinearIndx arr[i][j]; printf("Enter value for LinearIndx[%d][%d]:", i, j); scanf("%d", &LinearIndx[i][j]); } } //Displaying array elements printf("Two Dimensional array elements:\n"); for(i=0; i<4; i++) { for(j=0;j<5;j++) { printf("%d ", LinearIndx[i][j]); if(j==4){ printf("\n"); } } } return 0; }
[ "noreply@github.com" ]
BrightAugustt.noreply@github.com
7d15297eb55b0dbcacf1287f5c01c813b087731d
950161afb4cbe035579af74aa69a206e543697da
/parser/pglang_parser__token.hpp
cecd6402f8d6d5ecdf36744e0112abbe9dd78cd9
[]
no_license
mugisaku/pglang
31120a683cce8c9bca2c9271aa659a1a96269c1a
afdbd2c6e7f10bc2e16302d04fe9a26d33496b8e
refs/heads/master
2021-01-12T07:49:04.379042
2017-02-01T03:49:08
2017-02-01T03:49:08
77,029,725
1
0
null
null
null
null
UTF-8
C++
false
false
1,578
hpp
#ifndef PGLANG_PARSER__TOKEN_HPP_INCLUDED #define PGLANG_PARSER__TOKEN_HPP_INCLUDED #include<cstddef> #include<string> #include"pglang_expr__operator.hpp" #include"pglang_parser__block.hpp" #include"pglang_parser__cursor.hpp" #ifndef report #define report printf("[report in %s] %d %s\n",__FILE__,__LINE__,__func__); #endif namespace pglang{ namespace parser{ enum class TokenKind { null, tab, newline, space, semicolon, character, u8character, u16character, u32character, string, u8string, u16string, u32string, identifier, operator_, integer, floating_point_number, block, unknown, }; union TokenData { uint64_t i; double f; Block block; std::string string; Operator operator_; TokenData(){} ~TokenData(){} }; class Token { TokenKind kind; TokenData data; Cursor cursor; public: Token(TokenKind k=TokenKind::null); Token(uint64_t i, TokenKind k); Token(std::string&& s, TokenKind k); Token(double f); Token(Block&& blk); Token(Operator&& op); Token( Token&& rhs) noexcept; Token(const Token& rhs) noexcept; ~Token( ); Token& operator=( Token&& rhs) noexcept; Token& operator=(const Token& rhs) noexcept; const TokenData& operator*() const; const TokenData* operator->() const; bool operator==(TokenKind k) const; operator bool() const; void clear(); void set_cursor(const Cursor& cur); const Cursor& get_cursor() const; void print(int indent) const; }; }} #endif
[ "lentilspring@gmail.com" ]
lentilspring@gmail.com
46c1b4340ff046c08a85572c704c8874449434cc
6c3925c167d55577bff746bab9c0498b0f1a398d
/UDMF-Converter-EE/Lump.hpp
80d201437f962723db90324e8e1e5398b2337504
[]
no_license
ioan-chera/UDMF-Converter-EE
82457e5b7ef5162f606f5ebb9d5523274bb7e85c
02f3db0ed4b1b400f52d379a2659c90042d27182
refs/heads/master
2021-01-11T22:27:19.390316
2019-10-03T07:44:32
2019-10-03T07:44:32
78,963,353
0
1
null
2017-09-02T12:57:13
2017-01-14T19:57:58
C++
UTF-8
C++
false
false
1,916
hpp
// // UDMF Converter EE // Copyright (C) 2017 Ioan Chera // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see http://www.gnu.org/licenses/ // // Additional terms and conditions compatible with the GPLv3 apply. See the // file COPYING-EE for details. // // Purpose: Lump data class // Authors: Ioan Chera // #ifndef Lump_hpp #define Lump_hpp #include <stdint.h> #include <stdlib.h> #include <string.h> #include <istream> #include <vector> #include "Result.hpp" enum { LumpNameLength = 8, // lump name size is limited }; // // Lump class // class Lump { public: Lump() { memset(mName, 0, sizeof(mName)); } explicit Lump(const char name[LumpNameLength + 1]) { strcpy(mName, name); } Lump(const char name[LumpNameLength + 1], const std::string &text); template<typename T> Lump(const char name[LumpNameLength + 1], const std::vector<T> &data) { strcpy(mName, name); mData.resize(data.size() * sizeof(T)); memcpy(mData.data(), data.data(), data.size() * sizeof(T)); } Result Load(std::istream &is, size_t size); const char *Name() const { return mName; } const std::vector<uint8_t> &Data() const { return mData; } private: char mName[LumpNameLength + 1]; // lump name std::vector<uint8_t> mData; // lump content }; #endif /* Lump_hpp */
[ "ioan.chera@gmail.com" ]
ioan.chera@gmail.com