[Paraview] problem in defining vtkStructuredGrid in MPI

u.utku.turuncoglu at be.itu.edu.tr u.utku.turuncoglu at be.itu.edu.tr
Fri Jun 26 05:58:45 EDT 2015


Hi,

I am trying to create structured grid in an MPI application and i am using
following C++ code to implement it

extern "C" void createstgrid_(double* y, double* x,
                              int* nxstart, int* nxend, int* nystart, int*
nyend,
                              int* nx, int* ny, int* nz, int* mpiSize,
int* mpiRank) {
  //
  // Create structured grid
  //
  vtkSmartPointer<vtkStructuredGrid> sg =
vtkSmartPointer<vtkStructuredGrid>::New();
  sg->SetExtent (*nxstart-1, *nxend-1, *nystart-1, *nyend-1, 0, 0);

  //
  // Create data structure to store grid coordinates
  //
  int pnx = ((*nxend)-(*nxstart))+1;
  int pny = ((*nyend)-(*nystart))+1;
  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();

  //
  // Insert grid coordinate data as points
  //
  k = 0;
  for (int j = 0; j < pny; j++) {
    for (int i = 0; i < pnx; i++) {
      points->InsertPoint(k, x[i+j*pnx], y[i+j*pnx], 0);
      k = k+1;
    }
  }
  sg->SetPoints(points);

  //
  // Set grid
  //
  vtkCPPythonAdaptorAPI::GetCoProcessorData()->GetInputDescriptionByName("input")->SetGrid(sg);
  vtkCPPythonAdaptorAPI::GetCoProcessorData()->GetInputDescriptionByName("input")->SetWholeExtent(0,
*nx-1, 0, *ny-1, 0, 0);
}

so, when i run the code with grid writer, it creates the individual file
(*.vts) for each processor and one extra for the combination (*.pvts).
Anyway, the individual files looks fine in Paraview but if i open the file
with pvts extension, i am getting following error,

ERROR: In
/Users/turuncu/Qsync/progs/paraview-4.3.1/src/VTK/IO/XML/vtkXMLPStructuredDataReader.cxx,
line 461
vtkXMLPStructuredGridReader (0x7f961c0910a0): No available piece provides
data for the following extents:
0 140  0 1  0 0
0 1  1 58  0 0
0 140  58 59  0 0
0 1  59 114  0 0
71 72  1 58  0 0
71 72  59 114  0 0

The UpdateExtent cannot be filled.

What is the meaning of this message? It means that some of the grid data
(or points) are not filled by the code. I also check the loop in the C++
code and print out the number of points for each processor

0 number of points = 4118
1 number of points = 4047
2 number of points = 4060
3 number of points = 3990

and the total is 16215, which is consistent with the size of the grid but
if i check the individual vts files from the Paraview, the files shows
different number of points for each file

0 number of points = 4118
1 number of points = 3976
2 number of points = 4002
3 number of points = 3864

So, only first file matchs with the C++ code but others not. I am not sure
what is happening in there and if you have any suggestion that will be
great.

Anyway, in this case i did not use vtkMultiBlockDataSet but after having
correct representation of the grid, i am planing use SetBlock method of
vtkMultiBlockDataSet to assign decomposition elements as individual
blocks.

Regards,

--ufuk



More information about the ParaView mailing list