prolem with lappend and eval

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
funfo
Posts: 4
Joined: Wed Oct 21, 2015 11:38 am
Location: Politecnico di Torino

prolem with lappend and eval

Post by funfo »

Dear all,
I'm creating a model and I am following some examples. I cannot find the significance of the commands "lappend" and "eval". Can someone tell me where I can find a description? Thank you in advance. I report a short example below (I don't need help with this code, I just put an example from which I've read those commands):

set nodeList {}
for {set i 0} {$i < $numYnode} {incr i 1} {
lappend nodeList [expr $numXnode/2 + $i*$numXnode]
}

eval "recorder Node -file disp -time -node $nodeList -dof 1 2 -dT $deltaT disp"

for {set i 1} {$i < $numYnode} {incr i 1} {
set ele [expr $numXele-$numXele/2+($i-1)*$numXele]
set name11 [join [list $name1 $i] {}]
set name21 [join [list $name2 $i] {}]
recorder Element -ele $ele -time -file $name11 -dT $deltaT material 1 stress
recorder Element -ele $ele -time -file $name21 -dT $deltaT material 1 strain
}
Jeena
Posts: 50
Joined: Tue Mar 19, 2013 12:40 pm
Location: Virginia Tech

Re: prolem with lappend and eval

Post by Jeena »

Hi,

'lappend' and 'eval' are tcl language commands ..

For 'lappend', check http://wiki.tcl.tk/1479 .. The command actually add a new item to an already defined vector or matrix .. In your code nodeList is an empty vector/matrix. For each increment inside the for loop, lapped add a new row to the initially defined vector.

For 'eval' check http://wiki.tcl.tk/1017

Thanks,
Jeena
funfo
Posts: 4
Joined: Wed Oct 21, 2015 11:38 am
Location: Politecnico di Torino

Re: prolem with lappend and eval

Post by funfo »

Thank you very much!!!
Post Reply