Ejemplo n.º 1
0
    def __init__(self):
        
        InitialDatasetSearchPath = covise.getCoConfigEntry("vr-prepare.InitialDatasetSearchPath")
        if not InitialDatasetSearchPath:
            InitialDatasetSearchPath = os.getcwd()
        self.currentFilePath = InitialDatasetSearchPath
        self.ReadCfx_1 = 'None'
        self.scale=1.0
        self.mirror=0 # 0=none, 1=X, 2=Y, 3=Z
        self.rotAxisX=1.0
        self.rotAxisY=1.0
        self.rotAxisZ=1.0
        self.rotAngle=0.0
        self.composedGrid = False
        self.noGrid = False
        self.processBoundaries = True
        self.numVariables = 0
        self.fixdomain = "None"
        self.calculatePDYNFlag = False
        self.domains=[]
        self.coCaseFile = "None"
        self.reduce = False
        self.reductionFactor = 40.0

        
        #
        # init base class
        #
        Cfx2CoviseGuiBase.__init__(self, None)

        #
        # remove unused menubar items 
        #
        self.fileNewAction.setVisible(False)
        #
        # disable all buttons
        #
        self.gridFrame.setEnabled(False)
        self.reduceFrame.setEnabled(False)
        self.variableFrame.setEnabled(False)
        self.settingsFrame.setEnabled(False)
        self.startConversionFrame.setEnabled(False)
        self.outputDirFrame.setEnabled(False)
             
         
        #
        # register error log action
        #
        self.aErrorLogAction = ErrorLogAction()
        CoviseMsgLoop().register(self.aErrorLogAction)
        self.aErrorLogAction.register(self)
        
        # 
        # register action to read message and boundaries
        self.aBoundaryCollectorAction = BoundariesCollectorAction()
        CoviseMsgLoop().register(self.aBoundaryCollectorAction)
        
        
        #
        # register choice action
        #
        self.domainsGetterAction = ChoiceGetterAction()
        self.RegionsSelectionGetterAction = ChoiceGetterAction()        
        self.BoundarySelectionGetterAction = ChoiceGetterAction()        
        self.scalar_dataGetterAction = ChoiceGetterAction()
        self.vector_dataGetterAction = ChoiceGetterAction()
        self.timestepsGetterAction = IntGetterAction()
        #self.first_timestepGetterAction = ChoiceGetterAction()
        #self.readGridGetterAction = ChoiceGetterAction()
        #self.readRegionsGetterAction = ChoiceGetterAction()
        #self.readBoundariesGetterAction = ChoiceGetterAction()
        self.boundary_scalar_dataGetterAction = ChoiceGetterAction()
        self.boundary_vector_dataGetterAction = ChoiceGetterAction()
        #self.grid_is_time_dependentGetterAction = ChoiceGetterAction()
        #self.zone_with_time_dependent_gridGetterAction = ChoiceGetterAction()
        #self.rotAxisGetterAction = ChoiceGetterAction()
        #self.point_on_rotAxisGetterAction = ChoiceGetterAction()
        #self.rot_Angle_pre_timestepGetterAction = ChoiceGetterAction()
        #self.transform_velocityGetterAction = ChoiceGetterAction()
        #self.transform_directionGetterAction = ChoiceGetterAction()
        #self.rotation_axisGetterAction = ChoiceGetterAction()
        #self.zone_to_transform_velocityGetterAction = ChoiceGetterAction()
        #self.angular_velocityGetterAction = ChoiceGetterAction()
        #self.rotate_velocityGetterAction = ChoiceGetterAction()
        
        self.domainsGetterAction.register(self)
        self.RegionsSelectionGetterAction.register(self)
        self.BoundarySelectionGetterAction.register(self)
        self.scalar_dataGetterAction.register(self)
        self.vector_dataGetterAction.register(self)
        #self.timestepsGetterAction.register(self)
        #self.first_timestepGetterAction.register(self)
        #self.readGridGetterAction.register(self)
        #self.readRegionsGetterAction.register(self)
        #self.readBoundariesGetterAction.register(self)
        self.boundary_scalar_dataGetterAction.register(self)
        self.boundary_vector_dataGetterAction.register(self)
        #self.grid_is_time_dependentGetterAction.register(self)
        #self.zone_with_time_dependent_gridGetterAction.register(self)
        #self.rotAxisGetterAction.register(self)
        #self.point_on_rotAxisGetterAction.register(self)
        #self.rot_Angle_pre_timestepGetterAction.register(self)
        #self.transform_velocityGetterAction.register(self)
        #self.transform_directionGetterAction.register(self)
        #self.rotation_axisGetterAction.register(self)
        #self.zone_to_transform_velocityGetterAction.register(self)
        #self.angular_velocityGetterAction.register(self)
        #self.rotate_velocityGetterAction.register(self)
        
        global theNet
        theNet = net() 
        #
        # MODULE: ReadCfx
        #
        self.ReadCfx_1 = ReadCFX()
        theNet.add( self.ReadCfx_1 )
        #
        # hang in variable-getters
        #
        self.ReadCfx_1.addNotifier('domains',self.domainsGetterAction)
        self.ReadCfx_1.addNotifier('RegionsSelection',self.RegionsSelectionGetterAction)
        self.ReadCfx_1.addNotifier('BoundarySelection',self.BoundarySelectionGetterAction)
        self.ReadCfx_1.addNotifier('scalar_data',self.scalar_dataGetterAction)
        self.ReadCfx_1.addNotifier('vector_data',self.vector_dataGetterAction)
        self.ReadCfx_1.addNotifier('timesteps',self.timestepsGetterAction)
        #self.ReadCfx_1.addNotifier('first_timestep',self.first_timestepGetterAction)
        #self.ReadCfx_1.addNotifier('readGrid',self.readGridGetterAction)
        #self.ReadCfx_1.addNotifier('readRegions',self.readRegionsGetterAction)
        #self.ReadCfx_1.addNotifier('readBoundaries',self.readBoundariesGetterAction)
        self.ReadCfx_1.addNotifier('boundary_scalar_data',self.boundary_scalar_dataGetterAction)
        self.ReadCfx_1.addNotifier('boundary_vector_data',self.boundary_vector_dataGetterAction)
        #self.ReadCfx_1.addNotifier('grid_is_time_dependent',self.grid_is_time_dependentGetterAction)
        #self.ReadCfx_1.addNotifier('zone_with_time_dependent_grid',self.zone_with_time_dependent_gridGetterAction)
        #self.ReadCfx_1.addNotifier('rotAxis',self.rotAxisGetterAction)
        #self.ReadCfx_1.addNotifier('point_on_rotAxis',self.point_on_rotAxisGetterAction)
        #self.ReadCfx_1.addNotifier('rot_Angle_pre_timestep',self.rot_Angle_pre_timestepGetterAction)
        #self.ReadCfx_1.addNotifier('transform_velocity',self.transform_velocityGetterAction)
        #self.ReadCfx_1.addNotifier('transform_direction',self.transform_directionGetterAction)
        #self.ReadCfx_1.addNotifier('rotation_axis',self.rotation_axisGetterAction)
        #self.ReadCfx_1.addNotifier('zone_to_transform_velocity',self.zone_to_transform_velocityGetterAction)
        #self.ReadCfx_1.addNotifier('angular_velocity',self.angular_velocityGetterAction)
        #self.ReadCfx_1.addNotifier('rotate_velocity',self.rotate_velocityGetterAction)

        #
        # connect buttons
        #
        
        self.cbNoGrid.stateChanged.connect(self.setNoGrid)
        self.cbNoGrid.stateChanged.connect(self.setComposedGrid)
        self.cbNoGrid.stateChanged.connect(self.setTransientGrid)
        self.cbNoGrid.currentIndexChanged.connect(self.setNumVar)
        self.cbNoGrid.stateChanged.connect(self.setPdyn)
        self.cbNoGrid.stateChanged.connect(self.setNoBound)
        self.cbNoGrid.currentIndexChanged.connect(self.setDomain)
        self.cbNoGrid.returnPressed.connect(self.setOutputDir)
        self.cbNoGrid.clicked.connect(self.addToCoCase)
        self.cbNoGrid.clicked.connect(self.startConversion)
