diff --git a/CHANGELOG.md b/CHANGELOG.md index e69eb4200..02b119ec1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s - Added `transform` filter, which allows you to rotate, scale, translate, mesh coordinates - Added python script in src/utilities/visit_session_converters to convert VisIt color table to Ascent actions color table - Added `fields` option to the project 2d to support scalar rendering of specific fields. +- Added `dataset_bounds` option to the project 2d, which can be used instead of a full 3D camera specification ### Changed - Changed the replay utility's binary names such that `replay_ser` is now `ascent_replay` and `raplay_mpi` is now `ascent_replay_mpi`. This will help prevent potential name collisions with other tools that also have replay utilities. diff --git a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp index 162d8e0a3..be150997c 100644 --- a/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp +++ b/src/libs/ascent/runtimes/flow_filters/ascent_runtime_vtkh_filters.cpp @@ -3880,10 +3880,10 @@ VTKHStats::execute() MPI_Comm mpi_comm = MPI_Comm_f2c(Workspace::default_mpi_comm()); MPI_Comm_rank(mpi_comm, &rank); #endif - if(rank == 0) - { - res->PrintSummary(std::cout); - } + // if(rank == 0) + // { + // res->PrintSummary(std::cout); + // } } //----------------------------------------------------------------------------- @@ -3980,10 +3980,10 @@ VTKHHistogram::execute() MPI_Comm mpi_comm = MPI_Comm_f2c(Workspace::default_mpi_comm()); MPI_Comm_rank(mpi_comm, &rank); #endif - if(rank == 0) - { - res.Print(std::cout); - } + // if(rank == 0) + // { + // res.Print(std::cout); + // } } //----------------------------------------------------------------------------- @@ -4029,10 +4029,13 @@ VTKHProject2d::verify_params(const conduit::Node ¶ms, valid_paths.push_back("topology"); valid_paths.push_back("image_width"); valid_paths.push_back("image_height"); - ignore_paths.push_back("camera"); + valid_paths.push_back("dataset_bounds"); + valid_paths.push_back("camera"); valid_paths.push_back("fields"); + + ignore_paths.push_back("camera"); ignore_paths.push_back("fields"); - valid_paths.push_back("camera"); + ignore_paths.push_back("dataset_bounds"); std::string surprises = surprise_check(valid_paths, ignore_paths, params); @@ -4045,6 +4048,7 @@ VTKHProject2d::verify_params(const conduit::Node ¶ms, return res; } + //----------------------------------------------------------------------------- void VTKHProject2d::execute() @@ -4072,13 +4076,36 @@ VTKHProject2d::execute() throw_error); if(topo_name == "") { - // this creates a data object with an invalid soource + // this creates a data object with an invalid source set_output(new DataObject()); return; } vtkh::DataSet &data = collection->dataset_by_topology(topo_name); vtkm::Bounds bounds = data.GetGlobalBounds(); + + if(params().has_path("dataset_bounds")) + { + float64_accessor d_bounds = params()["dataset_bounds"].value(); + int num_bounds = d_bounds.number_of_elements(); + + if(num_bounds != 6) + { + std::string fpath = filter_to_path(this->name()); + ASCENT_ERROR("project_2d (" << fpath << ")" << + " only provided " << num_bounds << + " dataset_bounds when 6 are required:" << + " [xMin,xMax,yMin,yMax,zMin,zMax]"); + } + + bounds.X.Min = d_bounds[0]; + bounds.X.Max = d_bounds[1]; + bounds.Y.Min = d_bounds[2]; + bounds.Y.Max = d_bounds[3]; + bounds.Z.Min = d_bounds[4]; + bounds.Z.Max = d_bounds[5]; + } + vtkm::rendering::Camera camera; camera.ResetToBounds(bounds); @@ -4111,7 +4138,7 @@ VTKHProject2d::execute() } } - int width = 512; + int width = 512; int height = 512; if(params().has_path("image_width")) { @@ -5883,7 +5910,7 @@ VTKHVTKFileExtract::execute() n_recv, mpi_comm); n_global_domain_ids.set(DataType::index_t(num_global_domains)); - n_global_domain_ids.print(); + //n_global_domain_ids.print(); index_t_array global_vals = n_global_domain_ids.value(); // each child will an array with its domain ids index_t idx = 0; diff --git a/src/tests/ascent/t_ascent_scalar_renderer.cpp b/src/tests/ascent/t_ascent_scalar_renderer.cpp index 5efeba83b..257dce26f 100644 --- a/src/tests/ascent/t_ascent_scalar_renderer.cpp +++ b/src/tests/ascent/t_ascent_scalar_renderer.cpp @@ -19,6 +19,7 @@ #include #include +#include #include "t_config.hpp" #include "t_utils.hpp" @@ -189,6 +190,91 @@ TEST(ascent_scalar_rendering, test_scalar_rendering_fields_specified) ASCENT_ACTIONS_DUMP(actions,output_file,msg); } + + +//----------------------------------------------------------------------------- +TEST(ascent_scalar_rendering, test_scalar_rendering_data_bounds_specified) +{ + // the vtkm 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 test"); + return; + } + + + // + // Create an example mesh. + // + Node data, verify_info; + conduit::blueprint::mesh::examples::braid("quads", + EXAMPLE_MESH_SIDE_DIM, + EXAMPLE_MESH_SIDE_DIM, + 0, + data); + + EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info)); + + ASCENT_INFO("Testing Scalar Rendering with fields specified"); + + + string output_path = prepare_output_dir(); + string output_file = conduit::utils::join_file_path(output_path,"tout_scalar_rendering_bounds_specified"); + + conduit::relay::io::blueprint::save_mesh(data,conduit::utils::join_file_path(output_path, + "tout_scalar_rendering_bounds_specified_input"),"hdf5"); + + // + // Create the actions. + // + + conduit::Node pipelines; + // pipeline 1 + pipelines["pl1/f1/type"] = "project_2d"; + // filter knobs + conduit::Node ¶ms = pipelines["pl1/f1/params"]; + params["image_width"] = 512; + params["image_height"] = 512; + params["dataset_bounds"] = { 0.0, 5.0, // x + -10.0,-5.0, // y + 0.0,0.0}; // z + + conduit::Node extracts; + extracts["e1/type"] = "relay"; + extracts["e1/pipeline"] = "pl1"; + + extracts["e1/params/path"] = output_file; + extracts["e1/params/protocol"] = "blueprint/mesh/hdf5"; + + conduit::Node actions; + // add the extracts + conduit::Node &add_extracts = actions.append(); + add_extracts["action"] = "add_extracts"; + add_extracts["extracts"] = extracts; + // add the pipeline + conduit::Node &add_pipelines= actions.append(); + add_pipelines["action"] = "add_pipelines"; + add_pipelines["pipelines"] = pipelines; + + // + // Run Ascent + // + + Ascent ascent; + Node ascent_opts; + ascent.open(ascent_opts); + ascent.publish(data); + ascent.execute(actions); + ascent.close(); + + // check that we created an image + std::string msg = "An example of scalar rendering of specific fields"; + ASCENT_ACTIONS_DUMP(actions,output_file,msg); +} + //----------------------------------------------------------------------------- int main(int argc, char* argv[]) {