Commit 57440239 authored by Kenneth Moreland's avatar Kenneth Moreland Committed by Kitware Robot

Merge topic 'vec-typedefs'

53e86893 Add changedoc for common vec types
0be50c11 Update VTK-m code to use new Vec aliases
b3e29521 Add aliases for common Vec types
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !1743
parents 881b1713 53e86893
......@@ -140,21 +140,21 @@ struct BenchmarkValueTypeFunctor
bool operator()(DeviceAdapter id)
{
BenchmarkValueType<vtkm::UInt8, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec<vtkm::UInt8, 2>, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec<vtkm::UInt8, 3>, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec<vtkm::UInt8, 4>, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec2ui_8, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec3ui_8, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec4ui_8, DeviceAdapter>(id);
BenchmarkValueType<vtkm::UInt32, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec<vtkm::UInt32, 2>, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec2ui_32, DeviceAdapter>(id);
BenchmarkValueType<vtkm::UInt64, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec<vtkm::UInt64, 2>, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec2ui_64, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Float32, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec<vtkm::Float32, 2>, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec2f_32, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Float64, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec<vtkm::Float64, 2>, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Vec2f_64, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Pair<vtkm::UInt32, vtkm::Float32>, DeviceAdapter>(id);
BenchmarkValueType<vtkm::Pair<vtkm::UInt32, vtkm::Float64>, DeviceAdapter>(id);
......
......@@ -147,14 +147,14 @@ struct BaseTypes : vtkm::ListTagBase<vtkm::UInt8,
vtkm::Int64,
vtkm::Pair<vtkm::Id, vtkm::Float32>,
vtkm::Float32,
vtkm::Vec<vtkm::Float32, 3>,
vtkm::Vec3f_32,
vtkm::Float64,
vtkm::Vec<vtkm::Float64, 3>>
vtkm::Vec3f_64>
{
};
struct ExtendedTypes : vtkm::ListTagBase<vtkm::UInt8,
vtkm::Vec<vtkm::UInt8, 4>,
vtkm::Vec4ui_8,
vtkm::Int32,
vtkm::Int64,
vtkm::Pair<vtkm::Int32, vtkm::Float32>,
......@@ -162,9 +162,9 @@ struct ExtendedTypes : vtkm::ListTagBase<vtkm::UInt8,
vtkm::Pair<vtkm::Int64, vtkm::Float64>,
vtkm::Pair<vtkm::Int64, vtkm::Float64>,
vtkm::Float32,
vtkm::Vec<vtkm::Float32, 3>,
vtkm::Vec3f_32,
vtkm::Float64,
vtkm::Vec<vtkm::Float64, 3>>
vtkm::Vec3f_64>
{
};
......
......@@ -344,7 +344,7 @@ struct ValueTypes : vtkm::ListTagBase<vtkm::Float32, vtkm::Float64>
{
};
struct InterpValueTypes : vtkm::ListTagBase<vtkm::Float32, vtkm::Vec<vtkm::Float32, 3>>
struct InterpValueTypes : vtkm::ListTagBase<vtkm::Float32, vtkm::Vec3f_32>
{
};
......@@ -876,7 +876,7 @@ private:
struct ImplicitFunctionBenchData
{
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> Points;
vtkm::cont::ArrayHandle<vtkm::Vec3f> Points;
vtkm::cont::ArrayHandle<vtkm::FloatDefault> Result;
vtkm::Sphere Sphere1, Sphere2;
};
......
......@@ -133,10 +133,7 @@ static bool ReducedOptions;
// Limit the filter executions to only consider the following types, otherwise
// compile times and binary sizes are nuts.
using FieldTypes = vtkm::ListTagBase<vtkm::Float32,
vtkm::Float64,
vtkm::Vec<vtkm::Float32, 3>,
vtkm::Vec<vtkm::Float64, 3>>;
using FieldTypes = vtkm::ListTagBase<vtkm::Float32, vtkm::Float64, vtkm::Vec3f_32, vtkm::Vec3f_64>;
using StructuredCellList = vtkm::ListTagBase<vtkm::cont::CellSetStructured<3>>;
......@@ -145,7 +142,7 @@ using UnstructuredCellList =
using AllCellList = vtkm::ListTagJoin<StructuredCellList, UnstructuredCellList>;
using CoordinateList = vtkm::ListTagBase<vtkm::Vec<vtkm::Float32, 3>, vtkm::Vec<vtkm::Float64, 3>>;
using CoordinateList = vtkm::ListTagBase<vtkm::Vec3f_32, vtkm::Vec3f_64>;
class BenchmarkFilterPolicy : public vtkm::filter::PolicyBase<BenchmarkFilterPolicy>
{
......@@ -816,8 +813,8 @@ public:
using ExecutionSignature = _2(_1);
vtkm::Bounds Bounds;
vtkm::Vec<vtkm::Float64, 3> Center;
vtkm::Vec<vtkm::Float64, 3> Scale;
vtkm::Vec3f_64 Center;
vtkm::Vec3f_64 Scale;
VTKM_CONT
PointVectorGenerator(const vtkm::Bounds& bounds)
......@@ -833,7 +830,7 @@ public:
VTKM_EXEC vtkm::Vec<T, 3> operator()(vtkm::Vec<T, 3> val) const
{
using Vec3T = vtkm::Vec<T, 3>;
using Vec3F64 = vtkm::Vec<vtkm::Float64, 3>;
using Vec3F64 = vtkm::Vec3f_64;
Vec3F64 valF64{ val };
Vec3F64 periodic = (valF64 - this->Center) * this->Scale;
......@@ -933,7 +930,7 @@ void CreateFields(bool needPointScalars, bool needCellScalars, bool needPointVec
auto coords = InputDataSet.GetCoordinateSystem();
auto bounds = coords.GetBounds();
auto points = coords.GetData();
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> pvecs;
vtkm::cont::ArrayHandle<vtkm::Vec3f> pvecs;
PointVectorGenerator worklet(bounds);
vtkm::worklet::DispatcherMapField<PointVectorGenerator> dispatch(worklet);
......
......@@ -42,7 +42,7 @@ struct BenchRayTracing
{
vtkm::rendering::raytracing::RayTracer Tracer;
vtkm::rendering::raytracing::Camera RayCamera;
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> Indices;
vtkm::cont::ArrayHandle<vtkm::Id4> Indices;
vtkm::rendering::raytracing::Ray<Precision> Rays;
vtkm::cont::CoordinateSystem Coords;
vtkm::cont::DataSet Data;
......@@ -82,11 +82,11 @@ struct BenchRayTracing
Tracer.SetField(field, range);
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::UInt8, 4>> temp;
vtkm::cont::ArrayHandle<vtkm::Vec4ui_8> temp;
vtkm::cont::ColorTable table("cool to warm");
table.Sample(100, temp);
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 4>> colors;
vtkm::cont::ArrayHandle<vtkm::Vec4f_32> colors;
colors.Allocate(100);
auto portal = colors.GetPortalControl();
auto colorPortal = temp.GetPortalConstControl();
......@@ -94,10 +94,10 @@ struct BenchRayTracing
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);
vtkm::Vec4f_32 t(color[0] * conversionToFloatSpace,
color[1] * conversionToFloatSpace,
color[2] * conversionToFloatSpace,
color[3] * conversionToFloatSpace);
portal.Set(i, t);
}
......
# Add aliases for common Vec types
Specifying `Vec` types can be verbose. For example, to simply express a
vector in 3-space, you would need a declaration like this:
``` cpp
vtkm::Vec<vtkm::FloatDefault, 3>
```
This is very verbose and frankly confusing to users. To make things easier,
we have introduced several aliases for common `Vec` types. For example, the
above type can now be referenced simply with `vtkm::Vec3f`, which is a
3-vec of floating point values of the default width. If you want to specify
the width, then you can use either `vtkm::Vec3f_32` or `vtkm::Vec3f_64`.
There are likewise types introduced for integers and unsigned integers
(e.g. `vtkm::Vec3i` and `vtkm::Vec3ui`). You can specify the width of these
all the way down to 8 bit (e.g. `vtkm::Vec3ui_8`, `vtkm::Vec3ui_16`,
`vtkm::Vec3ui_32`, and `vtkm::Vec3ui_64`).
For completeness, `vtkm::Id4` was added as well as `vtkm::IdComponent2`,
`vtkm::IdComponent3`, and `vtkm::IdComponent4`.
......@@ -23,7 +23,7 @@
#include <stdexcept>
#include <string>
using FloatVec3 = vtkm::Vec<vtkm::Float32, 3>;
using FloatVec3 = vtkm::Vec3f_32;
namespace
{
......
......@@ -84,7 +84,7 @@ int main(int argc, char* argv[])
camera.ResetToBounds(coordsBounds);
vtkm::Vec<vtkm::Float32, 3> totalExtent;
vtkm::Vec3f_32 totalExtent;
totalExtent[0] = vtkm::Float32(coordsBounds.X.Max - coordsBounds.X.Min);
totalExtent[1] = vtkm::Float32(coordsBounds.Y.Max - coordsBounds.Y.Min);
totalExtent[2] = vtkm::Float32(coordsBounds.Z.Max - coordsBounds.Z.Min);
......
......@@ -54,7 +54,7 @@
struct GameOfLifePolicy : public vtkm::filter::PolicyBase<GameOfLifePolicy>
{
using FieldTypeList = vtkm::ListTagBase<vtkm::UInt8, vtkm::Vec<vtkm::UInt8, 4>>;
using FieldTypeList = vtkm::ListTagBase<vtkm::UInt8, vtkm::Vec4ui_8>;
};
struct UpdateLifeState : public vtkm::worklet::WorkletPointNeighborhood
......@@ -71,7 +71,7 @@ struct UpdateLifeState : public vtkm::worklet::WorkletPointNeighborhood
template <typename NeighIn>
VTKM_EXEC void operator()(const NeighIn& prevstate,
vtkm::UInt8& state,
vtkm::Vec<vtkm::UInt8, 4>& color) const
vtkm::Vec4ui_8& color) const
{
// Any live cell with fewer than two live neighbors dies, as if caused by under-population.
// Any live cell with two or three live neighbors lives on to the next generation.
......@@ -116,7 +116,7 @@ public:
vtkm::cont::ArrayHandle<vtkm::UInt8> state;
vtkm::cont::ArrayHandle<vtkm::UInt8> prevstate;
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::UInt8, 4>> colors;
vtkm::cont::ArrayHandle<vtkm::Vec4ui_8> colors;
//get the coordinate system we are using for the 2D area
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
......@@ -165,7 +165,7 @@ struct UploadData
template <typename DeviceAdapterTag>
bool operator()(DeviceAdapterTag device)
{
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::UInt8, 4>> colors;
vtkm::cont::ArrayHandle<vtkm::Vec4ui_8> colors;
this->Colors.GetData().CopyTo(colors);
vtkm::interop::TransferToOpenGL(colors, *this->ColorState, device);
return true;
......
......@@ -41,7 +41,7 @@
template <typename T>
struct HelloVTKMInterop
{
vtkm::Vec<vtkm::Int32, 2> Dims;
vtkm::Vec2i_32 Dims;
GLuint ProgramId;
GLuint VAOId;
......@@ -54,7 +54,7 @@ struct HelloVTKMInterop
std::vector<vtkm::Vec<T, 3>> InputData;
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>> InHandle;
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>> OutCoords;
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::UInt8, 4>> OutColors;
vtkm::cont::ArrayHandle<vtkm::Vec4ui_8> OutColors;
HelloVTKMInterop(vtkm::Int32 width, vtkm::Int32 height)
: Dims(256, 256)
......@@ -82,7 +82,7 @@ struct HelloVTKMInterop
}
}
this->Dims = vtkm::Vec<vtkm::Int32, 2>(dim, dim);
this->Dims = vtkm::Vec2i_32(dim, dim);
this->InHandle = vtkm::cont::make_ArrayHandle(this->InputData);
glGenVertexArrays(1, &this->VAOId);
......@@ -136,7 +136,7 @@ struct HelloVTKMInterop
VTKM_EXEC
void operator()(const vtkm::Vec<T, 3>& input,
vtkm::Vec<T, 3>& output,
vtkm::Vec<vtkm::UInt8, 4>& color) const
vtkm::Vec4ui_8& color) const
{
output[0] = input[0];
output[1] = 0.25f * vtkm::Sin(input[0] * 10.f + t) * vtkm::Cos(input[2] * 10.f + t);
......
......@@ -34,7 +34,7 @@
#include <vector>
static vtkm::Id3 dims(256, 256, 256);
static vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>> verticesArray, normalsArray;
static vtkm::cont::ArrayHandle<vtkm::Vec3f_32> verticesArray, normalsArray;
static vtkm::cont::ArrayHandle<vtkm::Float32> scalarsArray;
static Quaternion qrot;
static int lastx, lasty;
......@@ -107,10 +107,10 @@ vtkm::cont::DataSet MakeIsosurfaceTestDataSet(vtkm::Id3 dims)
TangleField(vdims, mins, maxs));
tangleFieldDispatcher.Invoke(vertexCountImplicitArray, fieldArray);
vtkm::Vec<vtkm::FloatDefault, 3> origin(0.0f, 0.0f, 0.0f);
vtkm::Vec<vtkm::FloatDefault, 3> spacing(1.0f / static_cast<vtkm::FloatDefault>(dims[0]),
1.0f / static_cast<vtkm::FloatDefault>(dims[2]),
1.0f / static_cast<vtkm::FloatDefault>(dims[1]));
vtkm::Vec3f origin(0.0f, 0.0f, 0.0f);
vtkm::Vec3f spacing(1.0f / static_cast<vtkm::FloatDefault>(dims[0]),
1.0f / static_cast<vtkm::FloatDefault>(dims[2]),
1.0f / static_cast<vtkm::FloatDefault>(dims[1]));
vtkm::cont::ArrayHandleUniformPointCoordinates coordinates(vdims, origin, spacing);
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates));
......@@ -177,8 +177,8 @@ void displayCall()
glBegin(GL_TRIANGLES);
for (vtkm::IdComponent i = 0; i < verticesArray.GetNumberOfValues(); i++)
{
vtkm::Vec<vtkm::Float32, 3> curNormal = normalsArray.GetPortalConstControl().Get(i);
vtkm::Vec<vtkm::Float32, 3> curVertex = verticesArray.GetPortalConstControl().Get(i);
vtkm::Vec3f_32 curNormal = normalsArray.GetPortalConstControl().Get(i);
vtkm::Vec3f_32 curVertex = verticesArray.GetPortalConstControl().Get(i);
glNormal3f(curNormal[0], curNormal[1], curNormal[2]);
glVertex3f(curVertex[0], curVertex[1], curVertex[2]);
}
......@@ -242,7 +242,7 @@ int main(int argc, char* argv[])
vtkm::cont::DataSet outputData = filter.Execute(dataSet);
//need to extract vertices, normals, and scalars
using VertType = vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>>;
using VertType = vtkm::cont::ArrayHandle<vtkm::Vec3f_32>;
vtkm::cont::CoordinateSystem coords = outputData.GetCoordinateSystem();
verticesArray = coords.GetData().Cast<VertType>();
......
......@@ -44,15 +44,15 @@ vtkm::cont::DataSet make3DRectilinearDataSet(double time)
double zdiff = (zmax - zmin) / (dims[2] - 1);
vtkm::Id3 DIMS(dims[0], dims[1], dims[2]);
vtkm::Vec<vtkm::Float64, 3> ORIGIN(0, 0, 0);
vtkm::Vec<vtkm::Float64, 3> SPACING(xdiff, ydiff, zdiff);
vtkm::Vec3f_64 ORIGIN(0, 0, 0);
vtkm::Vec3f_64 SPACING(xdiff, ydiff, zdiff);
vtkm::cont::DataSet dataset = dsb.Create(DIMS, ORIGIN, SPACING);
vtkm::cont::DataSetFieldAdd dsf;
int numPoints = dims[0] * dims[1] * dims[2];
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3>> velocityField;
vtkm::cont::ArrayHandle<vtkm::Vec3f_64> velocityField;
velocityField.Allocate(numPoints);
int count = 0;
......@@ -65,8 +65,7 @@ vtkm::cont::DataSet make3DRectilinearDataSet(double time)
double vec[3];
double loc[3] = { i * xdiff + xmin, j * ydiff + ymax, k * zdiff + zmin };
field.calculateVelocity(loc, time, vec);
velocityField.GetPortalControl().Set(count,
vtkm::Vec<vtkm::Float64, 3>(vec[0], vec[1], vec[2]));
velocityField.GetPortalControl().Set(count, vtkm::Vec3f_64(vec[0], vec[1], vec[2]));
count++;
}
}
......
......@@ -48,7 +48,7 @@ inline vtkm::cont::DataSet Make3DExplicitDataSet()
vtkm::cont::DataSet dataSet;
vtkm::cont::DataSetBuilderExplicit dsb;
using CoordType = vtkm::Vec<vtkm::Float64, 3>;
using CoordType = vtkm::Vec3f_64;
std::vector<CoordType> coords = {
{ 0.00, 0.00, 0.00 }, { 1.00, 0.00, 0.00 }, { 2.00, 0.00, 0.00 }, { 0.00, 0.00, 1.00 },
......
......@@ -42,7 +42,7 @@ vtkm::cont::DataSet make_test3DImageData(vtkm::Id3 dims)
using FieldAdd = vtkm::cont::DataSetFieldAdd;
vtkm::cont::DataSet ds = Builder::Create(dims);
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> field;
vtkm::cont::ArrayHandle<vtkm::Vec3f> field;
vtkm::worklet::DispatcherMapField<WaveField> dispatcher;
dispatcher.Invoke(ds.GetCoordinateSystem(), field);
......
......@@ -62,10 +62,8 @@ template <>
class FilterTraits<MultiDeviceGradient>
{
public:
struct TypeListTagGradientInputs : vtkm::ListTagBase<vtkm::Float32,
vtkm::Float64,
vtkm::Vec<vtkm::Float32, 3>,
vtkm::Vec<vtkm::Float64, 3>>
struct TypeListTagGradientInputs
: vtkm::ListTagBase<vtkm::Float32, vtkm::Float64, vtkm::Vec3f_32, vtkm::Vec3f_64>
{
};
......
......@@ -24,11 +24,10 @@
#include <vtkm/rendering/Scene.h>
#include <vtkm/rendering/View3D.h>
vtkm::Vec<vtkm::FloatDefault, 3> ArchimedeanSpiralToCartesian(
vtkm::Vec<vtkm::FloatDefault, 3> const& p)
vtkm::Vec3f ArchimedeanSpiralToCartesian(vtkm::Vec3f const& p)
{
// p[0] = r, p[1] = theta, p[2] = z:
vtkm::Vec<vtkm::FloatDefault, 3> xyz;
vtkm::Vec3f xyz;
auto c = std::polar(p[0], p[1]);
xyz[0] = c.real();
xyz[1] = c.imag();
......@@ -51,9 +50,8 @@ void TubeThatSpiral(vtkm::FloatDefault radius, vtkm::Id numLineSegments, vtkm::I
numLineSegments; // roughly two spins around. Doesn't need to be perfect.
vtkm::FloatDefault r = a + b * t;
vtkm::FloatDefault theta = t;
vtkm::Vec<vtkm::FloatDefault, 3> cylindricalCoordinate{ r, theta, t };
vtkm::Vec<vtkm::FloatDefault, 3> spiralSample =
ArchimedeanSpiralToCartesian(cylindricalCoordinate);
vtkm::Vec3f cylindricalCoordinate{ r, theta, t };
vtkm::Vec3f spiralSample = ArchimedeanSpiralToCartesian(cylindricalCoordinate);
vtkm::Id pid = dsb.AddPoint(spiralSample);
ids.push_back(pid);
}
......@@ -68,7 +66,7 @@ void TubeThatSpiral(vtkm::FloatDefault radius, vtkm::Id numLineSegments, vtkm::I
// You added lines, but you need to extend it to a tube.
// This generates a new pointset, and new cell set.
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> tubePoints;
vtkm::cont::ArrayHandle<vtkm::Vec3f> tubePoints;
vtkm::cont::CellSetSingleType<> tubeCells;
tubeWorklet.Run(ds.GetCoordinateSystem(0), ds.GetCellSet(0), tubePoints, tubeCells);
......@@ -78,7 +76,7 @@ void TubeThatSpiral(vtkm::FloatDefault radius, vtkm::Id numLineSegments, vtkm::I
vtkm::Bounds coordsBounds = tubeDataset.GetCoordinateSystem().GetBounds();
vtkm::Vec<vtkm::Float64, 3> totalExtent(
vtkm::Vec3f_64 totalExtent(
coordsBounds.X.Length(), coordsBounds.Y.Length(), coordsBounds.Z.Length());
vtkm::Float64 mag = vtkm::Magnitude(totalExtent);
vtkm::Normalize(totalExtent);
......
......@@ -48,7 +48,7 @@ const vtkm::Float32 tStep = 0.5f;
const vtkm::Id direction = vtkm::worklet::streamline::BOTH;
// Point location of vertices from a CastAndCall but needs a static cast eventually
static vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>> vertexArray;
static vtkm::cont::ArrayHandle<vtkm::Vec3f_32> vertexArray;
// OpenGL display variables
Quaternion qrot;
......@@ -124,7 +124,7 @@ void displayCall()
glBegin(GL_LINE_STRIP);
for (vtkm::IdComponent i = 0; i < numIndices; i++)
{
vtkm::Vec<vtkm::Float32, 3> pt = vertexArray.GetPortalConstControl().Get(polylineIndices[i]);
vtkm::Vec3f_32 pt = vertexArray.GetPortalConstControl().Get(polylineIndices[i]);
glVertex3f(pt[0], pt[1], pt[2]);
}
glEnd();
......@@ -229,16 +229,16 @@ int main(int argc, char* argv[])
//We are done with the file now, so release the file descriptor
fclose(pFile);
std::vector<vtkm::Vec<vtkm::Float32, 3>> field;
std::vector<vtkm::Vec3f_32> field;
for (vtkm::Id i = 0; i < nElements; i++)
{
vtkm::Float32 x = data[i];
vtkm::Float32 y = data[++i];
vtkm::Float32 z = data[++i];
vtkm::Vec<vtkm::Float32, 3> vecData(x, y, z);
vtkm::Vec3f_32 vecData(x, y, z);
field.push_back(Normalize(vecData));
}
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>> fieldArray;
vtkm::cont::ArrayHandle<vtkm::Vec3f_32> fieldArray;
fieldArray = vtkm::cont::make_ArrayHandle(field);
// Construct the input dataset (uniform) to hold the input and set vector data
......
......@@ -116,10 +116,10 @@ vtkm::cont::DataSet CreateTestDataSet(vtkm::Id3 dims)
cellSet.SetPointDimensions(vdims);
dataSet.AddCellSet(cellSet);
vtkm::Vec<vtkm::FloatDefault, 3> origin(0.0f, 0.0f, 0.0f);
vtkm::Vec<vtkm::FloatDefault, 3> spacing(1.0f / static_cast<vtkm::FloatDefault>(dims[0]),
1.0f / static_cast<vtkm::FloatDefault>(dims[2]),
1.0f / static_cast<vtkm::FloatDefault>(dims[1]));
vtkm::Vec3f origin(0.0f, 0.0f, 0.0f);
vtkm::Vec3f spacing(1.0f / static_cast<vtkm::FloatDefault>(dims[0]),
1.0f / static_cast<vtkm::FloatDefault>(dims[2]),
1.0f / static_cast<vtkm::FloatDefault>(dims[1]));
vtkm::cont::ArrayHandleUniformPointCoordinates coordinates(vdims, origin, spacing);
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coordinates));
......@@ -175,7 +175,7 @@ void TestStreamlineUniformGrid(int d)
std::cout<<"Streamline with gridsize = "<<dims<<std::endl;
vtkm::cont::DataSet dataSet = MakeIsosurfaceTestDataSet(dims);
vtkm::cont::ArrayHandle< vtkm::Vec<vtkm::Float32,3> > result;
vtkm::cont::ArrayHandle<vtkm::Vec3f_32> result;
PointGrad<vtkm::Float32> func(dataSet, "nodevar", result);
vtkm::cont::CastAndCall(dataSet.GetCellSet(), func);
......@@ -417,17 +417,17 @@ int main(int argc, char** argv)
ret_code = fread(data, sizeof(float), static_cast<std::size_t>(nElements), pFile);
fclose(pFile);
std::vector<vtkm::Vec<vtkm::Float32, 3>> field;
std::vector<vtkm::Vec3f_32> field;
for (vtkm::Id i = 0; i < nElements; i++)
{
vtkm::Float32 x = data[i];
vtkm::Float32 y = data[++i];
vtkm::Float32 z = data[++i];
vtkm::Vec<vtkm::Float32, 3> vecData(x, y, z);
vtkm::Vec3f_32 vecData(x, y, z);
field.push_back(Normalize(vecData));
}
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 3>> fieldArray;
vtkm::cont::ArrayHandle<vtkm::Vec3f_32> fieldArray;
fieldArray = vtkm::cont::make_ArrayHandle(field);
// Construct the input dataset (uniform) to hold the input and set vector data
......
......@@ -172,7 +172,7 @@ void displayCall()
glColor3f(color[indx][0], color[indx][1], color[indx][2]);
// Get the indices of the vertices that make up this tetrahedron
vtkm::Vec<vtkm::Id, 4> tetIndices;
vtkm::Id4 tetIndices;
cellSet.GetIndices(tetra, tetIndices);
// Get the vertex points for this tetrahedron
......
......@@ -49,11 +49,10 @@ vtkm::cont::DataSet MakeTetrahedralizeTestDataSet(vtkm::Id3 dim)
// Place uniform grid on a set physical space so OpenGL drawing is easier
const vtkm::Id3 vdims(dim[0] + 1, dim[1] + 1, dim[2] + 1);
const vtkm::Vec<vtkm::Float32, 3> origin = vtkm::make_Vec(0.0f, 0.0f, 0.0f);
const vtkm::Vec<vtkm::Float32, 3> spacing =
vtkm::make_Vec(1.0f / static_cast<vtkm::Float32>(dim[0]),
1.0f / static_cast<vtkm::Float32>(dim[1]),
1.0f / static_cast<vtkm::Float32>(dim[2]));
const vtkm::Vec3f_32 origin = vtkm::make_Vec(0.0f, 0.0f, 0.0f);
const vtkm::Vec3f_32 spacing = vtkm::make_Vec(1.0f / static_cast<vtkm::Float32>(dim[0]),
1.0f / static_cast<vtkm::Float32>(dim[1]),
1.0f / static_cast<vtkm::Float32>(dim[2]));
// Generate coordinate system
vtkm::cont::ArrayHandleUniformPointCoordinates coordinates(vdims, origin, spacing);
......@@ -139,7 +138,7 @@ void displayCall()
glColor3f(color[indx][0], color[indx][1], color[indx][2]);
// Get the indices of the vertices that make up this tetrahedron
vtkm::Vec<vtkm::Id, 4> tetIndices;
vtkm::Id4 tetIndices;
cellSet.GetIndices(tetra, tetIndices);
// Get the vertex points for this tetrahedron
......
......@@ -143,13 +143,13 @@ void displayCall()
glColor3f(color[indx