parameters: (inImagesetInfo, inPhactoriOperation,
          inPvDataRepresentation, inPhactoriRepresentation,
          inInitializeColorLegendFlag)
docstring: sets the color by variable to a scalar, vector component/magnitude, or
       tensor component.  Assumes we've already established we are doing this
       instead of solid color or color by block
docstring_summary: sets the color by variable to a scalar, vector component/magnitude, or
       tensor component.  Assumes we've already established we are doing this
       instead of solid color or color by block
docstring_tokens: sets the color by variable to a scalar vector component / magnitude or tensor component . Assumes we ve already established we are doing this instead of solid color or color by block
function: def SetForCorrectColorByVariable(inImagesetInfo, inPhactoriOperation,
          inPvDataRepresentation, inPhactoriRepresentation,
          inInitializeColorLegendFlag):
    """sets the color by variable to a scalar, vector component/magnitude, or
       tensor component.  Assumes we've already established we are doing this
       instead of solid color or color by block"""
  
    if PhactoriDbg():
      myDebugPrint3("SetForCorrectColorByVariable entered\n")
  
    savedActiveSourceX = GetActiveSource()
    SetActiveSource(inPhactoriOperation.GetPvFilter())
  
    colorVarInfo = inPhactoriRepresentation.mColorVariableInfo
  
    if PhactoriDbg():
      myDebugPrint3("colorVarInfo.mVariableName: " + \
          str(colorVarInfo.mVariableName) + "\n")
  
    if colorVarInfo.mVariableName == '':
      myVariableArrayType = gCellsString
    else:
      global gPipeAndViewsState
      #the correct behavior is probably to use the imageset's filter as the
      #filter to use to determine info about the variable, such as POINT or
      #cell; however prior work used the pipeline start default incoming
      #filter.  We are using prior to get tests to pass for now, and
      #we are considering switching to 'correct.'
      useImagesetFilterToDetectVariableType = False
      if useImagesetFilterToDetectVariableType:
        paraViewSource = inPhactoriOperation.GetPvFilter()
      else:
        paraViewSource = \
          gPipeAndViewsState.mIncomingDefaultOperation.GetPvFilter()
      detectResult = colorVarInfo.DetectVariableType(
          paraViewSource, True, False)
  
      if detectResult == True:
        #variable type detected determine value for paraview
        if colorVarInfo.mVariableType == 'node':
          myVariableArrayType = gPointsString
        elif colorVarInfo.mVariableType == 'element':
          myVariableArrayType = gCellsString
        else:
          if PhactoriDbg():
            myDebugPrint3(errStr)
          errStr = 'CreateParaviewItemsForImagesetC error:\n'\
            'image set ' + inImagesetInfo.mName + \
            'operation ' + inPhactoriOperation.mName + \
            ' representation ' + inPhactoriRepresentation.mName + \
            '\ncolor variable name: ' + \
            colorVarInfo.mVariableName +\
            '\nvariable should be node or element at this point and is not'
          raise Exception(errStr)
      else:
        #variable type not detected, deal with it
        errStr = 'CreateParaviewItemsForImagesetC error:\n'\
            'image set ' + inImagesetInfo.mName + \
            'operation ' + inPhactoriOperation.mName + \
            ' representation ' + inPhactoriRepresentation.mName + \
            '\ncolor variable name: ' + \
            colorVarInfo.mVariableName +\
            '\nvariable is not point data or cell data, assuming cell'
        if PhactoriDbg():
          myDebugPrint3(errStr)
        #current hack--if detection of variable type fails due to missing
        #variable; assume it is CELLS and let mpi stuff share info
        #and create odd color map otherwise
        myVariableArrayType = gCellsString
  
    if PhactoriDbg():
      myDebugPrint3("myVariableArrayType: " + myVariableArrayType + "\n")
        #("showColorLegend: " + str(showColorLegend) + "\n")
  
    colorVarName = colorVarInfo.mVariableName
    if colorVarName != '':
      if colorVarInfo.mVariableIsVectorComponent:
        if PhactoriDbg():
          myDebugPrint3("mVariableIsVectorComponent is true so we do\n"
            "ColorByVariableComponentOrMagnitudeXX (component)\n")
        ColorByVariableComponentOrMagnitudeXX(
          inPvDataRepresentation, inPhactoriRepresentation, colorVarName,
          'Component', colorVarInfo.mVariableComponent, myVariableArrayType,
          inPhactoriRepresentation.mColorMapSettings)
      elif colorVarInfo.mVariableIsVectorMagnitude:
        if PhactoriDbg():
          myDebugPrint3("mVariableIsVectorMagnitude is true so we do\n"
            "ColorByVariableComponentOrMagnitudeXX (magnitude)\n")
        ColorByVariableComponentOrMagnitudeXX(
          inPvDataRepresentation, inPhactoriRepresentation, colorVarName,
          'Magnitude', colorVarInfo.mVariableComponent, myVariableArrayType,
          inPhactoriRepresentation.mColorMapSettings)
      else:
        if PhactoriDbg():
          myDebugPrint3("not component or magnitude so we do "
              "ColorByVariableScalarXX\n")
        ColorByVariableScalarXX(inPvDataRepresentation, inPhactoriRepresentation,
            colorVarName, myVariableArrayType,
            inPhactoriRepresentation.mColorMapSettings)
  
      #if inInitializeColorLegendFlag:
      if True:
        if inPhactoriRepresentation.mUseFixedColorRange:
          fixedColorRange = inPhactoriRepresentation.mFixedColorRange
          SetMinimumMaximumColorValues(inPvDataRepresentation,
              fixedColorRange[0], fixedColorRange[1],
              inPhactoriOperation, inPhactoriRepresentation,
              colorVarName, myVariableArrayType)
        #else:
        #  SetMinimumMaximumColorValues(inPvDataRepresentation,
        #      -0.1, 0.1,
        #      inPhactoriRepresentation, colorVarName, myVariableArrayType)
    else:
      if gParaViewCatalystVersionFlag <= 40100:
        inPvDataRepresentation.ColorArrayName = ""
      else:
        #if PhactoriDbg():
        #  myDebugPrint3("using ColorBy() to set no color var 1\n")
        inPvDataRepresentation.RescaleTransferFunctionToDataRange(False)
        SafeColorBy(inPvDataRepresentation, (gPointsString,''))
        inPvDataRepresentation.RescaleTransferFunctionToDataRange(False)
  
    if PhactoriDbg():
      myDebugPrint3("SetForCorrectColorByVariable returning\n")
  
    #inPvDataRepresentation.RescaleTransferFunctionToDataRange(True)
    SetActiveSource(savedActiveSourceX)
