def displayIntForcDiag(self, itemToDisp, setToDisplay=None, 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 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 == None): setToDisplay = self.modelSpace.getTotalSet() #auto-scale parameters LrefModSize = setToDisplay.getBnd(1.0).diagonal.getModulus( ) #representative length of set size (to autoscale) scaleFactor = self.outputStyle.internalForcesDiagramScaleFactor unitConversionFactor = self.outputStyle.getForceUnitsScaleFactor() unitDescription = self.outputStyle.getForceUnitsDescription() diagAux = cvd.ControlVarDiagram(scaleFactor=scaleFactor, fUnitConv=unitConversionFactor, sets=[setToDisplay], attributeName="intForce", component=itemToDisp) maxAbs = diagAux.getMaxAbsComp() if maxAbs > 0: scaleFactor *= 0.15 * LrefModSize / (maxAbs * unitConversionFactor) loadCaseName = self.modelSpace.preprocessor.getDomain.currentCombinationName captionText = loadCaseName + ' ' + itemToDisp + ' ' + unitDescription + ' ' + setToDisplay.description diagram = cvd.ControlVarDiagram(scaleFactor=scaleFactor, fUnitConv=unitConversionFactor, sets=[setToDisplay], attributeName="intForce", component=itemToDisp) diagram.addDiagram() defDisplay = vtk_FE_graphic.RecordDefDisplayEF() defDisplay.cameraParameters = self.getCameraParameters() defDisplay.setupGrid(setToDisplay) defDisplay.defineMeshScene(None, defFScale, color=setToDisplay.color) defDisplay.appendDiagram(diagram) #Append diagram to the scene. defDisplay.displayScene(caption=captionText, fileName=fileName)
def displayDiagram(attributeName,component, setToDispRes,setDisp,caption,scaleFactor= 1.0, fileName= None, defFScale= 0.0): '''Auxiliary function to display results on linear elements. :param attributeName: attribute name(e.g. 'ULS_normalStressesResistance') :param component: result item to display (e.g. 'N', 'My', ...) :param setToDispRes: set of linear elements to which display results :param setToDisplay: set of elements (any type) to be depicted :param scaleFactor: factor of scale to apply to the auto-scaled display (defaults to 1) :param caption: caption to display :param fileName: file to dump the display :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) ''' diagram= cvd.ControlVarDiagram(scaleFactor= scaleFactor,fUnitConv= unitConversionFactor,sets=[setToDispRes],attributeName= attributeName,component= component) diagram.addDiagram() displaySettings= vtk_FE_graphic.DisplaySettingsFE() displaySettings.cameraParameters=cameraParameters displaySettings.setupGrid(setToDisplay) displaySettings.defineMeshScene(None,defFScale,color=setToDisplay.color) displaySettings.appendDiagram(diagram) #Append diagram to the scene. displaySettings.displayScene(caption=caption,fileName=fileName)
def displayBeamResult(self, attributeName, itemToDisp, beamSetDispRes, setToDisplay=None, caption=None, fileName=None, defFScale=0.0): '''display results for beam elements from a limit state verification file. :param attributeName:attribute name(e.g. 'ULS_normalStressesResistance') :param itemToDisp: result item to display (e.g. 'N', 'My', ...) :param beamSetDispRes:set of linear elements to which display results :param setToDisplay: set of elements (any type) to be depicted (defaults to None, in that case only elements in beamSetDispRes are displayed) :param caption: caption to display (defaults to 'attributeName + itemToDisp') :param fileName: file to dump the display (defaults to screen display) :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) ''' #auto-scale parameters LrefModSize = setToDisplay.getBnd(1.0).diagonal.getModulus( ) #representative length of set size (to autoscale) lstArgVal = [ e.getProp(attributeName + 'Sect1')(itemToDisp) for e in beamSetDispRes.elements ] unitConversionFactor, unitDescription = self.outputStyle.getUnitParameters( itemToDisp) scaleFactor = 1.0 maxAbs = max(abs(max(lstArgVal)), abs(min(lstArgVal))) if (maxAbs > 0): scaleFactor *= 0.15 * LrefModSize / (maxAbs * unitConversionFactor) if not setToDisplay: setToDisplay = beamSetDispRes if not caption: if hasattr(beamSetDispRes, 'description'): descrSet = beamSetDispRes.description.capitalize() else: descrSet = '' caption = attributeName + ', ' + itemToDisp + '. ' + descrSet diagram = cvd.ControlVarDiagram(scaleFactor=scaleFactor, fUnitConv=unitConversionFactor, sets=[beamSetDispRes], attributeName=attributeName, component=itemToDisp) diagram.addDiagram() defDisplay = vtk_FE_graphic.RecordDefDisplayEF() defDisplay.cameraParameters = self.getCameraParameters() defDisplay.setupGrid(setToDisplay) defDisplay.defineMeshScene(None, defFScale, color=setToDisplay.color) defDisplay.appendDiagram(diagram) #Append diagram to the scene. defDisplay.displayScene(caption=caption, fileName=fileName)
#Load properties to display: preprocessor= model.getPreprocessor() fName= cfg.projectDirTree.getVerifCrackQpermFile() execfile(fName) execfile('../captionTexts.py') limitStateLabel= lsd.quasiPermanentLoadsCrackControl.label #Possible arguments: 'getCF', 'getMaxSteelStress' argument= 'getMaxSteelStress' setDispRes=colsSet #set of linear elements to which display results setDisp=xcTotalSet #set of elements (any type) to be displayed diagram= cvd.ControlVarDiagram(scaleFactor= 1,fUnitConv= 1,sets=[setDispRes.elSet],attributeName= limitStateLabel,component= argument) diagram.addDiagram() displaySettings= vtk_FE_graphic.DisplaySettingsFE() #predefined view names: 'XYZPos','XNeg','XPos','YNeg','YPos', # 'ZNeg','ZPos' (defaults to 'XYZPos') displaySettings.cameraParameters= vtk_graphic_base.CameraParameters('YPos') #Point of view. displaySettings.setupGrid(setDisp.elSet) displaySettings.defineMeshScene(None) displaySettings.appendDiagram(diagram) #Append diagram to the scene. caption= capTexts[limitStateLabel] + ', ' + capTexts[argument] + '. '+ setDispRes.genDescr.capitalize() + ', ' + setDispRes.sectDescr[0] displaySettings.displayScene(caption)
#Load properties to display: fName = cfg.projectDirTree.getVerifNormStrFile() execfile(fName) execfile('../captionTexts.py') limitStateLabel = lsd.normalStressesResistance.label #Possible arguments: 'CF', 'N', 'My', 'Mz' argument = 'CF' setDispRes = beamX #set of linear elements to which display results setDisp = overallSet #set of elements (any type) to be displayed diagram = cvd.ControlVarDiagram(scaleFactor=1, fUnitConv=1000, sets=[beamX], attributeName=limitStateLabel, component=argument) diagram.addDiagram() displaySettings = vtk_FE_graphic.DisplaySettingsFE() #predefined view names: 'XYZPos','XNeg','XPos','YNeg','YPos', # 'ZNeg','ZPos' (defaults to 'XYZPos') #displaySettings.cameraParameters= vtk_graphic_base.CameraParameters('YPos') #Point of view. displaySettings.setupGrid(setDisp) displaySettings.defineMeshScene(None, defFScale=0.0) displaySettings.appendDiagram(diagram) #Append diagram to the scene. caption = capTexts[limitStateLabel] + ', ' + capTexts[ argument] + '. ' + setDispRes.description.capitalize() + ', ' + 'Dir. 1' displaySettings.displayScene(caption)
fName = cfg.projectDirTree.getVerifShearFile() 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() displaySettings = vtk_FE_graphic.DisplaySettingsFE() #predefined view names: 'XYZPos','XNeg','XPos','YNeg','YPos', # 'ZNeg','ZPos' (defaults to 'XYZPos') displaySettings.cameraParameters = vtk_graphic_base.CameraParameters( 'ZPos') #Point of view. displaySettings.setupGrid(setDispRes) displaySettings.defineMeshScene(None) displaySettings.appendDiagram(diagram) #Append diagram to the scene.
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.DisplaySettingsFE() 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.name.capitalize() + ', ' + st.sectDescr[0] grFileNm = pathGr + st.name + arg + 'Sect1' field.display(displaySettings=dfDisp, caption=capt, fileName=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.name.capitalize() + ', ' + st.sectDescr[1] grFileNm = pathGr + st.name + arg + 'Sect2' field.display(displaySettings=dfDisp, caption=capt, fileName=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].elSet], attributeName=limitStateLabel, component=argS[0]) diagram.addDiagram() dfDisp.cameraParameters = vtk_graphic_base.CameraParameters(stV[1]) dfDisp.setupGrid(stV[0].elSet) dfDisp.defineMeshScene(None) dfDisp.appendDiagram(diagram) capt = capTexts[limitStateLabel] + ', ' + capTexts[ argS[0]] + '. ' + stV[0].genDescr.capitalize( ) + ', ' + stV[0].sectDescr[0] grFileNm = pathGr + stV[0].elSet.name + argS[0] dfDisp.displayScene(caption=capt, fileName=grFileNm + '.jpg') insertGrInTex(texFile=report, grFileNm=grFileNm, grWdt=grWdt, capText=capt) report.close() return
from postprocess.control_vars import * from postprocess import limit_state_data as lsd from postprocess.xcVtk.FE_model import vtk_FE_graphic from postprocess.xcVtk.diagrams import control_var_diagram as cvd execfile("../model_gen.py") #FE model generation #Load properties to display: execfile(cfg.projectDirTree.getVerifCrackFreqFile()) # 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) # End config diagram= cvd.ControlVarDiagram(scaleFactor=scaleFactor,fUnitConv=fUnitConv,sets=setsDispRes,attributeName=lsd.freqLoadsCrackControl.label,component=argument) diagram.addDiagram() displaySettings= vtk_FE_graphic.DisplaySettingsFE() displaySettings.setupGrid(setDisp) displaySettings.defineMeshScene(None,defFScale=0.0) displaySettings.appendDiagram(diagram) #Append diagram to the scene. caption= cfg.capTexts[lsd.freqLoadsCrackControl.label] + ', ' + cfg.capTexts[argument] + '. '+ setsDispRes[0].description.capitalize() + ', ' displaySettings.displayScene(caption)
modelDataInputFile = model_path + "test_export_internal_forces_beam_2d.py" #data for FE model generation execfile(modelDataInputFile) #Load properties to display: fName = cfg.projectDirTree.getVerifShearFile() execfile(fName) #execfile(model_path+'/captionTexts.py') defGrid = vtk_graphic_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() displaySettings = vtk_FE_graphic.DisplaySettingsFE() #displaySettings.windowHeight= 300 displaySettings.cameraParameters = vtk_graphic_base.CameraParameters( 'YPos') #Point of view.