Skip to content

Commit

Permalink
Merge 28d491a into 8b4da06
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrush committed Apr 20, 2020
2 parents 8b4da06 + 28d491a commit 06acb66
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,10 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
- Added an open mode option to RelayIOHandle. See RelayIOHandle docs (https://llnl-conduit.readthedocs.io/en/latest/relay_io.html#relay-i-o-handle-interface) for more details.
- Added the conduit.relay.mpi Python module to support Relay MPI in Python.

#### Blueprint
- Added support for Adjacency sets for Structured Mesh Topologies. See the `blueprint::mesh::examples::adjset_uniform` example.


### Fixed

#### General
Expand Down
14 changes: 13 additions & 1 deletion src/libs/blueprint/conduit_blueprint_mesh_examples.cpp
Expand Up @@ -2863,7 +2863,7 @@ adjset_uniform(Node &res)
for(index_t i = 0; i < 8; i++)
{
std::ostringstream oss;
oss << "domain" << i;
oss << "domain_" << std::setfill('0') << std::setw(6) << i;
const std::string domain_name = oss.str();

Node &domain_node = res[domain_name];
Expand All @@ -2884,6 +2884,18 @@ adjset_uniform(Node &res)
domain_topo["type"].set_string("uniform");
domain_topo["coordset"].set_string("coords");

// add a simple field that has the domain id
Node &domain_field = domain_node["fields/id"];
domain_field["association"] = "element";
domain_field["topology"] = "topo";
domain_field["values"] = DataType::int32(20 * 20);

int32_array vals = domain_field["values"].value();
for(int j=0;j<20*20;j++)
{
vals[j] = i;
}

Node &domain_adjsets = domain_node["adjsets/adjset"];
domain_adjsets["association"].set_string("vertex");
domain_adjsets["topology"].set_string("topo");
Expand Down
33 changes: 33 additions & 0 deletions src/tests/blueprint/t_blueprint_mesh_examples.cpp
Expand Up @@ -504,6 +504,39 @@ TEST(conduit_blueprint_mesh_examples, check_gen_index_state_prop)
EXPECT_TRUE(idx.has_path("state/time"));
}

//-----------------------------------------------------------------------------
TEST(conduit_blueprint_mesh_examples, save_adjset_uniform)
{

Node io_protos;
relay::io::about(io_protos["io"]);
bool hdf5_enabled =io_protos["io/protocols/hdf5"].as_string() == "enabled";

// skip if we don't have hdf5 since this example has several domains
if(!hdf5_enabled)
return;

Node mesh,idx;
blueprint::mesh::examples::adjset_uniform(mesh);
blueprint::mesh::generate_index(mesh[0],
"",
8,
mesh["blueprint_index/adj_uniform"]);

mesh["protocol/name"] = "hdf5";
mesh["protocol/version"] = PROTOCOL_VER;

mesh["number_of_files"] = 1;
mesh["number_of_trees"] = 8;
mesh["file_pattern"] = "adj_uniform_example.blueprint_root";
mesh["tree_pattern"] = "domain_%06d";

CONDUIT_INFO("Creating: adj_uniform_example.blueprint_root")
relay::io::save(mesh,"adj_uniform_example.blueprint_root","json");
}




//-----------------------------------------------------------------------------
int main(int argc, char* argv[])
Expand Down

0 comments on commit 06acb66

Please sign in to comment.