FeResPost Web Site                     FeResPost Online User Manual

IV.3.7 Modifying units

The example illustrates the manipulation of CLA objects units. The example is presented in directory “TESTSAT/RUBY/EX18’, in file “testMatUnits.rb”.

The sequence of operations is simple:

The two files “oldUnits.txt” and “newUnits.txt” may be compared. They should contain equivalent results.

The part of interest of the example is the modification units for all the materials in the database:

    oldUnits=db.getUnits  
 
    newUnits=oldUnits.clone  
    newUnits["F"]="lbf"  
    newUnits["L"]="mm"  
    newUnits["T"]="oF"  
 
    puts oldUnits  
    puts newUnits  
 
    db.each_material do |id,mat|  
        mat.changeUnits(newUnits)  
        db.insertMaterial(mat)  
    end

(Note that in the example, one deliberately decided not to use the “changeUnitsAllMaterials” method of the ClaDb class.)

The user may test the outputs with or without units systems modifications to verify if the results are affected by the modification of units. (They should not be modified.)