1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
2 // Copyright (c) Lawrence Livermore National Security, LLC and other Ascent
3 // Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
4 // other details. No copyright assignment is required to contribute to Ascent.
5 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
6 
7 //-----------------------------------------------------------------------------
8 ///
9 /// file: t_ascent_render_3d.cpp
10 ///
11 //-----------------------------------------------------------------------------
12 
13 
14 #include "gtest/gtest.h"
15 
16 #include <ascent.hpp>
17 
18 #include <iostream>
19 #include <math.h>
20 
21 #include <conduit_blueprint.hpp>
22 
23 #include "t_config.hpp"
24 #include "t_utils.hpp"
25 
26 
27 
28 
29 using namespace std;
30 using namespace conduit;
31 using namespace ascent;
32 
33 
34 index_t EXAMPLE_MESH_SIDE_DIM = 20;
35 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_render_default_runtime)36 TEST(ascent_render_3d, test_render_3d_render_default_runtime)
37 {
38     // the ascent runtime is currently our only rendering runtime
39     Node n;
40     ascent::about(n);
41     // only run this test if ascent was built with vtkm support
42     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
43     {
44         ASCENT_INFO("Ascent support disabled, skipping 3D default"
45                       "Pipeline test");
46 
47         return;
48     }
49 
50 
51     //
52     // Create an example mesh.
53     //
54     Node data, verify_info;
55     conduit::blueprint::mesh::examples::braid("hexs",
56                                               EXAMPLE_MESH_SIDE_DIM,
57                                               EXAMPLE_MESH_SIDE_DIM,
58                                               EXAMPLE_MESH_SIDE_DIM,
59                                               data);
60 
61     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
62 
63     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
64 
65 
66     string output_path = prepare_output_dir();
67     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_default_runtime");
68 
69     // remove old images before rendering
70     remove_test_image(output_file);
71 
72 
73     //
74     // Create the actions.
75     //
76 
77     conduit::Node scenes;
78     scenes["s1/plots/p1/type"]         = "pseudocolor";
79     scenes["s1/plots/p1/field"] = "braid";
80     scenes["s1/image_prefix"] = output_file;
81 
82 
83     conduit::Node actions;
84     conduit::Node &add_plots = actions.append();
85     add_plots["action"] = "add_scenes";
86     add_plots["scenes"] = scenes;
87 
88     //
89     // Run Ascent
90     //
91 
92     Ascent ascent;
93 
94     Node ascent_opts;
95     //ascent_opts["ascent_info"] = "verbose";
96     ascent_opts["timings"] = "true";
97     ascent_opts["runtime/type"] = "ascent";
98     ascent.open(ascent_opts);
99     ascent.publish(data);
100     ascent.execute(actions);
101     ascent.close();
102 
103     // check that we created an image
104     EXPECT_TRUE(check_test_image(output_file));
105 }
106 
TEST(ascent_render_3d,test_render_3d_original_bounds)107 TEST(ascent_render_3d, test_render_3d_original_bounds)
108 {
109     // the ascent runtime is currently our only rendering runtime
110     Node n;
111     ascent::about(n);
112     // only run this test if ascent was built with vtkm support
113     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
114     {
115         ASCENT_INFO("Ascent support disabled, skipping 3D default"
116                       "Pipeline test");
117 
118         return;
119     }
120 
121 
122     //
123     // Create an example mesh.
124     //
125     Node data, verify_info;
126     conduit::blueprint::mesh::examples::braid("hexs",
127                                               EXAMPLE_MESH_SIDE_DIM,
128                                               EXAMPLE_MESH_SIDE_DIM,
129                                               EXAMPLE_MESH_SIDE_DIM,
130                                               data);
131 
132     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
133 
134     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
135 
136 
137     string output_path = prepare_output_dir();
138     string output_file =
139       conduit::utils::join_file_path(output_path,"tout_render_3d_original_bounds");
140 
141     // remove old images before rendering
142     remove_test_image(output_file);
143 
144 
145     //
146     // Create the actions.
147     //
148 
149     conduit::Node pipelines;
150     // pipeline 1
151     pipelines["pl1/f1/type"] = "clip";
152     // filter knobs
153     conduit::Node &clip_params = pipelines["pl1/f1/params"];
154     clip_params["box/min/x"] = -10.;
155     clip_params["box/min/y"] = -10.;
156     clip_params["box/min/z"] = 0.;
157     clip_params["box/max/x"] = 10.01; // <=
158     clip_params["box/max/y"] = 10.01;
159     clip_params["box/max/z"] = 10.01;
160 
161     conduit::Node scenes;
162     scenes["s1/plots/p1/type"]         = "pseudocolor";
163     scenes["s1/plots/p1/field"] = "braid";
164     scenes["s1/plots/p1/pipeline"] = "pl1";
165     scenes["s1/renders/r1/image_prefix"] = output_file;
166     scenes["s1/renders/r1/use_original_bounds"] = "true";
167     scenes["s1/renders/r1/camera/azimuth"] = 90;
168 
169 
170     conduit::Node actions;
171 
172     // add the pipeline
173     conduit::Node &add_pipelines= actions.append();
174     add_pipelines["action"] = "add_pipelines";
175     add_pipelines["pipelines"] = pipelines;
176 
177     conduit::Node &add_plots = actions.append();
178     add_plots["scenes"] = scenes;
179     add_plots["action"] = "add_scenes";
180 
181 
182     //
183     // Run Ascent
184     //
185 
186     Ascent ascent;
187 
188     Node ascent_opts;
189     //ascent_opts["ascent_info"] = "verbose";
190     ascent_opts["timings"] = "true";
191     ascent_opts["runtime/type"] = "ascent";
192     ascent.open(ascent_opts);
193     ascent.publish(data);
194     ascent.execute(actions);
195     ascent.close();
196 
197     // check that we created an image
198     EXPECT_TRUE(check_test_image(output_file));
199 }
200 
TEST(ascent_render_3d,test_render_3d_single_comp_scalar)201 TEST(ascent_render_3d, test_render_3d_single_comp_scalar)
202 {
203     // the ascent runtime is currently our only rendering runtime
204     Node n;
205     ascent::about(n);
206     // only run this test if ascent was built with vtkm support
207     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
208     {
209         ASCENT_INFO("Ascent support disabled, skipping 3D default"
210                       "Pipeline test");
211 
212         return;
213     }
214 
215 
216     //
217     // Create an example mesh.
218     //
219     Node data, verify_info;
220     conduit::blueprint::mesh::examples::braid("hexs",
221                                               EXAMPLE_MESH_SIDE_DIM,
222                                               EXAMPLE_MESH_SIDE_DIM,
223                                               EXAMPLE_MESH_SIDE_DIM,
224                                               data);
225 
226     data["fields/braid2"] = data["fields/braid"];
227     data["fields/braid2/values/c0"] = data["fields/braid/values"];
228     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
229 
230     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
231 
232 
233     string output_path = prepare_output_dir();
234     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_single_comp");
235 
236     // remove old images before rendering
237     remove_test_image(output_file);
238 
239 
240     //
241     // Create the actions.
242     //
243 
244     conduit::Node scenes;
245     scenes["s1/plots/p1/type"] = "pseudocolor";
246     scenes["s1/plots/p1/field"] = "braid2";
247     scenes["s1/image_prefix"] = output_file;
248 
249 
250     conduit::Node actions;
251     conduit::Node &add_plots = actions.append();
252     add_plots["action"] = "add_scenes";
253     add_plots["scenes"] = scenes;
254 
255     //
256     // Run Ascent
257     //
258 
259     Ascent ascent;
260 
261     Node ascent_opts;
262     //ascent_opts["ascent_info"] = "verbose";
263     ascent_opts["timings"] = "true";
264     ascent_opts["runtime/type"] = "ascent";
265     ascent.open(ascent_opts);
266     ascent.publish(data);
267     ascent.execute(actions);
268     ascent.close();
269 
270     // check that we created an image
271     EXPECT_TRUE(check_test_image(output_file));
272 }
273 
TEST(ascent_render_3d,test_render_3d_points)274 TEST(ascent_render_3d, test_render_3d_points)
275 {
276     // the ascent runtime is currently our only rendering runtime
277     Node n;
278     ascent::about(n);
279     // only run this test if ascent was built with vtkm support
280     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
281     {
282         ASCENT_INFO("Ascent support disabled, skipping 3D default"
283                       "Pipeline test");
284 
285         return;
286     }
287 
288 
289     //
290     // Create an example mesh.
291     //
292     Node data, verify_info;
293     conduit::blueprint::mesh::examples::braid("points",
294                                               EXAMPLE_MESH_SIDE_DIM,
295                                               EXAMPLE_MESH_SIDE_DIM,
296                                               EXAMPLE_MESH_SIDE_DIM,
297                                               data);
298 
299     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
300 
301     ASCENT_INFO("Testing 3D Rendering with points");
302 
303 
304     string output_path = prepare_output_dir();
305     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_points");
306 
307     // remove old images before rendering
308     remove_test_image(output_file);
309 
310 
311     //
312     // Create the actions.
313     //
314 
315     conduit::Node scenes;
316     scenes["s1/plots/p1/type"]         = "pseudocolor";
317     scenes["s1/plots/p1/field"] = "braid";
318     scenes["s1/image_prefix"] = output_file;
319 
320 
321     conduit::Node actions;
322     conduit::Node &add_plots = actions.append();
323     add_plots["action"] = "add_scenes";
324     add_plots["scenes"] = scenes;
325 
326     //
327     // Run Ascent
328     //
329 
330     Ascent ascent;
331 
332     Node ascent_opts;
333     //ascent_opts["ascent_info"] = "verbose";
334     ascent_opts["timings"] = "true";
335     ascent_opts["runtime/type"] = "ascent";
336     ascent.open(ascent_opts);
337     ascent.publish(data);
338     ascent.execute(actions);
339     ascent.close();
340 
341     // check that we created an image
342     // NOTE: RELAXED TOLERANCE TO FROM default
343     //       to mitigate differences between platforms
344     EXPECT_TRUE(check_test_image(output_file,0.09f));
345 }
346 
TEST(ascent_render_3d,test_render_3d_points_const_radius)347 TEST(ascent_render_3d, test_render_3d_points_const_radius)
348 {
349     // the ascent runtime is currently our only rendering runtime
350     Node n;
351     ascent::about(n);
352     // only run this test if ascent was built with vtkm support
353     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
354     {
355         ASCENT_INFO("Ascent support disabled, skipping 3D default"
356                       "Pipeline test");
357 
358         return;
359     }
360 
361 
362     //
363     // Create an example mesh.
364     //
365     Node data, verify_info;
366     conduit::blueprint::mesh::examples::braid("points",
367                                               EXAMPLE_MESH_SIDE_DIM,
368                                               EXAMPLE_MESH_SIDE_DIM,
369                                               EXAMPLE_MESH_SIDE_DIM,
370                                               data);
371 
372     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
373 
374     ASCENT_INFO("Testing 3D Rendering with points");
375 
376 
377     string output_path = prepare_output_dir();
378     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_points_const_radius");
379 
380     // remove old images before rendering
381     remove_test_image(output_file);
382 
383 
384     //
385     // Create the actions.
386     //
387 
388     conduit::Node scenes;
389     scenes["s1/plots/p1/type"]         = "pseudocolor";
390     scenes["s1/plots/p1/field"] = "braid";
391     scenes["s1/plots/p1/points/radius"] = 1.f;
392     scenes["s1/image_prefix"] = output_file;
393 
394 
395     conduit::Node actions;
396     conduit::Node &add_plots = actions.append();
397     add_plots["action"] = "add_scenes";
398     add_plots["scenes"] = scenes;
399 
400     //
401     // Run Ascent
402     //
403 
404     Ascent ascent;
405 
406     Node ascent_opts;
407     //ascent_opts["ascent_info"] = "verbose";
408     ascent_opts["timings"] = "true";
409     ascent_opts["runtime/type"] = "ascent";
410     ascent.open(ascent_opts);
411     ascent.publish(data);
412     ascent.execute(actions);
413     ascent.close();
414 
415     // check that we created an image
416     // NOTE: RELAXED TOLERANCE TO FROM default
417     //       to mitigate differences between platforms
418     EXPECT_TRUE(check_test_image(output_file,0.01f));
419     std::string msg = "An example of rendering a point field with constant radius.";
420     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
421 }
422 
TEST(ascent_render_3d,test_render_3d_points_variable_radius)423 TEST(ascent_render_3d, test_render_3d_points_variable_radius)
424 {
425     // the ascent runtime is currently our only rendering runtime
426     Node n;
427     ascent::about(n);
428     // only run this test if ascent was built with vtkm support
429     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
430     {
431         ASCENT_INFO("Ascent support disabled, skipping 3D default"
432                       "Pipeline test");
433 
434         return;
435     }
436 
437 
438     //
439     // Create an example mesh.
440     //
441     Node data, verify_info;
442     conduit::blueprint::mesh::examples::braid("points",
443                                               EXAMPLE_MESH_SIDE_DIM,
444                                               EXAMPLE_MESH_SIDE_DIM,
445                                               EXAMPLE_MESH_SIDE_DIM,
446                                               data);
447 
448     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
449 
450     ASCENT_INFO("Testing 3D Rendering with points");
451 
452 
453     string output_path = prepare_output_dir();
454     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_points_variable_radius");
455 
456     // remove old images before rendering
457     remove_test_image(output_file);
458 
459 
460     //
461     // Create the actions.
462     //
463 
464     conduit::Node scenes;
465     scenes["s1/plots/p1/type"]         = "pseudocolor";
466     scenes["s1/plots/p1/field"] = "braid";
467     scenes["s1/plots/p1/points/radius"] = 0.25f;
468     // this detla is relative to the base radius
469     scenes["s1/plots/p1/points/radius_delta"] = 2.0f;
470     scenes["s1/image_prefix"] = output_file;
471 
472 
473     conduit::Node actions;
474     conduit::Node &add_plots = actions.append();
475     add_plots["action"] = "add_scenes";
476     add_plots["scenes"] = scenes;
477 
478     //
479     // Run Ascent
480     //
481 
482     Ascent ascent;
483 
484     Node ascent_opts;
485     //ascent_opts["ascent_info"] = "verbose";
486     ascent_opts["timings"] = "true";
487     ascent_opts["runtime/type"] = "ascent";
488     ascent.open(ascent_opts);
489     ascent.publish(data);
490     ascent.execute(actions);
491     ascent.close();
492 
493     // check that we created an image
494     // NOTE: RELAXED TOLERANCE TO FROM default
495     //       to mitigate differences between platforms
496     EXPECT_TRUE(check_test_image(output_file, 0.09));
497     std::string msg = "An example of rendering a point field with variable radius.";
498     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
499 }
500 
TEST(ascent_render_3d,test_render_3d_bg_fg_color)501 TEST(ascent_render_3d, test_render_3d_bg_fg_color)
502 {
503     // the ascent runtime is currently our only rendering runtime
504     Node n;
505     ascent::about(n);
506     // only run this test if ascent was built with vtkm support
507     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
508     {
509         ASCENT_INFO("Ascent support disabled, skipping 3D default"
510                       "Pipeline test");
511 
512         return;
513     }
514 
515 
516     //
517     // Create an example mesh.
518     //
519     Node data, verify_info;
520     conduit::blueprint::mesh::examples::braid("hexs",
521                                               EXAMPLE_MESH_SIDE_DIM,
522                                               EXAMPLE_MESH_SIDE_DIM,
523                                               EXAMPLE_MESH_SIDE_DIM,
524                                               data);
525 
526     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
527 
528     ASCENT_INFO("Testing 3D Rendering with custom bg/fg colors");
529 
530 
531     string output_path = prepare_output_dir();
532     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_bg_fg_colors");
533 
534     // remove old images before rendering
535     remove_test_image(output_file);
536 
537 
538     //
539     // Create the actions.
540     //
541 
542     conduit::Node scenes;
543     scenes["s1/plots/p1/type"]         = "pseudocolor";
544     scenes["s1/plots/p1/field"] = "braid";
545     scenes["s1/renders/r1/image_prefix"]   = output_file;
546     float bg_color[3] = {1.f, 1.f, 1.f};
547     float fg_color[3] = {0.f, 0.f, 0.f};
548     scenes["s1/renders/r1/bg_color"].set(bg_color,3);
549     scenes["s1/renders/r1/fg_color"].set(fg_color,3);
550 
551     conduit::Node actions;
552     conduit::Node &add_plots = actions.append();
553     add_plots["action"] = "add_scenes";
554     add_plots["scenes"] = scenes;
555 
556     //
557     // Run Ascent
558     //
559 
560     Ascent ascent;
561 
562     Node ascent_opts;
563     //ascent_opts["ascent_info"] = "verbose";
564     ascent_opts["timings"] = "true";
565     ascent_opts["runtime/type"] = "ascent";
566     ascent.open(ascent_opts);
567     ascent.publish(data);
568     ascent.execute(actions);
569     ascent.close();
570 
571     // check that we created an image
572     EXPECT_TRUE(check_test_image(output_file));
573     std::string msg = "An example of rendering custom background and foreground colors.";
574     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
575 }
576 
TEST(ascent_render_3d,test_render_3d_no_annotations)577 TEST(ascent_render_3d, test_render_3d_no_annotations)
578 {
579     // the ascent runtime is currently our only rendering runtime
580     Node n;
581     ascent::about(n);
582     // only run this test if ascent was built with vtkm support
583     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
584     {
585         ASCENT_INFO("Ascent support disabled, skipping 3D default"
586                       "Pipeline test");
587 
588         return;
589     }
590 
591 
592     //
593     // Create an example mesh.
594     //
595     Node data, verify_info;
596     conduit::blueprint::mesh::examples::braid("hexs",
597                                               EXAMPLE_MESH_SIDE_DIM,
598                                               EXAMPLE_MESH_SIDE_DIM,
599                                               EXAMPLE_MESH_SIDE_DIM,
600                                               data);
601 
602     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
603 
604     ASCENT_INFO("Testing 3D Rendering with no_annotations");
605 
606 
607     string output_path = prepare_output_dir();
608     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_no_annotations");
609 
610     // remove old images before rendering
611     remove_test_image(output_file);
612 
613 
614     //
615     // Create the actions.
616     //
617 
618     conduit::Node scenes;
619     scenes["s1/plots/p1/type"]         = "pseudocolor";
620     scenes["s1/plots/p1/field"] = "braid";
621     scenes["s1/renders/r1/image_prefix"]  = output_file;
622     scenes["s1/renders/r1/annotations"] = "false";
623 
624     conduit::Node actions;
625     conduit::Node &add_plots = actions.append();
626     add_plots["action"] = "add_scenes";
627     add_plots["scenes"] = scenes;
628 
629     //
630     // Run Ascent
631     //
632 
633     Ascent ascent;
634 
635     Node ascent_opts;
636     //ascent_opts["ascent_info"] = "verbose";
637     ascent_opts["timings"] = "true";
638     ascent_opts["runtime/type"] = "ascent";
639     ascent.open(ascent_opts);
640     ascent.publish(data);
641     ascent.execute(actions);
642     ascent.close();
643 
644     // check that we created an image
645     EXPECT_TRUE(check_test_image(output_file));
646     std::string msg = "An example of rendering with no annotations.";
647     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
648 }
649 
650 
TEST(ascent_render_3d,test_render_3d_no_world_annotations)651 TEST(ascent_render_3d, test_render_3d_no_world_annotations)
652 {
653     // the ascent runtime is currently our only rendering runtime
654     Node n;
655     ascent::about(n);
656     // only run this test if ascent was built with vtkm support
657     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
658     {
659         ASCENT_INFO("Ascent support disabled, skipping 3D default"
660                       "Pipeline test");
661 
662         return;
663     }
664 
665 
666     //
667     // Create an example mesh.
668     //
669     Node data, verify_info;
670     conduit::blueprint::mesh::examples::braid("hexs",
671                                               EXAMPLE_MESH_SIDE_DIM,
672                                               EXAMPLE_MESH_SIDE_DIM,
673                                               EXAMPLE_MESH_SIDE_DIM,
674                                               data);
675 
676     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
677 
678     ASCENT_INFO("Testing 3D Rendering with no world annotations");
679 
680 
681     string output_path = prepare_output_dir();
682     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_no_world_annotations");
683 
684     // remove old images before rendering
685     remove_test_image(output_file);
686 
687 
688     //
689     // Create the actions.
690     //
691 
692     conduit::Node scenes;
693     scenes["s1/plots/p1/type"]         = "pseudocolor";
694     scenes["s1/plots/p1/field"] = "braid";
695     scenes["s1/renders/r1/image_prefix"]  = output_file;
696     scenes["s1/renders/r1/world_annotations"] = "false";
697 
698     conduit::Node actions;
699     conduit::Node &add_plots = actions.append();
700     add_plots["action"] = "add_scenes";
701     add_plots["scenes"] = scenes;
702 
703     //
704     // Run Ascent
705     //
706 
707     Ascent ascent;
708 
709     Node ascent_opts;
710     //ascent_opts["ascent_info"] = "verbose";
711     ascent_opts["timings"] = "true";
712     ascent_opts["runtime/type"] = "ascent";
713     ascent.open(ascent_opts);
714     ascent.publish(data);
715     ascent.execute(actions);
716     ascent.close();
717 
718     // check that we created an image
719     EXPECT_TRUE(check_test_image(output_file));
720     std::string msg = "An example of rendering with no world annotations.";
721     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
722 }
723 
TEST(ascent_render_3d,test_render_3d_no_screen_annotations)724 TEST(ascent_render_3d, test_render_3d_no_screen_annotations)
725 {
726     // the ascent runtime is currently our only rendering runtime
727     Node n;
728     ascent::about(n);
729     // only run this test if ascent was built with vtkm support
730     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
731     {
732         ASCENT_INFO("Ascent support disabled, skipping 3D default"
733                       "Pipeline test");
734 
735         return;
736     }
737 
738 
739     //
740     // Create an example mesh.
741     //
742     Node data, verify_info;
743     conduit::blueprint::mesh::examples::braid("hexs",
744                                               EXAMPLE_MESH_SIDE_DIM,
745                                               EXAMPLE_MESH_SIDE_DIM,
746                                               EXAMPLE_MESH_SIDE_DIM,
747                                               data);
748 
749     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
750 
751     ASCENT_INFO("Testing 3D Rendering with no screen annotations");
752 
753 
754     string output_path = prepare_output_dir();
755     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_no_screen_annotations");
756 
757     // remove old images before rendering
758     remove_test_image(output_file);
759 
760 
761     //
762     // Create the actions.
763     //
764 
765     conduit::Node scenes;
766     scenes["s1/plots/p1/type"]         = "pseudocolor";
767     scenes["s1/plots/p1/field"] = "braid";
768     scenes["s1/renders/r1/image_prefix"]  = output_file;
769     scenes["s1/renders/r1/screen_annotations"] = "false";
770 
771     conduit::Node actions;
772     conduit::Node &add_plots = actions.append();
773     add_plots["action"] = "add_scenes";
774     add_plots["scenes"] = scenes;
775 
776     //
777     // Run Ascent
778     //
779 
780     Ascent ascent;
781 
782     Node ascent_opts;
783     //ascent_opts["ascent_info"] = "verbose";
784     ascent_opts["timings"] = "true";
785     ascent_opts["runtime/type"] = "ascent";
786     ascent.open(ascent_opts);
787     ascent.publish(data);
788     ascent.execute(actions);
789     ascent.close();
790 
791     // check that we created an image
792     EXPECT_TRUE(check_test_image(output_file));
793     std::string msg = "An example of rendering with no screen annotations.";
794     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
795 }
796 
797 
798 
TEST(ascent_render_3d,test_render_3d_name_format)799 TEST(ascent_render_3d, test_render_3d_name_format)
800 {
801     // the ascent runtime is currently our only rendering runtime
802     Node n;
803     ascent::about(n);
804     // only run this test if ascent was built with vtkm support
805     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
806     {
807         ASCENT_INFO("Ascent support disabled, skipping 3D default"
808                       "Pipeline test");
809 
810         return;
811     }
812 
813 
814     //
815     // Create an example mesh.
816     //
817     Node data, verify_info;
818     conduit::blueprint::mesh::examples::braid("hexs",
819                                               EXAMPLE_MESH_SIDE_DIM,
820                                               EXAMPLE_MESH_SIDE_DIM,
821                                               EXAMPLE_MESH_SIDE_DIM,
822                                               data);
823 
824     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
825 
826     ASCENT_INFO("Testing 3D Rendering with image name format");
827 
828     string output_path = prepare_output_dir();
829     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_name_format");
830 
831     // remove old images before rendering
832     remove_test_image(output_file, "0100");
833 
834 
835     //
836     // Create the actions.
837     //
838 
839     conduit::Node scenes;
840     scenes["s1/plots/p1/type"]         = "pseudocolor";
841     scenes["s1/plots/p1/field"] = "braid";
842     scenes["s1/renders/r1/image_prefix"]  = output_file + "%04d";
843     scenes["s1/renders/r1/annotations"] = "false";
844 
845     conduit::Node actions;
846     conduit::Node &add_plots = actions.append();
847     add_plots["action"] = "add_scenes";
848     add_plots["scenes"] = scenes;
849 
850     //
851     // Run Ascent
852     //
853 
854     Ascent ascent;
855 
856     Node ascent_opts;
857     //ascent_opts["ascent_info"] = "verbose";
858     ascent_opts["timings"] = "true";
859     ascent_opts["runtime/type"] = "ascent";
860     ascent.open(ascent_opts);
861     ascent.publish(data);
862     ascent.execute(actions);
863     ascent.close();
864 
865     // check that we created an image
866     EXPECT_TRUE(check_test_image(output_file, 0.0001f, "0100"));
867     std::string msg = "An example of rendering to a filename using format specifiers.";
868     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
869 }
870 
TEST(ascent_render_3d,test_render_3d_no_bg)871 TEST(ascent_render_3d, test_render_3d_no_bg)
872 {
873     // the ascent runtime is currently our only rendering runtime
874     Node n;
875     ascent::about(n);
876     // only run this test if ascent was built with vtkm support
877     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
878     {
879         ASCENT_INFO("Ascent support disabled, skipping 3D default"
880                       "Pipeline test");
881 
882         return;
883     }
884 
885 
886     //
887     // Create an example mesh.
888     //
889     Node data, verify_info;
890     conduit::blueprint::mesh::examples::braid("hexs",
891                                               EXAMPLE_MESH_SIDE_DIM,
892                                               EXAMPLE_MESH_SIDE_DIM,
893                                               EXAMPLE_MESH_SIDE_DIM,
894                                               data);
895 
896     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
897 
898     ASCENT_INFO("Testing 3D Rendering with no background");
899 
900 
901     string output_path = prepare_output_dir();
902     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_no_bg");
903 
904     // remove old images before rendering
905     remove_test_image(output_file);
906 
907 
908     //
909     // Create the actions.
910     //
911 
912     conduit::Node scenes;
913     scenes["s1/plots/p1/type"]         = "pseudocolor";
914     scenes["s1/plots/p1/field"] = "braid";
915     scenes["s1/renders/r1/image_prefix"]  = output_file;
916     scenes["s1/renders/r1/render_bg"] = "false";
917 
918     conduit::Node actions;
919     conduit::Node &add_plots = actions.append();
920     add_plots["action"] = "add_scenes";
921     add_plots["scenes"] = scenes;
922 
923     //
924     // Run Ascent
925     //
926 
927     Ascent ascent;
928 
929     Node ascent_opts;
930     //ascent_opts["ascent_info"] = "verbose";
931     ascent_opts["timings"] = "true";
932     ascent_opts["runtime/type"] = "ascent";
933     ascent.open(ascent_opts);
934     ascent.publish(data);
935     ascent.execute(actions);
936     ascent.close();
937 
938     // check that we created an image
939     EXPECT_TRUE(check_test_image(output_file));
940     std::string msg = "An example of rendering with no background (alpha channel = 0)";
941     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
942 }
943 
TEST(ascent_render_3d,test_render_3d_render_azimuth)944 TEST(ascent_render_3d, test_render_3d_render_azimuth)
945 {
946     // the ascent runtime is currently our only rendering runtime
947     Node n;
948     ascent::about(n);
949     // only run this test if ascent was built with vtkm support
950     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
951     {
952         ASCENT_INFO("Ascent support disabled, skipping 3D default"
953                       "Pipeline test");
954 
955         return;
956     }
957 
958 
959     //
960     // Create an example mesh.
961     //
962     Node data, verify_info;
963     conduit::blueprint::mesh::examples::braid("hexs",
964                                               EXAMPLE_MESH_SIDE_DIM,
965                                               EXAMPLE_MESH_SIDE_DIM,
966                                               EXAMPLE_MESH_SIDE_DIM,
967                                               data);
968 
969     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
970 
971     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
972 
973 
974     string output_path = prepare_output_dir();
975     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_azimuth");
976 
977     // remove old images before rendering
978     remove_test_image(output_file);
979 
980 
981     //
982     // Create the actions.
983     //
984 
985     conduit::Node scenes;
986     scenes["s1/plots/p1/type"]         = "pseudocolor";
987     scenes["s1/plots/p1/field"] = "braid";
988     scenes["s1/renders/r1/camera/azimuth"] = 1.;
989     scenes["s1/renders/r1/image_prefix"]   = output_file;
990 
991 
992     conduit::Node actions;
993     conduit::Node &add_plots = actions.append();
994     add_plots["action"] = "add_scenes";
995     add_plots["scenes"] = scenes;
996 
997     //
998     // Run Ascent
999     //
1000 
1001     Ascent ascent;
1002 
1003     Node ascent_opts;
1004     //ascent_opts["ascent_info"] = "verbose";
1005     ascent_opts["runtime/type"] = "ascent";
1006     ascent.open(ascent_opts);
1007     ascent.publish(data);
1008     ascent.execute(actions);
1009     ascent.close();
1010 
1011     // check that we created an image
1012     EXPECT_TRUE(check_test_image(output_file));
1013     std::string msg = "An example of changing the azimuth of the camera.";
1014     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
1015 }
1016 
1017 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_multi_render_default_runtime)1018 TEST(ascent_render_3d, test_render_3d_multi_render_default_runtime)
1019 {
1020     // the ascent runtime is currently our only rendering runtime
1021     Node n;
1022     ascent::about(n);
1023     // only run this test if ascent was built with vtkm support
1024     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1025     {
1026         ASCENT_INFO("Ascent support disabled, skipping 3D default"
1027                       "Pipeline test");
1028 
1029         return;
1030     }
1031 
1032     //
1033     // Create an example mesh.
1034     //
1035     Node data, verify_info;
1036     conduit::blueprint::mesh::examples::braid("uniform",
1037                                               EXAMPLE_MESH_SIDE_DIM,
1038                                               EXAMPLE_MESH_SIDE_DIM,
1039                                               EXAMPLE_MESH_SIDE_DIM,
1040                                               data);
1041 
1042     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1043 
1044     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
1045 
1046 
1047     string output_path = prepare_output_dir();
1048     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_multi_default_runtime");
1049 
1050     // remove old images before rendering
1051     remove_test_image(output_file);
1052 
1053 
1054     //
1055     // Create the actions.
1056     //
1057 
1058     conduit::Node pipelines;
1059     // pipeline 1
1060     pipelines["pl1/f1/type"] = "contour";
1061     // filter knobs
1062     conduit::Node &contour_params = pipelines["pl1/f1/params"];
1063     contour_params["field"] = "braid";
1064     contour_params["iso_values"] = 0.;
1065 
1066     conduit::Node scenes;
1067     // plot 1
1068     scenes["s1/plots/p1/type"]         = "pseudocolor";
1069     scenes["s1/plots/p1/field"] = "radial";
1070     scenes["s1/plots/p1/pipeline"] = "pl1";
1071     //plot 2
1072     scenes["s1/plots/p2/type"]         = "volume";
1073     scenes["s1/plots/p2/field"] = "braid";
1074     scenes["s1/plots/p2/min_value"]    = -.5;
1075     scenes["s1/plots/p2/max_value"]    = .5;
1076     scenes["s1/plots/p2/color_table/name"]  = "rainbow desaturated";
1077 
1078     conduit::Node control_points;
1079 
1080     conduit::Node &point4 = control_points.append();
1081     point4["type"] = "alpha";
1082     point4["position"] = 0.;
1083     point4["alpha"] = 0.0;
1084 
1085     conduit::Node &point5 = control_points.append();
1086     point5["type"] = "alpha";
1087     point5["position"] = 1.0;
1088     point5["alpha"] = .5;
1089 
1090     scenes["s1/plots/p2/color_table/control_points"]  = control_points;
1091 
1092     scenes["s1/image_prefix"] = output_file;
1093 
1094 
1095     conduit::Node actions;
1096     // add the pipeline
1097     conduit::Node &add_pipelines = actions.append();
1098     add_pipelines["action"] = "add_pipelines";
1099     add_pipelines["pipelines"] = pipelines;
1100     // add the scenes
1101     conduit::Node &add_scenes= actions.append();
1102     add_scenes["action"] = "add_scenes";
1103     add_scenes["scenes"] = scenes;
1104 
1105     //
1106     // Run Ascent
1107     //
1108 
1109     Ascent ascent;
1110 
1111     Node ascent_opts;
1112     //ascent_opts["ascent_info"] = "verbose";
1113     ascent_opts["runtime/type"] = "ascent";
1114     ascent.open(ascent_opts);
1115     ascent.publish(data);
1116     ascent.execute(actions);
1117     ascent.close();
1118 
1119     // check that we created an image
1120     EXPECT_TRUE(check_test_image(output_file));
1121     std::string msg = "An example of creating a transfer function for volume rendering.";
1122     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
1123 }
1124 
1125 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_render_mesh)1126 TEST(ascent_render_3d, test_render_3d_render_mesh)
1127 {
1128     // the ascent runtime is currently our only rendering runtime
1129     Node n;
1130     ascent::about(n);
1131     // only run this test if ascent was built with vtkm support
1132     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1133     {
1134         ASCENT_INFO("Ascent support disabled, skipping 3D default"
1135                       "Pipeline test");
1136 
1137         return;
1138     }
1139 
1140     //
1141     // Create an example mesh.
1142     //
1143     Node data, verify_info;
1144     conduit::blueprint::mesh::examples::braid("uniform",
1145                                               EXAMPLE_MESH_SIDE_DIM,
1146                                               EXAMPLE_MESH_SIDE_DIM,
1147                                               EXAMPLE_MESH_SIDE_DIM,
1148                                               data);
1149 
1150     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1151 
1152     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
1153 
1154 
1155     string output_path = prepare_output_dir();
1156     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_mesh");
1157 
1158     // remove old images before rendering
1159     remove_test_image(output_file);
1160 
1161 
1162     //
1163     // Create the actions.
1164     //
1165 
1166     conduit::Node scenes;
1167     //plot 1
1168     scenes["s1/plots/p1/type"] = "mesh";
1169     scenes["s1/image_prefix"] = output_file;
1170 
1171     conduit::Node actions;
1172     // add the scenes
1173     conduit::Node &add_scenes= actions.append();
1174     add_scenes["action"] = "add_scenes";
1175     add_scenes["scenes"] = scenes;
1176 
1177     //
1178     // Run Ascent
1179     //
1180 
1181     Ascent ascent;
1182 
1183     Node ascent_opts;
1184     //ascent_opts["ascent_info"] = "verbose";
1185     ascent_opts["runtime/type"] = "ascent";
1186     ascent.open(ascent_opts);
1187     ascent.publish(data);
1188     ascent.execute(actions);
1189     ascent.close();
1190 
1191     // check that we created an image
1192     float tolerance = 0.01f;
1193     EXPECT_TRUE(check_test_image(output_file, tolerance));
1194     std::string msg = "An example of creating a mesh plot.";
1195     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
1196 }
1197 
1198 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_multi_render_mesh)1199 TEST(ascent_render_3d, test_render_3d_multi_render_mesh)
1200 {
1201     // the ascent runtime is currently our only rendering runtime
1202     Node n;
1203     ascent::about(n);
1204     // only run this test if ascent was built with vtkm support
1205     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1206     {
1207         ASCENT_INFO("Ascent support disabled, skipping 3D default"
1208                       "Pipeline test");
1209 
1210         return;
1211     }
1212 
1213     //
1214     // Create an example mesh.
1215     //
1216     Node data, verify_info;
1217     conduit::blueprint::mesh::examples::braid("uniform",
1218                                               EXAMPLE_MESH_SIDE_DIM,
1219                                               EXAMPLE_MESH_SIDE_DIM,
1220                                               EXAMPLE_MESH_SIDE_DIM,
1221                                               data);
1222 
1223     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1224 
1225     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
1226 
1227 
1228     string output_path = prepare_output_dir();
1229     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_multi_mesh");
1230 
1231     // remove old images before rendering
1232     remove_test_image(output_file);
1233 
1234 
1235     //
1236     // Create the actions.
1237     //
1238 
1239     conduit::Node pipelines;
1240     // pipeline 1
1241     pipelines["pl1/f1/type"] = "contour";
1242     // filter knobs
1243     conduit::Node &contour_params = pipelines["pl1/f1/params"];
1244     contour_params["field"] = "braid";
1245     contour_params["iso_values"] = 0.;
1246 
1247     conduit::Node scenes;
1248     // plot 1
1249     scenes["s1/plots/p1/type"]         = "pseudocolor";
1250     scenes["s1/plots/p1/field"] = "radial";
1251     scenes["s1/plots/p1/pipeline"] = "pl1";
1252     //plot 2
1253     scenes["s1/plots/p2/type"] = "mesh";
1254     scenes["s1/plots/p2/pipeline"] = "pl1";
1255 
1256     scenes["s1/image_prefix"] = output_file;
1257 
1258 
1259     conduit::Node actions;
1260     // add the pipeline
1261     conduit::Node &add_pipelines = actions.append();
1262     add_pipelines["action"] = "add_pipelines";
1263     add_pipelines["pipelines"] = pipelines;
1264     // add the scenes
1265     conduit::Node &add_scenes= actions.append();
1266     add_scenes["action"] = "add_scenes";
1267     add_scenes["scenes"] = scenes;
1268 
1269     //
1270     // Run Ascent
1271     //
1272 
1273     Ascent ascent;
1274 
1275     Node ascent_opts;
1276     //ascent_opts["ascent_info"] = "verbose";
1277     ascent_opts["runtime/type"] = "ascent";
1278     ascent.open(ascent_opts);
1279     ascent.publish(data);
1280     ascent.execute(actions);
1281     ascent.close();
1282 
1283     // check that we created an image
1284     float tolerance = 0.01f;
1285     EXPECT_TRUE(check_test_image(output_file, tolerance));
1286     std::string msg = "An example of creating a mesh plot of a contour.";
1287     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
1288 }
1289 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_render_ascent_serial_backend_uniform)1290 TEST(ascent_render_3d, test_render_3d_render_ascent_serial_backend_uniform)
1291 {
1292 
1293     Node n;
1294     ascent::about(n);
1295     // only run this test if ascent was built with vtkm support
1296     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1297     {
1298         ASCENT_INFO("Ascent support disabled, skipping 3D serial test");
1299         return;
1300     }
1301 
1302     ASCENT_INFO("Testing 3D Rendering with Ascent runtime using Serial Backend");
1303 
1304     //
1305     // Create an example mesh.
1306     //
1307     Node data, verify_info;
1308     conduit::blueprint::mesh::examples::braid("uniform",
1309                                               EXAMPLE_MESH_SIDE_DIM,
1310                                               EXAMPLE_MESH_SIDE_DIM,
1311                                               EXAMPLE_MESH_SIDE_DIM,
1312                                               data);
1313 
1314     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1315 
1316 
1317     string output_path = prepare_output_dir();
1318     string output_file = conduit::utils::join_file_path(output_path, "tout_render_3d_ascent_serial_backend_uniform");
1319 
1320     // remove old images before rendering
1321     remove_test_image(output_file);
1322 
1323     //
1324     // Create the actions.
1325     //
1326 
1327     conduit::Node scenes;
1328     scenes["s1/plots/p1/type"]         = "pseudocolor";
1329     scenes["s1/plots/p1/field"] = "braid";
1330     scenes["s1/image_prefix"] = output_file;
1331 
1332 
1333     conduit::Node actions;
1334     conduit::Node &add_plots = actions.append();
1335     add_plots["action"] = "add_scenes";
1336     add_plots["scenes"] = scenes;
1337     actions.print();
1338 
1339     //
1340     // Run Ascent
1341     //
1342 
1343     Ascent ascent;
1344 
1345     Node ascent_opts;
1346     ascent_opts["runtime/type"] = "ascent";
1347     ascent_opts["runtime/backend"] = "serial";
1348     ascent.open(ascent_opts);
1349     ascent.publish(data);
1350     ascent.execute(actions);
1351     ascent.close();
1352 
1353     // check that we created an image
1354     EXPECT_TRUE(check_test_image(output_file));
1355 }
1356 
1357 
1358 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_render_ascent_serial_backend)1359 TEST(ascent_render_3d, test_render_3d_render_ascent_serial_backend)
1360 {
1361 
1362     Node n;
1363     ascent::about(n);
1364     // only run this test if ascent was built with vtkm support
1365     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1366     {
1367         ASCENT_INFO("Ascent support disabled, skipping 3D serial test");
1368         return;
1369     }
1370 
1371     ASCENT_INFO("Testing 3D Rendering with Ascent runtime using Serial Backend");
1372 
1373     //
1374     // Create an example mesh.
1375     //
1376     Node data, verify_info;
1377     conduit::blueprint::mesh::examples::braid("hexs",
1378                                               EXAMPLE_MESH_SIDE_DIM,
1379                                               EXAMPLE_MESH_SIDE_DIM,
1380                                               EXAMPLE_MESH_SIDE_DIM,
1381                                               data);
1382 
1383     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1384 
1385     string output_path = prepare_output_dir();
1386     string output_file = conduit::utils::join_file_path(output_path, "tout_render_3d_ascent_serial_backend");
1387 
1388     // remove old images before rendering
1389     remove_test_image(output_file);
1390 
1391     //
1392     // Create the actions.
1393     //
1394 
1395     conduit::Node scenes;
1396     scenes["s1/plots/p1/type"]         = "pseudocolor";
1397     scenes["s1/plots/p1/field"] = "braid";
1398     scenes["s1/image_prefix"] = output_file;
1399 
1400 
1401     conduit::Node actions;
1402     conduit::Node &add_plots = actions.append();
1403     add_plots["action"] = "add_scenes";
1404     add_plots["scenes"] = scenes;
1405 
1406     //
1407     // Run Ascent
1408     //
1409 
1410     Ascent ascent;
1411 
1412     Node ascent_opts;
1413     ascent_opts["runtime/type"] = "ascent";
1414     ascent_opts["runtime/backend"] = "serial";
1415     ascent.open(ascent_opts);
1416     ascent.publish(data);
1417     ascent.execute(actions);
1418     ascent.close();
1419 
1420     // check that we created an image
1421     EXPECT_TRUE(check_test_image(output_file));
1422 }
1423 
1424 
1425 
1426 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_render_ascent_min_max)1427 TEST(ascent_render_3d, test_render_3d_render_ascent_min_max)
1428 {
1429 
1430     Node n;
1431     ascent::about(n);
1432     // only run this test if ascent was built with vtkm support
1433     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1434     {
1435         ASCENT_INFO("Ascent support disabled, skipping 3D serial test");
1436         return;
1437     }
1438 
1439     ASCENT_INFO("Testing 3D Rendering with Ascent runtime");
1440 
1441     //
1442     // Create an example mesh.
1443     //
1444     Node data, verify_info;
1445     conduit::blueprint::mesh::examples::braid("hexs",
1446                                               EXAMPLE_MESH_SIDE_DIM,
1447                                               EXAMPLE_MESH_SIDE_DIM,
1448                                               EXAMPLE_MESH_SIDE_DIM,
1449                                               data);
1450 
1451     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1452 
1453 
1454     string output_path = prepare_output_dir();
1455     string output_file = conduit::utils::join_file_path(output_path, "tout_render_3d_ascent_min_max");
1456 
1457     // remove old images before rendering
1458     remove_test_image(output_file);
1459 
1460 
1461     //
1462     // Create the actions.
1463     //
1464 
1465     conduit::Node scenes;
1466     scenes["s1/plots/p1/type"]         = "pseudocolor";
1467     scenes["s1/plots/p1/field"] = "braid";
1468     scenes["s1/plots/p1/min_value"] = -0.5;
1469     scenes["s1/plots/p1/max_value"] = 0.5;
1470     scenes["s1/image_prefix"] = output_file;
1471 
1472     conduit::Node actions;
1473     conduit::Node &add_plots = actions.append();
1474     add_plots["action"] = "add_scenes";
1475     add_plots["scenes"] = scenes;
1476 
1477     //
1478     // Run Ascent
1479     //
1480 
1481     Ascent ascent;
1482 
1483     Node ascent_opts;
1484     ascent_opts["runtime/type"] = "ascent";
1485     ascent.open(ascent_opts);
1486     ascent.publish(data);
1487     ascent.execute(actions);
1488     ascent.close();
1489 
1490     // check that we created an image
1491     EXPECT_TRUE(check_test_image(output_file));
1492     std::string msg = "An example of creating a plot specifying the min and max "
1493                       "values of the scalar range.";
1494     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
1495 }
1496 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_render_ascent_openmp_backend)1497 TEST(ascent_render_3d, test_render_3d_render_ascent_openmp_backend)
1498 {
1499 
1500     Node n;
1501     ascent::about(n);
1502     // only run this test if ascent was built with vtkm support
1503     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1504     {
1505         ASCENT_INFO("Ascent support disabled, skipping 3D Ascent-openmp test");
1506         return;
1507     }
1508 
1509     if(n["runtimes/ascent/vtkm/backends/openmp"].as_string() != "enabled")
1510     {
1511         ASCENT_INFO("Ascent openmp support disabled, skipping 3D Ascent-opemp test");
1512         return;
1513     }
1514 
1515     ASCENT_INFO("Testing 3D Rendering with Ascent using OpenMP Backend");
1516 
1517     //
1518     // Create an example mesh.
1519     //
1520     Node data, verify_info;
1521     conduit::blueprint::mesh::examples::braid("hexs",
1522                                               EXAMPLE_MESH_SIDE_DIM,
1523                                               EXAMPLE_MESH_SIDE_DIM,
1524                                               EXAMPLE_MESH_SIDE_DIM,
1525                                               data);
1526 
1527     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1528 
1529 
1530     string output_path = prepare_output_dir();
1531     string output_file = conduit::utils::join_file_path(output_path, "tout_render_3d_ascent_openmp_backend");
1532 
1533     // remove old images before rendering
1534     remove_test_image(output_file);
1535 
1536 
1537     //
1538     // Create the actions.
1539     //
1540 
1541     conduit::Node scenes;
1542     scenes["s1/plots/p1/type"]         = "pseudocolor";
1543     scenes["s1/plots/p1/field"] = "braid";
1544     scenes["s1/image_prefix"] = output_file;
1545 
1546     conduit::Node actions;
1547     conduit::Node &add_plots = actions.append();
1548     add_plots["action"] = "add_scenes";
1549     add_plots["scenes"] = scenes;
1550 
1551     //
1552     // Run Ascent
1553     //
1554 
1555     Ascent ascent;
1556 
1557     Node ascent_opts;
1558     ascent_opts["runtime/type"] = "ascent";
1559     ascent_opts["runtime/backend"] = "openmp";
1560     ascent.open(ascent_opts);
1561     ascent.publish(data);
1562     ascent.execute(actions);
1563     ascent.close();
1564 
1565     // check that we created an image
1566     EXPECT_TRUE(check_test_image(output_file));
1567 }
1568 
1569 
1570 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_3d_render_ascent_runtime_cuda_backend)1571 TEST(ascent_render_3d, test_3d_render_ascent_runtime_cuda_backend)
1572 {
1573 
1574     Node n;
1575     ascent::about(n);
1576     // only run this test if ascent was built with vtkm support
1577     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1578     {
1579         ASCENT_INFO("Ascent support disabled, skipping 3D Ascent-cuda test");
1580         return;
1581     }
1582 
1583     if(n["runtimes/ascent/vtkm/backends/cuda"].as_string() != "enabled")
1584     {
1585         ASCENT_INFO("Ascent CUDA support disabled, skipping 3D Ascent-cuda test");
1586         return;
1587     }
1588 
1589     ASCENT_INFO("Testing 3D Rendering with Ascent runtime  using CUDA Backend");
1590 
1591     //
1592     // Create an example mesh.
1593     //
1594     Node data, verify_info;
1595     conduit::blueprint::mesh::examples::braid("hexs",
1596                                               EXAMPLE_MESH_SIDE_DIM,
1597                                               EXAMPLE_MESH_SIDE_DIM,
1598                                               EXAMPLE_MESH_SIDE_DIM,
1599                                               data);
1600 
1601     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1602 
1603 
1604 
1605     string output_path = prepare_output_dir();
1606     string output_file = conduit::utils::join_file_path(output_path, "tout_render_3d_vtkm_cuda_backend");
1607 
1608     // remove old images before rendering
1609     remove_test_image(output_file);
1610 
1611     //
1612     // Create the actions.
1613     //
1614 
1615     conduit::Node scenes;
1616     scenes["s1/plots/p1/type"]         = "pseudocolor";
1617     scenes["s1/plots/p1/field"] = "braid";
1618     scenes["s1/image_prefix"] = output_file;
1619 
1620     conduit::Node actions;
1621     conduit::Node &add_plots = actions.append();
1622     add_plots["action"] = "add_scenes";
1623     add_plots["scenes"] = scenes;
1624 
1625     //
1626     // Run Ascent
1627     //
1628 
1629     Ascent ascent;
1630 
1631     Node ascent_opts;
1632     ascent_opts["runtime/type"] = "ascent";
1633     ascent_opts["runtime/backend"] = "cuda";
1634     ascent.open(ascent_opts);
1635     ascent.publish(data);
1636     ascent.execute(actions);
1637     ascent.close();
1638 
1639     // check that we created an image
1640     EXPECT_TRUE(check_test_image(output_file));
1641 }
1642 
1643 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_multi_render)1644 TEST(ascent_render_3d, test_render_3d_multi_render)
1645 {
1646     // the ascent runtime is currently our only rendering runtime
1647     Node n;
1648     ascent::about(n);
1649     // only run this test if ascent was built with vtkm support
1650     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1651     {
1652         ASCENT_INFO("Ascent support disabled, skipping 3D default"
1653                       "Pipeline test");
1654 
1655         return;
1656     }
1657 
1658 
1659     //
1660     // Create an example mesh.
1661     //
1662     Node data, verify_info;
1663     conduit::blueprint::mesh::examples::braid("uniform",
1664                                               EXAMPLE_MESH_SIDE_DIM,
1665                                               EXAMPLE_MESH_SIDE_DIM,
1666                                               EXAMPLE_MESH_SIDE_DIM,
1667                                               data);
1668 
1669     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1670 
1671 
1672     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
1673 
1674     string output_path = prepare_output_dir();
1675     string image_prefix0 = "render_0";
1676     string output_file = conduit::utils::join_file_path(output_path,image_prefix0);
1677 
1678     // remove old images before rendering
1679     remove_test_image(output_file);
1680 
1681     string image_prefix1 = "render_1";
1682     string output_file1 = conduit::utils::join_file_path(output_path,image_prefix1);
1683 
1684     // remove old images before rendering
1685     remove_test_image(output_file1);
1686 
1687 
1688     //
1689     // Create the actions.
1690     //
1691 
1692     conduit::Node control_points;
1693     conduit::Node &point1 = control_points.append();
1694     point1["type"] = "rgb";
1695     point1["position"] = 0.;
1696     double color[3] = {1., 0., 0.};
1697     point1["color"].set_float64_ptr(color, 3);
1698 
1699     conduit::Node &point2 = control_points.append();
1700     point2["type"] = "rgb";
1701     point2["position"] = 0.5;
1702     color[0] = 0;
1703     color[1] = 1.;
1704     point2["color"].set_float64_ptr(color, 3);
1705 
1706     conduit::Node &point3 = control_points.append();
1707     point3["type"] = "rgb";
1708     point3["position"] = 1.0;
1709     color[0] = 1.;
1710     color[1] = 1.;
1711     color[2] = 1.;
1712     point3["color"].set_float64_ptr(color, 3);
1713 
1714     conduit::Node &point4 = control_points.append();
1715     point4["type"] = "alpha";
1716     point4["position"] = 0.;
1717     point4["alpha"] = 0.;
1718 
1719     conduit::Node &point5 = control_points.append();
1720     point5["type"] = "alpha";
1721     point5["position"] = 1.0;
1722     point5["alpha"] = 1.;
1723 
1724     conduit::Node scenes;
1725     scenes["s1/plots/p1/type"]  = "volume";
1726     scenes["s1/plots/p1/field"] = "braid";
1727     scenes["s1/plots/p1/color_table/name"] = "blue";
1728     scenes["s1/plots/p1/color_table/control_points"] = control_points;
1729 
1730     scenes["s1/image_prefix"] = output_file;
1731 
1732     scenes["s1/renders/r1/image_width"]  = 512;
1733     scenes["s1/renders/r1/image_height"] = 512;
1734     scenes["s1/renders/r1/image_prefix"]   = output_file;
1735 
1736     //
1737     scenes["s1/renders/r2/image_width"]  = 400;
1738     scenes["s1/renders/r2/image_height"] = 400;
1739     scenes["s1/renders/r2/image_prefix"]   = output_file1;
1740     double vec3[3];
1741     vec3[0] = 1.; vec3[1] = 1.; vec3[2] = 1.;
1742     scenes["s1/renders/r2/camera/look_at"].set_float64_ptr(vec3,3);
1743     vec3[0] = 0.; vec3[1] = 25.; vec3[2] = 15.;
1744     scenes["s1/renders/r2/camera/position"].set_float64_ptr(vec3,3);
1745     vec3[0] = 0.; vec3[1] = -1.; vec3[2] = 0.;
1746     scenes["s1/renders/r2/camera/up"].set_float64_ptr(vec3,3);
1747     scenes["s1/renders/r2/camera/fov"] = 60.;
1748     scenes["s1/renders/r2/camera/xpan"] = 0.;
1749     scenes["s1/renders/r2/camera/ypan"] = 0.;
1750     scenes["s1/renders/r2/camera/zoom"] = 1.0;
1751     scenes["s1/renders/r2/camera/azimuth"] = 10.0;
1752     scenes["s1/renders/r2/camera/elevation"] = -10.0;
1753     scenes["s1/renders/r2/camera/near_plane"] = 0.1;
1754     scenes["s1/renders/r2/camera/far_plane"] = 100.1;
1755 
1756 
1757     conduit::Node actions;
1758     conduit::Node &add_plots = actions.append();
1759     add_plots["action"] = "add_scenes";
1760     add_plots["scenes"] = scenes;
1761 
1762     //
1763     // Run Ascent
1764     //
1765 
1766     Ascent ascent;
1767 
1768     Node ascent_opts;
1769     ascent_opts["runtime/type"] = "ascent";
1770     ascent.open(ascent_opts);
1771     ascent.publish(data);
1772     ascent.execute(actions);
1773     ascent.close();
1774 
1775     // check that we created an image
1776     EXPECT_TRUE(check_test_image(output_file));
1777     std::string msg = "An example of creating a render, specifying all camera parameters.";
1778     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
1779     // check that we created an image
1780     EXPECT_TRUE(check_test_image(output_file1, 0.01f));
1781 }
1782 
1783 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_milk_chocolate)1784 TEST(ascent_render_3d, test_render_3d_milk_chocolate)
1785 {
1786     // the ascent runtime is currently our only rendering runtime
1787     Node n;
1788     ascent::about(n);
1789     // only run this test if ascent was built with vtkm support
1790     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1791     {
1792         ASCENT_INFO("Ascent support disabled, skipping 3D default"
1793                       "Pipeline test");
1794 
1795         return;
1796     }
1797 
1798     //
1799     // Create an example mesh.
1800     //
1801     Node data, verify_info;
1802     conduit::blueprint::mesh::examples::braid("uniform",
1803                                               EXAMPLE_MESH_SIDE_DIM,
1804                                               EXAMPLE_MESH_SIDE_DIM,
1805                                               EXAMPLE_MESH_SIDE_DIM,
1806                                               data);
1807 
1808     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1809 
1810 
1811     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
1812 
1813     string output_path = prepare_output_dir();
1814     string image_prefix0 = "milk_chocolate";
1815     string output_file = conduit::utils::join_file_path(output_path,image_prefix0);
1816 
1817     // remove old images before rendering
1818     remove_test_image(output_file);
1819 
1820     //
1821     // Create the actions.
1822     //
1823 
1824     conduit::Node control_points;
1825     conduit::Node &point1 = control_points.append();
1826     point1["type"] = "rgb";
1827     point1["position"] = 0.;
1828     double color[3] = {.23, 0.08, 0.08};
1829     point1["color"].set_float64_ptr(color, 3);
1830 
1831     conduit::Node &point2 = control_points.append();
1832     point2["type"] = "rgb";
1833     point2["position"] = .5;
1834     color[0] = .48;
1835     color[1] = .23;
1836     color[2] = .04;
1837     point2["color"].set_float64_ptr(color, 3);
1838 
1839     conduit::Node &point3 = control_points.append();
1840     point3["type"] = "rgb";
1841     point3["position"] = 1.0;
1842     color[0] = .99;
1843     color[1] = 1.;
1844     color[2] = .96;
1845     point3["color"].set_float64_ptr(color, 3);
1846 
1847     conduit::Node scenes;
1848     scenes["s1/plots/p1/type"]  = "pseudocolor";
1849     scenes["s1/plots/p1/field"] = "braid";
1850     scenes["s1/plots/p1/color_table/control_points"] = control_points;
1851 
1852     scenes["s1/image_prefix"] = output_file;
1853 
1854     scenes["s1/renders/r1/image_width"]  = 512;
1855     scenes["s1/renders/r1/image_height"] = 512;
1856     scenes["s1/renders/r1/image_prefix"]   = output_file;
1857 
1858     conduit::Node actions;
1859     conduit::Node &add_plots = actions.append();
1860     add_plots["action"] = "add_scenes";
1861     add_plots["scenes"] = scenes;
1862 
1863     //
1864     // Run Ascent
1865     //
1866 
1867     Ascent ascent;
1868 
1869     Node ascent_opts;
1870     ascent_opts["runtime/type"] = "ascent";
1871     ascent.open(ascent_opts);
1872     ascent.publish(data);
1873     ascent.execute(actions);
1874     ascent.close();
1875 
1876     // check that we created an image
1877     EXPECT_TRUE(check_test_image(output_file));
1878     std::string msg = "An example of creating a custom color map.";
1879     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
1880 }
1881 
1882 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_disable_color_bar)1883 TEST(ascent_render_3d, test_render_3d_disable_color_bar)
1884 {
1885     // the ascent runtime is currently our only rendering runtime
1886     Node n;
1887     ascent::about(n);
1888     // only run this test if ascent was built with vtkm support
1889     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1890     {
1891         ASCENT_INFO("Ascent support disabled, skipping 3D default"
1892                       "Pipeline test");
1893 
1894         return;
1895     }
1896 
1897     //
1898     // Create an example mesh.
1899     //
1900     Node data, verify_info;
1901     conduit::blueprint::mesh::examples::braid("uniform",
1902                                               EXAMPLE_MESH_SIDE_DIM,
1903                                               EXAMPLE_MESH_SIDE_DIM,
1904                                               EXAMPLE_MESH_SIDE_DIM,
1905                                               data);
1906 
1907     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1908 
1909 
1910     ASCENT_INFO("Testing 3D Rendering with Default Pipeline");
1911 
1912     string output_path = prepare_output_dir();
1913     string image_prefix0 = "no_color_bar";
1914     string output_file = conduit::utils::join_file_path(output_path,image_prefix0);
1915 
1916     // remove old images before rendering
1917     remove_test_image(output_file);
1918 
1919     //
1920     // Create the actions.
1921     //
1922 
1923     conduit::Node scenes;
1924     scenes["s1/plots/p1/type"]  = "pseudocolor";
1925     scenes["s1/plots/p1/field"] = "braid";
1926     scenes["s1/plots/p1/color_table/annotation"] = "false";
1927 
1928     scenes["s1/image_prefix"] = output_file;
1929 
1930     scenes["s1/renders/r1/image_width"]  = 512;
1931     scenes["s1/renders/r1/image_height"] = 512;
1932     scenes["s1/renders/r1/image_prefix"]   = output_file;
1933 
1934     conduit::Node actions;
1935     conduit::Node &add_plots = actions.append();
1936     add_plots["action"] = "add_scenes";
1937     add_plots["scenes"] = scenes;
1938 
1939     //
1940     // Run Ascent
1941     //
1942 
1943     Ascent ascent;
1944 
1945     Node ascent_opts;
1946     ascent_opts["runtime/type"] = "ascent";
1947     ascent.open(ascent_opts);
1948     ascent.publish(data);
1949     ascent.execute(actions);
1950     ascent.close();
1951 
1952     // check that we created an image
1953     EXPECT_TRUE(check_test_image(output_file));
1954     std::string msg = "An example of disabling a color table.";
1955     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
1956 }
1957 
1958 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,render_3d_domain_overload)1959 TEST(ascent_render_3d, render_3d_domain_overload)
1960 {
1961     // the ascent runtime is currently our only rendering runtime
1962     Node n;
1963     ascent::about(n);
1964     // only run this test if ascent was built with ascent support
1965     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
1966     {
1967         ASCENT_INFO("Ascent support disabled, skipping 3D MPI "
1968                       "Runtime test");
1969 
1970         return;
1971     }
1972 
1973 
1974     Node multi_dom;
1975     Node &mesh1 = multi_dom.append();
1976     Node &mesh2 = multi_dom.append();
1977     //
1978     // Create the data.
1979     //
1980     Node verify_info;
1981     create_3d_example_dataset(mesh1,32,0,2);
1982     create_3d_example_dataset(mesh2,32,1,2);
1983 
1984     mesh1["state/domain_id"] = 0;
1985     mesh2["state/domain_id"] = 1;
1986 
1987     // There is a bug in conduit blueprint related to rectilinear
1988     // reenable this check after updating conduit
1989     // EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
1990     conduit::blueprint::mesh::verify(multi_dom,verify_info);
1991 
1992     // make sure the _output dir exists
1993     string output_path = "";
1994     output_path = prepare_output_dir();
1995     string output_file = conduit::utils::join_file_path(output_path,"tout_render_3d_domain_overload");
1996 
1997     // remove old images before rendering
1998     remove_test_image(output_file);
1999 
2000     //
2001     // Create the actions.
2002     //
2003 
2004     conduit::Node scenes;
2005     scenes["s1/plots/p1/type"]  = "pseudocolor";
2006     scenes["s1/plots/p1/field"] = "rank_ele";
2007     scenes["s1/renders/r1/image_width"]  = 512;
2008     scenes["s1/renders/r1/image_height"] = 512;
2009     scenes["s1/renders/r1/image_prefix"]   = output_file;
2010     scenes["s1/renders/r1/camera/azimuth"] = 45.0;
2011 
2012     conduit::Node actions;
2013     conduit::Node &add_plots = actions.append();
2014     add_plots["action"] = "add_scenes";
2015     add_plots["scenes"] = scenes;
2016 
2017     //
2018     // Run Ascent
2019     //
2020 
2021     Ascent ascent;
2022 
2023     Node ascent_opts;
2024     ascent_opts["runtime"] = "ascent";
2025     ascent.open(ascent_opts);
2026     ascent.publish(multi_dom);
2027     ascent.execute(actions);
2028     ascent.close();
2029     // check that we created an image
2030     EXPECT_TRUE(check_test_image(output_file));
2031     std::string msg = "An example of creating a render specifying the image size.";
2032     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
2033 }
2034 
2035 
2036 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,render_3d_empty_data)2037 TEST(ascent_render_3d, render_3d_empty_data)
2038 {
2039     // the ascent runtime is currently our only rendering runtime
2040     Node n;
2041     ascent::about(n);
2042     // only run this test if ascent was built with ascent support
2043     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
2044     {
2045         ASCENT_INFO("Ascent support disabled, skipping 3D MPI "
2046                       "Runtime test");
2047 
2048         return;
2049     }
2050 
2051     //
2052     // Create the actions.
2053     //
2054 
2055     conduit::Node scenes;
2056     scenes["s1/plots/p1/type"]  = "pseudocolor";
2057     scenes["s1/plots/p1/field"] = "rank_ele";
2058 
2059     conduit::Node actions;
2060     conduit::Node &add_plots = actions.append();
2061     add_plots["action"] = "add_scenes";
2062     add_plots["scenes"] = scenes;
2063 
2064 
2065     //
2066     // Run Ascent
2067     //
2068 
2069     Ascent ascent;
2070 
2071     Node data; // empty!
2072     Node ascent_opts;
2073     ascent_opts["runtime"] = "ascent";
2074     ascent_opts["exceptions"] = "forward";
2075     ascent.open(ascent_opts);
2076     ascent.publish(data);
2077     // we expect ascent to complain about no data
2078     EXPECT_THROW(ascent.execute(actions),conduit::Error);
2079     ascent.close();
2080 }
2081 
2082 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_supported_field_dtypes)2083 TEST(ascent_render_3d, test_render_3d_supported_field_dtypes)
2084 {
2085     // the ascent runtime is currently our only rendering runtime
2086     Node n;
2087     ascent::about(n);
2088     // only run this test if ascent was built with vtkm support
2089     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
2090     {
2091         ASCENT_INFO("Ascent support disabled, skipping 3D default"
2092                       "Pipeline test");
2093 
2094         return;
2095     }
2096 
2097 
2098     //
2099     // Create an example mesh.
2100     //
2101     Node data, verify_info;
2102     conduit::blueprint::mesh::examples::braid("hexs",
2103                                               3,
2104                                               3,
2105                                               3,
2106                                               data);
2107     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
2108 
2109     ASCENT_INFO("Testing 3D Rendering of fields with different data types");
2110 
2111     int num_vals = data["fields/braid/values"].dtype().number_of_elements();
2112     //
2113     // Create the actions.
2114     //
2115 
2116     conduit::Node actions;
2117     conduit::Node &add_plots = actions.append();
2118     add_plots["action"] = "add_scenes";
2119     conduit::Node &scenes = add_plots["scenes"];
2120     scenes["s1/plots/p1/type"]  = "pseudocolor";
2121     scenes["s1/plots/p1/field"] = "braid";
2122 
2123     Ascent ascent;
2124 
2125     Node ascent_opts;
2126     ascent_opts["runtime/type"] = "ascent";
2127     ascent.open(ascent_opts);
2128     string output_path = prepare_output_dir();
2129 
2130 
2131     // ints
2132 
2133     // int 8
2134     {
2135         string output_file = conduit::utils::join_file_path(output_path,
2136                                         "tout_render_3d_braid_int8");
2137         // remove old images before rendering
2138         remove_test_image(output_file);
2139 
2140         data["fields/braid/values"].set(DataType::int8(num_vals));
2141         int8_array varray = data["fields/braid/values"].value();
2142         for(int i=0; i<num_vals; i++)
2143         {
2144             varray[i] = i;
2145         }
2146 
2147         ascent.publish(data);
2148         scenes["s1/image_prefix"] = output_file;
2149         ascent.execute(actions);
2150         // check that we created an image
2151         EXPECT_TRUE(check_test_image(output_file));
2152     }
2153     // int 16
2154     {
2155         string output_file = conduit::utils::join_file_path(output_path,
2156                                         "tout_render_3d_braid_int16");
2157         // remove old images before rendering
2158         remove_test_image(output_file);
2159         data["fields/braid/values"].set(DataType::int16(num_vals));
2160         int16_array varray = data["fields/braid/values"].value();
2161         for(int i=0; i<num_vals; i++)
2162         {
2163             varray[i] = i;
2164         }
2165         ascent.publish(data);
2166         scenes["s1/image_prefix"] = output_file;
2167         ascent.execute(actions);
2168         // check that we created an image
2169         EXPECT_TRUE(check_test_image(output_file));
2170     }
2171 
2172     // int 32
2173     {
2174         string output_file = conduit::utils::join_file_path(output_path,
2175                                         "tout_render_3d_braid_int32");
2176         // remove old images before rendering
2177         remove_test_image(output_file);
2178 
2179         data["fields/braid/values"].set(DataType::int32(num_vals));
2180         int32_array varray = data["fields/braid/values"].value();
2181         for(int i=0; i<num_vals; i++)
2182         {
2183             varray[i] = i;
2184         }
2185 
2186         ascent.publish(data);
2187         scenes["s1/image_prefix"] = output_file;
2188         ascent.execute(actions);
2189         // check that we created an image
2190         EXPECT_TRUE(check_test_image(output_file));
2191     }
2192     // int 64
2193     {
2194         string output_file = conduit::utils::join_file_path(output_path,
2195                                         "tout_render_3d_braid_int64");
2196         // remove old images before rendering
2197         remove_test_image(output_file);
2198         data["fields/braid/values"].set(DataType::int64(num_vals));
2199         int64_array varray = data["fields/braid/values"].value();
2200         for(int i=0; i<num_vals; i++)
2201         {
2202             varray[i] = i;
2203         }
2204         ascent.publish(data);
2205         scenes["s1/image_prefix"] = output_file;
2206         ascent.execute(actions);
2207         // check that we created an image
2208         EXPECT_TRUE(check_test_image(output_file));
2209     }
2210 
2211 
2212     // uints
2213 
2214     // uint 8
2215     {
2216         string output_file = conduit::utils::join_file_path(output_path,
2217                                         "tout_render_3d_braid_uint8");
2218         // remove old images before rendering
2219         remove_test_image(output_file);
2220 
2221         data["fields/braid/values"].set(DataType::uint8(num_vals));
2222         uint8_array varray = data["fields/braid/values"].value();
2223         for(int i=0; i<num_vals; i++)
2224         {
2225             varray[i] = i;
2226         }
2227 
2228         ascent.publish(data);
2229         scenes["s1/image_prefix"] = output_file;
2230         ascent.execute(actions);
2231         // check that we created an image
2232         EXPECT_TRUE(check_test_image(output_file));
2233     }
2234     // uint 16
2235     {
2236         string output_file = conduit::utils::join_file_path(output_path,
2237                                         "tout_render_3d_braid_uint16");
2238         // remove old images before rendering
2239         remove_test_image(output_file);
2240         data["fields/braid/values"].set(DataType::uint16(num_vals));
2241         uint16_array varray = data["fields/braid/values"].value();
2242         for(int i=0; i<num_vals; i++)
2243         {
2244             varray[i] = i;
2245         }
2246         ascent.publish(data);
2247         scenes["s1/image_prefix"] = output_file;
2248         ascent.execute(actions);
2249         // check that we created an image
2250         EXPECT_TRUE(check_test_image(output_file));
2251     }
2252 
2253     // uint 32
2254     {
2255         string output_file = conduit::utils::join_file_path(output_path,
2256                                         "tout_render_3d_braid_uint32");
2257         // remove old images before rendering
2258         remove_test_image(output_file);
2259 
2260         data["fields/braid/values"].set(DataType::uint32(num_vals));
2261         uint32_array varray = data["fields/braid/values"].value();
2262         for(int i=0; i<num_vals; i++)
2263         {
2264             varray[i] = i;
2265         }
2266 
2267         ascent.publish(data);
2268         scenes["s1/image_prefix"] = output_file;
2269         ascent.execute(actions);
2270         // check that we created an image
2271         EXPECT_TRUE(check_test_image(output_file));
2272     }
2273     // uint 64
2274     {
2275         string output_file = conduit::utils::join_file_path(output_path,
2276                                         "tout_render_3d_braid_uint64");
2277         // remove old images before rendering
2278         remove_test_image(output_file);
2279         data["fields/braid/values"].set(DataType::uint64(num_vals));
2280         uint64_array varray = data["fields/braid/values"].value();
2281         for(int i=0; i<num_vals; i++)
2282         {
2283             varray[i] = i;
2284         }
2285         ascent.publish(data);
2286         scenes["s1/image_prefix"] = output_file;
2287         ascent.execute(actions);
2288         // check that we created an image
2289         EXPECT_TRUE(check_test_image(output_file));
2290     }
2291 
2292 
2293     // fp types
2294 
2295     // float 32
2296     {
2297         string output_file = conduit::utils::join_file_path(output_path,
2298                                         "tout_render_3d_braid_float32");
2299         // remove old images before rendering
2300         remove_test_image(output_file);
2301 
2302         data["fields/braid/values"].set(DataType::float32(num_vals));
2303         float32_array varray = data["fields/braid/values"].value();
2304         for(int i=0; i<num_vals; i++)
2305         {
2306             varray[i] = i;
2307         }
2308         ascent.publish(data);
2309         scenes["s1/image_prefix"] = output_file;
2310         ascent.execute(actions);
2311         // check that we created an image
2312         EXPECT_TRUE(check_test_image(output_file));
2313     }
2314 
2315     // float 64
2316     {
2317         string output_file = conduit::utils::join_file_path(output_path,
2318                                         "tout_render_3d_braid_float64");
2319         // remove old images before rendering
2320         remove_test_image(output_file);
2321 
2322         data["fields/braid/values"].set(DataType::float64(num_vals));
2323         float64_array varray = data["fields/braid/values"].value();
2324         for(int i=0; i<num_vals; i++)
2325         {
2326             varray[i] = i;
2327         }
2328         ascent.publish(data);
2329         scenes["s1/image_prefix"] = output_file;
2330         ascent.execute(actions);
2331         // check that we created an image
2332         EXPECT_TRUE(check_test_image(output_file));
2333     }
2334 
2335 
2336 
2337     ascent.close();
2338 }
2339 
2340 //-----------------------------------------------------------------------------
TEST(ascent_render_3d,test_render_3d_supported_conn_dtypes)2341 TEST(ascent_render_3d, test_render_3d_supported_conn_dtypes)
2342 {
2343     // the ascent runtime is currently our only rendering runtime
2344     Node n;
2345     ascent::about(n);
2346     // only run this test if ascent was built with vtkm support
2347     if(n["runtimes/ascent/vtkm/status"].as_string() == "disabled")
2348     {
2349         ASCENT_INFO("Ascent support disabled, skipping 3D default"
2350                       "Pipeline test");
2351 
2352         return;
2353     }
2354 
2355 
2356     //
2357     // Create an example mesh.
2358     //
2359     Node data, verify_info;
2360     conduit::blueprint::mesh::examples::braid("hexs",
2361                                               3,
2362                                               3,
2363                                               3,
2364                                               data);
2365 
2366     Node n_orig_coords = data["topologies/mesh/elements/connectivity"];
2367 
2368     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
2369 
2370     ASCENT_INFO("Testing 3D Rendering of fields with different data types");
2371 
2372     int num_vals = data["fields/braid/values"].dtype().number_of_elements();
2373     //
2374     // Create the actions.
2375     //
2376 
2377     conduit::Node actions;
2378     conduit::Node &add_plots = actions.append();
2379     add_plots["action"] = "add_scenes";
2380     conduit::Node &scenes = add_plots["scenes"];
2381     scenes["s1/plots/p1/type"]  = "pseudocolor";
2382     scenes["s1/plots/p1/field"] = "braid";
2383 
2384     Ascent ascent;
2385 
2386     Node ascent_opts;
2387     ascent_opts["runtime/type"] = "ascent";
2388     ascent.open(ascent_opts);
2389     string output_path = prepare_output_dir();
2390 
2391 
2392     // ints
2393 
2394     // int 8
2395     {
2396         string output_file = conduit::utils::join_file_path(output_path,
2397                                         "tout_render_3d_braid_int8_conn");
2398         // remove old images before rendering
2399         remove_test_image(output_file);
2400 
2401         n_orig_coords.to_int8_array(data["topologies/mesh/elements/connectivity"]);
2402         ascent.publish(data);
2403         scenes["s1/image_prefix"] = output_file;
2404         ascent.execute(actions);
2405         // check that we created an image
2406         EXPECT_TRUE(check_test_image(output_file));
2407     }
2408     // int 16
2409     {
2410         string output_file = conduit::utils::join_file_path(output_path,
2411                                         "tout_render_3d_braid_int16_conn");
2412         // remove old images before rendering
2413         remove_test_image(output_file);
2414         n_orig_coords.to_int16_array(data["topologies/mesh/elements/connectivity"]);
2415         ascent.publish(data);
2416         scenes["s1/image_prefix"] = output_file;
2417         ascent.execute(actions);
2418         // check that we created an image
2419         EXPECT_TRUE(check_test_image(output_file));
2420     }
2421 
2422     // int 32
2423     {
2424         string output_file = conduit::utils::join_file_path(output_path,
2425                                         "tout_render_3d_braid_int32_conn");
2426         // remove old images before rendering
2427         remove_test_image(output_file);
2428         n_orig_coords.to_int32_array(data["topologies/mesh/elements/connectivity"]);
2429         ascent.publish(data);
2430         scenes["s1/image_prefix"] = output_file;
2431         ascent.execute(actions);
2432         // check that we created an image
2433         EXPECT_TRUE(check_test_image(output_file));
2434     }
2435     // int 64
2436     {
2437         string output_file = conduit::utils::join_file_path(output_path,
2438                                         "tout_render_3d_braid_int64_conn");
2439         // remove old images before rendering
2440         remove_test_image(output_file);
2441         n_orig_coords.to_int64_array(data["topologies/mesh/elements/connectivity"]);
2442         ascent.publish(data);
2443         scenes["s1/image_prefix"] = output_file;
2444         ascent.execute(actions);
2445         // check that we created an image
2446         EXPECT_TRUE(check_test_image(output_file));
2447     }
2448 
2449 
2450     // uints
2451 
2452     // uint 8
2453     {
2454         string output_file = conduit::utils::join_file_path(output_path,
2455                                         "tout_render_3d_braid_uint8_conn");
2456         // remove old images before rendering
2457         remove_test_image(output_file);
2458 
2459         n_orig_coords.to_uint8_array(data["topologies/mesh/elements/connectivity"]);
2460 
2461         ascent.publish(data);
2462         scenes["s1/image_prefix"] = output_file;
2463         ascent.execute(actions);
2464         // check that we created an image
2465         EXPECT_TRUE(check_test_image(output_file));
2466     }
2467     // uint 16
2468     {
2469         string output_file = conduit::utils::join_file_path(output_path,
2470                                         "tout_render_3d_braid_uint16_conn");
2471         // remove old images before rendering
2472         remove_test_image(output_file);
2473         n_orig_coords.to_uint16_array(data["topologies/mesh/elements/connectivity"]);
2474         ascent.publish(data);
2475         scenes["s1/image_prefix"] = output_file;
2476         ascent.execute(actions);
2477         // check that we created an image
2478         EXPECT_TRUE(check_test_image(output_file));
2479     }
2480 
2481     // uint 32
2482     {
2483         string output_file = conduit::utils::join_file_path(output_path,
2484                                         "tout_render_3d_braid_uint32_conn");
2485         // remove old images before rendering
2486         remove_test_image(output_file);
2487 
2488         n_orig_coords.to_uint32_array(data["topologies/mesh/elements/connectivity"]);
2489 
2490         ascent.publish(data);
2491         scenes["s1/image_prefix"] = output_file;
2492         ascent.execute(actions);
2493         // check that we created an image
2494         EXPECT_TRUE(check_test_image(output_file));
2495     }
2496     // uint 64
2497     {
2498         string output_file = conduit::utils::join_file_path(output_path,
2499                                         "tout_render_3d_braid_uint64_conn");
2500         // remove old images before rendering
2501         remove_test_image(output_file);
2502         n_orig_coords.to_uint64_array(data["topologies/mesh/elements/connectivity"]);
2503         ascent.publish(data);
2504         scenes["s1/image_prefix"] = output_file;
2505         ascent.execute(actions);
2506         // check that we created an image
2507         EXPECT_TRUE(check_test_image(output_file));
2508     }
2509 
2510     ascent.close();
2511 }
2512 
2513 
2514 
2515 //-----------------------------------------------------------------------------
main(int argc,char * argv[])2516 int main(int argc, char* argv[])
2517 {
2518     int result = 0;
2519 
2520     ::testing::InitGoogleTest(&argc, argv);
2521 
2522     // allow override of the data size via the command line
2523     if(argc == 2)
2524     {
2525         EXAMPLE_MESH_SIDE_DIM = atoi(argv[1]);
2526     }
2527 
2528     result = RUN_ALL_TESTS();
2529     return result;
2530 }
2531 
2532 
2533