firedrakeproject / firedrake

Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)
https://firedrakeproject.org
Other
513 stars 160 forks source link

Would it be possible to save VTU files in base64 encoding instead of raw? #1312

Open pefarrell opened 6 years ago

pefarrell commented 6 years ago

This is desirable because standard tools like meshio-convert don't work with firedrake's VTU output:

[farrellp@colossus] $ meshio-convert -o gmsh2-ascii any.vtu output.msh

Traceback (most recent call last):
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20180927/bin/meshio-convert", line 11, in <module>
    sys.exit(main())
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20180927/lib/python3.6/site-packages/meshio/cli.py", line 22, in main
    mesh = read(args.infile, file_format=args.input_format)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20180927/lib/python3.6/site-packages/meshio/helpers.py", line 174, in read
    return format_to_reader[file_format].read(filename)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20180927/lib/python3.6/site-packages/meshio/vtu_io.py", line 274, in read
    reader = VtuReader(filename)
  File "/scratch/farrellp/install-scripts/firedrake/firedrake-dev-20180927/lib/python3.6/site-packages/meshio/vtu_io.py", line 98, in __init__
    tree = ET.parse(filename, parser)
  File "src/lxml/etree.pyx", line 3426, in lxml.etree.parse
  File "src/lxml/parser.pxi", line 1840, in lxml.etree._parseDocument
  File "src/lxml/parser.pxi", line 1866, in lxml.etree._parseDocumentFromURL
  File "src/lxml/parser.pxi", line 1770, in lxml.etree._parseDocFromFile
  File "src/lxml/parser.pxi", line 1163, in lxml.etree._BaseParser._parseDocFromFile
  File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
  File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
  File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError
  File "output/initial_0.vtu", line 19
lxml.etree.XMLSyntaxError: Char 0x0 out of allowed range, line 19, column 3
dham commented 6 years ago

I don't think we have a policy objection...

jrmaddison commented 6 years ago

That would make the vtu files about a third larger.