How can i use the vtkStreamtracer to generate a streamline with my unstructured grid data(vtu)

I`m using VTK to visualize data coming from xflow in vtu. When I use the
Paraview, it can generate the right streamline, but when I use the VTK to
visualize my data, it only displays the outline and the airplane model.
There is no streamline being generated.
This is my code:

    vtkSmartPointer<vtkNamedColors> namedColors = vtkSmartPointer<vtkNamedColors>::New();

       //The AirplaneModel file
    std::string meshfilename = "K:/Project/VTKproject/Airplane_Process/data/Mesh.vtp";
    vtkSmartPointer<vtkXMLPolyDataReader> meshreader = vtkSmartPointer<vtkXMLPolyDataReader>::New();
    meshreader->SetFileName(meshfilename.c_str());
    meshreader->Update();

       //The data file
    std::string datafilename ="K:/Project/VTKproject/Airplane_Process/data/data.vtu";
    vtkSmartPointer<vtkXMLUnstructuredGridReader> datareader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
    datareader->SetFileName(datafilename.c_str());
    datareader->Update();

    //The seed points
    vtkSmartPointer<vtkPointSource> seeds = vtkSmartPointer<vtkPointSource>::New();
    seeds->SetCenter(0,0,0);
    seeds->SetRadius(0.05);
    seeds->SetNumberOfPoints(100);


    //streamline generate

    vtkSmartPointer<vtkStreamTracer> streamline = vtkSmartPointer<vtkStreamTracer>::New();
    datareader->Update();
    streamline->SetInputConnection(datareader->GetOutputPort());
    streamline->SetSourceConnection(seeds->GetOutputPort());
    //streamline->SetIntegrationStepUnit(vtkStreamTracer::CELL_LENGTH_UNIT);
    streamline->SetMaximumPropagation(500);
    streamline->SetMaximumIntegrationStep(0.1);
    streamline->SetMinimumIntegrationStep(0.01);
    streamline->SetInitialIntegrationStep(0.05);
    //streamline->SetIntegrationStepUnit(vtkStreamTracer::CELL_LENGTH_UNIT);
    streamline->SetIntegrationDirectionToBoth();
    streamline->SetIntegratorTypeToRungeKutta45();
    streamline->Update();

    vtkSmartPointer<vtkPolyDataMapper> streamLineMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    streamLineMapper->SetInputConnection(streamline->GetOutputPort());

    vtkSmartPointer<vtkActor> streamLineActor = vtkSmartPointer<vtkActor>::New();
    streamLineActor->SetMapper(streamLineMapper);

    //outlinefilter
    vtkSmartPointer<vtkOutlineFilter> outline =vtkSmartPointer<vtkOutlineFilter>::New();
    outline->SetInputConnection(datareader->GetOutputPort());

    vtkSmartPointer<vtkPolyDataMapper> outlineMapper =vtkSmartPointer<vtkPolyDataMapper>::New();
    outlineMapper->SetInputConnection(outline->GetOutputPort());

    vtkSmartPointer<vtkActor> outlineActor =vtkSmartPointer<vtkActor>::New();
    outlineActor->SetMapper(outlineMapper);
    outlineActor->GetProperty()->SetColor(0,0,0);

    //
    vtkSmartPointer<vtkPolyDataMapper> meshmapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    meshmapper->SetInputConnection(meshreader->GetOutputPort());

    vtkSmartPointer<vtkActor> meshactor = vtkSmartPointer<vtkActor>::New();
    meshactor->SetMapper(meshmapper);

    //rendering
    vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
    renderer->AddActor(meshactor);
    renderer->AddActor(outlineActor);
    renderer->AddActor(streamLineActor);
    //renderer->AddActor(actor);
    renderer->SetBackground(namedColors->GetColor3d("Cadet").GetData());
    //window
    vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
    renderWindow->AddRenderer(renderer);

    //interaction
    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
    renderWindowInteractor->SetRenderWindow(renderWindow);

    vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
        vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
    renderWindowInteractor->SetInteractorStyle(style);
    renderWindowInteractor->Initialize();
    renderWindow->SetSize(300, 300);
    renderWindow->Render();
    renderWindowInteractor->Start();

This is my desired output generated in paraview:
![paraview1|455x209](upload://2NoqWPUqUNU2P53b7iBL7mnxeGD.png) 

This is the result of my code:
![%E6%88%91%E7%9A%84%E6%95%88%E6%9E%9C|690x305](upload://99P9p8A20iDJ9XhZV3XSePEPASR.png) 

Sorry,I`m a new here,I don`t find the image function.Any ideas on how to solve this?

Hello, we spoke on stackoverflow if you remember. How is your solution going ? I am kind of looking for creating another class such as poly data and apply streamline to that but really in doubt if this is the only way

Sorry, my work has not progressed. I think the streamtracer should support the grid data,because the unstructured grid is a common data structure in streamline render.There may be some other detail I have never know in the streamtracer.

try this and let me know the result:

vtkSmartPointer<vtkUnstructuredGrid> data = reader->GetOutput();

// cell 2 point and contour

vtkCellDataToPointData* c2p = vtkCellDataToPointData::New();

c2p->SetInputData(data);

vtkStreamTracer* streamer = vtkStreamTracer::New();

streamer->SetInputConnection(c2p->GetOutputPort());

If you’re open to Python, maybe PyVista and specifically, these examples on using the vtkStreamTracer would make your life easier.

vtkStreamTracer is a complicated filter and we worked to make it much easier to use with any data type and more accessible for people wanting to experiment with it in PyVista

I’ve tried using the code provided in your examples on my data-set. Unfortunately it did not produce any streamlines.

Printing the mesh gives:
UnstructuredGrid (0x7fb52607f3a0)
N Cells: 16135415
N Points: 17027364
X Bounds: -1.250e+01, 1.250e+01
Y Bounds: -1.250e+01, 1.250e+01
Z Bounds: -1.516e+00, 2.000e+00
N Arrays: 13

But there are no mesh vectors. Perhaps that’s why when trying to produce streamlines I get:
PolyData (0x7fb568557d00)
N Cells: 0
N Points: 0
X Bounds: 1.000e+00, -1.000e+00
Y Bounds: 1.000e+00, -1.000e+00
Z Bounds: 1.000e+00, -1.000e+00
N Arrays: 0

Am I missing something?

You’ll need to have vectors on the input in order to do this