padne.paraview ============== .. py:module:: padne.paraview .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: padne.paraview.log Functions --------- .. autoapisummary:: padne.paraview.create_data_array padne.paraview.create_vtk_root padne.paraview.create_point_data padne.paraview.create_points padne.paraview.create_cells padne.paraview.create_piece padne.paraview.export_solution Module Contents --------------- .. py:data:: log .. py:function:: 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 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 .. py:function:: create_vtk_root() -> lxml.etree.Element Create the root VTKFile element with standard attributes. Returns: Root VTKFile element configured for UnstructuredGrid format .. py:function:: create_point_data(potentials: padne.mesh.ZeroForm) -> lxml.etree.Element 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 .. py:function:: create_points(mesh_obj: padne.mesh.Mesh) -> lxml.etree.Element 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 .. py:function:: create_cells(mesh_obj: padne.mesh.Mesh) -> lxml.etree.Element 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 .. py:function:: create_piece(mesh_obj: padne.mesh.Mesh, potentials: padne.mesh.ZeroForm) -> lxml.etree.Element 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 .. py:function:: export_solution(solution: padne.solver.Solution, output_dir: pathlib.Path) -> None 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)