Skip to content

Optimize the vtkMaterialInterface filter so that with the clip method, the output material mesh has the same type as the input material mesh

guillaume Peillex requested to merge OptimizeShallowCopyFollowUp into main

In the vtkMaterialInterface filter, when using the clip method, the output material mesh should be of the same type as the input material mesh. Until know, whatever the input mesh was, the output one was a vtkUnstructuredGrid. With this MR, input and output mesh have the same type.

Main modifications are the fact that the MaterialTemplate class is replaced by a non template abstract class named MaterialAbstractMethod.

This class is concretized by the MaterialContourMethod class (formerly called MaterialPolyData) and the MaterialClipMethod (formerly called MaterialUnstructuredGrid) which is itself a template. The template parameter allows to choose the output type of the material mesh.

In the vtkMaterialInterface.cxx file, the internal class has its m_material_collection which is not templated anymore. Instead it contains now pointers to MaterialAbstractMethod objects, which allows polymorphism between MaterialContourMethod (FillMaterial=Off), MaterialClipMethod<vtkPolyData> (FillMaterial=On and input material mesh is vtkPolyData) and MaterialClipMethod<vtkUnstructuredGrid> (FillMaterial=On and input material mesh is vtkUnstructuredGrid).

This image represents a simplified class diagram before this MR:

Before

And this image represents a simplified class diagram introduced by this MR:

After

Closes #27 (closed)

Merge request reports