Skip to content

Commit

Permalink
fix bug with empty remote connections, fixes #473
Browse files Browse the repository at this point in the history
  • Loading branch information
hellkite500 authored and mattw-nws committed Dec 9, 2022
1 parent 18bb175 commit 0d10905
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions include/core/Partition_Parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,21 @@ class Partitions_Parser {
}
part_data.nexus_ids = nexus_ids;
nexus_ids.clear();

//Get remote-connections and set the corresponding part_data struct member
for (auto &remote_conn : part.at("remote-connections").as_list())
{
remote_mpi_rank = remote_conn.at("mpi-rank").as_natural_number();
remote_nex_id = remote_conn.at("nex-id").as_string();
remote_cat_id = remote_conn.at("cat-id").as_string();
direction = remote_conn.at("cat-direction").as_string();
tmp_tuple = std::make_tuple(remote_mpi_rank, remote_nex_id, remote_cat_id, direction);
remote_conn_vec.push_back(tmp_tuple);
if( part.at("remote-connections").get_type() == geojson::PropertyType::List ) {
//It is valid to have no remote connections, but the backend property tree parser
//can't represent empty lists/objects, so it turns into an ampty string (which is iterable)
//so we check to ensure the remote connections are a list type (not string) before we attempt
//to process the remote-connections. If they are empty, this step gets skipped entirely.
//Get remote-connections and set the corresponding part_data struct member
for (auto &remote_conn : part.at("remote-connections").as_list())
{
remote_mpi_rank = remote_conn.at("mpi-rank").as_natural_number();
remote_nex_id = remote_conn.at("nex-id").as_string();
remote_cat_id = remote_conn.at("cat-id").as_string();
direction = remote_conn.at("cat-direction").as_string();
tmp_tuple = std::make_tuple(remote_mpi_rank, remote_nex_id, remote_cat_id, direction);
remote_conn_vec.push_back(tmp_tuple);
}
}
part_data.remote_connections = remote_conn_vec;
remote_conn_vec.clear();
Expand Down

0 comments on commit 0d10905

Please sign in to comment.