XDMFFile¶
-
class
dolfin.cpp.io.XDMFFile(*args)¶ Bases:
dolfin.cpp.common.VariableRead and write
Mesh,Function,MeshFunctionand other objects in XDMF. This class supports the output of meshes and functions in XDMF (http://www.xdmf.org ) format. It creates an XML file that describes the data and points to a HDF5 file that stores the actual problem data. Output of data in parallel is supported. XDMF is not suitable for checkpointing as it may decimate some data.Constructor.
Parameters: - comm (MPI_Comm) –
- std::string filename (const) –
-
Encoding_ASCII= 1¶
-
Encoding_HDF5= 0¶
-
close()¶ Close the file This closes any open HDF5 files. In ASCII mode the XML file is closed each time it is written to or read from, so
closehas no effect. From Python you can also useXDMFFileas a context manager:with XDMFFile(mpi_comm_world(), 'name.xdmf') as xdmf: xdmf.write(mesh)
The file is automatically closed at the end of the with block
Return type: void
-
read()¶ Read
MeshValueCollectionfrom file, optionally specifying dataset nameParameters: - double > & mvc (MeshValueCollection<) – (MeshValueCollection<double>)
MeshValueCollectionto restore - name (std::string) – (std::string) Name of data attribute in XDMF file
Return type: void
- double > & mvc (MeshValueCollection<) – (MeshValueCollection<double>)
-
thisown¶ The membership flag
-
write()¶ Save a cloud of points, with scalar values using an associated HDF5 file, or storing the data inline as XML.
Parameters: - std::vector< Point > & points (const) – (std::vector<Point>) A list of points to save.
- std::vector< double > & values (const) – (std::vector<double>) A list of values at each point.
- encoding (Encoding) – (Encoding) Encoding to use: HDF5 or ASCII
Return type: void