mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
migrate Mask
tidy up language and library usage update benchmark
This commit is contained in:
parent
679f1b00e9
commit
e8278094f9
@ -193,7 +193,7 @@ void BenchThreshold(::benchmark::State& state)
|
||||
vtkm::Float64 quarter = range.Length() / 4.;
|
||||
vtkm::Float64 mid = range.Center();
|
||||
|
||||
vtkm::filter::Threshold filter;
|
||||
vtkm::filter::entity_extraction::Threshold filter;
|
||||
filter.SetActiveField(PointScalarsName, vtkm::cont::Field::Association::POINTS);
|
||||
filter.SetLowerThreshold(mid - quarter);
|
||||
filter.SetUpperThreshold(mid + quarter);
|
||||
|
@ -139,7 +139,6 @@ set(extra_header_template_sources
|
||||
ImageMedian.hxx
|
||||
Lagrangian.hxx
|
||||
LagrangianStructures.hxx
|
||||
Mask.hxx
|
||||
MeshQuality.hxx
|
||||
MIRFilter.hxx
|
||||
NDEntropy.hxx
|
||||
|
@ -7,57 +7,32 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_Mask_h
|
||||
#define vtk_m_filter_Mask_h
|
||||
|
||||
#include <vtkm/filter/FilterDataSet.h>
|
||||
#include <vtkm/worklet/Mask.h>
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/filter/entity_extraction/Mask.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
/// \brief Subselect cells using a stride
|
||||
///
|
||||
/// Extract only every Nth cell where N is equal to a stride value
|
||||
class Mask : public vtkm::filter::FilterDataSet<Mask>
|
||||
|
||||
VTKM_DEPRECATED(1.8, "Use vtkm/filter/entity_extraction/Mask.h instead of vtkm/filter/Mask.h.")
|
||||
inline void Mask_deprecated() {}
|
||||
|
||||
inline void Mask_deprecated_warning()
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
Mask();
|
||||
Mask_deprecated();
|
||||
}
|
||||
|
||||
// When CompactPoints is set, instead of copying the points and point fields
|
||||
// from the input, the filter will create new compact fields without the unused elements
|
||||
VTKM_CONT
|
||||
bool GetCompactPoints() const { return this->CompactPoints; }
|
||||
VTKM_CONT
|
||||
void SetCompactPoints(bool value) { this->CompactPoints = value; }
|
||||
|
||||
// Set the stride of the subsample
|
||||
VTKM_CONT
|
||||
vtkm::Id GetStride() const { return this->Stride; }
|
||||
VTKM_CONT
|
||||
void SetStride(vtkm::Id& stride) { this->Stride = stride; }
|
||||
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy> policy);
|
||||
|
||||
//Map a new field onto the resulting dataset after running the filter
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet& result,
|
||||
const vtkm::cont::Field& field,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy> policy);
|
||||
|
||||
private:
|
||||
vtkm::Id Stride;
|
||||
bool CompactPoints;
|
||||
vtkm::worklet::Mask Worklet;
|
||||
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::entity_extraction::Mask.") Mask
|
||||
: public vtkm::filter::entity_extraction::Mask
|
||||
{
|
||||
using entity_extraction::Mask::Mask;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#include <vtkm/filter/Mask.hxx>
|
||||
|
||||
#endif // vtk_m_filter_Mask_h
|
||||
#endif //vtk_m_filter_Mask_h
|
||||
|
@ -13,6 +13,7 @@ set(entity_extraction_headers
|
||||
ExtractPoints.h
|
||||
ExtractStructured.h
|
||||
GhostCellRemove.h
|
||||
Mask.h
|
||||
MaskPoints.h
|
||||
Threshold.h
|
||||
ThresholdPoints.h
|
||||
@ -23,6 +24,7 @@ set(entity_extraction_sources_device
|
||||
ExtractPoints.cxx
|
||||
ExtractStructured.cxx
|
||||
GhostCellRemove.cxx
|
||||
Mask.cxx
|
||||
MaskPoints.cxx
|
||||
Threshold.cxx
|
||||
ThresholdPoints.cxx
|
||||
|
@ -46,7 +46,8 @@ vtkm::cont::DataSet ExternalFaces::GenerateOutput(const vtkm::cont::DataSet& inp
|
||||
bool hasCellFields = false;
|
||||
for (vtkm::Id fieldIdx = 0; fieldIdx < numFields && !hasCellFields; ++fieldIdx)
|
||||
{
|
||||
hasCellFields = input.GetField(fieldIdx).IsFieldCell();
|
||||
const auto& f = input.GetField(fieldIdx);
|
||||
hasCellFields = f.IsFieldCell();
|
||||
}
|
||||
|
||||
if (!hasCellFields)
|
||||
|
@ -36,7 +36,7 @@ class VTKM_FILTER_ENTITY_EXTRACTION_EXPORT ExternalFaces : public vtkm::filter::
|
||||
{
|
||||
public:
|
||||
ExternalFaces();
|
||||
~ExternalFaces();
|
||||
~ExternalFaces() override;
|
||||
|
||||
// New Design: I am too lazy to make this filter thread-safe. Let's use it as an example of
|
||||
// thread un-safe filter.
|
||||
|
@ -117,7 +117,7 @@ vtkm::cont::DataSet ExtractGeometry::DoExecute(const vtkm::cont::DataSet& input)
|
||||
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
|
||||
output.SetCellSet(outCells);
|
||||
|
||||
auto mapper = [&, this](auto& result, const auto& f) { DoMapField(result, f, Worklet); };
|
||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, Worklet); };
|
||||
MapFieldsOntoOutput(input, output, mapper);
|
||||
|
||||
return output;
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
const vtkm::ImplicitFunctionGeneral& GetImplicitFunction() const { return this->Function; }
|
||||
|
||||
VTKM_CONT
|
||||
bool GetExtractInside() { return this->ExtractInside; }
|
||||
bool GetExtractInside() const { return this->ExtractInside; }
|
||||
VTKM_CONT
|
||||
void SetExtractInside(bool value) { this->ExtractInside = value; }
|
||||
VTKM_CONT
|
||||
@ -60,7 +60,7 @@ public:
|
||||
void ExtractInsideOff() { this->ExtractInside = false; }
|
||||
|
||||
VTKM_CONT
|
||||
bool GetExtractBoundaryCells() { return this->ExtractBoundaryCells; }
|
||||
bool GetExtractBoundaryCells() const { return this->ExtractBoundaryCells; }
|
||||
VTKM_CONT
|
||||
void SetExtractBoundaryCells(bool value) { this->ExtractBoundaryCells = value; }
|
||||
VTKM_CONT
|
||||
@ -69,7 +69,7 @@ public:
|
||||
void ExtractBoundaryCellsOff() { this->ExtractBoundaryCells = false; }
|
||||
|
||||
VTKM_CONT
|
||||
bool GetExtractOnlyBoundaryCells() { return this->ExtractOnlyBoundaryCells; }
|
||||
bool GetExtractOnlyBoundaryCells() const { return this->ExtractOnlyBoundaryCells; }
|
||||
VTKM_CONT
|
||||
void SetExtractOnlyBoundaryCells(bool value) { this->ExtractOnlyBoundaryCells = value; }
|
||||
VTKM_CONT
|
||||
|
@ -13,10 +13,6 @@
|
||||
#include <vtkm/filter/entity_extraction/ExtractPoints.h>
|
||||
#include <vtkm/filter/entity_extraction/worklet/ExtractPoints.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace
|
||||
{
|
||||
bool DoMapField(vtkm::cont::DataSet& result, const vtkm::cont::Field& field)
|
||||
@ -38,7 +34,12 @@ bool DoMapField(vtkm::cont::DataSet& result, const vtkm::cont::Field& field)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace entity_extraction
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -62,7 +63,7 @@ vtkm::cont::DataSet ExtractPoints::DoExecute(const vtkm::cont::DataSet& input)
|
||||
output.SetCellSet(outCellSet);
|
||||
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
|
||||
|
||||
auto mapper = [&, this](auto& result, const auto& f) { DoMapField(result, f); };
|
||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f); };
|
||||
this->MapFieldsOntoOutput(input, output, mapper);
|
||||
|
||||
// compact the unused points in the output dataset
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
const vtkm::ImplicitFunctionGeneral& GetImplicitFunction() const { return this->Function; }
|
||||
|
||||
VTKM_CONT
|
||||
bool GetExtractInside() { return this->ExtractInside; }
|
||||
bool GetExtractInside() const { return this->ExtractInside; }
|
||||
VTKM_CONT
|
||||
void SetExtractInside(bool value) { this->ExtractInside = value; }
|
||||
VTKM_CONT
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include <vtkm/filter/MapFieldPermutation.h>
|
||||
#include <vtkm/filter/entity_extraction/ExtractStructured.h>
|
||||
|
||||
#include <vtkm/filter/entity_extraction/worklet/ExtractStructured.h>
|
||||
|
||||
namespace vtkm
|
||||
@ -75,7 +74,7 @@ vtkm::cont::DataSet ExtractStructured::DoExecute(const vtkm::cont::DataSet& inpu
|
||||
auto PointFieldMap =
|
||||
Worklet.ProcessPointField(vtkm::cont::ArrayHandleIndex(input.GetNumberOfPoints()));
|
||||
|
||||
auto mapper = [&, this](auto& result, const auto& f) {
|
||||
auto mapper = [&](auto& result, const auto& f) {
|
||||
DoMapField(result, f, CellFieldMap, PointFieldMap);
|
||||
};
|
||||
MapFieldsOntoOutput(input, output, mapper);
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
|
||||
/// Get if we should include the outer boundary on a subsample
|
||||
VTKM_CONT
|
||||
bool GetIncludeBoundary() { return this->IncludeBoundary; }
|
||||
bool GetIncludeBoundary() const { return this->IncludeBoundary; }
|
||||
/// Set if we should include the outer boundary on a subsample
|
||||
VTKM_CONT
|
||||
void SetIncludeBoundary(bool value) { this->IncludeBoundary = value; }
|
||||
|
@ -24,7 +24,7 @@ class RemoveAllGhosts
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
RemoveAllGhosts() {}
|
||||
RemoveAllGhosts() = default;
|
||||
|
||||
VTKM_EXEC bool operator()(const vtkm::UInt8& value) const { return (value == 0); }
|
||||
};
|
||||
@ -39,7 +39,7 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
RemoveGhostByType(const vtkm::UInt8& val)
|
||||
explicit RemoveGhostByType(const vtkm::UInt8& val)
|
||||
: RemoveType(static_cast<vtkm::UInt8>(~val))
|
||||
{
|
||||
}
|
||||
@ -378,7 +378,7 @@ VTKM_CONT vtkm::cont::DataSet GhostCellRemove::DoExecute(const vtkm::cont::DataS
|
||||
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
|
||||
output.SetCellSet(cellOut);
|
||||
|
||||
auto mapper = [&, this](auto& result, const auto& f) { DoMapField(result, f, Worklet); };
|
||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, Worklet); };
|
||||
MapFieldsOntoOutput(input, output, mapper);
|
||||
|
||||
return output;
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
this->RemoveVals = vals;
|
||||
}
|
||||
VTKM_CONT
|
||||
bool GetRemoveGhostField() { return this->RemoveField; }
|
||||
bool GetRemoveGhostField() const { return this->RemoveField; }
|
||||
VTKM_CONT
|
||||
bool GetRemoveAllGhost() const { return this->RemoveAll; }
|
||||
|
||||
|
@ -7,11 +7,14 @@
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_filter_Mask_hxx
|
||||
#define vtk_m_filter_Mask_hxx
|
||||
|
||||
#include <vtkm/filter/MapFieldPermutation.h>
|
||||
#include <vtkm/filter/entity_extraction/Mask.h>
|
||||
#include <vtkm/filter/entity_extraction/worklet/Mask.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -35,43 +38,9 @@ struct CallWorklet
|
||||
}
|
||||
};
|
||||
|
||||
} // end anon namespace
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT Mask::Mask()
|
||||
: vtkm::filter::FilterDataSet<Mask>()
|
||||
, Stride(1)
|
||||
, CompactPoints(false)
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::DataSet Mask::DoExecute(const vtkm::cont::DataSet& input,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy> policy)
|
||||
{
|
||||
const vtkm::cont::UnknownCellSet& cells = input.GetCellSet();
|
||||
vtkm::cont::UnknownCellSet cellOut;
|
||||
CallWorklet workletCaller(this->Stride, cellOut, this->Worklet);
|
||||
vtkm::filter::ApplyPolicyCellSet(cells, policy, *this).CastAndCall(workletCaller);
|
||||
|
||||
// create the output dataset
|
||||
vtkm::cont::DataSet output;
|
||||
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
|
||||
output.SetCellSet(cellOut);
|
||||
return output;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename DerivedPolicy>
|
||||
inline VTKM_CONT bool Mask::MapFieldOntoOutput(vtkm::cont::DataSet& result,
|
||||
const vtkm::cont::Field& field,
|
||||
vtkm::filter::PolicyBase<DerivedPolicy>)
|
||||
VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
|
||||
const vtkm::cont::Field& field,
|
||||
const vtkm::worklet::Mask& Worklet)
|
||||
{
|
||||
if (field.IsFieldPoint() || field.IsFieldGlobal())
|
||||
{
|
||||
@ -80,13 +49,37 @@ inline VTKM_CONT bool Mask::MapFieldOntoOutput(vtkm::cont::DataSet& result,
|
||||
}
|
||||
else if (field.IsFieldCell())
|
||||
{
|
||||
return vtkm::filter::MapFieldPermutation(field, this->Worklet.GetValidCellIds(), result);
|
||||
return vtkm::filter::MapFieldPermutation(field, Worklet.GetValidCellIds(), result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // end anon namespace
|
||||
|
||||
namespace entity_extraction
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
VTKM_CONT vtkm::cont::DataSet Mask::DoExecute(const vtkm::cont::DataSet& input)
|
||||
{
|
||||
const vtkm::cont::UnknownCellSet& cells = input.GetCellSet();
|
||||
vtkm::cont::UnknownCellSet cellOut;
|
||||
vtkm::worklet::Mask Worklet;
|
||||
|
||||
CallWorklet workletCaller(this->Stride, cellOut, Worklet);
|
||||
cells.CastAndCallForTypes<VTKM_DEFAULT_CELL_SET_LIST>(workletCaller);
|
||||
|
||||
// create the output dataset
|
||||
vtkm::cont::DataSet output;
|
||||
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
|
||||
output.SetCellSet(cellOut);
|
||||
|
||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, Worklet); };
|
||||
MapFieldsOntoOutput(input, output, mapper);
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // namespace entity_extraction
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
53
vtkm/filter/entity_extraction/Mask.h
Normal file
53
vtkm/filter/entity_extraction/Mask.h
Normal file
@ -0,0 +1,53 @@
|
||||
//============================================================================
|
||||
// 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_Mask_h
|
||||
#define vtk_m_filter_Mask_h
|
||||
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/entity_extraction/vtkm_filter_entity_extraction_export.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace entity_extraction
|
||||
{
|
||||
/// \brief Subselect cells using a stride
|
||||
///
|
||||
/// Extract only every Nth cell where N is equal to a stride value
|
||||
class VTKM_FILTER_ENTITY_EXTRACTION_EXPORT Mask : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
// When CompactPoints is set, instead of copying the points and point fields
|
||||
// from the input, the filter will create new compact fields without the unused elements
|
||||
VTKM_CONT
|
||||
bool GetCompactPoints() const { return this->CompactPoints; }
|
||||
VTKM_CONT
|
||||
void SetCompactPoints(bool value) { this->CompactPoints = value; }
|
||||
|
||||
// Set the stride of the subsample
|
||||
VTKM_CONT
|
||||
vtkm::Id GetStride() const { return this->Stride; }
|
||||
VTKM_CONT
|
||||
void SetStride(vtkm::Id& stride) { this->Stride = stride; }
|
||||
|
||||
private:
|
||||
VTKM_CONT
|
||||
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
|
||||
|
||||
vtkm::Id Stride = 1;
|
||||
bool CompactPoints = false;
|
||||
};
|
||||
} // namespace entity_extraction
|
||||
} // namespace filter
|
||||
} // namespace vtk
|
||||
|
||||
#endif // vtk_m_filter_Mask_h
|
@ -59,7 +59,7 @@ VTKM_CONT vtkm::cont::DataSet MaskPoints::DoExecute(const vtkm::cont::DataSet& i
|
||||
output.SetCellSet(outCellSet);
|
||||
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
|
||||
|
||||
auto mapper = [&, this](auto& result, const auto& f) { DoMapField(result, f); };
|
||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f); };
|
||||
this->MapFieldsOntoOutput(input, output, mapper);
|
||||
|
||||
// compact the unused points in the output dataset
|
||||
|
@ -101,7 +101,7 @@ vtkm::cont::DataSet Threshold::DoExecute(const vtkm::cont::DataSet& input)
|
||||
output.SetCellSet(cellOut);
|
||||
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
|
||||
|
||||
auto mapper = [&, this](auto& result, const auto& f) { DoMapField(result, f, Worklet); };
|
||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, Worklet); };
|
||||
MapFieldsOntoOutput(input, output, mapper);
|
||||
|
||||
return output;
|
||||
|
@ -19,7 +19,7 @@ class ValuesBelow
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
ValuesBelow(const vtkm::Float64& value)
|
||||
explicit ValuesBelow(const vtkm::Float64& value)
|
||||
: Value(value)
|
||||
{
|
||||
}
|
||||
@ -39,7 +39,7 @@ class ValuesAbove
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
ValuesAbove(const vtkm::Float64& value)
|
||||
explicit ValuesAbove(const vtkm::Float64& value)
|
||||
: Value(value)
|
||||
{
|
||||
}
|
||||
@ -178,7 +178,7 @@ VTKM_CONT vtkm::cont::DataSet ThresholdPoints::DoExecute(const vtkm::cont::DataS
|
||||
output.SetCellSet(outCellSet);
|
||||
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
|
||||
|
||||
auto mapper = [&, this](auto& result, const auto& f) { DoMapField(result, f); };
|
||||
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f); };
|
||||
this->MapFieldsOntoOutput(input, output, mapper);
|
||||
|
||||
// compact the unused points in the output dataset
|
||||
|
@ -41,11 +41,11 @@ public:
|
||||
void SetUpperThreshold(vtkm::Float64 value) { this->UpperValue = value; }
|
||||
|
||||
VTKM_CONT
|
||||
void SetThresholdBelow(const vtkm::Float64 value);
|
||||
void SetThresholdBelow(vtkm::Float64 value);
|
||||
VTKM_CONT
|
||||
void SetThresholdAbove(const vtkm::Float64 value);
|
||||
void SetThresholdAbove(vtkm::Float64 value);
|
||||
VTKM_CONT
|
||||
void SetThresholdBetween(const vtkm::Float64 value1, const vtkm::Float64 value2);
|
||||
void SetThresholdBetween(vtkm::Float64 value1, vtkm::Float64 value2);
|
||||
|
||||
private:
|
||||
VTKM_CONT
|
||||
|
@ -14,6 +14,7 @@ set(unit_tests
|
||||
UnitTestExtractPointsFilter.cxx
|
||||
UnitTestExtractStructuredFilter.cxx
|
||||
UnitTestGhostCellRemove.cxx
|
||||
UnitTestMaskFilter.cxx
|
||||
UnitTestMaskPointsFilter.cxx
|
||||
UnitTestThresholdFilter.cxx
|
||||
UnitTestThresholdPointsFilter.cxx
|
||||
|
@ -19,11 +19,11 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
static vtkm::cont::ArrayHandle<vtkm::UInt8> StructuredGhostCellArray(vtkm::Id nx,
|
||||
vtkm::Id ny,
|
||||
vtkm::Id nz,
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
vtkm::cont::ArrayHandle<vtkm::UInt8> StructuredGhostCellArray(vtkm::Id nx,
|
||||
vtkm::Id ny,
|
||||
vtkm::Id nz,
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
{
|
||||
vtkm::Id numCells = nx * ny;
|
||||
if (nz > 0)
|
||||
@ -80,19 +80,18 @@ static vtkm::cont::ArrayHandle<vtkm::UInt8> StructuredGhostCellArray(vtkm::Id nx
|
||||
return ghosts;
|
||||
}
|
||||
|
||||
static vtkm::cont::DataSet MakeUniform(vtkm::Id numI,
|
||||
vtkm::Id numJ,
|
||||
vtkm::Id numK,
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
vtkm::cont::DataSet MakeUniform(vtkm::Id numI,
|
||||
vtkm::Id numJ,
|
||||
vtkm::Id numK,
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
{
|
||||
vtkm::cont::DataSetBuilderUniform dsb;
|
||||
vtkm::cont::DataSet ds;
|
||||
|
||||
if (numK == 0)
|
||||
ds = dsb.Create(vtkm::Id2(numI + 1, numJ + 1));
|
||||
ds = vtkm::cont::DataSetBuilderUniform::Create(vtkm::Id2(numI + 1, numJ + 1));
|
||||
else
|
||||
ds = dsb.Create(vtkm::Id3(numI + 1, numJ + 1, numK + 1));
|
||||
ds = vtkm::cont::DataSetBuilderUniform::Create(vtkm::Id3(numI + 1, numJ + 1, numK + 1));
|
||||
auto ghosts = StructuredGhostCellArray(numI, numJ, numK, numLayers, addMidGhost);
|
||||
|
||||
ds.AddCellField("vtkmGhostCells", ghosts);
|
||||
@ -100,13 +99,12 @@ static vtkm::cont::DataSet MakeUniform(vtkm::Id numI,
|
||||
return ds;
|
||||
}
|
||||
|
||||
static vtkm::cont::DataSet MakeRectilinear(vtkm::Id numI,
|
||||
vtkm::Id numJ,
|
||||
vtkm::Id numK,
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
vtkm::cont::DataSet MakeRectilinear(vtkm::Id numI,
|
||||
vtkm::Id numJ,
|
||||
vtkm::Id numK,
|
||||
int numLayers,
|
||||
bool addMidGhost = false)
|
||||
{
|
||||
vtkm::cont::DataSetBuilderRectilinear dsb;
|
||||
vtkm::cont::DataSet ds;
|
||||
std::size_t nx(static_cast<std::size_t>(numI + 1));
|
||||
std::size_t ny(static_cast<std::size_t>(numJ + 1));
|
||||
@ -118,14 +116,14 @@ static vtkm::cont::DataSet MakeRectilinear(vtkm::Id numI,
|
||||
y[i] = static_cast<float>(i);
|
||||
|
||||
if (numK == 0)
|
||||
ds = dsb.Create(x, y);
|
||||
ds = vtkm::cont::DataSetBuilderRectilinear::Create(x, y);
|
||||
else
|
||||
{
|
||||
std::size_t nz(static_cast<std::size_t>(numK + 1));
|
||||
std::vector<float> z(nz);
|
||||
for (std::size_t i = 0; i < nz; i++)
|
||||
z[i] = static_cast<float>(i);
|
||||
ds = dsb.Create(x, y, z);
|
||||
ds = vtkm::cont::DataSetBuilderRectilinear::Create(x, y, z);
|
||||
}
|
||||
|
||||
auto ghosts = StructuredGhostCellArray(numI, numJ, numK, numLayers, addMidGhost);
|
||||
@ -166,7 +164,7 @@ static void MakeExplicitCells(const CellSetType& cellSet,
|
||||
}
|
||||
}
|
||||
|
||||
static vtkm::cont::DataSet MakeExplicit(vtkm::Id numI, vtkm::Id numJ, vtkm::Id numK, int numLayers)
|
||||
vtkm::cont::DataSet MakeExplicit(vtkm::Id numI, vtkm::Id numJ, vtkm::Id numK, int numLayers)
|
||||
{
|
||||
using CoordType = vtkm::Vec3f_32;
|
||||
|
||||
@ -187,21 +185,22 @@ static vtkm::cont::DataSet MakeExplicit(vtkm::Id numI, vtkm::Id numJ, vtkm::Id n
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices;
|
||||
vtkm::cont::ArrayHandle<vtkm::UInt8> shapes;
|
||||
vtkm::cont::DataSet ds;
|
||||
vtkm::cont::DataSetBuilderExplicit dsb;
|
||||
|
||||
if (cellSet.IsType<vtkm::cont::CellSetStructured<2>>())
|
||||
{
|
||||
vtkm::Id2 dims(numI, numJ);
|
||||
MakeExplicitCells(
|
||||
cellSet.AsCellSet<vtkm::cont::CellSetStructured<2>>(), dims, numIndices, shapes, conn);
|
||||
ds = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates");
|
||||
ds = vtkm::cont::DataSetBuilderExplicit::Create(
|
||||
explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates");
|
||||
}
|
||||
else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>())
|
||||
{
|
||||
vtkm::Id3 dims(numI, numJ, numK);
|
||||
MakeExplicitCells(
|
||||
cellSet.AsCellSet<vtkm::cont::CellSetStructured<3>>(), dims, numIndices, shapes, conn);
|
||||
ds = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates");
|
||||
ds = vtkm::cont::DataSetBuilderExplicit::Create(
|
||||
explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates");
|
||||
}
|
||||
|
||||
auto ghosts = StructuredGhostCellArray(numI, numJ, numK, numLayers);
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <vtkm/filter/Mask.h>
|
||||
#include <vtkm/filter/entity_extraction/Mask.h>
|
||||
|
||||
using vtkm::cont::testing::MakeTestDataSet;
|
||||
|
||||
@ -27,7 +27,7 @@ public:
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet1();
|
||||
|
||||
// Setup and run filter to extract by stride
|
||||
vtkm::filter::Mask mask;
|
||||
vtkm::filter::entity_extraction::Mask mask;
|
||||
vtkm::Id stride = 2;
|
||||
mask.SetStride(stride);
|
||||
|
||||
@ -50,7 +50,7 @@ public:
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
|
||||
|
||||
// Setup and run filter to extract by stride
|
||||
vtkm::filter::Mask mask;
|
||||
vtkm::filter::entity_extraction::Mask mask;
|
||||
vtkm::Id stride = 9;
|
||||
mask.SetStride(stride);
|
||||
|
||||
@ -71,7 +71,7 @@ public:
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5();
|
||||
|
||||
// Setup and run filter to extract by stride
|
||||
vtkm::filter::Mask mask;
|
||||
vtkm::filter::entity_extraction::Mask mask;
|
||||
vtkm::Id stride = 2;
|
||||
mask.SetStride(stride);
|
||||
|
@ -13,6 +13,7 @@ set(headers
|
||||
ExtractGeometry.h
|
||||
ExtractStructured.h
|
||||
ExtractPoints.h
|
||||
Mask.h
|
||||
MaskPoints.h
|
||||
Threshold.h
|
||||
ThresholdPoints.h
|
||||
|
@ -10,7 +10,6 @@
|
||||
#ifndef vtkm_m_worklet_ExtractGeometry_h
|
||||
#define vtkm_m_worklet_ExtractGeometry_h
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
#include <vtkm/cont/Algorithm.h>
|
||||
@ -18,7 +17,7 @@
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/CellSetPermutation.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
#include <vtkm/cont/UnknownCellSet.h>
|
||||
|
||||
#include <vtkm/ImplicitFunction.h>
|
||||
@ -144,8 +143,8 @@ public:
|
||||
vtkm::cont::ArrayHandle<bool> passFlags;
|
||||
|
||||
ExtractCellsByVOI worklet(extractInside, extractBoundaryCells, extractOnlyBoundaryCells);
|
||||
DispatcherMapTopology<ExtractCellsByVOI> dispatcher(worklet);
|
||||
dispatcher.Invoke(cellSet, coordinates, implicitFunction, passFlags);
|
||||
vtkm::cont::Invoker invoke;
|
||||
invoke(worklet, cellSet, coordinates, implicitFunction, passFlags);
|
||||
|
||||
vtkm::cont::ArrayHandleCounting<vtkm::Id> indices =
|
||||
vtkm::cont::make_ArrayHandleCounting(vtkm::Id(0), vtkm::Id(1), passFlags.GetNumberOfValues());
|
||||
|
@ -10,17 +10,16 @@
|
||||
#ifndef vtkm_m_worklet_ExtractPoints_h
|
||||
#define vtkm_m_worklet_ExtractPoints_h
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
#include <vtkm/cont/Algorithm.h>
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
|
||||
#include <vtkm/ImplicitFunction.h>
|
||||
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace worklet
|
||||
@ -41,7 +40,7 @@ public:
|
||||
using ExecutionSignature = _4(_2, _3);
|
||||
|
||||
VTKM_CONT
|
||||
ExtractPointsByVOI(bool extractInside)
|
||||
explicit ExtractPointsByVOI(bool extractInside)
|
||||
: passValue(extractInside)
|
||||
, failValue(!extractInside)
|
||||
{
|
||||
@ -93,8 +92,8 @@ public:
|
||||
vtkm::cont::ArrayHandle<bool> passFlags;
|
||||
|
||||
ExtractPointsByVOI worklet(extractInside);
|
||||
DispatcherMapTopology<ExtractPointsByVOI> dispatcher(worklet);
|
||||
dispatcher.Invoke(cellSet, coordinates, implicitFunction, passFlags);
|
||||
vtkm::cont::Invoker invoke;
|
||||
invoke(worklet, cellSet, coordinates, implicitFunction, passFlags);
|
||||
|
||||
vtkm::cont::ArrayHandleCounting<vtkm::Id> indices =
|
||||
vtkm::cont::make_ArrayHandleCounting(vtkm::Id(0), vtkm::Id(1), passFlags.GetNumberOfValues());
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <vtkm/cont/CellSetList.h>
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
#include <vtkm/cont/UncertainCellSet.h>
|
||||
#include <vtkm/cont/UnknownArrayHandle.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
@ -73,7 +74,7 @@ struct ExtractCopy : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
using ControlSignature = void(FieldIn, FieldOut, WholeArrayIn);
|
||||
|
||||
ExtractCopy(const vtkm::Id3& dim)
|
||||
explicit ExtractCopy(const vtkm::Id3& dim)
|
||||
: XDim(dim[0])
|
||||
, XYDim(dim[0] * dim[1])
|
||||
{
|
||||
@ -178,7 +179,7 @@ private:
|
||||
return outCs;
|
||||
}
|
||||
default:
|
||||
return UncertainCellSetStructured();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@ -438,7 +439,7 @@ private:
|
||||
inOrigin[2] + static_cast<ValueType>(this->VOI.Z.Min) * inSpacing[2]);
|
||||
CoordType outSpacing = inSpacing * static_cast<CoordType>(this->SampleRate);
|
||||
|
||||
return CoordsArray(this->OutputDimensions, outOrigin, outSpacing);
|
||||
return { this->OutputDimensions, outOrigin, outSpacing };
|
||||
}
|
||||
|
||||
RectilinearCoordinatesArrayHandle MapCoordinatesRectilinear(
|
||||
@ -522,8 +523,8 @@ public:
|
||||
result.Allocate(this->ValidPoints.GetNumberOfValues());
|
||||
|
||||
ExtractCopy worklet(this->InputDimensions);
|
||||
DispatcherMapField<ExtractCopy> dispatcher(worklet);
|
||||
dispatcher.Invoke(this->ValidPoints, result, field);
|
||||
vtkm::cont::Invoker invoke;
|
||||
invoke(worklet, this->ValidPoints, result, field);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -538,8 +539,8 @@ public:
|
||||
|
||||
auto inputCellDimensions = this->InputDimensions - vtkm::Id3(1);
|
||||
ExtractCopy worklet(inputCellDimensions);
|
||||
DispatcherMapField<ExtractCopy> dispatcher(worklet);
|
||||
dispatcher.Invoke(this->ValidCells, result, field);
|
||||
vtkm::cont::Invoker invoke;
|
||||
invoke(worklet, this->ValidCells, result, field);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
#ifndef vtkm_m_worklet_Mask_h
|
||||
#define vtkm_m_worklet_Mask_h
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
@ -18,7 +17,6 @@
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/ArrayHandlePermutation.h>
|
||||
#include <vtkm/cont/CellSetPermutation.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
@ -13,7 +13,6 @@
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
@ -15,10 +15,8 @@
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
#include <vtkm/cont/Algorithm.h>
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/ArrayHandlePermutation.h>
|
||||
#include <vtkm/cont/CellSetPermutation.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/UncertainCellSet.h>
|
||||
|
@ -10,12 +10,11 @@
|
||||
#ifndef vtkm_m_worklet_ThresholdPoints_h
|
||||
#define vtkm_m_worklet_ThresholdPoints_h
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
#include <vtkm/cont/Algorithm.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -64,8 +63,8 @@ public:
|
||||
using ThresholdWorklet = ThresholdPointField<UnaryPredicate>;
|
||||
|
||||
ThresholdWorklet worklet(predicate);
|
||||
DispatcherMapTopology<ThresholdWorklet> dispatcher(worklet);
|
||||
dispatcher.Invoke(cellSet, scalars, passFlags);
|
||||
vtkm::cont::Invoker invoker;
|
||||
invoker(worklet, cellSet, scalars, passFlags);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> pointIds;
|
||||
vtkm::cont::ArrayHandleCounting<vtkm::Id> indices =
|
||||
|
@ -40,7 +40,6 @@ set(unit_tests
|
||||
UnitTestLagrangianStructuresFilter.cxx
|
||||
UnitTestMapFieldMergeAverage.cxx
|
||||
UnitTestMapFieldPermutation.cxx
|
||||
UnitTestMaskFilter.cxx
|
||||
UnitTestMeshQualityFilter.cxx
|
||||
UnitTestMIRFilter.cxx
|
||||
UnitTestMultiBlockFilter.cxx
|
||||
|
@ -38,7 +38,6 @@ set(headers
|
||||
LagrangianStructures.h
|
||||
Magnitude.h
|
||||
Contour.h
|
||||
Mask.h
|
||||
MaskIndices.h
|
||||
MaskNone.h
|
||||
MaskSelect.h
|
||||
|
@ -39,7 +39,6 @@ set(unit_tests
|
||||
UnitTestImageConnectivity.cxx
|
||||
UnitTestKeys.cxx
|
||||
UnitTestMagnitude.cxx
|
||||
UnitTestMask.cxx
|
||||
UnitTestMaskIndices.cxx
|
||||
UnitTestMaskSelect.cxx
|
||||
UnitTestNormalize.cxx
|
||||
|
@ -1,119 +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.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/worklet/Mask.h>
|
||||
|
||||
#include <vtkm/cont/testing/MakeTestDataSet.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/CellSet.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using vtkm::cont::testing::MakeTestDataSet;
|
||||
|
||||
class TestingMask
|
||||
{
|
||||
public:
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void TestUniform2D() const
|
||||
{
|
||||
std::cout << "Testing mask cells structured:" << std::endl;
|
||||
|
||||
using CellSetType = vtkm::cont::CellSetStructured<2>;
|
||||
using OutCellSetType = vtkm::cont::CellSetPermutation<CellSetType>;
|
||||
|
||||
// Input data set created
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet1();
|
||||
CellSetType cellSet;
|
||||
dataset.GetCellSet().AsCellSet(cellSet);
|
||||
|
||||
// Output data set permutation
|
||||
vtkm::worklet::Mask maskCells;
|
||||
OutCellSetType outCellSet = maskCells.Run(cellSet, 2);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> cellvar;
|
||||
dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar);
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> cellFieldArray = maskCells.ProcessCellField(cellvar);
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 8), "Wrong result for Mask");
|
||||
VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 8 &&
|
||||
cellFieldArray.ReadPortal().Get(7) == 14.f,
|
||||
"Wrong cell field data");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void TestUniform3D() const
|
||||
{
|
||||
std::cout << "Testing mask cells structured:" << std::endl;
|
||||
|
||||
using CellSetType = vtkm::cont::CellSetStructured<3>;
|
||||
using OutCellSetType = vtkm::cont::CellSetPermutation<CellSetType>;
|
||||
// Input data set created
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
|
||||
CellSetType cellSet;
|
||||
dataset.GetCellSet().AsCellSet(cellSet);
|
||||
|
||||
// Output data set with cell set permuted
|
||||
vtkm::worklet::Mask maskCells;
|
||||
OutCellSetType outCellSet = maskCells.Run(cellSet, 9);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> cellvar;
|
||||
dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar);
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> cellFieldArray = maskCells.ProcessCellField(cellvar);
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 7), "Wrong result for ExtractCells");
|
||||
VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 7 &&
|
||||
cellFieldArray.ReadPortal().Get(2) == 18.f,
|
||||
"Wrong cell field data");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void TestExplicit() const
|
||||
{
|
||||
std::cout << "Testing mask cells explicit:" << std::endl;
|
||||
|
||||
using CellSetType = vtkm::cont::CellSetExplicit<>;
|
||||
using OutCellSetType = vtkm::cont::CellSetPermutation<CellSetType>;
|
||||
|
||||
// Input data set created
|
||||
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5();
|
||||
CellSetType cellSet;
|
||||
dataset.GetCellSet().AsCellSet(cellSet);
|
||||
|
||||
// Output data set with cell set permuted
|
||||
vtkm::worklet::Mask maskCells;
|
||||
OutCellSetType outCellSet = maskCells.Run(cellSet, 2);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> cellvar;
|
||||
dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar);
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> cellFieldArray = maskCells.ProcessCellField(cellvar);
|
||||
|
||||
VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 2), "Wrong result for ExtractCells");
|
||||
VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 2 &&
|
||||
cellFieldArray.ReadPortal().Get(1) == 120.2f,
|
||||
"Wrong cell field data");
|
||||
}
|
||||
|
||||
void operator()() const
|
||||
{
|
||||
this->TestUniform2D();
|
||||
this->TestUniform3D();
|
||||
this->TestExplicit();
|
||||
}
|
||||
};
|
||||
|
||||
int UnitTestMask(int argc, char* argv[])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(TestingMask(), argc, argv);
|
||||
}
|
Loading…
Reference in New Issue
Block a user