Commit 8808b41f authored by Robert Maynard's avatar Robert Maynard

Merge branch 'master' into vtk-m-cmake_refactor

parents d205f953 90b91f7a
......@@ -21,6 +21,4 @@
list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
".*warning: ignoring loop annotation.*"
".*warning: Included by graph for.*not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES."
".*diy.include.*diy.mpi.io.hpp.*Wconversion.*"
".*diy.include.*diy.mpi.datatypes.hpp.*Wunused-parameter.*"
)
......@@ -61,7 +61,7 @@ VTK-m Requires:
+ GCC 4.8+
+ Clang 3.3+
+ XCode 5.0+
+ MSVC 2013+
+ MSVC 2015+
+ [CMake](http://www.cmake.org/download/)
+ CMake 3.3+ (for any build)
+ CMake 3.9+ (for CUDA build)
......@@ -153,7 +153,7 @@ camera.SetViewUp(vtkm::make_Vec(0.f, 1.f, 0.f));
camera.SetClippingRange(1.f, 100.f);
camera.SetFieldOfView(60.f);
camera.SetPosition(totalExtent*(mag * 2.f));
vtkm::rendering::ColorTable colorTable("thermal");
vtkm::cont::ColorTable colorTable("inferno");
// Create a mapper, canvas and view that will be used to render the scene
vtkm::rendering::Scene scene;
......
......@@ -161,7 +161,7 @@ struct ExtendedTypes : vtkm::ListTagBase<vtkm::UInt8,
{
};
const static std::string DIVIDER(40, '-');
static const std::string DIVIDER(40, '-');
/// This class runs a series of micro-benchmarks to measure
/// performance of the parallel primitives provided by each
......
......@@ -46,7 +46,7 @@ namespace benchmarking
#define ARRAY_SIZE (1 << 22)
#define CUBE_SIZE 256
const static std::string DIVIDER(40, '-');
static const std::string DIVIDER(40, '-');
enum BenchmarkName
{
......
......@@ -79,8 +79,24 @@ struct BenchRayTracing
Tracer.SetData(Coords.GetData(), Indices, field, NumberOfTriangles, range, bounds);
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::UInt8, 4>> temp;
vtkm::cont::ColorTable table("cool to warm");
table.Sample(100, temp);
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 4>> colors;
vtkm::rendering::ColorTable("cool2warm").Sample(100, colors);
colors.Allocate(100);
auto portal = colors.GetPortalControl();
auto colorPortal = temp.GetPortalConstControl();
constexpr vtkm::Float32 conversionToFloatSpace = (1.0f / 255.0f);
for (vtkm::Id i = 0; i < 100; ++i)
{
auto color = colorPortal.Get(i);
vtkm::Vec<vtkm::Float32, 4> t(color[0] * conversionToFloatSpace,
color[1] * conversionToFloatSpace,
color[2] * conversionToFloatSpace,
color[3] * conversionToFloatSpace);
portal.Set(i, t);
}
Tracer.SetColorMap(colors);
Tracer.Render(Rays);
......
......@@ -42,7 +42,7 @@ namespace benchmarking
{
#define CUBE_SIZE 256
const static std::string DIVIDER(40, '-');
static const std::string DIVIDER(40, '-');
enum BenchmarkName
{
......
......@@ -168,8 +168,7 @@ class ExposedClass;
namespace references are preferred).
+ All code must be valid by the C++11 specifications. It must also
compile correctly with Microsoft Visual Studio 2013, which implements a
subset of the C++11 standard.
compile with Microsoft Visual Studio 2015.
+ New code must include regression tests that will run on the dashboards.
Generally a new class will have an associated "UnitTest" that will test
......
......@@ -93,10 +93,12 @@ int main(int argc, char* argv[])
vtkm::cont::Timer<DeviceAdapter> total;
vtkm::cont::Timer<DeviceAdapter> timer;
bool invertClip = false;
vtkm::cont::CellSetExplicit<> outputCellSet =
clip.Run(input.GetCellSet(0),
scalarField.GetData().ResetTypeList(vtkm::TypeListTagScalarAll()),
clipValue,
invertClip,
DeviceAdapter());
vtkm::Float64 clipTime = timer.GetElapsedTime();
......
......@@ -115,14 +115,13 @@ int main(int argc, char* argv[])
vtkm::cont::DataSetFieldAdd dsf;
dsf.AddPointField(inDataSet, "values", values);
// Output data set is pairs of saddle and peak vertex IDs
vtkm::filter::Result result;
// Convert 2D mesh of values into contour tree, pairs of vertex ids
vtkm::filter::ContourTreeMesh2D filter;
result = filter.Execute(inDataSet, std::string("values"));
vtkm::cont::Field resultField = result.GetField();
filter.SetActiveField("values");
// Output data set is pairs of saddle and peak vertex IDs
vtkm::cont::DataSet output = filter.Execute(inDataSet);
vtkm::cont::Field resultField = output.GetField("saddlePeak");
;
vtkm::cont::ArrayHandle<vtkm::Pair<vtkm::Id, vtkm::Id>> saddlePeak;
resultField.GetData().CopyTo(saddlePeak);
......
......@@ -116,14 +116,13 @@ int main(int argc, char* argv[])
vtkm::cont::DataSetFieldAdd dsf;
dsf.AddPointField(inDataSet, "values", values);
// Output data set is pairs of saddle and peak vertex IDs
vtkm::filter::Result result;
// Convert 3D mesh of values into contour tree, pairs of vertex ids
vtkm::filter::ContourTreeMesh3D filter;
result = filter.Execute(inDataSet, std::string("values"));
filter.SetActiveField("values");
// Output data set is pairs of saddle and peak vertex IDs
vtkm::cont::DataSet output = filter.Execute(inDataSet);
vtkm::cont::Field resultField = result.GetField();
vtkm::cont::Field resultField = output.GetField("saddlePeak");
vtkm::cont::ArrayHandle<vtkm::Pair<vtkm::Id, vtkm::Id>> saddlePeak;
resultField.GetData().CopyTo(saddlePeak);
......
......@@ -35,7 +35,7 @@
#include <iostream>
void makeScene(const vtkm::cont::DataSet& inputData,
const vtkm::rendering::ColorTable& colorTable,
const vtkm::cont::ColorTable& colorTable,
const std::string& fieldName,
vtkm::rendering::Scene& scene)
{
......@@ -100,7 +100,7 @@ int main(int argc, char* argv[])
camera.SetClippingRange(1.f, 100.f);
camera.SetFieldOfView(60.f);
camera.SetPosition(totalExtent * (mag * 2.f));
vtkm::rendering::ColorTable colorTable("thermal");
vtkm::cont::ColorTable colorTable("inferno");
// Create a scene for rendering the input data
vtkm::rendering::Scene scene;
......
......@@ -168,6 +168,16 @@ public:
return vtkm::filter::Result(output);
}
template <typename T, typename StorageType, typename DerivedPolicy, typename DeviceAdapter>
VTKM_CONT bool DoMapField(vtkm::filter::Result&,
const vtkm::cont::ArrayHandle<T, StorageType>&,
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&,
DeviceAdapter)
{
return false;
}
};
struct UploadData
......@@ -370,11 +380,11 @@ int main(int argc, char** argv)
glutDisplayFunc([]() {
const vtkm::Float32 c = static_cast<vtkm::Float32>(gTimer.GetElapsedTime());
vtkm::filter::Result rdata = gFilter->Execute(*gData, GameOfLifePolicy());
gRenderer->render(rdata.GetDataSet());
vtkm::cont::DataSet oData = gFilter->Execute(*gData, GameOfLifePolicy());
gRenderer->render(oData);
glutSwapBuffers();
*gData = rdata.GetDataSet();
*gData = oData;
if (c > 120)
{
......
......@@ -246,13 +246,12 @@ int main(int argc, char* argv[])
filter.SetGenerateNormals(true);
filter.SetMergeDuplicatePoints(false);
filter.SetIsoValue(0, 0.1);
vtkm::filter::Result result = filter.Execute(dataSet, dataSet.GetField("nodevar"));
filter.SetActiveField("nodevar");
filter.SetFieldsToPass({ "nodevar" });
filter.MapFieldOntoOutput(result, dataSet.GetField("nodevar"));
vtkm::cont::DataSet outputData = filter.Execute(dataSet);
//need to extract vertices, normals, and scalars
vtkm::cont::DataSet& outputData = result.GetDataSet();
using VertType = vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>>;
vtkm::cont::CoordinateSystem coords = outputData.GetCoordinateSystem();
......
......@@ -42,8 +42,8 @@
#include <GL/glut.h>
#endif
#include <vtkm/cont/ColorTable.h>
#include <vtkm/rendering/CanvasGL.h>
#include <vtkm/rendering/ColorTable.h>
#include <vtkm/rendering/MapperGL.h>
#include <vtkm/rendering/View3D.h>
......@@ -141,7 +141,7 @@ int main(int argc, char* argv[])
scene.AddActor(vtkm::rendering::Actor(ds.GetCellSet(),
ds.GetCoordinateSystem(),
ds.GetField("pointvar"),
vtkm::rendering::ColorTable("thermal")));
vtkm::cont::ColorTable("inferno")));
//Create vtkm rendering stuff.
view = new vtkm::rendering::View3D(scene, mapper, canvas, bg);
......
......@@ -348,7 +348,7 @@ void RenderRTTest(const vtkm::cont::DataSet& ds, int N)
using V3 = vtkm::rendering::View3D;
//std::cout<<"Render: "<<i<<std::endl;
vtkm::rendering::ColorTable colorTable("thermal");
vtkm::cont::ColorTable colorTable("inferno");
vtkm::rendering::testing::Render<M, C, V3>(ds, "scalar", colorTable);
}
}
......@@ -366,7 +366,7 @@ void RenderVolTest(const vtkm::cont::DataSet& ds, int N)
using V3 = vtkm::rendering::View3D;
//std::cout<<"Render: "<<i<<std::endl;
vtkm::rendering::ColorTable colorTable("thermal");
vtkm::cont::ColorTable colorTable("inferno");
vtkm::rendering::testing::Render<M, C, V3>(ds, "scalar", colorTable);
}
}
......
......@@ -272,9 +272,7 @@ int main(int argc, char* argv[])
// Convert cells to tetrahedra
vtkm::filter::Tetrahedralize tetrahedralize;
vtkm::filter::Result result = tetrahedralize.Execute(inDataSet);
outDataSet = result.GetDataSet();
outDataSet = tetrahedralize.Execute(inDataSet);
// Render the output dataset of tets
lastx = lasty = 0;
......
......@@ -254,9 +254,7 @@ int main(int argc, char* argv[])
vtkm::cont::DataSet inDataSet = MakeTetrahedralizeTestDataSet(dims);
vtkm::filter::Tetrahedralize tetrahedralize;
vtkm::filter::Result result = tetrahedralize.Execute(inDataSet);
tetDataSet = result.GetDataSet();
tetDataSet = tetrahedralize.Execute(inDataSet);
// Render the output dataset of tets
lastx = lasty = 0;
......
......@@ -192,8 +192,7 @@ int main(int argc, char* argv[])
// Convert 2D explicit cells to triangles
vtkm::filter::Triangulate triangulate;
vtkm::filter::Result result = triangulate.Execute(inDataSet);
outDataSet = result.GetDataSet();
outDataSet = triangulate.Execute(inDataSet);
// Render the output dataset of tets
glutInit(&argc, argv);
......
......@@ -159,9 +159,7 @@ int main(int argc, char* argv[])
// Convert uniform quad to triangle
vtkm::filter::Triangulate triangulate;
vtkm::filter::Result result = triangulate.Execute(inDataSet);
triDataSet = result.GetDataSet();
triDataSet = triangulate.Execute(inDataSet);
// Render the output dataset of tets
glutInit(&argc, argv);
......
......@@ -38,7 +38,11 @@
///
/// The VTKM_NO_ASSERT cmake and preprocessor option allows debugging builds
/// to remove assertions for performance reasons.
#if !defined(NDEBUG) && !defined(VTKM_NO_ASSERT)
#if defined(VTKM_CUDA_VERSION_MAJOR) && (VTKM_CUDA_VERSION_MAJOR == 7)
//CUDA 7.5 doesn't support assert in device code
#define VTKM_ASSERT(condition) (void)(condition)
#elif !defined(NDEBUG) && !defined(VTKM_NO_ASSERT)
//Only assert if we are in debug mode and don't have VTKM_NO_ASSERT defined
#define VTKM_ASSERT(condition) assert(condition)
#else
#define VTKM_ASSERT(condition) (void)(condition)
......
......@@ -67,11 +67,7 @@ vtkm_declare_headers(${headers})
#-----------------------------------------------------------------------------
#first add all the components vtkm that are shared between control and exec
if(VTKm_ENABLE_MPI)
# This `if` is temporary and will be removed once `diy` supports building
# without MPI.
add_subdirectory(thirdparty/diy)
endif()
add_subdirectory(thirdparty/diy)
add_subdirectory(testing)
add_subdirectory(internal)
......
......@@ -96,7 +96,7 @@ struct CellShapeIdToTag
#define VTKM_DEFINE_CELL_TAG(name, idname) \
struct CellShapeTag##name \
{ \
static const vtkm::UInt8 Id = vtkm::idname; \
static constexpr vtkm::UInt8 Id = vtkm::idname; \
}; \
namespace internal \
{ \
......
......@@ -59,7 +59,7 @@ struct CellTraits
/// This defines the topological dimensions of the cell type. 3 for
/// polyhedra, 2 for polygons, 1 for lines, 0 for points.
///
const static vtkm::IdComponent TOPOLOGICAL_DIMENSIONS = 3;
static const vtkm::IdComponent TOPOLOGICAL_DIMENSIONS = 3;
/// This tag is typedef'ed to
/// vtkm::CellTopologicalDimensionsTag<TOPOLOGICAL_DIMENSIONS>. This provides
......@@ -81,7 +81,7 @@ struct CellTraits
/// This is only defined for cell shapes of a fixed number of points (i.e.
/// \c IsSizedFixed is set to \c CellTraitsTagSizeFixed.
///
static const vtkm::IdComponent NUM_POINTS = 3;
static constexpr vtkm::IdComponent NUM_POINTS = 3;
};
#else // VTKM_DOXYGEN_ONLY
;
......
......@@ -32,8 +32,8 @@ using HashType = vtkm::UInt32;
namespace detail
{
static const vtkm::HashType FNV1A_OFFSET = 2166136261;
static const vtkm::HashType FNV1A_PRIME = 16777619;
static constexpr vtkm::HashType FNV1A_OFFSET = 2166136261;
static constexpr vtkm::HashType FNV1A_PRIME = 16777619;
/// \brief Performs an FNV-1a hash on 32-bit integers returning a 32-bit hash
///
......
......@@ -36,7 +36,7 @@ namespace internal
template <typename ListTag>
struct ListTagCheck : std::is_base_of<vtkm::detail::ListRoot, ListTag>
{
static VTKM_CONSTEXPR bool Valid = std::is_base_of<vtkm::detail::ListRoot, ListTag>::value;
static constexpr bool Valid = std::is_base_of<vtkm::detail::ListRoot, ListTag>::value;
};
} // namespace internal
......@@ -111,7 +111,7 @@ template <typename ListTag, typename Type>
struct ListContains
{
VTKM_IS_LIST_TAG(ListTag);
static VTKM_CONSTEXPR bool value = detail::ListContainsImpl<Type, typename ListTag::list>::value;
static constexpr bool value = detail::ListContainsImpl<Type, typename ListTag::list>::value;
};
} // namespace vtkm
......
......@@ -46,8 +46,8 @@ class Matrix
{
public:
using ComponentType = T;
static const vtkm::IdComponent NUM_ROWS = NumRow;
static const vtkm::IdComponent NUM_COLUMNS = NumCol;
static constexpr vtkm::IdComponent NUM_ROWS = NumRow;
static constexpr vtkm::IdComponent NUM_COLUMNS = NumCol;
VTKM_EXEC_CONT
Matrix() {}
......@@ -547,7 +547,7 @@ private:
public:
using ComponentType = T;
static const vtkm::IdComponent NUM_COMPONENTS = NumRow * NumCol;
static constexpr vtkm::IdComponent NUM_COMPONENTS = NumRow * NumCol;
using HasMultipleComponents = vtkm::VecTraitsTagMultipleComponents;
using IsSizeStatic = vtkm::VecTraitsTagSizeStatic;
......
......@@ -207,7 +207,7 @@ struct TypeListTagCommon : vtkm::ListTagBase<vtkm::Int32,
template <typename Type>
struct ListContains<vtkm::TypeListTagAll, Type>
{
static const bool value = true;
static constexpr bool value = true;
};
} // namespace vtkm
......
......@@ -606,7 +606,7 @@ class VTKM_ALWAYS_EXPORT VecBase : public vtkm::detail::VecBaseCommon<T, Derived
{
public:
using ComponentType = T;
static const vtkm::IdComponent NUM_COMPONENTS = Size;
static constexpr vtkm::IdComponent NUM_COMPONENTS = Size;
protected:
VecBase() = default;
......@@ -764,7 +764,7 @@ class VTKM_ALWAYS_EXPORT Vec : public detail::VecBase<T, Size, Vec<T, Size>>
public:
#ifdef VTKM_DOXYGEN_ONLY
using ComponentType = T;
static const vtkm::IdComponent NUM_COMPONENTS = Size;
static constexpr vtkm::IdComponent NUM_COMPONENTS = Size;
#endif
Vec() = default;
......@@ -792,7 +792,7 @@ class VTKM_ALWAYS_EXPORT Vec<T, 0>
{
public:
using ComponentType = T;
static const vtkm::IdComponent NUM_COMPONENTS = 0;
static constexpr vtkm::IdComponent NUM_COMPONENTS = 0;
Vec() = default;
VTKM_EXEC_CONT explicit Vec(const ComponentType&) {}
......
......@@ -25,6 +25,7 @@
#include <vtkm/TypeTraits.h>
#include <vtkm/Types.h>
#include <vtkm/VecTraits.h>
#include <vtkm/internal/ExportMacros.h>
namespace vtkm
{
......@@ -41,19 +42,31 @@ struct VecAxisAlignedPointCoordinatesNumComponents;
template <>
struct VecAxisAlignedPointCoordinatesNumComponents<1>
{
static const vtkm::IdComponent NUM_COMPONENTS = 2;
static constexpr vtkm::IdComponent NUM_COMPONENTS = 2;
};
template <>
struct VecAxisAlignedPointCoordinatesNumComponents<2>
{
static const vtkm::IdComponent NUM_COMPONENTS = 4;
static constexpr vtkm::IdComponent NUM_COMPONENTS = 4;
};
template <>
struct VecAxisAlignedPointCoordinatesNumComponents<3>
{
static const vtkm::IdComponent NUM_COMPONENTS = 8;
static constexpr vtkm::IdComponent NUM_COMPONENTS = 8;
};
struct VecAxisAlignedPointCoordinatesOffsetTable
{
VTKM_EXEC_CONT vtkm::FloatDefault Get(vtkm::Int32 i, vtkm::Int32 j) const
{
VTKM_STATIC_CONSTEXPR_ARRAY vtkm::FloatDefault offsetTable[8][3] = {
{ 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, 1.0f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 1.0f }
};
return offsetTable[i][j];
}
};
} // namespace detail
......@@ -77,7 +90,7 @@ class VecAxisAlignedPointCoordinates
public:
using ComponentType = vtkm::Vec<vtkm::FloatDefault, 3>;
static const vtkm::IdComponent NUM_COMPONENTS =
static constexpr vtkm::IdComponent NUM_COMPONENTS =
detail::VecAxisAlignedPointCoordinatesNumComponents<NumDimensions>::NUM_COMPONENTS;
VTKM_EXEC_CONT
......@@ -104,15 +117,10 @@ public:
VTKM_EXEC_CONT
ComponentType operator[](vtkm::IdComponent index) const
{
static const vtkm::FloatDefault VecAxisAlignedPointCoordinatesOffsetTable[8][3] = {
{ 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f }, { 1.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f },
{ 0.0f, 0.0f, 1.0f }, { 1.0f, 0.0f, 1.0f }, { 1.0f, 1.0f, 1.0f }, { 0.0f, 1.0f, 1.0f }
};
const auto& offset = VecAxisAlignedPointCoordinatesOffsetTable[index];
return ComponentType(this->Origin[0] + offset[0] * this->Spacing[0],
this->Origin[1] + offset[1] * this->Spacing[1],
this->Origin[2] + offset[2] * this->Spacing[2]);
detail::VecAxisAlignedPointCoordinatesOffsetTable table;
return ComponentType(this->Origin[0] + table.Get(index, 0) * this->Spacing[0],
this->Origin[1] + table.Get(index, 1) * this->Spacing[1],
this->Origin[2] + table.Get(index, 2) * this->Spacing[2]);
}
VTKM_EXEC_CONT
......@@ -152,7 +160,7 @@ struct VecTraits<vtkm::VecAxisAlignedPointCoordinates<NumDimensions>>
using HasMultipleComponents = vtkm::VecTraitsTagMultipleComponents;
using IsSizeStatic = vtkm::VecTraitsTagSizeStatic;
static const vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
static constexpr vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
VTKM_EXEC_CONT
static vtkm::IdComponent GetNumberOfComponents(const VecType&) { return NUM_COMPONENTS; }
......
......@@ -84,7 +84,7 @@ struct VecTraits
///
/// This is only defined for vectors of a static size.
///
static const vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
static constexpr vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
/// Number of components in the given vector.
///
......@@ -149,7 +149,7 @@ struct VecTraits<vtkm::Vec<T, Size>>
/// Number of components in the vector.
///
static const vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
static constexpr vtkm::IdComponent NUM_COMPONENTS = VecType::NUM_COMPONENTS;
/// Number of components in the given vector.
///
......@@ -335,7 +335,7 @@ template <typename ScalarType>
struct VecTraitsBasic
{
using ComponentType = ScalarType;
static const vtkm::IdComponent NUM_COMPONENTS = 1;
static constexpr vtkm::IdComponent NUM_COMPONENTS = 1;
using HasMultipleComponents = vtkm::VecTraitsTagSingleComponent;
using IsSizeStatic = vtkm::VecTraitsTagSizeStatic;
......
......@@ -59,7 +59,7 @@ VTKM_EXEC_CONT vtkm::Vec<ValueType, N> Lerp(const vtkm::Vec<ValueType, N>& value
const vtkm::Vec<ValueType, N>& value1,
const vtkm::Vec<ValueType, N>& weight)
{
static const vtkm::Vec<ValueType, N> One(ValueType(1));
const vtkm::Vec<ValueType, N> One(ValueType(1));
return (One - weight) * value0 + weight * value1;
}
......
......@@ -58,20 +58,28 @@ class VTKM_CONT_EXPORT ArrayHandleBase
{
};
/// Checks to see if the given type and storage can form a valid array handle