Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

<PT_data>
Main root field of the .spd file. It contains the version number and the name of the problem type.
PT must be replaced by the problem type name.
version - Internal version number.
e.g. if the problemtype is named 'cmas2d_customlib' the main node will be
<cmas2d_customlib_data version='1.0'>
...
</cmas2d_customlib_data>
Data tree fields>PT_data>container
<container>
This is the simplest form to group the data for improving its visualization.
On the resulting window, in addition to the inputs there will be the following set of buttons:
Image Removed
It can contain the following fields: <value>, <container>, <condition>, <function>, <dependencies>
The parameters are as follows,
n - Name used to reference the field, especially when writing the .dat file.
pn - Label that will be visualized by the user. It can be translated.
icon - It allows to put an image in .png format in the data tree. The image should be stored inside the images folder of the problem type.
help - It displays a pop-up window of help information related to the task the user is performing.
state - Specifies one of two states for the field: normal, or hidden. Note that hidden <container> field can be used for storing hidden values, that you do not want to show in the user interface. It also permits to handle a Tcl function, by means of square brackets.
update_proc - It calls a TCL procedure, when clicking on the 'Ok' button in the window. Square brackets are not supported.
actualize_tree - Itupdates the information in the whole data tree, and automatically refresh data shown in the user interface. It is a boolean value as a 1 or 0 that indicates if it is activated or deactivated. If the data source is changed, such as new fields have been added or data values and field have been modified, all the user interface will reflect those changes. Furthermore, all the TCL procedures defined in the data tree will be called and the whole data tree will be refreshed. Therefore, this instruction must be carried out only when necessary.
actualize - This only updates a specified field in data tree. Note that only this specified field will be refreshed in the user interface, and not the whole data tree. It is a boolean value as a 1 or 0 that indicates if it is activated or deactivated.
del_cancel_button - It is a boolean value as a 1 or 0 that indicates if the cancel button is removed (1) or not (0). On the resulting window there will be only the 'OK' button, as follows,
Image Removed
Fields to allow customize tree contextual menu:
addcontextualmenu -To add a new option to the menu. Expects a Tcl list of items, each item with subitems "icon text tcl_command"
replacecontextualmenu -To replace a menu option. Expects a Tcl list of items, each item with subitems "old_text icon text tcl_command"
removecontextualmenu -To remove a menu options. Expects a Tcl list of items, each item with subitems "old_text"
Example:
<container n='general_data' pn='General data' icon='general'>
<value n='max_iterations' pn='Maximum iterations' value='1e3' help='limit of iterations for iterative solver'/>
<value n='stop_tolerance' pn='Stop tolerance' value='1e-8'/>
</container>
Example: (customize contextual menu)
<blockdata n="Simulation_type" pn="Simulation data" icon="[icon_simtype]" addcontextualmenu="{advanced-16 {Add option 1} CompassFEM::Test} {advanced-16 {Add option 2} CompassFEM::Test}" replacecontextualmenu="{{Edit} advanced-16 {Edit mod.} CompassFEM::Test} {{View this} advanced-16 {View this mod.} CompassFEM::Test_mod}"removecontextualmenu="{View this} {Edit}"</blockdata>
Data tree fields>PT_data>value
<value>
It is the main field to store data. This field allows to define an entry, or a combobox in the window.
It can contain the following fields: <function>, <dependencies>, <edit_command>
The parameters are as follows,
n - Name used to reference the field, especially when writing the .dat file.
pn - Label that will be visualized by the user. It can be translated.
v - The value or default value for a 'value' field
state - Specifies one of the four states for the entry: normal, disabled, hidden or readonly. If the entry is readonly, then the value may not be changed using widget commands and no insertion cursor will be displayed, even if the input focus is in the widget; the contents of the widget may still be selected. If the entry is disabled, the entry may not be changed, no insertion cursor will be displayed and the contents will not be selectable. Note that hidden entry can be used for storing hidden values. It also permits to define a Tcl function, by means of square brackets.
values_tree - Permits to define a TCL function, by means of square brackets, and returns a combobox with a list of strings.
values - Comma-separated list of strings.
For instance, values="mech,therm"
dict - Comma-separated list of key,value. This operation places a mapping from the given key to the given value, which is shown in the GUI. Values can be translated.
For instance, dict="mech,Mechanical,therm,Thermal" shows Mechanical and Thermal.
string_is - Tests the validity of various interpretations of a string, as follows,
integer - To test if a string is an integer value.
integer_or_void - To test if a string is an integer value, or empty (not-filled).
double - To test if a string is a double value.
double_or_void - To test if a string is a double value, or empty (not-filled).
% - To test if a string is a percentage (%)
list_of_double - To test if a string is a list of doubles, representing a data structure of doubles in Tcl.
help - It displays a pop-up window of help information related to the task the user is performing.
actualize_tree - Itupdates the information in the whole data tree, and automatically refresh data shown in the user interface. It is a boolean value as a 1 or 0 that indicates if it is activated or deactivated. If the data source is changed, such as new fields have been added or data values and field have been modified, all the user interface will reflect those changes. Furthermore, all the TCL procedures defined in the data tree will be called and the whole data tree will be refreshed. Therefore, this instruction must be carried out only when necessary.
actualize - This only updates a specified field in data tree. Note that only this specified field will be refreshed in the user interface, and not the whole data tree. It is a boolean value as a 1 or 0 that indicates if it is activated or deactivated.
update_proc - It calls a TCL procedure, when clicking on the 'Ok' button in the window or when changing the value of the entry. Square brackets are not supported.
menu_update - It allows to update the menus.Values can be yes or no. It is necessary to define a <dependencies> field, as follows,
<dependencies node="/*/blockdata[@n='General_Data']/value[@n='analysis_type']" att1="menu_update" v1="[TCL_proc]" actualize="1"/>
fieldtype - It creates a box in the user interface in order to introduce a text. It can be:
longtext - A text box is created.
editable - It is a boolean value as a 1 or 0 that indicates if the entry could be changed or not. If it is activated (1) the entry may not be changed, no insertion cursor will be displayed and the contents will not be selectable.
unit_magnitude - Physical quantity (i.e. L, for Length). For more information about this attribute, see the sectionDescription of the units
units - Unit of the physical quantity (i.e. m). For more information about this attribute, see the sectionDescription of the units
function - Contains a Tcl command, which is executed when is called. It permits to create or edit a function for a determined entry.
function_func - Permits to define a TCL function.
values_check - It allows to handle a Tcl function, by means of square brackets.
min_two_pnts - It is a boolean value as a 1 or 0 and indicates that two points or more are required in a linear interpolation.
unit_definition - The fields <value/> used to choose the default units in the GUI are special. They contain the attribute called unit_definition="magnitude" being magnitude the name 'n' to be used in that field. It is important to note that these kind of fields does not contain dependencies.
show_in_window - Can be 1 or 0 (1 by default). It indicates if the value must be shown in the conditions window. If set to 0, the value will be shown in the tree, but will be hidden in the window.
Example:
<value n='units_length' pn='Length' unit_definition='L'/>
<value n='units_mass' pn='Mass' unit_definition='M'/>
<value n='units_force' pn='Force' unit_definition='F'/>
unit_mesh_definition - The field <value/> used to choose the mesh unit is special. It has the attribute unit_mesh_definition="1", and it does not contain any "v" attribute or dependencies.
Example:
<value n="units_mesh" pn="Geometry units" unit_mesh_definition="1"/>
units_system_definition - The field <value/> used to choose the units system is special. It has the attribute units_system_definition="1", it does not contain any "v" attribute, and it contains a unique dependency related to the units fields.
Example:
<value n='units_system' pn='Units system' units_system_definition='1' icon='units-16'>
<dependencies node="//*[@unit_definition or @unit_mesh_definition='1']" att1='change_units_system' v1='{@v}'/>
</value>
Data tree fields>PT_data>condition
<condition>
It contains some inputs with values and can be applied to groups. For each applied group, a dependent set of values will be created that belong to that group, for this condition.
A group is a category that brings together selected entities (points, lines, surfaces and/or volumes) with identical properties. I should be noted that any entity can belong to more than one group (unlike the concept of layer, where any entity cannot belong to more than one layer).
It can contain the following fields: <value>, <dependencies>, <edit_command>
On the resulting window, in addition to the inputs there will be the following set of buttons:
Image Removed
Button 'Select' enables to create a group and choose entities into it.
ov, ovi, i=1,2 - Indicates to which entity types can a 'condition' be applied. Can be one or several of the following values: point, line, surface, volume.
Note: usually a condition is attached to a group, and ov is used, but some special conditions are attached to two groups, then ov1 and ov2 must be used (for example could be used to define master-slave parts)
ovp, ovpi, i=1,2 - Optional, to visually show an string alternative to the ov keyword values
ov_default - Indicates the default entity type selected (used in case of ov with multiple types). Can be one, and only one of the following values: point, line, surface, volume.
ovm, ovmi, i=1,2 - Indicates to which entity can a 'condition' be applied. It can be element, node, face_element or ""
ov_element_types - Optional, to restrict the element types that could be applied. Must be a list of comma separated of the following values: linear, triangle, quadrilateral, tetrahedra, hexahedra, prism, point, pyramid, sphere, circle (by default all element types are allowed)
state - Specifies one of two states for the field: normal, or hidden. Note that hidden <container> field can be used for storing hidden values, that you do not want to show in the user interface. It also permits to handle a Tcl function, by means of square brackets.
groups_icon -It allows to put a custom image when creating groups in the data tree, with .png format. The image should be stored inside the images folder of the problem type.
Example:
<condition n="Point_Weight" pn="Point Weight" icon="constraints" groups_icon="groups-16">
...
</condition>
Data tree fields>PT_data>condition>symbol
<symbol>
Every condition can have a symbol, that will be drawn when the user selects Draw symbols in the contextual menu that appears on user interactions such as right-mouse click operation.
The symbol is defined by a field <symbol> inside the condition. The available XML parameters are:

  • proc: Includes the name of a TCL proc to be defined in the TCL files of the problemtypes. In that proc, OpenGL is used to make the real drawing.

