void RectifyParametersControlWidget::loadParamWidget(WidgetLoader &loader)
{
    RectifyParameters *params = createParameters();
    loader.loadParameters(*params, rootPath);
    setParameters(*params);
    delete params;
}
示例#2
0
CKinFunction::CKinFunction(const CFunction & src,
                           CReadConfig * configBuffer,
                           const CCopasiContainer * pParent):
    CFunction(src, pParent)
{
  CONSTRUCTOR_TRACE;

  if (configBuffer)
    {
      C_INT32 i, Size;
      configBuffer->getVariable("Nodes", "C_INT32", &Size);
      mNodes.resize(Size);

      for (i = 0; i < Size; i++)
        {
          mNodes[i] = new CNodeK;
          mNodes[i]->load(*configBuffer);
        }

      createParameters();

      cleanupNodes();
    }

  //  compile();
}
示例#3
0
TRandomic *createBinomialRandomic(char *entry){
	static unsigned short seed[]={24,89,9};

    TRandomic *p = createRandomic();
    TDataRandomic *data = (TDataRandomic *) malloc(sizeof(TDataRandomic));
    TDataBinomialRandomic *pars = (TDataBinomialRandomic *)malloc(sizeof(TDataBinomialRandomic));

    TParameters *lp = createParameters(entry, PARAMETERS_SEPARATOR);

    setSeedRandomic(seed);

    lp->iterator(lp);

    pars->trials = atoi(lp->next(lp));;
    pars->sucess = atof(lp->next(lp));;

    data->seed[0] = seed[0];
    data->seed[1] = seed[1];
    data->seed[2] = seed[2];


    data->pars = pars;

    p->data = data;
    p->pick = pickBinomialRandomic;
    p->last = getLastPickedBinomialRandomic;

    lp->dispose(lp);

    return p;
}
void OpenCVFilterParametersControlWidget::loadParamWidget(WidgetLoader &loader)
{
    OpenCVFilterParameters *params = createParameters();
    loader.loadParameters(*params, rootPath);
    setParameters(*params);
    delete params;
}
示例#5
0
TRandomic *createParetoRandomic(char *entry){
	static unsigned short seed[] = {10,11,12};

    TRandomic *p = createRandomic();
    TDataRandomic *data = (TDataRandomic *) malloc(sizeof(TDataRandomic));
    TDataParetoRandomic *pars = (TDataParetoRandomic *) malloc(sizeof(TDataParetoRandomic));

    // extract parameters from user's entry limited by semi-color
    TParameters *lp = createParameters(entry, PARAMETERS_SEPARATOR);

    lp->iterator(lp);


    // walk through the parameters as setting up
    pars->alpha = atof(lp->next(lp));
    pars->beta = atof(lp->next(lp));

	setSeedRandomic(seed);

    data->seed[0] = seed[0];
    data->seed[1] = seed[1];
    data->seed[2] = seed[2];

    data->pars = pars;

    p->data = data;
    p->pick = pickParetoRandomic;
    p->last = getLastPickedParetoRandomic;


    lp->dispose(lp);

    return p;
}
示例#6
0
TRandomic *createFromFileRandomic(char *entry){
	char *fileName;

    TRandomic *p = createRandomic();
    TDataRandomic *data = (TDataRandomic *) malloc(sizeof(TDataRandomic));
	TDataFromFileRandomic *pars = (TDataFromFileRandomic*)malloc(sizeof(TDataFromFileRandomic));

    TParameters *lp = createParameters(entry,PARAMETERS_SEPARATOR);
    lp->iterator(lp);

    fileName = lp->next(lp);

    pars->source = malloc(strlen(fileName)+1);
    strcpy(pars->source,fileName);

    pars->fp = fopen(fileName, "r");
    if (pars->fp == NULL){
    	printf("PANIC: ERROR FILE NOT FOUND\n");
    	exit(0);
    }

    data->pars = pars;

    p->data = data;
    p->pick = pickFromFileRandomic;
    p->last = getLastPickedFromFileRandomic;
    p->dispose = disposeFromFileRandomic;

    lp->dispose(lp);

    return p;
}
示例#7
0
TRandomic *createLognormalRandomic(char *entry){
	static unsigned short seed[]={129, 15, 18};

    TRandomic *p = createRandomic();
    TDataRandomic *data = (TDataRandomic *) malloc(sizeof(TDataRandomic));
    TDataLogNormalRandomic *pars = (TDataLogNormalRandomic *)malloc(sizeof(TDataLogNormalRandomic));

    TParameters *lp = createParameters(entry,PARAMETERS_SEPARATOR);
    lp->iterator(lp);

//    , double mu, double sigma, unsigned int rank

    pars->mu = (double)atof(lp->next(lp));
    pars->sigma = (double)atof(lp->next(lp));;
    pars->rank = (unsigned int)atol(lp->next(lp));;

    setSeedRandomic(seed);

    data->seed[0] = seed[0];
    data->seed[1] = seed[1];
    data->seed[2] = seed[2];

    data->pars = pars;

    p->data = data;
    p->pick = pickLognormalRandomic;
    p->last = getLastPickedLognormalRandomic;

    lp->dispose(lp);

    return p;
}
示例#8
0
TRandomic *createPoissonRandomic(char *entry){
	static unsigned short seed[]={1,12,45};

    TRandomic *p = createRandomic();
    TDataRandomic *data = (TDataRandomic *) malloc(sizeof(TDataRandomic));

    TDataPoissonRandomic *pars = (TDataPoissonRandomic *)malloc(sizeof(TDataPoissonRandomic));

    TParameters *lp = createParameters(entry, PARAMETERS_SEPARATOR);

    setSeedRandomic(seed);

    lp->iterator(lp);

    pars->mean = atof(lp->next(lp));


    data->seed[0] = seed[0];
    data->seed[1] = seed[1];
    data->seed[2] = seed[2];


    data->pars = pars;

    p->data = data;
    p->pick = pickPoissonRandomic;
    p->last = getLastPickedPoissonRandomic;

    lp->dispose(lp);

    return p;
}
void PresentationParametersControlWidget::loadParamWidget(WidgetLoader &loader)
{
    PresentationParameters *params = createParameters();
    loader.loadParameters(*params, rootPath);
    setParameters(*params);
    delete params;
}
示例#10
0
TRandomic *createTruncatedGeometricRandomic(char *entry){
	static unsigned short seed[]={10,12,14};

	TRandomic *p = createRandomic();
	TDataRandomic *data = data = (TDataRandomic *) malloc(sizeof(TDataRandomic));
    TDataTruncatedGeometricRandomic *pars = (TDataTruncatedGeometricRandomic *)malloc(sizeof(TDataTruncatedGeometricRandomic));

//    setSeedRandomic(seed);

    TParameters *lp = createParameters(entry, PARAMETERS_SEPARATOR);

    lp->iterator(lp);

    pars->alpha = atof(lp->next(lp));

    
	setSeedRandomic(seed);

    data->seed[0] = seed[0];
    data->seed[1] = seed[1];
    data->seed[2] = seed[2];

    data->pars = pars;
    
    p->data = data;
    p->pick = pickTruncatedGeometricRandomic;
    p->last = getLastPickedTruncatedGeometric;
    p->reset = resetTruncatedGeometricRandomic;

    lp->dispose(lp);

    return p;
}
示例#11
0
 //-----------------------------------------------------------------------------
 GpuProgramParametersSharedPtr GpuProgram::getDefaultParameters(void)
 {
     if (mDefaultParams.isNull())
     {
         mDefaultParams = createParameters();
     }
     return mDefaultParams;
 }
