[vtkusers] Parallel pipeline based on vtkConnectivityFilter

Robert Sawko robertsawko at gmail.com
Mon Feb 5 04:35:24 EST 2018


Hi,

I am trying to write a parallel variant of a VTK serial pipeline I wrote couple
of weeks back and I would appreciate a little steer from more experienced
users, if that's all right. My data contains some disjoint surfaces and my
serial pipeline iterates over them with vtkConnectivityFilter and if the
surface is closed it computes volume and surface area.

Now I have lots and lots of these surfaces. I am reading about vtk parallel
pipelines, I went through a XMLPWriter example and it all seems to fit, but I
am still not sure how to do it. Do I need to write to a partitioned format? Or
can I just spawn parallel pipeline on top of a threshold filter? Ideally, I
would like to avoid further I/O as I am already straining it needlessly.

Please advise. My serial code with comments below.
Robert



    vtkSmartPointer<vtkConnectivityFilter> connectivity = 
        vtkSmartPointer<vtkConnectivityFilter>::New();
    connectivity->SetInputConnection(reader->GetOutputPort());
    connectivity->SetExtractionModeToSpecifiedRegions(); 
    connectivity->Update(); 

    // PARALLEL: I could add vtkThreshold here and divide it up based on
    // RegionID.

    vtkSmartPointer<vtkGeometryFilter> geometry = 
        vtkSmartPointer<vtkGeometryFilter>::New();
    geometry->SetInputConnection(connectivity->GetOutputPort());
    geometry->Update(); 

    vtkSmartPointer<vtkMassProperties> mass =
        vtkSmartPointer<vtkMassProperties>::New();
    mass->SetInputConnection(geometry->GetOutputPort());

    // PARALLEL: I could have MPI rank here and just do a process-specific
    // porition
    for (int i = 0; i < connectivity->GetNumberOfExtractedRegions(); i++) {
        connectivity->AddSpecifiedRegion(i);

        //check if closed

        mass->Update();
        float V = mass->GetVolume();
        float A = mass->GetSurfaceArea();

        // write V and A to file

        connectivity->DeleteSpecifiedRegion(i);
    }

-- 
Probability is confusing:
http://en.wikipedia.org/wiki/Bertrand_paradox_(probability)
This is why we need sigma-algebras!


More information about the vtkusers mailing list