[vtkusers] read XDMF in parallel

Nico Schlömer nico.schloemer at gmail.com
Tue Jun 16 09:06:56 EDT 2015


>From [1], I find that parallel reading of XDMF files is as simple as
```
  vtkMPIController *contr = vtkMPIController::New();
  contr->Initialize();
  int proc = contr->GetLocalProcessId();
  int numprocs = contr->GetNumberOfProcesses();
  contr->Barrier();
  vtkXdmf3Reader *xreader = vtkXdmf3Reader::New();
  xreader->SetFileName("data/pacman.xmf");
  contr->Barrier();
  xreader->SetUpdateExtent(proc, numprocs, 0);
  xreader->Update();
```
How can I check if this really worked?
After retrieving the output
```
  vtkDataObject *rOutput = xreader->GetOutputDataObject(0);
  TEUCHOS_ASSERT(rOutput != nullptr);
  vtkUnstructuredGrid * m = dynamic_cast<vtkUnstructuredGrid*>(rOutput);
  TEUCHOS_ASSERT(m != nullptr);

  std::cout << m->GetNumberOfCells() << " " << m->GetNumberOfPoints()
<< std::endl;
```
it seems that the all procs have all points and cells.

Is there a way to only retrieve the locally owned cells/points?

Cheers,
Nico


More information about the vtkusers mailing list