One example illustrating the use of some of the iterators defined in DataBase class. The following lines print the elements connectivity:
db.each_elemId do |elemId|
STDOUT.printf(" %d =>",elemId)
db.each_nodeOfElement(elemId) do |nodeId|
STDOUT.printf(" %d",nodeId)
end
STDOUT.printf("\n")
end
Two iterators have been used in the calculation: “each_elemId” and “each_nodeOfElement”. A second version of the loop restricts the printing of connectivity to corner nodes only.
The example is given in file “RUBY/EX16/elemConnectivity.rb”.
An iterator is also used in example “RUBY/EX03/properties.rb”. In that example, the “fillCard” method is used of NastranDb class to obtain the definition of the properties in the model:
db.each_propertyId do |id|
puts "Property",id
card=db.fillCard("Property",id)
puts card
end
(See section III.1.1.6 for the definition of “fillCard” method.)