Commit 334262db authored by Sujin Philip's avatar Sujin Philip
Browse files

Fix Field constructors

1. Add option to copy user supplied array in make_ArrayHandle.
2. Replace Field constructors that take user supplied arrays with make_Field.
3. Replace CoordinateSystem constructors that take user supplied arrays with
   make_CoordinateSystem.
parent fab26344
......@@ -355,7 +355,7 @@ int main(int argc, char** argv)
vtkm::cont::DataSetBuilderUniform builder;
vtkm::cont::DataSet data = builder.Create(vtkm::Id2(x, y));
vtkm::cont::Field stateField("state", vtkm::cont::Field::ASSOC_POINTS, input_state);
auto stateField = vtkm::cont::make_Field("state", vtkm::cont::Field::ASSOC_POINTS, input_state);
data.AddField(stateField);
GameOfLife filter;
......
......@@ -34,6 +34,7 @@ set(headers
Bounds.h
CellShape.h
CellTraits.h
Flags.h
Hash.h
ImplicitFunction.h
ListTag.h
......
//============================================================================
// 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.
//
// Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2014 UT-Battelle, LLC.
// Copyright 2014 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#ifndef vtk_m_Flags_h
#define vtk_m_Flags_h
namespace vtkm
{
enum class CopyFlag
{
Off = 0,
On = 1
};
}
#endif // vtk_m_Flags_h
......@@ -23,6 +23,7 @@
#include <vtkm/cont/vtkm_cont_export.h>
#include <vtkm/Assert.h>
#include <vtkm/Flags.h>
#include <vtkm/Types.h>
#include <vtkm/cont/ArrayPortalToIterators.h>
......@@ -31,6 +32,7 @@
#include <vtkm/cont/Storage.h>
#include <vtkm/cont/StorageBasic.h>
#include <algorithm>
#include <iterator>
#include <memory>
#include <vector>
......@@ -503,23 +505,35 @@ public:
/// A convenience function for creating an ArrayHandle from a standard C array.
///
template <typename T>
VTKM_CONT vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagBasic> make_ArrayHandle(const T* array,
vtkm::Id length)
VTKM_CONT vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagBasic>
make_ArrayHandle(const T* array, vtkm::Id length, vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
using ArrayHandleType = vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagBasic>;
using StorageType = vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagBasic>;
return ArrayHandleType(StorageType(array, length));
if (copy == vtkm::CopyFlag::On)
{
ArrayHandleType handle;
handle.Allocate(length);
std::copy(
array, array + length, vtkm::cont::ArrayPortalToIteratorBegin(handle.GetPortalControl()));
return handle;
}
else
{
using StorageType = vtkm::cont::internal::Storage<T, vtkm::cont::StorageTagBasic>;
return ArrayHandleType(StorageType(array, length));
}
}
/// A convenience function for creating an ArrayHandle from an std::vector.
///
template <typename T, typename Allocator>
VTKM_CONT vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagBasic> make_ArrayHandle(
const std::vector<T, Allocator>& array)
const std::vector<T, Allocator>& array,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
if (!array.empty())
{
return make_ArrayHandle(&array.front(), static_cast<vtkm::Id>(array.size()));
return make_ArrayHandle(&array.front(), static_cast<vtkm::Id>(array.size()), copy);
}
else
{
......
......@@ -110,18 +110,6 @@ public:
{
}
template <typename T>
VTKM_CONT CoordinateSystem(std::string name, const std::vector<T>& data)
: Superclass(name, ASSOC_POINTS, data)
{
}
template <typename T>
VTKM_CONT CoordinateSystem(std::string name, const T* data, vtkm::Id numberOfValues)
: Superclass(name, ASSOC_POINTS, data, numberOfValues)
{
}
/// This constructor of coordinate system sets up a regular grid of points.
///
VTKM_CONT
......@@ -230,6 +218,24 @@ void CastAndCall(const vtkm::cont::CoordinateSystem& coords, Functor&& f, Args&&
coords.GetData().CastAndCall(std::forward<Functor>(f), std::forward<Args>(args)...);
}
template <typename T>
vtkm::cont::CoordinateSystem make_CoordinateSystem(std::string name,
const std::vector<T>& data,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::CoordinateSystem(name, vtkm::cont::make_ArrayHandle(data, copy));
}
template <typename T>
vtkm::cont::CoordinateSystem make_CoordinateSystem(std::string name,
const T* data,
vtkm::Id numberOfValues,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::CoordinateSystem(name,
vtkm::cont::make_ArrayHandle(data, numberOfValues, copy));
}
namespace internal
{
......
......@@ -57,7 +57,8 @@ public:
const std::string& fieldName,
const std::vector<T>& field)
{
dataSet.AddField(Field(fieldName, vtkm::cont::Field::ASSOC_POINTS, field));
dataSet.AddField(
make_Field(fieldName, vtkm::cont::Field::ASSOC_POINTS, field, vtkm::CopyFlag::On));
}
template <typename T>
......@@ -66,7 +67,8 @@ public:
const T* field,
const vtkm::Id& n)
{
dataSet.AddField(Field(fieldName, vtkm::cont::Field::ASSOC_POINTS, field, n));
dataSet.AddField(
make_Field(fieldName, vtkm::cont::Field::ASSOC_POINTS, field, n, vtkm::CopyFlag::On));
}
//Cell centered field
......@@ -94,7 +96,8 @@ public:
const std::vector<T>& field,
const std::string& cellSetName)
{
dataSet.AddField(Field(fieldName, vtkm::cont::Field::ASSOC_CELL_SET, cellSetName, field));
dataSet.AddField(make_Field(
fieldName, vtkm::cont::Field::ASSOC_CELL_SET, cellSetName, field, vtkm::CopyFlag::On));
}
template <typename T>
......@@ -104,7 +107,8 @@ public:
const vtkm::Id& n,
const std::string& cellSetName)
{
dataSet.AddField(Field(fieldName, vtkm::cont::Field::ASSOC_CELL_SET, cellSetName, field, n));
dataSet.AddField(make_Field(
fieldName, vtkm::cont::Field::ASSOC_CELL_SET, cellSetName, field, n, vtkm::CopyFlag::On));
}
VTKM_CONT
......
......@@ -102,32 +102,6 @@ public:
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) || (this->Association == ASSOC_POINTS));
}
template <typename T>
VTKM_CONT Field(std::string name, AssociationEnum association, const std::vector<T>& data)
: Name(name)
, Association(association)
, AssocCellSetName()
, AssocLogicalDim(-1)
, Range()
, ModifiedFlag(true)
{
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) || (this->Association == ASSOC_POINTS));
this->CopyData(&data[0], static_cast<vtkm::Id>(data.size()));
}
template <typename T>
VTKM_CONT Field(std::string name, AssociationEnum association, const T* data, vtkm::Id nvals)
: Name(name)
, Association(association)
, AssocCellSetName()
, AssocLogicalDim(-1)
, Range()
, ModifiedFlag(true)
{
VTKM_ASSERT((this->Association == ASSOC_WHOLE_MESH) || (this->Association == ASSOC_POINTS));
this->CopyData(data, nvals);
}
/// constructors for cell set associations
VTKM_CONT
Field(std::string name,
......@@ -161,39 +135,6 @@ public:
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
}
template <typename T>
VTKM_CONT Field(std::string name,
AssociationEnum association,
const std::string& cellSetName,
const std::vector<T>& data)
: Name(name)
, Association(association)
, AssocCellSetName(cellSetName)
, AssocLogicalDim(-1)
, Range()
, ModifiedFlag(true)
{
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
this->CopyData(&data[0], static_cast<vtkm::Id>(data.size()));
}
template <typename T>
VTKM_CONT Field(std::string name,
AssociationEnum association,
const std::string& cellSetName,
const T* data,
vtkm::Id nvals)
: Name(name)
, Association(association)
, AssocCellSetName(cellSetName)
, AssocLogicalDim(-1)
, Range()
, ModifiedFlag(true)
{
VTKM_ASSERT(this->Association == ASSOC_CELL_SET);
this->CopyData(data, nvals);
}
/// constructors for logical dimension associations
VTKM_CONT
Field(std::string name,
......@@ -226,37 +167,6 @@ public:
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
}
template <typename T>
VTKM_CONT Field(std::string name,
AssociationEnum association,
vtkm::IdComponent logicalDim,
const std::vector<T>& data)
: Name(name)
, Association(association)
, AssocLogicalDim(logicalDim)
, Range()
, ModifiedFlag(true)
{
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
this->CopyData(&data[0], static_cast<vtkm::Id>(data.size()));
}
template <typename T>
VTKM_CONT Field(std::string name,
AssociationEnum association,
vtkm::IdComponent logicalDim,
const T* data,
vtkm::Id nvals)
: Name(name)
, Association(association)
, AssocLogicalDim(logicalDim)
, Range()
, ModifiedFlag(true)
{
VTKM_ASSERT(this->Association == ASSOC_LOGICAL_DIM);
CopyData(data, nvals);
}
VTKM_CONT
Field()
: Name()
......@@ -356,17 +266,7 @@ public:
template <typename T>
VTKM_CONT void CopyData(const T* ptr, vtkm::Id nvals)
{
//allocate main memory using an array handle
vtkm::cont::ArrayHandle<T> tmp;
tmp.Allocate(nvals);
//copy into the memory owned by the array handle
std::copy(ptr,
ptr + static_cast<std::size_t>(nvals),
vtkm::cont::ArrayPortalToIteratorBegin(tmp.GetPortalControl()));
//assign to the dynamic array handle
this->Data = tmp;
this->Data = vtkm::cont::make_ArrayHandle(ptr, nvals, true);
this->ModifiedFlag = true;
}
......@@ -407,6 +307,73 @@ void CastAndCall(const vtkm::cont::Field& field, Functor&& f, Args&&... args)
field.GetData().CastAndCall(std::forward<Functor>(f), std::forward<Args>(args)...);
}
//@{
/// Convinience functions to build fields from C style arrays and std::vector
template <typename T>
vtkm::cont::Field make_Field(std::string name,
Field::AssociationEnum association,
const T* data,
vtkm::Id size,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::Field(name, association, vtkm::cont::make_ArrayHandle(data, size, copy));
}
template <typename T>
vtkm::cont::Field make_Field(std::string name,
Field::AssociationEnum association,
const std::vector<T>& data,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::Field(name, association, vtkm::cont::make_ArrayHandle(data, copy));
}
template <typename T>
vtkm::cont::Field make_Field(std::string name,
Field::AssociationEnum association,
const std::string& cellSetName,
const T* data,
vtkm::Id size,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::Field(
name, association, cellSetName, vtkm::cont::make_ArrayHandle(data, size, copy));
}
template <typename T>
vtkm::cont::Field make_Field(std::string name,
Field::AssociationEnum association,
const std::string& cellSetName,
const std::vector<T>& data,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::Field(
name, association, cellSetName, vtkm::cont::make_ArrayHandle(data, copy));
}
template <typename T>
vtkm::cont::Field make_Field(std::string name,
Field::AssociationEnum association,
vtkm::IdComponent logicalDim,
const T* data,
vtkm::Id size,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::Field(
name, association, logicalDim, vtkm::cont::make_ArrayHandle(data, size, copy));
}
template <typename T>
vtkm::cont::Field make_Field(std::string name,
Field::AssociationEnum association,
vtkm::IdComponent logicalDim,
const std::vector<T>& data,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::Field(name, association, logicalDim, vtkm::cont::make_ArrayHandle(data, copy));
}
//@}
namespace internal
{
......
......@@ -287,11 +287,13 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DRegularDataSet0()
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates));
//Set point scalar
dataSet.AddField(Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts));
dataSet.AddField(
make_Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts, vtkm::CopyFlag::On));
//Set cell scalar
vtkm::Float32 cellvar[4] = { 100.1f, 100.2f, 100.3f, 100.4f };
dataSet.AddField(Field("cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 4));
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 4, vtkm::CopyFlag::On));
static const vtkm::IdComponent dim = 3;
vtkm::cont::CellSetStructured<dim> cellSet("cells");
......@@ -312,11 +314,13 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DRegularDataSet1()
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates));
//Set point scalar
dataSet.AddField(Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts));
dataSet.AddField(
make_Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts, vtkm::CopyFlag::On));
//Set cell scalar
vtkm::Float32 cellvar[1] = { 100.1f };
dataSet.AddField(Field("cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 1));
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 1, vtkm::CopyFlag::On));
static const vtkm::IdComponent dim = 3;
vtkm::cont::CellSetStructured<dim> cellSet("cells");
......@@ -556,7 +560,8 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet1()
CoordType(2, 2, 0) };
vtkm::Float32 vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f };
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates, nVerts));
dataSet.AddCoordinateSystem(
vtkm::cont::make_CoordinateSystem("coordinates", coordinates, nVerts, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
cellSet.PrepareToAddCells(2, 7);
cellSet.AddCell(vtkm::CELL_SHAPE_TRIANGLE, 3, make_Vec<vtkm::Id>(0, 1, 2));
......@@ -565,11 +570,13 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet1()
dataSet.AddCellSet(cellSet);
//Set point scalar
dataSet.AddField(Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts));
dataSet.AddField(
make_Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts, vtkm::CopyFlag::On));
//Set cell scalar
vtkm::Float32 cellvar[2] = { 100.1f, 100.2f };
dataSet.AddField(Field("cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 2));
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 2, vtkm::CopyFlag::On));
return dataSet;
}
......@@ -592,14 +599,17 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet2()
};
vtkm::Float32 vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f, 60.2f, 70.2f, 80.3f };
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates, nVerts));
dataSet.AddCoordinateSystem(
vtkm::cont::make_CoordinateSystem("coordinates", coordinates, nVerts, vtkm::CopyFlag::On));
//Set point scalar
dataSet.AddField(Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts));
dataSet.AddField(
make_Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts, vtkm::CopyFlag::On));
//Set cell scalar
vtkm::Float32 cellvar[2] = { 100.1f };
dataSet.AddField(Field("cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 1));
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 1, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
vtkm::Vec<vtkm::Id, 8> ids;
......@@ -645,14 +655,17 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet4()
vtkm::Float32 vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f, 60.2f,
70.2f, 80.3f, 90.f, 10.f, 11.f, 12.f };
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates, nVerts));
dataSet.AddCoordinateSystem(
vtkm::cont::make_CoordinateSystem("coordinates", coordinates, nVerts, vtkm::CopyFlag::On));
//Set point scalar
dataSet.AddField(Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts));
dataSet.AddField(
make_Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts, vtkm::CopyFlag::On));
//Set cell scalar
vtkm::Float32 cellvar[2] = { 100.1f, 110.f };
dataSet.AddField(Field("cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 2));
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 2, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
vtkm::Vec<vtkm::Id, 8> ids;
......@@ -695,14 +708,17 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet3()
};
vtkm::Float32 vars[nVerts] = { 10.1f, 10.1f, 10.2f, 30.2f };
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates, nVerts));
dataSet.AddCoordinateSystem(
vtkm::cont::make_CoordinateSystem("coordinates", coordinates, nVerts, vtkm::CopyFlag::On));
//Set point scalar
dataSet.AddField(Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts));
dataSet.AddField(
make_Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts, vtkm::CopyFlag::On));
//Set cell scalar
vtkm::Float32 cellvar[2] = { 100.1f };
dataSet.AddField(Field("cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 1));
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, 1, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
vtkm::Vec<vtkm::Id, 4> ids;
......@@ -743,15 +759,18 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet5()
vtkm::Float32 vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f, 60.2f,
70.2f, 80.3f, 90.f, 10.f, 11.f };
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates, nVerts));
dataSet.AddCoordinateSystem(
vtkm::cont::make_CoordinateSystem("coordinates", coordinates, nVerts, vtkm::CopyFlag::On));
//Set point scalar
dataSet.AddField(Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts));
dataSet.AddField(
make_Field("pointvar", vtkm::cont::Field::ASSOC_POINTS, vars, nVerts, vtkm::CopyFlag::On));
//Set cell scalar
const int nCells = 4;
vtkm::Float32 cellvar[nCells] = { 100.1f, 110.f, 120.2f, 130.5f };
dataSet.AddField(Field("cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, nCells));
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::ASSOC_CELL_SET, "cells", cellvar, nCells, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
vtkm::Vec<vtkm::Id, 8> ids;
......@@ -982,7 +1001,8 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSetCowNose()
// create DataSet
vtkm::cont::DataSet dataSet;
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates, nVerts));
dataSet.AddCoordinateSystem(
vtkm::cont::make_CoordinateSystem("coordinates", coordinates, nVerts, vtkm::CopyFlag::On));
vtkm::cont::ArrayHandle<vtkm::Id> connectivity;
connectivity.Allocate(connectivitySize);
......
......@@ -60,7 +60,7 @@ private:
const vtkm::Id nvals = 11;
T data[nvals] = { 1, 2, 3, 4, 5, -5, -4, -3, -2, -1, 0 };
std::random_shuffle(data, data + nvals);
vtkm::cont::Field field("TestField", vtkm::cont::Field::ASSOC_POINTS, data, nvals);
auto field = vtkm::cont::make_Field("TestField", vtkm::cont::Field::ASSOC_POINTS, data, nvals);
vtkm::Range result;
field.GetRange(&result);
......@@ -84,7 +84,8 @@ private:
fieldData[j][i] = data[j];
}
}
vtkm::cont::Field field("TestField", vtkm::cont::Field::ASSOC_POINTS, fieldData, nvals);
auto field =
vtkm::cont::make_Field("TestField", vtkm::cont::Field::ASSOC_POINTS, fieldData, nvals);
vtkm::Range result[NumberOfComponents];
field.GetRange(result, CustomTypeList(), VTKM_DEFAULT_STORAGE_LIST_TAG());
......
......@@ -18,7 +18,6 @@
// this software.
//============================================================================
#include <vector>
#include <vtkm/cont/DataSet.h>
#include <vtkm/worklet/NDimsEntropy.h>
......@@ -57,11 +56,9 @@ inline VTKM_CONT vtkm::filter::Result NDEntropy::DoExecute(
// Run worklet to calculate multi-variate entropy
vtkm::Float64 entropy = ndEntropy.Run(device);
vtkm::cont::DataSet outputData;
std::vector<vtkm::Float64> entropyHandle;
entropyHandle.push_back(entropy);
outputData.AddField(vtkm::cont::Field("Entropy", vtkm::cont::Field::ASSOC_POINTS, entropyHandle));
outputData.AddField(vtkm::cont::make_Field(
"Entropy", vtkm::cont::Field::ASSOC_POINTS, &entropy, 1, vtkm::CopyFlag::On));
//return outputData;
return vtkm::filter::Result(outputData);
......
......@@ -59,7 +59,7 @@ void TestFieldTypesPoint()
//verify the field helper work