Example #1
0
def displayFieldDirs1and2Base(limitStateLabel,
                              argument,
                              elementSet,
                              genDescr,
                              sectDescr,
                              component,
                              fUnitConv,
                              fileName,
                              captionTexts,
                              defFScale=0.0,
                              viewName='XYZPos',
                              rgMinMax=None):
    '''Display a field defined over bi-dimensional elements in its two directions.

  :param limitStateLabel: label that identifies the limit state.
  :param argument: name of the control var to represent.
  :param xcSet: represent the field over those elements.
  :param genDescr: text to identify the set (i.e 'deck' or 'west wall').
  :param sectDescr: text list to identify each direction (as ['vertical reinforcement', 'horizontal reinforcement']).
  :param component: component of the control var to represent.
  :param fUnitConv: unit conversion factor (i.e N->kN => fUnitConv= 1e-3).
  :param fileName: file name to store the image. If none -> window on screen.
  :param captionTexts: dictionary of caption texts. 
  :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 viewName: name of the view that contains the renderer (possible
                       options: "XYZPos", "XPos", "XNeg","YPos", "YNeg",
                       "ZPos", "ZNeg") (defaults to "XYZPos")
  :param rgMinMax: range (vmin,vmax) with the maximum and minimum values  
              of the scalar field (if any) to be represented. All the values 
              less than vmin are displayed in blue and those greater than vmax 
              in red (defaults to None)
  '''
    defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
    defDisplay.viewName = viewName
    attributeName = limitStateLabel + 'Sect1'  #Normal stresses limit state direction 1.
    field = Fields.getScalarFieldFromControlVar(attributeName, argument,
                                                elementSet, component,
                                                fUnitConv, rgMinMax)
    captionBaseText = captionTexts[limitStateLabel] + ', ' + captionTexts[
        argument] + '. ' + genDescr.capitalize()
    field.display(defDisplay,
                  fName=fileName,
                  caption=captionBaseText + ', ' + sectDescr[0],
                  defFScale=defFScale)

    attributeName = limitStateLabel + 'Sect2'  #Normal stresses limit state direction 2
    field = Fields.getScalarFieldFromControlVar(attributeName, argument,
                                                elementSet, component,
                                                fUnitConv, rgMinMax)
    field.display(defDisplay,
                  caption=captionBaseText + ', ' + sectDescr[1],
                  defFScale=defFScale)
Example #2
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)
            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)
            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
Example #3
0
    def displayPressures(self,
                         caption,
                         fUnitConv,
                         unitDescription,
                         rgMinMax=None,
                         fileName=None):
        '''Display foundation pressures for a single load case.
        :param rgMinMax: range (vmin,vmax) with the maximum and minimum values  
              of the scalar field (if any) to be represented. All the values 
              less than vmin are displayed in blue and those greater than vmax 
              in red (defaults to None)
        :param fileName: file name (defaults to None -> screen display)
        '''
        reac = self.calcPressures()

        field = Fields.ExtrapolatedScalarField('soilPressure',
                                               'getProp',
                                               self.foundationSet,
                                               component=2,
                                               fUnitConv=fUnitConv,
                                               rgMinMax=rgMinMax)
        defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
        field.display(defDisplay,
                      caption=caption + ' ' + unitDescription,
                      fName=fileName)