The procedure must return the id of a OpenGL drawing list (created by GiD_OpenGL draw -genlists 1), or a dict with some required keys depending on the orientation attribute value.
The proc is invoked adding automatically an extra argument: valuesList with a list of key value of the condition values stored in the tree.

  • orientation: can be global, local, localLA, free or have some special values section, shell_thickness, loads to invoke internally predefined drawings.
    • global means that the symbol defined in the proc will be draw with its axes corresponding to that of the global axes of the model.
    • local means that the symbol will be drawn related to a local axes system dependent on the entity.

For lines, this local axes system will have x' axe parallel to the line. For surfaces, the z' axe will be parallel to the surface normal
(for lines some extra correction of the local axes could be applied)

    • localLA is similar to local, in this case is compulsory attach local axis to entities, implicit automatic local axis of lines and surfaces are not used (and without the extra correction in case of lines)
    • section used for lines to draw bar section profiles in its local axes. (some extra correction of the local axes could be applied)

In this case the proc must return a dict Tcl object with keys named:

      • obj the integer representing the opengl list to be drawn.
    • shell_thickness to draw the surface with a thickness.

In this case the proc must return a dict Tcl object with keys named:

      • thickness with the value of the thickness associated to the surface.
      • cdg_pos (optional) with the list of the 3 components of the center position
    • loads to represent loads.

