|
7 | 7 | #include "xdmf_function.h" |
8 | 8 | #include "xdmf_mesh.h" |
9 | 9 | #include "xdmf_utils.h" |
| 10 | +#include <algorithm> |
10 | 11 | #include <basix/mdspan.hpp> |
11 | 12 | #include <boost/lexical_cast.hpp> |
12 | 13 | #include <dolfinx/common/IndexMap.h> |
@@ -167,13 +168,12 @@ void xdmf_function::add_function(MPI_Comm comm, const fem::Function<T, U>& u, |
167 | 168 | std::vector<std::string> components = {""}; |
168 | 169 | if constexpr (!std::is_scalar_v<T>) |
169 | 170 | components = {"real_", "imag_"}; |
| 171 | + |
170 | 172 | std::string t_str = boost::lexical_cast<std::string>(t); |
171 | 173 | std::replace(t_str.begin(), t_str.end(), '.', '_'); |
172 | 174 | for (const auto& component : components) |
173 | 175 | { |
174 | 176 | std::string attr_name = component + u.name; |
175 | | - std::string dataset_name |
176 | | - = "/Function/" + attr_name.append("/").append(t_str); |
177 | 177 |
|
178 | 178 | // Add attribute node |
179 | 179 | pugi::xml_node attr_node = xml_node.append_child("Attribute"); |
@@ -205,7 +205,8 @@ void xdmf_function::add_function(MPI_Comm comm, const fem::Function<T, U>& u, |
205 | 205 | u = std::span<const T>(data_values); |
206 | 206 |
|
207 | 207 | // -- Real case, add data item |
208 | | - xdmf_utils::add_data_item(attr_node, h5_id, dataset_name, u, offset, |
| 208 | + std::string h5_path = std::format("/Function/{}/{}", attr_name, t_str); |
| 209 | + xdmf_utils::add_data_item(attr_node, h5_id, h5_path, u, offset, |
209 | 210 | {num_values, num_components}, "", use_mpi_io); |
210 | 211 | } |
211 | 212 | } |
|
0 commit comments