GAMBIT - Journal commands to determine the edges for periodic face linking given face and vertex labels


While linking faces to make them periodic, a vertex from each face is to be chosen for linking. In interactive mode, when you select the face and edge with the mouse, Gambit internally determines the edge on that face for linking . However, if you use a journal file to do the same operation in batch mode, the edge does not get automatically selected for linking.

The following macro finds the edge needed and returns it in a string given the face and vertex labels.

This could be useful in templates that are built using journal files.
/Journal to determine the edges for periodic face linking given face and vertex labels
$falab = "face.1"
$verlab = "vertex.7"
declare $e[1:2]

/run the macro below once the face and vertex labels are known. The macro would return the
/edgeneded as an string.

macro start "find_edge"

$X = LISTENTITY(t_ed, t_fa, $falab)
$Y = LISTENTITY(t_ed, t_ve, $verlab)
$noedfa = PARAMSIZE("X")
$noedve = PARAMSIZE("Y")
$k = 1
$i =1
$j = 1
do para "$i" init 1 cond ($i .le. $noedve) incr 1

do para "$j" init 1 cond ($j .le. $noedfa) incr 1

$st = STRCMP($X[$j] , $Y[$i])
if cond ($st .EQ. 0)
$e[$k] = $X[$j]
$k = $k + 1
endif

enddo
enddo


do para "$i" init 1 cond ($i .le. $noedfa) incr 1

$st = STRCMP($e[1] , $X[$i])
if cond ($st .EQ. 0)
$findex = $i
endif

$st = STRCMP($e[2] , $X[$i])
if cond ($st .EQ. 0)
$sindex = $i
endif

enddo

if cond ($findex .gt. $sindex)

$edgeindex = $sindex

else

$edgeindex = $findex

endif

if cond ($findex .EQ. $noedfa)

if cond ($sindex .EQ. 1)

$edgeindex = $findex


endif
endif

if cond ($findex .EQ. 1)

if cond ($sindex .EQ. $noedfa)

$edgeindex = $sindex


endif
endif

$edgeneeded = $X[$edgeindex]

macro end





Show Form
No comments yet. Be the first to add a comment!