示例#12
0
CopterWidget::~CopterWidget()
{
    Copter *params = createParameters();
    SettingsSetter visitor("cvs.conf");
    params->accept<SettingsSetter>(visitor);
    setParameters(*params);
    delete params;

    delete mUi;
}
示例#13
0
void resetTruncatedGeometricRandomic(TRandomic *randomic, char *entry){
    TDataRandomic *p = (TDataRandomic *)randomic->data;
    TDataTruncatedGeometricRandomic *pars = (TDataTruncatedGeometricRandomic *)p->pars;

    TParameters *lp = createParameters(entry, PARAMETERS_SEPARATOR);

    lp->iterator(lp);

    pars->B = atoi(lp->next(lp));

    lp->dispose(lp);
}
示例#14
0
void resetExponentialRandomic(TRandomic *randomic, char *entry){
    TDataRandomic *p = (TDataRandomic *)randomic->data;
    TDataExponentialRandomic *pars = (TDataExponentialRandomic *)p->pars;

    TParameters *lp = createParameters(entry, PARAMETERS_SEPARATOR);

    lp->iterator(lp);

    pars->mean = atof(lp->next(lp));

    lp->dispose(lp);
}
示例#15
0
GrEdge::GrEdge(int id, const QString sourceId, const QString targetId, bool directed, const QString params)
{
	_id			= id;
	_directed	= directed;
	_sourceId	= sourceId;
	_targetId	= targetId;

	createParameters( params );
	setColor();

	// control output
	//toString();
}
示例#16
0
CopterWidget::CopterWidget(QWidget *parent)
    : QWidget(parent)
    , mUi(new Ui::CopterWidget)
{
    mUi->setupUi(this);

    Copter *params = createParameters();
    SettingsGetter visitor("cvs.conf");
    params->accept<SettingsGetter>(visitor);
    setParameters(*params);
    delete params;

    QObject::connect(mUi->pathEdit, SIGNAL(textEdited(QString)), this, SIGNAL(paramsChanged()));
    QObject::connect(mUi->fileTemplateEdit, SIGNAL(textEdited(QString)), this, SIGNAL(paramsChanged()));
}
示例#17
0
void resetUniformRandomic( TRandomic *randomic, char *entry ){
    TDataRandomic *data = (TDataRandomic *)randomic->data;
    TDataUniformRandomic *pars = (TDataUniformRandomic*)data->pars;

    TParameters *lp = createParameters(entry, PARAMETERS_SEPARATOR);

    lp->iterator(lp);

    pars->range = atof(lp->next(lp));

    data->pars = pars;

    lp->dispose(lp);

}
示例#18
0
    //-----------------------------------------------------------------------------
    void GpuProgram::loadImpl(void)
    {
        if (mLoadFromFile)
        {
            // find & load source code
            DataStreamPtr stream = 
                ResourceGroupManager::getSingleton().openResource(
                    mFilename, mGroup, true, this);
            mSource = stream->getAsString();
        }

        // Call polymorphic load
        try 
        {
            loadFromSource();

            if (!mDefaultParams.isNull())
            {
                // Keep a reference to old ones to copy
                GpuProgramParametersSharedPtr savedParams = mDefaultParams;
                // reset params to stop them being referenced in the next create
                mDefaultParams.setNull();

                // Create new params
                mDefaultParams = createParameters();

                // Copy old (matching) values across
                // Don't use copyConstantsFrom since program may be different
                mDefaultParams->copyMatchingNamedConstantsFrom(*savedParams.get());

            }
        }
        catch (const Exception&)
        {
            StringStream ss;
            ss << "Gpu program " << mName << " encountered an error "
                << "during loading and is thus not supported.";
            
            mCompileErrorMessage = ss.str();
            // will already have been logged
            LogManager::getSingleton().stream() << mCompileErrorMessage;

            mCompileError = true;
        }

    }
