Workspace 6.21.5
Modified-in-place Inputs

The normal execution model for a Workspace operation is that an operation reads data from its inputs and writes data to its outputs. As the inputs are normally only read, then their values do not change. Workspace operations may have inputs which are marked as "Modified-in-place". For such inputs, the operation may change the value of these inputs. For example, in the screenshot below we can see a Smooth Mesh operation with a MeshModelInterface input and corresponding output. Notice the small 'M' marker on the MeshModelInterface input. This indicates that the MeshModelInterface data provided to this input will be directly modified by the Smooth Mesh operation.

The Smooth Mesh operation has a Mutable input, indicated by the small 'M' decoration

Users need to be aware that Workspace will change the order in which it updates operations with "Modified-in-place" inputs. Ordinarily, when the user modifies an input to an operation on a workflow, Workspace will make sure to only re-execute that operation and operations down-stream of it. In the case of a "Modified in place" input, however, we cannot follow this approach - if we did, we would be accumulating changes to our dataset (applying operations more than once to a dataset).

Let's look at the SmoothMeshModel operation again as an example. This operation applies a smoothing function to the vertices in a MeshModelInterface object. The workflow shown below reads a MeshModelInterface from file, smooths it, then writes it out again.

Smoothing a MeshModelInterface object in-place

When the smoothing operation executes, Workspace has only one copy of this MeshModelInterface in memory - and it has been smoothed. Let's say that after we visualise our smoothed model, we see that the model is not smoothed as expected and we therefore want to adjust the Smooth Mesh operation by reducing the smoothing factor input. Workspace can't just re-execute the Smooth Mesh operation; that would apply the smoothing to the already smoothed dataset! Instead, Workspace looks up-stream to find an operation that doesn't modify data in-place, and re-executes from that point instead. In this case, Workspace will find the VTKReader operation. This way, the SmoothMesh operation is provided with the original MeshModelInterface data so that it can apply its smoothing operation correctly.