Пример #1
0
    def displayIntForcDiag(self,
                           itemToDisp='',
                           setToDisplay=None,
                           fConvUnits=1.0,
                           scaleFactor=1.0,
                           unitDescription='',
                           viewDef=vtk_graphic_base.CameraParameters('XYZPos'),
                           fileName=None,
                           defFScale=0.0):
        '''displays the component of internal forces in the set of entities as a 
         diagram over lines (i.e. appropiated for beam elements).

        :param itemToDisp: component of the internal forces 
          ('N', 'Qy' (or 'Vy'), 'Qz' (or 'Vz'), 'My', 'Mz', 'T') to be depicted 
        :param setToDisplay: set of entities (elements of type beam) to be 
          represented
        :param fConvUnits:   factor of conversion to be applied to the results 
            (defaults to 1)
        :param scaleFactor:  factor of scale to apply to the diagram display
        :param unitDescription: string like '[kN/m] or [kN m/m]'
        :param vwDef:  camera parameters.
        :param fileName:  name of the file to plot the graphic. Defaults to None,
                       in that case an screen display is generated
        :param defFScale: factor to apply to current displacement of nodes 
                so that the display position of each node equals to
                the initial position plus its displacement multiplied
                by this factor. (Defaults to 0.0, i.e. display of 
                initial/undeformed shape)
        '''
        self.checkSetToDisp(setToDisplay)
        #auto-scale parameters
        LrefModSize = self.xcSet.getBnd(1.0).diagonal.getModulus(
        )  #representative length of set size (to autoscale)
        diagAux = cvd.ControlVarDiagram(scaleFactor=scaleFactor,
                                        fUnitConv=fConvUnits,
                                        sets=[self.xcSet],
                                        attributeName="intForce",
                                        component=itemToDisp)
        maxAbs = diagAux.getMaxAbsComp()
        if maxAbs > 0:
            scaleFactor *= 0.15 * LrefModSize / (maxAbs * fConvUnits)
        #
        caption = self.loadCaseName + ' ' + itemToDisp + ' ' + unitDescription + ' ' + self.xcSet.description
        display_diagram(scaleFactor=scaleFactor,
                        fConvUnits=fConvUnits,
                        setToDispRes=self.xcSet,
                        setDisp=self.xcSet,
                        attributeName="intForce",
                        component=itemToDisp,
                        caption=caption,
                        viewDef=viewDef,
                        defFScale=defFScale,
                        fileName=fileName)
Пример #2
0
    def displayIntForcDiag(self,itemToDisp='',setToDisplay=None,fConvUnits=1.0,scaleFactor=1.0,unitDescription= '',viewName='XYZPos',hCamFct=1.0,fileName=None,defFScale=0.0):
      '''displays the component of internal forces in the set of entities as a 
       diagram over lines (i.e. appropiated for beam elements).

      :param itemToDisp: component of the internal forces 
          ('N', 'Qy' (or 'Vy'), 'Qz' (or 'Vz'), 'My', 'Mz', 'T') to be depicted 
      :param setToDisplay: set of entities (elements of type beam) to be 
          represented
      :param fConvUnits:   factor of conversion to be applied to the results 
           (defaults to 1)
      :param scaleFactor:  factor of scale to apply to the diagram display of
      :param unitDescription: string like '[kN/m] or [kN m/m]'
      :param viewName:  name of the view  that contains the renderer (possible
                        options: "XYZPos", "XPos", "XNeg","YPos", "YNeg",
                        "ZPos", "ZNeg") (defaults to "XYZPos")
      :param hCamFct:  factor that applies to the height of the camera position
                          in order to change perspective of isometric views 
                          (defaults to 1, usual values 0.1 to 10)
      :param fileName:  name of the file to plot the graphic. Defaults to None,
                       in that case an screen display is generated
      :param defFScale: factor to apply to current displacement of nodes 
                so that the display position of each node equals to
                the initial position plus its displacement multiplied
                by this factor. (Defaults to 0.0, i.e. display of 
                initial/undeformed shape)
      '''
      if(setToDisplay):
          self.xcSet= setToDisplay
      else:
          lmsg.warning('QuickGraphics::displayIntForc; set to display not defined; using previously defined set (total if None).')
      diagram= cvd.ControlVarDiagram(scaleFactor= scaleFactor,fUnitConv= fConvUnits,sets=[self.xcSet],attributeName= "intForce",component= itemToDisp)
      diagram.addDiagram()
      defDisplay= self.getDisplay(vwName=viewName,hCamF= hCamFct)
      defDisplay.setupGrid(self.xcSet)
      defDisplay.defineMeshScene(None,defFScale)
      defDisplay.appendDiagram(diagram) #Append diagram to the scene.

      caption= self.loadCaseName+' '+itemToDisp+' '+unitDescription +' '+self.xcSet.description
      defDisplay.displayScene(caption=caption,fName=fileName)
