Skip to content

Commit

Permalink
Venn Example: Remove non-blueprint "params"
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinPrivitera committed Nov 10, 2023
2 parents e72f2ed + 8904911 commit f62ddb0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
32 changes: 11 additions & 21 deletions src/libs/blueprint/conduit_blueprint_mesh_examples_venn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ namespace examples
{

//---------------------------------------------------------------------------//
void venn_full_matset(Node &res)
void venn_full_matset(Node &res, index_t nx, index_t ny)
{
// create the material sets
index_t nx = res["coordsets/coords/params/nx"].value();
index_t ny = res["coordsets/coords/params/ny"].value();

index_t elements = nx * ny;

Expand Down Expand Up @@ -211,10 +209,10 @@ void build_material_sparse(Node & src, index_t len,

//---------------------------------------------------------------------------//
void compute_material_sparse_matset_field(Node &res,
const std::string & field_name)
const std::string & field_name,
index_t nx,
index_t ny)
{
index_t nx = res["coordsets/coords/params/nx"].value();
index_t ny = res["coordsets/coords/params/ny"].value();
index_t elements = nx * ny;

Node & n = res["fields/" + field_name + "/values"];
Expand Down Expand Up @@ -247,11 +245,9 @@ void compute_material_sparse_matset_field(Node &res,
}

//---------------------------------------------------------------------------//
void venn_sparse_by_material_matset(Node &res)
void venn_sparse_by_material_matset(Node &res, index_t nx, index_t ny)
{
// create the materials
index_t nx = res["coordsets/coords/params/nx"].value();
index_t ny = res["coordsets/coords/params/ny"].value();

// make sure our materials appear in the correct order,
// by pre-creating the nodes.
Expand Down Expand Up @@ -410,15 +406,13 @@ void venn_sparse_by_material_matset(Node &res)
// importance, sum the product of the volume fraction and the matset
// value for each element to compute the field itself.

compute_material_sparse_matset_field(res, "area");
compute_material_sparse_matset_field(res, "importance");
compute_material_sparse_matset_field(res, "area", nx, ny);
compute_material_sparse_matset_field(res, "importance", nx, ny);
}

void venn_sparse_by_element_matset(Node &res)
void venn_sparse_by_element_matset(Node &res, index_t nx, index_t ny)
{
// create the materials
index_t nx = res["coordsets/coords/params/nx"].value();
index_t ny = res["coordsets/coords/params/ny"].value();

float64_array cir_a = res["fields/circle_a/values"].value();
float64_array cir_b = res["fields/circle_b/values"].value();
Expand Down Expand Up @@ -546,10 +540,6 @@ void venn(const std::string &matset_type,
res["coordsets/coords/type"] = "rectilinear";
res["coordsets/coords/values/x"] = DataType::float64(nx+1);
res["coordsets/coords/values/y"] = DataType::float64(ny+1);

// Not part of the blueprint, but I want these values handy
res["coordsets/coords/params/nx"] = nx;
res["coordsets/coords/params/ny"] = ny;

float64_array x_coords = res["coordsets/coords/values/x"].value();
float64_array y_coords = res["coordsets/coords/values/y"].value();
Expand Down Expand Up @@ -793,15 +783,15 @@ void venn(const std::string &matset_type,

if (matset_type == "full")
{
venn_full_matset(res);
venn_full_matset(res, nx, ny);
}
else if (matset_type == "sparse_by_material")
{
venn_sparse_by_material_matset(res);
venn_sparse_by_material_matset(res, nx, ny);
}
else if (matset_type == "sparse_by_element")
{
venn_sparse_by_element_matset(res);
venn_sparse_by_element_matset(res, nx, ny);
}
else
{
Expand Down
6 changes: 0 additions & 6 deletions src/tests/relay/t_relay_io_silo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,6 @@ TEST(conduit_relay_io_silo, round_trip_venn)
save_mesh["state/cycle"] = (int64) 0;
save_mesh["state/domain_id"] = 0;

// TODO remove once https://github.com/LLNL/conduit/issues/1163 is closed
save_mesh["coordsets"]["coords"].remove_child("params");

// The field mat_check has values that are one type and matset_values
// that are another type. The silo writer converts both to double arrays
// in this case, so we follow suit.
Expand Down Expand Up @@ -470,9 +467,6 @@ TEST(conduit_relay_io_silo, round_trip_venn_modded_matnos)
save_mesh["state/cycle"] = (int64) 0;
save_mesh["state/domain_id"] = 0;

// TODO remove once https://github.com/LLNL/conduit/issues/1163 is closed
save_mesh["coordsets"]["coords"].remove_child("params");

// The field mat_check has values that are one type and matset_values
// that are another type. The silo writer converts both to double arrays
// in this case, so we follow suit.
Expand Down

0 comments on commit f62ddb0

Please sign in to comment.