Week - 11 - Element quality check
Objective
The purpose of this challenge is to develop a tool that eases the process of checking the quality values on 2D and 3D elements.
Problem Statement
The problem consists of a visual interface where quality criteria can be written in boxes and then checked after pressing the corresponding button.
Tcl Code Explanation
# 2D procedures
# Create a procedure for each and every single mesh quality check
# Take this example
proc minlength {minlength} {
*clearmarkall 1; *clearmarkall 2;
*createmark elements 1 "displayed"
*elementtestlength elements 1 $minlength 2 1 2 0 "2D Length < "
*maskentitymark elements 2 0
*maskreverse elements
*createmark nodes 1 "displayed"
*nodemarkaddtempmark 1
*unmaskall
}
Just change the line of elementtestlength for whatever the quality check is supposed to do, for example:
*elementtestwarpage elements 1 $warpangle 2 2 0 "2D Warpage "
Create procedures for each check in 2D
proc minlength {minlength} {
proc maxlength {maxlength} {
proc warpage {warpangle}
proc aspect {aspect} {
proc skew {skewness} {
proc jacobian {jacobiann} {
proc minanglequad {interangleminquad} {
proc maxanglequad {interanglemaxquad} {
proc minangletria {interanglemintria} {
proc maxangletria {interanglemaxtria} {
and 3D, changing the dimension values where applicable
proc minlength3d {minlength} {
proc maxlength3d {maxlength} {
proc warpage3d {warpangle} {
proc aspect3d {aspect} {
proc skew3d {skewness} {
proc jacobian3d {jacobiann} {
proc minanglequad3d {interangleminquad} {
proc maxanglequad3d {interanglemaxquad} {
proc minangletria3d {interanglemintria} {
proc maxangletria3d {interanglemaxtria} {
# Create a window
set a .window
catch {destroy a}
toplevel $a -class TopClass
# Set the size ad position, set it as non-resizable
wm title $a "Quality Checks"
wm geometry $a 650x680+500+250; update
wm resizable $a 0 0
wm deiconify $a
# Create buttons, labels and entry boxes for each parameter and assign
# the procedures defined earlier to each button
label $a.31 -text "2D Parameters" -bg grey -font {times 10 bold}; place $a.31 -x 10 -y 10-width 200 -height 20
label $a.63 -text "Quality Criteria" -bg grey -font {times 10 bold};place $a.63 -x 430-y 10-width 200 -height 20
button $a.01 -text "Min Length - 2D" -command {minlength $minl}; place $a.01 -x 10-y 40 -width 200 -height 20
label $a.02 -text "Minimum Length - 2D " -bg grey -font {times 10 bold}; place $a.02 -x 220 -y 40 -width 200 -height 20
entry $a.03 -textvariable ::minl; place $a.03 -x 430 -y 40-width 200 -height 20
.
.
.
And so forth for all the quality criteria.
Run the macro
Conclusions
The creation of this code has helped us add even one more gadget to our toolbox, a mechanism that will eventually help reduce the chance of delivering meshes with bad quality.