mpacts.io. vtp_read

In order to be able to use this module import it like this:

import mpacts.io.vtp_read
#or assign it to a shorter name
import mpacts.io.vtp_read as vtp

VTP_State

class mpacts.io.vtp_read.VTP_State(step, BaseName_in=None, verbose=0, doNotThrow=False)

Bases: mpacts.io.readerstatebase.ReaderStateBase

Reading in vtp-files (vtk poly data xml files). Uses python-vtk. State object to access the contents of a DEMeter written file(s).

Can be used as an iterator (iterating over all saved time-steps) and with direct access ‘[]’ operator to access a specific time/time-step.

The ‘get’ member is used to return a specific array from the file.

VTP_State(name, parent, **kwargs)
get(pcName, arrayName, point_or_cell='point', i_want_the_x_array_not_the_points=False)

returns the saved array with specified arrayName in particle container pcName as a numpy-array. If arrayName is ‘x’, the node positions will be returned, if arrayName is ‘connectivity’, the connectivity of the polyhedra is returned.

Params:
-pcName particle container name
-arrayName name of array to get
-point_or_cell can be either “point” (default) or “cell”
get_time()
set_step(step, verbose=1, doNotThrow=False)
set_time(time, strict=True)

Set the state to the one with a corresponding time.

Params:
-time The time of the state.
-strict If set to False, it will find the state with the closest time.
If set to True (by default), in case there is no such state with a given time, it will fail.