next up previous contents index
Next: I.2 The ``CoordSys'' class Up: I. FeResPost Reference Manual Previous: I.0 Introduction   Contents   Index

Subsections


I.1 Generic ``DataBase'' class

Basically, a ``DataBase'' class is a container used to store a finite element model, Groups, Results, and other less important entities. The DataBase class also allow to retrieve, manipulate or modify these objects. The DataBase class is a generic class that cannot be instantiated. The specialized classes that inherit the generic DataBase class are described in Part III. Other solvers might be supported in the future. The class hierarchy is schematically represented in Figure I.1.1.

Figure I.1.1: Finite element DataBase classes hierarchy.
\begin{figure}
\centerline{%
\input{userManual/DataBase/XFIG/DbTree.pstex_t}}
\end{figure}

As three classes are represented in Figure I.1.1, the methods described in this Chapter may belong to the generic DataBase class or to the derived classes. A few basic principles should help the user to ``guess'' in which class some of the methods are defined:

Throughout the Chapter one specifies for the different methods, in which class they are defined. This Chapter is divided in several sections:

A list of the methods defined in ``DataBase'' class is given in Table I.1.1.

Table I.1.1: The different methods that have been defined in ``DataBase'' class. userManual.DataBase.methods.tab
(FeResPost list of classes is given in Table 1 page [*].)
Method Name Description Example
     
Creation and initialization methods
(new) I.1.1  
(initialize) I.1.1  
(clone) I.1.1  
DataBase.checkCoordSysExistscheckCoordSysExists I.1.1  
DataBase.checkElementExistscheckElementExists I.1.1  
DataBase.checkNodeExistscheckNodeExists I.1.1  
DataBase.checkRbeExistscheckRbeExists I.1.1  
DataBase.getElementTypegetElementType I.1.1  
DataBase.getElementTypeNamegetElementTypeName I.1.1  
DataBase.getElementDimgetElementDim I.1.1  
DataBase.getElementNbrNodesgetElementNbrNodes I.1.1  
DataBase.getElementNbrCornerNodesgetElementNbrCornerNodes I.1.1  
DataBase.getElementNodesgetElementNodes I.1.1  
DataBase.getElementCornerNodesgetElementCornerNodes I.1.1  
Attributes
DataBase.NameName I.1.7 IV.2.2.1
DataBase.NbrCoordSysNbrCoordSys I.1.1  
DataBase.NbrElementsNbrElements I.1.1  
DataBase.NbrNodesNbrNodes I.1.1  
DataBase.NbrAbbreviationsNbrAbbreviations I.1.4  
DataBase.NbrGroupsNbrGroups I.1.2.1  
Manipulation of Results
DataBase.getResultLoadCaseNamesgetResultLoadCaseNames I.1.3.1 ``EX09/modifCS3D.rb''
DataBase.getResultSubCaseNamesgetResultSubCaseNames I.1.3.1 ``EX09/modifCS3D.rb''
DataBase.getResultTypeNamesgetResultTypeNames I.1.3.1 ``EX09/modifCS3D.rb''
DataBase.checkResultExistscheckResultExists I.1.3.1  
DataBase.getResultSizegetResultSize I.1.3.1  
DataBase.addResultaddResult I.1.3.1  
DataBase.generateCoordResultsgenerateCoordResults I.1.3.1 IV.2.4
DataBase.generateElemAxesResultsgenerateElemAxesResults I.1.3.1  
DataBase.buildLoadCasesCombilibuildLoadCasesCombili I.1.3.1 ``PROJECTb/DATA/loadCases.rb''
DataBase.renameResultsrenameResults I.1.3.1  
DataBase.copyResultscopyResults I.1.3.1  
DataBase.removeResultsremoveResults I.1.3.1 ``PROJECTb/DATA/loadCases.rb''
DataBase.removeAllResultsremoveAllResults I.1.3.1  
DataBase.getResultCopygetResultCopy I.1.3.1 IV.2.4.2
DataBase.enableLayeredResultsReadingenableLayeredResultsReading I.1.3.2  
DataBase.disableLayeredResultsReadingdisableLayeredResultsReading I.1.3.2 IV.2.4
DataBase.enableSubLayersReadingenableSubLayersReading I.1.3.2  
DataBase.disableSubLayersReadingdisableSubLayersReading I.1.3.2 IV.2.4
Manipulation of Groups
DataBase.readGroupsFromPatranSessionreadGroupsFromPatranSession I.1.2.1 IV.2.2.2
DataBase.writeGroupsToPatranSessionwriteGroupsToPatranSession I.1.2.1 IV.2.2.2
DataBase.addGroupCopyaddGroupCopy I.1.2.1 IV.2.2.4
DataBase.getAllGroupNamesgetAllGroupNames I.1.2.1 IV.2.2.2
DataBase.checkGroupExistscheckGroupExists I.1.2.1  
DataBase.getGroupCopygetGroupCopy I.1.2.1 IV.2.2.2
DataBase.eraseGrouperaseGroup I.1.2.1  
DataBase.eraseAllGroupseraseAllGroups I.1.2.1  
DataBase.getGroupAllElementsgetGroupAllElements I.1.2.1  
DataBase.getGroupAllNodesgetGroupAllNodes I.1.2.1  
DataBase.getGroupAllRbesgetGroupAllRbes I.1.2.1  
DataBase.getGroupAllCoordSysgetGroupAllCoordSys I.1.2.1  
DataBase.getGroupAllFEMgetGroupAllFEM I.1.2.1 IV.2.4.4
Manipulation of abbreviations
DataBase.clearAbbreviationsclearAbbreviations I.1.4  
DataBase.addAbbreviationaddAbbreviation I.1.4  
DataBase.addAbbreviationsaddAbbreviations I.1.4  
DataBase.AbbreviationsAbbreviations I.1.4  
DataBase.getAbbreviationgetAbbreviation I.1.4  
DataBase.checkAbbreviationExistscheckAbbreviationExists I.1.4  
DataBase.getAbbreviationsgetAbbreviations I.1.4  
CLA methods
DataBase.getClaDbgetClaDb I.1.5 IV.5.1
DataBase.calcFiniteElementResponsecalcFiniteElementResponse I.1.5 IV.5.6
DataBase.calcFiniteElementCriteriacalcFiniteElementCriteria I.1.5 IV.5.6
DataBase.calcFemLamPropertiescalcFemLamProperties I.1.5  
Iterators
DataBase.each_abbreviationeach_abbreviation I.1.6  
DataBase.each_groupNameeach_groupName I.1.6 IV.2.2.2
DataBase.each_resultKeyeach_resultKey I.1.6 IV.2.4
DataBase.each_resultKeyCaseIdeach_resultKeyCaseId I.1.6 IV.2.4
DataBase.each_resultKeySubCaseIdeach_resultKeySubCaseId I.1.6 IV.2.4
DataBase.each_resultKeyLcScIdeach_resultKeyLcScId I.1.6 IV.2.4
DataBase.each_resultKeyResIdeach_resultKeyResId I.1.6 IV.2.4
Write methods
DataBase.to_sto_s I.1.7  
DataBase.writeGmshwriteGmsh I.1.8 IV.2.5.4
DataBase.writeGmshMeshwriteGmshMesh I.1.8 IV.2.5.4
Attributes
DataBase.NameName I.1.7  
     


