Tdyn Tcl extension includes a basic library for vector operation and manipulation. The functions for vector manipulation can operate with temporal vector created from Tcl code and with internal Tdyn variable vectors. Internal Tdyn vectors can be accessed using the standard names for variables defined in Function Syntax section, but they have to be preceded by an 's' (for solid domain vectors) or 'f' (for fluid domain vectors). This way, the vector containing the x components of the velocity in the fluid domain can be accessed by 'fvx', and the temperature of the solid domain by 'stm'.
The basic functions of this library are described below.
vmexpr funtion(vectorname)
Performs the operation given by function in the vector vectorname , returning a real. Functions available for vmexpr are those defined in mather_eval_vectors. Example: set ret [vmexpr sum_abs(fvx)]
vmexpr temp=funtion(operator)
Performs a vector operation, returning a temporal vector. Functions available for vmexpr are those defined in mather_apply_vectors.
Examples:
set temp [vmexpr temp=abs(2.0*fvy)]
set temp [vmexpr temp=2.0*stm]
vmdelete vectorname
Deletes the temporal vector named vectorname . Example: mather_release_temp temp2
mather_give_temp vectorsize defaultvalue
Creates a temporal vector of size vectorsize . This vector is initiated to defaultvalue . The function returns the name of the vector. Example: set temp [mather_give_temp 100 0.0]
mather_release_temp vectorname
Deletes the temporal vector named vectorname . Example: mather_release_temp temp2
mather_release
Deletes all the temporal vectors. Example: mather_release
mather_create_temp_vectors isize
Defines the dimension of the array of temporal vectors to isize. By default Tdyn only allows to use 100 temporal vectors. This function has to be called before to start using temporal vectors. Example: mather_create_temp_vectors 150
mather_apply_vectors function vectorname
Apply a function to every value of the vector named vectorname . Available functions are abs, sqrt, cos, sin, tan, acos, asin, atan, cosh, sinh, tanh, log, log10 and exp. Example: mather_apply_vectors sqrt temp2
mather_eval_vectors function vectorname
Apply a function to a vector named vectorname. Available functions are sum, sum_abs, min_val, max_val, min_abs, max_abs, min_signed, max_signed, sumsq, norm, fintegral, sintegral, fintegralnorm, sintegralnorm.
Examples:
mather_eval_vectors min_val temp2
mather_eval_vectors sintegral stm
mather_eval_vectors fintegral ftm