<div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue 14. Feb 2023 at 21:27, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Dave May <<a href="mailto:dave.mayhem23@gmail.com" target="_blank">dave.mayhem23@gmail.com</a>> writes:<br>
<br>
> On Tue 14. Feb 2023 at 17:17, Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:<br>
><br>
>> Can you share a reproducer? I think I recall the format requiring certain<br>
>> things to be Int32.<br>
><br>
><br>
> By default, the byte offset used with the appended data format is UInt32. I<br>
> believe that’s where the sizeof(int) is coming from. This default is<br>
> annoying as it limits the total size of your appended data to be < 3 GB.<br>
> That said, in the opening of the paraview file you can add this attribute<br>
><br>
> header_type="UInt64"<br>
<br>
You mean in the header of the .vtu? </blockquote><div dir="auto"><br></div><div dir="auto">Yeah, within the open VTKFile tag.</div><div dir="auto">Like this</div><div dir="auto">< VTKFile type=“xxx”,  <span class="hljs-attr" style="font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre;color:rgb(0,0,128)">byte_order</span><span style="font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre;background-color:rgb(249,249,249);color:rgb(0,0,128)">=</span><span class="hljs-string" style="font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre">"LittleEndian"</span><span style="font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre;background-color:rgb(249,249,249);color:rgb(0,0,128)"> </span><span class="hljs-attr" style="font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre;color:rgb(0,0,128)">header_type</span><span style="font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre;background-color:rgb(249,249,249);color:rgb(0,0,128)">=</span><span class="hljs-string" style="font-family:monospace,monospace;font-size:15.008000373840332px;white-space:pre">"UInt64" </span>></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)" dir="auto">Do you happen to have an example or pointers to docs describing this feature? </blockquote><div dir="auto"><br></div><div dir="auto">Example yes - will send it to you tomorrow. Docs… not really. Only stuff like this</div><div dir="auto"><br></div><div dir="auto"><div><a href="https://kitware.github.io/paraview-docs/latest/python/paraview.simple.XMLPStructuredGridWriter.html">https://kitware.github.io/paraview-docs/latest/python/paraview.simple.XMLPStructuredGridWriter.html</a></div><br></div><div dir="auto"><br></div><div dir="auto"><div><a href="https://kitware.github.io/paraview-docs/v5.8.0/python/paraview.simple.XMLMultiBlockDataWriter.html">https://kitware.github.io/paraview-docs/v5.8.0/python/paraview.simple.XMLMultiBlockDataWriter.html</a></div><br></div><div dir="auto">All the writers seem to support it.</div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)" dir="auto">Can we always do this? </blockquote><div dir="auto"><br></div><div dir="auto">Yep!</div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)" dir="auto">It isn't mentioned in these: <br>
<br>
<a href="https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf" rel="noreferrer" target="_blank">https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf</a>   (PDF was created in 2003)<br>
<a href="https://kitware.github.io/vtk-examples/site/VTKFileFormats/#xml-file-formats" rel="noreferrer" target="_blank">https://kitware.github.io/vtk-examples/site/VTKFileFormats/#xml-file-formats</a><br>
</blockquote><div dir="auto"><br></div><div dir="auto">Yes I know. I’ve tied myself in knots for years because the of the assumption that the offset had to be an int.</div><div dir="auto"><br></div><div dir="auto">Credit for the discovery goes to Carsten Uphoff. He showed me this.</div><div dir="auto"><br></div><div dir="auto">Cheers,</div><div dir="auto">Dave</div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)" dir="auto"><br>
> then the size of the offset is now UInt64 and now large files can be<br>
> finally written.<br>
><br>
><br>
> Cheers,<br>
> Dave<br>
><br>
><br>
><br>
><br>
>><br>
>> Mike Michell <<a href="mailto:mi.mike1021@gmail.com" target="_blank">mi.mike1021@gmail.com</a>> writes:<br>
>><br>
>> > Thanks for the note.<br>
>> > I understood that PETSc calculates the offsets for me through "boffset"<br>
>> > variable in plexvtu.c file. Please correct me if it is wrong.<br>
>> ><br>
>> > If plexvtu.c has a bug, it could be around "write file header" part in<br>
>> > which the boffset is also computed. Is this correct? I am not using<br>
>> complex<br>
>> > number.<br>
>> > There are several mixed parts among "Int32, UInt8, PetscInt_FMT,<br>
>> > PetscInt64_FMT" in writing the header.<br>
>> ><br>
>> > Which combination of those flags is correct for 64bit indices? I am gonna<br>
>> > modify plexvtu.c file with "#if defined(PETSC_USE_64BIT_INDICES)"<br>
>> > statement, but I do not know what is the correct form of the header flag<br>
>> > for 64bit indices.<br>
>> ><br>
>> > It is also confusing to me:<br>
>> > boffset += gpiece[r].ncells * sizeof(PetscInt) + sizeof(int);<br>
>> > How is sizeof(PetscInt) different from sizeof(int)?<br>
>> ><br>
>> > Thanks,<br>
>> > Mike<br>
>> ><br>
>> ><br>
>> >> On Tue, Feb 14, 2023 at 11:45 AM Mike Michell <<a href="mailto:mi.mike1021@gmail.com" target="_blank">mi.mike1021@gmail.com</a>><br>
>> >> wrote:<br>
>> >><br>
>> >>> I was trying to modify the header flags from "Int32" to "Int64", but<br>
>> the<br>
>> >>> problem was not resolved. Could I get any additional comments?<br>
>> >>><br>
>> >><br>
>> >> The calculated offsets are not correct I think.<br>
>> >><br>
>> >>   Matt<br>
>> >><br>
>> >><br>
>> >>> Thanks,<br>
>> >>> Mike<br>
>> >>><br>
>> >>><br>
>> >>>> Thanks for the comments.<br>
>> >>>> To be precise on the question, the entire part of the header of the<br>
>> .vtu<br>
>> >>>> file is attached:<br>
>> >>>><br>
>> >>>> <?xml version="1.0"?><br>
>> >>>> <VTKFile type="UnstructuredGrid" version="0.1"<br>
>> byte_order="LittleEndian"><br>
>> >>>>   <UnstructuredGrid><br>
>> >>>>     <Piece NumberOfPoints="4872" NumberOfCells="4000"><br>
>> >>>>       <Points><br>
>> >>>>         <DataArray type="Float64" Name="Position"<br>
>> NumberOfComponents="3"<br>
>> >>>> format="appended" offset="0" /><br>
>> >>>>       </Points><br>
>> >>>>       <Cells><br>
>> >>>>         <DataArray type="Int32" Name="connectivity"<br>
>> >>>> NumberOfComponents="1" format="appended" offset="116932" /><br>
>> >>>>         <DataArray type="Int32" Name="offsets"<br>
>> >>>>  NumberOfComponents="1" format="appended" offset="372936" /><br>
>> >>>>         <DataArray type="UInt8" Name="types"<br>
>> >>>>  NumberOfComponents="1" format="appended" offset="404940" /><br>
>> >>>>       </Cells><br>
>> >>>>       <CellData><br>
>> >>>>         <DataArray type="Int32" Name="Rank" NumberOfComponents="1"<br>
>> >>>> format="appended" offset="408944" /><br>
>> >>>>       </CellData><br>
>> >>>>       <PointData><br>
>> >>>>         <DataArray type="Float64" Name="Vec_0x37c89c0_4Field_0.0"<br>
>> >>>> NumberOfComponents="1" format="appended" offset="424948" /><br>
>> >>>>       </PointData><br>
>> >>>>     </Piece><br>
>> >>>>     <Piece NumberOfPoints="4872" NumberOfCells="4000"><br>
>> >>>>       <Points><br>
>> >>>>         <DataArray type="Float64" Name="Position"<br>
>> NumberOfComponents="3"<br>
>> >>>> format="appended" offset="463928" /><br>
>> >>>>       </Points><br>
>> >>>>       <Cells><br>
>> >>>>         <DataArray type="Int32" Name="connectivity"<br>
>> >>>> NumberOfComponents="1" format="appended" offset="580860" /><br>
>> >>>>         <DataArray type="Int32" Name="offsets"<br>
>> >>>>  NumberOfComponents="1" format="appended" offset="836864" /><br>
>> >>>>         <DataArray type="UInt8" Name="types"<br>
>> >>>>  NumberOfComponents="1" format="appended" offset="868868" /><br>
>> >>>>       </Cells><br>
>> >>>>       <CellData><br>
>> >>>>         <DataArray type="Int32" Name="Rank" NumberOfComponents="1"<br>
>> >>>> format="appended" offset="872872" /><br>
>> >>>>       </CellData><br>
>> >>>>       <PointData><br>
>> >>>>         <DataArray type="Float64" Name="Vec_0x37c89c0_4Field_0.0"<br>
>> >>>> NumberOfComponents="1" format="appended" offset="888876" /><br>
>> >>>>       </PointData><br>
>> >>>>     </Piece><br>
>> >>>>   </UnstructuredGrid><br>
>> >>>>   <AppendedData encoding="raw"><br>
>> >>>><br>
>> >>>><br>
>> >>>> Thanks,<br>
>> >>>> Mike<br>
>> >>>><br>
>> >>>><br>
>> >>>>> On Sun, Feb 12, 2023 at 6:15 PM Mike Michell <<a href="mailto:mi.mike1021@gmail.com" target="_blank">mi.mike1021@gmail.com</a>><br>
>> >>>>> wrote:<br>
>> >>>>><br>
>> >>>>>> Dear PETSc team,<br>
>> >>>>>><br>
>> >>>>>> I am a user of PETSc with Fortran. My code uses DMPlex to handle dm<br>
>> >>>>>> object. To print out output variable and mesh connectivity, I use<br>
>> VecView()<br>
>> >>>>>> by defining PetscSection on that dm and borrow a vector. The type<br>
>> of the<br>
>> >>>>>> viewer is set to PETSCVIEWERVTK.<br>
>> >>>>>><br>
>> >>>>>> With 32bit indices, the above work flow has no issue. However, if<br>
>> >>>>>> PETSc is configured with 64bit indices, my output .vtu file has an<br>
>> error if<br>
>> >>>>>> I open the file with visualization tools, such as Paraview or<br>
>> Tecplot,<br>
>> >>>>>> saying that:<br>
>> >>>>>> "Cannot read cell connectivity from Cells in piece 0 because the<br>
>> >>>>>> "offsets" array is not monotonically increasing or starts with a<br>
>> value<br>
>> >>>>>> other than 0."<br>
>> >>>>>><br>
>> >>>>>> If I open the .vtu file from terminal, I can see such a line:<br>
>> >>>>>> ...<br>
>> >>>>>> <DataArray type="Int32" Name="connectivity" NumberOfComponents="1"<br>
>> >>>>>> format="appended" offset="580860" /><br>
>> >>>>>> ...<br>
>> >>>>>><br>
>> >>>>>> I expected "DataArray type="Int64", since the PETSc has 64bit<br>
>> indices.<br>
>> >>>>>> Could I get recommendations that I need to check to resolve the<br>
>> issue?<br>
>> >>>>>><br>
>> >>>>><br>
>> >>>>> This is probably a bug. We will look at it.<br>
>> >>>>><br>
>> >>>>> Jed, I saw that Int32 is hardcoded in plexvtu.c, but sizeof(PetscInt)<br>
>> >>>>> is used to calculate the offset, which looks inconsistent. Can you<br>
>> take a<br>
>> >>>>> look?<br>
>> >>>>><br>
>> >>>>>   Thanks,<br>
>> >>>>><br>
>> >>>>>      Matt<br>
>> >>>>><br>
>> >>>>><br>
>> >>>>>> Thanks,<br>
>> >>>>>> Mike<br>
>> >>>>>><br>
>> >>>>><br>
>> >>>>><br>
>> >>>>> --<br>
>> >>>>> What most experimenters take for granted before they begin their<br>
>> >>>>> experiments is infinitely more interesting than any results to which<br>
>> their<br>
>> >>>>> experiments lead.<br>
>> >>>>> -- Norbert Wiener<br>
>> >>>>><br>
>> >>>>> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
>> >>>>> <<a href="http://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">http://www.cse.buffalo.edu/~knepley/</a>><br>
>> >>>>><br>
>> >>>><br>
>> >><br>
>> >> --<br>
>> >> What most experimenters take for granted before they begin their<br>
>> >> experiments is infinitely more interesting than any results to which<br>
>> their<br>
>> >> experiments lead.<br>
>> >> -- Norbert Wiener<br>
>> >><br>
>> >> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
>> >> <<a href="http://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">http://www.cse.buffalo.edu/~knepley/</a>><br>
>> >><br>
>><br>
</blockquote></div></div>