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

cinema fixes #1425

Merged
merged 2 commits into from
Nov 20, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ and this project aspires to adhere to [Semantic Versioning](https://semver.org/s
### Fixed
- Resolved a few cases where MPI_COMM_WORLD was used instead instead of the selected MPI communicator.
- Resolved a bug where a sharing a coordset between multiple polytopal topologies would corrupt mesh processing.
- Fixed a bug with Cinema resource output that could lead to corrupted html results.
- Fixed a bug where controls for world and screen annotations where ignored in Cinema renders.

## [0.9.3] - Released 2024-05-11
### Preferred dependency versions for [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ class CinemaManager
{
conduit::Node render_copy = render_node;

// allow zoom to be ajusted
// allow zoom to be adjusted
conduit::Node zoom;
if(render_copy.has_path("camera/zoom"))
{
Expand Down Expand Up @@ -774,6 +774,7 @@ class CinemaManager
}

tmp.SetCamera(camera);

renders->push_back(tmp);
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/libs/ascent/utils/ascent_resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ expand_resource_tree_to_file_system(const conduit::Node &resource_tree,
{
ASCENT_ERROR("expand_to_file_system failed to open file: "
<< "\"" << child_file << "\"");

}
ofs << curr.as_string();
std::string sval;
// construct string obeying bounds
sval.assign(curr.as_char8_str(), curr.dtype().number_of_elements());
ofs << sval;
}
else
{
Expand Down
8 changes: 8 additions & 0 deletions src/libs/vtkh/rendering/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ Render::Copy() const
copy.m_bg_color = m_bg_color;
copy.m_fg_color = m_fg_color;
copy.m_render_annotations = m_render_annotations;
copy.m_render_world_annotations = m_render_world_annotations;
copy.m_render_screen_annotations = m_render_screen_annotations;
copy.m_render_background = m_render_background;
copy.m_shading = m_shading;
copy.m_canvas = CreateCanvas();
Expand Down Expand Up @@ -266,6 +268,12 @@ Render::Print() const
std::cout<<"=== annotations : "
<<(m_render_annotations ? "On" : "Off")
<<"\n";
std::cout<<"=== world annotations : "
<<(m_render_world_annotations ? "On" : "Off")
<<"\n";
std::cout<<"=== screen annotations : "
<<(m_render_screen_annotations ? "On" : "Off")
<<"\n";
std::cout<<"=== background : "
<<(m_render_background ? "On" : "Off")
<<"\n";
Expand Down
94 changes: 94 additions & 0 deletions src/tests/ascent/t_ascent_cinema_a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,100 @@ TEST(ascent_cinema_a, test_cinema_a)
EXPECT_TRUE(conduit::utils::is_file(output_file));
}


//-----------------------------------------------------------------------------
TEST(ascent_cinema_a, test_cinema_a_annotations_off)
{
// 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 example mesh.
//
Node data, verify_info;
conduit::blueprint::mesh::examples::braid("hexs",
EXAMPLE_MESH_SIDE_DIM,
EXAMPLE_MESH_SIDE_DIM,
EXAMPLE_MESH_SIDE_DIM,
data);

EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));

std::string db_no_annot = "test_db1_no_annotations";
std::string db_world_no_annot = "test_db1_no_world_annotations";
std::string db_no_screen_annot = "test_db1_no_screen_annotations";

string output_path_base = conduit::utils::join_file_path(".","cinema_databases");
conduit::utils::remove_path_if_exists(conduit::utils::join_file_path(output_path_base, db_no_annot));
conduit::utils::remove_path_if_exists(conduit::utils::join_file_path(output_path_base, db_world_no_annot));
conduit::utils::remove_path_if_exists(conduit::utils::join_file_path(output_path_base, db_no_screen_annot));

Node actions;

conduit::Node pipelines;
pipelines["pl1/f1/type"] = "contour";
conduit::Node &contour_params = pipelines["pl1/f1/params"];
contour_params["field"] = "braid";
contour_params["iso_values"] = 0.;

conduit::Node scenes;
scenes["scene1/plots/plt1/type"] = "pseudocolor";
scenes["scene1/plots/plt1/pipeline"] = "pl1";
scenes["scene1/plots/plt1/field"] = "braid";

// no annotations
scenes["scene1/renders/r1/type"] = "cinema";
scenes["scene1/renders/r1/phi"] = 2;
scenes["scene1/renders/r1/theta"] = 2;
scenes["scene1/renders/r1/db_name"] = db_no_annot;
scenes["scene1/renders/r1/annotations"] = "false";

// no world annotations
scenes["scene1/renders/r2/type"] = "cinema";
scenes["scene1/renders/r2/phi"] = 2;
scenes["scene1/renders/r2/theta"] = 2;
scenes["scene1/renders/r2/db_name"] = db_world_no_annot;
scenes["scene1/renders/r2/world_annotations"] = "false";

// no screen annotations
scenes["scene1/renders/r3/type"] = "cinema";
scenes["scene1/renders/r3/phi"] = 2;
scenes["scene1/renders/r3/theta"] = 2;
scenes["scene1/renders/r3/db_name"] = db_no_screen_annot;
scenes["scene1/renders/r3/screen_annotations"] = "false";

// add the pipeline
conduit::Node &add_pipelines = actions.append();
add_pipelines["action"] = "add_pipelines";
add_pipelines["pipelines"] = pipelines;

// add scene
conduit::Node &add_scenes = actions.append();
add_scenes["action"] = "add_scenes";
add_scenes["scenes"] = scenes;
actions.print();

// Run Ascent
Ascent ascent;
ascent.open();
ascent.publish(data);
ascent.execute(actions);
ascent.close();

// check that we created the db dirs
EXPECT_TRUE(conduit::utils::is_directory(conduit::utils::join_file_path(output_path_base, db_no_annot)));
EXPECT_TRUE(conduit::utils::is_directory(conduit::utils::join_file_path(output_path_base, db_world_no_annot)));
EXPECT_TRUE(conduit::utils::is_directory(conduit::utils::join_file_path(output_path_base, db_no_screen_annot)));
}


//-----------------------------------------------------------------------------
TEST(ascent_cinema_a, test_angle_range_1)
{
Expand Down