示例#19
0
TRandomic *createZipfRandomic(char *entry){
	static unsigned short seed[]={98,76,54};
	double alpha;
	unsigned int range;

	double c = 0;          // Normalization constant
	unsigned int i;

	TRandomic *p = createRandomic();
    TDataRandomic *data = (TDataRandomic *) malloc(sizeof(TDataRandomic));
	TDataZipfRandomic *pars = (TDataZipfRandomic *)malloc(sizeof(TDataZipfRandomic));

    TParameters *lp = createParameters(entry,PARAMETERS_SEPARATOR);
    lp->iterator(lp);

    alpha = (double)atof(lp->next(lp));
    range = (unsigned int)atoi(lp->next(lp));


    setSeedRandomic(seed);
    data->seed[0] = seed[0];
    data->seed[1] = seed[1];
    data->seed[2] = seed[2];



   for (i=1; i<=range; i++)
        c = c + (1.0 / pow((double) i, alpha));
    c = 1.0 / c;


    pars->normC = c;
    pars->alpha = alpha;
    pars->range = range;

    data->pars = pars;

    p->data = data;
    p->pick = pickZipfRandomic;
    p->last = getLastPickedZipfRandomic;

    lp->dispose(lp);

    return p;
}
示例#20
0
文件: randomic.c 项目: cavmelo/P2PSim
TRandomic *createConstantRandomic(char *entry){
    TRandomic *p = createRandomic();
    TDataRandomic *data = (TDataRandomic *) malloc(sizeof(TDataRandomic));
    TDataConstantRandomic *pars = (TDataConstantRandomic *) malloc(sizeof(TDataConstantRandomic));

    // extract parameters from user's entry limited by semi-color
    TParameters *lp = createParameters(entry, PARAMETERS_SEPARATOR);

    lp->iterator(lp);

    // walk through the parameters as setting up
    pars->mean = atoi(lp->next(lp));

    data->pars = pars;

    p->data = data;
    p->pick = pickConstantRandomic;
    p->last = getLastPickedConstant;

    return p;
}
    //---------------------------------------------------------------------------
    void HighLevelGpuProgram::loadHighLevel(void)
    {
        if (!mHighLevelLoaded)
        {
			try 
			{
				loadHighLevelImpl();
				mHighLevelLoaded = true;
				if (!mDefaultParams.isNull())
				{
					// Keep a reference to old ones to copy
					GpuProgramParametersSharedPtr savedParams = mDefaultParams;
					// reset params to stop them being referenced in the next create
					mDefaultParams.setNull();

					// Create new params
					mDefaultParams = createParameters();

					// Copy old (matching) values across
					// Don't use copyConstantsFrom since program may be different
					mDefaultParams->copyMatchingNamedConstantsFrom(*savedParams.get());

				}

			}
			catch (const Exception& e)
			{
				// will already have been logged
				LogManager::getSingleton().stream()
					<< "High-level program " << mName << " encountered an error "
					<< "during loading and is thus not supported.\n"
					<< e.getFullDescription();

				mCompileError = true;
			}
        }
    }