Example #4
0
    def displayDispRot(self,itemToDisp='',setToDisplay=None,fConvUnits=1.0,unitDescription= '',viewName='XYZPos',hCamFct=1.0,fileName=None,defFScale=0.0):
      '''displays the component of the displacement or rotations in the 
      set of entities.

      :param itemToDisp: component of the displacement ('uX', 'uY' or 'uZ') 
                    or the rotation ('rotX', rotY', 'rotZ') to be depicted 
      :param setToDisplay:   set of entities to be represented (defaults to all 
                    entities)
      :param fConvUnits: factor of conversion to be applied to the results 
                    (defaults to 1)
      :param unitDescription: string describing units like '[mm] or [cm]'
      :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::displayDispRot; set to display not defined; using previously defined set (total if None).')
      vCompDisp= self.getDispComponentFromName(itemToDisp)
      nodSet= self.xcSet.getNodes
      for n in nodSet:
          n.setProp('propToDisp',n.getDisp[vCompDisp])
      field= Fields.ScalarField('propToDisp',"getProp",None,fConvUnits)
      defDisplay= self.getDisplay(vwName=viewName,hCamF= hCamFct)
      defDisplay.displayMesh(xcSet=self.xcSet,field=field,diagrams= None, fName=fileName,caption=self.loadCaseName+' '+itemToDisp+' '+unitDescription+' '+self.xcSet.description,defFScale=defFScale)
Example #5
0
    def displayIntForc(self,
                       itemToDisp='',
                       setToDisplay=None,
                       fConvUnits=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 scalar field (i.e. appropiated for 2D elements; 
        shells...).

        :param itemToDisp:   component of the internal forces ('N1', 'N2', 'N12', 
             'M1', 'M2', 'M12', 'Q1', 'Q2') to be depicted 
        :param setToDisplay: set of entities to be represented (default to all 
             entities)
        :param fConvUnits:   factor of conversion to be applied to the results 
             (defalts to 1)
        :param unitDescription: string like '[kN/m] or [kN m/m]'
        :param viewDef:  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)
        '''
        if (setToDisplay):
            self.xcSet = setToDisplay
        else:
            lmsg.warning(
                'QuickGraphics::displayIntForc; set to display not defined; using previously defined set (total if None).'
            )
        vCompDisp = self.getIntForceComponentFromName(itemToDisp)
        elSet = self.xcSet.getElements.pickElemsOfDimension(2)
        if (len(elSet) > 0):
            propName = 'propToDisp_' + str(itemToDisp)
            for e in elSet:
                if (e.getDimension == 2):
                    e.getResistingForce()
                    mat = e.getPhysicalProperties.getVectorMaterials
                    e.setProp(propName,
                              mat.getMeanGeneralizedStressByName(vCompDisp))
                else:
                    lmsg.warning(
                        'QuickGraphics::displayIntForc; not a 2D element; ignored.'
                    )
            field = Fields.ExtrapolatedProperty(propName,
                                                "getProp",
                                                self.xcSet,
                                                fUnitConv=fConvUnits)
            defDisplay = self.getDisplay(viewDef)
            field.display(defDisplay=defDisplay,
                          fName=fileName,
                          caption=self.loadCaseName + ' ' + itemToDisp + ' ' +
                          unitDescription + ' ' + self.xcSet.description,
                          defFScale=defFScale)
Example #6
0
def displayFieldDirs1and2Base(limitStateLabel,
                              argument,
                              elementSet,
                              genDescr,
                              sectDescr,
                              component,
                              fUnitConv,
                              fileName,
                              captionTexts,
                              defFScale=0.0):
    '''Display a field defined over bi-dimensional elements in its two directions.

  :param limitStateLabel: label that identifies the limit state.
  :param argument: name of the control var to represent.
  :param xcSet: represent the field over those elements.
  :param genDescr: text to identify the set (i.e 'deck' or 'west wall').
  :param sectDescr: text list to identify each direction (as ['vertical reinforcement', 'horizontal reinforcement']).
  :param component: component of the control var to represent.
  :param fUnitConv: unit conversion factor (i.e N->kN => fUnitConv= 1e-3).
  :param fileName: file name to store the image. If none -> window on screen.
  :param captionTexts: dictionary of caption texts. 
  :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)
  '''
    defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
    attributeName = limitStateLabel + 'Sect1'  #Normal stresses limit state direction 1.
    field = Fields.getScalarFieldFromControlVar(attributeName, argument,
                                                elementSet, component,
                                                fUnitConv)
    captionBaseText = captionTexts[limitStateLabel] + ', ' + captionTexts[
        argument] + '. ' + genDescr.capitalize()
    field.display(defDisplay,
                  fName=fileName,
                  caption=captionBaseText + ', ' + sectDescr[0])

    attributeName = limitStateLabel + 'Sect2'  #Normal stresses limit state direction 2
    field = Fields.getScalarFieldFromControlVar(attributeName, argument,
                                                elementSet, component,
                                                fUnitConv)
    field.display(defDisplay,
                  caption=captionBaseText + ', ' + sectDescr[1],
                  defFScale=defFScale)
