! ******************
! Edge Length Test
! ******************
!
! This test checks the edge length of an element
!
! Error if edge length is less then 1e-6
! Warning if edge length is less then 1e-3
!
/nopr
*get,_enum,elem,,count
!
! ******************************
!  Error and Warning Tolerances
! ******************************
!
_tolme = 1e-6		! error tolerance
!
_tolmw = 1e-3		! warning tolerance
!
! ****************
!
_ecount = 0		! initialize element counter
!
_count_err = 0		! counter for errors
_count_warn = 0		! counter for warnings
!
*do,_i,1,_enum
_ecount = elnext(_ecount)	! starting element number
!
 *do,_a,1,4		! bottom face do loop
!
! Bottom Face
!
!
_bnode1 = nelem(_ecount,_a)		! first node
_bnode2 = nelem(_ecount,mod(_a,4)+1)	! adjacent node
!
*if,_bnode1,ne,_bnode2,then		! check for same node location
!
_distb = abs(distnd(_bnode1,_bnode2))
!
 *if,_distb,lt,_tolme,then
/com Edge length (%_distb%) of element %_ecount% is smaller 
/com than the ERROR minimum EDGE LENGTH tolerance (%_tolme%) 
/com between nodes %_bnode1% and %_bnode2%.
_count_err = _count_err + 1		! increment error counter
!
  *elseif,_distb,lt,_tolmw
/com Edge length (%_distb%) of element %_ecount% is smaller 
/com than the WARNING minimum EDGE LENGTH tolerance (%_tolmw%)
/com between nodes %_bnode1% and %_bnode2%.
_count_warn = _count_warn + 1		! increment warning counter
!
 *endif
*endif
!
! Top face
!
_tnode1 = nelem(_ecount,(_a+4))		! first node
_tnode2 = nelem(_ecount,mod(_a,4)+5)	! adjacent node
!
*if,_tnode1,ne,_tnode2,then		! check for same node location
!
_distt = abs(distnd(_tnode1,_tnode2))
!
 *if,_distt,lt,_tolme,then
/com Edge length (%_distt%) of element %_ecount% is smaller 
/com than the ERROR minimum EDGE LENGTH  tolerance (%_tolme%) 
/com between nodes %_tnode1% and %_tnode2%.
_count_err = _count_err + 1		! increment error counter
!
  *elseif,_distt,lt,_tolmw
/com Edge length (%_distt%) of element %_ecount% is smaller 
/com than the WARNING minimum EDGE LENGTH tolerance (%_tolmw%) 
/com between nodes %_tnode1% and %_tnode2%.
_count_warn = _count_warn + 1		! increment warning counter
!
 *endif
*endif
!
! Sides
!
_snode1 = nelem(_ecount,_a)		! first node
_snode2 = nelem(_ecount,(_a+4))		! adjacent node
!
*if,_snode1,ne,_snode2,then		! check for same node location
!
_dists = abs(distnd(_snode1,_snode2))
!
 *if,_dists,lt,_tolme,then
/com Edge length (%_dists%) of element %_ecount% is smaller 
/com than the ERROR minimum EDGE LENGTH tolerance (%_tolme%) 
/com between nodes %_snode1% and %_snode2%.
_count_err = _count_err + 1		! increment error counter
!
  *elseif,_dists,lt,_tolmw
/com Edge length (%_dists%) of element %_ecount% is smaller 
/com than the WARNING minimum EDGE LENGTH tolerance (%_tolmw%) 
/com between nodes %_snode1% and %_snode2%.
_count_warn = _count_warn + 1		! increment warning counter
!
 *endif
*endif
!
 *enddo
*enddo
!
/com *****************************************
/com    EDGE LENGTH Error and Warning Summary
/com *****************************************
/com
/com Total Errors in Model:	%_count_err%
/com
/com Total Warnings in Model:	%_count_warn%
/com
/com *****************************************
!
_distb=
_distt=
_dists=
_count_err=
_count_warn=
_tolme=
_tol1e=
_tolmw=
_tol1w=
_ecount=
_enum=
_i=
_a=
_bnode1=
_bnode2=
_tnode1=
_tnode2=
_snode1=
_snode2=
!
/gopr