void RectifyParametersControlWidget::saveParamWidget(WidgetSaver  &saver)
{
    RectifyParameters *params = createParameters();
    saver.saveParameters(*params, rootPath);
    delete params;
}
void InputFilterParametersControlWidget::getParameters(InputFilterParameters& params) const
{
    params = *std::unique_ptr<InputFilterParameters>(createParameters());
}
void InputFilterParametersControlWidget::saveParamWidget(WidgetSaver  &saver)
{
    saver.saveParameters(*std::unique_ptr<InputFilterParameters>(createParameters()), rootPath);
}
void InputFilterParametersControlWidget::loadParamWidget(WidgetLoader &loader)
{
    std::unique_ptr<InputFilterParameters> params(createParameters());
    loader.loadParameters(*params, rootPath);
    setParameters(*params);
}
void OpenCVFilterParametersControlWidget::saveParamWidget(WidgetSaver  &saver)
{
    OpenCVFilterParameters *params = createParameters();
    saver.saveParameters(*params, rootPath);
    delete params;
}
void ThickeningParametersControlWidget::getParameters(ThickeningParameters& params) const
{
    params = *std::unique_ptr<ThickeningParameters>(createParameters());
}
void PresentationParametersControlWidget::saveParamWidget(WidgetSaver  &saver)
{
    PresentationParameters *params = createParameters();
    saver.saveParameters(*params, rootPath);
    delete params;
}
示例#29
0
MKIIModel::MKIIModel() : Model()
{
    createParameters();
}
void ThickeningParametersControlWidget::saveParamWidget(WidgetSaver  &saver)
{
    saver.saveParameters(*std::unique_ptr<ThickeningParameters>(createParameters()), rootPath);
}