Example #7
0
    def displayDispRot(self,
                       itemToDisp='',
                       setToDisplay=None,
                       fConvUnits=1.0,
                       unitDescription='',
                       viewDef=vtk_graphic_base.CameraParameters(
                           'XYZPos', 1.0),
                       fileName=None,
                       defFScale=0.0,
                       rgMinMax=None):
        '''displays the component of the displacement or rotations in the 
        set of entities.

        :param itemToDisp: component of the displacement ('uX', 'uY' or 'uZ') 
                    or the rotation ('rotX', rotY', 'rotZ') to be depicted 
        :param setToDisplay:   set of entities to be represented (defaults to all 
                    entities)
        :param fConvUnits: factor of conversion to be applied to the results 
                    (defaults to 1)
        :param unitDescription: string describing units like '[mm] or [cm]'
        :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)
        :param rgMinMax: range (vmin,vmax) with the maximum and minimum values of 
              the field to be represented. All the values less than vmin are 
              displayed in blue and those greater than vmax in red
              (defaults to None)

        '''
        if (setToDisplay):
            self.xcSet = setToDisplay
        else:
            lmsg.warning(
                'QuickGraphics::displayDispRot; set to display not defined; using previously defined set (total if None).'
            )
        vCompDisp = self.getDispComponentFromName(itemToDisp)
        nodSet = self.xcSet.getNodes
        for n in nodSet:
            n.setProp('propToDisp', n.getDisp[vCompDisp])
        field = Fields.ScalarField(name='propToDisp',
                                   functionName="getProp",
                                   component=None,
                                   fUnitConv=fConvUnits,
                                   rgMinMax=rgMinMax)
        defDisplay = self.getDisplay(viewDef)
        defDisplay.displayMesh(xcSets=self.xcSet,
                               field=field,
                               diagrams=None,
                               fName=fileName,
                               caption=self.loadCaseName + ' ' + itemToDisp +
                               ' ' + unitDescription + ' ' +
                               self.xcSet.description,
                               defFScale=defFScale)
Example #8
0
 def defField(self, xcSet):
     print '********** Enters FigureDefinition::defField; limit state: ', self.limitStateLabel, ' attributeName= ', self.attributeName, ' xcSet.name= ', xcSet.name
     #self.field= Fields.ExtrapolatedScalarField(self.attributeName,"getProp",None,1.0,xcSet)
     self.field = Fields.getScalarFieldFromControlVar(
         attributeName=self.attributeName,
         argument=self.argument,
         xcSet=xcSet,
         component=None,
         fUnitConv=1.0,
         rgMinMax=None)
     print '********** Exits FigureDefinition::defField; limit state: ', self.limitStateLabel, ' attributeName= ', self.attributeName, ' xcSet.name= ', xcSet.name
