File

class dolfin.cpp.io.File(*args)

Bases: object

A File represents a data file for reading and writing objects. Unless specified explicitly, the format is determined by the file name suffix. A list of objects that can be read/written to file can be found in GenericFile.h. Compatible file formats include:

  • Binary (.bin)
  • RAW (.raw)
  • SVG (.svg)
  • XD3 (.xd3)
  • XDMF (.xdmf)
  • XML (.xml)
  • XYZ (.xyz)
  • VTK (.pvd)

Overloaded versions

  • File(filename, encoding=”ascii”)

    Create a file with given name

    Arguments
    filename (str)

    Name of file.

    encoding (str)

    Optional argument specifying encoding, ASCII is default.

    Example

    Note

    No example code available for this function.

  • File(comm, filename, encoding=”ascii”)

    Create a file with given name with MPI communicator

    Arguments
    communicator (MPI)

    The MPI communicator.

    filename (str)

    Name of file.

    encoding (str)

    Optional argument specifying encoding, ascii is default.

    Example

    Note

    No example code available for this function.

  • File(filename, type, encoding=”ascii”)

    Create a file with given name and type (format)

    Arguments
    filename (str)

    Name of file.

    type (Type)

    File format.

    encoding (str)

    Optional argument specifying encoding, ascii is default.

    Example

    Note

    No example code available for this function.

  • File(comm, filename, type, encoding=”ascii”)

    Create a file with given name and type (format) with MPI communicator

    Arguments
    communicator (MPI)

    The MPI communicator.

    filename (str)

    Name of file.

    type (Type)

    File format.

    encoding (str)

    Optional argument specifying encoding, ascii is default.

    Example

    Note

    No example code available for this function.

  • File(outstream)

    Create an outfile object writing to stream

    Arguments
    outstream (std::ostream)

    The stream.

binary = 6
static create_parent_path(*args)
Arguments
filename (str)
Name of file / path.
static exists(*args)

Check if file exists

Arguments
filename (str)
Name of file.
Returns
bool
True if the file exists.
raw = 4
svg = 7
thisown

The membership flag

vtk = 3
x3d = 0
xdmf = 1
xml = 2
xyz = 5