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

add support for all wedge and all pyramid topos #1302

Merged
merged 3 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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