Commit b25c8af9 authored by James Kress's avatar James Kress

Merge remote-tracking branch 'upstream/master'

parents 26f9dc3c 2ed1bb72
......@@ -197,7 +197,7 @@ struct GetTypeInParentheses<void(T)>
/// This macro also defines a Superclass typedef as well as ValueType and
/// StorageTag.
///
/// Note that this macor only works on ArrayHandle subclasses that are
/// Note that this macro only works on ArrayHandle subclasses that are
/// templated. For ArrayHandle sublcasses that are not templates, use
/// VTKM_ARRAY_HANDLE_SUBCLASS_NT.
///
......@@ -220,8 +220,8 @@ struct GetTypeInParentheses<void(T)>
/// This macro also defines a Superclass typedef as well as ValueType and
/// StorageTag.
///
/// Note that this macor only works on ArrayHandle subclasses that are not
/// templated. For ArrayHandle sublcasses that are are templates, use
/// Note that this macro only works on ArrayHandle subclasses that are not
/// templated. For ArrayHandle sublcasses that are templates, use
/// VTKM_ARRAY_HANDLE_SUBCLASS.
///
#define VTKM_ARRAY_HANDLE_SUBCLASS_NT(classname, superclass) \
......
......@@ -153,12 +153,10 @@ ColorSpace ColorTable::GetColorSpace() const
//----------------------------------------------------------------------------
void ColorTable::SetColorSpace(ColorSpace space)
{
if (this->Impl->CSpace != space || this->Impl->HostSideCache == nullptr)
if (this->Impl->CSpace != space || this->Impl->HostSideCache.get() == nullptr)
{
this->Impl->CSpace = space;
//Remove any existing host and execution data
delete this->Impl->HostSideCache;
delete this->Impl->ExecHandle;
using HandleType = vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>;
switch (space)
......@@ -166,36 +164,36 @@ void ColorTable::SetColorSpace(ColorSpace space)
case vtkm::cont::ColorSpace::RGB:
{
auto* hostPortal = new vtkm::exec::ColorTableRGB();
this->Impl->ExecHandle = new HandleType(hostPortal, false);
this->Impl->HostSideCache = hostPortal;
this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache.reset(hostPortal);
break;
}
case vtkm::cont::ColorSpace::HSV:
{
auto* hostPortal = new vtkm::exec::ColorTableHSV();
this->Impl->ExecHandle = new HandleType(hostPortal, false);
this->Impl->HostSideCache = hostPortal;
this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache.reset(hostPortal);
break;
}
case vtkm::cont::ColorSpace::HSV_WRAP:
{
auto* hostPortal = new vtkm::exec::ColorTableHSVWrap();
this->Impl->ExecHandle = new HandleType(hostPortal, false);
this->Impl->HostSideCache = hostPortal;
this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache.reset(hostPortal);
break;
}
case vtkm::cont::ColorSpace::LAB:
{
auto* hostPortal = new vtkm::exec::ColorTableLab();
this->Impl->ExecHandle = new HandleType(hostPortal, false);
this->Impl->HostSideCache = hostPortal;
this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache.reset(hostPortal);
break;
}
case vtkm::cont::ColorSpace::DIVERGING:
{
auto* hostPortal = new vtkm::exec::ColorTableDiverging();
this->Impl->ExecHandle = new HandleType(hostPortal, false);
this->Impl->HostSideCache = hostPortal;
this->Impl->ExecHandle.reset(new HandleType(hostPortal, false));
this->Impl->HostSideCache.reset(hostPortal);
break;
}
default:
......@@ -864,14 +862,14 @@ vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>* ColorTable::GetHand
if (this->Impl->ColorArraysChanged || this->Impl->OpacityArraysChanged)
{
vtkm::cont::TryExecute(
detail::transfer_color_table_to_device{}, this->Impl->HostSideCache, this->Impl.get());
detail::transfer_color_table_to_device{}, this->Impl->HostSideCache.get(), this->Impl.get());
this->Impl->HostSideCache->Modified();
}
this->Impl->ColorArraysChanged = false;
this->Impl->OpacityArraysChanged = false;
return this->Impl->ExecHandle;
return this->Impl->ExecHandle.get();
}
//---------------------------------------------------------------------------
......
......@@ -48,9 +48,9 @@ struct ColorTableInternals
// AboveRangeColor
//Note the pointers inside the host side portal are not valid, as they
//are execution
vtkm::exec::ColorTableBase* HostSideCache = nullptr;
std::unique_ptr<vtkm::exec::ColorTableBase> HostSideCache;
//Execution side version of the ColorTableBase.
vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>* ExecHandle = nullptr;
std::unique_ptr<vtkm::cont::VirtualObjectHandle<vtkm::exec::ColorTableBase>> ExecHandle;
std::vector<double> ColorNodePos;
std::vector<vtkm::Vec<float, 3>> ColorRGB;
......
......@@ -66,13 +66,13 @@ struct compute_info
//if we both the same SM level check performance
if ((this->Major >= 3 && other.Major >= 3) || (this->Major == other.Major))
{
return betterPerfomance(other);
return betterPerformance(other);
}
//prefer the greater SM otherwise
return this->Major > other.Major;
}
bool betterPerfomance(const compute_info other) const
bool betterPerformance(const compute_info other) const
{
if (this->Performance == other.Performance)
{
......
......@@ -69,6 +69,15 @@ public:
vtkm::cont::ColorTable tableRGBA(range, rgba1, rgba2, diverging);
VTKM_TEST_ASSERT(tableRGBA.GetColorSpace() == diverging, "color space not saved");
VTKM_TEST_ASSERT(tableRGBA.GetRange() == range, "color range not saved");
//verify we can store a vector of tables
std::vector<vtkm::cont::ColorTable> tables;
tables.push_back(table);
tables.push_back(tableRGB);
tables.push_back(tableRGBA);
tables.push_back(tableRGBA);
tables.push_back(tableRGB);
tables.push_back(table);
}
static void TestLoadPresets()
......
......@@ -95,7 +95,7 @@ static inline VTKM_EXEC bool CellInside(const vtkm::Vec<T, 3>& pcoords, vtkm::Ce
pcoords[2] >= T(0) && pcoords[2] <= T(1);
}
/// Checks if the paramteric coordinates `pcoords` are on the inside for the
/// Checks if the parametric coordinates `pcoords` are on the inside for the
/// specified cell type.
///
template <typename T>
......
Markdown is supported
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