question about the type transfer from vtkDataObject to vtkPolyData

Hello,

I try to gather the polydata generated by different processes into one processes based on vtkMPIController, and then aggregate them into one data set for further processing by following code:

    ......
    std::vector<vtkSmartPointer<vtkDataObject> > recvlist;
    int status = vtkcontroller->Gather(polydata, recvlist, 0);
    if (!status)
    {
      throw std::runtime_error("failed to gather poly data");
    }

    if (rank == 0)
    {
      std::cout << "size of recvlist: " << recvlist.size() << std::endl;
      // Append data
      vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
      for (int i = 0; i < recvlist.size(); i++)
      {
        vtkSmartPointer<vtkPolyData> temppolydata;
        temppolydata.TakeReference(recvlist[i]);
        appendFilter->AddInputData(temppolydata);
      }

      auto output = appendFilter->GetOutput();
      ......
     }

But there is compiling error for the AddInputData function, since I’m not sure what is the proper way to transfer the vtkDataObject into the vtkPolyData.

Thanks a lot for your help!