just to add that for compressed vtu files I use the attached conversion
script based on binary vtk files exported from getfem.
On Thu, May 7, 2020 at 11:59 AM Konstantinos Poulios <
[email protected]> wrote:
> Dear Tetsuo
>
> I think it is an important contribution to add vtu support, especially if
> it is binary/compressed, just ascii is not very useful. However we might
> need to discuss a bit on how to do it. As far as I can see you have used
> boost for xml writing. I think we had dropped our dependency on boost and I
> am not very keen on reintroducing a dependency on boost.
>
> Before we merge this, I would like to hear some arguments for one solution
> or another. The first thing to check is what others do. How is vtu export
> implemented in other software like e.g. fenics? What is the more
> future-proof way of implementing vtu support? What is a solution with least
> dependencies? If we have to depend on an external library it might be
> better to depend on vtk directly
> https://www.paraview.org/Wiki/VTK/Examples/Cxx/IO/WriteVTU
>
> Have you done some research regarding these questions?
>
> There is also another thing that I would like to ask you about. Could you
> please don't use markup in your git commit description? It might look nice
> in your git client but it looks ugly and difficult to read on other's
> systems.
>
> Best regards
> Kostas
>
>
>
>
> On Thu, May 7, 2020 at 2:07 AM Tetsuo Koyama <[email protected]> wrote:
>
>> Dear getfem project
>>
>> Could you merge devel-tetsuo-xml?
>> This branch is addition of vtu_export class.
>> By using this class we can export xml unstructured grid format vtk
>> (only ascii format and write_point_data).
>> I tested it by using meshio package (https://github.com/nschloe/meshio).
>> In the future, the binary format and write_cell_data method may be
>> extended.
>>
>> Thank you for reading.
>>
>> BR Tetsuo
>>
>>
import sys
import os
import glob
from paraview.simple import *
if hasattr(sys, 'argv') and len(sys.argv) > 1:
namepattern = sys.argv[1]
files = glob.glob(namepattern+"*.vtk")
cleanup = (len(sys.argv) > 2 and sys.argv[2] == "cleanup")
for f in files:
r = LegacyVTKReader( FileNames=[f] )
w = XMLUnstructuredGridWriter()
w.DataMode = "Appended"
w.CompressorType = "ZLib"
w.FileName = f[:-3]+"vtu"
w.UpdatePipeline()
if cleanup:
os.remove(f)
else:
print('Usage: pvpython convert_vtk_to_vtu.py "./results/filebasename" "cleanup"')