Skip to content

Commit

Permalink
add support for all wedge and all pyramid topos (#1302)
Browse files Browse the repository at this point in the history
* add support for all wedge and all pyramid topos

* add baselines

* add exec guards for new tests
  • Loading branch information
cyrush committed May 22, 2024
1 parent 2aa608c commit baa7ec2
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 15 deletions.
39 changes: 24 additions & 15 deletions src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,16 @@ void VTKmCellShape(const std::string &shape_type,
shape_id = 3;
num_indices = 2;
}
else if(shape_type == "pyramid")
{
shape_id = 14;
num_indices = 5;
}
else if(shape_type == "wedge")
{
shape_id = 13;
num_indices = 6;
}
else
{
ASCENT_ERROR("Unsupported cell type "<<shape_type);
Expand Down Expand Up @@ -812,19 +822,18 @@ void CreateExplicitArrays(vtkm::cont::ArrayHandle<vtkm::UInt8> &shapes,
indices = 1;
dimensionality = 1;
}
// TODO: Not supported in blueprint yet ...
// else if(shape_type == "wedge")
// {
// shape_id = 13;
// indices = 6;
// dimensionality = 3;
// }
// else if(shape_type == "pyramid")
// {
// shape_id = 14;
// indices = 5;
// dimensionality = 3;
// }
else if(shape_type == "wedge")
{
shape_id = 13;
indices = 6;
dimensionality = 3;
}
else if(shape_type == "pyramid")
{
shape_id = 14;
indices = 5;
dimensionality = 3;
}
else
{
ASCENT_ERROR("Unsupported element shape " << shape_type);
Expand Down Expand Up @@ -1880,11 +1889,11 @@ GetBlueprintCellName(vtkm::UInt8 shape_id)
}
else if(shape_id == vtkm::CELL_SHAPE_WEDGE)
{
ASCENT_ERROR("Wedge is not supported in blueprint");
name = "wedge";
}
else if(shape_id == vtkm::CELL_SHAPE_PYRAMID)
{
ASCENT_ERROR("Pyramid is not supported in blueprint");
name = "pyramid";
}
return name;
}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
163 changes: 163 additions & 0 deletions src/tests/ascent/t_ascent_render_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2584,9 +2584,172 @@ TEST(ascent_render_3d, test_render_3d_points_implicit_topo)
}


//-----------------------------------------------------------------------------
TEST(ascent_render_3d, test_render_3d_pyra)
{
// the ascent runtime is currently our only rendering runtime
Node n;
ascent::about(n);
// only run this test if ascent was built with vtkm support
if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
{
ASCENT_INFO("Ascent support disabled, skipping 3D default"
"Pipeline test");

return;
}


Node mesh, info;
mesh["state/cycle"] = 100;
// create the coordinate set
mesh["coordsets/coords/type"] = "explicit";
mesh["coordsets/coords/values/x"] = {-1.0, 1.0, 1.0, -1.0, 0.0};
mesh["coordsets/coords/values/y"] = {-1.0, -1.0, 1.0, 1.0, 0.0};
mesh["coordsets/coords/values/z"] = { 0.0, 0.0, 0.0, 0.0, 1.0};
// add the topology

mesh["topologies/topo/type"] = "unstructured";
mesh["topologies/topo/coordset"] = "coords";
mesh["topologies/topo/elements/shape"] = "pyramid";
mesh["topologies/topo/elements/connectivity"].set(DataType::int64(5));
int64_array con_vals = mesh["topologies/topo/elements/connectivity"].value();
for(index_t i =0; i < 5; i++)
{
con_vals[i] = i;
}

mesh["fields/vert_id/topology"] = "topo";
mesh["fields/vert_id/association"] = "vertex";
mesh["fields/vert_id/values"].set(DataType::float64(5));
float64_array vert_id_vals = mesh["fields/vert_id/values"].value();
for(index_t i =0; i < 5; i++)
{
vert_id_vals[i] = i;
}

mesh["fields/ele_id/topology"] = "topo";
mesh["fields/ele_id/association"] = "element";
mesh["fields/ele_id/values"].set(DataType::float64(1));
float64_array ele_id_vals = mesh["fields/ele_id/values"].value();
ele_id_vals[0] = 0;

string output_path = prepare_output_dir();
string output_file = conduit::utils::join_file_path(output_path,
"tout_render_3d_pyramid_vert_id");
// remove old images before rendering
remove_test_image(output_file);

conduit::Node actions;
conduit::Node &add_plots = actions.append();
add_plots["action"] = "add_scenes";
conduit::Node &scenes = add_plots["scenes"];
scenes["s1/plots/p1/type"] = "pseudocolor";
scenes["s1/plots/p1/field"] = "vert_id";
scenes["s1/image_prefix"] = output_file;


Ascent ascent;
ascent.open();
ascent.publish(mesh);
ascent.execute(actions);
ascent.close();

EXPECT_TRUE(check_test_image(output_file));

}