Пример #3
0
def display_diagram(scaleFactor, fConvUnits, setToDispRes, setDisp,
                    attributeName, component, caption, viewDef, defFScale,
                    fileName):
    '''Auxiliary function to display results on linear elements.

    :param scaleFactor:  factor of scale to apply to the diagram display
    :param fConvUnits:   factor of conversion to be applied to the results 
    :param setToDispRes: set of linear elements to which display results
    :param setDisp:      set of elements (any type) to be depicted
    :param attributeName:attribute name(e.g. 'ULS_normalStressesResistance')
    :param component:    result item to display (e.g. 'N', 'My', ...)
    :param caption:      caption to display
    :param viewDef:      instance of class CameraParameters
    :param defFScale:    factor to apply to current displacement of nodes 
                so that the display position of each node equals to
                the initial position plus its displacement multiplied
                by this factor. (Defaults to 0.0, i.e. display of 
                initial/undeformed shape)
    :param fileName:     file to dump the display
    '''
    diagram = cvd.ControlVarDiagram(scaleFactor=scaleFactor,
                                    fUnitConv=fConvUnits,
                                    sets=[setToDispRes],
                                    attributeName=attributeName,
                                    component=component)
    diagram.addDiagram()
    defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
    defDisplay.cameraParameters = viewDef
    defDisplay.setupGrid(setDisp)
    if hasattr(setDisp, 'color'):
        color = setDisp.color
    else:
        color = xc.Vector([rd.random(), rd.random(), rd.random()])
    defDisplay.defineMeshScene(None, defFScale, color=color)
    defDisplay.appendDiagram(diagram)  #Append diagram to the scene.
    defDisplay.displayScene(caption=caption, fName=fileName)
Пример #4
0
fName = model_path + check_results_directory + 'verifRsl_crackingSLS_qperm.py'
execfile(fName)
execfile('../captionTexts.py')

limitStateLabel = lsd.quasiPermanentLoadsCrackControl.label

#Possible arguments: 'getCF', 'getMaxSteelStress'
argument = 'getMaxSteelStress'

setDispRes = beamXSet  #set of linear elements to which display results

setDisp = xcTotalSet  #set of elements (any type) to be displayed

diagram = cvd.ControlVarDiagram(scaleFactor=1,
                                fUnitConv=100,
                                sets=[setDispRes.elSet],
                                attributeName=limitStateLabel,
                                component=argument)
diagram.addDiagram()

defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
#predefined view names: 'XYZPos','XNeg','XPos','YNeg','YPos',
#                        'ZNeg','ZPos'  (defaults to 'XYZPos')
#defDisplay.viewName= "YPos" #Point of view.
defDisplay.setupGrid(setDisp.elSet)
defDisplay.defineMeshScene(None)
defDisplay.appendDiagram(diagram)  #Append diagram to the scene.

caption = capTexts[limitStateLabel] + ', ' + capTexts[
    argument] + '. ' + setDispRes.genDescr.capitalize(
    ) + ', ' + setDispRes.sectDescr[0]
