-
Notifications
You must be signed in to change notification settings - Fork 70
sidre mesh load fix #1524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sidre mesh load fix #1524
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2433,9 +2433,63 @@ void read_mesh(const std::string &root_file_path, | |
| hnd.open(root_file_path, "sidre_hdf5", open_opts); | ||
| for(int i = domain_start ; i < domain_end; i++) | ||
| { | ||
| oss.str(""); | ||
| oss << i << "/" << mesh_name; | ||
| hnd.read(oss.str(),mesh); | ||
| std::string mesh_path = conduit_fmt::format("domain_{:06d}",i); | ||
| Node &mesh_out = mesh[mesh_path]; | ||
|
|
||
| // Read components of the mesh according to the mesh index. | ||
| // For Sidre roots, the per-domain tree id is the prefix and the | ||
| // blueprint index paths are relative to that tree. | ||
| NodeConstIterator outer_itr = mesh_index.children(); | ||
| while(outer_itr.has_next()) | ||
| { | ||
| const Node &outer = outer_itr.next(); | ||
| std::string outer_name = outer_itr.name(); | ||
|
|
||
| // special logic for state, since it may not include paths | ||
| if(outer_name == "state" ) | ||
| { | ||
| if(outer.has_child("path")) | ||
| { | ||
| const std::string fetch_path = | ||
| utils::join_path(conduit_fmt::format("{}",i), | ||
| outer["path"].as_string()); | ||
| if(hnd.has_path(fetch_path)) | ||
| { | ||
| hnd.read(fetch_path, mesh_out[outer_name]); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(outer.has_child("cycle")) | ||
| { | ||
| mesh_out[outer_name]["cycle"] = outer["cycle"]; | ||
| } | ||
|
|
||
| if(outer.has_child("time")) | ||
| { | ||
| mesh_out[outer_name]["time"] = outer["time"]; | ||
| } | ||
cyrush marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| NodeConstIterator itr = outer.children(); | ||
| while(itr.has_next()) | ||
| { | ||
| const Node &entry = itr.next(); | ||
| if(entry.has_child("path")) | ||
| { | ||
| const std::string entry_name = itr.name(); | ||
| const std::string entry_path = entry["path"].as_string(); | ||
| const std::string fetch_path = | ||
| utils::join_path(conduit_fmt::format("{}",i), | ||
| entry_path); | ||
|
Comment on lines
+2484
to
+2485
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here about using conduit_fmt to make a string out of an integer being overkill
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure it matters much for these cases - but lore states that fmt is faster than std::to_string()
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I trust lore |
||
| if(hnd.has_path(fetch_path)) | ||
| { | ||
| hnd.read(fetch_path, mesh_out[outer_name][entry_name]); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| else | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.