FeResPost Web Site                     FeResPost Online User Manual

X.F.3.1 Simple extraction of components

A new post-processing class is created to allow the presentation of dynamic Results. Actually, this class only extracts the magnitude and phase for one finite element entity and one component, and saves it into an Array, for later output in a text file. The class is called “PostExtract” and has only one member data: “extracts” in which the extracted Results shall be stored.

The “initialize” method calls the constructor of the parent class and initializes “extracts” to a void Hash:

    def initialize  
        super  
        @extracts = {}  
    end

Then the sequence of operations to perform the extractions is described below. It is performed by the “calcOneGroup” method:

    def calcOneGroup(db,lcName,scName,refName,grpContent,resName,  
                          extractMethod,csId,component)  
        ...

The method has nine arguments:

Then the following sequence of operations:

The class “PostExtract” also defines a method for the final processing of the values stored in “extracts” member data. This method, called “gnuplot” outputs the Results in text files created in “OUT_DYNAM” directory. Also, a “dat” file containing the gnuplot commands to create graphical outputs is created in the same directory. The name of this command file is the argument of “gnuplot” method:

    def gnuplot(datName)  
        gnuplotOs=File::open("OUT' _DYNAM/"+datName,"w")  
        gnuplotOs.printf("' nset terminal png' n' n")  
        @extracts.each do |key,tabs|  
            fileName="OUT' _DYNAM/"+key+".txt"  
            os=File::open(fileName,"w")  
            tabs.each do |mode,freq,mag,phase|  
                os.printf("%4d%15g%15g%15g' n",mode,freq,mag,phase)  
            end  
            os.close  
            gnuplotOs.printf("set output ' "%s_m.png' "' n",key)  
            gnuplotOs.printf("plot ' "%s.txt' " using 2:3 with lines' n",key)  
            gnuplotOs.printf("set output ' "%s_p.png' "' n",key)  
            gnuplotOs.printf("plot ' "%s.txt' " using 2:4 with points 1' n' n",key)  
        end  
        gnuplotOs.close  
    end