Example #9
0
    def displayMaxPressures(self,
                            FEcase,
                            combs,
                            caption,
                            fUnitConv,
                            unitDescription,
                            rgMinMax=None,
                            fileName=None):
        '''Calculate and display the maximum earth pressures (Z direction)
        obtained from the group of load combinations passed as paremeter.

        :param FEcase: finite element problem
        :param combs: load cases to analyze and compare to obtain the maximum 
                    pressures.
        :param caption: caption text to diaplay.
        :param fUnitConv: factor to apply to results (unit conversion)
        :param unitDescription: text to display as unit description.
        :param rgMinMax: range (vmin,vmax) with the maximum and minimum values  
              of the scalar field (if any) to be represented. All the values 
              less than vmin are displayed in blue and those greater than vmax 
              in red (defaults to None)
        :param fileName: file name (defaults to None -> screen display)
        '''
        #Init max. pressures
        nodSet = self.foundationSet.getNodes
        for n in nodSet:
            n.setProp('maxSoilPressure', -1e10)
        #Calculate max. pressures
        for lc in combs:
            lcs = QGrph.QuickGraphics(FEcase)
            lcs.solve(loadCaseName=combs[lc].name, loadCaseExpr=combs[lc].expr)
            reac = self.calcPressures()
            for n in nodSet:
                prs = n.getProp('soilPressure')[2]
                if prs > n.getProp('maxSoilPressure'):
                    n.setProp('maxSoilPressure', prs)
        #Display max. pressures
        field = Fields.ExtrapolatedScalarField(name='maxSoilPressure',
                                               functionName='getProp',
                                               xcSet=self.foundationSet,
                                               component=None,
                                               fUnitConv=fUnitConv,
                                               rgMinMax=rgMinMax)
        defDisplay = vtk_FE_graphic.RecordDefDisplayEF()
        field.display(defDisplay,
                      caption=caption + ' ' + unitDescription,
                      fName=fileName)
Example #10
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
Example #11
0
#attributeName= limitStateLabel + 'Sect2'   #Shear limit state direction 2


#Possible arguments: 'CF', 'N', 'My', 'Mz', 'Mu', 'Vy', 'Vz', 'theta', 'Vcu', 'Vsu', 'Vu'
argument= 'CF'


# #Flatten values.
# if( "FCCP" in attributeName):
#   extrapolate_elem_attr.flatten_attribute(elemSet,attributeName,1,2)


displaySettings= vtk_FE_graphic.DisplaySettingsFE()
xcSet= deckSet
attributeName= limitStateLabel + 'Sect1'
field= Fields.getScalarFieldFromControlVar(attributeName,argument,xcSet,None,1.0)
field.plot(displaySettings,caption= 'Shear check '+ attributeName + '  '+xcSet.name+ '  '+argument)
attributeName= limitStateLabel + 'Sect2'
field= Fields.getScalarFieldFromControlVar(attributeName,argument,xcSet,None,1.0)
field.plot(displaySettings,caption= 'Shear check '+ attributeName + ' '+xcSet.name+ '  '+argument)
xcSet= foundationSet
attributeName= limitStateLabel + 'Sect1'
field= Fields.getScalarFieldFromControlVar(attributeName,argument,xcSet,None,1.0)
field.plot(displaySettings,caption= 'Shear check '+ attributeName + ' '+xcSet.name+ '  '+argument)
attributeName= limitStateLabel + 'Sect2'
field= Fields.getScalarFieldFromControlVar(attributeName,argument,xcSet,None,1.0)
field.plot(displaySettings,caption= 'Shear check '+ attributeName + ' '+xcSet.name+ '  '+argument)
xcSet= wallsSet
attributeName= limitStateLabel + 'Sect1'
field= Fields.getScalarFieldFromControlVar(attributeName,argument,xcSet,None,1.0)
field.plot(displaySettings,caption= 'Shear check '+ attributeName + ' '+xcSet.name+ '  '+argument)
Example #12
0
 def defField(self, xcSet):
   print '********** Enters FigureDefinition::defField; limit state: ', self.limitStateLabel, ' attributeName= ', self.attributeName, ' xcSet.name= ', xcSet.name
   #self.field= Fields.ExtrapolatedScalarField(self.attributeName,"getProp",None,1.0,xcSet)
   self.field= Fields.getScalarFieldFromControlVar(attributeName=self.attributeName,argument=self.argument,xcSet=xcSet,component=None,fUnitConv=1.0,rgMinMax=None)
   print '********** Exits FigureDefinition::defField; limit state: ', self.limitStateLabel, ' attributeName= ', self.attributeName, ' xcSet.name= ', xcSet.name