IV.2.4.1 Inspecting Results contained in a DataBase
The following example prints the information on Results available in the DataBase. It starts with the
following lines:
require "FeResPost"
include FeResPost
#DataBase::disableLayeredResultsReading
#DataBase::disableSubLayersReading("Bottom")
#DataBase::disableSubLayersReading("Mid")
#DataBase::disableSubLayersReading("Top")
The commented lines are methods that disable partially or entirely the reading of composite
element layered Results. After reading the corresponding manual in section I.1.3.2, you may
un-comment some of these instructions to check the effect on the reading of composite
Results.
The main part of the example program looks like this:
# Reading or generating Results :
db.readOp2("../../MODEL/EXEC_OP2/unit_xyz.op2","Results")
db.generateCoordResults
db.generateCoordResults("Fake Coords Case","No SubCase","coords")
# Inspecting and reading Results :
db.each_resultKeyCaseId do |lcName|
printf("LOADCASE: ' "%s' "' n",lcName)
end
db.each_resultKeySubCaseId do |scName|
printf("SUBCASE: ' "%s' "' n",scName)
end
db.each_resultKeyLcScId do |lcName,scName|
printf("LOADCASE and SUBCASE: ' "%s' " - ' "%s' "' n",lcName,scName)
end
db.each_resultKeyResId do |resName|
printf("RESULT: ' "%s' "' n",resName)
end
db.each_resultKey do |lcName,scName,tpName|
tmpRes=db.getResultCopy(lcName,scName,tpName)
printf("%-20s%-15s%-50s%-10d' n",lcName,scName,tpName,'
tmpRes.Size)
end
It works as follows:
- The call to method “readOp2” loads Results into the DataBase.
- One also generate coordinate Results.
- Then one builds three lists containing the load cases, sub cases and type names of all
the Results contained in the DataBase. Those are three Array of String objects. Their
respective contents are printed.
- One uses several iterators that read the lists of load cases, subcases and Result identifiers
and prints the output.
- Using the iterator “each_resultKey” one obtains copy of the Results stored in the
DataBase, prints the corresponding key identifiers, and the corresponding size.
The example is provided in file “RUBY/EX04/printResLists.rb”.
Another example illustrating the reading of Results from a Nastran OP2 file is provided in file
“RUBY/EX04/printResLists_filter.rb”. This example illustrates the use of “readOp2FilteredResults”
method.