mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
Getting there with ES
This commit is contained in:
parent
665f6ec4a8
commit
7d77059339
@ -219,96 +219,7 @@ public:
|
||||
// Verify input parameters
|
||||
vtkm::Vec<vtkm::Id, Dimensionality> ptdim(cellset.GetPointDimensions());
|
||||
vtkm::Vec<vtkm::Id, Dimensionality> offset_vec;
|
||||
vtkm::Vec<vtkm::Id, 6> voiSubset;
|
||||
//if(includeOffset)
|
||||
//{
|
||||
// offset_vec = cellset.GetGlobalPointIndexStart();
|
||||
// //ptdim[0] += offset_vec[0];
|
||||
// //ptdim[1] += offset_vec[1];
|
||||
// //if(Dimensionality == 3)
|
||||
// // ptdim[2] += offset_vec[2];
|
||||
//}
|
||||
voiSubset[0] = vtkm::Max(vtkm::Id(0), voi.X.Min);
|
||||
voiSubset[1] = vtkm::Min(this->InputDimensions[0], voi.X.Max);
|
||||
if (includeOffset)
|
||||
{
|
||||
offset_vec = cellset.GetGlobalPointIndexStart();
|
||||
if (voi.X.Min < offset_vec[0])
|
||||
{
|
||||
voiSubset[0] = offset_vec[0];
|
||||
}
|
||||
else if (voi.X.Min > offset_vec[0] && voi.X.Min < offset_vec[0] + ptdim[0])
|
||||
{
|
||||
voiSubset[0] = voi.X.Min;
|
||||
}
|
||||
if (voi.X.Max < offset_vec[0])
|
||||
{
|
||||
voiSubset[1] = offset_vec[0];
|
||||
}
|
||||
else if (voi.X.Max > offset_vec[0])
|
||||
{
|
||||
if (voi.X.Max > offset_vec[0] + ptdim[0])
|
||||
{
|
||||
voiSubset[1] = offset_vec[0] + ptdim[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
voiSubset[1] = voi.X.Max - offset_vec[0];
|
||||
}
|
||||
}
|
||||
if (Dimensionality >= 2)
|
||||
{
|
||||
if (voi.Y.Min < offset_vec[2])
|
||||
{
|
||||
voiSubset[2] = offset_vec[2];
|
||||
}
|
||||
else if (voi.Y.Min > offset_vec[2] && voi.Y.Min < offset_vec[2] + ptdim[1])
|
||||
{
|
||||
voiSubset[2] = voi.Y.Min;
|
||||
}
|
||||
if (voi.Y.Max < offset_vec[2])
|
||||
{
|
||||
voiSubset[3] = offset_vec[2];
|
||||
}
|
||||
else if (voi.Y.Max > offset_vec[2])
|
||||
{
|
||||
if (voi.Y.Max > offset_vec[2] + ptdim[1])
|
||||
{
|
||||
voiSubset[3] = offset_vec[2] + ptdim[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
voiSubset[3] = voi.Y.Max - offset_vec[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Dimensionality >= 3)
|
||||
{
|
||||
if (voi.Y.Min < offset_vec[4])
|
||||
{
|
||||
voiSubset[4] = offset_vec[4];
|
||||
}
|
||||
else if (voi.Y.Min > offset_vec[4] && voi.Y.Min < offset_vec[4] + ptdim[2])
|
||||
{
|
||||
voiSubset[4] = voi.Y.Min;
|
||||
}
|
||||
if (voi.Y.Max < offset_vec[4])
|
||||
{
|
||||
voiSubset[5] = offset_vec[4];
|
||||
}
|
||||
else if (voi.Y.Max > offset_vec[4])
|
||||
{
|
||||
if (voi.Y.Max > offset_vec[4] + ptdim[2])
|
||||
{
|
||||
voiSubset[5] = offset_vec[4] + ptdim[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
voiSubset[5] = voi.Y.Max - offset_vec[4];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->SampleRate = vtkm::Id3(sampleRate[0], 1, 1);
|
||||
this->InputDimensions = vtkm::Id3(ptdim[0], 1, 1);
|
||||
|
||||
@ -348,18 +259,37 @@ public:
|
||||
this->InputDimensionality = Dimensionality;
|
||||
|
||||
// intersect VOI
|
||||
//this->VOI.X.Min = vtkm::Max(vtkm::Id(0), voi.X.Min);
|
||||
//this->VOI.X.Max = vtkm::Min(this->InputDimensions[0], voi.X.Max);
|
||||
this->VOI.X.Min = voiSubset[0];
|
||||
this->VOI.X.Max = voiSubset[1];
|
||||
this->VOI.Y.Min = voiSubset[2];
|
||||
this->VOI.Y.Max = voiSubset[3];
|
||||
this->VOI.Z.Min = voiSubset[4];
|
||||
this->VOI.Z.Max = voiSubset[5];
|
||||
//this->VOI.Y.Min = vtkm::Max(vtkm::Id(0), voi.Y.Min);
|
||||
//this->VOI.Y.Max = vtkm::Min(this->InputDimensions[1], voi.Y.Max);
|
||||
//this->VOI.Z.Min = vtkm::Max(vtkm::Id(0), voi.Z.Min);
|
||||
//this->VOI.Z.Max = vtkm::Min(this->InputDimensions[2], voi.Z.Max);
|
||||
if (includeOffset)
|
||||
{
|
||||
offset_vec = cellset.GetGlobalPointIndexStart();
|
||||
if (voi.X.Min < offset_vec[0])
|
||||
this->VOI.X.Min = vtkm::Max(vtkm::Id(0), offset_vec[0]);
|
||||
if (voi.X.Max < offset_vec[0])
|
||||
this->VOI.X.Max = vtkm::Min(this->InputDimensions[0], offset_vec[0]);
|
||||
if (Dimensionality >= 2)
|
||||
{
|
||||
if (voi.Y.Min < offset_vec[1])
|
||||
this->VOI.Y.Min = vtkm::Max(vtkm::Id(0), offset_vec[1]);
|
||||
if (voi.Y.Max < offset_vec[1])
|
||||
this->VOI.Y.Max = vtkm::Min(this->InputDimensions[1], offset_vec[1]);
|
||||
if (Dimensionality == 3)
|
||||
{
|
||||
if (voi.Z.Min < offset_vec[2])
|
||||
this->VOI.Z.Min = vtkm::Max(vtkm::Id(0), offset_vec[2]);
|
||||
if (voi.Z.Max < offset_vec[2])
|
||||
this->VOI.Z.Max = vtkm::Min(this->InputDimensions[2], offset_vec[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // includeOffset = false
|
||||
{
|
||||
this->VOI.X.Min = vtkm::Max(vtkm::Id(0), voi.X.Min);
|
||||
this->VOI.X.Max = vtkm::Min(this->InputDimensions[0], voi.X.Max);
|
||||
this->VOI.Y.Min = vtkm::Max(vtkm::Id(0), voi.Y.Min);
|
||||
this->VOI.Y.Max = vtkm::Min(this->InputDimensions[1], voi.Y.Max);
|
||||
this->VOI.Z.Min = vtkm::Max(vtkm::Id(0), voi.Z.Min);
|
||||
this->VOI.Z.Max = vtkm::Min(this->InputDimensions[2], voi.Z.Max);
|
||||
}
|
||||
if (!this->VOI.IsNonEmpty()) // empty VOI
|
||||
{
|
||||
return DynamicCellSetStructured();
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
vtkm::RangeId3 range(1, 4, 1, 4, 0, 1);
|
||||
vtkm::Id3 sample(1, 1, 1);
|
||||
bool includeBoundary = false;
|
||||
bool includeOffset = true;
|
||||
bool includeOffset = false;
|
||||
|
||||
vtkm::worklet::ExtractStructured worklet;
|
||||
auto outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset);
|
||||
@ -71,7 +71,7 @@ public:
|
||||
vtkm::RangeId3 range0(1, 4, 1, 4, 1, 4);
|
||||
vtkm::Id3 sample(1, 1, 1);
|
||||
bool includeBoundary = false;
|
||||
bool includeOffset = true;
|
||||
bool includeOffset = false;
|
||||
|
||||
outCellSet = worklet.Run(cellSet, range0, sample, includeBoundary, includeOffset);
|
||||
VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfPoints(), 27),
|
||||
@ -137,8 +137,9 @@ public:
|
||||
vtkm::RangeId3 range0(0, 5, 0, 5, 1, 4);
|
||||
vtkm::Id3 sample0(2, 2, 1);
|
||||
bool includeBoundary0 = false;
|
||||
bool includeOffset = false;
|
||||
|
||||
outCellSet = worklet.Run(cellSet, range0, sample0, includeBoundary0, false);
|
||||
outCellSet = worklet.Run(cellSet, range0, sample0, includeBoundary0, includeOffset);
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfPoints(), 27),
|
||||
"Wrong result for ExtractStructured worklet");
|
||||
@ -150,7 +151,7 @@ public:
|
||||
vtkm::Id3 sample1(3, 3, 2);
|
||||
bool includeBoundary1 = false;
|
||||
|
||||
outCellSet = worklet.Run(cellSet, range1, sample1, includeBoundary1, false);
|
||||
outCellSet = worklet.Run(cellSet, range1, sample1, includeBoundary1, includeOffset);
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfPoints(), 8),
|
||||
"Wrong result for ExtractStructured worklet");
|
||||
@ -161,7 +162,6 @@ public:
|
||||
vtkm::RangeId3 range2(0, 5, 0, 5, 1, 4);
|
||||
vtkm::Id3 sample2(3, 3, 2);
|
||||
bool includeBoundary2 = true;
|
||||
bool includeOffset = true;
|
||||
|
||||
outCellSet = worklet.Run(cellSet, range2, sample2, includeBoundary2, includeOffset);
|
||||
|
||||
@ -234,7 +234,6 @@ public:
|
||||
dataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
|
||||
// RangeID3 and subsample
|
||||
//vtkm::RangeId3 range(0,2,0,2,0,2);
|
||||
vtkm::RangeId3 range(5, 15, 0, 10, 0, 10);
|
||||
vtkm::Id3 sample(1, 1, 1);
|
||||
vtkm::Id3 test_offset(1, 1, 1);
|
||||
@ -242,7 +241,7 @@ public:
|
||||
vtkm::Id3 no_offset(0, 0, 0);
|
||||
const vtkm::Int32 Dimensionality = 3;
|
||||
bool includeBoundary = false;
|
||||
bool includeOffset = true;
|
||||
bool includeOffset = false;
|
||||
cellSet.SetPointDimensions(vtkm::make_Vec(10, 0, 0));
|
||||
vtkm::Vec<vtkm::Id, Dimensionality> ptdim(cellSet.GetPointDimensions());
|
||||
|
||||
@ -253,11 +252,10 @@ public:
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), no_offset));
|
||||
|
||||
includeOffset = true;
|
||||
outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset);
|
||||
cellSet.SetGlobalPointIndexStart(test_offset);
|
||||
VTKM_TEST_ASSERT(test_equal(cellSet.GetPointDimensions(), test_offset));
|
||||
|
||||
//VTKM_TEST_ASSERT(test_equal(worklet.GetIncludeOffset(), includeOffset));
|
||||
//VTKM_TEST_ASSERT(test_equal(outCellSet.GetIncludeOffset(), false));
|
||||
}
|
||||
|
||||
void operator()() const
|
||||
|
Loading…
Reference in New Issue
Block a user