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)
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
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)
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
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
#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)
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