2015-09-11 21:16:23 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2015-09-11 21:16:23 +00:00
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
2019-04-09 13:52:53 +00:00
|
|
|
#include <vtkm/cont/Initialize.h>
|
|
|
|
|
2021-09-08 14:54:15 +00:00
|
|
|
#include <vtkm/io/VTKDataSetReader.h>
|
2020-04-30 12:12:04 +00:00
|
|
|
#include <vtkm/io/VTKDataSetWriter.h>
|
2017-06-28 16:20:09 +00:00
|
|
|
|
2022-01-11 03:37:48 +00:00
|
|
|
#include <vtkm/filter/contour/ClipWithField.h>
|
2017-06-28 16:20:09 +00:00
|
|
|
|
2021-09-08 14:54:15 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <iostream>
|
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
int main(int argc, char* argv[])
|
2015-09-11 21:16:23 +00:00
|
|
|
{
|
2021-09-08 14:54:15 +00:00
|
|
|
vtkm::cont::Initialize(argc, argv);
|
|
|
|
|
|
|
|
if ((argc < 4) || (argc > 5))
|
|
|
|
{
|
|
|
|
std::cerr << "Usage: " << argv[0] << " in_data.vtk field_name clip_value [out_data.vtk]\n\n";
|
2023-03-02 17:47:37 +00:00
|
|
|
std::cerr << "For example, you could use the example.vtk that comes with the VTK-m source:\n\n";
|
2021-09-08 14:54:15 +00:00
|
|
|
std::cerr << " " << argv[0]
|
2023-03-02 17:47:37 +00:00
|
|
|
<< " <path-to-vtkm-source>/data/data/third_party/visit/example.vtk temp 3.5\n";
|
2021-09-08 14:54:15 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
std::string infilename = argv[1];
|
|
|
|
std::string infield = argv[2];
|
|
|
|
double fieldValue = std::atof(argv[3]);
|
|
|
|
std::string outfilename = "out_data.vtk";
|
|
|
|
if (argc == 5)
|
|
|
|
{
|
|
|
|
outfilename = argv[4];
|
|
|
|
}
|
|
|
|
|
|
|
|
vtkm::io::VTKDataSetReader reader(infilename);
|
|
|
|
vtkm::cont::DataSet input = reader.ReadDataSet();
|
2015-09-11 21:16:23 +00:00
|
|
|
|
2022-01-11 15:08:42 +00:00
|
|
|
vtkm::filter::contour::ClipWithField clipFilter;
|
2021-09-08 14:54:15 +00:00
|
|
|
clipFilter.SetActiveField(infield);
|
|
|
|
clipFilter.SetClipValue(fieldValue);
|
2019-07-31 20:38:14 +00:00
|
|
|
vtkm::cont::DataSet output = clipFilter.Execute(input);
|
2015-09-11 21:16:23 +00:00
|
|
|
|
2021-09-08 14:54:15 +00:00
|
|
|
vtkm::io::VTKDataSetWriter writer(outfilename);
|
2016-03-17 15:13:25 +00:00
|
|
|
writer.WriteDataSet(output);
|
2015-09-11 21:16:23 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|