Пример #5
0
def checksReports(limitStateLabel,
                  setsShEl,
                  argsShEl,
                  capTexts,
                  pathGr,
                  texReportFile,
                  grWdt,
                  setsBmElView=[],
                  argsBmElScale=[]):
    '''Create a LaTeX report including the desired graphical results obtained
     in the verification of a limit state.

    :param limitStateLabel: limit state
    :param setsShEl:   Ordered list of sets of shell elements (defined in 
                       model_data.py as instances of utils_display.setToDisplay)
                       to be included in the report
    :param argsShEl:   Ordered list of arguments to be included in the report   
                       for shell elements
    :param capTexts:  dictionary from wich to read the texts for captions
    :param pathGr:     width to be applied to graphics 
    :param texReportFile: laTex file where to include the graphics
    :param grWdt:      width of the graphics for the tex file
    :param setsBmView: Ordered list of lists [set of beam elements, view to 
                       represent this set] to be included in the report. 
                       The sets have been defined in model_data.py 
                       as instances of utils_display.setToDisplay and the 
                       possible views are: 'XYZPos','XNeg','XPos','YNeg','YPos',
                       'ZNeg','ZPos'  (defaults to 'XYZPos')
    :param argsShEl:   Ordered list of lists [arguments, scale to represent the 
                       argument] to be included in the report for beam elements
    '''
    report = open(texReportFile, 'w')  #report latex file
    dfDisp = vtk_FE_graphic.RecordDefDisplayEF()
    for st in setsShEl:
        for arg in argsShEl:
            attributeName = limitStateLabel + 'Sect1'
            field = Fields.getScalarFieldFromControlVar(
                attributeName, arg, st, None, 1.0, None)
            capt = capTexts[limitStateLabel] + ', ' + capTexts[
                arg] + '. ' + st.description.capitalize() + ', ' + 'section 1'
            grFileNm = pathGr + st.name + arg + 'Sect1'
            field.display(defDisplay=dfDisp,
                          caption=capt,
                          fName=grFileNm + '.jpg')
            insertGrInTex(texFile=report,
                          grFileNm=grFileNm,
                          grWdt=grWdt,
                          capText=capt)

            attributeName = limitStateLabel + 'Sect2'
            field = Fields.getScalarFieldFromControlVar(
                attributeName, arg, st, None, 1.0, None)
            capt = capTexts[limitStateLabel] + ', ' + capTexts[
                arg] + '. ' + st.description.capitalize() + ', ' + 'section 2'
            grFileNm = pathGr + st.name + arg + 'Sect2'
            field.display(defDisplay=dfDisp,
                          caption=capt,
                          fName=grFileNm + '.jpg')
            insertGrInTex(texFile=report,
                          grFileNm=grFileNm,
                          grWdt=grWdt,
                          capText=capt)
    for stV in setsBmElView:
        for argS in argsBmElScale:
            diagram = cvd.ControlVarDiagram(scaleFactor=argS[1],
                                            fUnitConv=1,
                                            sets=[stV[0]],
                                            attributeName=limitStateLabel,
                                            component=argS[0])
            diagram.addDiagram()
            dfDisp.cameraParameters = vtk_graphic_base.CameraParameters(stV[1])
            dfDisp.setupGrid(stV[0])
            dfDisp.defineMeshScene(None)
            dfDisp.appendDiagram(diagram)
            capt = capTexts[limitStateLabel] + ', ' + capTexts[
                argS[0]] + '. ' + stV[0].description.capitalize(
                ) + ', ' + 'section 1'
            grFileNm = pathGr + stV[0].name + argS[0]
            dfDisp.displayScene(caption=capt, fName=grFileNm + '.jpg')
            insertGrInTex(texFile=report,
                          grFileNm=grFileNm,
                          grWdt=grWdt,
                          capText=capt)
    report.close()
    return
execfile("../model_gen.py")  #FE model generation

#Load properties to display:
execfile(cfg.verifCrackFreqFile)

#  Config
argument = 'wk'  #Available arguments: 'N', 'My','Mz','s_rmax','eps_sm','wk'
setsDispRes = [beamX
               ]  #list of linear elements sets for which to display results
setDisp = overallSet  #set of elements (any type) to be displayed
scaleFactor = 1e2  #scale factor for the diagram (can be negative)
fUnitConv = 1e3  #unit conversion factor (i.e m->mm => fUnitConv= 1e3)
viewName = 'XYZPos'  #predefined view names: 'XYZPos','XNeg','XPos','YNeg',
#'YPos','ZNeg','ZPos'  (defaults to 'XYZPos')
#  End config

diagram = cvd.ControlVarDiagram(scaleFactor=scaleFactor,
                                fUnitConv=fUnitConv,
                                sets=setsDispRes,
                                attributeName=lsd.freqLoadsCrackControl.label,
                                component=argument)
diagram.addDiagram()
defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
defDisplay.setupGrid(setDisp)
defDisplay.defineMeshScene(None, defFScale=0.0)
defDisplay.appendDiagram(diagram)  #Append diagram to the scene.
caption = cfg.capTexts[lsd.freqLoadsCrackControl.label] + ', ' + cfg.capTexts[
    argument] + '. ' + setsDispRes[0].description.capitalize() + ', '
