IsA() errors

There a few places in the VTK code where calling IsA() is flawed.

Classes vtkOpenGL2ContextDevice2D, vtkSimpleTransform, vtkXXX do not exist, so the code should either be deleted or the class name changed.

Classes vtkLabeledDataMapper, vtkMPIController, vtkImageStack are descendant classes referenced by an ancestor module.

 VTK-8\Charts\Core\Testing\Cxx\TestScalarsToColors.cxx(81):  if (view->GetContext()->GetDevice()->IsA("vtkOpenGL2ContextDevice2D"))
 VTK-8\Common\Transforms\vtkTransform.cxx(176):        !this->Concatenation->GetTransform(i)->IsA("vtkSimpleTransform");
 VTK-8\Filters\Modeling\Testing\Cxx\UnitTestCollisionDetectionFilter.cxx(144):  if (collision->IsA("vtkXXX"))
 VTK-8\Rendering\Core\vtkActor2D.cxx(103):                              this->Mapper->IsA("vtkLabeledDataMapper"))))
 VTK-8\Rendering\Core\vtkImageMapper3D.cxx(250):      if (a->IsA("vtkAssembly") || a->IsA("vtkImageStack"))
 VTK-8\Rendering\Parallel\vtkSynchronizedRenderers.cxx(384):  if (this->ParallelController->IsA("vtkMPIController"))

Thanks for reporting this. VTK developers might respond to this here but if not then submit a merge request with a proposed fix.

I’m not sure what the fix should be for a base module referencing a descendant class. Either refactoring of the modules is required or those classes should not be referenced in those places.

It all compiles because the test is done with a class name which effectively hides the dependency.

The non-existent classes should certainly be fixed. The dependent module thing should probably be fixed by adding a virtual method to the base class named after what is being asked (e.g., vtkProcessController::SupportsAllReduce should be added and vtkActor::GetCapturingGL2PSSpecialProps already exists) instead of assuming functionality based on class names.

AllReduce() is implemented in vtkMultiProcessController, so I’m not sure why it isn’t used for both vtkMPIController and vtkSocketController.

The comments in that code state it doesn’t work for some reason. You’ll have to track down authors of the code to figure out the story.

The original author was @utkarshayachit in commit
SHA-1: 59b4bd57cdbff9fad35c52572ff25092c672fe46

  • Added API to compute visible prop bounds collectively.

I’m familiar enough with vtkImageMapper3D and vtkTransform to put together an MR, maybe TestScalarsToColors.cxx as well.

The classes that IsA refers to may have existed in the past, but were removed/renamed during refactoring. The SafeDownCast() is better in this regard, because it won’t compile if the class is missing.

I understood that IsA() is used here because Safedowncast() might break third party libraries that compare by class name rather than class type.

vtkMultiProcessController::AllReduce calls vtkCommunicator APIs and vtkSocketCommunicator (a vtkCommunicator subclass) does not implement the collectives. The correct fix would be fix vtkSocketCommunicator to implement all the collectives and one would not need the check in vtkSynchronizedRenderers anymore.