<div dir="ltr">Hi Alejandro,<div><br></div><div>I will check this out soon. To make sure that I understand, when you write out the data stored in the trivial producer using vtkXMLPImageDataWriter, the extent in the pvti file is wrong. Did I get that right?</div><div><br></div><div>Best,</div><div>-berk</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 4, 2015 at 7:43 AM, Alejandro Fernández <span dir="ltr"><<a href="mailto:alejandro.fernandez@bsc.es" target="_blank">alejandro.fernandez@bsc.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi Berk,<br>
    <br>
    Thanks a lot for your help. Now the whole extent in the .pvti file
    is correct. <br>
    <br>
    However, since I upgraded from VTK 6.0 to VTK 6.2, the extent
    information in the PVTI file contains only the extent information of
    the piece 0 (since only process 0 writes the .pvti file). If I add
    them manually in the PVTI file, paraview opens it perfectly
    (although the extents have to overlap in one point, even if the
    information in the pieces is completely disjoint, otherwise paraview
    complains).<br>
    <br>
    Here I attach my original .pvti file and the one manually fixed, as
    well as the piece VTI files.<br>
    <br>
    Thank you very much for your time and attention,<span class=""><br>
    <pre cols="72">-- 

Alejandro Fernández Suárez
Computer Science Dept.
K2M Building - Room 104 - <a href="tel:%28%2B34%29%20934%20137%20529" value="+34934137529" target="_blank">(+34) 934 137 529</a>
Barcelona Supercomputing Center - CNS
<a href="http://www.bsc.es" target="_blank">www.bsc.es</a></pre>
    </span><div><div class="h5"><div>On 03/06/2015 16:33, Berk Geveci wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Alejandro,
        <div><br>
        </div>
        <div>(I CCed the mailing list to share the knowledge)</div>
        <div><br>
        </div>
        <div>(Note that you need VTK 6.2 or later for what I am about to
          describe.)</div>
        <div><br>
        </div>
        <div>What you have is almost correct. You just need a way for
          the whole extent information to get to the writer. So do this:</div>
        <div><br>
        </div>
        <div>vtkNew<vtkTrivialProducer> tp;</div>
        <div>tp->SetOutput(imageData);</div>
        <div>tp->SetWholeExtent(<span style="font-size:12.8000001907349px">0, msx-1, 0, msy-1,</span><span style="font-size:12.8000001907349px"> 0, msz-1);</span></div>
        <div><span style="font-size:12.8000001907349px"><br>
          </span></div>
        <div><span style="font-size:12.8000001907349px">writer->SetInputConnection(tp->GetOutputPort());</span></div>
        <div><span style="font-size:12.8000001907349px"><br>
          </span></div>
        <div><span style="font-size:12.8000001907349px">By the way,
            SetInputData() does almost exactly this except that it has
            no way of setting the whole extent.</span></div>
        <div><span style="font-size:12.8000001907349px"><br>
          </span></div>
        <div><span style="font-size:12.8000001907349px">Best,</span></div>
        <div><span style="font-size:12.8000001907349px">-berk</span></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Jun 2, 2015 at 12:28 PM,
          Alejandro Fernández <span dir="ltr"><<a href="mailto:alejandro.fernandez@bsc.es" target="_blank">alejandro.fernandez@bsc.es</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> Thanks for your
              answer!<br>
              <br>
              I used the vtkXMLPImageDataWriter to write my .pvti file
              only with MPI process 0. However, I can not find a way to
              specify the whole extent of the .pvti file separately from
              the extent of each piece. My domains are patitioned along
              the Z axis (third) component. But the writer seems to
              implicitly partition the Y axis and I do not know how to
              specify it separately. Please, can you tell me if there is
              any way to do so? Here is the structure of my code:<br>
              <br>
              vtkSmartPointer<vtkImageData> imageData =
              vtkSmartPointer<vtkImageData>::New();<br>
              imageData->SetExtent(0, msx-1, 0, msy-1, zstart, zend);
              // zstart and zend vary depending on MPI process<br>
              imageData->SetSpacing(hx, hy, hz);<br>
              <br>
              vtkSmartPointer<VtkFloatArray> sf =
              vtkSmartPointer<VtkFloatArray>::New();<br>
              sf->SetNumberOfComponents(nDims);<br>
              sf->SetNumberOfTuples(msx*msy*(zend-zstart+1));<br>
              ... loop<br>
                          sf->SetTuple(tupleCount++, field_data);<br>
              ...<br>
              <br>
              imageData->GetPointData()->AddArray(sf);<br>
              <br>
              vtkSmartPointer<vtkXMLPImageDataWriter> writer =
              vtkSmartPointer<vtkXMLPImageDataWriter>::New();<br>
              <br>
              // I would expect a way to specify the "whole extent" here<br>
              // This does not work <a href="http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Removal_of_SetWholeExtent" target="_blank">http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Removal_of_SetWholeExtent</a><br>
              if (world->rank() != 0) 
              writer->WriteSummaryFileOff();<br>
              writer->SetNumberOfPieces(world->size());<br>
              writer->SetEndPiece(world->rank());<br>
              writer->SetStartPiece(world->rank());<br>
              <br>
              writer->SetFileName("output.pvti");<br>
              writer->SetInputData(imageData);<br>
              writer->Write();<br>
              <br>
              Thanks a lot!<span><br>
                <pre cols="72">--

