The math routine operates on attributes of a mesh object(s). It performs arithmetic operations or evaluates mathematical functions on the source mesh object or objects, and places the results in the sink mesh object. The source and sink mesh objects can be the same, and there can be either one or two source objects, depending on the operation selected.

All attributes must have the same type, rank, and length.

The last parameter, value, may or may not be used according to the operation details listed below.

For the standard arithmetic operations, value can be either a constant or an attribute. These arithmetic operations work for all types of attributes.

For the mathematical functions other than floor and ceiling,  value is omitted, and the function is performed on the src_attr and stored in the sink_attr. Mathematical functions other than floor and ceiling are not implemented for attributes whose values are integers.


math / operation / cmo_sink / attr_sink / range /cmo_src/attr_src / [ value ]

The syntax is:


The ‘field_value’ for an element is either the value of attr_src (if the attr_src is an element attribute and has length ‘nelements’) or is the average of the values at the vertices of the element (if the attr_src is a node attribute has length ‘nnodes’).

If sink_attr does not exist or if it exists and has length ‘nelements’ and type ‘VDOUBLE’ the products (</> ‘field_value’ times ‘element_volume’) are stored in sink_attr.

If sink_attr exists and has length ‘scalar’ and type ‘REAL’, then the products are summed up and the resulting sum if stored in sink_attr. (If the user requires just the integrated sum this alternative avoids having to use the pair of commands [integrate, sum] and also avoids creating the ‘nelement’ long sink attribute)

It is assumed that the sink and source attributes are in the same mesh object and the second cmo name is ignored.

If range is used, it must refer to a set of elements.

sum adds all node or element values in attr_src, within the selected range and writes the result to attr_sink. The sink attribute must be of type ‘REAL’ or ‘INT’ (length=’scalar’) and will be created if it does not exist.

cmo_sink, attr_sink: are the sink cmo and sink attribute for the math results to be written to. These parameters are required for all math operations.

range: is the selection set of elements or nodes for the math operation and may be in one of these 3 forms:

/ifirst,ilast,istride / numbers indicating attribute set  (1,0,0 means all elements or nodes)

/pset,get, pset_name / for attributes with length = ‘nnodes’  (all nodes in the named point set)

/eltset,get, eltset_name / for attributes with length = ‘nelements’ (all elements in the named element set)

value: is required by some math operations and can be of type constant or can be a cmo attribute. The following are possible forms:

/cmo_src2/attr_src2/ where cmo_src2 may be the same name as the source cmo, or the name of a second source cmo.

/attr_src2/ assumes attribute is a part of cmo_src

/constant/ is a numerical value


math/integrate/cmotri /Vf /1,0,0/ cmotri/ Fn
math/sum/cmotri / Vfsum /1,0,0/ cmotri / Vf
math/sum/cmotri / area\_sum /1,0,0/ cmotri / darea