Beispiel #1
0
 def __getParams(self):
     """
         convert information in the panel into the right negotiator param classes
     """
     _infoer.function = str(self.__getParams)
     _infoer.write("")
     if self.__taskType==STREAMLINE:
         data = PartStreamlineVisParams()
         data.tubeWidth = getDoubleInLineEdit(self.TubeWidth)
     elif self.__taskType==MOVING_POINTS:
         data = PartMovingPointsVisParams()
         data.numSteps = getIntInLineEdit(self.NumberOfSteps)
         data.duration = getDoubleInLineEdit(self.DurationOfSteps)
         data.sphereRadius = getDoubleInLineEdit(self.RadiusOfSpheres)
     else:
         data = PartPathlinesVisParams()
         data.numSteps = getIntInLineEdit(self.NumberOfSteps)
         data.duration = getDoubleInLineEdit(self.DurationOfSteps)
         data.tubeWidth = getDoubleInLineEdit(self.TubeWidth)
         data.sphereRadius = getDoubleInLineEdit(self.RadiusOfSpheres)
     data.taskType = self.__taskType
     data.name = str(self.nameWidget.text())
     data.isVisible = self.visibilityCheckBox.isChecked()
     data.variable = str(self.vrpLineEditVariable.text())
     data.colorTableKey = self.colorCreator
     if self.vrpCheckBoxMapVariable.isChecked():
         data.secondVariable = str(self.vrpComboBoxVariable.currentText())
         if data.secondVariable!="" and data.colorTableKey!=None and data.secondVariable in data.colorTableKey and self.__baseVariable and self.__baseVariable==data.secondVariable:
             data.colorTableKey[data.secondVariable] = MainWindow.globalColorManager.getSelectedColormapKey( self.colorMapCombobox)
     else :
         if self.__baseVariable and self.__baseVariable==data.variable and data.colorTableKey:
             data.colorTableKey[data.variable] = MainWindow.globalColorManager.getSelectedColormapKey( self.colorMapCombobox)
     if self.__startStyle == PLANE:
         data.alignedRectangle = self.__rectangleManager.getParams()
     elif self.__startStyle == LINE:
         #data.line3D = self.__rectangleManager.getParams(LINE)
         data.alignedRectangle = self.__rectangleManager.getParams(LINE)
     else:
         data.alignedRectangle = self.__rectangleManager.getParams()
     data.boundingBox = self.__rectangleManager.getBoundingBox()
     try:
         data.no_startp = getIntInLineEdit(self.numberStartpoints)
     except ConversionError:
         data.no_startp = 0
     try:
         data.len = getDoubleInLineEdit(self.lengthTraces)
     except ConversionError:
         data.len = 0.0
     data.direction = self.tracingDirectionCB.currentIndex()+1
     try:
         data.eps = getDoubleInLineEdit(self.vrpLineEditRelativeErrors)
     except ConversionError:
         data.eps = 0.0
     try:
         data.abs = getDoubleInLineEdit(self.vrpLineEditAbsoluteErrors)
     except ConversionError:
         data.abs = 0.0
     try:
         data.grid_tol = getDoubleInLineEdit(self.vrpLineEditGridTolerance)
     except ConversionError:
         data.grid_tol = 0.0
     try:
         data.maxOutOfDomain = getDoubleInLineEdit(self.vrpLineEditMinimumValue_2)
     except ConversionError:
         data.maxOutOfDomain = 0.0
     try:
         data.min_vel = getDoubleInLineEdit(self.vrpLineEditMinimumValue)
     except ConversionError:
         data.min_vel = 0.0
     data.showSmoke= self.vrpCheckBoxShow.isChecked()
     data.showInteractor = self.checkBox5.isChecked()
     if self.checkBoxDomainFromList.isChecked():
         if self.comboBoxDomain.currentIndex()>0 :
             data.use2DPartKey=self.__UsePartIdx2key[self.comboBoxDomain.currentIndex()]
         else :
             data.use2DPartKey=-1
     if self.checkBoxFreeStartpoints.isChecked():
         data.start_style = 3
     else:
         data.start_style = self.__startStyle
             
     return data
