trimem.mc.output package

Module contents

IO functionality.

Writing and reading of output trajectories and checkpoint files.

Submodules

trimem.mc.output.checkpoint module

Checkpoint writer/reader.

Writes and reads the mesh and configuration data that is necessary to restart a simulation.

class trimem.mc.output.checkpoint.CheckpointReader(fname, fnum)

Reader for a checkpoint file with number fnum and prefix fname.

Parameters:
  • fname (str, path-like) – filename prefix.

  • fnum (int) – checkpoint file number.

read()

Reads points, cells and configuration file.

Returns:

A 3-tuple of the (N,3) and (M,3) arrays of points and cells and the trimem configuration. N: number of vertices; M: number of faces.

Return type:

tuple(ndarray[float], ndarray[int], ConfigParser)

class trimem.mc.output.checkpoint.CheckpointWriter(fname)

Writer for an automatically enumerated checkpoint file.

Parameters:

fname (str, path-like) – filename prefix.

write(points, cells, config, **kwargs)

Write points, cells and config to checkpoint file.

Parameters:
  • points (numpy.ndarray[float]) – (N,3) array of vertex positions with N being the number of vertices.

  • cells (numpy.ndarray[int]) – (M,3) array of face definitions with M being the number of faces.

  • config (ConfigParser) – trimem configuration

Keyword Arguments:

kwargs – currently unused

trimem.mc.output.util module

Output utilities.

trimem.mc.output.util.create_backup(outprefix, cptprefix)

Create enumerated backups of a set of files with prefixed names.

Takes a whole set of files starting with outprefix and/or cptprefix and puts it into an enumerated backup that automatically detects its number from existing backups of the same set of files.

trimem.mc.output.util.make_output(config)

Construct output writer object.

Parameters:

config (ConfigParser) – trimem config defining the output type in config[‘GENERAL’][‘output_format’]. Must be one of vtu, xyz or xdmf.

Returns:

An instance of an output writer class having a method write_points_cells with signature (points, cells).

Return type:

Writer-like

trimem.mc.output.vtu module

A simple vtu writer.

Writes a mesh as a series of enumerated vtu files that can conveniently be visualized as time-series by, e.g., paraview.

class trimem.mc.output.vtu.VtuWriter(fname)

Vtu writer to write series of meshes.

Parameters:

fname (str, path-like) – output file prefix.

write_points_cells(points, cells)

Write points and cells to vtu series file.

Parameters:
  • points (ndarray[float]) – (N,3) array of vertex positions with N being the number of vertices.

  • cells (ndarray[int]) – (M,3) array of face definitions with M being the number of faces.

trimem.mc.output.xdmf module

A simple xdmf writer.

A simple xdmf writer that writes a series of triangle meshes as grid collection. It is not a generic xdmf writer but specific to the use case in trimem, in particular to the writing of temporal series of meshes as xdmf’s collections of grids. Data is stored in hdf5 format.

[https://www.xdmf.org/index.php/XDMF_Model_and_Format]

class trimem.mc.output.xdmf.XdmfWriter(fname)

Xdmf writer to write series of meshes.

Parameters:

fname (str, path-like) – output file prefix.

write_points_cells(points, cells)

Write points and cells by appending a grid to the collection.

Parameters:
  • points (ndarray[float]) – (N,3) array of vertex positions with N being the number of vertices.

  • cells (ndarray[int]) – (M,3) array of face definitions with M being the number of faces.

trimem.mc.output.xyz module

xyz coordinate writer.

Writes vertex coordinates only, i.e. the mesh is lost. It also writes data as plain text.

class trimem.mc.output.xyz.XyzWriter(fname)

Write series of point locations in xyz-format.

Parameters:

fname (str, path-like) – output file prefix.

write_points_cells(points, cells)

Write points and ignore cells.

Parameters:
  • points (ndarray[float]) – (N,3) array of vertex positions with N being the number of vertices.

  • cells – ignored