Alejandro Fernández Suárez
Computer Science Dept.
K2M Building - Room 104 - <a href="tel:%28%2B34%29%20934%20137%20529" value="+34934137529" target="_blank">(+34) 934 137 529</a>
Barcelona Supercomputing Center - CNS
<a href="http://www.bsc.es" target="_blank">www.bsc.es</a></pre>
              </span>
              <div>
                <div>
                  <div>On 01/06/2015 19:52, Shawn Waldon wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div dir="ltr">
                      <div>One of the key things to realize about the
                        vtkXMLP*Writers is that the writer makes no
                        assumptions when used in parallel.  The P is for
                        Piece not Parallel, so you have to tell it how
                        many pieces total are being written.  You also
                        have to tell it the start and end piece numbers
                        for each process (probably just the process
                        id).  Otherwise it defaults to  one total piece
                        and each process thinks it is writing piece 0 so
                        the file gets clobbered when all the processes
                        try to write it.  See the vtkXMLPDataWriter
                        documentation [1] for details on how to set
                        these options.<br>
                        <br>
                      </div>
                      <div>HTH,<br>
                      </div>
                      Shawn<br>
                      <br>
                      [1]: <a href="http://www.vtk.org/doc/nightly/html/classvtkXMLPDataWriter.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkXMLPDataWriter.html</a><br>
                    </div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On Mon, Jun 1, 2015 at
                        1:15 PM, Berk Geveci <span dir="ltr"><<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                          <div dir="ltr">The easiest thing is to
                            use vtkXMLPImageDataWriter in parallel to
                            write an example and then to follow that
                            template.
                            <div><br>
                            </div>
                            <div>Best,</div>
                            <div>-berk</div>
                          </div>
                          <div>
                            <div>
                              <div class="gmail_extra"><br>
                                <div class="gmail_quote">On Thu, May 28,
                                  2015 at 2:20 PM, Alejandro Fernández <span dir="ltr"><<a href="mailto:alejandro.fernandez@bsc.es" target="_blank">alejandro.fernandez@bsc.es</a>></span>
                                  wrote:<br>
                                  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello
                                    everyone,<br>
                                    <br>
                                    I have a C++ MPI application that
                                    writes the results of a
                                    domain-decomposed mesh in different
                                    VTI files. Each process writes its
                                    own VTI file with the points
                                    corresponding to its domain. In
                                    order to group all VTI files into a
                                    single 3D image in paraview, I want
                                    to produce a single PVTI file using
                                    XMLPImageDataWriter. However, I have
                                    not found any example and do not
                                    know how to achieve this result with
                                    just the raw class method
                                    documentation.<br>
                                    <br>
                                    Please, can somebody provide me a
                                    C++ example or point me to the
                                    required documentation?<br>
                                    <br>
                                    Thank you very much, your help will
                                    be much appreciated.<br>
                                    <br>
                                    -- <br>
                                    <br>
                                    Alejandro Fernández Suárez<br>
                                    Computer Science Dept.<br>
                                    K2M Building - Room 104 - <a href="tel:%28%2B34%29%20934%20137%20529" value="+34934137529" target="_blank">(+34) 934 137 529</a><br>
                                    Barcelona Supercomputing Center -
                                    CNS<br>
                                    <a href="http://www.bsc.es" target="_blank">www.bsc.es</a><br>
                                    <br>
_______________________________________________<br>
                                    Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
                                    <br>
                                    Visit other Kitware open-source
                                    projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                                    <br>
                                    Please keep messages on-topic and
                                    check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
                                    <br>
                                    Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
                                    <br>
                                    Follow this link to
                                    subscribe/unsubscribe:<br>
                                    <a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
                                  </blockquote>
                                </div>
                                <br>
                              </div>
                            </div>
                          </div>
                          <br>
_______________________________________________<br>
                          Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
                          <br>
                          Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                          <br>
                          Please keep messages on-topic and check the
                          VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
                          <br>
                          Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
                          <br>
                          Follow this link to subscribe/unsubscribe:<br>
                          <a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
                          <br>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>