Multiple fields with values set by set_external not working
I am trying to use multiple fields with values set by set_external()
like this:
auto fields = exec_params["catalyst/channels/grid/data/fields"];
...
for (int k = 0; k < nQuantities; ++k) {
fields[(quantities[k].GetName()+"/association").c_str()].set("element");
fields[(quantities[k].GetName()+"/topology").c_str()].set("mesh");
fields[(quantities[k].GetName()+"/volume_dependent").c_str()].set("false");
fields[(quantities[k].GetName()+"/values").c_str()].set_external_float64_ptr(
src + srcOffset * nQuantities, nLocalCells, /*offset=*/k*sizeof(double), /*stride=*/nQuantities*sizeof(double));
}
All 5 fields use the same pointer, with increasing offset and the same stride of 5*sizeof(double), which corresponds to the actual data layout in memory. But the data does not correctly arrive at Paraview. Inspecting the node I create with exec_params.info().print();
shows:
mem_spaces:
0x1d66dd0:
path: "catalyst/state/timestep"
type: "allocated"
bytes: 4
0x1d30e10:
path: "catalyst/state/time"
type: "allocated"
bytes: 8
0x1d39b90:
path: "catalyst/channels/grid/type"
type: "allocated"
bytes: 5
0x1d5c250:
path: "catalyst/channels/grid/data/coordsets/coords/type"
type: "allocated"
bytes: 9
0x7fc7e58f9010:
path: "catalyst/channels/grid/data/coordsets/coords/values/x"
type: "external"
0x1fcdb30:
path: "catalyst/channels/grid/data/topologies/mesh/type"
type: "allocated"
bytes: 13
0x8437ed0:
path: "catalyst/channels/grid/data/topologies/mesh/coordset"
type: "allocated"
bytes: 7
0x8319bc0:
path: "catalyst/channels/grid/data/topologies/mesh/elements/shape"
type: "allocated"
bytes: 4
0x7fc7e48f7010:
path: "catalyst/channels/grid/data/topologies/mesh/elements/connectivity"
type: "external"
0x843c4b0:
path: "catalyst/channels/grid/data/fields/Density/association"
type: "allocated"
bytes: 8
0x1b999f0:
path: "catalyst/channels/grid/data/fields/Density/topology"
type: "allocated"
bytes: 5
0x1dfa870:
path: "catalyst/channels/grid/data/fields/Density/volume_dependent"
type: "allocated"
bytes: 6
0xd0d2430:
path: "catalyst/channels/grid/data/fields/Density/values"
type: "external"
0x1df67e0:
path: "catalyst/channels/grid/data/fields/MomentumX/association"
type: "allocated"
bytes: 8
0x1df13a0:
path: "catalyst/channels/grid/data/fields/MomentumX/topology"
type: "allocated"
bytes: 5
0x1df2bc0:
path: "catalyst/channels/grid/data/fields/MomentumX/volume_dependent"
type: "allocated"
bytes: 6
0x1fcca40:
path: "catalyst/channels/grid/data/fields/MomentumY/association"
type: "allocated"
bytes: 8
0x1d4b5e0:
path: "catalyst/channels/grid/data/fields/MomentumY/topology"
type: "allocated"
bytes: 5
0x1ded330:
path: "catalyst/channels/grid/data/fields/MomentumY/volume_dependent"
type: "allocated"
bytes: 6
0x1d86e80:
path: "catalyst/channels/grid/data/fields/MomentumZ/association"
type: "allocated"
bytes: 8
0x1fabe70:
path: "catalyst/channels/grid/data/fields/MomentumZ/topology"
type: "allocated"
bytes: 5
0x1f841d0:
path: "catalyst/channels/grid/data/fields/MomentumZ/volume_dependent"
type: "allocated"
bytes: 6
0x1fc63b0:
path: "catalyst/channels/grid/data/fields/EnergyStagnationDensity/association"
type: "allocated"
bytes: 8
0x8304b20:
path: "catalyst/channels/grid/data/fields/EnergyStagnationDensity/topology"
type: "allocated"
bytes: 5
0x1d69a20:
path: "catalyst/channels/grid/data/fields/EnergyStagnationDensity/volume_dependent"
type: "allocated"
bytes: 6
total_bytes_allocated: 145
total_bytes_mmaped: 0
total_bytes_compact: 25465513
total_strided_bytes: 80590345
So only the "Density" field has an external pointer set for its values. This is also the case for the coords values, where only values/x shows up. When I use set()
instead of set_external()
all fields have their own values pointer of type allocated and the data transfer is working as expected. Not printing the info node, but the full exec_params node, with exec_params.print()
(for a very small example) shows the correct data on the simulation side in both cases.
Is this a usage error on my side or a bug?