Auxiliary procedures to convert between different unit types
There are a couple of functions that are essential when writing the input file for the calculation. These functions permit the treatment of the units, and facilitates the conversion from one measurement to another. They are the following:
- gid_groups_conds::give_mesh_unit
This function provides the mesh unit.
- gid_groups_conds::set_mesh_unit unit
This function imposes a mesh unit, where the argument is as follows:
unit - A text string, denoting the unit that you want to apply as mesh unit.
- gid_groups_conds::convert_value_to nodeObject to_unit
This function converts the value of a nodeObject from the current unit for the original number to another unit, where the arguments are as follows:
nodeObject - DOM node object chosen.
to_unit - A text string, denoting the unit that you want to convert the original number to.
- gid_groups_conds::convert_value_to_active nodeObject
This function converts the value of a nodeObject from the current unit type to the general active unit selected in the GUI. The argument is as follows:
nodeObject - DOM node object chosen.
- gid_groups_conds::convert_unit_value magnitude value unit_from to_unit
This function converts a number from one unit type to another unit type, for the same magnitude. It receives as arguments:
magnitude - Unit definition, it is the name 'n' of the physical quantity (eg. "L" for Length)
value - The number to be converted.
unit_from - A text string, denoting the unit for the original number.
to_unit - A text string, denoting the unit that you want to convert the original number to.
- gid_groups_conds::convert_value_to_printable_unit nodeObject
This function returns a text string, denoting the current unit of the node. It receives as argument:
nodeObject - DOM node object chosen.
- gid_groups_conds::give_unit_factor magnitude unit
This function returns the conversion factor for the unit given. The arguments are as follows:
magnitude - Unit definition, it is the name 'n' of the physical quantity (eg. "L" for Length)
unit - A text string, denoting the unit chosen to obtain the conversion factor.
- gid_groups_conds::convert_v_to_default value magnitude unit_from
This function converts a number from one unit type to the unit type by default, for the same magnitude. It receives as arguments:
value - The number to be converted.
magnitude - Unit definition, it is the name 'n' of the physical quantity (eg. "L" for Length)
unit_from - A text string, denoting the unit for the original number.
- gid_groups_conds::give_active_units_system
This function returns a string list, where the first item is the units system.
- gid_groups_conds::give_active_unit magnitude
This function returns the active unit for a given magnitude. It receives as argument:
magnitude - Unit definition, it is the name 'n' of the physical quantity (eg. "L" for Length)