I.1.1 Methods for FEM definition

No generic ``DataBase'' object can be created because ``DataBase'' class cannot be instantiated. This means that a statement like:

    db=DataBase.new()
leads to an error message. All the methods described in this section are defined in the specialized versions of the DataBase class. So no ``DataBase.newnew'', ``DataBase.initializeinitialize'' or ``DataBase.cloneclone'' method is defined in DataBase class.

One defines three methods that allow to retrieve the number of entities of certain types stored in DataBase FE model:

Each of these methods has no argument and returns an integer. Other methods allow to check the existence of finite element entities: Each of these four methods has one integer argument corresponding to the entity the existence of which is checked.

Several methods allow to retrieve elements information. Each of the following methods has one integer argument corresponding to the element ID:

Normally one class corresponds to each solver supported by FeResPost. The preferences for the different supported solvers are described in Part III.


I.1.2 ``Group'' methods

Groups can be stored in, and retrieved from a DataBase object. One presents here the methods defined in generic class DataBase, or in its derived classes, and that are devoted to the manipulation of Group objects. In the DataBase, the Group objects are stored in a mapping associating their names to the Group. This association allows to retrieve the Group when needed.

One makes the distinction between the simple manipulation of Groups described in section I.1.2.1 and the more complicated operation where new Groups are created by association operations (section I.1.2.2). The methods related to these associative operations are often defined in the specialized versions of the Database class.


I.1.2.1 Simple manipulation of Groups

One describes here methods that allow the manipulation of Groups stored in a generic DataBase object. All the methods described in this section are defined in generic DataBase class. These methods are described below:


I.1.2.2 Construction of Groups by association operations

