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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
--- a/cpp/demo/interpolation-io/main.cpp
+++ b/cpp/demo/interpolation-io/main.cpp
@@ -7,6 +7,7 @@
// # Interpolation and IO
#include <basix/finite-element.h>
+#include <bit>
#include <cmath>
#include <concepts>
#include <dolfinx/common/log.h>
@@ -64,12 +65,16 @@
});
#ifdef HAS_ADIOS2
- // Write the function to a VTX file for visualisation, e.g. using
- // ParaView
- io::VTXWriter<U> outfile(mesh->comm(), filename.replace_extension("bp"), {u},
- "BP4");
- outfile.write(0.0);
- outfile.close();
+ // Adios2 is not well tested on big-endian systems, so skip them
+ if constexpr (std::endian::native != std::endian::big)
+ {
+ // Write the function to a VTX file for visualisation, e.g. using
+ // ParaView
+ io::VTXWriter<U> outfile(mesh->comm(), filename.replace_extension("bp"), {u},
+ "BP4");
+ outfile.write(0.0);
+ outfile.close();
+ }
#endif
}
@@ -181,10 +186,14 @@
// (jump in the normal component between cells) and the x1 component
// will appear continuous (continuous tangent component between cells).
#ifdef HAS_ADIOS2
- io::VTXWriter<U> outfile(mesh->comm(), filename.replace_extension("bp"),
- {u_l}, "BP4");
- outfile.write(0.0);
- outfile.close();
+ // Adios2 is not well tested on big-endian systems, so skip them
+ if constexpr (std::endian::native != std::endian::big)
+ {
+ io::VTXWriter<U> outfile(mesh->comm(), filename.replace_extension("bp"),
+ {u_l}, "BP4");
+ outfile.write(0.0);
+ outfile.close();
+ }
#endif
}
--- a/cpp/demo/interpolation_different_meshes/main.cpp
+++ b/cpp/demo/interpolation_different_meshes/main.cpp
@@ -10,6 +10,7 @@
#include <dolfinx/fem/dolfinx_fem.h>
#include <dolfinx/io/ADIOS2Writers.h>
#include <dolfinx/mesh/generation.h>
+#include <bit>
#include <memory>
using namespace dolfinx;
@@ -82,10 +83,14 @@
u_hex->interpolate(*u_tet, cells, interpolation_data);
#ifdef HAS_ADIOS2
- io::VTXWriter<double> write_tet(mesh_tet->comm(), "u_tet.bp", {u_tet});
- write_tet.write(0.0);
- io::VTXWriter<double> write_hex(mesh_hex->comm(), "u_hex.bp", {u_hex});
- write_hex.write(0.0);
+ // Adios2 is not well tested on big-endian systems, so skip them
+ if constexpr (std::endian::native != std::endian::big)
+ {
+ io::VTXWriter<double> write_tet(mesh_tet->comm(), "u_tet.bp", {u_tet});
+ write_tet.write(0.0);
+ io::VTXWriter<double> write_hex(mesh_hex->comm(), "u_hex.bp", {u_hex});
+ write_hex.write(0.0);
+ }
#endif
}
MPI_Finalize();
--- a/cpp/demo/poisson/main.cpp
+++ b/cpp/demo/poisson/main.cpp
@@ -81,6 +81,7 @@
#include "poisson.h"
#include <basix/finite-element.h>
+#include <bit>
#include <cmath>
#include <dolfinx.h>
#include <dolfinx/fem/Constant.h>
@@ -250,9 +251,13 @@
file.write<T>({*u}, 0.0);
#ifdef HAS_ADIOS2
- // Save solution in VTX format
- io::VTXWriter<U> vtx(MPI_COMM_WORLD, "u.bp", {u}, "bp4");
- vtx.write(0);
+ // Adios2 is not well tested on big-endian systems, so skip them
+ if constexpr (std::endian::native != std::endian::big)
+ {
+ // Save solution in VTX format
+ io::VTXWriter<U> vtx(MPI_COMM_WORLD, "u.bp", {u}, "bp4");
+ vtx.write(0);
+ }
#endif
}
--- a/python/demo/demo_interpolation-io.py
+++ b/python/demo/demo_interpolation-io.py
@@ -22,6 +22,7 @@
# +
import numpy as np
+from sys import byteorder
from dolfinx import default_scalar_type, plot
from dolfinx.fem import Function, functionspace
@@ -65,10 +66,12 @@
# discontinuous and the $x_1$-component should appear continuous.
try:
- from dolfinx.io import VTXWriter
+ # adios2 is not well tested on big-endian systems, so skip them
+ if byteorder != 'big':
+ from dolfinx.io import VTXWriter
- with VTXWriter(msh.comm, "output_nedelec.bp", u0, "bp4") as f:
- f.write(0.0)
+ with VTXWriter(msh.comm, "output_nedelec.bp", u0, "bp4") as f:
+ f.write(0.0)
except ImportError:
print("ADIOS2 required for VTX output")
|