demo_timing.py is broken

Issue #549 resolved
Prof Garth Wells created an issue

demo_timing.py doesn't handle writing to existing XML files properly.

The XMLFile class is very simple and doesn't handle things like

if MPI.rank(mpi_comm_world()) == 0:
    f = File(mpi_comm_self(), "timings_aggregate.xml")
    f << t_sum
    f << t_min
    f << t_max
    f << t_avg

properly. XMLFile is set-up to read, or to write just once.

The proper fix is return a handle to an XML objects that can be manipulated, which at destruction writes to file.

Comments (13)

  1. Prof Garth Wells reporter

    @blechta I'm not sure if this a priority for 1.6. Maybe just make sure a single table can be output? Longer term we can let a user get a XML handle and stick whatever they want in file (implementing this would be too much for the 1.6 release).

  2. Jan Blechta

    Let me fix this, it is easy. Regression is that pugixlm::load_file now returns status_no_document_element instead of 0 if document is empty.

  3. Prof Garth Wells reporter

    The logic in the code seemed a bit wonky to me. Do we need a better fix longer term?

  4. Jan Blechta

    The logic in the code seemed a bit wonky to me. Do we need a better fix longer term?

    What do you mean, Garth? Which code?

  5. Log in to comment