File: demo_no_vtk_adios2.patch

package info (click to toggle)
fenics-dolfinx 1%3A0.10.0.post4-1exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 6,028 kB
  • sloc: cpp: 36,535; python: 25,391; makefile: 226; sh: 171; xml: 55
file content (32 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Index: fenics-dolfinx/python/demo/demo_scattering_boundary_conditions.py
===================================================================
--- fenics-dolfinx.orig/python/demo/demo_scattering_boundary_conditions.py	2025-11-12 15:19:05.407175808 +0100
+++ fenics-dolfinx/python/demo/demo_scattering_boundary_conditions.py	2025-11-12 15:21:23.079677959 +0100
@@ -644,8 +644,11 @@
 assert isinstance(Esh, fem.Function)
 Esh_dg.interpolate(Esh)
 
-with io.VTXWriter(mesh_data.mesh.comm, out_folder / "Esh.bp", Esh_dg) as vtx:
-    vtx.write(0.0)
+if hasattr(io,"VTXWriter"):
+    with io.VTXWriter(mesh_data.mesh.comm, out_folder / "Esh.bp", Esh_dg) as vtx:
+        vtx.write(0.0)
+else:
+    print("Cannot write Esh.bp: VTXWriter (adios2) is not available")
 # -
 
 # We visualize the solution using PyVista. For more information about
@@ -683,8 +686,11 @@
 E.x.array[:] = Eb.x.array[:] + Esh.x.array[:]
 E_dg = fem.Function(V_dg)
 E_dg.interpolate(E)
-with io.VTXWriter(mesh_data.mesh.comm, "E.bp", E_dg) as vtx:
-    vtx.write(0.0)
+if hasattr(io,"VTXWriter"):
+    with io.VTXWriter(mesh_data.mesh.comm, "E.bp", E_dg) as vtx:
+        vtx.write(0.0)
+else:
+    print("Cannot write E.bp: VTXWriter (adios2) is not available")
 # -
 
 # We validate our numerical solution by computing the absorption,