Commit 5c453769 authored by dpugmire's avatar dpugmire
Browse files

Merge branch 'master' of https://gitlab.kitware.com/vtk/vtk-m into messenger_cleanup

parents 43b4bf46 32b87b8b
......@@ -70,12 +70,13 @@ public:
DoubleInvWidth = 2.f / static_cast<vtkm::Float32>(width);
}
using ControlSignature = void(FieldIn, FieldInOut, WholeArrayIn);
using ExecutionSignature = void(_1, _2, _3);
using ControlSignature = void(FieldIn, FieldInOut, FieldIn, WholeArrayIn);
using ExecutionSignature = void(_1, _2, _3, _4);
template <typename Precision, typename DepthPortalType>
VTKM_EXEC void operator()(const vtkm::Id& pixelId,
Precision& maxDistance,
const Vec<Precision, 3>& origin,
const DepthPortalType& depths) const
{
vtkm::Vec4f_32 position;
......@@ -94,7 +95,8 @@ public:
p[0] = position[0] / position[3];
p[1] = position[1] / position[3];
p[2] = position[2] / position[3];
p = p - Origin;
p = p - origin;
maxDistance = vtkm::Magnitude(p);
}
......
......@@ -277,6 +277,7 @@ void RayTracer::RenderOnDevice(Ray<Precision>& rays)
logger->AddLogData("shapes", NumberOfShapes);
logger->AddLogData("num_rays", rays.NumRays);
size_t numShapes = Intersectors.size();
if (NumberOfShapes > 0)
{
......
......@@ -257,7 +257,7 @@ public:
: MinScalar(minScalar)
{
Normalize = true;
if (minScalar > maxScalar)
if (minScalar >= maxScalar)
{
// support the scalar renderer
Normalize = false;
......
......@@ -251,7 +251,7 @@ public:
: MinScalar(minScalar)
{
Normalize = true;
if (minScalar > maxScalar)
if (minScalar >= maxScalar)
{
// support the scalar renderer
Normalize = false;
......@@ -315,7 +315,7 @@ public:
: MinScalar(minScalar)
{
Normalize = true;
if (minScalar > maxScalar)
if (minScalar >= maxScalar)
{
// support the scalar renderer
Normalize = false;
......
......@@ -73,7 +73,7 @@ inline TestEqualResult test_equal_images(const std::shared_ptr<ViewType> view,
}
catch (const vtkm::cont::ErrorExecution& error)
{
VTKM_LOG_S(vtkm::cont::LogLevel::Error, error.what());
VTKM_LOG_S(vtkm::cont::LogLevel::Error, error.GetMessage());
imageResult.PushMessage(error.GetMessage());
const std::string outputImagePath = vtkm::cont::testing::Testing::WriteDirPath(fileName);
......@@ -85,7 +85,7 @@ inline TestEqualResult test_equal_images(const std::shared_ptr<ViewType> view,
}
catch (const vtkm::cont::ErrorBadValue& error)
{
VTKM_LOG_S(vtkm::cont::LogLevel::Error, error.what());
VTKM_LOG_S(vtkm::cont::LogLevel::Error, error.GetMessage());
imageResult.PushMessage(error.GetMessage());
imageResult.PushMessage("Unsupported file type for image: " + fileName);
testResults.PushMessage(imageResult.GetMergedMessage());
......@@ -199,5 +199,4 @@ inline TestEqualResult test_equal_images_matching_name(
returnOnPass);
}
#endif // vtk_m_rendering_testing_Testing_h
......@@ -562,14 +562,14 @@ inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& ot
IdArrayType overallSortIndex;
overallSortIndex.Allocate(overallSortOrder.GetNumberOfValues());
{
// Functor return 0,1 for each element depending on whethern the current value is different from the next
mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNext differentFromNextFunctor(
this->GlobalMeshIndex, other.GlobalMeshIndex, overallSortOrder);
// Array based on the functor
// TODO: This should really use ArrayHandleDecorator, not ArrayHandleTransform
auto differentFromNextArr = vtkm::cont::make_ArrayHandleTransform(
vtkm::cont::ArrayHandleIndex(overallSortIndex.GetNumberOfValues() - 1),
differentFromNextFunctor);
// Array decorator with functor returning 0, 1 for each element depending
// on whethern the current value is different from the next
auto differentFromNextArr = vtkm::cont::make_ArrayHandleDecorator(
overallSortIndex.GetNumberOfValues() - 1,
mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNextDecoratorImpl{},
overallSortOrder,
this->GlobalMeshIndex,
other.GlobalMeshIndex);
// Compute the exclusive scan of our transformed combined vector
overallSortIndex.WritePortal().Set(0, 0);
......
......@@ -76,84 +76,42 @@ namespace contourtree_augmented
namespace mesh_dem_contourtree_mesh_inc
{
/// transform functor to compute if element i is different from element i+1 in an arrays. The
/// Decorator to compute if element i is different from element i+1 in an arrays. The
/// resulting array should hence be 1 element shorter than the input arrays
class CombinedVectorDifferentFromNextExecObj
class CombinedVectorDifferentFromNextDecoratorImpl
{
public:
using IdPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
VTKM_EXEC_CONT
CombinedVectorDifferentFromNextExecObj() {}
VTKM_CONT
CombinedVectorDifferentFromNextExecObj(const IdPortalType& thisGlobalMeshIndex,
const IdPortalType& otherGlobalMeshIndex,
const IdPortalType& sortOrder)
: OverallSortOrderPortal(sortOrder)
, ThisGlobalMeshIndex(thisGlobalMeshIndex)
, OtherGlobalMeshIndex(otherGlobalMeshIndex)
{
}
VTKM_EXEC_CONT
inline vtkm::Id GetGlobalMeshIndex(vtkm::Id idx) const
template <typename Portal1Type, typename Portal2Type, typename Portal3Type>
struct Functor
{
return vtkm::worklet::contourtree_augmented::IsThis(idx)
? this->ThisGlobalMeshIndex.Get(MaskedIndex(idx))
: this->OtherGlobalMeshIndex.Get(MaskedIndex(idx));
}
VTKM_EXEC_CONT
vtkm::Id operator()(vtkm::Id i) const
Portal1Type OverallSortOrderPortal;
Portal2Type ThisGlobalMeshIndex;
Portal3Type OtherGlobalMeshIndex;
VTKM_EXEC_CONT inline vtkm::Id GetGlobalMeshIndex(vtkm::Id idx) const
{
return vtkm::worklet::contourtree_augmented::IsThis(idx)
? this->ThisGlobalMeshIndex.Get(MaskedIndex(idx))
: this->OtherGlobalMeshIndex.Get(MaskedIndex(idx));
}
VTKM_EXEC_CONT vtkm::Id operator()(vtkm::Id i) const
{
vtkm::Id currGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i));
vtkm::Id nextGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i + 1));
return (currGlobalIdx != nextGlobalIdx) ? 1 : 0;
}
};
template <typename PT1, typename PT2, typename PT3>
Functor<PT1, PT2, PT3> CreateFunctor(PT1 OverallSortOrderPortal,
PT2 ThisGlobalMeshIndex,
PT3 OtherGlobalMeshIndex) const
{
vtkm::Id currGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i));
vtkm::Id nextGlobalIdx = this->GetGlobalMeshIndex(this->OverallSortOrderPortal.Get(i + 1));
return (currGlobalIdx != nextGlobalIdx) ? 1 : 0;
return { OverallSortOrderPortal, ThisGlobalMeshIndex, OtherGlobalMeshIndex };
}
private:
IdPortalType OverallSortOrderPortal;
IdPortalType ThisGlobalMeshIndex;
IdPortalType OtherGlobalMeshIndex;
};
class CombinedVectorDifferentFromNext : public vtkm::cont::ExecutionAndControlObjectBase
{
IdArrayType OverallSortOrder;
IdArrayType ThisGlobalMeshIndex;
IdArrayType OtherGlobalMeshIndex;
public:
CombinedVectorDifferentFromNext() = default;
CombinedVectorDifferentFromNext(const IdArrayType& thisGlobalMeshIndex,
const IdArrayType& otherGlobalMeshIndex,
const IdArrayType& sortOrder)
: OverallSortOrder(sortOrder)
, ThisGlobalMeshIndex(thisGlobalMeshIndex)
, OtherGlobalMeshIndex(otherGlobalMeshIndex)
{
}
VTKM_CONT CombinedVectorDifferentFromNextExecObj
PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
{
return CombinedVectorDifferentFromNextExecObj(
this->ThisGlobalMeshIndex.PrepareForInput(device, token),
this->OtherGlobalMeshIndex.PrepareForInput(device, token),
this->OverallSortOrder.PrepareForInput(device, token));
}
VTKM_CONT CombinedVectorDifferentFromNextExecObj PrepareForControl() const
{
return CombinedVectorDifferentFromNextExecObj(this->ThisGlobalMeshIndex.ReadPortal(),
this->OtherGlobalMeshIndex.ReadPortal(),
this->OverallSortOrder.ReadPortal());
}
};
} // namespace mesh_dem_contourtree_mesh_inc
} // namespace contourtree_augmented
} // namespace worklet
......
......@@ -234,13 +234,13 @@ public:
VTKM_ASSERT(pos[0] != 0 && pos[0] != this->MeshStructure.MeshSize[0]);
VTKM_ASSERT(pos[1] != 0 && pos[1] != this->MeshStructure.MeshSize[1]);
return CountLinkComponentsIn2DSlice(meshIndex,
vtkm::Id2(this->MeshStructure.MeshSize[0], 1)) != 2;
vtkm::Id2(1, this->MeshStructure.MeshSize[0])) != 2;
}
else if (pos[1] == 0 || pos[1] == this->MeshStructure.MeshSize[1] - 1)
{ // On [1]-perpendicular face
VTKM_ASSERT(pos[0] != 0 && pos[0] != this->MeshStructure.MeshSize[0]);
VTKM_ASSERT(pos[2] != 0 && pos[2] != this->MeshStructure.MeshSize[2]);
return CountLinkComponentsIn2DSlice(meshIndex, vtkm::Id2(nPerSlice, 1)) != 2;
return CountLinkComponentsIn2DSlice(meshIndex, vtkm::Id2(1, nPerSlice)) != 2;
}
else
{ // On [0]-perpendicular face
......@@ -248,7 +248,7 @@ public:
VTKM_ASSERT(pos[1] != 0 && pos[1] != this->MeshStructure.MeshSize[1]);
VTKM_ASSERT(pos[2] != 0 && pos[2] != this->MeshStructure.MeshSize[2]);
return CountLinkComponentsIn2DSlice(
meshIndex, vtkm::Id2(this->MeshStructure.MeshSize[0], nPerSlice)) != 2;
meshIndex, vtkm::Id2(nPerSlice, this->MeshStructure.MeshSize[0])) != 2;
}
}
}
......
......@@ -69,7 +69,7 @@ namespace contourtree_distributed
{
// Possibly change the following when comapring to PPP prototype
constexpr int PRINT_WIDTH = 12;
using dataType = vtkm::FloatDefault;
using dataType = vtkm::Float64;
using indexType = vtkm::Id;
// small class for storing the contour arcs
......@@ -224,7 +224,7 @@ inline void TreeCompiler::AddHierarchicalTree(const vtkm::cont::DataSet& addedTr
{ // TreeCompiler::AddHierarchicalTree()
// Copy relevant tree content to STL arrays
vtkm::cont::UnknownArrayHandle dataValues_array = addedTree.GetField("DataValues").GetData();
std::vector<vtkm::FloatDefault> dataValues(dataValues_array.GetNumberOfValues());
std::vector<vtkm::Float64> dataValues(dataValues_array.GetNumberOfValues());
auto dataValues_handle = vtkm::cont::make_ArrayHandle(dataValues, vtkm::CopyFlag::Off);
vtkm::cont::ArrayCopy(dataValues_array, dataValues_handle);
dataValues_handle.SyncControlArray();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment