FeResPost Web Site                     FeResPost Online User Manual

IV.2.2.4 Adding Groups to a DataBase

In the examples of section IV.2.2.2, one initialized a DataBase and examined its Groups and the content of the Groups. In this example, one shows how the Groups can be manipulated, and the DataBase modified during the execution of the program.

The groups contained in session file “groups.ses” are not sufficient to suit our post-processing requirements. Indeed, it would be very practical if for each panel, a distinction between the skins and honeycomb could be made. We decide that it shall be done by adding new Groups to the DataBase. This problem can be solved in four steps:

1.
Initialization of a DataBase.
2.
Creation of Groups by association to materials.
3.
Creation of Groups by intersections and insertion in the DataBase.
4.
Printing of the Groups contained in the DataBase (for checking the result of the operation).

Steps 1 and 4 above correspond to the operation of the example presented in section IV.2.2.2. Therefore, one does not present those parts of the program here. One only gives explanation on steps 2 and 3.

The creation of “material Groups” is done by calling the DataBase “getElementsAssociatedToMaterialId” method. Three Groups are created, corresponding to honeycomb 50 kg/m3, honeycomb 72 kg/m3 and Aluminum 2024 T3 respectively. Practically this is programmed as follows:

# Groups created by Materials :  
 
   tmpGroup_Honey_50  = db.getElementsAssociatedToMaterialId(5)  
   tmpGroup_Honey_50 += db.getElementsAssociatedToMaterialId(4)  
   tmpGroup_Honey_50.Name="Honey_50"  
 
   tmpGroup_Honey_72 = db.getElementsAssociatedToMaterialId(6)  
   tmpGroup_Honey_72.Name="Honey_72"  
 
   tmpGroup_Al_2024 = db.getElementsAssociatedToMaterialId(3)  
   tmpGroup_Al_2024.Name="Al_2024"  
 
   tmpGroup_CFRP = db.getElementsAssociatedToMaterials(10000)  
   tmpGroup_CFRP.Name="CFRP"  
 
   matGroups = Array.new()  
   matGroups << tmpGroup_Honey_50  
   matGroups << tmpGroup_Honey_72  
   matGroups << tmpGroup_Al_2024  
   matGroups << tmpGroup_CFRP  
 
   db.addGroupCopy(tmpGroup_Honey_50)  
   db.addGroupCopy(tmpGroup_Honey_72)  
   db.addGroupCopy(tmpGroup_Al_2024)  
   db.addGroupCopy(tmpGroup_CFRP)

One can make a few remarks about the previous ruby lines:

After the creation of material Groups, one creates the other Groups by intersection (step 3). This is done as follows:

# Groups created by intersection :  
 
   panelGroupNames = Array.new()  
   panelGroupNames << "pan_MX"  
   panelGroupNames << "pan_MY"  
   panelGroupNames << "pan_MZ"  
   panelGroupNames << "pan_PX"  
   panelGroupNames << "pan_PY"  
   panelGroupNames << "pan_PZ"  
   panelGroupNames << "pan_SUP"  
 
   for panelGroupName in panelGroupNames  
      panelGroup = db.getGroupCopy(panelGroupName)  
      for matGrp in matGroups  
         newGrp = panelGroup * matGrp  
         newGrp.Name=panelGroupName+"_"+matGrp.Name  
         if newGrp.getEntitiesByType("Element").size > 0  
            db.addGroupCopy(newGrp)  
         end  
      end  
   end

Here again, a few commentaries can be done:

The example is given in file “RUBY/EX03/makeMatGroups.rb”.