FeResPost Web Site                     FeResPost Online User Manual

I.4.12 Iterators

Three iterators are defined in the class:

For the meaning of the arguments, see more information in section I.4.10. One difference between the “each” iterator and the getData method is that the key and values elements are separated into two Arrays in the block. So the iterator is to be used as follows:

    strain.each("int","int","int") do |key,values|  
        ...  
    end  
    ...  
    strain.each("int","int","string","string") do |key,values|  
        ...  
    end

Note that, as the “each_key” and “each_values” iterators return Arrays, one can indifferently recover an Array argument, or its elements in the arguments of the block that follows the iterator. For example, in the following lines:

    stress.each_key do |stressKey|  
        ...  
    end

“stressKey” is an Array of three elements. However in the following lines:

    stress.each_key("int","int","int") do |elemId,nodeId,layerId|  
        ...  
    end

the arguments correspond to the different identifiers of the Result key.