function_tokens: def SetForCorrectColorByVariable ( inImagesetInfo , inPhactoriOperation , inPvDataRepresentation , inPhactoriRepresentation , inInitializeColorLegendFlag ) : if PhactoriDbg ( ) : myDebugPrint3 ( "SetForCorrectColorByVariable entered\n" ) savedActiveSourceX = GetActiveSource ( ) SetActiveSource ( inPhactoriOperation . GetPvFilter ( ) ) colorVarInfo = inPhactoriRepresentation . mColorVariableInfo if PhactoriDbg ( ) : myDebugPrint3 ( "colorVarInfo.mVariableName: " + str ( colorVarInfo . mVariableName ) + "\n" ) if colorVarInfo . mVariableName == '' : myVariableArrayType = gCellsString else : global gPipeAndViewsState #the correct behavior is probably to use the imageset's filter as the #filter to use to determine info about the variable, such as POINT or #cell; however prior work used the pipeline start default incoming #filter.  We are using prior to get tests to pass for now, and #we are considering switching to 'correct.' useImagesetFilterToDetectVariableType = False if useImagesetFilterToDetectVariableType : paraViewSource = inPhactoriOperation . GetPvFilter ( ) else : paraViewSource = gPipeAndViewsState . mIncomingDefaultOperation . GetPvFilter ( ) detectResult = colorVarInfo . DetectVariableType ( paraViewSource , True , False ) if detectResult == True : #variable type detected determine value for paraview if colorVarInfo . mVariableType == 'node' : myVariableArrayType = gPointsString elif colorVarInfo . mVariableType == 'element' : myVariableArrayType = gCellsString else : if PhactoriDbg ( ) : myDebugPrint3 ( errStr ) errStr = 'CreateParaviewItemsForImagesetC error:\n' 'image set ' + inImagesetInfo . mName + 'operation ' + inPhactoriOperation . mName + ' representation ' + inPhactoriRepresentation . mName + '\ncolor variable name: ' + colorVarInfo . mVariableName + '\nvariable should be node or element at this point and is not' raise Exception ( errStr ) else : #variable type not detected, deal with it errStr = 'CreateParaviewItemsForImagesetC error:\n' 'image set ' + inImagesetInfo . mName + 'operation ' + inPhactoriOperation . mName + ' representation ' + inPhactoriRepresentation . mName + '\ncolor variable name: ' + colorVarInfo . mVariableName + '\nvariable is not point data or cell data, assuming cell' if PhactoriDbg ( ) : myDebugPrint3 ( errStr ) #current hack--if detection of variable type fails due to missing #variable; assume it is CELLS and let mpi stuff share info #and create odd color map otherwise myVariableArrayType = gCellsString if PhactoriDbg ( ) : myDebugPrint3 ( "myVariableArrayType: " + myVariableArrayType + "\n" ) #("showColorLegend: " + str(showColorLegend) + "\n") colorVarName = colorVarInfo . mVariableName if colorVarName != '' : if colorVarInfo . mVariableIsVectorComponent : if PhactoriDbg ( ) : myDebugPrint3 ( "mVariableIsVectorComponent is true so we do\n" "ColorByVariableComponentOrMagnitudeXX (component)\n" ) ColorByVariableComponentOrMagnitudeXX ( inPvDataRepresentation , inPhactoriRepresentation , colorVarName , 'Component' , colorVarInfo . mVariableComponent , myVariableArrayType , inPhactoriRepresentation . mColorMapSettings ) elif colorVarInfo . mVariableIsVectorMagnitude : if PhactoriDbg ( ) : myDebugPrint3 ( "mVariableIsVectorMagnitude is true so we do\n" "ColorByVariableComponentOrMagnitudeXX (magnitude)\n" ) ColorByVariableComponentOrMagnitudeXX ( inPvDataRepresentation , inPhactoriRepresentation , colorVarName , 'Magnitude' , colorVarInfo . mVariableComponent , myVariableArrayType , inPhactoriRepresentation . mColorMapSettings ) else : if PhactoriDbg ( ) : myDebugPrint3 ( "not component or magnitude so we do " "ColorByVariableScalarXX\n" ) ColorByVariableScalarXX ( inPvDataRepresentation , inPhactoriRepresentation , colorVarName , myVariableArrayType , inPhactoriRepresentation . mColorMapSettings ) #if inInitializeColorLegendFlag: if True : if inPhactoriRepresentation . mUseFixedColorRange : fixedColorRange = inPhactoriRepresentation . mFixedColorRange SetMinimumMaximumColorValues ( inPvDataRepresentation , fixedColorRange [ 0 ] , fixedColorRange [ 1 ] , inPhactoriOperation , inPhactoriRepresentation , colorVarName , myVariableArrayType ) #else: #  SetMinimumMaximumColorValues(inPvDataRepresentation, #      -0.1, 0.1, #      inPhactoriRepresentation, colorVarName, myVariableArrayType) else : if gParaViewCatalystVersionFlag <= 40100 : inPvDataRepresentation . ColorArrayName = "" else : #if PhactoriDbg(): #  myDebugPrint3("using ColorBy() to set no color var 1\n") inPvDataRepresentation . RescaleTransferFunctionToDataRange ( False ) SafeColorBy ( inPvDataRepresentation , ( gPointsString , '' ) ) inPvDataRepresentation . RescaleTransferFunctionToDataRange ( False ) if PhactoriDbg ( ) : myDebugPrint3 ( "SetForCorrectColorByVariable returning\n" ) #inPvDataRepresentation.RescaleTransferFunctionToDataRange(True) SetActiveSource ( savedActiveSourceX )