This section is devoted to methods that allow the construction of a new Group by selecting entities associated to other entities of the finite element model. For all these methods, the association is checked by inspection of the finite element model stored in the DataBase. Therefore, these methods are defined in the specialized version of the ``DataBase'' class. Therefore, these methods are systematically defined in specialized versions of the ``DataBase'' class. For each supported solver, a description of these methods is given. (See Part III.)


I.1.3 ``Result'' methods

As explained in the introduction of this Chapter, the DataBase can be used to store Results. Internally, a mapping between keys and Results allows to associate Result objects to an identifier. Each keyI.11 is characterized by three String objects corresponding respectively to the load case name, to the subcase name and to the Result type name.


I.1.3.1 Manipulation of Results

The class ``Result'' is described in Chapter I.4. In this section, one describes the methods of the generic ``DataBase'' class that deal with ``Result'' objects. The ``Result'' methods are:

Methods devoted to the importation of Results from binary Results files are specific to the peculiar solver that produced the Results. These methods are described in Part III.


I.1.3.2 Enabling composite Results reading operations

Four singleton methods allow to enable or disable partially or totally the reading of composite layered Results from finite element result files. These methods influence the behavior of methods defined in the ``specialized'' versions of the ``DataBase'' class. (See Part III.) The four methods are:

By default the reading of layered composite Results is enabled for all sub-layers. The disabling may help to reduce the size of Results stored in specialized DataBases. Actually, the reading of composite results is no longer mandatory as most composite results can be produced with the appropriate methods of the ``CLA'' classes (Part II).


I.1.4 Manipulation of abbreviations

When a Samcef banque is read into a DataBase, the abbreviations defined in the Samcef model are read as well and stored into the Samcef DataBase in a mapping of string objects. Five methods allow the manipulation of abbreviations stored in the DataBase:

  1. ``DataBase.clearAbbreviationsclearAbbreviations'' has no argument and clears all the abbreviations stored into the DataBase.
  2. ``DataBase.addAbbreviationaddAbbreviation'' adds one abbreviation to the DataBase. The method has two String arguments: the key and the value.
  3. ``DataBase.addAbbreviationsaddAbbreviations'' adds a list of abbreviations to the DataBase. The method has one argument: A Hash object containing the correspondence between keys and values. Each pair is of course a pair of String objects.
  4. ``DataBase.NbrAbbreviationsNbrAbbreviations'' attribute has no argument and returns the number of abbreviations stored in the DataBase.
  5. ``DataBase.getAbbreviationgetAbbreviation'' returns the String value of one abbreviation. The method has one String argument: the key of the abbreviation.
  6. ``DataBase.checkAbbreviationExistscheckAbbreviationExists'' returns ``true'' if the abbreviation exists. The method has one String argument: the key of the abbreviation.
  7. ``DataBase.getAbbreviationsgetAbbreviations'' returns a Hash object containing all the abbreviations stored in the DataBase. This method has no argument.
Note that, even though no abbreviation is defined in other solver models, the abbreviation methods defined in DataBase class can also be used when one works with all models. This is why the methods listed above are defined in generic ``DataBase'' class and not in ``SamcefDb'' class described in Chapter III.2.


I.1.5 Composite methods

The DataBase Class provides one method that returns a ClaDb object corresponding to the materials, plies and Laminates stored in the DataBase. This method is called ``DataBase.getClaDbgetClaDb'' and has no argument. The units associated to this ClaDb object are the default units as defined in Table II.1.4. If the finite element model is defined in another unit system, it is the responsibility of the user to define correctly the units of the ClaDb database and of all its entities using the method ``ClaDb.setUnitsAllEntitiessetUnitsAllEntities'' of ClaDb class. (See section II.2.4.)

Another method corresponding to the calculation of Results related to laminate load response has been added. This method called ``DataBase.calcFiniteElementResponsecalcFiniteElementResponse'' has the same arguments as the corresponding method defined in the ``ClaLam'' class. The method and the meaning of its arguments are described in section II.4.8. The method defined in ``DataBase'' class differs from the one defined in ``ClaLam'' class by the fact that the algorithm tries to retrieve the Laminate corresponding to the element to which Result values are attached. The information is found in the DataBase object. More precisely, The algorithm performs as follows:

Similarly, one defined the method ``DataBase.calcFiniteElementCriteriacalcFiniteElementCriteria'' which has exactly the same arguments and outputs as the corresponding method of ``ClaLam'' class described in section II.4.8. The difference between the two methods resides in the fact that the method in DataBase class retrieves the ClaLam object corresponding to the element to which the tensorial values are attached.