Ejemplo n.º 2
0
    def startModules(self):
        #print "Ensight2CoviseGui.startModules"
        self.aErrorLogAction = ErrorLogAction()
        CoviseMsgLoop().register(self.aErrorLogAction)

        global theNet
        theNet = net()
        
        self.scalarVariables3DGetterAction = ChoiceGetterAction()
        self.vectorVariables3DGetterAction = ChoiceGetterAction()
        self.scalarVariables2DGetterAction = ChoiceGetterAction()
        self.vectorVariables2DGetterAction = ChoiceGetterAction()

 

        # MODULE: ReadEnsight
        self.ReadEnsight_1 = ReadEnsight()
        theNet.add( self.ReadEnsight_1 )

        self.aPartsCollectorAction = PartsCollectorAction()
        CoviseMsgLoop().register(self.aPartsCollectorAction)


        # hang in variable-getters
        self.ReadEnsight_1.addNotifier('data_for_sdata1_3D', self.scalarVariables3DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_vdata1_3D', self.vectorVariables3DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_sdata1_2D', self.scalarVariables2DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_vdata1_2D', self.vectorVariables2DGetterAction)


        # set parameter values
        if self.isByteSwapped == True:
            self.ReadEnsight_1.set_data_byte_swap( "TRUE" )
        else:
            self.ReadEnsight_1.set_data_byte_swap( "FALSE" )
        self.ReadEnsight_1.set_case_file( self.fullEnsightCaseName )
        self.ReadEnsight_1.set_include_polyhedra( "TRUE")
        self.ReadEnsight_1.set_enable_autocoloring( "FALSE" )
       
        # wait for choices to be updated
        self.scalarVariables3DGetterAction.waitForChoices()
        self.vectorVariables3DGetterAction.waitForChoices()
        self.scalarVariables2DGetterAction.waitForChoices()
        self.vectorVariables2DGetterAction.waitForChoices()

        # wait for the part info message
        self.aPartsCollectorAction.waitForPartsinfoFinished()

                
        # get variables
        self.scalarVariables3D=self.scalarVariables3DGetterAction.getChoices()
        self.vectorVariables3D=self.vectorVariables3DGetterAction.getChoices()
        self.scalarVariables2D=self.scalarVariables2DGetterAction.getChoices()
        self.vectorVariables2D=self.vectorVariables2DGetterAction.getChoices()


        text = "Ensight Case File: %s"%(self.fullEnsightCaseName)
        self.statusText.append(text)

        self.statusText.append("\n3D parts:")
        for partid in self.aPartsCollectorAction.getRefNameDict3dParts().keys():
            partname = self.aPartsCollectorAction.getRefNameDict3dParts()[partid]
            text = "\tPart %d = %s"%(partid, partname)
            self.statusText.append(text)

        self.statusText.append("3D Part Variables:")
        for svar in self.scalarVariables3D:
           text= "\t%s(scalar)"%(svar)   
           self.statusText.append(text)
        for vvar in self.vectorVariables3D:
           text= "\t%s(vector)"%(vvar)   
           self.statusText.append(text)              
                                  
        self.statusText.append("\n2D parts:")
        for partid in self.aPartsCollectorAction.getRefNameDict2dParts().keys():
            partname = self.aPartsCollectorAction.getRefNameDict2dParts()[partid]
            text = "\tPart %d = %s"%(partid, partname)
            self.statusText.append(text)

        self.statusText.append("2D Part Variables:")
        for svar in self.scalarVariables2D:
           text= "\t%s(scalar)"%(svar)   
           self.statusText.append(text)
        for vvar in self.vectorVariables2D:
           text= "\t%s(vector)"%(vvar)   
           self.statusText.append(text) 
           
        QtWidgets.QApplication.processEvents()
       
         

        # MODULE: RWCovise
        self.RWCovise_1 = RWCovise()
        theNet.add( self.RWCovise_1 )
        self.RWCovise_1.set_stepNo( 0 )
        self.RWCovise_1.set_rotate_output( "FALSE" )
        self.RWCovise_1.set_rotation_axis( 3 )
        self.RWCovise_1.set_rot_speed( 2.000000 )

        self.cocase = CoviseCaseFile()
        cn = os.path.basename(str(self.fullEnsightCaseName))
        self.cocasename = cn[0: cn.rfind('.')]
Ejemplo n.º 3
0
def theNet():
    global _net
    if None == _net: _net = net()
    return _net
Ejemplo n.º 4
0
    def startModules(self):
        #print "Ensight2CoviseGui.startModules"
        self.aErrorLogAction = ErrorLogAction()
        CoviseMsgLoop().register(self.aErrorLogAction)

        global theNet
        theNet = net()

        self.scalarVariables3DGetterAction = ChoiceGetterAction()
        self.vectorVariables3DGetterAction = ChoiceGetterAction()
        self.scalarVariables2DGetterAction = ChoiceGetterAction()
        self.vectorVariables2DGetterAction = ChoiceGetterAction()

        # MODULE: ReadEnsight
        self.ReadEnsight_1 = ReadEnsight()
        theNet.add(self.ReadEnsight_1)

        self.aPartsCollectorAction = PartsCollectorAction()
        CoviseMsgLoop().register(self.aPartsCollectorAction)

        # hang in variable-getters
        self.ReadEnsight_1.addNotifier('data_for_sdata1_3D',
                                       self.scalarVariables3DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_vdata1_3D',
                                       self.vectorVariables3DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_sdata1_2D',
                                       self.scalarVariables2DGetterAction)
        self.ReadEnsight_1.addNotifier('data_for_vdata1_2D',
                                       self.vectorVariables2DGetterAction)

        # set parameter values
        if self.isByteSwapped == True:
            self.ReadEnsight_1.set_data_byte_swap("TRUE")
        else:
            self.ReadEnsight_1.set_data_byte_swap("FALSE")
        self.ReadEnsight_1.set_case_file(self.fullEnsightCaseName)
        self.ReadEnsight_1.set_include_polyhedra("TRUE")
        self.ReadEnsight_1.set_enable_autocoloring("FALSE")

        # wait for choices to be updated
        self.scalarVariables3DGetterAction.waitForChoices()
        self.vectorVariables3DGetterAction.waitForChoices()
        self.scalarVariables2DGetterAction.waitForChoices()
        self.vectorVariables2DGetterAction.waitForChoices()

        # wait for the part info message
        self.aPartsCollectorAction.waitForPartsinfoFinished()

        # get variables
        self.scalarVariables3D = self.scalarVariables3DGetterAction.getChoices(
        )
        self.vectorVariables3D = self.vectorVariables3DGetterAction.getChoices(
        )
        self.scalarVariables2D = self.scalarVariables2DGetterAction.getChoices(
        )
        self.vectorVariables2D = self.vectorVariables2DGetterAction.getChoices(
        )

        text = "Ensight Case File: %s" % (self.fullEnsightCaseName)
        self.statusText.append(text)

        self.statusText.append("\n3D parts:")
        for partid in self.aPartsCollectorAction.getRefNameDict3dParts().keys(
        ):
            partname = self.aPartsCollectorAction.getRefNameDict3dParts(
            )[partid]
            text = "\tPart %d = %s" % (partid, partname)
            self.statusText.append(text)

        self.statusText.append("3D Part Variables:")
        for svar in self.scalarVariables3D:
            text = "\t%s(scalar)" % (svar)
            self.statusText.append(text)
        for vvar in self.vectorVariables3D:
            text = "\t%s(vector)" % (vvar)
            self.statusText.append(text)

        self.statusText.append("\n2D parts:")
        for partid in self.aPartsCollectorAction.getRefNameDict2dParts().keys(
        ):
            partname = self.aPartsCollectorAction.getRefNameDict2dParts(
            )[partid]
            text = "\tPart %d = %s" % (partid, partname)
            self.statusText.append(text)

        self.statusText.append("2D Part Variables:")
        for svar in self.scalarVariables2D:
            text = "\t%s(scalar)" % (svar)
            self.statusText.append(text)
        for vvar in self.vectorVariables2D:
            text = "\t%s(vector)" % (vvar)
            self.statusText.append(text)

        QtWidgets.QApplication.processEvents()

        # MODULE: RWCovise
        self.RWCovise_1 = RWCovise()
        theNet.add(self.RWCovise_1)
        self.RWCovise_1.set_stepNo(0)
        self.RWCovise_1.set_rotate_output("FALSE")
        self.RWCovise_1.set_rotation_axis(3)
        self.RWCovise_1.set_rot_speed(2.000000)

        self.cocase = CoviseCaseFile()
        cn = os.path.basename(str(self.fullEnsightCaseName))
        self.cocasename = cn[0:cn.rfind('.')]