FeResPost Web Site                     FeResPost Online User Manual

III.1.1.10 Attaching “XDB” files to a Nastran DataBase

Since version 3.4.0, FeResPost allows a random access to XDB result files. This method is more efficient than the methods that import XDB Results into the DataBase, and extracting copies of these Results. A peculiar case in which the random access methods will be more efficient is when only some small parts of the XDB file are of interest to the programmer.

The principle of random access is the same as the attachment of XDB files to a Patran DataBase:

The different methods called to perform these operations are described in the following sub-sections. These methods correspond more or less to the methods described in section III.1.1.9.

III.1.1.10.1 Managing XDB file attachments

The method “attachXdb” is used to attach an XDB file to the Nastran DataBase. This method has up to two arguments:

1.

The first argument is a String containing the name of the XDB file. (Full path name must be provided.)

2.

The second argument is an optional Boolean parameter specifying whether the endianness must be swapped when XDB file content is read. If the parameter is not given, the endianness of the file is automatically detected. Note however that this check might fail. (See also page 798 for more information.)

Several other methods are used to manage the Xdb attachments to a DataBase:

III.1.1.10.2 Extracting information of XDB file attachments

The following methods extract information related to the Results stored in an XDB file attached to the DataBase:

All these methods have a single String argument containing the name of the XDB file that must have been previously attached to the DataBase. On the other hand, the following methods have one or two arguments:

The first argument is the name of the XDB file that must have been previously attached to the DataBase. The second argument is optional and corresponds to the name of a load case found in the attached XDB file. If the argument is not provided, all the load cases are investigated to build the list of sub-cases or Result names or IDs. If the argument is provided, only the sub-cases or Results of the corresponding load case are considered. If the provided load case does not exist in XDB attachment an error message is issued.

III.1.1.10.3 Extracting Results From XDB file attachments

The method “getAttachmentResults” is used to read Results from the XDB file. The Results are directly returned by the method to the caller in a Hash object. They are not inserted in the DataBase from which the method is called.

The method has minimum four arguments:

1.

A String corresponding to the name of XDB file attachment from which Results are read. (This file must have been previously attached to the DataBase.)

2.

A String corresponding to the name of the load case for which Results are read.

3.

A String or an Array of Strings corresponding to the names of sub-cases for which Results are read.

4.

A String or an Array of Strings corresponding to the names of Results for which Results are read. The Result name provided as arguments must be considered as “filters” or “hints” indicating which kind of Results are extracted. Practically, FeResPost checks whether possible extracted Results contain one of the Strings provided as argument. For example, that the Request “Stress Tensor” matches several Results:

On the other hand, the request “Stress Tensor (RI)” matches only “Stress Tensor (RI)”, and not “Stress Tensor” or “Stress Tensor (MP)”.

The other arguments are optional and correspond to the specification of target entities for which Results are read. Actually, the reading operation from an XDB combines the reading and some of the extraction operations described in section I.4.3. For example:

If only four parameters are provided in the call to “getAttachmentResults” method, all the pairs of key-values found in the XDB file are inserted in the list of returned Results.

Only lists below the list of valid calls to “getAttachmentResults”:

    h=db.getAttachmentResults(xdbName,lcName,scNames,resNames,
            method,grpTarget[,layers[,subLayers]])
    h=db.getAttachmentResults(xdbName,lcName,scNames,resNames,
            resTarget)
    h=db.getAttachmentResults(xdbName,lcName,scNames,resNames,
            rklTarget)
    h=db.getAttachmentResults(xdbName,lcName,scNames,resNames
            [,layers[,subLayers]])

When Results are extracted from an XDB attachment on a Group, the “Method” argument may influence the efficiency of Results extraction. When possible, a real random access is performed, otherwise, entire tables must be read to ensure that all eligible Result values are loaded. For example:

It is the responsibility of the post-processing programmer to try to provide the arguments in order to select the most efficient algorithm for Results extraction.

Note that “Grid Point Forces” are always sorted by nodes. This is true for the applied loads, the MPC/SPC forces and moments, as well as for the internal forces and moments. (Even though these last contain forces by elements and nodes.) This mean that for the selection of extraction algorithm, “Grid Point Forces” should always be considered as nodal Results.

As several Result types, and sub-case names can be given as argument to “getAttachmentResults” method, this method can return several Results. This is why Results are returned in a Hash:

