[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 14:50:47 EDT 2015


Hi,

Thanks for your suggestion. I did it as follows,

  vtkMultiBlockDataSet* grid = vtkMultiBlockDataSet::New();
  vtkNew<vtkMultiPieceDataSet> mpds;
  mpds->SetNumberOfPieces(*mpiSize);
  mpds->SetPiece(*mpiRank, sg.GetPointer());
  grid->SetNumberOfBlocks(1);
  grid->SetBlock(0, mpds.GetPointer());

so, there is one block that has each partition in a vtkMultiPieceDataSet.
Thanks again.

Regards,

--ufuk


> If the output of the vtm is what you're looking for you won't be able to
> do
> that with the parallel XML structured grid writer because you have a node
> partition (i.e. nodes are uniquely assigned to a process and in this case
> no other process has that node). Thus the missing cells at the partition
> boundary are causing you problems with the pvts reader.
>
> With the multiblock data set my suggestion is to make the first block in
> that be a vtkMultiPieceDataSet and then add each process's structured grid
> as a piece to that. Then when you load it into ParaView it will behave
> much
> more uniformly.
>
>
>
> On Fri, Jun 26, 2015 at 9:56 AM, <u.utku.turuncoglu at be.itu.edu.tr> wrote:
>
>> Hi,
>>
>> Thanks for your help. Actually, every processor has its own data and i
>> am
>> just using the interior regions (so, it does not overlap, no ghost or
>> halo
>> regions). Anyway, after my initial mail, i changed the SetExtent part of
>> the code as
>>
>>   sg->SetExtent (*nxstart-2, *nxend-2, *nystart-2, *nyend-2, 0, 0);
>>
>> because it was starting from 1 in each direction, now it starts from
>> zero.
>> This modification fixes the mismatch problem in the number of points
>> comes
>> from Paraview and seen in the C++ code. On the other hand, the Paraview
>> still complains about the following extents (seems that the inner
>> boundary
>> of the 2 x 2 decomposition elements, like ghost region).
>>
>>     0 140  57 58  0 0
>>     70 71  0 57  0 0
>>     70 71  58 114  0 0
>>
>> You can find the data in the attached file (data_00.tar.gz).
>>
>> Then, i tried to put the individual parts of the structured grid into
>> the
>> vtkMultiBlockDataSet using following code
>>
>>   //
>>   // Create multi block grid
>>   //
>>   vtkMultiBlockDataSet* grid = vtkMultiBlockDataSet::New ();
>>   grid->SetNumberOfBlocks(*mpiSize);
>>   grid->SetBlock (*mpiRank, sg.GetPointer());
>>
>> and write the grid information to the file (data_01.tar.gz). In this
>> case,
>> Paraview could open the *.vtm file without any message. So, i could not
>> be
>> sure about the grid. It seems fine if i look at multi block data file
>> (vtm) but not in pvts file.
>>
>> Regards,
>>
>> --ufuk
>>
>>
>> > Do you have a node partitioning of your grid? If you do you really
>> need a
>> > cell partitioning of the grid which will have multiple points a the
>> > partition overlap.
>> >
>> > Can you share your data?
>> >
>> > On Fri, Jun 26, 2015 at 5:58 AM, <u.utku.turuncoglu at be.itu.edu.tr>
>> wrote:
>> >
>> >> 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
>> >>
>> >> _______________________________________________
>> >> Powered by www.kitware.com
>> >>
>> >> Visit other Kitware open-source projects at
>> >> http://www.kitware.com/opensource/opensource.html
>> >>
>> >> Please keep messages on-topic and check the ParaView Wiki at:
>> >> http://paraview.org/Wiki/ParaView
>> >>
>> >> Search the list archives at: http://markmail.org/search/?q=ParaView
>> >>
>> >> Follow this link to subscribe/unsubscribe:
>> >> http://public.kitware.com/mailman/listinfo/paraview
>> >>
>> >
>>
>



More information about the ParaView mailing list