defDisplay.displayScene(caption)
Пример #7
0
modelDataInputFile = model_path + "test_export_internal_forces_beam_2d.py"  #data for FE model generation
execfile(modelDataInputFile)

#Load properties to display:
#fName= model_path+'verifRsl_normStrsULS.py'
fName = model_path + 'verifRsl_shearULS.py'
execfile(fName)
#execfile(model_path+'/captionTexts.py')

defGrid = vtk_grafico_base.RecordDefGrid()
defGrid.nmbSet = "total"

#diagram= cvd.ControlVarDiagram(scaleFactor= 1,fUnitConv= 1,sets=[totalSet],attributeName= lsd.normalStressesResistance.label,component= 'N')
diagram = cvd.ControlVarDiagram(
    scaleFactor=1,
    fUnitConv=1,
    sets=[totalSet],
    attributeName=lsd.normalStressesResistance.label,
    component='Mz')
#diagram= cvd.ControlVarDiagram(scaleFactor= 1,fUnitConv= 1,sets=[totalSet],attributeName= lsd.normalStressesResistance.label,component= 'CF')
diagram = cvd.ControlVarDiagram(scaleFactor=10,
                                fUnitConv=1,
                                sets=[totalSet],
                                attributeName=lsd.shearResistance.label,
                                component='CF')
#diagram= npd.InternalForceDiagram(-0.02,fUnitConv=1e-3,sets=[colsSet.elSet],component= "Qy")
diagram.addDiagram()

defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
#defDisplay.windowHeight= 300
defDisplay.viewName = "YPos"  #Point of view.
defDisplay.setupGrid(totalSet)
#Load properties to display:
execfile(cfg.verifShearFile)

#  Config
argument = 'CF'  #Available arguments: 'CF', 'N', 'My', 'Mz', 'Mu',
#'Vy', 'Vz', 'theta', 'Vcu', 'Vsu', 'CF'
setsDispRes = [beamY]  #list of linear elements sets for which
#to display results
setDisp = overallSet  #set of elements (any type) to be displayed
scaleFactor = 1  #scale factor for the diagram (can be negative)
fUnitConv = 1  #unit conversion factor (i.e N->kN => fUnitConv= 1e-3)
viewName = 'XYZPos'  #predefined view names: 'XYZPos','XNeg','XPos','YNeg',
#'YPos','ZNeg','ZPos'  (defaults to 'XYZPos')
#  End config

diagram = cvd.ControlVarDiagram(scaleFactor=scaleFactor,
                                fUnitConv=fUnitConv,
                                sets=setsDispRes,
                                attributeName=lsd.shearResistance.label,
                                component=argument)
diagram.addDiagram()
defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
defDisplay.viewName = viewName
defDisplay.setupGrid(setDisp)
defDisplay.defineMeshScene(None, defFScale=0.0)
defDisplay.appendDiagram(diagram)
caption = cfg.capTexts[lsd.shearResistance.label] + ', ' + cfg.capTexts[
    argument] + '. ' + setsDispRes[0].description.capitalize()
defDisplay.displayScene(caption)
fName= model_path+check_results_directory+'verifRsl_shearULS.py'
execfile(fName)
execfile(model_path+'/captionTexts.py')


limitStateLabel= lsd.shearResistance.label


#Possible arguments: 'CF', 'N', 'My', 'Mz', 'Mu', 'Vy', 'Vz', 'theta', 'Vcu', 'Vsu', 'Vu'
shearFactor= 1.14 #Voir note de calcul.
argument= 'Vy'#'CF' #'Vu'
setDispRes= deckSet #deckSet #parapetSet #bridgeSectionSet   #set of linear elements to which display results 

#CF= -0.5
#Vy= 0.01
diagram= cvd.ControlVarDiagram(scaleFactor= -0.005,fUnitConv= shearFactor,sets=[setDispRes],attributeName= limitStateLabel,component= argument)
diagram.addDiagram()


defDisplay= vtk_FE_graphic.RecordDefDisplayEF()
#predefined view names: 'XYZPos','XNeg','XPos','YNeg','YPos',
 #                        'ZNeg','ZPos'  (defaults to 'XYZPos')

defDisplay.viewName= "ZPos" #Point of view.
defDisplay.setupGrid(setDispRes)

defDisplay.defineMeshScene(None)
defDisplay.appendDiagram(diagram) #Append diagram to the scene.

#execfile('draw_supports.py')
#defDisplay.renderer.AddActor(supportsActor)