-
Notifications
You must be signed in to change notification settings - Fork 3
/
tut_error_handling.cxx
37 lines (31 loc) · 1.1 KB
/
tut_error_handling.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <vtkm/cont/Initialize.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/io/reader/VTKDataSetReader.h>
#include <vtkm/io/writer/VTKDataSetWriter.h>
int main(int argc, char** argv)
{
auto opts = vtkm::cont::InitializeOptions::DefaultAnyDevice;
vtkm::cont::InitializeResult config = vtkm::cont::Initialize(argc, argv, opts);
try
{
vtkm::io::VTKDataSetReader reader("data/kitchen.vtk");
// PROBLEM! ... we aren't reading from a file, so we have an empty vtkm::cont::DataSet.
//vtkm::cont::DataSet ds_from_file = reader.ReadDataSet();
vtkm::cont::DataSet ds_from_file;
vtkm::filter::Contour contour;
contour.SetActiveField("c1");
contour.SetNumberOfIsoValues(3);
contour.SetIsoValue(0, 0.05);
contour.SetIsoValue(1, 0.10);
contour.SetIsoValue(2, 0.15);
vtkm::cont::DataSet ds_from_mc = contour.Execute(ds_from_file);
vtkm::io::VTKDataSetWriter writer("out_mc.vtk");
writer.WriteDataSet(ds_from_mc);
}
catch (const vtkm::cont::Error& error)
{
std::cerr << "VTK-m error occurred!: " << error.GetMessage() << std::endl;
return 1;
}
return 0;
}