Revert from VOIIsGlobal to IncludeOffset. Add comment about deprecation reasoning.

This commit is contained in:
Gunther H. Weber 2023-03-09 13:20:07 -08:00 committed by Kenneth Moreland
parent 523c8f3f21
commit 7bea5413cf
3 changed files with 27 additions and 27 deletions

@ -74,7 +74,7 @@ vtkm::cont::DataSet ExtractStructured::DoExecute(const vtkm::cont::DataSet& inpu
this->VOI, this->VOI,
this->SampleRate, this->SampleRate,
this->IncludeBoundary, this->IncludeBoundary,
this->VOIIsGlobal); this->IncludeOffset);
// Create map arrays for mapping fields. Could potentially save some time to first check to see // Create map arrays for mapping fields. Could potentially save some time to first check to see
// if these arrays would be used. // if these arrays would be used.

@ -78,17 +78,16 @@ public:
VTKM_CONT VTKM_CONT
void SetIncludeBoundary(bool value) { this->IncludeBoundary = value; } void SetIncludeBoundary(bool value) { this->IncludeBoundary = value; }
/// Get if VOI is specified in global point (rather than in local) indices /// Set if VOI is specified in global (rather than in local) point indices
/// (NOTE: Depracted this method since this does not seem to work as
/// expected and there are no tests for it. Furthermore, neither VTK-m nor
/// VTK-h/Ascent seem to use this method. If your are using this method
/// somewhere else 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.1)
VTKM_CONT VTKM_CONT
bool GetVOIIsGlobal() const { return this->VOIIsGlobal; } void SetIncludeOffset(bool value) { this->IncludeOffset = value; }
/// Set if VOI is specified in global point (rather than in local) indices
VTKM_CONT
void SetVOIIsGlobal(bool value) { this->VOIIsGlobal = value; }
/// Set if VOI is specified in global point (rather than in local) indices
/// (depracted in favor of a method with a name that better conveys purpose)
VTKM_DEPRECATED(2.0)
VTKM_CONT
void SetIncludeOffset(bool value) { this->VOIIsGlobal = value; }
private: private:
VTKM_CONT VTKM_CONT
@ -97,7 +96,7 @@ private:
vtkm::RangeId3 VOI = vtkm::RangeId3(0, -1, 0, -1, 0, -1); vtkm::RangeId3 VOI = vtkm::RangeId3(0, -1, 0, -1, 0, -1);
vtkm::Id3 SampleRate = { 1, 1, 1 }; vtkm::Id3 SampleRate = { 1, 1, 1 };
bool IncludeBoundary = false; bool IncludeBoundary = false;
bool VOIIsGlobal = false; bool IncludeOffset = false;
}; };
} // namespace entity_extraction } // namespace entity_extraction