//-----------------------------------------------------------------------------
TEST(ascent_render_3d, test_render_3d_wedge)
{
// the ascent runtime is currently our only rendering runtime
Node n;
ascent::about(n);
// only run this test if ascent was built with vtkm support
if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
{
ASCENT_INFO("Ascent support disabled, skipping 3D default"
"Pipeline test");

return;
}

Node mesh, info;
mesh["state/cycle"] = 100;
// create the coordinate set
mesh["coordsets/coords/type"] = "explicit";
mesh["coordsets/coords/values/x"] = {-1.0, 1.0, 0.0, -1.0, 1.0, 0.0};
mesh["coordsets/coords/values/y"] = {-1.0, -1.0, -1.0, 1.0, 1.0, 1.0};
mesh["coordsets/coords/values/z"] = { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0};
// add the topology

mesh["topologies/topo/type"] = "unstructured";
mesh["topologies/topo/coordset"] = "coords";
mesh["topologies/topo/elements/shape"] = "wedge";
mesh["topologies/topo/elements/connectivity"].set(DataType::int64(6));
int64_array con_vals = mesh["topologies/topo/elements/connectivity"].value();
for(index_t i =0; i < 6; i++)
{
con_vals[i] = i;
}

mesh["fields/vert_id/topology"] = "topo";
mesh["fields/vert_id/association"] = "vertex";
mesh["fields/vert_id/values"].set(DataType::float64(6));
float64_array vert_id_vals = mesh["fields/vert_id/values"].value();
for(index_t i =0; i < 6; i++)
{
vert_id_vals[i] = i;
}

mesh["fields/ele_id/topology"] = "topo";
mesh["fields/ele_id/association"] = "element";
mesh["fields/ele_id/values"].set(DataType::float64(1));
float64_array ele_id_vals = mesh["fields/ele_id/values"].value();
ele_id_vals[0] = 0;

string output_path = prepare_output_dir();
string output_file = conduit::utils::join_file_path(output_path,
"tout_render_3d_wedge_vert_id");
// remove old images before rendering
remove_test_image(output_file);

conduit::Node actions;
conduit::Node &add_plots = actions.append();
add_plots["action"] = "add_scenes";
conduit::Node &scenes = add_plots["scenes"];
scenes["s1/plots/p1/type"] = "pseudocolor";
scenes["s1/plots/p1/field"] = "vert_id";
scenes["s1/image_prefix"] = output_file;


Ascent ascent;
ascent.open();
ascent.publish(mesh);
ascent.execute(actions);
ascent.close();

EXPECT_TRUE(check_test_image(output_file));

}



// //-----------------------------------------------------------------------------
TEST(ascent_render_3d, test_render_3d_extreme_extents)
{
// the ascent runtime is currently our only rendering runtime
Node n;
ascent::about(n);
// only run this test if ascent was built with vtkm support
if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
{
ASCENT_INFO("Ascent support disabled, skipping 3D default"
"Pipeline test");

return;
}

// create uniform grid with very large (spatial) extents
Node mesh, info;

Expand Down

0 comments on commit baa7ec2

Please sign in to comment.