# Gridgen Journal File V1 (Gridgen 15.10 REL 1) # Created Tue May 08 17:53:19 2007 # package require PWI_Glyph 1.6.9 # # Copyright 2003 (c) Pointwise, Inc. # All rights reserved. # # This sample Gridgen script is not supported by Pointwise, Inc. # It is provided freely for demonstration purposes only. # SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE. # gg::tkLoad set scriptDir [file dirname [info script]] catch {source [file join $scriptDir pwiLogo.glf]} set nblks [llength [gg::blkGetAll]] if { $nblks == 0 } { puts "\n Sorry, can't compute number of points " puts " because there aren't any enabled blocks.\n" exit } set blklist [gg::blkGetAll] if {[llength $blklist] == 0} { tk_messageBox -icon error -title "No blocks" -message \ "There are no blocks defined." -type ok gg::abort } set PreserveGrid 1 set selectedBlk {} proc BlkSelect { } { global selectedBlk blklist wm withdraw . set add [gg::dispPick BLOCK -message "Select blocks for examination" -select $selectedBlk] foreach i $add { if { [lsearch $selectedBlk $i]==-1 } { lappend selectedBlk $i } } if {[winfo exists .]} { wm deiconify . } #if {0 == [llength $selectedBlk]} { # .buttons.ok configure -state disabled # } else { # .buttons.ok configure -state normal # } } proc report {} { global selectedDom selectedBlk set flag 0 foreach blk $selectedBlk { gg::blkReport $blk Report STRUCTURE set blkName [string trimright [gg::blkName $blk] " "] if {$Report(type) == "UNSTRUCTURED"} { set blkCellNum $Report(cellsTotal) gg::blkReport $blk Report SIZE set volAvg $Report(volumeAvg) set volMin $Report(volumeMin) set volBlk [expr $volAvg * $blkCellNum] if {$volMin < 0.0} { set flag 1 set result [tk_messageBox -parent .\ -title "Negative Volume Cell Warning"\ -type ok -icon warning \ -message "The block $blkName contains negative volume cells!"] } if {$volBlk < 0.0} { set flag 1 set result [tk_messageBox -parent .\ -title "Left-handed block detected"\ -type ok -icon error \ -message "The block $blkName is left-handed!"] } } else { set blkCellNum $Report(cellsTotal) gg::blkReport $blk Report SIZE set volMin $Report(volumeMin) gg::blkReport $blk Report JACOBIAN set jacNegNum $Report(jacobianNeg) if {$volMin < 0.0} { set flag 1 set result [tk_messageBox -parent .\ -title "Negative Volume Cell Warning"\ -type ok -icon warning \ -message "The block $blkName contains negative volume cells!"] } if {$jacNegNum == $blkCellNum } { set flag 1 set result [tk_messageBox -parent .\ -title "Left-handed block detected"\ -type ok -icon error \ -message "The block $blkName is left-handed!"] } } } if {$flag == 0} { set result [tk_messageBox -parent .\ -title "Good news"\ -type ok -icon info \ -message "Congratulations! No block is left-handed."] } } proc makeWindow {} { global blklist pack [frame .top] -fill both -padx 2 -pady 2 pack [label .top.lbl1 -text "Left-handed Block Detective" \ -wraplength 300 -justify center] -fill x -side top set font [.top.lbl1 cget -font] .top.lbl1 configure -font [font create -family [font actual $font -family] \ -weight bold] pack [label .top.caption -text "NOTE: 2D unstructured block cannot be examined."\ -wraplength 300] -pady 5 -padx 5 pack [frame .buttons] -fill x -padx 2 -pady 5 pack [button .buttons.cancel -text "Exit" -command { exit }] -side right -padx 15 pack [button .buttons.select -text "Select Blocks for Examination" -command \ {BlkSelect; report}] -side right -padx 10 if {![catch {pwiLogoCreate .buttons.logo 1} b]} { $b configure -bd 0 -relief flat pack $b -side left -padx 5 -fill y } bind . { exit } } makeWindow gg::tkLoop # # DISCLAIMER: # TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, POINTWISE DISCLAIMS # ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED # TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE, WITH REGARD TO THIS SCRIPT. TO THE MAXIMUM EXTENT PERMITTED # BY APPLICABLE LAW, IN NO EVENT SHALL POINTWISE BE LIABLE TO ANY PARTY # FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES # WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF # BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE # USE OF OR INABILITY TO USE THIS SCRIPT EVEN IF POINTWISE HAS BEEN # ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF THE # FAULT OR NEGLIGENCE OF POINTWISE. #