Overview | All Modules | Tutorial | User's Guide | Programming Guide

COVISE Online Documentation


Module category: Tools



Calc

This module allows you to make mathematical calculation with scalar and/or vector objects. The result may be a scalar or a vector. The module interprets a string, whose syntax is described in a subsection below.

Calc.png

This module has been tested on SGI platforms.

Parameters

Name Type Description
expression String Expression Arithmetic expression describing the computation to be done.
It complies with the syntax shown below.

Input Ports

Name Type Description
optionals_indata1 Float
Float
Corresponds to s1 in the parameter expression if connected
optionals_indata2 Float
Float
Corresponds to s2 in the parameter expression if connected
optionalv_indata1 Vec3
Vec3
Corresponds to v1 in the parameter expression if connected
optionalv_indata2 Vec3
Vec3
Corresponds to v2 in the parameter expression if connected

Output Ports

Name Type Description
dependout2data1 Float
Float
Result of the computation if it is of a scalar type
dependout2data2 Vec3
Vec3
Result of the computation if it is of a vectorial type

Syntax

Numeric expressions to be submitted to the module obey the following context free grammar:

Explanations added where necessary,and not part of the grammar

inputport --> `s1´                             	   | Scalar data compliant to s_indata1
              `s2´                                 | Scalar data compliant to s_indata2
              `v1´                                 | Scalar data compliant to v_indata1
              `v2´                                 | Scalar data compliant to v_indata2
						   |
expression --> number				   | Common floating point number
						   |
               e				   | The unit vector (1,1,1)
	       inputport			   | 
	       `(' expression `)'		   |
	       `[' number `,' number `,' number `]'| Constant three-dimensional vector
	       `neg(' expression `)'		   | Negation of the expression, don't use `-'
	       `sin(' expression `)'		   |
	       `tan(' expression `)'		   |
	       `log(' expression `)'		   |
	       `exp(' expression `)'		   |
	       `vlen(' expression `)'		   | Norm (expression must be of vector type)
	       `comp1(' expression `)'		   | 1st component of vector
	       `comp2(' expression `)'		   | 2nd component of vector
	       `comp3(' expression `)'		   | 3rd component of vector
	       `min(' inputport `)'		   | Minimal scalar value or vector norm
	       `max(' inputport `)'		   | Maximal scalar value or vector norm
	       expression `+' expression	   |
	       expression `-' expression	   |
	       expression `*' expression	   |
	       expression `/' expression	   |
	       expression `^' expression	   | power
	       expression `#' expression	   | cross product
	       expression `~' expression	   | root

Restrictions

The arithmetic expressions which can be specified are restricted:

1. At least one input port must occur in the expression even if 
no input port is needed for the computation. 
This means that the expression 3+sin(7.0) is invalid while 0*s1+3+sin(7.0) is valid.
2. Expressions with cubic root and negation have to be written like neg(neg(s1)~3)

Examples

Consider the first map:
RWCOvise_1 reads the geometry of the data while RWCovise_2 reads in the data. Then we make a Cuttingsurface of the data. Scalar data on the surface are now handled by the Calc module. The result of this computation is mapped to colors by Colors_1 and Collect_1. The module Colors_2 is only used to get a colormap for the data. In our simple example we take just a multiple of the scalar value on the CuttingSurface.

Figure: covise/net/examples/Calc1.net
CalcNet.png

Figure: covise/net/examples/Calc.net
Calc_map.png

In the second map the Calc module is used in order to work out the magnitude of the density of linear momentum. The density and the velocity fields are read at the first and third port, respectively. That is why we have written in the expression string parameter vlen(s1*v1); s1 stands for the mass density, and v1 for the velocity field; vlen calculates the length of a vector. This scalar magnitude is available at the first output port. The renderer snapshot shows the output for the third time step of this calculation.

Figure: Magnitude of the density of linear momentum
Calc_out.png

As the grammar shows, expressions like max(s1+s2) are not allowed. Instead use cascading Calc modules as shown in the last figure where the expression for Calc1 is s1+s2 and for Calc3 max(s1)

Figure: Using cascading Calc modules
CalMax.png


Authors: Martin Aumüller, Ruth Lang, Daniela Rainer, Jürgen Schulze-Döbold, Andreas Werner, Peter Wolf, Uwe Wössner
Copyright © 1993-2022 HLRS, 2004-2014 RRZK, 2005-2014 Visenso
COVISE Version 2021.12