Finally, a third method allows to retrieve laminate engineering properties in the format of Result objects. The method ``DataBase.calcFemLamPropertiescalcFemLamProperties'' has three arguments:

  1. A ClaDb object which is used for the calculations of the different laminate properties.
  2. A ResKeyList object that corresponds to the finite element entities for which values shall be inserted in Result object. Note that the produced Result object are non layered. (Only the ElemId and NodeId of the ResKeyList keys matter.)
  3. A Hash with String keys and values corresponding to the requests. The key corresponds to the name by which the returned Result shall be referred. The value corresponds to the laminate engineering property that is requested. Presently, possible values of this parameter are: ``E_f_xx'', ``E_f_yy'', ``E_k0_xx'', ``E_k0_yy'', ``E_xx'', ``E_yy'', ``G_f_xy'', ``G_k0_xy'', ``G_xy'', ``nu_f_xy'', ``nu_f_yx'', ``nu_k0_xy'', ``nu_k0_yx'', ``nu_xy'', ``nu_yx'', ``thickness'', ``surfacicMass'', ``averageDensity''.
The method returns a Hash with String keys and Result values.

An example of use of this method follows:

    ...
    compDb=db.getClaDb
    
    res=db.getResultCopy("COORD","coord","coordinates")
    rkl=res.extractRkl
    
    requests={}
    requests["res1"]="thickness"
    requests["res2"]="E_xx"
    requests["res3"]="E_yy"
    
    resList=db.calcFemLamProperties(compDb,rkl,requests)
    
    resList.each do |id,res|
        Util.printRes(STDOUT,id,res)
    end
    ...

For the different ``finite element'' methods listed above, the units considered for the returned ``Result'' objects are the units of the ``ClaDb'' object argument. This characteristic differs from the behavior of the corresponding methods in ``ClaLam'' class.


I.1.6 Iterators

One describes here the iterators of the generic DataBase class only. The iterators of the specialized versions of the class are described in Part III.


I.1.7 General purpose methods

A few more methods with general purpose are defined:

These methods are defined in the generic ``DataBase'' class.


I.1.8 ``Gmsh'' methods

The ``DataBase.writeGmshwriteGmsh'' method defined in generic ``DataBase'' class is used to create a Gmsh result file in which parts of the model and of the Results are saved for later visualization. The purpose of the method is to allow the user to visualize parts of the model and Results. An example of use of the method is as follows:

    db.writeGmsh("brol.gmsh",0,[[res,"stress","ElemCenters"],\
                                         [displ,"displ","Nodes"]],\
                                        [[skelGrp,"mesh slat"]],\
                                        [[skelGrp,"skel slat"]])
The method has six parameters:
  1. A string containing the name of the file in which the model and Results will be output.
  2. An integer corresponding to the id of a coordinate system in which the positions are located and in which the components of Result values are expressed. The coordinate system must be defined in the dataBase db and must be a rectangular one.
  3. An Array containing the Results to be stored in Gmsh file. Each element of the Array is An Array of three elements:
  4. An Array containing the Meshes to be stored in Gmsh file. Each element of the Array is An Array of two elements:
  5. An Array containing the parts of the model for which a ``skeleton'' shall be saved in the Gmsh file. (A skeleton is a representation of the mesh with only a few edges.)
  6. A logical parameter specifying whether a binary output is requested. If the parameter is ``true'' a binary output is done, otherwise, the output is an ASCII one. The parameter is optional and binary output is the default. A binary output is significantly faster than an ASCII one.
Parameters 3, 4 and 5 are optional. They can be a void Array or replaced by nil argument. All the last nil parameters may be omitted. Parameter 6 is optional too. If no pair of key-values is found for a Result to be printed. Nothing is output in the gmsh file.

It is the responsibility of the user to provide Results that associate values to a single valid key. Otherwise, an error message is issued and exception is thrown. In particular, as Results written in GMSH files are not layered, the user should be careful not to output multi-layered Results. The details in error message output are controlled by the debugging verbosity level. (See I.6.6.)

The ``DataBase.writeGmshMeshwriteGmshMesh'' method defined in generic ``DataBase'' class saves a Gmsh mesh file. The method has up to four arguments (last argument is optional):

  1. A String containing the name of the file in which the mesh is output.
  2. An integer argument corresponding to the coordinate system in which the nodes are expressed.
  3. A Group corresponding to the entities to be saved in the mesh file.
  4. An optional Boolean argument specifying whether the mesh is output in binary format. The default value of the argument is ``true'' and corresponds to a binary output.
An example of use follows:
        db.writeGmshMesh("brol.msh",0,skelGrp,false)


next up previous contents index
Next: I.2 The ``CoordSys'' class Up: I. FeResPost Reference Manual Previous: I.0 Introduction   Contents   Index
FeResPost 2017-05-28