コード例 #1
0
void rungeKutta(void)
{
    //stage 1
    clRhs();
    #pragma omp parallel for
    for (int j = 0; j < Y; j++) {
        for (int k = 0; k < KSIZE; k++) {
            for (int i = 0; i < X; i++) {
                w_n[(k*Y*X)+(j*X)+i] = w[(k*Y*X)+(j*X)+i]+dt*K[(k*Y*X)+(j*X)+i];
            }
        }
    }
    updateVariables();
    
    //stage 2
    clRhs();
    #pragma omp parallel for
    for (int j = 0; j < Y; j++) {
        for (int k = 0; k < KSIZE; k++) {
            for (int i = 0; i < X; i++) {
                w_n[(k*Y*X)+(j*X)+i] = 0.5*w[(k*Y*X)+(j*X)+i]+0.5*w_n[(k*Y*X)+(j*X)+i]+0.5*dt*K[(k*Y*X)+(j*X)+i];
                w[(k*Y*X)+(j*X)+i] = w_n[(k*Y*X)+(j*X)+i];
            }
        }
    }
    updateVariables();
    
    //apply boundary conditions
    bc();
}
コード例 #2
0
void WMLSelectElement::setSelectedIndex(int optionIndex, bool deselect)
{
    SelectElement::setSelectedIndex(m_data, this, optionIndex, deselect, false, false);

    //SAMSUNG_WML_FIX
    updateVariables();
}
コード例 #3
0
void WMLSelectElement::setSelectedIndexByUser(int optionIndex, bool deselect, bool fireOnChangeNow)
{
    SelectElement::setSelectedIndex(m_data, this, optionIndex, deselect, fireOnChangeNow, true);

    //SAMSUNG_WML_FIX
    updateVariables();
}
コード例 #4
0
bool KEnvVarProxyDlg::validate(bool erase)
{
    m_bHasValidData = false;

    if(!mDlg->cbShowValue->isChecked())
        updateVariables();

    bool notFound = getProxyEnv(mEnvVarsMap["http"]).isEmpty();
    m_bHasValidData |= !notFound;
    setHighLight(mDlg->lbHttp, notFound);
    if(notFound && erase)
        mEnvVarsMap["http"] = QString::null;

    notFound = getProxyEnv(mEnvVarsMap["https"]).isEmpty();
    m_bHasValidData |= !notFound;
    setHighLight(mDlg->lbHttps, notFound);
    if(notFound && erase)
        mEnvVarsMap["https"] = QString::null;

    notFound = getProxyEnv(mEnvVarsMap["ftp"]).isEmpty();
    m_bHasValidData |= !notFound;
    setHighLight(mDlg->lbFtp, notFound);
    if(notFound && erase)
        mEnvVarsMap["ftp"] = QString::null;

    notFound = getProxyEnv(mEnvVarsMap["noProxy"]).isEmpty();
    m_bHasValidData |= !notFound;
    setHighLight(mDlg->lbNoProxy, notFound);
    if(notFound && erase)
        mEnvVarsMap["noProxy"] = QString::null;

    return m_bHasValidData;
}
コード例 #5
0
void *ScreenLensDistortionOperation::initializeTileData(rcti *rect)
{
	void *buffer = this->m_inputProgram->initializeTileData(NULL);

	/* get distortion/dispersion values once, by reading inputs at (0,0)
	 * XXX this assumes invariable values (no image inputs),
	 * we don't have a nice generic system for that yet
	 */
	if (!m_variables_ready) {
		this->lockMutex();
		
		if (!m_distortion_const) {
			float result[4];
			getInputSocketReader(1)->readSampled(result, 0, 0, COM_PS_NEAREST);
			m_distortion = result[0];
		}
		if (!m_dispersion_const) {
			float result[4];
			getInputSocketReader(2)->readSampled(result, 0, 0, COM_PS_NEAREST);
			m_dispersion = result[0];
		}
		
		updateVariables(m_distortion, m_dispersion);
		m_variables_ready = true;
		
		this->unlockMutex();
	}
	
	return buffer;
}
コード例 #6
0
void KEnvVarProxyDlg::showValuePressed()
{
    // Only update the variables whenever
    if(mDlg->cbShowValue->isChecked())
        updateVariables();

    showValue();
}
コード例 #7
0
void WMLSelectElement::defaultEventHandler(Event* event)
{
    SelectElement::defaultEventHandler(m_data, this, event);

    // FIXME: There must be a better place to update the page variable state. Investigate.
    updateVariables();

    if (event->defaultHandled())
        return;

    WMLFormControlElement::defaultEventHandler(event);
}
コード例 #8
0
void ScreenLensDistortionOperation::initExecution()
{
	this->m_inputProgram = this->getInputSocketReader(0);
	this->initMutex();
	
	this->m_cx = 0.5f * (float)getWidth();
	this->m_cy = 0.5f * (float)getHeight();
	
	/* if both are constant, init variables once */
	if (m_distortion_const && m_dispersion_const) {
		updateVariables(m_distortion, m_dispersion);
		m_variables_ready = true;
	}
}
コード例 #9
0
void loop(){
	//This function is called once per second.  Use it to control the satellite.
	updateVariables();
	
	facePos(center); //Always face the center
	
	if((timeToFlare>2||timeToFlare==-1)&&!on){ //Turn sphere back on
	    game.turnOn();
	    on=true;
	}
	else if(timeToFlare!=-1&&timeToFlare<=2&&on){ //Auto Shutdown, doesn't let sphere be on during solar flare
	    game.turnOff();
	    on=false;
	}
	if(game.getMemoryFilled()<2&&poiZone<2&&(timeToFlare>12||timeToFlare==-1)&&time<230){ //If we have memory space and no incoming solar flare
    	switch(poiZone){
	        case 0: //Outer Ring
                calcPoiEntry(spherePoi,tP1,.4425f);//.430f
	            safeSetPosition(tP1,.2f);//.15
	            break;
    	    case 1: //Inner Ring
	            calcPoiEntry(spherePoi,tP1,.3725f);//.370f
	            safeSetPosition(tP1,.2f);//.15
	            break;
	    }
	    mathVecSubtract(tempVec,center,myState,3);
	    if(distance(myState,tP1)<.025f&&mathVecInner(tP1,tempVec,3)<.05f){ //If in range, take picture
	        game.takePic(spherePoi);
	        picTries++;
	        if(game.getMemoryFilled()>lastMem||picTries>7){ //Successfully taken picture or stuck taking pic, go to next poi
	            poiZone++;
	        }
	    }
	}else{ //Solar Flare incoming
	    if(game.getMemoryFilled()>0){ //Upload pictures in memory
	        //float memPack[] = {-.5,sphere*.6,0};
            calcPoiEntry(spherePoi,tP1,.7);
	        safeSetPosition(tP1,.15f);
	        game.uploadPic();
    	    if(distance(myState,center)>.5){
	            game.uploadPic();
	            picTries=0;
	            poiZone=0;
	        }
    	}else{ //Stop
    	    api.setVelocityTarget(center);
    	    game.takePic(spherePoi);
    	}
	}
}
コード例 #10
0
ファイル: debugwindow.cpp プロジェクト: j71200/DentistHelper
DebugWindow::DebugWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::DebugWindow)
{
    ui->setupUi(this);

    this->setWindowTitle("Debug Window");

    ui->variableTextBrowser->setFocusPolicy(Qt::NoFocus);
    ui->updateButton->setAutoDefault(true);
    ui->updateButton->setFocusPolicy(Qt::StrongFocus);



    QPixmap pp = QPixmap(APP_FOLDER_PATH + OPEN_FOLDER_ICON_SUFFIX);
    ui->label->setOriginalPixmap(pp);



    updateVariables();
}
コード例 #11
0
QgsLayoutItemPropertiesWidget::QgsLayoutItemPropertiesWidget( QWidget *parent, QgsLayoutItem *item )
  : QWidget( parent )
  , mConfigObject( new QgsLayoutConfigObject( this, item ) )
{
  setupUi( this );

  mVariableEditor->setMinimumHeight( mVariableEditor->fontMetrics().height() * 15 );

  mItemRotationSpinBox->setClearValue( 0 );
  mStrokeUnitsComboBox->linkToWidget( mStrokeWidthSpinBox );
  mStrokeUnitsComboBox->setConverter( &item->layout()->renderContext().measurementConverter() );

  mPosUnitsComboBox->linkToWidget( mXPosSpin );
  mPosUnitsComboBox->linkToWidget( mYPosSpin );
  mSizeUnitsComboBox->linkToWidget( mWidthSpin );
  mSizeUnitsComboBox->linkToWidget( mHeightSpin );

  mPosUnitsComboBox->setConverter( &item->layout()->renderContext().measurementConverter() );
  mSizeUnitsComboBox->setConverter( &item->layout()->renderContext().measurementConverter() );

  mPosLockAspectRatio->setWidthSpinBox( mXPosSpin );
  mPosLockAspectRatio->setHeightSpinBox( mYPosSpin );
  mSizeLockAspectRatio->setWidthSpinBox( mWidthSpin );
  mSizeLockAspectRatio->setHeightSpinBox( mHeightSpin );

  mItemFrameColorDDBtn->registerLinkedWidget( mFrameColorButton );
  mItemBackgroundColorDDBtn->registerLinkedWidget( mBackgroundColorButton );

  connect( mFrameColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutItemPropertiesWidget::mFrameColorButton_colorChanged );
  connect( mBackgroundColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutItemPropertiesWidget::mBackgroundColorButton_colorChanged );
  connect( mStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutItemPropertiesWidget::mStrokeWidthSpinBox_valueChanged );
  connect( mStrokeUnitsComboBox, &QgsLayoutUnitsComboBox::changed, this, &QgsLayoutItemPropertiesWidget::strokeUnitChanged );
  connect( mFrameGroupBox, &QgsCollapsibleGroupBoxBasic::toggled, this, &QgsLayoutItemPropertiesWidget::mFrameGroupBox_toggled );
  connect( mFrameJoinStyleCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutItemPropertiesWidget::mFrameJoinStyleCombo_currentIndexChanged );
  connect( mBackgroundGroupBox, &QgsCollapsibleGroupBoxBasic::toggled, this, &QgsLayoutItemPropertiesWidget::mBackgroundGroupBox_toggled );
  connect( mItemIdLineEdit, &QLineEdit::editingFinished, this, &QgsLayoutItemPropertiesWidget::mItemIdLineEdit_editingFinished );
  connect( mPageSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsLayoutItemPropertiesWidget::mPageSpinBox_valueChanged );
  connect( mXPosSpin, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutItemPropertiesWidget::mXPosSpin_valueChanged );
  connect( mYPosSpin, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutItemPropertiesWidget::mYPosSpin_valueChanged );
  connect( mPosUnitsComboBox, &QgsLayoutUnitsComboBox::changed, this, &QgsLayoutItemPropertiesWidget::positionUnitsChanged );
  connect( mWidthSpin, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutItemPropertiesWidget::mWidthSpin_valueChanged );
  connect( mHeightSpin, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutItemPropertiesWidget::mHeightSpin_valueChanged );
  connect( mSizeUnitsComboBox, &QgsLayoutUnitsComboBox::changed, this, &QgsLayoutItemPropertiesWidget::sizeUnitsChanged );
  connect( mUpperLeftRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mUpperLeftCheckBox_stateChanged );
  connect( mUpperMiddleRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mUpperMiddleCheckBox_stateChanged );
  connect( mUpperRightRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mUpperRightCheckBox_stateChanged );
  connect( mMiddleLeftRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mMiddleLeftCheckBox_stateChanged );
  connect( mMiddleRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mMiddleCheckBox_stateChanged );
  connect( mMiddleRightRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mMiddleRightCheckBox_stateChanged );
  connect( mLowerLeftRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mLowerLeftCheckBox_stateChanged );
  connect( mLowerMiddleRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mLowerMiddleCheckBox_stateChanged );
  connect( mLowerRightRadioButton, &QRadioButton::toggled, this, &QgsLayoutItemPropertiesWidget::mLowerRightCheckBox_stateChanged );
  connect( mBlendModeCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutItemPropertiesWidget::mBlendModeCombo_currentIndexChanged );
  connect( mItemRotationSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutItemPropertiesWidget::mItemRotationSpinBox_valueChanged );
  connect( mExcludeFromPrintsCheckBox, &QCheckBox::toggled, this, &QgsLayoutItemPropertiesWidget::mExcludeFromPrintsCheckBox_toggled );

  //make button exclusive
  QButtonGroup *buttonGroup = new QButtonGroup( this );
  buttonGroup->addButton( mUpperLeftRadioButton );
  buttonGroup->addButton( mUpperMiddleRadioButton );
  buttonGroup->addButton( mUpperRightRadioButton );
  buttonGroup->addButton( mMiddleLeftRadioButton );
  buttonGroup->addButton( mMiddleRadioButton );
  buttonGroup->addButton( mMiddleRightRadioButton );
  buttonGroup->addButton( mLowerLeftRadioButton );
  buttonGroup->addButton( mLowerMiddleRadioButton );
  buttonGroup->addButton( mLowerRightRadioButton );
  buttonGroup->setExclusive( true );

  initializeDataDefinedButtons();

  setItem( item );

  connect( mOpacityWidget, &QgsOpacityWidget::opacityChanged, this, &QgsLayoutItemPropertiesWidget::opacityChanged );

  updateVariables();
  connect( mVariableEditor, &QgsVariableEditorWidget::scopeChanged, this, &QgsLayoutItemPropertiesWidget::variablesChanged );
  // listen out for variable edits
  connect( QgsApplication::instance(), &QgsApplication::customVariablesChanged, this, &QgsLayoutItemPropertiesWidget::updateVariables );
  connect( item->layout()->project(), &QgsProject::customVariablesChanged, this, &QgsLayoutItemPropertiesWidget::updateVariables );

  if ( item->layout() )
    connect( item->layout(), &QgsLayout::variablesChanged, this, &QgsLayoutItemPropertiesWidget::updateVariables );
}
コード例 #12
0
UInt32 ShaderExecutableChunk::handleGL(DrawEnv                 *pEnv, 
                                       UInt32                   id, 
                                       Window::GLObjectStatusE  mode,
                                       UInt32                   uiOptions)
{
    UInt32  returnValue = 0;
    Window *pWin        = pEnv->getWindow();

    if(!pWin->hasExtension(_extSHL))
    {
        FWARNING(("OpenGL Shading Language is not supported, couldn't find "
                  "extension 'GL_ARB_shading_language_100'!\n"));

        pWin->setGLObjectId(getGLId(), 0);

        return returnValue;
    }

    if(mode == Window::initialize   || 
       mode == Window::reinitialize ||
       mode == Window::needrefresh   )
    {
        GLuint uiProgram = GLuint(pWin->getGLObjectId(getGLId()));;

        if(mode != Window::needrefresh)
        {
            if(uiProgram != 0)
            {
                OSGGETGLFUNC(OSGglDeleteProgramProc,
                             osgGlDeleteProgram,
                             ShaderProgram::getFuncIdDeleteProgram());

                osgGlDeleteProgram(uiProgram);
            }

            OSGGETGLFUNC(OSGglCreateProgramProc,
                         osgGlCreateProgram,
                         ShaderProgram::getFuncIdCreateProgram());

            OSGGETGLFUNC(OSGglAttachShaderProc,
                         osgGlAttachShader,
                         ShaderProgram::getFuncIdAttachShader());

            OSGGETGLFUNC(OSGglLinkProgramProc,
                         osgGlLinkProgram,
                         ShaderProgram::getFuncIdLinkProgram());

            uiProgram = osgGlCreateProgram();

            FragmentShaderIt fIt  = _mfFragmentShader.begin();
            FragmentShaderIt fEnd = _mfFragmentShader.end  ();
            
            for(; fIt != fEnd; ++fIt)
            {
                (*fIt)->validate(pEnv);

                GLuint uiShader = 
                    GLuint(pWin->getGLObjectId((*fIt)->getGLId()));

                if(uiShader != 0)
                    osgGlAttachShader(uiProgram, uiShader);
            }
    
            GeometryShaderIt gIt  = _mfGeometryShader.begin();
            GeometryShaderIt gEnd = _mfGeometryShader.end  ();
            
            for(; gIt != gEnd; ++gIt)
            {
                (*gIt)->validate(pEnv);

                GLuint uiShader = 
                    GLuint(pWin->getGLObjectId((*gIt)->getGLId()));

                if(uiShader != 0)
                    osgGlAttachShader(uiProgram, uiShader);
            }
        
            VertexShaderIt vIt  = _mfVertexShader.begin();
            VertexShaderIt vEnd = _mfVertexShader.end  ();
            
            for(; vIt != vEnd; ++vIt)
            {
                (*vIt)->validate(pEnv);

                GLuint uiShader = 
                    GLuint(pWin->getGLObjectId((*vIt)->getGLId()));

                if(uiShader != 0)
                    osgGlAttachShader(uiProgram, uiShader);
            }

            // attribute binding must be done before linking
            updateAttribBindings(pEnv, uiProgram);

            // parameters must be set before linking
            updateParameters(pEnv, uiProgram);
            
            osgGlLinkProgram(uiProgram);

            GLint  iInfoLength;
            Char8 *szInfoBuffer = NULL;

            OSGGETGLFUNC(OSGglGetProgramivProc,
                         osgGlGetProgramiv,
                         ShaderProgram::getFuncIdGetProgramiv());

            osgGlGetProgramiv(uiProgram, 
                              GL_OBJECT_INFO_LOG_LENGTH_ARB, 
                              &iInfoLength);

            if(iInfoLength > 0)
            {
                szInfoBuffer = new Char8[iInfoLength];
                szInfoBuffer[0] = '\0';

                OSGGETGLFUNC(OSGglGetProgramInfoLogProc,
                             osgGlGetProgramInfoLog,
                             ShaderProgram::getFuncIdGetProgramInfoLog());

                osgGlGetProgramInfoLog( uiProgram, 
                                        iInfoLength, 
                                       &iInfoLength, 
                                        szInfoBuffer);
            }

            GLint iStatus = 0;

            osgGlGetProgramiv(uiProgram, GL_LINK_STATUS, &iStatus);

            if(iStatus == 0)
            {
                if(szInfoBuffer != NULL && szInfoBuffer[0] != '\0')
                {
                    FFATAL(("Couldn't link vertex and fragment program!\n%s\n",
                            szInfoBuffer));
                }
                else
                {
                    FFATAL(("Couldn't link vertex and fragment program!\n"
                            "No further info available\n"));
                }

                OSGGETGLFUNC(OSGglDeleteProgramProc,
                             osgGlDeleteProgram,
                             ShaderProgram::getFuncIdDeleteProgram());

                osgGlDeleteProgram(uiProgram);

                uiProgram = 0;
            }
            else
            {
                if(szInfoBuffer != NULL && szInfoBuffer[0] != '\0')
                {
                    FWARNING(("SHLChunk: link status: %s\n", szInfoBuffer));
                }
            }

            pWin->setGLObjectId(getGLId(), uiProgram);

            updateVariableLocations(pEnv, uiProgram);
            
            delete [] szInfoBuffer;
        }

        if(uiProgram != 0)
        {
            OSGGETGLFUNC(OSGglUseProgramProc,
                         osgGlUseProgram,
                         ShaderProgram::getFuncIdUseProgram());

            pEnv->setActiveShader(uiProgram);
            osgGlUseProgram      (uiProgram);
        
            updateVariables(pEnv, uiProgram);
        
            if(0x0000 == (uiOptions & KeepProgActive))
            {
                pEnv->setActiveShader(0);
                osgGlUseProgram      (0);
            }
            else
            {
                returnValue |= ProgActive;
            }
        }
    }

    return returnValue;
}
コード例 #13
0
UInt32 ComputeShaderChunk::handleGL(DrawEnv                 *pEnv, 
                                    UInt32                   id, 
                                    Window::GLObjectStatusE  mode,
                                    UInt64                   uiOptions)
{
    UInt32  returnValue = 0;
    Window *pWin        = pEnv->getWindow();

    if(!pWin->hasExtOrVersion(_arbComputeShader, 0x0403, 0xFFFF))
    {
        FWARNING(("OpenGL compute shader is not supported, couldn't find "
                  "extension 'GL_ARB_compute_shader'!\n"));

        pWin->setGLObjectId(getGLId(), 0);

        return returnValue;
    }

    if(mode == Window::initialize   || 
       mode == Window::reinitialize ||
       mode == Window::needrefresh   )
    {
        GLuint uiProgram = GLuint(pWin->getGLObjectId(getGLId()));;

        if(mode != Window::needrefresh)
        {
            if(uiProgram != 0)
            {
                OSGGETGLFUNCBYID_GL3_ES(glDeleteProgram,
                                        osgGlDeleteProgram,
                                        ShaderProgram::getFuncIdDeleteProgram(),
                                        pWin);

                osgGlDeleteProgram(uiProgram);
            }

            OSGGETGLFUNCBYID_GL3_ES(glCreateProgram,
                                    osgGlCreateProgram,
                                    ShaderProgram::getFuncIdCreateProgram(),
                                    pWin);

            OSGGETGLFUNCBYID_GL3_ES(glAttachShader,
                                    osgGlAttachShader,
                                    ShaderProgram::getFuncIdAttachShader(),
                                    pWin);

            OSGGETGLFUNCBYID_GL3_ES(glLinkProgram,
                                    osgGlLinkProgram,
                                    ShaderProgram::getFuncIdLinkProgram(),
                                    pWin);

            uiProgram = osgGlCreateProgram();
        
            ComputeShaderIt vIt  = _mfComputeShader.begin();
            ComputeShaderIt vEnd = _mfComputeShader.end  ();
            
            for(; vIt != vEnd; ++vIt)
            {
                (*vIt)->validate(pEnv);

                GLuint uiShader = 
                    GLuint(pWin->getGLObjectId((*vIt)->getGLId()));

                if(uiShader != 0)
                    osgGlAttachShader(uiProgram, uiShader);
            }

            osgGlLinkProgram(uiProgram);

            GLint  iInfoLength;
            Char8 *szInfoBuffer = NULL;

            OSGGETGLFUNCBYID_GL3_ES(glGetProgramiv,
                                    osgGlGetProgramiv,
                                    ShaderProgram::getFuncIdGetProgramiv(),
                                    pWin);

            osgGlGetProgramiv(uiProgram, 
                              GL_OBJECT_INFO_LOG_LENGTH_ARB, 
                              &iInfoLength);

            if(iInfoLength > 0)
            {
                szInfoBuffer = new Char8[iInfoLength];
                szInfoBuffer[0] = '\0';

                OSGGETGLFUNCBYID_GL3_ES(
                    glGetProgramInfoLog,
                    osgGlGetProgramInfoLog,
                    ShaderProgram::getFuncIdGetProgramInfoLog(),
                    pWin);

                osgGlGetProgramInfoLog( uiProgram, 
                                        iInfoLength, 
                                       &iInfoLength, 
                                        szInfoBuffer);
            }

            GLint iStatus = 0;

            osgGlGetProgramiv(uiProgram, GL_LINK_STATUS, &iStatus);

            if(iStatus == 0)
            {
                if(szInfoBuffer != NULL && szInfoBuffer[0] != '\0')
                {
                    FFATAL(("Couldn't link compute program!\n%s\n",
                            szInfoBuffer));
                }
                else
                {
                    FFATAL(("Couldn't link compute program!\n"
                            "No further info available\n"));
                }

                OSGGETGLFUNCBYID_GL3_ES(glDeleteProgram,
                                        osgGlDeleteProgram,
                                        ShaderProgram::getFuncIdDeleteProgram(),
                                        pWin);

                osgGlDeleteProgram(uiProgram);

                uiProgram = 0;
            }
            else
            {
                if(szInfoBuffer != NULL && szInfoBuffer[0] != '\0')
                {
                    FWARNING(("ComputeShaderChunk: link status: %s\n", 
                              szInfoBuffer));
                }
            }

            pWin->setGLObjectId(getGLId(), uiProgram);

            updateVariableLocations(pEnv, uiProgram);
        }

        if(uiProgram != 0)
        {
            OSGGETGLFUNCBYID_GL3_ES(glUseProgram,
                                    osgGlUseProgram,
                                    ShaderProgram::getFuncIdUseProgram(),
                                    pWin);
        
            osgGlUseProgram(uiProgram);
        
            updateVariables(pEnv, uiProgram);
        
            if(0x0000 == (uiOptions & KeepProgActive))
            {
                osgGlUseProgram(0);
            }
            else
            {
                returnValue |= ProgActive;
            }
        }
    }

    return returnValue;
}
コード例 #14
0
ファイル: monitor.cpp プロジェクト: arturo393/IRMA
int MonitorProcessor::step() {
    cda.lockArea(EXECUTIVE_AREA);
    execute_ready_flag = pCDAExecutive->exec_ready_flag;
    cda.unlockArea(EXECUTIVE_AREA);

    if ((num_steps < max_steps_nr) && (!mission_accomplished_flag) && (execute_ready_flag)) {
        updateVariables();
        setNavigationMode2();
        updateExecutiveData();

        cda.lockArea(LONG_NAV_AREA);
        mission_accomplished_flag = pCDALongNav->lrn_mission_accomplished;
        cda.unlockArea(LONG_NAV_AREA);

        if (mission_accomplished_flag) {
            fprintf(stdout, "\n********************************************************\n");
            fprintf(stdout, "MONITOR: EXPERIMENT WAS COMPLETED - LONG RANGE NAVIGATOR\n");
            fprintf(stdout, "MONITOR: PLEASE RESTART PROCESSES\n");
            fprintf(stdout, "********************************************************\n\n");
        }
    } else if (num_steps >= max_steps_nr) {
        cda.lockArea(CLOSE_NAV_AREA);
        pCDACloseNav->ctrl.loop = stop_cmd;
        cda.unlockArea(CLOSE_NAV_AREA);

        cda.lockArea(LONG_NAV_AREA);
        pCDALongNav->ctrl.loop = stop_cmd;
        cda.unlockArea(LONG_NAV_AREA);

        cda.lockArea(FEATURE_NAV_AREA);
        pCDAFeatureNav->ctrl.loop = stop_cmd;
        cda.unlockArea(FEATURE_NAV_AREA);

        fprintf(stdout, "\n**********************************************************************\n");
        fprintf(stdout, "MONITOR: EXPERIMENT WAS COMPLETED - MAX NUMBER OF STEPS REACHED\n");
        fprintf(stdout, "MONITOR: PLEASE RESTART PROCESSES\n");
        fprintf(stdout, "**********************************************************************\n\n");
    }
    // Go to sleep so we dont eat all the CPU
    usleep(sleep_time);

    // TODO
    //   // Whenever the experiment is over, the map must be sent
    //   // to the main computer
    //   if( num_executed_steps >= MAX_STEPS && MAX_STEPS != -1)
    //   {
    //      free_steps = false;
    //      fprintf(stdout, "Maximum number of steps (%d) reached\n", num_executed_steps);
    //
    //      fprintf(stdout, "Requesting to send map to main computer...\n");
    //
    //      cda.lockArea(CLOSE_NAV_AREA);
    //         pCloseNav->ctrl.loop = stop_cmd;
    //      cda.unlockArea(CLOSE_NAV_AREA);
    //
    //      cda.lockArea(NETWORK_AREA);
    //         pNetwork->send_map_flag = true;
    //      cda.unlockArea(NETWORK_AREA);
    //
    //      // Modificaciones para el LRN
    //      cda.lockArea(LONG_NAV_AREA);
    //         pLongNav->lg_move_ready_flag = false;
    //         pLongNav->lg_route_obsolete_flag = true;
    //      cda.unlockArea(LONG_NAV_AREA);
    //      num_executed_steps = 0;
    //      // Modificaciones para el LRN
    //   }


    return (0);
}
コード例 #15
0
ファイル: debugwindow.cpp プロジェクト: j71200/DentistHelper
void DebugWindow::on_updateButton_clicked(){
	updateVariables();
}
コード例 #16
0
ファイル: gurobi.cpp プロジェクト: schwabe/zeugs
void gurobi_solver::writeModel(const std::string filename) 
{
	updateVariables();
	model.write(filename);
}
コード例 #17
0
// =============================== PRIVATE ====================================
void FunctionVariablesWidget::useFunction(const FunctionPtr &f)
{
    mFunction = f;
    connect(f.data(), SIGNAL(expressionChanged()), this, SLOT(updateVariables()));
    updateVariables();
}
コード例 #18
0
/**
 * Sets the graphic and updates the GUI to match the drawing.
 */
