mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Remove dependence of examples on testing files
The testing files (even the headers) are not available if `VTKm_ENABLE_TESTING` is off. Mostly, the testing was used to generate example data sets. Instead, change the examples to load data files.
This commit is contained in:
parent
c494963626
commit
264a8a4b6c
@ -9,24 +9,44 @@
|
||||
//============================================================================
|
||||
#include <vtkm/cont/Initialize.h>
|
||||
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
#include <vtkm/io/VTKDataSetWriter.h>
|
||||
|
||||
#include <vtkm/filter/ClipWithField.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
vtkm::cont::Initialize(argc, argv, vtkm::cont::InitializeOptions::Strict);
|
||||
vtkm::cont::Initialize(argc, argv);
|
||||
|
||||
vtkm::cont::DataSet input = vtkm::cont::testing::MakeTestDataSet().Make3DExplicitDataSetCowNose();
|
||||
if ((argc < 4) || (argc > 5))
|
||||
{
|
||||
std::cerr << "Usage: " << argv[0] << " in_data.vtk field_name clip_value [out_data.vtk]\n\n";
|
||||
std::cerr << "For example, you could use the ucd3d.vtk that comes with the VTK-m source:\n\n";
|
||||
std::cerr << " " << argv[0]
|
||||
<< " <path-to-vtkm-source>/data/data/unstructured/ucd3d.vtk v 0.3\n";
|
||||
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();
|
||||
|
||||
vtkm::filter::ClipWithField clipFilter;
|
||||
clipFilter.SetActiveField("pointvar");
|
||||
clipFilter.SetClipValue(20.0);
|
||||
clipFilter.SetActiveField(infield);
|
||||
clipFilter.SetClipValue(fieldValue);
|
||||
vtkm::cont::DataSet output = clipFilter.Execute(input);
|
||||
|
||||
vtkm::io::VTKDataSetWriter writer("out_data.vtk");
|
||||
vtkm::io::VTKDataSetWriter writer(outfilename);
|
||||
writer.WriteDataSet(output);
|
||||
|
||||
return 0;
|
||||
|
@ -13,14 +13,16 @@
|
||||
#include <vtkm/filter/CreateResult.h>
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
#include <vtkm/io/VTKDataSetWriter.h>
|
||||
|
||||
#include <vtkm/cont/Initialize.h>
|
||||
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace worklet
|
||||
@ -81,16 +83,34 @@ public:
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
vtkm::cont::Initialize(argc, argv, vtkm::cont::InitializeOptions::Strict);
|
||||
vtkm::cont::Initialize(argc, argv);
|
||||
|
||||
vtkm::cont::testing::MakeTestDataSet testDataMaker;
|
||||
vtkm::cont::DataSet inputData = testDataMaker.Make3DExplicitDataSetCowNose();
|
||||
if ((argc < 3) || (argc > 4))
|
||||
{
|
||||
std::cerr << "Usage: " << argv[0] << " in_data.vtk field_name [out_data.vtk]\n\n";
|
||||
std::cerr << "For example, you could use the simple_unstructured_bin.vtk that comes with the "
|
||||
"VTK-m source:\n\n";
|
||||
std::cerr
|
||||
<< " " << argv[0]
|
||||
<< " <path-to-vtkm-source>/data/data/unstructured/simple_unstructured_bin.vtk vectors\n";
|
||||
return 1;
|
||||
}
|
||||
std::string infilename = argv[1];
|
||||
std::string infield = argv[2];
|
||||
std::string outfilename = "out_data.vtk";
|
||||
if (argc == 4)
|
||||
{
|
||||
outfilename = argv[3];
|
||||
}
|
||||
|
||||
vtkm::io::VTKDataSetReader reader(infilename);
|
||||
vtkm::cont::DataSet inputData = reader.ReadDataSet();
|
||||
|
||||
vtkm::filter::HelloField helloField;
|
||||
helloField.SetActiveField("point_vectors");
|
||||
helloField.SetActiveField(infield);
|
||||
vtkm::cont::DataSet outputData = helloField.Execute(inputData);
|
||||
|
||||
vtkm::io::VTKDataSetWriter writer("out_data.vtk");
|
||||
vtkm::io::VTKDataSetWriter writer(outfilename);
|
||||
writer.WriteDataSet(outputData);
|
||||
|
||||
return 0;
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include <vector>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DataSetBuilderExplicit.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/MeshQuality.h>
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
#include <vtkm/io/VTKDataSetWriter.h>
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include <complex>
|
||||
#include <vtkm/cont/DataSetBuilderExplicit.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/io/VTKDataSetWriter.h>
|
||||
#include <vtkm/worklet/Tube.h>
|
||||
|
||||
|
@ -9,23 +9,39 @@
|
||||
//============================================================================
|
||||
#include <vtkm/cont/Initialize.h>
|
||||
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
#include <vtkm/io/VTKDataSetWriter.h>
|
||||
|
||||
#include <vtkm/filter/Tetrahedralize.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
vtkm::cont::Initialize(argc, argv, vtkm::cont::InitializeOptions::Strict);
|
||||
vtkm::cont::Initialize(argc, argv);
|
||||
|
||||
vtkm::cont::DataSet input =
|
||||
vtkm::cont::testing::MakeTestDataSet().Make3DUniformDataSet3(vtkm::Id3(25, 25, 25));
|
||||
if ((argc < 2) || (argc > 3))
|
||||
{
|
||||
std::cerr << "Usage: " << argv[0] << " in_data.vtk [out_data.vtk]\n\n";
|
||||
std::cerr << "For example, you could use the ucd3d.vtk that comes with the VTK-m source:\n\n";
|
||||
std::cerr << " " << argv[0] << " <path-to-vtkm-source>/data/data/unstructured/ucd3d.vtk\n";
|
||||
return 1;
|
||||
}
|
||||
std::string infilename = argv[1];
|
||||
std::string outfilename = "out_tets.vtk";
|
||||
if (argc == 3)
|
||||
{
|
||||
outfilename = argv[2];
|
||||
}
|
||||
|
||||
vtkm::io::VTKDataSetReader reader(infilename);
|
||||
vtkm::cont::DataSet input = reader.ReadDataSet();
|
||||
|
||||
vtkm::filter::Tetrahedralize tetrahedralizeFilter;
|
||||
vtkm::cont::DataSet output = tetrahedralizeFilter.Execute(input);
|
||||
|
||||
vtkm::io::VTKDataSetWriter writer("out_tets.vtk");
|
||||
vtkm::io::VTKDataSetWriter writer(outfilename);
|
||||
writer.WriteDataSet(output);
|
||||
|
||||
return 0;
|
||||
|
@ -9,22 +9,39 @@
|
||||
//============================================================================
|
||||
#include <vtkm/cont/Initialize.h>
|
||||
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
#include <vtkm/io/VTKDataSetWriter.h>
|
||||
|
||||
#include <vtkm/filter/Triangulate.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
vtkm::cont::Initialize(argc, argv, vtkm::cont::InitializeOptions::Strict);
|
||||
vtkm::cont::Initialize(argc, argv);
|
||||
|
||||
vtkm::cont::DataSet input = vtkm::cont::testing::MakeTestDataSet().Make2DUniformDataSet2();
|
||||
if ((argc < 2) || (argc > 3))
|
||||
{
|
||||
std::cerr << "Usage: " << argv[0] << " in_data.vtk [out_data.vtk]\n\n";
|
||||
std::cerr << "For example, you could use the vanc.vtk that comes with the VTK-m source:\n\n";
|
||||
std::cerr << " " << argv[0] << " <path-to-vtkm-source>/data/data/rectilinear/vanc.vtk\n";
|
||||
return 1;
|
||||
}
|
||||
std::string infilename = argv[1];
|
||||
std::string outfilename = "out_tris.vtk";
|
||||
if (argc == 3)
|
||||
{
|
||||
outfilename = argv[2];
|
||||
}
|
||||
|
||||
vtkm::io::VTKDataSetReader reader(infilename);
|
||||
vtkm::cont::DataSet input = reader.ReadDataSet();
|
||||
|
||||
vtkm::filter::Triangulate triangulateFilter;
|
||||
vtkm::cont::DataSet output = triangulateFilter.Execute(input);
|
||||
|
||||
vtkm::io::VTKDataSetWriter writer("out_tris.vtk");
|
||||
vtkm::io::VTKDataSetWriter writer(outfilename);
|
||||
writer.WriteDataSet(output);
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user