Access function in time dependent XDMFFile

Using the other signature of write_checkpoint, with arguments encoding and append:

#write
with XDMFFile("u.xdmf") as file:
    file.write_checkpoint(u, "u_out", 0, XDMFFile.Encoding.HDF5, False)


#read
u1 = Function(V)
with XDMFFile("u.xdmf") as file:
    file.read_checkpoint(u1, "u_out", 0)

with XDMFFile("u.xdmf") as file:    
    file.write_checkpoint(u1, "u_out", 1, XDMFFile.Encoding.HDF5, True)
    file.write_checkpoint(u1, "u_out", 2, XDMFFile.Encoding.HDF5, True)
1 Like