Skip to content

Commit fb8e4b3

Browse files
committed
Address feedback
1 parent db5a0bf commit fb8e4b3

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

src/libs/blueprint/conduit_blueprint_mesh.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ convert_topology_to_rectilinear(const std::string &/*base_type*/,
11001100

11011101
dest.set(topo);
11021102
dest["type"].set("rectilinear");
1103-
dest["coordset"].set(bputils::resolve_output_name(*coordset, cdest));
1103+
dest["coordset"].set(bputils::resolve_output_name(topo, "coordset", cdest));
11041104
}
11051105

11061106
//-------------------------------------------------------------------------
@@ -1128,7 +1128,7 @@ convert_topology_to_structured(const std::string &base_type,
11281128
}
11291129

11301130
dest["type"].set("structured");
1131-
dest["coordset"].set(bputils::resolve_output_name(*coordset, cdest));
1131+
dest["coordset"].set(bputils::resolve_output_name(topo, "coordset", cdest));
11321132
if(topo.has_child("origin"))
11331133
{
11341134
dest["origin"].set(topo["origin"]);
@@ -1185,7 +1185,7 @@ convert_topology_to_unstructured(const std::string &base_type,
11851185
}
11861186

11871187
dest["type"].set("unstructured");
1188-
dest["coordset"].set(bputils::resolve_output_name(*coordset, cdest));
1188+
dest["coordset"].set(bputils::resolve_output_name(topo, "coordset", cdest));
11891189
if(topo.has_child("origin"))
11901190
{
11911191
dest["origin"].set(topo["origin"]);
@@ -5269,7 +5269,7 @@ mesh::topology::unstructured::generate_sides(const Node &topo,
52695269

52705270
topo_dest.reset();
52715271
topo_dest["type"].set("unstructured");
5272-
topo_dest["coordset"].set(bputils::resolve_output_name(*coordset, coords_dest));
5272+
topo_dest["coordset"].set(bputils::resolve_output_name(topo, "coordset", coords_dest));
52735273
topo_dest["elements/shape"].set(side_shape.type());
52745274
topo_dest["elements/connectivity"].set(DataType(int_dtype.id(),
52755275
side_shape.indices * sides_num_elems));
@@ -6118,7 +6118,7 @@ mesh::topology::unstructured::generate_corners(const Node &topo,
61186118

61196119
topo_dest.reset();
61206120
topo_dest["type"].set("unstructured");
6121-
topo_dest["coordset"].set(bputils::resolve_output_name(*coordset, coords_dest));
6121+
topo_dest["coordset"].set(bputils::resolve_output_name(topo, "coordset", coords_dest));
61226122
topo_dest["elements/shape"].set(corner_shape.type());
61236123
if (is_topo_3d)
61246124
{

src/libs/blueprint/conduit_blueprint_mesh_utils.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ find_reference_node(const Node &node, const std::string &ref_key)
465465

466466
//-----------------------------------------------------------------------------
467467
std::string
468-
resolve_output_name(const Node &source, const Node &dest)
468+
resolve_output_name(const Node &node, const std::string &ref_key, const Node &dest)
469469
{
470470
if (!dest.name().empty())
471471
{
@@ -477,12 +477,13 @@ resolve_output_name(const Node &source, const Node &dest)
477477
}
478478
else // if (dest.name().empty())
479479
{
480-
// If the dest node has no name, use the source node's name. This is
481-
// relevant when passing an empty output node when calling mesh
482-
// transforms, where the output node is expected to inherit the
483-
// coordset name from the source node. Not doing this was resulting
484-
// in newly converted topologies to fail `verify`.
485-
return source.name();
480+
// If the dest node has no name, fall back to the name that 'node'
481+
// itself references (e.g. node["coordset"]). This is relevant
482+
// when passing an empty output node when calling mesh transforms,
483+
// where the output node is expected to inherit the reference name
484+
// from 'node'. Not doing this was resulting in newly converted
485+
// topologies to fail `verify`.
486+
return node[ref_key].as_string();
486487
}
487488
}
488489

@@ -5143,4 +5144,3 @@ void CONDUIT_BLUEPRINT_API lerp(const Node& As,
51435144
//-----------------------------------------------------------------------------
51445145
// -- end conduit:: --
51455146
//-----------------------------------------------------------------------------
5146-

src/libs/blueprint/conduit_blueprint_mesh_utils.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,14 @@ CONDUIT_BLUEPRINT_API const Node * find_reference_node(const Node &node, const s
251251

252252
//-----------------------------------------------------------------------------
253253
/**
254-
@brief Get the name that a reference node (i.e. "coordset") should use for a
255-
destination node. If the destination node has a name, use it; otherwise,
256-
use the name of 'source'.
254+
@brief Get the name that a reference field (e.g. "coordset") should use for
255+
a destination node. If the destination node has a name, use it;
256+
otherwise, fall back to the name that 'node' itself references via
257+
'ref_key' (e.g. node["coordset"]).
257258
*/
258-
std::string CONDUIT_BLUEPRINT_API resolve_output_name(const Node &source, const Node &dest);
259+
std::string CONDUIT_BLUEPRINT_API resolve_output_name(const Node &node,
260+
const std::string &ref_key,
261+
const Node &dest);
259262

260263
//-----------------------------------------------------------------------------
261264
index_t CONDUIT_BLUEPRINT_API find_domain_id(const Node &node);

0 commit comments

Comments
 (0)