X.F.4 Main function
"testSat" method is slightly more complicated than before:
def testSat
db=LoadCases.getDb("LAUNCH")
GenPost::each do |current|
if current.respond_to?("preCalc") then
current.preCalc(db)
end
end
GC.start
version="All"
LoadCases.each(version) do |db,lcName,scName|
GenPost::each do |current|
if current.respond_to?("calcAll") then
current.calcAll(db,lcName,scName)
end
end
GC.start
end
db=LoadCases.getDb("LAUNCH")
GenPost::each do |current|
if current.respond_to?("postCalc") then
current.postCalc(db)
end
end
GC.start
end
The "GenPost" iterator is used to loop on the different object of class "GenPost" or of one of its
derived classes. This iterator is called three times:
-
1.
- The first time "GenPost" iterator is used, one checks the existence of “preCalc” method
in each object to perform preliminary operations before the loop on load case.
-
2.
- Then, the iterator is called inside the loop on load cases to perform the operations required
for each load case.
-
3.
- The third time the iterator is called, this is done outside the load cases loop. Then the
instance method "postCalc" is called to perform the operations that are to be done at the
very end of the program. In the example, this operation corresponds to the printing of the
maps of critical margins.
Note that “preCalc”, “calcAll” and “postCalc” methods are now instance methods. This means they are
specific to a particular instance of the classes. Note also, that the availability of these instance methods
is tested before the method is called.
The “testSat” example is defined in “testSat.rb” file. Similarly, a “dynam.rb” file is defined to
provide an example for dynamic analysis. ‘dynam.rb” is very similar to “testSat.rb”, but the file calls
another version of the LoadCases and includes other data for post-processing:
require "DATA/data_Post_accel"
require "DATA/data_Post_cbush"
One should keep in mind that the data for dynamic Results post-processing are generally very
different than the data for Static load cases post-processing. This justifies that separate “main” data
files are written for these different categories of load cases.