void QG_DlgOptionsVariables::setGraphic(RS_Graphic* g) {
    graphic = g;
    updateVariables();
}
コード例 #19
0
void initialConditions(void)
{
    lambda = c/frequency_max;    //minimum wavelength to account for
    dx = lambda/ppw;             //delta x
    dy = lambda/ppw;             //delta y
    dt = cfl*(dx/c);             //delta t
    x_length = dx*X;             //length of x domain in meters
    y_length = dy*Y;             //length of y domain in meters
    
    b = (float *)malloc(Y*X*sizeof(float)); if (b == NULL) mfail("b");
    p = (float*)malloc(X*Y*sizeof(float)); if (p == NULL) mfail("p");
    T = (float*)malloc(X*Y*sizeof(float)); if (T == NULL) mfail("T");
    H0 = (float*)malloc(X*Y*sizeof(float)); if (H0 == NULL) mfail("H0");
    w = (float*)malloc(KSIZE*X*Y*sizeof(float)); if (w == NULL) mfail("w");
    w_n = (float*)malloc(KSIZE*X*Y*sizeof(float)); if (w_n == NULL) mfail("w_n");
    K = (float*)malloc(KSIZE*X*Y*sizeof(float)); if (K == NULL) mfail("K");
    
    //initialize grids to ambient conditions
    #pragma omp parallel for
    for (int j = 0; j < Y; j++) {
        for (int i = 0; i < X; i++) {
            b[(j*X)+i] = 0;
            p[(j*X)+i] = p0;
            T[(j*X)+i] = T0-(0.01*j*dy);
            H0[(j*X)+i] = 0;
        }
    }
    
    //set all vectors for equations to 0; if using calloc this can go away
    #pragma omp parallel for
    for (int j = 0; j < Y; j++) {
        for (int k = 0; k < KSIZE; k++) {
            for (int i = 0; i < X; i++) {
                w[(k*Y*X)+(j*X)+i] = w_n[(k*Y*X)+(j*X)+i] = K[(k*Y*X)+(j*X)+i] = 0;
            }
        }
    }
    
    //calculate relaxation frequencies and times
    const float zeta = 10.79586*(1-(273.16/T0))-5.02808*log10(T0/273.16)
        +(1.50474e-4)*(1-pow(10,(-8.29692*((T0/273.16)-1))))
        -(4.2873e-4)*(1-pow(10,(-4.76955*((273.16/T0)-1))))-2.2195983;
    const float p_vp = p_ref*pow(10,zeta);
    const float h = (pow(10.0,-2)*RH*p_vp*T0)/p0;
    const float eta = 4.17*(pow(T_ref/T0,1.0/3.0)-1);
    const float f_n = (p0/p_ref)*(24+(4.04e6)*h*((0.02+100*h)/(0.391+100*h)));
    const float f_o = (p0/p_ref)*(pow((T_ref/T0),0.5)*(9+2.8e4*h*exp(-eta)));
    tau_n = 1/(2*PI*f_n);
    tau_o = 1/(2*PI*f_o);
    
    //initialize w to ambient values
    for (int j = 0; j < Y; j++) {
        for (int i = 0; i < X; i++) {
            w[(0*Y*X)+(j*X)+i] = rho0;
            w[(1*Y*X)+(j*X)+i] = rho0*0;
            w[(2*Y*X)+(j*X)+i] = rho0*0;
            w[(3*Y*X)+(j*X)+i] = rho0*s0;
            //w[(4*Y*X)+(j*X)+i] = rho0*T0;
            //w[(5*Y*X)+(j*X)+i] = rho0*T0;
        }
    }
    
    //set w_n=w
    #pragma omp parallel for
    for (int j = 0; j < Y; j++) {
        for (int k = 0; k < KSIZE; k++) {
            for (int i = 0; i < X; i++) {
                w_n[(k*Y*X)+(j*X)+i] = w[(k*Y*X)+(j*X)+i];
            }
        }
    }
    
    updateVariables();
    
    setupCL("kernel.cl");
}