Usage Reference for pyvisfile.xdmf
¶
This implementation targets XDMF3 and takes available fields directly from the code in the xdmf library. Additional documentation can be found online, but (at the time of this writing, December 2020) does not appear to be kept up to date.
Writing¶
-
class
pyvisfile.xdmf.
DataArray
(components, *, name=None, acenter=None, atype=None)¶ An array represented as a list of
DataItem
s.-
__init__
(components, *, name=None, acenter=None, atype=None)¶ - Parameters
components (Tuple[pyvisfile.xdmf.DataItem, ..]) – a description of each component of an array.
name (Optional[str]) – name of the array. This name will be used if the array is added as an attribute, otherwise the names of the components are used.
acenter (Optional[pyvisfile.xdmf.AttributeCenter]) –
atype (Optional[pyvisfile.xdmf.AttributeType]) –
-
as_data_item
(*, parent=None)¶ Finalize the
DataArray
and constructDataItem
s to be written to a file.- Parameters
parent (Optional[xml.etree.ElementTree.Element]) –
- Return type
Tuple[pyvisfile.xdmf.DataItem, ..]
-
-
class
pyvisfile.xdmf.
NumpyDataArray
(ary, *, acenter=None, name=None)¶ -
__init__
(ary, *, acenter=None, name=None)¶ - Parameters
ary (numpy.ndarray) – if this is an
object
array, each entry is considered a different component and will consist of a separateDataItem
.acenter (Optional[pyvisfile.xdmf.AttributeCenter]) –
name (Optional[str]) –
-
-
class
pyvisfile.xdmf.
XdmfGrid
(root)¶ -
__init__
(root)¶ Initialize self. See help(type(self)) for accurate signature.
- Parameters
root (pyvisfile.xdmf.Grid) –
-
add_attribute
(ary, *, join=True)¶ - Parameters
ary (pyvisfile.xdmf.DataArray) –
join (bool) – If True and ary has multiple components, they are joined using an XDMF Function.
- Return type
-
-
class
pyvisfile.xdmf.
XdmfUnstructuredGrid
(points, connectivity, *, topology_type, name=None, geometry_type=None)¶ Bases:
pyvisfile.xdmf.XdmfGrid
-
__init__
(points, connectivity, *, topology_type, name=None, geometry_type=None)¶ Initialize self. See help(type(self)) for accurate signature.
- Parameters
points (pyvisfile.xdmf.DataArray) –
connectivity (pyvisfile.xdmf.DataArray) –
topology_type (Union[pyvisfile.xdmf.Topology, pyvisfile.xdmf.TopologyType]) –
name (Optional[str]) –
geometry_type (Optional[pyvisfile.xdmf.GeometryType]) –
-
-
class
pyvisfile.xdmf.
XdmfWriter
(grids, *, arrays=None, tags=None)¶ -
__init__
(grids, *, arrays=None, tags=None)¶ - Parameters
grids (Tuple[pyvisfile.xdmf.XdmfGrid, ..]) – a
tuple
of grids to be added to the topDomain
. Currently only a single domain is supported.arrays (Optional[Tuple[pyvisfile.xdmf.DataArray, ..]]) – additional
DataArray
s to be added to the topDomain
, as opposed to as attribute on the grids.tags (Optional[Tuple[xml.etree.ElementTree.Element, ..]]) –
-
write
(filename)¶ Write the the XDMF file.
-
write_pretty
(filename)¶ Produces a nicer-looking XML file with clean indentation.
-