Skip to content

Upgrade vtkArrayCalculator

The goal of this merge request is to upgrade the vtkArrayCalculator filter to:

  1. Containers: Raw pointers have been replaced with std::vector which reduces the LOC, and simplifies the code
  2. Functionality: A new function parser (wrapper to be more exact) has been developed using the ExprTk library. This library is the best for this purpose, and includes a lot of extra functionality compared to the vtkFunctionParser. The only limitation of this library is the fact that you can't define a function that returns a vector. Therefore to implement norm, and cross, regular expression tricks have been employed. These tricks come with a specific limitation, i.e., the input vector of this function can't be a sub-expression that includes '(', ')' or ',', e.g. norm(cross(v1,v2)).
  3. Performance: vtkSMPTools have been utilized to parallelize this filter by creating multiple parser instances for each thread
  4. Known issues: An input variable name must either be sanitized or enclosed in quotes

It should be noted that the user can select if he wants to use the vtkFunctionParser or the new vtkExprTkFunctionParser (default).

If the limitations regarding norm and cross are a major issue, a similar implementation to vtkExprTkFunctionParser can be implemented in vtkFunctionParser to solve the known variable name issues.

This MR required the following extra MRs to be fully complete:

Once this MR is completed, another MR will be created for the vtkPVArrayCalculator filter (see paraview/paraview!5090 (merged)).

Edited by Spiros Tsalikis

Merge request reports