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_slice.cpp
10 ///
11 //-----------------------------------------------------------------------------
12 
13 
14 #include "gtest/gtest.h"
15 
16 #include <ascent.hpp>
17 #include <ascent_hola.hpp>
18 
19 #include <iostream>
20 #include <math.h>
21 
22 #include <conduit_blueprint.hpp>
23 
24 #include "t_config.hpp"
25 #include "t_utils.hpp"
26 
27 
28 using namespace std;
29 using namespace conduit;
30 using namespace ascent;
31 
32 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_pseudocolor_cinema)33 TEST(ascent_devil_ray, test_pseudocolor_cinema)
34 {   Node n;
35     ascent::about(n);
36 
37     //
38     // Create an example mesh.
39     //
40     Node data, hola_opts, verify_info;
41     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
42     ascent::hola("relay/blueprint/mesh", hola_opts, data);
43     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
44 
45     ASCENT_INFO("Testing Devil Ray");
46 
47     std::string db_name = "pseudo_taylor";
48     string output_path = "./cinema_databases/" + db_name;
49     string output_file = conduit::utils::join_file_path(output_path, "info.json");
50     // remove old file before rendering
51     if(conduit::utils::is_file(output_file))
52     {
53         conduit::utils::remove_file(output_file);
54     }
55 
56     //
57     // Create the actions.
58     //
59 
60     conduit::Node extracts;
61     extracts["e1/type"] = "dray_pseudocolor";
62     // filter knobs
63     conduit::Node &params = extracts["e1/params/"];
64     params["field"] = "density";
65     params["min_value"] = 0.99;
66     params["max_value"] = 1.0;
67     params["log_scale"] = "false";
68     params["camera/type"] = "cinema";
69     params["camera/db_name"] = db_name;
70     params["camera/phi"] = 5;
71     params["camera/theta"] = 5;
72 
73     params["draw_mesh"] = "true";
74     params["line_thickness"] = 0.1;
75     float line_color[4] = {0.f, 0.f, 0.f, 1.0f};
76     params["line_color"].set(line_color, 4);;
77 
78     conduit::Node actions;
79     // add the extracts
80     conduit::Node &add_extracts = actions.append();
81     add_extracts["action"] = "add_extracts";
82     add_extracts["extracts"] = extracts;
83 
84     //
85     // Run Ascent
86     //
87 
88     Ascent ascent;
89 
90     Node ascent_opts;
91     ascent_opts["runtime/type"] = "ascent";
92     ascent.open(ascent_opts);
93     ascent.publish(data);
94     ascent.execute(actions);
95     ascent.close();
96 
97     // check that we created an image
98     EXPECT_TRUE(conduit::utils::is_file(output_file));
99     std::string msg = "An example of creating a cinema database "
100                       "using devil ray pseudocolor plots.";
101     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
102 }
103 
104 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_pseudocolor)105 TEST(ascent_devil_ray, test_pseudocolor)
106 {   Node n;
107     ascent::about(n);
108 
109     //
110     // Create an example mesh.
111     //
112     Node data, hola_opts, verify_info;
113     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
114     ascent::hola("relay/blueprint/mesh", hola_opts, data);
115     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
116 
117     ASCENT_INFO("Testing Devil Ray");
118 
119     string output_path = prepare_output_dir();
120     string output_file = conduit::utils::join_file_path(output_path,"tout_dray_surface");
121 
122     // remove old images before rendering
123     remove_test_image(output_file);
124 
125     //
126     // Create the actions.
127     //
128 
129     conduit::Node extracts;
130     extracts["e1/type"] = "dray_pseudocolor";
131     // filter knobs
132     conduit::Node &params = extracts["e1/params/"];
133     params["field"] = "density";
134     params["min_value"] = 0.99;
135     params["max_value"] = 1.0;
136     params["log_scale"] = "false";
137     params["image_prefix"] = output_file;
138     params["camera/azimuth"] = -30;
139     params["camera/elevation"] = 35;
140 
141     params["draw_mesh"] = "true";
142     params["line_thickness"] = 0.1;
143     float line_color[4] = {0.f, 0.f, 0.f, 1.0f};
144     params["line_color"].set(line_color, 4);;
145 
146     conduit::Node actions;
147     // add the extracts
148     conduit::Node &add_extracts = actions.append();
149     add_extracts["action"] = "add_extracts";
150     add_extracts["extracts"] = extracts;
151 
152     //
153     // Run Ascent
154     //
155 
156     Ascent ascent;
157 
158     Node ascent_opts;
159     ascent_opts["runtime/type"] = "ascent";
160     ascent.open(ascent_opts);
161     ascent.publish(data);
162     ascent.execute(actions);
163     ascent.close();
164 
165     // check that we created an image
166     EXPECT_TRUE(check_test_image(output_file, 0.1, "1860"));
167     std::string msg = "An example of using devil ray for pseudocolor plot.";
168     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
169 }
170 
171 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_pseudocolor_noannots)172 TEST(ascent_devil_ray, test_pseudocolor_noannots)
173 {   Node n;
174     ascent::about(n);
175 
176     //
177     // Create an example mesh.
178     //
179     Node data, hola_opts, verify_info;
180     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
181     ascent::hola("relay/blueprint/mesh", hola_opts, data);
182     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
183 
184     ASCENT_INFO("Testing Devil Ray");
185 
186     string output_path = prepare_output_dir();
187     string output_file = conduit::utils::join_file_path(output_path,"tout_dray_noannots");
188 
189     // remove old images before rendering
190     remove_test_image(output_file);
191 
192     //
193     // Create the actions.
194     //
195 
196     conduit::Node extracts;
197     extracts["e1/type"] = "dray_pseudocolor";
198 
199     // filter knobs
200     conduit::Node &params = extracts["e1/params/"];
201     params["field"] = "density";
202     params["min_value"] = 0.99;
203     params["max_value"] = 1.0;
204     params["annotations"] = "false";
205     params["log_scale"] = "false";
206     params["image_prefix"] = output_file;
207     params["camera/azimuth"] = -30;
208     params["camera/elevation"] = 35;
209 
210     params["draw_mesh"] = "true";
211     params["line_thickness"] = 0.1;
212     float line_color[4] = {0.f, 0.f, 0.f, 1.0f};
213     params["line_color"].set(line_color, 4);;
214 
215     conduit::Node actions;
216     // add the extracts
217     conduit::Node &add_extracts = actions.append();
218     add_extracts["action"] = "add_extracts";
219     add_extracts["extracts"] = extracts;
220 
221     //
222     // Run Ascent
223     //
224 
225     Ascent ascent;
226 
227     Node ascent_opts;
228     ascent_opts["runtime/type"] = "ascent";
229     ascent.open(ascent_opts);
230     ascent.publish(data);
231     ascent.execute(actions);
232     ascent.close();
233 
234     // check that we created an image
235     EXPECT_TRUE(check_test_image(output_file, 0.1, "1860"));
236     std::string msg = "An example of using devil ray for pseudocolor plot.";
237     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
238 }
239 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_3slice)240 TEST(ascent_devil_ray, test_3slice)
241 {
242     Node n;
243     ascent::about(n);
244 
245     //
246     // Create an example mesh.
247     //
248     Node data, hola_opts, verify_info;
249     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
250     ascent::hola("relay/blueprint/mesh", hola_opts, data);
251     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
252 
253     ASCENT_INFO("Testing Devil Ray");
254 
255     string output_path = prepare_output_dir();
256     string output_file = conduit::utils::join_file_path(output_path,"tout_dray_3slice");
257 
258     // remove old images before rendering
259     remove_test_image(output_file);
260 
261     //
262     // Create the actions.
263     //
264 
265     conduit::Node extracts;
266     extracts["e1/type"] = "dray_3slice";
267     // filter knobs
268     conduit::Node &params = extracts["e1/params/"];
269     params["field"] = "density";
270     params["min_value"] = 0.99;
271     params["max_value"] = 1.0;
272     params["log_scale"] = "false";
273     params["image_prefix"] = output_file;
274     params["camera/azimuth"] = -30;
275     params["camera/elevation"] = 35;
276 
277     params["x_offset"] = 0.;
278     params["y_offset"] = 0.;
279     params["z_offset"] = 0.;
280 
281     conduit::Node actions;
282     // add the extracts
283     conduit::Node &add_extracts = actions.append();
284     add_extracts["action"] = "add_extracts";
285     add_extracts["extracts"] = extracts;
286 
287     //
288     // Run Ascent
289     //
290 
291     Ascent ascent;
292 
293     Node ascent_opts;
294     ascent_opts["runtime/type"] = "ascent";
295     ascent.open(ascent_opts);
296     ascent.publish(data);
297     ascent.execute(actions);
298     ascent.close();
299 
300     // check that we created an image
301     EXPECT_TRUE(check_test_image(output_file, 0.1, "1860"));
302     std::string msg = "An example of using devil ray for pseudocolor plot.";
303     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
304 }
305 
306 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_3slice_cinema_no_sweep)307 TEST(ascent_devil_ray, test_3slice_cinema_no_sweep)
308 {
309     Node n;
310     ascent::about(n);
311 
312     //
313     // Create an example mesh.
314     //
315     Node data, hola_opts, verify_info;
316     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
317     ascent::hola("relay/blueprint/mesh", hola_opts, data);
318     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
319 
320     ASCENT_INFO("Testing Devil Ray");
321 
322     std::string db_name = "pseudo_3slice";
323     string output_path = "./cinema_databases/" + db_name;
324     string output_file = conduit::utils::join_file_path(output_path, "info.json");
325     // remove old file before rendering
326     if(conduit::utils::is_file(output_file))
327     {
328         conduit::utils::remove_file(output_file);
329     }
330 
331     //
332     // Create the actions.
333     //
334 
335     conduit::Node extracts;
336     extracts["e1/type"] = "dray_3slice";
337     // filter knobs
338     conduit::Node &params = extracts["e1/params/"];
339     params["field"] = "density";
340     params["min_value"] = 0.99;
341     params["max_value"] = 1.0;
342     params["log_scale"] = "false";
343 
344     params["camera/type"] = "cinema";
345     params["camera/db_name"] = db_name;
346     params["camera/phi"] = 2;
347     params["camera/theta"] = 2;
348 
349     params["x_offset"] = 0.7;
350     params["y_offset"] = 0.2;
351     params["z_offset"] = 0.4;
352 
353     conduit::Node actions;
354     // add the extracts
355     conduit::Node &add_extracts = actions.append();
356     add_extracts["action"] = "add_extracts";
357     add_extracts["extracts"] = extracts;
358 
359     //
360     // Run Ascent
361     //
362 
363     Ascent ascent;
364 
365     Node ascent_opts;
366     ascent_opts["runtime/type"] = "ascent";
367     ascent.open(ascent_opts);
368     ascent.publish(data);
369     ascent.execute(actions);
370     ascent.close();
371 
372     // check that we created an image
373     EXPECT_TRUE(conduit::utils::is_file(output_file));
374     std::string msg = "An example of creating a cinema databasev using devil "
375                       " ray for a 3 slice plot.";
376     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
377 }
378 
TEST(ascent_devil_ray,test_3slice_cinema_sweep)379 TEST(ascent_devil_ray, test_3slice_cinema_sweep)
380 {
381     Node n;
382     ascent::about(n);
383 
384     //
385     // Create an example mesh.
386     //
387     Node data, hola_opts, verify_info;
388     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
389     ascent::hola("relay/blueprint/mesh", hola_opts, data);
390     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
391 
392     ASCENT_INFO("Testing Devil Ray");
393 
394     std::string db_name = "pseudo_3slice_sweep";
395     string output_path = "./cinema_databases/" + db_name;
396     string output_file = conduit::utils::join_file_path(output_path, "info.json");
397     // remove old file before rendering
398     if(conduit::utils::is_file(output_file))
399     {
400         conduit::utils::remove_file(output_file);
401     }
402 
403     //
404     // Create the actions.
405     //
406 
407     conduit::Node extracts;
408     extracts["e1/type"] = "dray_3slice";
409     // filter knobs
410     conduit::Node &params = extracts["e1/params/"];
411     params["field"] = "density";
412     params["min_value"] = 0.99;
413     params["max_value"] = 1.0;
414     params["log_scale"] = "false";
415 
416     params["camera/type"] = "cinema";
417     params["camera/db_name"] = db_name;
418     params["camera/phi"] = 2;
419     params["camera/theta"] = 2;
420 
421     params["sweep/count"] = 2;
422     params["sweep/axis"] = "x";
423     params["x_offset"] = 0.7;
424     params["y_offset"] = 0.2;
425     params["z_offset"] = 0.4;
426 
427     conduit::Node actions;
428     // add the extracts
429     conduit::Node &add_extracts = actions.append();
430     add_extracts["action"] = "add_extracts";
431     add_extracts["extracts"] = extracts;
432 
433     //
434     // Run Ascent
435     //
436 
437     Ascent ascent;
438 
439     Node ascent_opts;
440     ascent_opts["runtime/type"] = "ascent";
441     ascent.open(ascent_opts);
442     ascent.publish(data);
443     ascent.execute(actions);
444     ascent.close();
445 
446     // check that we created an image
447     EXPECT_TRUE(conduit::utils::is_file(output_file));
448     std::string msg = "An example of creating a cinema databasev using devil "
449                       " ray for a 3 slice plot.";
450     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
451 }
452 
453 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_volume)454 TEST(ascent_devil_ray, test_volume)
455 {
456     Node n;
457     ascent::about(n);
458 
459     //
460     // Create an example mesh.
461     //
462     Node data, hola_opts, verify_info;
463     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
464     ascent::hola("relay/blueprint/mesh", hola_opts, data);
465     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
466 
467     ASCENT_INFO("Testing Devil Ray");
468 
469     string output_path = prepare_output_dir();
470     string output_file = conduit::utils::join_file_path(output_path,"tout_dray_volume");
471 
472     // remove old images before rendering
473     remove_test_image(output_file);
474 
475     //
476     // Create the actions.
477     //
478 
479     conduit::Node extracts;
480     extracts["e1/type"] = "dray_volume";
481     // filter knobs
482     conduit::Node &params = extracts["e1/params/"];
483     params["field"] = "density";
484     //params["min_value"] = 0.955;
485     params["min_value"] = 0.98;
486     params["max_value"] = 1.04;
487     params["log_scale"] = "false";
488     params["image_prefix"] = output_file;
489     params["camera/azimuth"] = -30;
490     params["camera/elevation"] = 35;
491 
492     params["samples"] = 100;
493 
494     conduit::Node actions;
495     // add the extracts
496     conduit::Node &add_extracts = actions.append();
497     add_extracts["action"] = "add_extracts";
498     add_extracts["extracts"] = extracts;
499 
500     //
501     // Run Ascent
502     //
503 
504     Ascent ascent;
505 
506     Node ascent_opts;
507     ascent_opts["runtime/type"] = "ascent";
508     ascent.open(ascent_opts);
509     ascent.publish(data);
510     ascent.execute(actions);
511     ascent.close();
512 
513     // check that we created an image
514     EXPECT_TRUE(check_test_image(output_file, 0.1, "1860"));
515     std::string msg = "An example of using devil ray for pseudocolor plot.";
516     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
517 }
518 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_reflect)519 TEST(ascent_devil_ray, test_reflect)
520 {
521     Node n;
522     ascent::about(n);
523 
524     //
525     // Create an example mesh.
526     //
527     Node data, hola_opts, verify_info;
528     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
529     ascent::hola("relay/blueprint/mesh", hola_opts, data);
530     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
531 
532     ASCENT_INFO("Testing Devil Ray");
533 
534     string output_path = prepare_output_dir();
535     string output_file = conduit::utils::join_file_path(output_path,"tout_reflect");
536 
537     // remove old images before rendering
538     remove_test_image(output_file);
539 
540     //
541     // Create the actions.
542     //
543 
544     conduit::Node pipelines;
545     pipelines["p1/f1/type"] = "dray_reflect";
546     // filter knobs
547     conduit::Node &rparams = pipelines["p1/f1/params/"];
548     rparams["point/x"] = 0.;
549     rparams["point/y"] = 0.;
550     rparams["point/z"] = 0.;
551     rparams["normal/x"] = 0.;
552     rparams["normal/y"] = 1.;
553     rparams["normal/z"] = 0.;
554 
555     conduit::Node extracts;
556     extracts["e1/type"] = "dray_pseudocolor";
557     extracts["e1/pipeline"] = "p1";
558     // filter knobs
559     conduit::Node &params = extracts["e1/params/"];
560     params["field"] = "density";
561     //params["min_value"] = 0.955;
562     params["min_value"] = 0.98;
563     params["max_value"] = 1.04;
564     params["log_scale"] = "false";
565     params["image_prefix"] = output_file;
566     params["camera/azimuth"] = -30;
567     params["camera/elevation"] = 35;
568 
569     conduit::Node actions;
570     // add the pipeline
571     conduit::Node &add_pipelines = actions.append();
572     add_pipelines["action"] = "add_pipelines";
573     add_pipelines["pipelines"] = pipelines;
574     // add the extracts
575     conduit::Node &add_extracts = actions.append();
576     add_extracts["action"] = "add_extracts";
577     add_extracts["extracts"] = extracts;
578 
579     //
580     // Run Ascent
581     //
582 
583     Ascent ascent;
584 
585     Node ascent_opts;
586     ascent_opts["runtime/type"] = "ascent";
587     ascent.open(ascent_opts);
588     ascent.publish(data);
589     ascent.execute(actions);
590     ascent.close();
591 
592     // check that we created an image
593     EXPECT_TRUE(check_test_image(output_file, 0.1, "1860"));
594     std::string msg = "An example of using devil ray to reflect a data set.";
595     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
596 }
597 
598 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_scalar_rendering)599 TEST(ascent_devil_ray, test_scalar_rendering)
600 {
601     Node n;
602     ascent::about(n);
603 
604     //
605     // Create an example mesh.
606     //
607     Node data, hola_opts, verify_info;
608     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
609     ascent::hola("relay/blueprint/mesh", hola_opts, data);
610     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
611 
612     ASCENT_INFO("Testing Devil Ray");
613 
614     string output_path = prepare_output_dir();
615     string output_file = conduit::utils::join_file_path(output_path,"tout_scalar_renderer");
616 
617     //
618     // Create the actions.
619     //
620 
621     conduit::Node pipelines;
622     // pipeline 1
623     pipelines["pl1/f1/type"] = "dray_project_2d";
624     // filter knobs
625     conduit::Node &params = pipelines["pl1/f1/params"];
626     params["image_width"] = 512;
627     params["image_height"] = 512;
628     params["fields"].append() = "density";
629 
630     conduit::Node extracts;
631     extracts["e1/type"]  = "relay";
632     extracts["e1/pipeline"] = "pl1";
633 
634     extracts["e1/params/path"] = output_file;
635     extracts["e1/params/protocol"] = "blueprint/mesh/hdf5";
636 
637     conduit::Node actions;
638     // add the extracts
639     conduit::Node &add_extracts = actions.append();
640     add_extracts["action"] = "add_extracts";
641     add_extracts["extracts"] = extracts;
642     // add the pipeline
643     conduit::Node &add_pipelines= actions.append();
644     add_pipelines["action"] = "add_pipelines";
645     add_pipelines["pipelines"] = pipelines;
646 
647     //
648     // Run Ascent
649     //
650     Ascent ascent;
651 
652     Node ascent_opts;
653     ascent_opts["runtime/type"] = "ascent";
654     ascent.open(ascent_opts);
655     ascent.publish(data);
656     ascent.execute(actions);
657     ascent.close();
658 
659     // check that we created an image
660     std::string msg = "An example of using devil ray scalar rendering.";
661     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
662 }
663 
664 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_scalar_rendering_plane)665 TEST(ascent_devil_ray, test_scalar_rendering_plane)
666 {
667     Node n;
668     ascent::about(n);
669 
670     //
671     // Create an example mesh.
672     //
673     Node data, hola_opts, verify_info;
674     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
675     ascent::hola("relay/blueprint/mesh", hola_opts, data);
676     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
677 
678     ASCENT_INFO("Testing Devil Ray");
679 
680     string output_path = prepare_output_dir();
681     string output_file
682       = conduit::utils::join_file_path(output_path,"tout_scalar_renderer_plane");
683 
684     //
685     // Create the actions.
686     //
687 
688     conduit::Node pipelines;
689     // pipeline 1
690     pipelines["pl1/f1/type"] = "dray_project_2d";
691     // filter knobs
692     conduit::Node &params = pipelines["pl1/f1/params"];
693     params["image_width"] = 512;
694     params["image_height"] = 512;
695 
696     double center[3] = {0.5, 0.0, -1.5};
697     double up[3] = {0., 1., 0.};
698     double normal[3] = {0., 0.25, 1.};
699     params["plane/center"].set(center,3);
700     params["plane/up"].set(up,3);
701     params["plane/normal"].set(normal,3);
702     params["plane/width"] = 1.5f;
703     params["plane/height"] = 1.5f;
704 
705     params["fields"].append() = "density";
706 
707     conduit::Node extracts;
708     extracts["e1/type"]  = "relay";
709     extracts["e1/pipeline"] = "pl1";
710 
711     extracts["e1/params/path"] = output_file;
712     extracts["e1/params/protocol"] = "blueprint/mesh/hdf5";
713 
714     conduit::Node actions;
715     // add the extracts
716     conduit::Node &add_extracts = actions.append();
717     add_extracts["action"] = "add_extracts";
718     add_extracts["extracts"] = extracts;
719     // add the pipeline
720     conduit::Node &add_pipelines= actions.append();
721     add_pipelines["action"] = "add_pipelines";
722     add_pipelines["pipelines"] = pipelines;
723 
724     //
725     // Run Ascent
726     //
727     Ascent ascent;
728 
729     Node ascent_opts;
730     ascent_opts["runtime/type"] = "ascent";
731     ascent.open(ascent_opts);
732     ascent.publish(data);
733     ascent.execute(actions);
734     ascent.close();
735 
736     // check that we created an image
737     std::string msg = "An example of using devil ray scalar rendering using a plane.";
738     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
739 }
740 
741 //-----------------------------------------------------------------------------
TEST(ascent_devil_ray,test_vector_component)742 TEST(ascent_devil_ray, test_vector_component)
743 {
744     Node n;
745     ascent::about(n);
746 
747     //
748     // Create an example mesh.
749     //
750     Node data, hola_opts, verify_info;
751     hola_opts["root_file"] = test_data_file("taylor_green.cycle_001860.root");
752     ascent::hola("relay/blueprint/mesh", hola_opts, data);
753     EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info));
754 
755     ASCENT_INFO("Testing Devil Ray");
756 
757     string output_path = prepare_output_dir();
758     string output_file = conduit::utils::join_file_path(output_path,"tout_vector_comp");
759 
760     // remove old images before rendering
761     remove_test_image(output_file);
762 
763     //
764     // Create the actions.
765     //
766 
767     conduit::Node pipelines;
768     pipelines["p1/f1/type"] = "dray_vector_component";
769     // filter knobs
770     conduit::Node &rparams = pipelines["p1/f1/params/"];
771     rparams["field"] = "velocity";
772     rparams["output_name"] = "velocity_x";
773     rparams["component"] = 0;
774 
775     conduit::Node extracts;
776     extracts["e1/type"] = "dray_pseudocolor";
777     extracts["e1/pipeline"] = "p1";
778     // filter knobs
779     conduit::Node &params = extracts["e1/params/"];
780     params["field"] = "velocity_x";
781     //params["min_value"] = 0.955;
782     params["log_scale"] = "false";
783     params["image_prefix"] = output_file;
784     params["camera/azimuth"] = -30;
785     params["camera/elevation"] = 35;
786 
787     conduit::Node actions;
788     // add the pipeline
789     conduit::Node &add_pipelines = actions.append();
790     add_pipelines["action"] = "add_pipelines";
791     add_pipelines["pipelines"] = pipelines;
792     // add the extracts
793     conduit::Node &add_extracts = actions.append();
794     add_extracts["action"] = "add_extracts";
795     add_extracts["extracts"] = extracts;
796 
797     //
798     // Run Ascent
799     //
800 
801     Ascent ascent;
802 
803     Node ascent_opts;
804     ascent_opts["runtime/type"] = "ascent";
805     ascent.open(ascent_opts);
806     ascent.publish(data);
807     ascent.execute(actions);
808     ascent.close();
809 
810     // check that we created an image
811     EXPECT_TRUE(check_test_image(output_file, 0.1, "1860"));
812     std::string msg = "An example of using devil ray extract a component of a vector.";
813     ASCENT_ACTIONS_DUMP(actions,output_file,msg);
814 }
815 //-----------------------------------------------------------------------------
main(int argc,char * argv[])816 int main(int argc, char* argv[])
817 {
818     int result = 0;
819 
820     ::testing::InitGoogleTest(&argc, argv);
821 
822     // allow override of the data size via the command line
823     result = RUN_ALL_TESTS();
824     return result;
825 }
826 
827 
828