-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding slice to the list of supported filters
- Loading branch information
Showing
6 changed files
with
310 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// | ||
// Copyright (c) 2015-2017, Lawrence Livermore National Security, LLC. | ||
// | ||
// Produced at the Lawrence Livermore National Laboratory | ||
// | ||
// LLNL-CODE-716457 | ||
// | ||
// All rights reserved. | ||
// | ||
// This file is part of Ascent. | ||
// | ||
// For details, see: http://software.llnl.gov/ascent/. | ||
// | ||
// Please also read ascent/LICENSE | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are met: | ||
// | ||
// * Redistributions of source code must retain the above copyright notice, | ||
// this list of conditions and the disclaimer below. | ||
// | ||
// * Redistributions in binary form must reproduce the above copyright notice, | ||
// this list of conditions and the disclaimer (as noted below) in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// * Neither the name of the LLNS/LLNL nor the names of its contributors may | ||
// be used to endorse or promote products derived from this software without | ||
// specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
// ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, | ||
// LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY | ||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// | ||
|
||
//----------------------------------------------------------------------------- | ||
/// | ||
/// file: t_ascent_slice.cpp | ||
/// | ||
//----------------------------------------------------------------------------- | ||
|
||
|
||
#include "gtest/gtest.h" | ||
|
||
#include <ascent.hpp> | ||
|
||
#include <iostream> | ||
#include <math.h> | ||
|
||
#include <conduit_blueprint.hpp> | ||
|
||
#include "t_config.hpp" | ||
#include "t_utils.hpp" | ||
|
||
|
||
|
||
|
||
using namespace std; | ||
using namespace conduit; | ||
using namespace ascent; | ||
|
||
|
||
index_t EXAMPLE_MESH_SIDE_DIM = 20; | ||
|
||
|
||
//----------------------------------------------------------------------------- | ||
TEST(ascent_slice, test_slice) | ||
{ | ||
// the ascent runtime is currently our only rendering runtime | ||
Node n; | ||
ascent::about(n); | ||
// only run this test if ascent was built with vtkm support | ||
if(n["runtimes/ascent/status"].as_string() == "disabled") | ||
{ | ||
ASCENT_INFO("Ascent support disabled, skipping 3D default" | ||
"Pipeline test"); | ||
|
||
return; | ||
} | ||
|
||
|
||
// | ||
// Create an example mesh. | ||
// | ||
Node data, verify_info; | ||
conduit::blueprint::mesh::examples::braid("hexs", | ||
EXAMPLE_MESH_SIDE_DIM, | ||
EXAMPLE_MESH_SIDE_DIM, | ||
EXAMPLE_MESH_SIDE_DIM, | ||
data); | ||
|
||
EXPECT_TRUE(conduit::blueprint::mesh::verify(data,verify_info)); | ||
verify_info.print(); | ||
|
||
ASCENT_INFO("Testing slice"); | ||
|
||
|
||
string output_path = prepare_output_dir(); | ||
string output_file = conduit::utils::join_file_path(output_path,"tout_slice_3d"); | ||
|
||
// remove old images before rendering | ||
remove_test_image(output_file); | ||
|
||
|
||
// | ||
// Create the actions. | ||
// | ||
|
||
conduit::Node pipelines; | ||
// pipeline 1 | ||
pipelines["pl1/f1/type"] = "slice"; | ||
// filter knobs | ||
conduit::Node &contour_params = pipelines["pl1/f1/params"]; | ||
contour_params["point/x"] = 0.f; | ||
contour_params["point/y"] = 0.f; | ||
contour_params["point/z"] = 0.f; | ||
|
||
contour_params["normal/x"] = 0.f; | ||
contour_params["normal/y"] = 0.f; | ||
contour_params["normal/z"] = 1.f; | ||
|
||
conduit::Node scenes; | ||
scenes["s1/plots/p1/type"] = "pseudocolor"; | ||
scenes["s1/plots/p1/params/field"] = "radial"; | ||
scenes["s1/plots/p1/pipeline"] = "pl1"; | ||
scenes["s1/image_prefix"] = output_file; | ||
|
||
conduit::Node actions; | ||
// add the pipeline | ||
conduit::Node &add_pipelines = actions.append(); | ||
add_pipelines["action"] = "add_pipelines"; | ||
add_pipelines["pipelines"] = pipelines; | ||
// add the scenes | ||
conduit::Node &add_scenes= actions.append(); | ||
add_scenes["action"] = "add_scenes"; | ||
add_scenes["scenes"] = scenes; | ||
// execute | ||
conduit::Node &execute = actions.append(); | ||
execute["action"] = "execute"; | ||
|
||
// | ||
// Run Ascent | ||
// | ||
|
||
Ascent ascent; | ||
|
||
Node ascent_opts; | ||
ascent_opts["runtime/type"] = "ascent"; | ||
ascent.open(ascent_opts); | ||
ascent.publish(data); | ||
ascent.execute(actions); | ||
ascent.close(); | ||
|
||
// check that we created an image | ||
EXPECT_TRUE(check_test_image(output_file)); | ||
} | ||
//----------------------------------------------------------------------------- | ||
int main(int argc, char* argv[]) | ||
{ | ||
int result = 0; | ||
|
||
::testing::InitGoogleTest(&argc, argv); | ||
|
||
// allow override of the data size via the command line | ||
if(argc == 2) | ||
{ | ||
EXAMPLE_MESH_SIDE_DIM = atoi(argv[1]); | ||
} | ||
|
||
result = RUN_ALL_TESTS(); | ||
return result; | ||
} | ||
|
||
|