diff --git a/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp b/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp index d7ded7b8c..9cee660c5 100644 --- a/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp +++ b/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.cpp @@ -684,6 +684,16 @@ VTKHDataAdapter::BlueprintToVTKmDataSet(const Node &node, nverts, zero_copy); } + else if( mesh_type == "points") + { + result = PointsImplicitBlueprintToVTKmDataSet(coords_name, + n_coords, + topo_name, + n_topo, + neles, + nverts, + zero_copy); + } else if( mesh_type == "unstructured") { result = UnstructuredBlueprintToVTKmDataSet(coords_name, @@ -1186,6 +1196,62 @@ VTKHDataAdapter::StructuredBlueprintToVTKmDataSet return result; } +//----------------------------------------------------------------------------- + +vtkm::cont::DataSet * +VTKHDataAdapter::PointsImplicitBlueprintToVTKmDataSet + (const std::string &coords_name, // input string with coordset name + const Node &n_coords, // input mesh bp coordset (assumed unstructured) + const std::string &topo_name, // input string with topo name + const Node &n_topo, // input mesh bp topo + int &neles, // output, number of eles (will be the same as nverts) + int &nverts, // output, number of verts (will be the same as neles) + bool zero_copy) // attempt to zero copy +{ + vtkm::cont::DataSet *result = new vtkm::cont::DataSet(); + + nverts = n_coords["values/x"].dtype().number_of_elements(); + + int32 ndims; + vtkm::cont::CoordinateSystem coords; + if(n_coords["values/x"].dtype().is_float64()) + { + coords = detail::GetExplicitCoordinateSystem(n_coords, + coords_name, + ndims, + zero_copy); + } + else if(n_coords["values/x"].dtype().is_float32()) + { + coords = detail::GetExplicitCoordinateSystem(n_coords, + coords_name, + ndims, + zero_copy); + } + else + { + ASCENT_ERROR("Coordinate system must be floating point values"); + } + + result->AddCoordinateSystem(coords); + + vtkm::UInt8 shape_id = 1; + vtkm::IdComponent indices_per = 1; + vtkm::cont::CellSetSingleType<> cellset; + // alloc conn to nverts, fill with 0 --> nverts-1) + vtkm::cont::ArrayHandle connectivity; + connectivity.Allocate(nverts); + auto conn_portal = connectivity.WritePortal(); + for(int i = 0; i < nverts; ++i) + { + conn_portal.Set(i, i); + } + cellset.Fill(nverts, shape_id, indices_per, connectivity); + neles = cellset.GetNumberOfCells(); + result->SetCellSet(cellset); + return result; +} + //----------------------------------------------------------------------------- diff --git a/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.hpp b/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.hpp index 003fdb7f2..ca15124b4 100644 --- a/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.hpp +++ b/src/libs/ascent/runtimes/ascent_vtkh_data_adapter.hpp @@ -123,6 +123,14 @@ class ASCENT_API VTKHDataAdapter int &nverts, bool zero_copy); + static vtkm::cont::DataSet *PointsImplicitBlueprintToVTKmDataSet(const std::string &coords_name, + const conduit::Node &n_coords, + const std::string &topo_name, + const conduit::Node &n_topo, + int &neles, + int &nverts, + bool zero_copy); + static vtkm::cont::DataSet *UnstructuredBlueprintToVTKmDataSet(const std::string &coords_name, const conduit::Node &n_coords, const std::string &topo_name, diff --git a/src/tests/_baseline_images/tout_render_3d_braid_points_implicit100.png b/src/tests/_baseline_images/tout_render_3d_braid_points_implicit100.png new file mode 100644 index 000000000..b06a93672 Binary files /dev/null and b/src/tests/_baseline_images/tout_render_3d_braid_points_implicit100.png differ diff --git a/src/tests/ascent/t_ascent_render_3d.cpp b/src/tests/ascent/t_ascent_render_3d.cpp index b05f13eb7..833ef1f95 100644 --- a/src/tests/ascent/t_ascent_render_3d.cpp +++ b/src/tests/ascent/t_ascent_render_3d.cpp @@ -2510,6 +2510,69 @@ TEST(ascent_render_3d, test_render_3d_supported_conn_dtypes) ascent.close(); } + +//----------------------------------------------------------------------------- +TEST(ascent_render_3d, test_render_3d_points_implicit_topo) +{ + // 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 an example mesh. + // + Node data, verify_info; + conduit::blueprint::mesh::examples::braid("points_implicit", + 10, + 10, + 10, + data); + + + EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info)); + + ASCENT_INFO("Testing 3D Rendering of implicit points topology"); + + // + // Create the actions. + // + 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"] = "braid"; + + + string output_path = prepare_output_dir(); + + + string output_file = conduit::utils::join_file_path(output_path, + "tout_render_3d_braid_points_implicit"); + // remove old images before rendering + remove_test_image(output_file); + + Ascent ascent; + ascent.open(); + ascent.publish(data); + scenes["s1/image_prefix"] = output_file; + ascent.execute(actions); + ascent.close(); + + // check that we created an image + EXPECT_TRUE(check_test_image(output_file)); + +} + + // //----------------------------------------------------------------------------- TEST(ascent_render_3d, test_render_3d_extreme_extents) {