@@ -47,6 +47,7 @@ def __init__(
4747 self ,
4848 comm : _MPI .Comm ,
4949 filename : str | Path ,
50+ mode : str ,
5051 output : Mesh | Function | list [Function ] | tuple [Function ],
5152 engine : str = "BPFile" ,
5253 mesh_policy : VTXMeshPolicy = VTXMeshPolicy .update ,
@@ -56,6 +57,8 @@ def __init__(
5657 Args:
5758 comm: The MPI communicator
5859 filename: The output filename
60+ mode: The filemode to open the file in, one of 'a' (append)
61+ or 'w' (write).
5962 output: The data to output. Either a mesh, a single
6063 (discontinuous) Lagrange Function or list of
6164 (discontinuous) Lagrange Functions.
@@ -87,14 +90,16 @@ def __init__(
8790 raise RuntimeError (f"VTXWriter does not support dtype={ dtype } ." )
8891
8992 if isinstance (output , Mesh ):
90- self ._cpp_object = _vtxwriter (comm , filename , output ._cpp_object , engine ) # type: ignore[union-attr]
93+ self ._cpp_object = _vtxwriter (comm , filename , mode , output ._cpp_object , engine ) # type: ignore[union-attr]
9194 else :
9295 cpp_objects = (
9396 [output ._cpp_object ]
9497 if isinstance (output , Function )
9598 else [o ._cpp_object for o in output ]
9699 )
97- self ._cpp_object = _vtxwriter (comm , filename , cpp_objects , engine , mesh_policy )
100+ self ._cpp_object = _vtxwriter (
101+ comm , filename , mode , cpp_objects , engine , mesh_policy
102+ )
98103
99104 def __enter__ (self ):
100105 """Enter context manager."""
0 commit comments