For example, the list of extracted Result sizes can be printed with the following statements:

    h=db.getAttachmentResults(xdbFileName,lcName,scNames,resNames,"Nodes",grp)
    h.each do |id,res|
        lcName=id[0]
        scName=id[1]
        resName=id[2]
        size=res.Size
        STDOUT.printf("%s - %s - %s : %d\n",lcName,scName,resName,size)
        #~ Util::printRes(STDOUT,"brol",res)
    end

The method “getAttachmentResultsCombili” is used to extract linear combinations of elementary Results found in one or several XDB files. As for method “getAttachmentResults” the Results are directly returned by the method to the caller. They are not inserted in the DataBase from which the method is called. This method is more or less a combination of the methods “getAttachmentResults” and “buildLoadCasesCombili” of the generic DataBase class.

Practically, the main difference between “getAttachmentResults” and “getAttachmentResultsCombili” is that the first argument is no longer an Xdb file name. This argument is removed. Instead, one provides a “Combili” argument that describes the linear combination corresponding to extracted Results. This “Combili” argument is the second argument. The first argument is the “LcName” argument corresponding to the load case name attributed to the generated Results. This load case name is unsupposed to correspond to any load case name found in the attached XDB file(s).

The method has minimum four arguments:

1.

A String corresponding to the name of the load case for which Results are read.

2.

A “Combili” Array containing the description of the linear combination of elementary load case Results. The Array is an Array of Arrays. Each secondary Array contains three elements:

3.

A String or an Array of Strings corresponding to the names of sub-cases for which Results are read.

4.

A String or an Array of Strings corresponding to the names of Results for which Results are read.

The other arguments are optional and correspond to the specification of target entities for which Results are read. Actually, the reading operation from an XDB combines the reading and some of the extraction operations described in section I.4.3. For example:

If only four parameters are provided in the call to “getAttachmentResultsCombili” method, all the pairs of key-values found in the XDB file are inserted in the returned Results.

Only lists below the list of valid calls to “getAttachmentResultsCombili”:

    h=db.getAttachmentResultsCombili(xdbFileName,lcName,combili,
            scNames,resNames,
            method,grpTarget[,layers[,subLayers]])
    h=db.getAttachmentResultsCombili(xdbFileName,lcName,combili,
            scNames,resNames,
            resTarget)
    h=db.getAttachmentResultsCombili(xdbFileName,lcName,combili,
            scNames,resNames,
            rklTarget)
    h=db.getAttachmentResultsCombili(xdbFileName,lcName,combili,
            scNames,resNames
                [,layers[,subLayers]])

The Hash object returned by the method has a structure identical to the one returned by “getAttachmentResults” and can be manipulated the same way.

III.1.1.10.4 Importing Results From XDB file attachments

The method “importAttachmentResults” is used to read Results from the XDB file. Instead of being returned to the caller in a Hash object, the results are imported into the list of results stored into the Nastran DataBase. The method has four arguments:

    db.importAttachmentResults(xdbName,lcName,scNames,resNames)

III.1.1.10.5 Getting optimization data from XDB

It is possible to obtain some of the Nastran optimization (SOL200) results from an XDB attachment. Four methods have been defined in NastranDb class:

1.

getAttachmentDesVarHistory” returns the history of design variables and has three parameters:

Parameters 2 and 3 are optional and can be omitted or replaced by a “nil” argument or a void Array. If they are not defined, all the steps or design variables are returned in the results. The method returns a N*3 array. For each line, the three columns correspond to:

2.

getAttachmentConstrDefinitions” returns the definition of constraints and has two arguments:

Parameters 2 is optional and can be omitted or replaced by a “nil” argument. The method returns a N*6 array. For each line, the three columns correspond to:

3.

getAttachmentConstrHistory” returns the history of constrains and has three parameters:

Parameters 2 and 3 are optional and can be omitted or replaced by a “nil” argument. If they are not defined, all the steps or design responses are returned in the results. The method returns a N*3 array. For each line, the three columns correspond to:

4.

getAttachmentObjectiveHistory” returns the history of constrains and has two parameters:

Parameter 2 is optional and can be omitted or replaced by a “nil” argument. If it is not defined, all the steps are returned in the results. The method returns a N*3 array. For each line, the three columns correspond to:

5.

getAttachmentDesRespHistory” returns the history of design responses and has three parameters:

