mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
remove MakeTestDataSet, generate vtk dataset files
This commit is contained in:
parent
b883b2d92b
commit
9c59f3907a
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ab7462d094c75d92e7d034a748b5cd7cd353ecc8187e1b13de226a15c37ba11a
|
||||
size 10310
|
3
data/baseline/contour-wedge0.png
Normal file
3
data/baseline/contour-wedge0.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:74995441b8f0c0c19b16d45c489932958784bb3f32c65fd274985b3ecfcc87d6
|
||||
size 19885
|
3
data/baseline/contour-wedge1.png
Normal file
3
data/baseline/contour-wedge1.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c1a54c159483076a2eed1f7cf8f8d947e6ec59dcfbd8ed41355e92cf052d344e
|
||||
size 19884
|
3
data/baseline/point-transform1.png
Normal file
3
data/baseline/point-transform1.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f369086fb38f92d4b0074af566872ce3876d65df8e2bc5fb0757c57a7449522f
|
||||
size 28255
|
3
data/baseline/streamline1.png
Normal file
3
data/baseline/streamline1.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b215997c33dfb26d6a949af55b8161b63a83e48f8f11d4733551a215cf085e15
|
||||
size 31588
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fd088f6851b05be6aade3ca60eb7e8214eed18b216ba70c9c76e936c461541f1
|
||||
size 52955
|
3
data/baseline/surface-normals0.png
Normal file
3
data/baseline/surface-normals0.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:34698f0f8e0895745208f4e9f608cbd4faca6cfb0b25a1a984b117a4f53eea38
|
||||
size 46680
|
3
data/baseline/surface-normals1.png
Normal file
3
data/baseline/surface-normals1.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a16d182ccd5199a577d54386ab7f5f35c988848ef81bcb8d1f7001eb60b2e1a9
|
||||
size 46683
|
3
data/data/uniform/StreamlineTestDataSet.vtk
Normal file
3
data/data/uniform/StreamlineTestDataSet.vtk
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a2c0b3788197a48a305fc049f54d66c94c20298e617ef06dbe4fe0c2043f7366
|
||||
size 3590
|
3
data/data/unstructured/PointTransformTestDataSet.vtk
Normal file
3
data/data/unstructured/PointTransformTestDataSet.vtk
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7191ea7dec00129cb262239a508aeba4bb9387e581adfa2049211f4514ee4130
|
||||
size 1020
|
3
data/data/unstructured/SplitSharpEdgesTestDataSet.vtk
Normal file
3
data/data/unstructured/SplitSharpEdgesTestDataSet.vtk
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b7b7e73f60f3572e19178aa55fcd32cafb5c5823062241d28aa37d82b0031a2a
|
||||
size 1145
|
3
data/data/unstructured/SurfaceNormalsTestDataSet.vtk
Normal file
3
data/data/unstructured/SurfaceNormalsTestDataSet.vtk
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:90aed1ed3c3eba58f1b0b1573b09e8c024e48f5ca822e9f88b0c1ff6593a978f
|
||||
size 693
|
@ -8,12 +8,6 @@
|
||||
## PURPOSE. See the above copyright notice for more information.
|
||||
##============================================================================
|
||||
|
||||
set(headers
|
||||
MakeTestDataSet.h
|
||||
)
|
||||
|
||||
vtkm_declare_headers(${headers})
|
||||
|
||||
set(unit_tests
|
||||
UnitTestCellAverageFilter.cxx
|
||||
UnitTestCellMeasuresFilter.cxx
|
||||
|
@ -1,175 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// 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.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_testing_MakeTestDataSet_h
|
||||
#define vtk_m_filter_testing_MakeTestDataSet_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DataSetBuilderExplicit.h>
|
||||
#include <vtkm/cont/DataSetBuilderRectilinear.h>
|
||||
#include <vtkm/cont/DataSetBuilderUniform.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <numeric>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace testing
|
||||
{
|
||||
|
||||
class MakeTestDataSet
|
||||
{
|
||||
public:
|
||||
// 3D explicit datasets
|
||||
vtkm::cont::DataSet Make3DExplicitSimpleCube();
|
||||
|
||||
// Special test datasets
|
||||
vtkm::cont::DataSet MakePointTransformTestDataSet();
|
||||
vtkm::cont::DataSet MakeStreamlineTestDataSet(const vtkm::Id3& dims, const vtkm::Vec3f& vec);
|
||||
};
|
||||
|
||||
inline vtkm::cont::DataSet MakeTestDataSet::MakePointTransformTestDataSet()
|
||||
{
|
||||
vtkm::cont::DataSet dataSet;
|
||||
|
||||
std::vector<vtkm::Vec3f> coordinates;
|
||||
const vtkm::Id dim = 5;
|
||||
for (vtkm::Id j = 0; j < dim; ++j)
|
||||
{
|
||||
vtkm::FloatDefault z =
|
||||
static_cast<vtkm::FloatDefault>(j) / static_cast<vtkm::FloatDefault>(dim - 1);
|
||||
for (vtkm::Id i = 0; i < dim; ++i)
|
||||
{
|
||||
vtkm::FloatDefault x =
|
||||
static_cast<vtkm::FloatDefault>(i) / static_cast<vtkm::FloatDefault>(dim - 1);
|
||||
vtkm::FloatDefault y = (x * x + z * z) / 2.0f;
|
||||
coordinates.push_back(vtkm::make_Vec(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
vtkm::Id numCells = (dim - 1) * (dim - 1);
|
||||
dataSet.AddCoordinateSystem(
|
||||
vtkm::cont::make_CoordinateSystem("coordinates", coordinates, vtkm::CopyFlag::On));
|
||||
|
||||
vtkm::cont::CellSetExplicit<> cellSet;
|
||||
cellSet.PrepareToAddCells(numCells, numCells * 4);
|
||||
for (vtkm::Id j = 0; j < dim - 1; ++j)
|
||||
{
|
||||
for (vtkm::Id i = 0; i < dim - 1; ++i)
|
||||
{
|
||||
cellSet.AddCell(vtkm::CELL_SHAPE_QUAD,
|
||||
4,
|
||||
vtkm::make_Vec<vtkm::Id>(
|
||||
j * dim + i, j * dim + i + 1, (j + 1) * dim + i + 1, (j + 1) * dim + i));
|
||||
}
|
||||
}
|
||||
cellSet.CompleteAddingCells(vtkm::Id(coordinates.size()));
|
||||
|
||||
dataSet.SetCellSet(cellSet);
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
inline vtkm::cont::DataSet MakeTestDataSet::MakeStreamlineTestDataSet(const vtkm::Id3& dims,
|
||||
const vtkm::Vec3f& vec)
|
||||
{
|
||||
vtkm::Id numPoints = dims[0] * dims[1] * dims[2];
|
||||
|
||||
std::vector<vtkm::Vec3f> vectorField(static_cast<std::size_t>(numPoints));
|
||||
for (std::size_t i = 0; i < static_cast<std::size_t>(numPoints); i++)
|
||||
vectorField[i] = vec;
|
||||
|
||||
vtkm::cont::DataSetBuilderUniform dataSetBuilder;
|
||||
|
||||
vtkm::cont::DataSet ds = dataSetBuilder.Create(dims);
|
||||
ds.AddPointField("vector", vectorField);
|
||||
|
||||
return ds;
|
||||
}
|
||||
|
||||
inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitSimpleCube()
|
||||
{
|
||||
vtkm::cont::DataSet dataSet;
|
||||
vtkm::cont::DataSetBuilderExplicit dsb;
|
||||
|
||||
const int nVerts = 8;
|
||||
const int nCells = 6;
|
||||
using CoordType = vtkm::Vec3f;
|
||||
std::vector<CoordType> coords = {
|
||||
CoordType(0, 0, 0), // 0
|
||||
CoordType(1, 0, 0), // 1
|
||||
CoordType(1, 0, 1), // 2
|
||||
CoordType(0, 0, 1), // 3
|
||||
CoordType(0, 1, 0), // 4
|
||||
CoordType(1, 1, 0), // 5
|
||||
CoordType(1, 1, 1), // 6
|
||||
CoordType(0, 1, 1) // 7
|
||||
};
|
||||
|
||||
//Connectivity
|
||||
std::vector<vtkm::UInt8> shapes;
|
||||
std::vector<vtkm::IdComponent> numIndices;
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
{
|
||||
shapes.push_back(vtkm::CELL_SHAPE_QUAD);
|
||||
numIndices.push_back(4);
|
||||
}
|
||||
|
||||
std::vector<vtkm::Id> conn;
|
||||
// Down face
|
||||
conn.push_back(0);
|
||||
conn.push_back(1);
|
||||
conn.push_back(5);
|
||||
conn.push_back(4);
|
||||
// Right face
|
||||
conn.push_back(1);
|
||||
conn.push_back(2);
|
||||
conn.push_back(6);
|
||||
conn.push_back(5);
|
||||
// Top face
|
||||
conn.push_back(2);
|
||||
conn.push_back(3);
|
||||
conn.push_back(7);
|
||||
conn.push_back(6);
|
||||
// Left face
|
||||
conn.push_back(3);
|
||||
conn.push_back(0);
|
||||
conn.push_back(4);
|
||||
conn.push_back(7);
|
||||
// Front face
|
||||
conn.push_back(4);
|
||||
conn.push_back(5);
|
||||
conn.push_back(6);
|
||||
conn.push_back(7);
|
||||
// Back face
|
||||
conn.push_back(0);
|
||||
conn.push_back(3);
|
||||
conn.push_back(2);
|
||||
conn.push_back(1);
|
||||
//Create the dataset.
|
||||
dataSet = dsb.Create(coords, shapes, numIndices, conn, "coordinates");
|
||||
|
||||
vtkm::FloatDefault vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f, 60.3f, 70.3f, 80.3f };
|
||||
vtkm::FloatDefault cellvar[nCells] = { 100.1f, 200.2f, 300.3f, 400.4f, 500.5f, 600.6f };
|
||||
|
||||
dataSet.AddPointField("pointvar", vars, nVerts);
|
||||
dataSet.AddCellField("cellvar", cellvar, nCells);
|
||||
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter::testing
|
||||
|
||||
#endif //vtk_m_filter_testing_MakeTestDataSet_h
|
@ -51,9 +51,10 @@ void TestContourFilterWedge()
|
||||
M mapper;
|
||||
vtkm::rendering::Scene scene;
|
||||
auto view = vtkm::rendering::testing::GetViewPtr<M, C, V3>(
|
||||
result, "gyroid", canvas, mapper, scene, colorTable, static_cast<vtkm::FloatDefault>(0.075));
|
||||
result, "gyroid", canvas, mapper, scene, colorTable, static_cast<vtkm::FloatDefault>(0.08));
|
||||
|
||||
VTKM_TEST_ASSERT(vtkm::rendering::testing::test_equal_images(view, "contour-wedge.png"));
|
||||
VTKM_TEST_ASSERT(
|
||||
vtkm::rendering::testing::test_equal_images_matching_name(view, "contour-wedge.png"));
|
||||
}
|
||||
|
||||
void TestContourFilter()
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
|
||||
#include <vtkm/filter/PointTransform.h>
|
||||
#include <vtkm/filter/VectorMagnitude.h>
|
||||
@ -33,8 +33,10 @@ void TestPointTransform()
|
||||
using C = vtkm::rendering::CanvasRayTracer;
|
||||
using V3 = vtkm::rendering::View3D;
|
||||
|
||||
vtkm::filter::testing::MakeTestDataSet makeTestData;
|
||||
auto dataSet = makeTestData.MakePointTransformTestDataSet();
|
||||
auto pathname =
|
||||
vtkm::cont::testing::Testing::DataPath("unstructured/PointTransformTestDataSet.vtk");
|
||||
vtkm::io::VTKDataSetReader reader(pathname);
|
||||
vtkm::cont::DataSet dataSet = reader.ReadDataSet();
|
||||
|
||||
vtkm::filter::PointTransform pointTransform;
|
||||
pointTransform.SetOutputFieldName("translation");
|
||||
@ -56,7 +58,8 @@ void TestPointTransform()
|
||||
auto view = vtkm::rendering::testing::GetViewPtr<M, C, V3>(
|
||||
result, "pointvar", canvas, mapper, scene, colorTable, static_cast<vtkm::FloatDefault>(0.05));
|
||||
|
||||
VTKM_TEST_ASSERT(vtkm::rendering::testing::test_equal_images(view, "point-transform.png"));
|
||||
VTKM_TEST_ASSERT(
|
||||
vtkm::rendering::testing::test_equal_images_matching_name(view, "point-transform.png"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
|
||||
#include <vtkm/filter/SplitSharpEdges.h>
|
||||
#include <vtkm/filter/SurfaceNormals.h>
|
||||
@ -33,11 +33,10 @@ void TestSplitSharpEdges()
|
||||
using C = vtkm::rendering::CanvasRayTracer;
|
||||
using V3 = vtkm::rendering::View3D;
|
||||
|
||||
vtkm::filter::testing::MakeTestDataSet makeTestData;
|
||||
vtkm::filter::SurfaceNormals surfaceNormalsFilter;
|
||||
surfaceNormalsFilter.SetGenerateCellNormals(true);
|
||||
vtkm::cont::DataSet dataSet =
|
||||
surfaceNormalsFilter.Execute(makeTestData.Make3DExplicitSimpleCube());
|
||||
auto pathname =
|
||||
vtkm::cont::testing::Testing::DataPath("unstructured/SplitSharpEdgesTestDataSet.vtk");
|
||||
vtkm::io::VTKDataSetReader reader(pathname);
|
||||
auto dataSet = reader.ReadDataSet();
|
||||
|
||||
vtkm::filter::SplitSharpEdges splitSharpEdges;
|
||||
splitSharpEdges.SetFeatureAngle(89.0);
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <vtkm/cont/ArrayHandleConstant.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
|
||||
#include <vtkm/filter/Streamline.h>
|
||||
#include <vtkm/filter/Tube.h>
|
||||
@ -34,10 +34,9 @@ void TestStreamline()
|
||||
using C = vtkm::rendering::CanvasRayTracer;
|
||||
using V3 = vtkm::rendering::View3D;
|
||||
|
||||
const vtkm::Id3 dims(5, 5, 5);
|
||||
const vtkm::Vec3f vecX(1, 0, 0);
|
||||
vtkm::filter::testing::MakeTestDataSet makeTestData;
|
||||
auto dataSet = makeTestData.MakeStreamlineTestDataSet(dims, vecX);
|
||||
auto pathname = vtkm::cont::testing::Testing::DataPath("uniform/StreamlineTestDataSet.vtk");
|
||||
vtkm::io::VTKDataSetReader reader(pathname);
|
||||
vtkm::cont::DataSet dataSet = reader.ReadDataSet();
|
||||
vtkm::cont::ArrayHandle<vtkm::Particle> seedArray =
|
||||
vtkm::cont::make_ArrayHandle({ vtkm::Particle(vtkm::Vec3f(.2f, 1.0f, .2f), 0),
|
||||
vtkm::Particle(vtkm::Vec3f(.2f, 2.0f, .2f), 1),
|
||||
@ -75,7 +74,8 @@ void TestStreamline()
|
||||
auto view = vtkm::rendering::testing::GetViewPtr<M, C, V3>(
|
||||
result, "pointvar", canvas, mapper, scene, colorTable, static_cast<vtkm::FloatDefault>(0.1));
|
||||
|
||||
VTKM_TEST_ASSERT(vtkm::rendering::testing::test_equal_images(view, "streamline.png"));
|
||||
VTKM_TEST_ASSERT(
|
||||
vtkm::rendering::testing::test_equal_images_matching_name(view, "streamline.png"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
|
||||
#include <vtkm/filter/SurfaceNormals.h>
|
||||
|
||||
@ -32,8 +32,13 @@ void TestSurfaceNormals()
|
||||
using C = vtkm::rendering::CanvasRayTracer;
|
||||
using V3 = vtkm::rendering::View3D;
|
||||
|
||||
vtkm::cont::testing::MakeTestDataSet makeTestData;
|
||||
auto dataSet = makeTestData.Make3DExplicitDataSetPolygonal();
|
||||
// NOTE: This dataset stores a shape value of 7 for polygons. The
|
||||
// VTKDataSetReader currently converts all polygons with 4 verticies to
|
||||
// quads (shape 9).
|
||||
auto pathname =
|
||||
vtkm::cont::testing::Testing::DataPath("unstructured/SurfaceNormalsTestDataSet.vtk");
|
||||
vtkm::io::VTKDataSetReader reader(pathname);
|
||||
auto dataSet = reader.ReadDataSet();
|
||||
|
||||
vtkm::filter::SurfaceNormals surfaceNormals;
|
||||
surfaceNormals.SetGeneratePointNormals(true);
|
||||
@ -48,7 +53,8 @@ void TestSurfaceNormals()
|
||||
auto view = vtkm::rendering::testing::GetViewPtr<M, C, V3>(
|
||||
result, "pointvar", canvas, mapper, scene, colorTable, static_cast<vtkm::FloatDefault>(0.05));
|
||||
|
||||
VTKM_TEST_ASSERT(vtkm::rendering::testing::test_equal_images(view, "surface-normals.png"));
|
||||
VTKM_TEST_ASSERT(
|
||||
vtkm::rendering::testing::test_equal_images_matching_name(view, "surface-normals.png"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/PointTransform.h>
|
||||
#include <vtkm/filter/testing/MakeTestDataSet.h>
|
||||
|
||||
#include <random>
|
||||
#include <string>
|
||||
@ -20,6 +19,47 @@ namespace
|
||||
{
|
||||
std::mt19937 randGenerator;
|
||||
|
||||
vtkm::cont::DataSet MakePointTransformTestDataSet()
|
||||
{
|
||||
vtkm::cont::DataSet dataSet;
|
||||
|
||||
std::vector<vtkm::Vec3f> coordinates;
|
||||
const vtkm::Id dim = 5;
|
||||
for (vtkm::Id j = 0; j < dim; ++j)
|
||||
{
|
||||
vtkm::FloatDefault z =
|
||||
static_cast<vtkm::FloatDefault>(j) / static_cast<vtkm::FloatDefault>(dim - 1);
|
||||
for (vtkm::Id i = 0; i < dim; ++i)
|
||||
{
|
||||
vtkm::FloatDefault x =
|
||||
static_cast<vtkm::FloatDefault>(i) / static_cast<vtkm::FloatDefault>(dim - 1);
|
||||
vtkm::FloatDefault y = (x * x + z * z) / 2.0f;
|
||||
coordinates.push_back(vtkm::make_Vec(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
vtkm::Id numCells = (dim - 1) * (dim - 1);
|
||||
dataSet.AddCoordinateSystem(
|
||||
vtkm::cont::make_CoordinateSystem("coordinates", coordinates, vtkm::CopyFlag::On));
|
||||
|
||||
vtkm::cont::CellSetExplicit<> cellSet;
|
||||
cellSet.PrepareToAddCells(numCells, numCells * 4);
|
||||
for (vtkm::Id j = 0; j < dim - 1; ++j)
|
||||
{
|
||||
for (vtkm::Id i = 0; i < dim - 1; ++i)
|
||||
{
|
||||
cellSet.AddCell(vtkm::CELL_SHAPE_QUAD,
|
||||
4,
|
||||
vtkm::make_Vec<vtkm::Id>(
|
||||
j * dim + i, j * dim + i + 1, (j + 1) * dim + i + 1, (j + 1) * dim + i));
|
||||
}
|
||||
}
|
||||
cellSet.CompleteAddingCells(vtkm::Id(coordinates.size()));
|
||||
|
||||
dataSet.SetCellSet(cellSet);
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
void ValidatePointTransform(const vtkm::cont::CoordinateSystem& coords,
|
||||
const std::string fieldName,
|
||||
const vtkm::cont::DataSet& result,
|
||||
@ -98,8 +138,7 @@ void TestPointTransform()
|
||||
{
|
||||
std::cout << "Testing PointTransform Worklet" << std::endl;
|
||||
|
||||
vtkm::filter::testing::MakeTestDataSet makeTestData;
|
||||
vtkm::cont::DataSet ds = makeTestData.MakePointTransformTestDataSet();
|
||||
vtkm::cont::DataSet ds = MakePointTransformTestDataSet();
|
||||
int N = 41;
|
||||
|
||||
//Test translation
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include <vtkm/filter/SplitSharpEdges.h>
|
||||
#include <vtkm/filter/SurfaceNormals.h>
|
||||
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
#include <vtkm/filter/testing/MakeTestDataSet.h>
|
||||
|
||||
#include <vtkm/source/Wavelet.h>
|
||||
|
||||
@ -37,6 +37,79 @@ const std::vector<vtkm::FloatDefault> expectedPointvar{ 10.1f, 20.1f, 30.2f, 40.
|
||||
30.2f, 30.2f, 40.2f, 40.2f, 50.3f, 50.3f,
|
||||
60.3f, 60.3f, 70.3f, 70.3f, 80.3f, 80.3f };
|
||||
|
||||
vtkm::cont::DataSet Make3DExplicitSimpleCube()
|
||||
{
|
||||
vtkm::cont::DataSet dataSet;
|
||||
vtkm::cont::DataSetBuilderExplicit dsb;
|
||||
|
||||
const int nVerts = 8;
|
||||
const int nCells = 6;
|
||||
using CoordType = vtkm::Vec3f;
|
||||
std::vector<CoordType> coords = {
|
||||
CoordType(0, 0, 0), // 0
|
||||
CoordType(1, 0, 0), // 1
|
||||
CoordType(1, 0, 1), // 2
|
||||
CoordType(0, 0, 1), // 3
|
||||
CoordType(0, 1, 0), // 4
|
||||
CoordType(1, 1, 0), // 5
|
||||
CoordType(1, 1, 1), // 6
|
||||
CoordType(0, 1, 1) // 7
|
||||
};
|
||||
|
||||
//Connectivity
|
||||
std::vector<vtkm::UInt8> shapes;
|
||||
std::vector<vtkm::IdComponent> numIndices;
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
{
|
||||
shapes.push_back(vtkm::CELL_SHAPE_QUAD);
|
||||
numIndices.push_back(4);
|
||||
}
|
||||
|
||||
|
||||
std::vector<vtkm::Id> conn;
|
||||
// Down face
|
||||
conn.push_back(0);
|
||||
conn.push_back(1);
|
||||
conn.push_back(5);
|
||||
conn.push_back(4);
|
||||
// Right face
|
||||
conn.push_back(1);
|
||||
conn.push_back(2);
|
||||
conn.push_back(6);
|
||||
conn.push_back(5);
|
||||
// Top face
|
||||
conn.push_back(2);
|
||||
conn.push_back(3);
|
||||
conn.push_back(7);
|
||||
conn.push_back(6);
|
||||
// Left face
|
||||
conn.push_back(3);
|
||||
conn.push_back(0);
|
||||
conn.push_back(4);
|
||||
conn.push_back(7);
|
||||
// Front face
|
||||
conn.push_back(4);
|
||||
conn.push_back(5);
|
||||
conn.push_back(6);
|
||||
conn.push_back(7);
|
||||
// Back face
|
||||
conn.push_back(0);
|
||||
conn.push_back(3);
|
||||
conn.push_back(2);
|
||||
conn.push_back(1);
|
||||
|
||||
//Create the dataset.
|
||||
dataSet = dsb.Create(coords, shapes, numIndices, conn, "coordinates");
|
||||
|
||||
vtkm::FloatDefault vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f, 60.3f, 70.3f, 80.3f };
|
||||
vtkm::FloatDefault cellvar[nCells] = { 100.1f, 200.2f, 300.3f, 400.4f, 500.5f, 600.6f };
|
||||
|
||||
dataSet.AddPointField("pointvar", vars, nVerts);
|
||||
dataSet.AddCellField("cellvar", cellvar, nCells);
|
||||
|
||||
return dataSet;
|
||||
}
|
||||
|
||||
vtkm::cont::DataSet Make3DWavelet()
|
||||
{
|
||||
|
||||
@ -129,8 +202,8 @@ void TestSplitSharpEdgesFilterNoSplit(vtkm::cont::DataSet& simpleCubeWithSN,
|
||||
|
||||
void TestWithExplicitData()
|
||||
{
|
||||
vtkm::filter::testing::MakeTestDataSet makeTestData;
|
||||
vtkm::cont::DataSet simpleCube = makeTestData.Make3DExplicitSimpleCube();
|
||||
vtkm::cont::DataSet simpleCube = Make3DExplicitSimpleCube();
|
||||
|
||||
// Generate surface normal field
|
||||
vtkm::filter::SurfaceNormals surfaceNormalsFilter;
|
||||
surfaceNormalsFilter.SetGenerateCellNormals(true);
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <vtkm/filter/ParticleAdvection.h>
|
||||
#include <vtkm/filter/Pathline.h>
|
||||
#include <vtkm/filter/Streamline.h>
|
||||
#include <vtkm/filter/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/io/VTKDataSetReader.h>
|
||||
#include <vtkm/worklet/testing/GenerateTestDataSets.h>
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/Error.h>
|
||||
#include <vtkm/cont/RuntimeDeviceTracker.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <vtkm/filter/ImageDifference.h>
|
||||
@ -51,6 +52,7 @@ inline vtkm::cont::testing::TestEqualResult test_equal_images(
|
||||
const bool& writeDiff = true,
|
||||
const bool& returnOnPass = true)
|
||||
{
|
||||
vtkm::cont::ScopedRuntimeDeviceTracker runtime(vtkm::cont::DeviceAdapterTagAny{});
|
||||
vtkm::cont::testing::TestEqualResult testResults;
|
||||
|
||||
if (fileNames.empty())
|
||||
@ -132,6 +134,7 @@ inline vtkm::cont::testing::TestEqualResult test_equal_images(
|
||||
testResults.PushMessage(imageResult.GetMergedMessage());
|
||||
}
|
||||
|
||||
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Test Results: " << testResults.GetMergedMessage());
|
||||
return testResults;
|
||||
}
|
||||
|
||||
@ -171,7 +174,7 @@ inline vtkm::cont::testing::TestEqualResult test_equal_images_matching_name(
|
||||
const bool& writeDiff = true,
|
||||
const bool& returnOnPass = true)
|
||||
{
|
||||
std::vector<std::string> fileNames{ fileName };
|
||||
std::vector<std::string> fileNames;
|
||||
auto found = fileName.rfind(".");
|
||||
auto prefix = fileName.substr(0, found);
|
||||
auto suffix = fileName.substr(found, fileName.length());
|
||||
@ -185,12 +188,12 @@ inline vtkm::cont::testing::TestEqualResult test_equal_images_matching_name(
|
||||
if (!check.good())
|
||||
{
|
||||
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
|
||||
"Could not find file with name " << fileNameStream.str() << ", beginning testing");
|
||||
"Stopped filename search at: " << fileNameStream.str() << ", beginning testing");
|
||||
break;
|
||||
}
|
||||
fileNames.emplace_back(fileNameStream.str());
|
||||
}
|
||||
test_equal_images(view, fileNames, threshold, radius, average, writeDiff, returnOnPass);
|
||||
return test_equal_images(view, fileNames, threshold, radius, average, writeDiff, returnOnPass);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user