Source: io4dolfinx Version: 1.2.0-1 Severity: serious Control: forwarded -1 https://github.com/scientificcomputing/io4dolfinx/issues/66
test_xdmf_function in test_xdmf.py fails when run with dolfinx 0.10 built with complex number support. https://ci.debian.net/packages/i/io4dolfinx/testing/amd64/72528850/#S14 Reported upstream, issue #66 https://github.com/scientificcomputing/io4dolfinx/issues/66 4552s =================================== FAILURES =================================== 4552s ______________________________ test_xdmf_function ______________________________ 4552s 4552s tmp_path = PosixPath('/tmp/autopkgtest-lxc.40nbiv74/downtmp/autopkgtest_tmp/io4dolfinx_complex_py3.14/test_xdmf_function0') 4552s 4552s def test_xdmf_function(tmp_path): 4552s tmp_path = MPI.COMM_WORLD.bcast(tmp_path, root=0) 4552s mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 8, 10) 4552s 4552s def f(x): 4552s return (x[0], x[1], -2 * x[1], 3 * x[0]) 4552s 4552s V = dolfinx.fem.functionspace(mesh, ("Lagrange", 1, (4,))) 4552s u = dolfinx.fem.Function(V, name="u") 4552s u.interpolate(f) 4552s 4552s tmp_file = tmp_path / "function.xdmf" 4552s with dolfinx.io.XDMFFile(MPI.COMM_WORLD, tmp_file, "w") as xdmf: 4552s xdmf.write_mesh(mesh) 4552s xdmf.write_function(u) 4552s 4552s MPI.COMM_WORLD.barrier() 4552s 4552s in_grid = io4dolfinx.read_mesh(tmp_file, MPI.COMM_WORLD, backend="xdmf") 4552s names = io4dolfinx.read_function_names( 4552s tmp_file, MPI.COMM_WORLD, backend_args={}, backend="xdmf" 4552s ) 4552s assert len(names) == 1 4552s assert names[0] == "u" 4552s 4552s > u = io4dolfinx.read_point_data(tmp_file, "u", in_grid, backend="xdmf") 4552s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4552s 4552s tests/test_xdmf.py:64: 4552s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 4552s /usr/lib/python3/dist-packages/io4dolfinx/readers.py:406: in read_point_data 4552s dataset, local_range_start = backend_cls.read_point_data( 4552s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 4552s 4552s filename = PosixPath('/tmp/autopkgtest-lxc.40nbiv74/downtmp/autopkgtest_tmp/io4dolfinx_complex_py3.14/test_xdmf_function0/function.xdmf') 4552s name = 'u', comm = <mpi4py.MPI.Intracomm object at 0x7fec89a2ef40>, time = None 4552s backend_args = {} 4552s 4552s def read_point_data( 4552s filename: Path | str, 4552s name: str, 4552s comm: MPI.Intracomm, 4552s time: float | str | None, 4552s backend_args: dict[str, Any] | None, 4552s ) -> tuple[np.ndarray, int]: 4552s """Read data from the nodes of a mesh. 4552s 4552s Args: 4552s filename: Path to file 4552s name: Name of point data 4552s comm: Communicator to launch IO on. 4552s time: The time stamp 4552s backend_args: The backend arguments 4552s 4552s Returns: 4552s Data local to process (contiguous, no mpi comm) and local start range 4552s """ 4552s # Find function with name u in xml tree 4552s check_file_exists(filename) 4552s filename = Path(filename) 4552s 4552s tree = ElementTree.parse(filename) 4552s root = tree.getroot() 4552s backend_args = get_default_backend_args(backend_args) 4552s if time is not None: 4552s time_steps = root.findall(f".//Grid[@Name='{name}']") 4552s time_found = False 4552s for time_node in time_steps: 4552s step_node = time_node.find(".//Time") 4552s assert isinstance(step_node, ElementTree.Element) 4552s if np.isclose(float(step_node.attrib["Value"]), float(time)): 4552s time_found = True 4552s break 4552s func_node = time_node.find(f".//Attribute[@Name='{name}']") 4552s if not time_found: 4552s raise RuntimeError(f"Function {name} at time={time} not found in {filename}") 4552s else: 4552s func_node = root.find(f".//Attribute[@Name='{name}']") 4552s > assert isinstance(func_node, ElementTree.Element) 4552s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 4552s E AssertionError 4552s 4552s /usr/lib/python3/dist-packages/io4dolfinx/backends/xdmf/backend.py:134: AssertionError 4552s =========================== short test summary info ============================ 4552s FAILED tests/test_xdmf.py::test_xdmf_function - AssertionError 4552s ============ 1 failed, 1274 passed, 8 skipped in 404.88s (0:06:44) ============= 4552s autopkgtest [13:37:59]: test test-io4dolfinx-complex: -----------------------]