Beispiel #2
0
def testRequest():
    """Example for requesting something at the theGuiMsgHandler()."""
    keepReference = QApplication(sys.argv)

    initHandlers()

    g = theGuiMsgHandler()

    g.registerAddCallback(SESSION_KEY, createProjectPanel)
    reqId = g.requestObject(TYPE_PROJECT)
    g.waitforAnswer(reqId)

    reqId = g.requestObject(TYPE_CASE, None, project_key)
    g.waitforAnswer(reqId)

    caseP = coCaseMgrParams()
    nameAndCase = NameAndCoviseCase()
    nameAndCase.setFromFile('/work/common/Projekte/DC-CFDGui/datasets/'
                            'TINY/CoviseDaten/TINY.cocase')
    #nameAndCase.setFromFile(
    #        '/work/common/Projekte/DC-CFDGui/datasets/'
    #        'msport/CoviseDaten/msport.cocase')

    caseP.origDsc = caseP.filteredDsc = coviseCase2DimensionSeperatedCase(nameAndCase.case, nameAndCase.name, nameAndCase.pathToCaseFile)
    g.setParams(case_key1, caseP)

    # testing static coloring
    if testMode==VIS_2D_STATIC_COLOR:
        colP = Part2DStaticColorVisParams()
        colP.g = 0
        g.setParams( VisColor_key, colP )

        status()

        reqId = g.runObject( case_key1 )
        g.waitforAnswer(reqId)

        colP.r = 255
        colP.g = 0
        colP.b = 0
        g.setParams( VisColor_key, colP )
        g.runObject( case_key1 )


    #testing scalar coloring
    elif testMode==VIS_2D_SCALAR_COLOR:
        colP = Part2DScalarColorVisParams()
        colP.variable = scalar_variable
        g.setParams( VisColor_key, colP )
        g.runObject( case_key1 )

    elif testMode==VIS_STREAMLINE:
        streamP = PartStreamlineVisParams()
        streamP.variable = vector_variable
        """
        colorP = coColorCreator()
        ctableP = coColorTableParams()
        ctableP.min = 98
        ctableP.max = 100
        ctableP.colorMapIdx = 2

        ctable = coColorTable()
        ctable.params = ctableP
        colorP.params.colorTable = ctable
        streamP.colorCreator = colorP
        colorP.run(RUN_ALL)
        """
        g.setParams( Tracer_key, streamP )
        r = g.runObject( case_key1, RUN_OCT )
        g.waitforAnswer(r)
        g.runObject( Tracer_key )

        #g.saveObject(0, "/work/sk_te/test.coprj")
        theNet().save("/work/ko_te/testgui.net")
    
    elif testMode==VIS_STREAMLINE_2D:
        streamP = PartStreamline2DVisParams()
        streamP.variable = vector_variable
        streamP.alignedRectangle = Line3D()
        streamP.alignedRectangle.setStartEndPoint(0.1, -0.6, 0., 0.5, -0.8, 0. )
        
        g.setParams( Tracer_key, streamP )
        r = g.runObject( case_key1, RUN_OCT )
        g.waitforAnswer(r)
        g.runObject( Tracer_key )
        theNet().save("/work/sk_te/test.net")
        status()
        
    elif testMode==VIS_PLANE:
        planeP = PartPlaneVisParams()
        planeP.variable = vector_variable
        planeP.alignedRectangle.middle = (0, 0, 1)
        """
        colorP = coColorCreator()
        ctableP = coColorTableParams()
        ctableP.min = 98
        ctableP.max = 100
        ctableP.colorMapIdx = 2

        ctable = coColorTable()
        ctable.params = ctableP
        colorP.params.colorTable = ctable
        streamP.colorCreator = colorP
        colorP.run(RUN_ALL)
        """
        g.setParams( Tracer_key, planeP )
        r = g.runObject( case_key1, RUN_OCT )
        g.waitforAnswer(r)
        g.runObject( Tracer_key )

        #g.saveObject(0, "/work/ko_te/test.coprj")
        theNet().save("/work/ko_te/testgui.net")

    elif testMode==VIS_VECTOR:
        vectorP = PartVectorVisParams()
        vectorP.variable = vector_variable
        """
        colorP = coColorCreator()
        ctableP = coColorTableParams()
        ctableP.min = 98
        ctableP.max = 100
        ctableP.colorMapIdx = 2

        ctable = coColorTable()
        ctable.params = ctableP
        colorP.params.colorTable = ctable
        streamP.colorCreator = colorP
        colorP.run(RUN_ALL)
        """
        g.setParams( Tracer_key, vectorP )
        r = g.runObject( case_key1, RUN_OCT )
        g.waitforAnswer(r)
        g.runObject( Tracer_key )

        #g.saveObject(0, "/work/ko_te/test.coprj")
        theNet().save("/work/ko_te/testgui.net")

    elif testMode==VIS_ISOPLANE:
        isoplaneP = PartIsoSurfaceVisParams()
        isoplaneP.variable = vector_variable
        """
        colorP = coColorCreator()
        ctableP = coColorTableParams()
        ctableP.min = 98
        ctableP.max = 100
        ctableP.colorMapIdx = 2

        ctable = coColorTable()
        ctable.params = ctableP
        colorP.params.colorTable = ctable
        streamP.colorCreator = colorP
        colorP.run(RUN_ALL)
        """
        g.setParams( Tracer_key, isoplaneP )
        r = g.runObject( case_key1, RUN_OCT )
        g.waitforAnswer(r)
        g.runObject( Tracer_key )

        #g.saveObject(0, "/work/ko_te/test.coprj")
        theNet().save("/work/ko_te/testgui.net")

    else :
        status()
        g.runObject( case_key1 )
        vP = VisItemParams()
        vP.isVisible=True
        g.setParams( VisColor_key, vP )
        theNet().save("/work/sk_te/testgui.net")

    if False: # True:
        reqId = g.requestObject(TYPE_CASE, None, project_key)
        g.waitforAnswer(reqId)
        caseP = coCaseMgrParams()
        caseP.filename = (
            '/work/common/Projekte/DC-CFDGui/datasets/'
            'msport/CoviseDaten/msport.cocase')
        g.setParams(case_key1, caseP)
