Skip to content
Snippets Groups Projects

Split up filter documentation into basic and advanced development

Merged Kenneth Moreland requested to merge kmorel/vtk-m-user-guide:basic-filter-impl into master
Files
3
+ 3
3
@@ -57,14 +57,14 @@ The type of the computed output field is typically derived from the type of the
Once the filter has both the input and output \textidentifier{ArrayHandle}s, it is ready to invoke the worklet to compute the output.
For convenience, all filter superclasses provide an \classmember*{Filter}{Invoke} member that is a \vtkmcont{Invoker} class.
Thus, worklets can be invoked within a filter by calling \textcode{this->Invoke} as if it were a method.
This is shown starting on line \ref{ex:SimpleFieldDoExecute.cxx::Invoke}.
This is shown starting on line \ref{ex:SimpleFieldDoExecute.cxx:Invoke}.
Recall that the worklet created in Chapter \ref{chap:SimpleWorklets} takes two parameters: an input array and an output array, which are shown in this invocation.
With the output data created, the filter has to build the output structure to return.
All implementations of \classmember*{Filter}{DoExecute} must return a \vtkmcont{DataSet}, and for a simple field filter like this we want to return the same \textidentifier{DataSet} as the input with the output field added.
The output field needs a name, and we get the appropriate name from the superclass (line \ref{ex:SimpleFieldDoExecute.cxx:OutputName}).
However, we would like a special case where if the user does not specify an output field name we construct one based on the input field name.
Recall from Example \ref{ex:SampleFieldConstructor} that by default we set the output field name to the empty string.
Recall from Example \ref{ex:SimpleFieldConstructor} that by default we set the output field name to the empty string.
Thus, our filter checks for this empty string, and if it is encountered, it builds a field name by appending ``\_N/M\^2'' to it.
Finally, our filter constructs the output \textidentifier{DataSet} using the \vtkmfilter{CreateResult} helper function.
@@ -72,6 +72,6 @@ There are multiple versions of \textidentifier{CreateResult}, but the version we
This chapter has just provided a brief introduction to creating filters.
There are several more filter superclasses to help express algorithms of different types.
After some more worklet concepts to implement more complex algorithms are introduced in Part \ref{part:Advanced}, we will see a more complete documentation of the types of filters in Chapter \ref{chap:FilerTypeReference}.
After some more worklet concepts to implement more complex algorithms are introduced in Part \ref{part:Advanced}, we will see a more complete documentation of the types of filters in Chapter \ref{chap:FilterTypeReference}.
\index{filter!implementation|)}
Loading