Parameters 2 and 3 are optional and can be omitted or replaced by a “nil” argument. If they are not defined, all the steps or design variables are returned in the results. The method returns a N*3 array. For each line, the three columns correspond to:

So far, the reading of optimization results is experimental and might be changed in future version.

III.1.1.10.6 Storage buffers for XDB result files random access

In order to reduce the number of accesses to disk, it may be useful to store some of the blocks read from binary result files into memory. FeResPost provides an algorithm that allows to store the blocks most recently read for later usage. Two singleton methods of the “NastranDb” class allow the to tune the capacity of the buffer area:

Note that all buffers are now common to all the methods that provide random access to XDB result files. In particular, the method is used in management of the binary file access for XDB attachment or reading. This means that if one Result file attached to one DataBase is more used, the storage will contain a majority of buffers for this Result file and progressively delete the other buffers.

The default capacity for storage buffer is 0Mb. Note that the two methods described above can be called from any class derived from the generic “DataBase” class.

III.1.1.10.7 “Raw” access to XDB file content

So far, the XDB access methods that have been described allow the extraction of Results only when the corresponding programming has been done in FeResPost source code. Sometimes, this limitation can be frustrating. For that reason, several methods allowing a “low level” or “raw access” to XDB content have been added.

Before listing these methods, one gives some information about the XDB content:

1.

The XDB file is a binary file divided in pages. Each page has a fixed size specified by a given number of words. (This number of words per page is given in the file by the first word of the file.) A word may correspond to 4 or 8 bytes depending whether the XDB file is output in single or double precision.

2.

The XDB file contains different tables corresponding to finite element model, results,... A “dictionnary” allows to identify and retrieve the different tables stored in an XDB file. In FeResPost, each XDB table is identified with a “ String-Integer key”:

Each table contains fields that can be distributed into several pages. A field corresponds for example to the forces and moments on one CBAR element, and for a given load case and sub-case. The naming conventions for the table types are given in MSC.Access Manual [Nas05]. The dictionnary keys allow to retrieve information from the dictionnary that can be used to retrieve the table content. This information is given in an Array of 22 integers that correspond for example to

(For the reading operations, one generally needs the field size.) You may find more information on the meaning of these 22 integers in MSC.Access Manual [Nas05]. The access to dictionnary is done by calling “getAttachmentDictKeys” and “getAttachmentDictionnary” methods.

3.

When results associated to elements are read from an XDB file, the values are associated to a key that corresponds to the element ID. However, this integer does not correspond to the Nastran integer ID of the element. Instead, there is in the XDB file, an “EQEXINE” table that contains the correspondence between the XDB IDs and the Nastran element IDs:

Method “getAttachmentElementExtId” allows to retrieve the Nastran element ID, if you know the type of the element, and its internal ID. The type of the element is the “MSC.Access Element Type” associated to XDB file format. The numbering of element types can be found in [Nas05].

4.

Similarly, the XDB file also contains an “EQEXING” table that allows to retrieve node information. The Access internal node ID numbering starts at 1 and is also sequential. Each node internal ID is associated to three “external” integers:

(a)

The Nastran “external” ID of the node that appears in the GRID card definition.

(b)

The node type is always “1” in the tests we have done. (We presume it corresponds to usual Nastran GRIDs.)

(c)

The Analysis Coordinate System of the GRID. This information is useful as it allows to associate the vectorial results components to a coordinate system.

Method “getAttachmentNodeInfo” is used to retrieve this information when reading nodal results.

The ‘NastranDb” class methods that give a “raw” access to XDB attachment content are:


Table III.1.3: Interpretation of the binary data translation String.
Char Conversion Action
“i” or “l” One word is converted to a single precision integer
“u” One word is converted to a single precision unsigned integer
“I” or “L” 8 bytes (one or two words) are converted to a long long (8 bytes integer)
“U” 8 bytes (one or two words) are converted to an unsigned long long (8 bytes unsigned integer)
“f” or “d” One word is converted to a float (single precision real value)
“F” or “D” 8 bytes (one or two words) are converted to a double (double precision real value)
“s” One word is converted to a String
“S” 8 bytes (one or two words) are converted to a String
“x” One word is skipped and a nil value is generated
“X” 8 bytes (one or two words) are skipped and a nil value is generated
“y” One word is skipped and no value is generated
“Y” 8 bytes (one or two words) are skipped no value is generated