Skip to content
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

relay::io::blueprint::load_mesh() recognizes yaml as json #1291

Open
JustinPrivitera opened this issue Jul 9, 2024 · 3 comments
Open

relay::io::blueprint::load_mesh() recognizes yaml as json #1291

JustinPrivitera opened this issue Jul 9, 2024 · 3 comments
Labels

Comments

@JustinPrivitera
Copy link
Member

This is the blueprint index.

blueprint_index: 
  mesh: 
    state: 
      cycle: 48
      time: 4.8
      path: "mesh/state"
      number_of_domains: 36
      partition_pattern: "visit_ex_db.cycle_000048/domain_{domain:06d}.yaml:/"
      partition_map: 
        file: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]
        domain: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35]
    coordsets: 
      coords: 
        type: "explicit"
        coord_system: 
          axes: 
            x: 
            y: 
            z: 
          type: "cartesian"
        path: "mesh/coordsets/coords"
    topologies: 
      topo: 
        type: "structured"
        coordset: "coords"
        path: "mesh/topologies/topo"
    fields: 
      d: 
        number_of_components: 1
        topology: "topo"
        association: "element"
        path: "mesh/fields/d"
protocol: 
  name: "yaml"
  version: "0.9.0"
number_of_files: 36
number_of_trees: 36
file_pattern: "visit_ex_db.cycle_000048/domain_%06d.yaml"
tree_pattern: "/"

This is the logic for determining the protocol:

            // for json or yaml, lets make sure a new line exists
            if(test_str.find("\n") != std::string::npos)
            {
                // for yaml look for ":" 
                // for json, look for "{"
                if(test_str.find(":") != std::string::npos)
                {
                   file_type = "yaml";
                }
                if(test_str.find("{") != std::string::npos)
                {
                   file_type = "json";
                }
            }

So because of this line:

partition_pattern: "visit_ex_db.cycle_000048/domain_{domain:06d}.yaml:/"

the protocol is erroneously assumed to be json.

I have attached the yaml files I used to reproduce this.

visit_ex_db.cycle_000048.tar.xz.zip

@cyrush
Copy link
Member

cyrush commented Jul 15, 2024

if(test_str.find("\n") != std::string::npos)

@cyrush cyrush added the bug label Jul 15, 2024
@JustinPrivitera
Copy link
Member Author

There's nothing wrong with checking for newline, right? It's the { that breaks it.

@cyrush
Copy link
Member

cyrush commented Jul 15, 2024

yes, I just wanted to link the code in the issue + I linked near - not the exact spot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants