padne.paraview

ParaView VTK XML export functionality for FEM simulation results.

This module provides functions to export padne’s FEM simulation results to the VTK XML UnstructuredGrid format, compatible with ParaView and other VTK-based visualization tools.

Attributes

log

Functions

create_data_array(→ lxml.etree.Element)

Create a DataArray element with specified type and values.

create_vtk_root(→ lxml.etree.Element)

Create the root VTKFile element with standard attributes.

create_point_data(→ lxml.etree.Element)

Create PointData element with voltage scalar field values.

create_points(→ lxml.etree.Element)

Create Points element with vertex coordinates.

create_cells(→ lxml.etree.Element)

Create Cells element with triangle connectivity, offsets, and types.

create_piece(→ lxml.etree.Element)

Create a Piece element representing one triangular mesh with voltage data.

export_solution(→ None)

Export a complete Solution to VTK XML format as separate files per layer.

Module Contents

padne.paraview.log[source]
padne.paraview.create_data_array(parent: lxml.etree.Element, data_type: str, values: Iterable[int | float], name: str | None = None, number_of_components: int | None = None) lxml.etree.Element[source]

Create a DataArray element with specified type and values.

Args:

parent: Parent element to attach the DataArray to data_type: VTK data type (e.g., “Float64”, “Int32”, “UInt8”) values: Numeric values to store in the array name: Optional name attribute for the DataArray number_of_components: Optional NumberOfComponents attribute

Returns:

Created DataArray element

padne.paraview.create_vtk_root() lxml.etree.Element[source]

Create the root VTKFile element with standard attributes.

Returns:

Root VTKFile element configured for UnstructuredGrid format

padne.paraview.create_point_data(potentials: padne.mesh.ZeroForm) lxml.etree.Element[source]

Create PointData element with voltage scalar field values.

Args:

potentials: ZeroForm containing scalar values at mesh vertices

Returns:

PointData element containing the voltage field data

padne.paraview.create_points(mesh_obj: padne.mesh.Mesh) lxml.etree.Element[source]

Create Points element with vertex coordinates.

Args:

mesh_obj: Mesh object containing vertices

Returns:

Points element containing 3D coordinates (z=0 for 2D meshes) Note: Y coordinates are negated for ParaView orientation

padne.paraview.create_cells(mesh_obj: padne.mesh.Mesh) lxml.etree.Element[source]

Create Cells element with triangle connectivity, offsets, and types.

Args:

mesh_obj: Mesh object containing triangular faces

Returns:

Cells element with connectivity, offsets, and types arrays

padne.paraview.create_piece(mesh_obj: padne.mesh.Mesh, potentials: padne.mesh.ZeroForm) lxml.etree.Element[source]

Create a Piece element representing one triangular mesh with voltage data.

Args:

mesh_obj: Triangular mesh object potentials: Scalar field values at mesh vertices

Returns:

Piece element containing mesh geometry and voltage field

padne.paraview.export_solution(solution: padne.solver.Solution, output_dir: pathlib.Path) None[source]

Export a complete Solution to VTK XML format as separate files per layer.

Args:

solution: Complete solution containing meshes and potential fields output_dir: Directory where VTU files should be written (one per layer)