In this case the proc must return a dict Tcl object with keys named:

      • load_type with possible values global, global projected, local
      • load_vector with a list of 3 components of the vector

e.g. return [dict create load_type $load_type load_vector $load_vector]

    • free is another special value, in this case the Tcl procedure will be called once by entity with the condition to be draw, instead of only once by group.

The proc is invoked adding automatically some extra arguments: valuesList geom_mesh ov num pnts points ent_type center scale
this allow to know the information of the entity.
geom_mesh: GEOMETRYUSE or MESHUSE
ov: point line surface volume node element
num: <entity id>
pnts: in case of lines integer?, in case of surfaces its boundary lines and orientations <{line_1 SAME1ST|DIFF1ST} ... line_n SAME1ST|DIFF1ST}>
points: in case of lines <{x1 y1 z1} {x2 y2 z2}> start and end coordinates, in case of lines the boundary point coordinates
ent_type: STLINE, ...
center: <x y z>
scale: <scale_to_draw>
The local axes are defined by a special 'classical condition' (point_Local_axes, line_Local_axes, ...) assigned to the entities, or if there is not assigned this 'local axis' then the implicit local axis for lines and surfaces is used (based in its tangent and normal respectively)
There are Tcl predefined procedures to facilitate drawing with OpenGL:

  • gid_groups_conds::import_gid_mesh_as_openGL <filename> <color_lines> <color_surfaces>

To automatically import a GiD mesh file to be drawn with OpenGL.
The filename to be read must be a GiD ASCII mesh of lines, triangles and quadrilaterals (with as few elements as as possible). This mesh could be exported from the menu Files->Export->GiD mesh. The procedure read the mesh and invoke GiD_OpenGL draw commands.
The mesh must represent a normalized shape, centered at the origin and contained in a box of size 1 for every of its dimensions (a 2x2x2 cube)

  • gid_groups_conds::draw_symbol_image <image> <values_list>

To automatically import in image file to be drawn with OpenGL.
The image must use some valid image format (png, gif, jpg,...), and is expected to be inside a folder named /images of the problemtype
The values_list argument is currently not used.

  • gid_groups_conds::draw_symbol_text <txt> <values_list>

...

  • Single value: The linear interpolation uses two or more pairs of input data points that approximate a function.
  • Linear ramp: Calculates two or more 'Linear ramp' pairs of input data points that approximate a function.
  • Equation: Calculates two or more pairs of input data points that satisfy a given equation.

...

  • dimension_function: Determine the dimensions of a the given square matrix.
  • symmetric_function: It is a boolean value as a 1 or 0. It allows to indicate that it is given only the upper triangular part of a symmetric matrix.
  • components_function: List of numbers or names. The natural way to refer to rows and columns in a matrix is via the row and column numbers. However, the user can also give names to these entities.
  • has_diag: It is a boolean value as a 1 or 0, that allows to indicate if it is a diagonal matrix.

<proc n="loads_function" args="">
return [cmas2d_CustomLIB::chk_loads_function $domNode]
</proc>
proc cmas2d_CustomLIB::chk_loads_function { domNode } {
set loads [list [list scalar]]
lappend loads [list interpolator_func x x T]
return [join $loads ,]
}The fields and parameters of the main configuration file (.spd) of the data tree, are described below.