FeResPost Web Site                     FeResPost Online User Manual

IV.2.11.1 Reading BDF file and accessing superelements

Example “TESTSAT/RUBY/EX27/readBdf.rb” illustrates the reading of superelements from a BDF file, and the identification of the superelements that have been read.

One first examines a NastranDb object, before reading the model from a BDF file:

   db=NastranDb.new()  
   printf("db = %s' n",db.to_s)  
   printf("   db.SEID = %d' n",db.SEID)  
   printf("   db.refCounter = %d' n",db.RefCounter)  
   printf("   db.NbrSuperElements = %d' n",db.NbrSuperElements)

These instructions produce the following output:

db = DataBase: 0309CDD8  
   db.SEID = -1  
   db.refCounter = 1  
   db.NbrSuperElements = 0

As no model has been read, the number of superelements in the database is necessarily zero. SEID=-1, because the model is not yet “initialized” (read from a BDF or an OP2 file).

The output is different when our example model is read:

db=NastranDb.new()  
db.readBdf(bdfPath)  
printf("db = %s' n",db.to_s)  
printf("   db.SEID = %d' n",db.SEID)  
printf("   db.refCounter = %d' n",db.RefCounter)  
printf("   db.NbrSuperElements = %d' n",db.NbrSuperElements)

These instructions produce the following output:

db = DataBase: 030BF618  
   db.SEID = 0  
   db.refCounter = 1  
   db.NbrSuperElements = 8

After reading the model, the SEID is set to 0, which means that “db” points to a master DB (corresponding to residual model). The master database contains 8 superelements.

The following instructions:

   db2=db.getMaster()  
   printf("db2 = %s' n",db2.to_s)  
   printf("db2.class = %s' n",db2.class.to_s)

lead to the following output:

   db2 =  
   db2.class = NilClass

As “db” is a master database, the function “getMaster” returns a “nil” object.

On the other hand, the following instructions:

nbr=db.NbrSuperElements  
(0...nbr).each do |pos|  
    printf("   pos = %d' n",pos)  
    id=db.getSuperElementIdFromPos(pos)  
    printf("   id = %d' n",id)  
    sdb=db.getSuperElementFromPos(pos)  
    if pos==3 then  
        sdb3=sdb  
        db2=sdb3.getMaster()  
    end  
    GC.start  
    printf("   sdb = %s' n",sdb.to_s)  
    printf("   db2 = %s' n",db2.to_s)  
    printf("   db.SEID = %d' n",db.SEID)  
    printf("   sdb.SEID = %d' n",sdb.SEID)  
    if db2 then  
        printf("   db2.SEID = %d' n",db2.SEID)  
    end  
    printf("   refCounter = %d' n",db.RefCounter)  
end

produce information for the different superelement databases contained in the master database. For example, for pos=5, the output lines are:

   pos = 5  
   id = 12  
   sdb = DataBase: 0312C6E0  
   db2 = DataBase: 030BF618  
   db.SEID = 0  
   sdb.SEID = 12  
   db2.SEID = 0  
   refCounter = 4

“sdb” points to the superelement at position 5 in the list of superelements. Superelement ID is 12. “db2” is the master database of superelement at position 3 in the list of superelements (fourth superelement as first superelement is at position 0). This means that “db2” points to the master database that has been read from the BDF file.

The database references counter is printed at several places in the script. This has been done to check and debug reference counting. It works as expected with ruby extension. Note however that reference counting management is a little more tricky with Python, .NET assembly and COM component. We made some tests to check these and believe there is no program leak related to reference counting.