Beispiel #3
0
def testRequest():
    """Example for requesting something at the theGuiMsgHandler()."""
    keepReference = QApplication(sys.argv)

    initHandlers()

    g = theGuiMsgHandler()

    g.registerAddCallback(SESSION_KEY, createProjectPanel)
    reqId = g.requestObject(TYPE_PROJECT)
    g.waitforAnswer(reqId)

    reqId = g.requestObject(TYPE_CASE, None, project_key)
    g.waitforAnswer(reqId)

    caseP = coCaseMgrParams()
    nameAndCase = NameAndCoviseCase()
    nameAndCase.setFromFile('/work/common/Projekte/DC-CFDGui/datasets/'
                            'TINY/CoviseDaten/TINY.cocase')
    #nameAndCase.setFromFile(
    #        '/work/common/Projekte/DC-CFDGui/datasets/'
    #        'msport/CoviseDaten/msport.cocase')

    caseP.origDsc = caseP.filteredDsc = coviseCase2DimensionSeperatedCase(
        nameAndCase.case, nameAndCase.name, nameAndCase.pathToCaseFile)
    g.setParams(case_key1, caseP)

    # testing static coloring
    if testMode == VIS_2D_STATIC_COLOR:
        colP = Part2DStaticColorVisParams()
        colP.g = 0
        g.setParams(VisColor_key, colP)

        status()

        reqId = g.runObject(case_key1)
        g.waitforAnswer(reqId)

        colP.r = 255
        colP.g = 0
        colP.b = 0
        g.setParams(VisColor_key, colP)
        g.runObject(case_key1)

    #testing scalar coloring
    elif testMode == VIS_2D_SCALAR_COLOR:
        colP = Part2DScalarColorVisParams()
        colP.variable = scalar_variable
        g.setParams(VisColor_key, colP)
        g.runObject(case_key1)

    elif testMode == VIS_STREAMLINE:
        streamP = PartStreamlineVisParams()
        streamP.variable = vector_variable
        """
        colorP = coColorCreator()
        ctableP = coColorTableParams()
        ctableP.min = 98
        ctableP.max = 100
        ctableP.colorMapIdx = 2

        ctable = coColorTable()
        ctable.params = ctableP
        colorP.params.colorTable = ctable
        streamP.colorCreator = colorP
        colorP.run(RUN_ALL)
        """
        g.setParams(Tracer_key, streamP)
        r = g.runObject(case_key1, RUN_OCT)
        g.waitforAnswer(r)
        g.runObject(Tracer_key)

        #g.saveObject(0, "/work/sk_te/test.coprj")
        theNet().save("/work/ko_te/testgui.net")

    elif testMode == VIS_STREAMLINE_2D:
        streamP = PartStreamline2DVisParams()
        streamP.variable = vector_variable
        streamP.alignedRectangle = Line3D()
        streamP.alignedRectangle.setStartEndPoint(0.1, -0.6, 0., 0.5, -0.8, 0.)

        g.setParams(Tracer_key, streamP)
        r = g.runObject(case_key1, RUN_OCT)
        g.waitforAnswer(r)
        g.runObject(Tracer_key)
        theNet().save("/work/sk_te/test.net")
        status()

    elif testMode == VIS_PLANE:
        planeP = PartPlaneVisParams()
        planeP.variable = vector_variable
        planeP.alignedRectangle.middle = (0, 0, 1)
        """
        colorP = coColorCreator()
        ctableP = coColorTableParams()
        ctableP.min = 98
        ctableP.max = 100
        ctableP.colorMapIdx = 2

        ctable = coColorTable()
        ctable.params = ctableP
        colorP.params.colorTable = ctable
        streamP.colorCreator = colorP
        colorP.run(RUN_ALL)
        """
        g.setParams(Tracer_key, planeP)
        r = g.runObject(case_key1, RUN_OCT)
        g.waitforAnswer(r)
        g.runObject(Tracer_key)

        #g.saveObject(0, "/work/ko_te/test.coprj")
        theNet().save("/work/ko_te/testgui.net")

    elif testMode == VIS_VECTOR:
        vectorP = PartVectorVisParams()
        vectorP.variable = vector_variable
        """
        colorP = coColorCreator()
        ctableP = coColorTableParams()
        ctableP.min = 98
        ctableP.max = 100
        ctableP.colorMapIdx = 2

        ctable = coColorTable()
        ctable.params = ctableP
        colorP.params.colorTable = ctable
        streamP.colorCreator = colorP
        colorP.run(RUN_ALL)
        """
        g.setParams(Tracer_key, vectorP)
        r = g.runObject(case_key1, RUN_OCT)
        g.waitforAnswer(r)
        g.runObject(Tracer_key)

        #g.saveObject(0, "/work/ko_te/test.coprj")
        theNet().save("/work/ko_te/testgui.net")

    elif testMode == VIS_ISOPLANE:
        isoplaneP = PartIsoSurfaceVisParams()
        isoplaneP.variable = vector_variable
        """
        colorP = coColorCreator()
        ctableP = coColorTableParams()
        ctableP.min = 98
        ctableP.max = 100
        ctableP.colorMapIdx = 2

        ctable = coColorTable()
        ctable.params = ctableP
        colorP.params.colorTable = ctable
        streamP.colorCreator = colorP
        colorP.run(RUN_ALL)
        """
        g.setParams(Tracer_key, isoplaneP)
        r = g.runObject(case_key1, RUN_OCT)
        g.waitforAnswer(r)
        g.runObject(Tracer_key)

        #g.saveObject(0, "/work/ko_te/test.coprj")
        theNet().save("/work/ko_te/testgui.net")

    else:
        status()
        g.runObject(case_key1)
        vP = VisItemParams()
        vP.isVisible = True
        g.setParams(VisColor_key, vP)
        theNet().save("/work/sk_te/testgui.net")

    if False:  # True:
        reqId = g.requestObject(TYPE_CASE, None, project_key)
        g.waitforAnswer(reqId)
        caseP = coCaseMgrParams()
        caseP.filename = ('/work/common/Projekte/DC-CFDGui/datasets/'
                          'msport/CoviseDaten/msport.cocase')
        g.setParams(case_key1, caseP)