Invoice::Invoice(string n, string d, int qitem, int pitem) { setNumber(n); setdescription(d); setquantity(qitem); setprice(pitem); }
int BlogObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = TSqlObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; #ifndef QT_NO_PROPERTIES if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = getid(); break; case 1: *reinterpret_cast< QString*>(_v) = getusername(); break; case 2: *reinterpret_cast< QString*>(_v) = gettitle(); break; case 3: *reinterpret_cast< QString*>(_v) = getdescription(); break; case 4: *reinterpret_cast< QDateTime*>(_v) = getcreated_at(); break; case 5: *reinterpret_cast< QDateTime*>(_v) = getupdated_at(); break; case 6: *reinterpret_cast< int*>(_v) = getlock_revision(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setid(*reinterpret_cast< int*>(_v)); break; case 1: setusername(*reinterpret_cast< QString*>(_v)); break; case 2: settitle(*reinterpret_cast< QString*>(_v)); break; case 3: setdescription(*reinterpret_cast< QString*>(_v)); break; case 4: setcreated_at(*reinterpret_cast< QDateTime*>(_v)); break; case 5: setupdated_at(*reinterpret_cast< QDateTime*>(_v)); break; case 6: setlock_revision(*reinterpret_cast< int*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
DosLifetimeSpline::DosLifetimeSpline(int n,double estart,double dispersion,std::vector<Parameter*>* parameterlistptr) :Component(n,estart,dispersion),Evector(),Yvector(),b(),c(),d() { broadeningtype=QUADRATIC; //offset=2; offset=2; //create spectrum with same energy scale as this dummy=new Spectrum(n,estart,dispersion); Plotspec=0; compptr=0; if (parameterlistptr==0){ //ask for the degree of the polynomial between 1 and 100 const int min=1; const int max=1024; int d=10; Integerinput myinput(0,"","enter number of points",d,min,max); degree=size_t(d); //enter Estart and Estop Parameter* p1=new Parameter("Estart",estart,1); p1->interactivevalue("Enter Estart"); p1->setchangeable(false); this->addparameter(p1); Parameter* p2=new Parameter("Estop",estart,1); p2->interactivevalue("Enter Estop"); p2->setchangeable(false); this->addparameter(p2); //atomic to calculate the lifetime broadening Parameter* p3=new Parameter("a",0.4,1); //choose between different types of broadening int broadtype=0; Integerinput* myask=new Integerinput(0, "Lifetime broadening selector","1=Lin.,2=Quadr.,3=Egert.",broadtype,1,3); (void) myask; switch(broadtype){ case 1: p3->setname("Linear coefficient"); break; case 2: p3->setname("Quadratic coefficient"); break; case 3: p3->setname("Egerton Broadening atomic distance [nm]"); break; default: break; } p3->setboundaries(0,10.0); p3->interactivevalue("Enter broadening coefficient (0.0 for linear scale)"); p3->setchangeable(false); this->addparameter(p3); //do we want linear or lifetime optimised energy points linear=false; if ((p3->getvalue())==0.0){ //only for linear scale we need Estop //for lieftime broadening Estop is calculated by initenergy linear=true; } for (size_t i=0;i<degree;i++){ std::string name; std::ostringstream s; if ((s << "a"<< i)){ //converting an int to a string in c++ style rather than unsafe c-style // conversion worked name=s.str(); } //store parameters to hold the strengths of the basis set L Parameter* p=new Parameter(name,1.0,1); p->setboundaries(-1.0,10.0); //copy this parameter this->addparameter(p); } //now link this to a cross section which needs to be multiplied Model* mymodel=geteelsmodelptr()->getmodel_nonconst(); int cnr=0; //create a componentselector here Componentselector myinput2(0,"","Select the component you want to multiply with",cnr); //get a pointer to this component and tell it that we are his multiplier compptr=mymodel->getcomponent(cnr); set_ismultiplier(true);//important do it here, otherwise multiplierptr is not accepted if (compptr!=0){ compptr->setmultiplierptr(this); } else{ //something went wrong Saysomething mysay(0,"Error","the component didn't appear to be valid"); throw Componenterr::unable_to_create(); } //save this number in a parameter Parameter* p5=new Parameter("compnr",cnr,1); p5->setchangeable(false); this->addparameter(p5); } else{ //get parameters from a list for (size_t i=0;i<(parameterlistptr->size());i++){ Parameter* p=(*parameterlistptr)[i]; this->addparameter(p); } degree=(parameterlistptr->size())-4;//there are 4 other parameters //tell the component that we multiply that we are here Parameter* p5=(*parameterlistptr)[parameterlistptr->size()-1]; Model* mymodel=geteelsmodelptr()->getmodel_nonconst(); const int cnr=int(p5->getvalue()); //get a pointer to this component and tell it that we are his multiplier compptr=mymodel->getcomponent(cnr); set_ismultiplier(true);//important do it here, otherwise multiplierptr is not accepted if (compptr!=0) { compptr->setmultiplierptr(this); } #ifdef COMPONENT_DEBUG std::cout <<"After linking to the cross section\n"; #endif } //end of else #ifdef COMPONENT_DEBUG std::cout <<"Setting the names etc\n"; #endif //give a name and description setname("Fine Structure (DOS) with lifetime (cubic spline)"); setdescription("Fine Structure used in combination with a normal cross-section using Lifetime broadening as an extra prior knowledge"); setcanconvolute(true); setshifter(false); set_ismultiplier(true); /* for (size_t i=0;i<degree;i++){ //tell that we have a gradient for each point a_i this->sethasgradient(i+3,true); } */ InitEnergy(); //prepare the energy points that are linked to the paramters gslinit(); //setup the memory for the gsl fitter calculate(); setvisible(true); Plotspec=new Spectrum(Evector.size()); initplotspec(); (this->getgraphptr())->addgraph(Plotspec); (this->getgraphptr())->setstyle(1,2); //set style of this plot to dots instead of lines //show the current DOS //make a new spectrum containing Evector,Yvector //show an equaliser this->showequalizer(); }
Plasmon::Plasmon(int n,double estart,double dispersion,std::vector<Parameter*>* parameterlistptr) :Component(n,estart,dispersion) { //ask for number of plasmons to calculate const int min=1; const int max=10; nrofplasmons=2; Integerinput myinput(0,"","enter degree the number of plasmons",nrofplasmons,min,max); //create the lorentz peaks for ZL and plasmons peaklist.resize(0); const double EZL=0.0; //the zl position const double fwhmZL=1.0; //the fwhm of the ZL peak const double heightZL=1.0e3; //the height of the ZL peak //create the ZL peak Lorentz* ZL=new Lorentz(n,estart,dispersion,EZL,fwhmZL,heightZL); peaklist.push_back(ZL); //create the plasmon peaks const double EP=15.0; //the zl position const double fwhmP=10.0; //the fwhm of the ZL peak const double tlambda=0.3; //the t/lambda thickness factor for (int i=1;i<=nrofplasmons;i++){ //a poisson related height for the ith plasmon double height=heightZL*poissonfraction(tlambda,i); Lorentz* plasmon=new Lorentz(n,estart,dispersion,i*EP,fwhmP,height); peaklist.push_back(plasmon); } //add the required parameters if (parameterlistptr==0){ //we have to create a new set of parameters //position of the ZL Parameter* p1=new Parameter("EZL",EZL,1); p1->interactivevalue("enter the ZL position"); this->addparameter(p1); //fwhm ZL Parameter* p2=new Parameter("fwhmZL",fwhmZL,1); p2->interactivevalue("enter fwhm of the ZL"); this->addparameter(p2); //ZL height Parameter* p3=new Parameter("heightZL",heightZL,1); p3->interactivevalue("enter height of the ZL"); this->addparameter(p3); //plasmon energy Parameter* p4=new Parameter("EP",EP,1); p4->interactivevalue("enter plasmon energy"); this->addparameter(p4); //plasmon fwhm Parameter* p5=new Parameter("fwhmP",fwhmP,1); p5->interactivevalue("enter plasmon fwhm"); this->addparameter(p5); //t/lambda Parameter* p6=new Parameter("tlambda",tlambda,1); p6->interactivevalue("enter plasmon fwhm"); this->addparameter(p6); //darknoise double dnoise=0.0; Parameter* p7=new Parameter("dnoise",dnoise,1); p7->interactivevalue("enter darknoise value"); this->addparameter(p7); } else{ //get parameters from a list Parameter* p1=(*parameterlistptr)[0]; this->addparameter(p1); Parameter* p2=(*parameterlistptr)[1]; this->addparameter(p2); Parameter* p3=(*parameterlistptr)[2]; this->addparameter(p3); Parameter* p4=(*parameterlistptr)[3]; this->addparameter(p4); Parameter* p5=(*parameterlistptr)[4]; this->addparameter(p5); Parameter* p6=(*parameterlistptr)[5]; this->addparameter(p6); Parameter* p7=(*parameterlistptr)[6]; this->addparameter(p7); } //give a name and description setname("Plasmon model"); setdescription("A model of a lorentzian ZL peak and a set of lorentzian plasmon peaks"); setcanconvolute(true); setshifter(false); }