mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Compare commits
5 Commits
e987ac6e04
...
7353e53730
Author | SHA1 | Date | |
---|---|---|---|
|
7353e53730 | ||
|
31b9c44fc3 | ||
|
3440dfa9f9 | ||
|
67b0fea23a | ||
|
012853a73b |
@ -233,33 +233,56 @@ vtkm::cont::DataSet MakeTestDataSet::Make3DUniformDataSet1()
|
||||
constexpr vtkm::Id nVerts = 125;
|
||||
constexpr vtkm::Id nCells = 64;
|
||||
constexpr vtkm::Float32 pointvar[nVerts] = {
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 0
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 1, 0
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 2, 0
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 3, 0
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 4, 0
|
||||
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 99.0f, 90.0f, 85.0f, 0.0f, 0.0f, 95.0f, 80.0f,
|
||||
95.0f, 0.0f, 0.0f, 85.0f, 90.0f, 99.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 1
|
||||
0.0f, 99.0f, 90.0f, 85.0f, 0.0f, // 0-4, 1, 1
|
||||
0.0f, 95.0f, 80.0f, 95.0f, 0.0f, // 0-4, 2, 1
|
||||
0.0f, 85.0f, 90.0f, 99.0f, 0.0f, // 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f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 4
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 1, 4
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 2, 4
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 3, 4
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f // 0-4, 4, 4
|
||||
};
|
||||
constexpr vtkm::Float32 cellvar[nCells] = {
|
||||
0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f,
|
||||
8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f,
|
||||
0.0f, 1.0f, 2.0f, 3.0f, // 0-3, 0, 0
|
||||
4.0f, 5.0f, 6.0f, 7.0f, // 0-3, 1, 0
|
||||
8.0f, 9.0f, 10.0f, 11.0f, // 0-3, 2, 0
|
||||
12.0f, 13.0f, 14.0f, 15.0f, // 0-3, 3, 0
|
||||
|
||||
16.0f, 17.0f, 18.0f, 19.0f, 20.0f, 21.0f, 22.0f, 23.0f,
|
||||
24.0f, 25.0f, 26.0f, 27.0f, 28.0f, 29.0f, 30.0f, 31.0f,
|
||||
16.0f, 17.0f, 18.0f, 19.0f, // 0-3, 0, 1
|
||||
20.0f, 21.0f, 22.0f, 23.0f, // 0-3, 1, 1
|
||||
24.0f, 25.0f, 26.0f, 27.0f, // 0-3, 2, 1
|
||||
28.0f, 29.0f, 30.0f, 31.0f, // 0-3, 3, 1
|
||||
|
||||
32.0f, 33.0f, 34.0f, 35.0f, 36.0f, 37.0f, 38.0f, 39.0f,
|
||||
40.0f, 41.0f, 42.0f, 43.0f, 44.0f, 45.0f, 46.0f, 47.0f,
|
||||
32.0f, 33.0f, 34.0f, 35.0f, // 0-3, 0, 2
|
||||
36.0f, 37.0f, 38.0f, 39.0f, // 0-3, 1, 2
|
||||
40.0f, 41.0f, 42.0f, 43.0f, // 0-3, 2, 2
|
||||
44.0f, 45.0f, 46.0f, 47.0f, // 0-3, 3, 2
|
||||
|
||||
48.0f, 49.0f, 50.0f, 51.0f, 52.0f, 53.0f, 54.0f, 55.0f,
|
||||
56.0f, 57.0f, 58.0f, 59.0f, 60.0f, 61.0f, 62.0f, 63.0f
|
||||
48.0f, 49.0f, 50.0f, 51.0f, // 0-3, 0, 3
|
||||
52.0f, 53.0f, 54.0f, 55.0f, // 0-3, 1, 3
|
||||
56.0f, 57.0f, 58.0f, 59.0f, // 0-3, 2, 3
|
||||
60.0f, 61.0f, 62.0f, 63.0f // 0-3, 3, 3
|
||||
};
|
||||
|
||||
dataSet.AddPointField("pointvar", pointvar, nVerts);
|
||||
|
@ -85,17 +85,23 @@ public:
|
||||
VTKM_CONT
|
||||
void SetSampleRate(vtkm::Id3 sampleRate) { this->SampleRate = sampleRate; }
|
||||
|
||||
// Get if we should include the outer boundary on a subsample
|
||||
// (NOTE: This method is deprecated because it is not clear from either
|
||||
// the documentation or the source code what the intention of this feature
|
||||
// is. If your are using this method somewhere and think it should remain,
|
||||
// please open a merge request to "de-deprecate" it and add a test and
|
||||
// documentation of the expected behavior.)
|
||||
VTKM_DEPRECATED(2.2)
|
||||
/// @brief Specifies if the outer boundary should always be included.
|
||||
///
|
||||
/// When a subsample rate is specified, it is possible that some of the
|
||||
/// boundary samples will not be included in the sampling. If this is the
|
||||
/// case and `IncludeBoundary` is set to true, then an extra sample is
|
||||
/// set in the output and the values on the boundary are included. For example,
|
||||
/// say the input has resolution (5, 5, 1) (and the VOI matches), and the sample
|
||||
/// rate is set to (3, 3, 1). If `IncludeBoundary` is false, then the output will
|
||||
/// have the 4 points that correspond to the 3D indices (0, 0, 0), (3, 0, 0),
|
||||
/// (0, 3, 0), and (3, 3, 0) of the input. This misses the outer boundary at
|
||||
/// index 4 in the x and y directions. If `IncludeBoundary is set to true, then
|
||||
/// the output will have the 9 points that correspond to the 3D indices (0, 0, 0),
|
||||
/// (3, 0, 0), (4, 0, 0), (0, 3, 0), (3, 3, 0), (4, 3, 0), (0, 4, 0), (3, 4, 0),
|
||||
/// and (4, 4, 0) to capture this outer boundary.
|
||||
VTKM_CONT
|
||||
bool GetIncludeBoundary() const { return this->IncludeBoundary; }
|
||||
// Set if we should include the outer boundary on a subsample
|
||||
VTKM_DEPRECATED(2.2)
|
||||
/// @copydoc GetIncludeBoundary
|
||||
VTKM_CONT
|
||||
void SetIncludeBoundary(bool value) { this->IncludeBoundary = value; }
|
||||
|
||||
|
@ -341,7 +341,7 @@ public:
|
||||
|
||||
static void TestUniform3D7()
|
||||
{
|
||||
std::cout << "Testing extract structured uniform" << std::endl;
|
||||
std::cout << "Testing extract structured uniform, exclude boundary" << std::endl;
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
|
||||
|
||||
vtkm::filter::entity_extraction::ExtractStructured extract;
|
||||
@ -351,6 +351,7 @@ public:
|
||||
vtkm::Id3 sample(3, 3, 2);
|
||||
extract.SetVOI(range);
|
||||
extract.SetSampleRate(sample);
|
||||
extract.SetIncludeBoundary(false); // default
|
||||
|
||||
extract.SetFieldsToPass({ "pointvar", "cellvar" });
|
||||
vtkm::cont::DataSet output = extract.Execute(dataset);
|
||||
@ -371,16 +372,16 @@ public:
|
||||
"Data/Geometry mismatch for ExtractStructured filter");
|
||||
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(0) == 0.0f, "Wrong point field data");
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(3) == 99.0f, "Wrong point field data");
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(4) == 0.0f, "Wrong point field data");
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(7) == 97.0f, "Wrong point field data");
|
||||
|
||||
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 16.0f, "Wrong cell field data");
|
||||
}
|
||||
|
||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
||||
// This test repeates TestUniform3D7 but uses deprecated behavior.
|
||||
static void TestUniform3D8()
|
||||
{
|
||||
std::cout << "Testing extract structured uniform" << std::endl;
|
||||
std::cout << "Testing extract structured uniform, include boundary" << std::endl;
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
|
||||
vtkm::filter::entity_extraction::ExtractStructured extract;
|
||||
|
||||
@ -411,12 +412,15 @@ public:
|
||||
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(0) == 0.0f, "Wrong point field data");
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(4) == 99.0f, "Wrong point field data");
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(5) == 0.0f, "Wrong point field data");
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(7) == 0.0f, "Wrong point field data");
|
||||
VTKM_TEST_ASSERT(outPointData.ReadPortal().Get(13) == 97.0f, "Wrong point field data");
|
||||
|
||||
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 16.0f, "Wrong cell field data");
|
||||
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(1) == 19.0f, "Wrong cell field data");
|
||||
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(2) == 28.0f, "Wrong cell field data");
|
||||
VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(3) == 31.0f, "Wrong cell field data");
|
||||
}
|
||||
VTKM_DEPRECATED_SUPPRESS_END
|
||||
|
||||
static void TestRectilinear2D()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user