Package mbdyn :: Package bindings :: Module main :: Class Groups
[hide private]

Class Groups

source code

Gather MBDyn groups of nodes or elements. The nodes and elements are organised into groups by the DataManager, described in the file 'dataman.h'. The SWIG interface to the DataManager is able to get back the objects pointers, so then they can create Python objects as described in mbdyn.bindings.basic_objects. The SWIG interface of the DataManager is described in 'dataman.i' and the instance of that class is pDM, attribute of the MBDyn Solver.

This class will interact with pDM and get back all the MBDyn objects. However this step requires to have a corresponding group where to store the object reference. That is the role of the mbdyn.bindings.groups module.

Moreover MBDyn uses a polymorphism on the Elem class or Node class. This single class definition will try to be converted to a general class for the group, this is achieved in the method try_to_convert.

Finally this class is responsible of listing present groups. For example:
   >>> wm = WraptMBDyn("input_file")
   >>> wm.init()
   >>> wm.elts
   [automatic_structurals,
   bodies,
   joints,
   beams,
   forces]
elts is a Groups instance.

Instance Methods [hide private]
 
__init__(self, item_key)
Translation of the C++ enumeration done in MBDyn, each key corresponds to an integer, indice of the group.
source code
 
add_group(self, group)
Add a group of elements or nodes
source code
 
__getitem__(self, key)
Return a group from the MBDyn key (STRUCTURAL, FORCE...)
source code
 
try_to_convert(self)
Try to call the convert method for each group.
source code
 
set_group_as_attributes(self)
The present groups are set as attribute names.
source code
 
__repr__(self)
Return all the present groups
source code
Method Details [hide private]

try_to_convert(self)

source code 
Try to call the convert method for each group. Due to the numerous groups, the difficulty is to make a package that work without having an interface for everyone. That's why this method tests if the SWIG module has a function to convert the object from the mbdyn.bindings.basic_objects to a general class of the group. If the SWIG module has a conversion to offer, the convert method of the group will be called by supplying the function reference. The conversion details can then be found in mbdyn.bindings.groups.

set_group_as_attributes(self)

source code 
The present groups are set as attribute names. The names used are defined in the GROUP_TABLE of mbdyn.bindings.groups.