mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Compare commits
8 Commits
e987ac6e04
...
7353e53730
Author | SHA1 | Date | |
---|---|---|---|
|
7353e53730 | ||
|
31b9c44fc3 | ||
|
3440dfa9f9 | ||
|
67b0fea23a | ||
|
012853a73b | ||
|
fae6ef8c93 | ||
|
8b87ae192f | ||
|
99900576c5 |
@ -155,6 +155,110 @@ private:
|
|||||||
std::vector<std::string> mCLOptions;
|
std::vector<std::string> mCLOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ComputeGlobalPointDimensions(vtkm::cont::PartitionedDataSet& pds)
|
||||||
|
{
|
||||||
|
// Compute GlobalPointDimensions as maximum of GlobalPointIndexStart + PointDimensions
|
||||||
|
// for each dimension across all blocks
|
||||||
|
|
||||||
|
// Compute GlobalPointDimensions for all data sets on this MPI rank
|
||||||
|
std::vector<vtkm::Id> globalPointDimensionsThisRank;
|
||||||
|
using ds_const_iterator = vtkm::cont::PartitionedDataSet::const_iterator;
|
||||||
|
for (ds_const_iterator ds_it = pds.cbegin(); ds_it != pds.cend(); ++ds_it)
|
||||||
|
{
|
||||||
|
ds_it->GetCellSet().CastAndCallForTypes<vtkm::cont::CellSetListStructured>(
|
||||||
|
[&globalPointDimensionsThisRank](const auto& css) {
|
||||||
|
globalPointDimensionsThisRank.resize(css.Dimension, -1);
|
||||||
|
for (vtkm::IdComponent d = 0; d < css.Dimension; ++d)
|
||||||
|
{
|
||||||
|
globalPointDimensionsThisRank[d] =
|
||||||
|
std::max(globalPointDimensionsThisRank[d],
|
||||||
|
css.GetGlobalPointIndexStart()[d] + css.GetPointDimensions()[d]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform global reduction to find GlobalPointDimensions across all ranks
|
||||||
|
std::vector<vtkm::Id> globalPointDimensions;
|
||||||
|
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||||
|
vtkmdiy::mpi::all_reduce(
|
||||||
|
comm, globalPointDimensionsThisRank, globalPointDimensions, vtkmdiy::mpi::maximum<vtkm::Id>{});
|
||||||
|
|
||||||
|
// Set this information in all cell sets
|
||||||
|
using ds_iterator = vtkm::cont::PartitionedDataSet::iterator;
|
||||||
|
for (ds_iterator ds_it = pds.begin(); ds_it != pds.end(); ++ds_it)
|
||||||
|
{
|
||||||
|
// This does not work, i.e., it does not really change the cell set for the DataSet
|
||||||
|
ds_it->GetCellSet().CastAndCallForTypes<vtkm::cont::CellSetListStructured>(
|
||||||
|
[&globalPointDimensions, &ds_it](auto& css) {
|
||||||
|
typename std::remove_reference_t<decltype(css)>::SchedulingRangeType gpd;
|
||||||
|
for (vtkm::IdComponent d = 0; d < css.Dimension; ++d)
|
||||||
|
{
|
||||||
|
gpd[d] = globalPointDimensions[d];
|
||||||
|
}
|
||||||
|
css.SetGlobalPointDimensions(gpd);
|
||||||
|
// Why is the following necessary? Shouldn't it be sufficient to update the
|
||||||
|
// CellSet through the reference?
|
||||||
|
ds_it->SetCellSet(css);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
pds.PrintSummary(std::cout);
|
||||||
|
}
|
||||||
|
void ShiftLogicalOriginToZero(vtkm::cont::PartitionedDataSet& pds)
|
||||||
|
{
|
||||||
|
// Shift the logical origin (minimum of LocalPointIndexStart) to zero
|
||||||
|
// along each dimension
|
||||||
|
|
||||||
|
// Compute minimum global point index start for all data sets on this MPI rank
|
||||||
|
std::vector<vtkm::Id> minimumGlobalPointIndexStartThisRank;
|
||||||
|
using ds_const_iterator = vtkm::cont::PartitionedDataSet::const_iterator;
|
||||||
|
for (ds_const_iterator ds_it = pds.cbegin(); ds_it != pds.cend(); ++ds_it)
|
||||||
|
{
|
||||||
|
ds_it->GetCellSet().CastAndCallForTypes<vtkm::cont::CellSetListStructured>(
|
||||||
|
[&minimumGlobalPointIndexStartThisRank](const auto& css) {
|
||||||
|
minimumGlobalPointIndexStartThisRank.resize(css.Dimension,
|
||||||
|
std::numeric_limits<vtkm::Id>::max());
|
||||||
|
for (vtkm::IdComponent d = 0; d < css.Dimension; ++d)
|
||||||
|
{
|
||||||
|
minimumGlobalPointIndexStartThisRank[d] =
|
||||||
|
std::min(minimumGlobalPointIndexStartThisRank[d], css.GetGlobalPointIndexStart()[d]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform global reduction to find GlobalPointDimensions across all ranks
|
||||||
|
std::vector<vtkm::Id> minimumGlobalPointIndexStart;
|
||||||
|
auto comm = vtkm::cont::EnvironmentTracker::GetCommunicator();
|
||||||
|
vtkmdiy::mpi::all_reduce(comm,
|
||||||
|
minimumGlobalPointIndexStartThisRank,
|
||||||
|
minimumGlobalPointIndexStart,
|
||||||
|
vtkmdiy::mpi::minimum<vtkm::Id>{});
|
||||||
|
|
||||||
|
// Shift all cell sets so that minimum global point index start
|
||||||
|
// along each dimension is zero
|
||||||
|
using ds_iterator = vtkm::cont::PartitionedDataSet::iterator;
|
||||||
|
for (ds_iterator ds_it = pds.begin(); ds_it != pds.end(); ++ds_it)
|
||||||
|
{
|
||||||
|
// This does not work, i.e., it does not really change the cell set for the DataSet
|
||||||
|
ds_it->GetCellSet().CastAndCallForTypes<vtkm::cont::CellSetListStructured>(
|
||||||
|
[&minimumGlobalPointIndexStart, &ds_it](auto& css) {
|
||||||
|
auto pointIndexStart = css.GetGlobalPointIndexStart();
|
||||||
|
typename std::remove_reference_t<decltype(css)>::SchedulingRangeType shiftedPointIndexStart;
|
||||||
|
for (vtkm::IdComponent d = 0; d < css.Dimension; ++d)
|
||||||
|
{
|
||||||
|
shiftedPointIndexStart[d] = pointIndexStart[d] - minimumGlobalPointIndexStart[d];
|
||||||
|
}
|
||||||
|
css.SetGlobalPointIndexStart(shiftedPointIndexStart);
|
||||||
|
// Why is the following necessary? Shouldn't it be sufficient to update the
|
||||||
|
// CellSet through the reference?
|
||||||
|
ds_it->SetCellSet(css);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
//pds.PrintSummary(std::cout);
|
||||||
|
}
|
||||||
|
|
||||||
// Compute and render an isosurface for a uniform grid example
|
// Compute and render an isosurface for a uniform grid example
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
@ -652,6 +756,8 @@ int main(int argc, char* argv[])
|
|||||||
filter.SetActiveField("values");
|
filter.SetActiveField("values");
|
||||||
|
|
||||||
// Execute the contour tree analysis
|
// Execute the contour tree analysis
|
||||||
|
ShiftLogicalOriginToZero(useDataSet);
|
||||||
|
ComputeGlobalPointDimensions(useDataSet);
|
||||||
auto result = filter.Execute(useDataSet);
|
auto result = filter.Execute(useDataSet);
|
||||||
|
|
||||||
currTime = totalTime.GetElapsedTime();
|
currTime = totalTime.GetElapsedTime();
|
||||||
|
@ -346,7 +346,8 @@ bool read3DHDF5File(const int& mpi_rank,
|
|||||||
ds = dsb.Create(v_dims, v_origin, v_spacing);
|
ds = dsb.Create(v_dims, v_origin, v_spacing);
|
||||||
vtkm::cont::CellSetStructured<3> cs;
|
vtkm::cont::CellSetStructured<3> cs;
|
||||||
cs.SetPointDimensions(v_dims);
|
cs.SetPointDimensions(v_dims);
|
||||||
cs.SetGlobalPointDimensions(globalSize);
|
// NOTE: Comment out for test purposes
|
||||||
|
//cs.SetGlobalPointDimensions(globalSize);
|
||||||
cs.SetGlobalPointIndexStart(vtkm::Id3{ v_origin[0], v_origin[1], v_origin[2] });
|
cs.SetGlobalPointIndexStart(vtkm::Id3{ v_origin[0], v_origin[1], v_origin[2] });
|
||||||
ds.SetCellSet(cs);
|
ds.SetCellSet(cs);
|
||||||
|
|
||||||
@ -587,7 +588,8 @@ bool readPreSplitFiles(const int& rank,
|
|||||||
ds = dsb.Create(v_dims, v_origin, v_spacing);
|
ds = dsb.Create(v_dims, v_origin, v_spacing);
|
||||||
vtkm::cont::CellSetStructured<2> cs;
|
vtkm::cont::CellSetStructured<2> cs;
|
||||||
cs.SetPointDimensions(v_dims);
|
cs.SetPointDimensions(v_dims);
|
||||||
cs.SetGlobalPointDimensions(vtkm::Id2{ globalSize[0], globalSize[1] });
|
// NOTE: Comment out for test purposes
|
||||||
|
//cs.SetGlobalPointDimensions(vtkm::Id2{ globalSize[0], globalSize[1] });
|
||||||
cs.SetGlobalPointIndexStart(vtkm::Id2{ offset[0], offset[1] });
|
cs.SetGlobalPointIndexStart(vtkm::Id2{ offset[0], offset[1] });
|
||||||
ds.SetCellSet(cs);
|
ds.SetCellSet(cs);
|
||||||
}
|
}
|
||||||
@ -604,7 +606,8 @@ bool readPreSplitFiles(const int& rank,
|
|||||||
ds = dsb.Create(v_dims, v_origin, v_spacing);
|
ds = dsb.Create(v_dims, v_origin, v_spacing);
|
||||||
vtkm::cont::CellSetStructured<3> cs;
|
vtkm::cont::CellSetStructured<3> cs;
|
||||||
cs.SetPointDimensions(v_dims);
|
cs.SetPointDimensions(v_dims);
|
||||||
cs.SetGlobalPointDimensions(globalSize);
|
// NOTE: Comment out for test purposes
|
||||||
|
//cs.SetGlobalPointDimensions(globalSize);
|
||||||
cs.SetGlobalPointIndexStart(vtkm::Id3{ offset[0], offset[1], offset[2] });
|
cs.SetGlobalPointIndexStart(vtkm::Id3{ offset[0], offset[1], offset[2] });
|
||||||
ds.SetCellSet(cs);
|
ds.SetCellSet(cs);
|
||||||
}
|
}
|
||||||
@ -815,7 +818,8 @@ bool readSingleBlockFile(const int& rank,
|
|||||||
ds = dsb.Create(vdims, origin, spacing);
|
ds = dsb.Create(vdims, origin, spacing);
|
||||||
vtkm::cont::CellSetStructured<2> cs;
|
vtkm::cont::CellSetStructured<2> cs;
|
||||||
cs.SetPointDimensions(vdims);
|
cs.SetPointDimensions(vdims);
|
||||||
cs.SetGlobalPointDimensions(vtkm::Id2{ globalSize[0], globalSize[1] });
|
// NOTE: Comment out for test purposes
|
||||||
|
//cs.SetGlobalPointDimensions(vtkm::Id2{ globalSize[0], globalSize[1] });
|
||||||
cs.SetGlobalPointIndexStart(vtkm::Id2{ 0, (blockStart / blockSliceSize) });
|
cs.SetGlobalPointIndexStart(vtkm::Id2{ 0, (blockStart / blockSliceSize) });
|
||||||
ds.SetCellSet(cs);
|
ds.SetCellSet(cs);
|
||||||
localBlockIndicesPortal.Set(localBlockIndex, vtkm::Id3(0, blockIndex, 0));
|
localBlockIndicesPortal.Set(localBlockIndex, vtkm::Id3(0, blockIndex, 0));
|
||||||
@ -832,7 +836,8 @@ bool readSingleBlockFile(const int& rank,
|
|||||||
ds = dsb.Create(vdims, origin, spacing);
|
ds = dsb.Create(vdims, origin, spacing);
|
||||||
vtkm::cont::CellSetStructured<3> cs;
|
vtkm::cont::CellSetStructured<3> cs;
|
||||||
cs.SetPointDimensions(vdims);
|
cs.SetPointDimensions(vdims);
|
||||||
cs.SetGlobalPointDimensions(globalSize);
|
// NOTE: Comment out for test purposes
|
||||||
|
//cs.SetGlobalPointDimensions(globalSize);
|
||||||
cs.SetGlobalPointIndexStart(vtkm::Id3(0, 0, blockStart / blockSliceSize));
|
cs.SetGlobalPointIndexStart(vtkm::Id3(0, 0, blockStart / blockSliceSize));
|
||||||
ds.SetCellSet(cs);
|
ds.SetCellSet(cs);
|
||||||
localBlockIndicesPortal.Set(localBlockIndex, vtkm::Id3(0, 0, blockIndex));
|
localBlockIndicesPortal.Set(localBlockIndex, vtkm::Id3(0, 0, blockIndex));
|
||||||
|
@ -233,33 +233,56 @@ vtkm::cont::DataSet MakeTestDataSet::Make3DUniformDataSet1()
|
|||||||
constexpr vtkm::Id nVerts = 125;
|
constexpr vtkm::Id nVerts = 125;
|
||||||
constexpr vtkm::Id nCells = 64;
|
constexpr vtkm::Id nCells = 64;
|
||||||
constexpr vtkm::Float32 pointvar[nVerts] = {
|
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-4, 0, 0
|
||||||
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, 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,
|
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 1
|
||||||
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, 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, // 0-4, 3, 1
|
||||||
|
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 4, 1
|
||||||
|
|
||||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 75.0f, 50.0f, 65.0f, 0.0f, 0.0f, 55.0f, 15.0f,
|
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 2
|
||||||
45.0f, 0.0f, 0.0f, 60.0f, 40.0f, 70.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
0.0f, 75.0f, 50.0f, 65.0f, 0.0f, // 0-4, 1, 2
|
||||||
|
0.0f, 55.0f, 15.0f, 45.0f, 0.0f, // 0-4, 2, 2
|
||||||
|
0.0f, 60.0f, 40.0f, 70.0f, 0.0f, // 0-4, 3, 2
|
||||||
|
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 4, 2
|
||||||
|
|
||||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 97.0f, 87.0f, 82.0f, 0.0f, 0.0f, 92.0f, 77.0f,
|
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 0, 3
|
||||||
92.0f, 0.0f, 0.0f, 82.0f, 87.0f, 97.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
0.0f, 97.0f, 87.0f, 82.0f, 0.0f, // 0-4, 1, 3
|
||||||
|
0.0f, 92.0f, 77.0f, 92.0f, 0.0f, // 0-4, 2, 3
|
||||||
|
0.0f, 82.0f, 87.0f, 97.0f, 0.0f, // 0-4, 3, 3
|
||||||
|
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, // 0-4, 4, 3
|
||||||
|
|
||||||
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, 4
|
||||||
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, 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] = {
|
constexpr vtkm::Float32 cellvar[nCells] = {
|
||||||
0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f,
|
0.0f, 1.0f, 2.0f, 3.0f, // 0-3, 0, 0
|
||||||
8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f,
|
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,
|
16.0f, 17.0f, 18.0f, 19.0f, // 0-3, 0, 1
|
||||||
24.0f, 25.0f, 26.0f, 27.0f, 28.0f, 29.0f, 30.0f, 31.0f,
|
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,
|
32.0f, 33.0f, 34.0f, 35.0f, // 0-3, 0, 2
|
||||||
40.0f, 41.0f, 42.0f, 43.0f, 44.0f, 45.0f, 46.0f, 47.0f,
|
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,
|
48.0f, 49.0f, 50.0f, 51.0f, // 0-3, 0, 3
|
||||||
56.0f, 57.0f, 58.0f, 59.0f, 60.0f, 61.0f, 62.0f, 63.0f
|
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);
|
dataSet.AddPointField("pointvar", pointvar, nVerts);
|
||||||
|
@ -85,17 +85,23 @@ public:
|
|||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
void SetSampleRate(vtkm::Id3 sampleRate) { this->SampleRate = sampleRate; }
|
void SetSampleRate(vtkm::Id3 sampleRate) { this->SampleRate = sampleRate; }
|
||||||
|
|
||||||
// Get if we should include the outer boundary on a subsample
|
/// @brief Specifies if the outer boundary should always be included.
|
||||||
// (NOTE: This method is deprecated because it is not clear from either
|
///
|
||||||
// the documentation or the source code what the intention of this feature
|
/// When a subsample rate is specified, it is possible that some of the
|
||||||
// is. If your are using this method somewhere and think it should remain,
|
/// boundary samples will not be included in the sampling. If this is the
|
||||||
// please open a merge request to "de-deprecate" it and add a test and
|
/// case and `IncludeBoundary` is set to true, then an extra sample is
|
||||||
// documentation of the expected behavior.)
|
/// set in the output and the values on the boundary are included. For example,
|
||||||
VTKM_DEPRECATED(2.2)
|
/// 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
|
VTKM_CONT
|
||||||
bool GetIncludeBoundary() const { return this->IncludeBoundary; }
|
bool GetIncludeBoundary() const { return this->IncludeBoundary; }
|
||||||
// Set if we should include the outer boundary on a subsample
|
/// @copydoc GetIncludeBoundary
|
||||||
VTKM_DEPRECATED(2.2)
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
void SetIncludeBoundary(bool value) { this->IncludeBoundary = value; }
|
void SetIncludeBoundary(bool value) { this->IncludeBoundary = value; }
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ public:
|
|||||||
|
|
||||||
static void TestUniform3D7()
|
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::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
|
||||||
|
|
||||||
vtkm::filter::entity_extraction::ExtractStructured extract;
|
vtkm::filter::entity_extraction::ExtractStructured extract;
|
||||||
@ -351,6 +351,7 @@ public:
|
|||||||
vtkm::Id3 sample(3, 3, 2);
|
vtkm::Id3 sample(3, 3, 2);
|
||||||
extract.SetVOI(range);
|
extract.SetVOI(range);
|
||||||
extract.SetSampleRate(sample);
|
extract.SetSampleRate(sample);
|
||||||
|
extract.SetIncludeBoundary(false); // default
|
||||||
|
|
||||||
extract.SetFieldsToPass({ "pointvar", "cellvar" });
|
extract.SetFieldsToPass({ "pointvar", "cellvar" });
|
||||||
vtkm::cont::DataSet output = extract.Execute(dataset);
|
vtkm::cont::DataSet output = extract.Execute(dataset);
|
||||||
@ -371,16 +372,16 @@ public:
|
|||||||
"Data/Geometry mismatch for ExtractStructured filter");
|
"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(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(outPointData.ReadPortal().Get(7) == 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(0) == 16.0f, "Wrong cell field data");
|
||||||
}
|
}
|
||||||
|
|
||||||
VTKM_DEPRECATED_SUPPRESS_BEGIN
|
|
||||||
// This test repeates TestUniform3D7 but uses deprecated behavior.
|
|
||||||
static void TestUniform3D8()
|
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::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
|
||||||
vtkm::filter::entity_extraction::ExtractStructured extract;
|
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(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(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(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(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_TEST_ASSERT(outCellData.ReadPortal().Get(3) == 31.0f, "Wrong cell field data");
|
||||||
}
|
}
|
||||||
VTKM_DEPRECATED_SUPPRESS_END
|
|
||||||
|
|
||||||
static void TestRectilinear2D()
|
static void TestRectilinear2D()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user