Imagix 4D User Guide


Calculation Trees

The Calculation Trees display information about the assignments related to the current value of a variable. You're able to examine all of the initializations, sets and reads, of any variable, that contribute to or are impacted by a specific variable's value. This analysis of your software's data flow tracks assignment dependencies across function boundaries and through parameter passing.

The initial focus of a Calculation Tree needs to be a top-level variable or array. This can be of any type, and can be of global, static or local scope. While members of variables (e.g. var.member) or referenced members of pointers (e.g. pointer->member) can not be the initial focus, the resulting Calculation Tree will include those variable paths in the dependencies it displays. For example, if you initially focus the Calculation Tree on a pointer variable, the resulting display will show what is impacted by pointer->member and any variables referenced by that.

If you invoke the Calculation Tree through the right mouse pop-up menu in a File Editor, the Calculation Tree displays just those assignments leading to or resulting from the value of the variable in the selected line of code. Otherwise, the tool shows the full set of assignments related to any of the occurrences of the variable.

Contributing vs. Impacted Statements

While examining data flow within the Calculation Tree, the most significant setting controls whether to display the fan-in from upstream assignments that contribute to the value of a specific variable, or to show the downstream fan-out of all the variable assignments that are impacted by that specific variable's value. If you're trying to understand how a variable might have reached a problematic value, the contributing statements setting is more applicable. For reviewing the possible consequences of changing a calculation, you may want to review the impacted statements.

Assignment Views

The Calculation Tree window consists of a series of views that show different aspects of the overall data flow for the variable. The Assignment views provide full detail, showing the complete hierarchy of upstream or downstream assignments involving the variable. The Assignment Flow view depicts this graphically.

Within the Assignment Flow graph, each rectangle represents a specific assignment, and contains the source code for that assignment. Lines show the hierarchy of that assignment within the overall data flow. The lines have direction, which is indicated by the arrowheads. The lines also communicate the symbol involved in their part of the data flow, by pointing to the symbol's name within the rectangle.

As you select an assignment in the graph by clicking on it, information about that particular assignment is shown in the table just below the graph. Included is a description of the assignment, as well as details about its location. And of course, double clicking on the assignment will open a file editor to that line of source code.

All of these same assignments are also displayed in the Assignment List view. In this tabular view, the full source line for each assignment, or alternatively, a description of each assignment, appears in a list. The order and indenting of the list indicates the flow of the assignments.

Variable Views

The Variable views provide a somewhat higher level display of the overall data flow. You can examine the global and the local variables and parameters which are involved in the calculation, and study the dependencies between these variables.

The Variable Dependencies view shows this graphically, using the same graph symbols that appear in Imagix 4D's standard graph windows.

As with the Assignment Flow view, clicking on a specific symbol results in details about it being displayed in a table just below the graph. Here, the table lists all of the lines where the particular variable is involved in an assignment.

This focus on the variable being set is maintained in the Variable Table view, where the individual assignments are organized by assigned variable.

Initialization

Because of the information they display and their interaction with other display windows, the Calculation Trees are included under the Tools menu with the other display windows described in this section of the User Guide. However, before initial Calculation Tree information can be displayed, a large amount of underlying global data flow analysis needs to take place. Depending on the size of your project, you will see significant delays during this analysis. In addition, this analysis requires knowledge of local variables, so the use of Calculation Trees requires that your source code be analyzed with the -locals option (see `Analyzer Syntax and Options').