The 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:
“readGroupsFromPatranSession” reads one or several Groups from a Patran session file obtained using the utility “Patran–>utilities–>groups–>exportToSessionFile”. The argument is a String corresponding to the name of the session file. The method returns nil. If some of the entities read in the session file do not exist (for example, missing elements or nodes), then the read entities will not be added to the Group. This corresponds to the behavior of Groups in Patran. Therefore the session file containing the definition of Groups should be read after the finite element model.
Note that, even though the method is related to an MSC software, it can be used with DataBase related to different solvers. This is the reason why the method “readGroupsFromPatranSession” is defined in generic DataBase class.
The method “readGroupsFromPatranSession” works as follows:
It searches in the file the statements “ga_group_entity_add” and stores the while PCL statement in a string.
Then, the name of the Group being initialized is scanned from the string.
Finally, the entity definition is scanned:
The statement searches words like “Node”, “Element”, “MPC”, “CoordSys”. Note that “MPC” corresponds to the definition of a list of rigid body elements (RBEs). Nastran MPC cards cannot be inserted in a Group.
For any of the four first words, the method builds a list of integers corresponding to the identifiers of the entities to be added to the Group. For the three last words above, the method skips the entities.
The entities can be defined by a list of integers separated by blanks, or by pairs of integers separated by “:” which defines a range of integers, or by groups of three integers separated by two “:” which defines a range with a stepping argument.
Prior to storing the Group in DataBase, the method checks that the entities of the Group are defined in the DataBase. If not, they are erased from the Group.
Note that the definition of Groups in Ruby by range specification uses the same kind of formats as ”setEntities” method in Group class. (See section I.3.3.)
“writeGroupsToPatranSession” writes the Groups stored in the DataBase in a text file corresponding to a Patran session defining groups. This method is the reverse of method “readGroupsFromPatranSession” an has one argument: the name of the Patran session file. Note that “MPC” corresponds to the definition of a list of rigid body elements (RBEs). Nastran MPC cards cannot be inserted in a Group.
“addGroupCopy” is used to add a Group to a DataBase. The method returns nil and has one argument: the Group object. Note that, when adding a Group to the DataBase, a check is done to verify that all its entities are present in the DataBase. If not present, then the corresponding entities are erased from the Group. As this involves the modification of the Group definition, all operations are performed on a copy of the Group argument. In the DataBase, the added Group is associated with the name of the group argument. If a Group associated with the same name existed prior to adding the new Group, the method replaces the former Group by the new one.
“NbrGroups” attribute has no argument and returns the number of Groups stored in the DataBase.
“getAllGroupNames” has no argument and returns an Array of String objects corresponding to the names of all the Groups contained in the DataBase on which the method is called.
“checkGroupExists” allows to check whether a Group exists in the DataBase. The argument is a String object corresponding to the name of the Group. The returned value is true if the Group has been found, false otherwise.
“getGroupCopy” has one argument: a String object corresponding to the name of the Group to be retrieved. The method returns a copy of the Group stored in the DataBase, if the Group with the appropriate name exists. The method returns an error if no Group with the appropriate name exists in the DataBase.
“eraseGroup” erases a Group from the DataBase. The argument is a String object corresponding to the name of the Group to be erased. If the Group does not exist in the DataBase, nothing is done.
“eraseAllGroups” erases all Groups stored in the DataBase. This method has no argument.
“getGroupAllElements” returns a Group containing all the elements that define the model stored in the DataBase.
“getGroupAllNodes” returns a Group containing all the nodes that define the model stored in the DataBase.
“getGroupAllRbes” returns a Group containing all the RBEs that define the model stored in the DataBase.
“getGroupAllCoordSys” returns a Group containing all the coordinate systems that define the model stored in the DataBase.
“getGroupAllFEM” returns a Group containing all the elements, nodes, rbes and coordinate systems that define the model stored in the DataBase.