Exemple #1
0
int* lowly_get_ell(int *pnell, int *inell, int lmax,error **err) {
  int *outell;
  int nell,i;
  
  nell = *pnell;
  
  if (nell==0) {
    outell = malloc_err(sizeof(int)*(lmax+1),err);
    forwardError(*err,__LINE__,NULL);
    for(i=0;i<lmax+1;i++) {
      outell[i]=i;
    }
    nell = lmax+1;
  } else {
    outell = malloc_err(sizeof(int)*nell,err);
    forwardError(*err,__LINE__,NULL);
    memcpy(outell,inell,sizeof(int)*nell);
  }
  *pnell = nell;
  if (lmax!=0) {
    for(i=0;i<nell;i++) {
      testErrorRetVA(outell[i]>lmax,lowly_lbig,"ell[%d]=%d>lmax (%d)",*err,__LINE__,NULL,i,outell[i],lmax);
    }
  }
  return outell;
}
Exemple #2
0
EditWidget::EditWidget(RESpecTa *parent, Model * newmod )
    : QStackedWidget(parent)
{
    this->setMinimumWidth(230);
stateWidget = new StateWidget(this, newmod);
    this->addWidget(stateWidget);//,tr("State"));
transWidget = new TransWidget(this, newmod);
    this->addWidget(transWidget);//, tr("Transition"));
subtaskWidget = new SubtaskWidget(this, newmod);
    this->addWidget(subtaskWidget);//, tr("Subtasks"));
this->addWidget(new QWidget());

    connect(this, SIGNAL(currentChanged(int)), this, SLOT(refreshWidget(int)));

    connect(subtaskWidget, SIGNAL(added(QString)), parent, SLOT(SubtaskAdded(QString)));
    connect(subtaskWidget, SIGNAL(changed(QString,QString)), parent, SLOT(SubtaskChanged(QString, QString)));
    connect(subtaskWidget, SIGNAL(removed(QString)), parent, SLOT(SubtaskRemoved(QString)));
    connect(subtaskWidget, SIGNAL(reportError(QString)), this, SLOT(forwardError(QString)));
    connect(subtaskWidget, SIGNAL(UncheckTasksAction()), parent, SLOT(HideTheSubtask()));

    //connect (stateWidget, SIGNAL(InsertState(BaseState*)), parent,SLOT(InsertState(BaseState*)));
    connect (stateWidget, SIGNAL(ReplaceState(BaseState * , BaseState * )), parent,SLOT(ReplaceState(BaseState * , BaseState * )));
    connect (stateWidget, SIGNAL(reportError(QString)), this, SLOT(forwardError(QString)));

    //connect (transWidget, SIGNAL(insertTransition(std::pair<QString,QString>)), parent,SLOT(insertTransition(std::pair<QString,QString>)));
    connect (transWidget, SIGNAL(reportError(QString)), this, SLOT(forwardError(QString)));

    connect(parent, SIGNAL(refreshWidgets()), this, SLOT(refreshAllWidgets()));
    connect(parent, SIGNAL(SignalDeleted()), this, SLOT(SignalDeleted()));
    this->setCurrentIndex(3);
}
Exemple #3
0
cmblkl *init_cmblkl(void* lkl_data, posterior_log_pdf_func* lkl_func, 
                    posterior_log_free *lkl_free,
                    int nell,int* ell,int* has_cl,int lmax,
                    double unit,
                    double *wl, int wlselect,double *bins,int nbins,int xdim, error **err) {
  cmblkl *self;
  int *_ell,_nell;
  
  self = malloc_err(sizeof(cmblkl),err);
  forwardError(*err,__LINE__,NULL);
  
  self->unit = unit;
  
  self->lkl_data = lkl_data;
  self->lkl_func = lkl_func;
  self->lkl_free = lkl_free;
  
  self->nell = nell;
  self->ell = lowly_get_ell(&self->nell, ell, lmax, err);
  forwardError(*err,__LINE__,NULL);    
  
  _ell = self->ell;
  _nell = self->nell;
  
  self->ndim = lowly_get_offset_cl(has_cl, self->offset_cl,self->nell);
  self->xdim = xdim;
  
  self->wl=NULL;
  if (wl!=NULL) {
    self->wl = malloc_err(sizeof(double)*_nell,err);
    forwardError(*err,__LINE__,NULL);    
    if (wlselect==1) {
      memcpy(self->wl,wl,sizeof(double)*_nell);
    } else {
      int il;
      for(il=0;il<_nell;il++) {
        self->wl[il] = wl[_ell[il]];
      }
    }
  }
  
  self->bins = NULL;
  self->nbins = self->ndim;  // if I have no binning matrix, nbins = ndim
  if (nbins!=0 && bins!=NULL) {
    self->nbins = nbins;
    self->pls = malloc_err(sizeof(double)*((self->ndim+1)*self->nbins+self->xdim), err);
    self->bins = self->pls + self->nbins + self->xdim;
    forwardError(*err,__LINE__,NULL);    
    memcpy(self->bins,bins,sizeof(double)*self->ndim*self->nbins);
  }
  self->xnames = NULL;
  
  return self;
}
Exemple #4
0
double lklbs_lkl(void* pelf, double* pars, error **err) {
  lklbs* self;
  double res;
  double* cls;
  int cli,ilkl;
  cmblkl *llkl;
  char spars[200000];
  int i;
  
  self=pelf;
  
  /*sprintf(spars,"pars (%d,%d): ",self->ndim,self->xdim );
  for(i=0;i<self->ndim+self->xdim;i++) {
    sprintf(spars,"%s %15.10f",spars,pars[i]);
  }*/
  //_DEBUGHERE_("%s",spars);
  
  self->rbs->bs_compute(self->rbs->bs,pars,self->cl_theo,err);
  if (isError(*err)) {
    char *problem;
    int iii;
    problem = malloc(sizeof(char)*(50+10*self->ndim));
    sprintf(problem,"Problem in cl code at :\n    ");
    for (iii=0;iii<self->ndim;iii++) {
      sprintf(problem,"%s %g",problem,pars[iii]);
    }
    sprintf(problem,"%s\n",problem);
    //_DEBUGHERE_("%s",problem);
    free(problem);
  }
  forwardError(*err,__LINE__,0);
  
  res=0;
  
  for (ilkl=0;ilkl<self->nlkl;ilkl++) {
    llkl = self->lkls[ilkl];
    cls = cmblkl_select_cls(llkl,self);
    //_DEBUGHERE_("ilkl %d xdim %d ndim %d nbins %d",ilkl,llkl->xdim,llkl->ndim,llkl->nbins);
    if (llkl->xdim!=0) {
      int ii;
      for(ii=0;ii<llkl->xdim;ii++) {
        //_DEBUGHERE_("ilkl %d ixdim %d self->ndim %d ofx+i %d rx %d %g ->",ilkl,ii,self->ndim,self->ofx[ilkl]+ii,self->rx[self->ofx[ilkl]+ii],pars[self->ndim+self->rx[self->ofx[ilkl]+ii]]);
        cls[llkl->nbins+ii] = pars[self->ndim+self->rx[self->ofx[ilkl]+ii]];
      }
    }
    res += llkl->lkl_func(llkl->lkl_data,cls,err);
    forwardError(*err,__LINE__,0);
  }
  //_DEBUGHERE_("%g",res);
  return res;
}
Exemple #5
0
distribution* init_fulllklbs_distribution(cmblkl** lkls,int nlkl, 
                                           bs_struct* rbs, 
                                           int *lmax, error **err) {
  distribution *dist;
  lklbs* self;

  self = init_fulllklbs(lkls,nlkl, rbs, lmax, err); 
  forwardError(*err,__LINE__,NULL);
  
  dist = init_distribution(self->ndim+self->xdim,self,&lklbs_lkl,&free_lklbs,NULL,err);
  forwardError(*err,__LINE__,NULL);
  
  return dist;
 
}
Exemple #6
0
lklbs* init_multilklbs(cmblkl** lkls,int nlkl, 
                  int ndim,void* bs, compute_cl_func* bs_compute, 
                  posterior_log_free* bs_free, 
                  int *lmax, error **err) {
  lklbs *self;
  bs_struct *rbs;

  rbs = init_bs_struct(ndim,bs,bs_compute,bs_free,NULL,err);
  forwardError(*err,__LINE__,NULL);
  
  self =  init_fulllklbs(lkls,nlkl, rbs, lmax, err); 
  forwardError(*err,__LINE__,NULL);

  return self;
}
Exemple #7
0
distribution* init_multilklbs_distribution(int ndim,cmblkl** lkls,int nlkl, 
                                           void* bs, compute_cl_func* bs_compute, 
                                           posterior_log_free* bs_free, 
                                           int *lmax, error **err) {
  distribution *dist;
  lklbs* self;
  
  self = init_multilklbs(lkls,nlkl,ndim,bs,bs_compute,bs_free,lmax,err);
  forwardError(*err,__LINE__,NULL);
  
  dist = init_distribution(ndim+self->xdim,self,&lklbs_lkl,&free_lklbs,NULL,err);
  forwardError(*err,__LINE__,NULL);
  
  return dist;
  
}
distribution* init_distribution_full(int ndim,
                                     void* data, 
                                     posterior_log_pdf_func* log_pdf,
                                     posterior_log_free* freef,
                                     simulate_func *simulate,
                                     int n_ded,
                                     retrieve_ded_func* retrieve,
                                     error **err) {
  distribution *dist;
  
  testErrorRet(n_ded!=0 && retrieve==NULL,dist_undef,
               "Target invalid, expect deduced parameters, but no function provided...",
               *err,__LINE__,NULL);
  
  dist = malloc_err(sizeof(distribution),err);
  forwardError(*err,__LINE__,NULL);
  
  dist->ndim = ndim;
  dist->n_ded = n_ded;
  dist->data = data;
  dist->log_pdf = log_pdf;
  dist->free = freef;
  dist->simulate = simulate;
  dist->retrieve = retrieve;
  dist->broadcast_mpi = NULL;
  dist->ndef = 0;
  dist->def = NULL;
  dist->pars = NULL;
  dist->dlhandle = NULL;
  dist->name = NULL;
  
  dist->f_der = NULL;
  dist->d_der = NULL;
  return dist;
}
Exemple #9
0
double select_func(void* dt, double *pars,error **err) {
  cmblkl_select *selec;
  int i,cli,zero,cr;
  double res;

  selec = dt;

  zero = 0;
  cr=0;
  for(cli=0;cli<6;cli++) {
    //_DEBUGHERE_("%d :: %d %d %d,%d",cli,selec->mlmax,selec->lmax[cli],zero,cr);
    for(i=0;i<selec->lmax[cli]+1;i++) {
      selec->pars[cr] = pars[zero+i];
      cr++;
    }
    if (selec->lmax[cli]!=-1) {
      zero += selec->mlmax+1;  
    }
  }
  for(i=0;i<selec->xdim;i++) {
    //_DEBUGHERE_("%d %d %d %d %g",selec->xdim,i,cr,zero,pars[zero+i]);
    selec->pars[cr] = pars[zero+i];
    cr++;
  }

  res = selec->lkl_func(selec->lkl_data,selec->pars,err);
  forwardError(*err,__LINE__,0);

  return res;
}
Exemple #10
0
int lklbs_get_par_id(lklbs* self,extraname name, error **err) {
  int i;
  void *old;

  if (self->rbs->xnames!=NULL) {
    // check whether the parameter is not one of the bs parameters
    for(i=0;i<self->ndim;i++) {
      if (strcmp(self->rbs->xnames[i],name)==0) {
        return i-self->ndim;
      }
    }
  }
  if (self->xdim==0) {
    self->xnames = malloc_err(sizeof(extraname),err);
    sprintf(self->xnames[0],"%s",name);
    self->xdim = 1;
    return 0;
  }
  for(i=0;i<self->xdim;i++) {
    if (strcmp(self->xnames[i],name)==0) {
      return i;
    }
  }
  old = self->xnames;
  self->xnames = malloc_err(sizeof(extraname)*(self->xdim+1),err);
  forwardError(*err,__LINE__,-1);
  memcpy(self->xnames,old,self->xdim*sizeof(extraname));
  sprintf(self->xnames[self->xdim],"%s",name);
  self->xdim++;
  free(old);
  return self->xdim-1;
}
Exemple #11
0
// deprecated stuff
distribution* init_lklbs_distribution(int ndim,void* lkl, posterior_log_pdf_func* lkl_func, 
                                      posterior_log_free *lkl_free, 
                                      void* bs, compute_cl_func* bs_compute, 
                                      posterior_log_free* bs_free, 
                                      int nell, int* ell, int *lmax,error **err) {
  distribution *dist;
  lklbs* self;
  
  self = init_lklbs(lkl,lkl_func,lkl_free,ndim,bs,bs_compute,bs_free,nell,ell,lmax,err);
  forwardError(*err,__LINE__,NULL);
  
  dist = init_distribution(ndim+self->xdim,self,&lklbs_lkl,&free_lklbs,NULL,err);
  forwardError(*err,__LINE__,NULL);
  
  return dist;
}
Exemple #12
0
lklbs* init_lklbs(void* lkl, posterior_log_pdf_func* lkl_func, 
                  posterior_log_free *lkl_free, int ndim,
                  void* bs, compute_cl_func* bs_compute, 
                  posterior_log_free* bs_free, 
                  int nell, int* ell, int *lmax, error **err) {
  lklbs *self;
  int cli,clmax,mlmax,l;
  int has_cl[6];
  cmblkl *lkls;
  
  
  mlmax = -1;
  for(cli=0;cli<6;cli++) {
    if(lmax[cli]>mlmax) 
      mlmax=lmax[cli];
  }
  
  if (ell!=NULL) {
    for(l=0;l<nell;l++) {
      if (self->ell[l]-1>mlmax) {
        mlmax = self->ell[l]-1;
      }
    }
  }
  
  for(cli=0;cli<6;cli++) {
    if(lmax[cli]!=-1) {
      has_cl[cli] = 1;
      if(lmax[cli]<mlmax) 
        lmax[cli]=mlmax;
    } else{
      has_cl[cli]=-1;
    }
  }
  
  lkls = init_cmblkl(lkl, lkl_func, lkl_free, nell, ell, has_cl, mlmax,1,NULL,0,NULL,0,0, err);
  forwardError(*err,__LINE__,0);
  
  self = init_multilklbs(&lkls, 1, ndim,bs, bs_compute, bs_free, lmax, err);
  forwardError(*err,__LINE__,0);
  
  return self;
}
Exemple #13
0
cmblkl *init_cmblkl_select(void* lkl_data, posterior_log_pdf_func* lkl_func, 
                    posterior_log_free *lkl_free,
                    int *lmax,
                    int xdim, error **err) {
  cmblkl_select *selec;
  cmblkl *self;
  int mlmax,i;
  int has_cl[6];
  int np;

  selec = malloc_err(sizeof(cmblkl_select),err);
  forwardError(*err,__LINE__,NULL);
  
  np = lmax[0]+1;
  mlmax = lmax[0];
  for (i=0;i<6;i++) {
    has_cl[i]=0;
    if (lmax[i]!=-1) {
      has_cl[i] = 1;  
    }
    if (lmax[i]>mlmax) {
      mlmax = lmax[i];
    }
    selec->lmax[i] = lmax[i];
    np += lmax[i] + 1;
  }
  selec->mlmax = mlmax;
  
  selec->lkl_data = lkl_data;
  selec->lkl_func = lkl_func;
  selec->lkl_free = lkl_free;
  selec->xdim = xdim;
  selec->ndim = np;
  selec->pars = malloc_err(sizeof(double)*(np+xdim),err);
  forwardError(*err,__LINE__,NULL);
  
  self = init_cmblkl(selec,select_func,select_free,0,NULL,has_cl,mlmax,1,NULL,0,NULL,0,xdim,err);
  forwardError(*err,__LINE__,NULL);
  
  return self;
}
distribution* init_simple_distribution(int ndim,
                                void* data, 
                                posterior_log_pdf_func* log_pdf,
                                posterior_log_free* freef,
                                error **err) {
  distribution *dist;
  
  dist = init_distribution(ndim,data,log_pdf,freef,NULL,err);
  forwardError(*err,__LINE__,NULL);
  
  return dist;
}                                
Exemple #15
0
bs_struct *init_bs_struct(int ndim, void* bs, compute_cl_func* bs_compute, posterior_log_free* bs_free, char **_xnames, error **err) {
  bs_struct *rbs;

  rbs = malloc_err(sizeof(bs_struct), err);
  forwardError(*err,__LINE__,NULL);

  rbs->bs = bs;
  rbs->bs_compute = bs_compute;
  rbs->bs_free = bs_free;
  rbs->ndim = ndim;
  rbs->xnames = NULL;
  if (_xnames!=NULL) {
    int i;
    rbs->xnames = malloc_err(sizeof(extraname)*ndim,err);
    forwardError(*err,__LINE__,NULL);
    for (i=0;i<ndim;i++) {
      sprintf(rbs->xnames[i],"%s",_xnames[i]);
    }
  }

  return rbs;
}
Exemple #16
0
Client::Client(QObject* parent) : QObject(parent)
{
	socket = new QTcpSocket(this);

	connect(socket, SIGNAL(readyRead()), this, SLOT(read()));
	connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(forwardError(QAbstractSocket::SocketError)));

	// cleanup on disconnect
	connect(socket, &QTcpSocket::disconnected, []() {qDebug() << "disconnected";});
	connect(socket, SIGNAL(disconnected()), socket, SLOT(deleteLater()));
	connect(socket, SIGNAL(disconnected()), this, SLOT(deleteLater()));


	socket->connectToHost(QHostAddress::LocalHost, 61377);
}
Exemple #17
0
zero_bs* init_zero_bs(int *lmax, error **err) {
  zero_bs *zbs;
  int i;
  
  zbs = malloc_err(sizeof(zero_bs), err);
  forwardError(*err,__LINE__,NULL);    
  zbs->ndim = 0;
  for (i=0; i<6; i++) {
    zbs->lmax[i] = lmax[i];
    //_DEBUGHERE_("zzz lmax %d %d",lmax[i],zbs->ndim);
    zbs->ndim += lmax[i] + 1;
  }
  //_DEBUGHERE_("zzz ndim %d",zbs->ndim);
  return zbs;
}
Exemple #18
0
cmblkl* wlik_wmap_init(char *dirname, int ttmin, int ttmax, int temin, int temax, int use_gibbs, int use_lowl_pol, error **err) {
  int bok;
  cmblkl *cing,*target;
  int mlmax;
  char pwd[5000];
  int has_cl[6],lmaxs[6];
  int *ell;
  int lmax,l,n_cl,cli;
  zero_bs* zbs;
  

  //only one wmap
  wmap_extra_only_one_(&bok);
  testErrorRet(bok!=0,-100,"wmap already initialized",*err,__LINE__,NULL);
  
  //change dir
  testErrorRetVA(getcwd(pwd,4096)==NULL,-101010,"can't get cwd name (cause = '%s')",*err,__LINE__,NULL,strerror(errno));
  testErrorRetVA(chdir(dirname)!=0,-100,"Cannot change dir to %s (cause = '%s')",*err,__LINE__,NULL,dirname,strerror(errno));

  // call wmap_init
  wmap_extra_parameter_init_(&ttmin,&ttmax,&temin,&temax,&use_gibbs,&use_lowl_pol);
  
  //change dir back
  testErrorRetVA(chdir(pwd)!=0,-100,"Cannot change dir to %s (cause = '%s')",*err,__LINE__,NULL,pwd,strerror(errno));
  
  lmax = ttmax;
  if (temax>ttmax) {
    lmax = temax;
  }
  has_cl[0]=0;
  has_cl[1]=0;
  has_cl[2]=0;
  has_cl[3]=0;
  has_cl[4]=0;
  has_cl[5]=0;
  lmaxs[0]=-1;
  lmaxs[1]=-1;
  lmaxs[2]=-1;
  lmaxs[3]=-1;
  lmaxs[4]=-1;
  lmaxs[5]=-1;

  if (ttmin<=ttmax && ttmax>0) {
    has_cl[0]=1;
  }
  if (temin<=temax && temax>0) {
    has_cl[1]=1;
    has_cl[2]=1;
    has_cl[3]=1;
  }

  ell = malloc_err(sizeof(double)*(lmax+1),err);
  forwardError(*err,__LINE__,NULL);

  for(l=0;l<=lmax;l++) {
    ell[l] = l;
  }
  cing = init_cmblkl(NULL, &wmap_lkl, 
                     &free_wmap,
                     lmax+1,ell,
                     has_cl,lmax,1,NULL,0,NULL,0,0,err);
  forwardError(*err,__LINE__,NULL);
  
  n_cl = 0;
  for(cli=0;cli<6;cli++) {
    n_cl += (lmax+1)*has_cl[cli];
  }
  
  cmblkl_max_lmax(cing,lmaxs,err);
  forwardError(*err,__LINE__,NULL);
    
  zbs = init_zero_bs(lmaxs, err);
  forwardError(*err,__LINE__,NULL);
  target = init_multilklbs_distribution(n_cl , &cing,1,
                                        zbs, &zero_bs_compute, &free_zero_bs, lmaxs, err);
  forwardError(*err,__LINE__,NULL);

  free(ell);
  
  return target;
}
Exemple #19
0
StateWidget::StateWidget(QWidget *parent, Model * newmod )
: QWidget(parent)
{
    mod = newmod;
this->setMaximumWidth(230);
    //creating Base of the widget (background)
    QHBoxLayout *bottomLayout = new QHBoxLayout;
    mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    OKButton = new QPushButton(tr("&Apply"));
    OKButton->setChecked(false);
    connect(OKButton, SIGNAL(clicked()), this, SLOT(AcceptState()));
    OKButton->setDisabled(true);
    bottomLayout->addWidget(OKButton);

    /*InsertButton = new QPushButton(tr("&Insert"));
    InsertButton->setChecked(false);
    connect(InsertButton, SIGNAL(clicked()), this, SLOT(InsertState()));
    InsertButton->setDisabled(true);
    bottomLayout->addWidget(InsertButton);*/

    StateLayout = new QVBoxLayout;

    QLabel * nameLabel = new QLabel(tr("State Name:"));
    stateNameEdit = new QLineEdit;
    connect(stateNameEdit, SIGNAL(textChanged(QString)), this, SLOT(lengthChanged(QString)));
   StateLayout->addWidget(nameLabel);
   nameLabel->setBuddy(stateNameEdit);
   StateLayout->addWidget(stateNameEdit);

    stateTypeCombo = new QComboBox(this);
    stateTypeCombo->addItems(getStateTypeTable());
    connect(stateTypeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setStateSubclass(int)));
   StateLayout->addWidget(stateTypeCombo);
   QLabel * paramLabel = new QLabel("Parameters:");
   paramEdit = new QLineEdit;
   StateLayout->addWidget(paramLabel);
   StateLayout->addWidget(paramEdit);

   mainLayout->addLayout(StateLayout);
   mainLayout->addStretch();

   sysIniWidget* sysIni = new sysIniWidget(this, mod  );
   mainLayout->addWidget(sysIni);
   tmpWidget = 0;
   StateWidgets[0]=sysIni;
   connect(sysIni, SIGNAL(reportError(QString)), this, SLOT(forwardError(QString)));

   runGenWidget* runGen = new runGenWidget(this,  mod  );
   mainLayout->addWidget(runGen);
   runGen->setVisible(false);
   StateWidgets[1]=runGen;
   connect(runGen, SIGNAL(reportError(QString)), this, SLOT(forwardError(QString)));

   emptyGenForSetWidget* emptyForSet = new emptyGenForSetWidget(this,  mod  );
   mainLayout->addWidget(emptyForSet);
   emptyForSet->setVisible(false);
   StateWidgets[2]=emptyForSet;
   connect(emptyForSet, SIGNAL(reportError(QString)), this, SLOT(forwardError(QString)));

   emptyGenWidget* emptyGen = new emptyGenWidget(this,  mod  );
   mainLayout->addWidget(emptyGen);
   emptyGen->setVisible(false);
   StateWidgets[3]=emptyGen;

   waitStateWidget* waitGen = new waitStateWidget(this,  mod  );
   mainLayout->addWidget(waitGen);
   waitGen->setVisible(false);
   StateWidgets[4]=waitGen;

   stopGenWidget* stopGen = new stopGenWidget(this,  mod  );
   mainLayout->addWidget(stopGen);
   stopGen->setVisible(false);
   StateWidgets[5]=stopGen;
   connect(stopGen, SIGNAL(reportError(QString)), this, SLOT(forwardError(QString)));

   iniSensorWidget* initSensor = new iniSensorWidget(this,  mod  );
   mainLayout->addWidget(initSensor);
   initSensor->setVisible(false);
   StateWidgets[6]=initSensor;

   getSensorWidget* getSensorReading = new getSensorWidget(this,  mod  );
   mainLayout->addWidget(getSensorReading);
   getSensorReading->setVisible(false);
   StateWidgets[7]=getSensorReading;

   if(tmpWidget==SYSTEM_INITIALIZATION)
   {
       stateNameEdit->setText("INIT");
       stateNameEdit->setDisabled(true);
   }

   mainLayout->addLayout(bottomLayout);
}
Exemple #20
0
Process::Process(QObject *parent)
    : QProcess(parent)
{
    connect(this, SIGNAL(error(QProcess::ProcessError)), SLOT(forwardError(QProcess::ProcessError)));
    connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(forwardFinished(int, QProcess::ExitStatus)));
}
Exemple #21
0
lklbs* init_fulllklbs(cmblkl** lkls,int nlkl, 
                                           bs_struct* rbs, 
                                           int *lmax, error **err) {
  lklbs* self;
  int cli,ilkl;
  int lndim;
  int ofx;
  int nrx,irx;
  
  self = malloc_err(sizeof(lklbs),err);
  forwardError(*err,__LINE__,NULL);
    
  self->rbs = rbs;
  self->ndim = rbs->ndim;

  self->lkls = malloc_err(sizeof(cmblkl*)*nlkl,err);
  forwardError(*err,__LINE__,NULL);
  
  self->ofx = malloc_err(sizeof(int)*nlkl,err);
  forwardError(*err,__LINE__,NULL);
  
  memcpy(self->lkls,lkls,sizeof(cmblkl*)*nlkl);
  self->nlkl = nlkl;
  
  lndim = 0;
  ofx = 0;
  self->xdim=0;
  nrx = 0;
  for(ilkl=0;ilkl<self->nlkl;ilkl++) {
    nrx += lkls[ilkl]->xdim;
  }
  
  if (nrx!=0) {
    self->rx = malloc_err(sizeof(int)*nrx,err);
    forwardError(*err,__LINE__,NULL);    
  } 
  self->nrx = nrx;
  
  irx = 0;
  
  for(ilkl=0;ilkl<self->nlkl;ilkl++) {
    int nd;
    int xi;
    int ipos;
      
    cmblkl_check_lmax(self->lkls[ilkl],lmax,err);
    forwardError(*err,__LINE__,NULL);
    cmblkl_check_xnames(self->lkls[ilkl],ilkl,err);
    forwardError(*err,__LINE__,NULL);
    for (xi=0;xi<lkls[ilkl]->xdim;xi++) {
      ipos = lklbs_get_par_id(self,lkls[ilkl]->xnames[xi],err);
      forwardError(*err,__LINE__,NULL);
      self->rx[irx+xi] = ipos;
    }
    self->ofx[ilkl] = irx;
    irx += lkls[ilkl]->xdim;
    nd = lkls[ilkl]->ndim + lkls[ilkl]->xdim;
    if(lndim<nd) {
      lndim=nd;
    }
    self->ofx[ilkl] = ofx;
    ofx += lkls[ilkl]->xdim;
  }    
  
  self->tot_cl = 0;
  for(cli=0;cli<6;cli++) {
    if (lmax[cli]!=-1) {
      self->offset_lmax[cli] = self->tot_cl;
      self->tot_cl += lmax[cli] + 1;
    } else {
      self->offset_lmax[cli] = -1;
    }
  }
  
  self->cl_theo=malloc_err(sizeof(double)*(lndim+self->tot_cl),err);
  forwardError(*err,__LINE__,NULL);
  self->cl_select=self->cl_theo + self->tot_cl;
  
  
  return self; 
  
}