@ -203,7 +203,7 @@ public:
const vtkm::RangeId3& voi, const vtkm::RangeId3& voi,
const vtkm::Id3& sampleRate, const vtkm::Id3& sampleRate,
bool includeBoundary, bool includeBoundary,
bool voiIsGlobal) bool includeOffset)
{ {
vtkm::Id pdims = cellset.GetPointDimensions(); vtkm::Id pdims = cellset.GetPointDimensions();
vtkm::Id offsets = cellset.GetGlobalPointIndexStart(); vtkm::Id offsets = cellset.GetGlobalPointIndexStart();
@ -215,14 +215,14 @@ public:
voi, voi,
sampleRate, sampleRate,
includeBoundary, includeBoundary,
voiIsGlobal); includeOffset);
} }
inline UncertainCellSetStructured Run(const vtkm::cont::CellSetStructured<2>& cellset, inline UncertainCellSetStructured Run(const vtkm::cont::CellSetStructured<2>& cellset,
const vtkm::RangeId3& voi, const vtkm::RangeId3& voi,
const vtkm::Id3& sampleRate, const vtkm::Id3& sampleRate,
bool includeBoundary, bool includeBoundary,
bool voiIsGlobal) bool includeOffset)
{ {
vtkm::Id2 pdims = cellset.GetPointDimensions(); vtkm::Id2 pdims = cellset.GetPointDimensions();
vtkm::Id2 offsets = cellset.GetGlobalPointIndexStart(); vtkm::Id2 offsets = cellset.GetGlobalPointIndexStart();
@ -234,19 +234,20 @@ public:
voi, voi,
sampleRate, sampleRate,
includeBoundary, includeBoundary,
voiIsGlobal); includeOffset);
} }
inline UncertainCellSetStructured Run(const vtkm::cont::CellSetStructured<3>& cellset, inline UncertainCellSetStructured Run(const vtkm::cont::CellSetStructured<3>& cellset,
const vtkm::RangeId3& voi, const vtkm::RangeId3& voi,
const vtkm::Id3& sampleRate, const vtkm::Id3& sampleRate,
bool includeBoundary, bool includeBoundary,
bool voiIsGlobal) bool includeOffset)
{ {
vtkm::Id3 pdims = cellset.GetPointDimensions(); vtkm::Id3 pdims = cellset.GetPointDimensions();
vtkm::Id3 offsets = cellset.GetGlobalPointIndexStart(); vtkm::Id3 offsets = cellset.GetGlobalPointIndexStart();
vtkm::Id3 gpdims = cellset.GetGlobalPointDimensions(); vtkm::Id3 gpdims = cellset.GetGlobalPointDimensions();
return this->Compute(3, pdims, offsets, gpdims, voi, sampleRate, includeBoundary, voiIsGlobal); return this->Compute(
3, pdims, offsets, gpdims, voi, sampleRate, includeBoundary, includeOffset);
} }
UncertainCellSetStructured Compute(const int dimensionality, UncertainCellSetStructured Compute(const int dimensionality,
@ -256,7 +257,7 @@ public:
const vtkm::RangeId3& voi, const vtkm::RangeId3& voi,
const vtkm::Id3& sampleRate, const vtkm::Id3& sampleRate,
bool includeBoundary, bool includeBoundary,
bool voiIsGlobal) bool includeOffset)
{ {
// Verify input parameters // Verify input parameters
vtkm::Id3 offset_vec(0, 0, 0); vtkm::Id3 offset_vec(0, 0, 0);
@ -271,7 +272,7 @@ public:
{ {
throw vtkm::cont::ErrorBadValue("Bad sampling rate"); throw vtkm::cont::ErrorBadValue("Bad sampling rate");
} }
if (voiIsGlobal) if (includeOffset)
{ {
vtkm::Id3 tmpDims = ptdim; vtkm::Id3 tmpDims = ptdim;
offset_vec = offsets; offset_vec = offsets;
@ -338,7 +339,7 @@ public:
vtkm::Id3 empty = { 0, 0, 0 }; vtkm::Id3 empty = { 0, 0, 0 };
return MakeCellSetStructured(empty, empty, globalPointDimensions, dimensionality); return MakeCellSetStructured(empty, empty, globalPointDimensions, dimensionality);
} }
if (!voiIsGlobal) if (!includeOffset)
{ {
// compute output dimensions // compute output dimensions
this->OutputDimensions = vtkm::Id3(1, 1, 1); this->OutputDimensions = vtkm::Id3(1, 1, 1);
@ -395,13 +396,13 @@ private:
const vtkm::RangeId3& voi, const vtkm::RangeId3& voi,
const vtkm::Id3& sampleRate, const vtkm::Id3& sampleRate,
bool includeBoundary, bool includeBoundary,
bool voiIsGlobal, bool includeOffset,
UncertainCellSetStructured& output) UncertainCellSetStructured& output)
: Worklet(worklet) : Worklet(worklet)
, VOI(&voi) , VOI(&voi)
, SampleRate(&sampleRate) , SampleRate(&sampleRate)
, IncludeBoundary(includeBoundary) , IncludeBoundary(includeBoundary)
, VOIIsGlobal(voiIsGlobal) , IncludeOffset(includeOffset)
, Output(&output) , Output(&output)
{ {
} }
@ -410,7 +411,7 @@ private:
void operator()(const vtkm::cont::CellSetStructured<N>& cellset) const void operator()(const vtkm::cont::CellSetStructured<N>& cellset) const
{ {
*this->Output = this->Worklet->Run( *this->Output = this->Worklet->Run(
cellset, *this->VOI, *this->SampleRate, this->IncludeBoundary, this->VOIIsGlobal); cellset, *this->VOI, *this->SampleRate, this->IncludeBoundary, this->IncludeOffset);
} }
template <typename CellSetType> template <typename CellSetType>
@ -424,7 +425,7 @@ private:
const vtkm::RangeId3* VOI; const vtkm::RangeId3* VOI;
const vtkm::Id3* SampleRate; const vtkm::Id3* SampleRate;
bool IncludeBoundary; bool IncludeBoundary;
bool VOIIsGlobal; bool IncludeOffset;
UncertainCellSetStructured* Output; UncertainCellSetStructured* Output;
}; };
@ -434,10 +435,10 @@ public:
const vtkm::RangeId3& voi, const vtkm::RangeId3& voi,
const vtkm::Id3& sampleRate, const vtkm::Id3& sampleRate,
bool includeBoundary, bool includeBoundary,
bool voiIsGlobal) bool includeOffset)
{ {
UncertainCellSetStructured output; UncertainCellSetStructured output;
CallRun cr(this, voi, sampleRate, includeBoundary, voiIsGlobal, output); CallRun cr(this, voi, sampleRate, includeBoundary, includeOffset, output);
vtkm::cont::CastAndCall(cellset, cr); vtkm::cont::CastAndCall(cellset, cr);
return output; return output;
} }