mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
DataSetBuilders don't require a cellset name
This commit is contained in:
parent
89fa2c0293
commit
5cd47a7065
@ -194,7 +194,7 @@ inline vtkm::cont::DataSet Make3DExplicitDataSet()
|
||||
conn.push_back(7);
|
||||
conn.push_back(2);
|
||||
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
return dataSet;
|
||||
}
|
||||
|
@ -22,11 +22,9 @@ DataSetBuilderExplicitIterative::DataSetBuilderExplicitIterative()
|
||||
|
||||
|
||||
VTKM_CONT
|
||||
void DataSetBuilderExplicitIterative::Begin(const std::string& coordName,
|
||||
const std::string& cellName)
|
||||
void DataSetBuilderExplicitIterative::Begin(const std::string& coordName)
|
||||
{
|
||||
this->coordNm = coordName;
|
||||
this->cellNm = cellName;
|
||||
this->points.resize(0);
|
||||
this->shapes.resize(0);
|
||||
this->numIdx.resize(0);
|
||||
@ -38,7 +36,7 @@ VTKM_CONT
|
||||
vtkm::cont::DataSet DataSetBuilderExplicitIterative::Create()
|
||||
{
|
||||
DataSetBuilderExplicit dsb;
|
||||
return dsb.Create(points, shapes, numIdx, connectivity, coordNm, cellNm);
|
||||
return dsb.Create(points, shapes, numIdx, connectivity, coordNm);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
|
@ -45,12 +45,11 @@ public:
|
||||
const std::vector<vtkm::UInt8>& shapes,
|
||||
const std::vector<vtkm::IdComponent>& numIndices,
|
||||
const std::vector<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm = "coords",
|
||||
const std::string& cellNm = "cells")
|
||||
const std::string& coordsNm = "coords")
|
||||
{
|
||||
std::vector<T> yVals(xVals.size(), 0), zVals(xVals.size(), 0);
|
||||
return DataSetBuilderExplicit::Create(
|
||||
xVals, yVals, zVals, shapes, numIndices, connectivity, coordsNm, cellNm);
|
||||
xVals, yVals, zVals, shapes, numIndices, connectivity, coordsNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -59,12 +58,11 @@ public:
|
||||
const std::vector<vtkm::UInt8>& shapes,
|
||||
const std::vector<vtkm::IdComponent>& numIndices,
|
||||
const std::vector<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm = "coords",
|
||||
const std::string& cellNm = "cells")
|
||||
const std::string& coordsNm = "coords")
|
||||
{
|
||||
std::vector<T> zVals(xVals.size(), 0);
|
||||
return DataSetBuilderExplicit::Create(
|
||||
xVals, yVals, zVals, shapes, numIndices, connectivity, coordsNm, cellNm);
|
||||
xVals, yVals, zVals, shapes, numIndices, connectivity, coordsNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -74,8 +72,7 @@ public:
|
||||
const std::vector<vtkm::UInt8>& shapes,
|
||||
const std::vector<vtkm::IdComponent>& numIndices,
|
||||
const std::vector<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm = "coords",
|
||||
const std::string& cellNm = "cells");
|
||||
const std::string& coordsNm = "coords");
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(
|
||||
@ -85,11 +82,10 @@ public:
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8>& shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent>& numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm = "coords",
|
||||
const std::string& cellNm = "cells")
|
||||
const std::string& coordsNm = "coords")
|
||||
{
|
||||
return DataSetBuilderExplicit::BuildDataSet(
|
||||
xVals, yVals, zVals, shapes, numIndices, connectivity, coordsNm, cellNm);
|
||||
xVals, yVals, zVals, shapes, numIndices, connectivity, coordsNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -97,8 +93,7 @@ public:
|
||||
const std::vector<vtkm::UInt8>& shapes,
|
||||
const std::vector<vtkm::IdComponent>& numIndices,
|
||||
const std::vector<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm = "coords",
|
||||
const std::string& cellNm = "cells");
|
||||
const std::string& coordsNm = "coords");
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(
|
||||
@ -106,11 +101,9 @@ public:
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8>& shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent>& numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm = "coords",
|
||||
const std::string& cellNm = "cells")
|
||||
const std::string& coordsNm = "coords")
|
||||
{
|
||||
return DataSetBuilderExplicit::BuildDataSet(
|
||||
coords, shapes, numIndices, connectivity, coordsNm, cellNm);
|
||||
return DataSetBuilderExplicit::BuildDataSet(coords, shapes, numIndices, connectivity, coordsNm);
|
||||
}
|
||||
|
||||
template <typename T, typename CellShapeTag>
|
||||
@ -118,8 +111,7 @@ public:
|
||||
CellShapeTag tag,
|
||||
vtkm::IdComponent numberOfPointsPerCell,
|
||||
const std::vector<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm = "coords",
|
||||
const std::string& cellNm = "cells");
|
||||
const std::string& coordsNm = "coords");
|
||||
|
||||
template <typename T, typename CellShapeTag>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(
|
||||
@ -127,11 +119,10 @@ public:
|
||||
CellShapeTag tag,
|
||||
vtkm::IdComponent numberOfPointsPerCell,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm = "coords",
|
||||
const std::string& cellNm = "cells")
|
||||
const std::string& coordsNm = "coords")
|
||||
{
|
||||
return DataSetBuilderExplicit::BuildDataSet(
|
||||
coords, tag, numberOfPointsPerCell, connectivity, coordsNm, cellNm);
|
||||
coords, tag, numberOfPointsPerCell, connectivity, coordsNm);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -143,8 +134,7 @@ private:
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8>& shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent>& numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm);
|
||||
const std::string& coordsNm);
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet BuildDataSet(
|
||||
@ -152,8 +142,7 @@ private:
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8>& shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent>& numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm);
|
||||
const std::string& coordsNm);
|
||||
|
||||
template <typename T, typename CellShapeTag>
|
||||
VTKM_CONT static vtkm::cont::DataSet BuildDataSet(
|
||||
@ -161,8 +150,7 @@ private:
|
||||
CellShapeTag tag,
|
||||
vtkm::IdComponent numberOfPointsPerCell,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm);
|
||||
const std::string& coordsNm);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -173,8 +161,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::Create(
|
||||
const std::vector<vtkm::UInt8>& shapes,
|
||||
const std::vector<vtkm::IdComponent>& numIndices,
|
||||
const std::vector<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm)
|
||||
const std::string& coordsNm)
|
||||
{
|
||||
VTKM_ASSERT(xVals.size() == yVals.size() && yVals.size() == zVals.size() && xVals.size() > 0);
|
||||
|
||||
@ -190,7 +177,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::Create(
|
||||
DataSetBuilderExplicit::CopyInto(numIndices, Nc);
|
||||
DataSetBuilderExplicit::CopyInto(connectivity, Cc);
|
||||
|
||||
return DataSetBuilderExplicit::BuildDataSet(Xc, Yc, Zc, Sc, Nc, Cc, coordsNm, cellNm);
|
||||
return DataSetBuilderExplicit::BuildDataSet(Xc, Yc, Zc, Sc, Nc, Cc, coordsNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -201,8 +188,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::BuildDataSet(
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8>& shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent>& numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm)
|
||||
const std::string& coordsNm)
|
||||
{
|
||||
VTKM_ASSERT(X.GetNumberOfValues() == Y.GetNumberOfValues() &&
|
||||
Y.GetNumberOfValues() == Z.GetNumberOfValues() && X.GetNumberOfValues() > 0 &&
|
||||
@ -212,7 +198,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::BuildDataSet(
|
||||
dataSet.AddCoordinateSystem(
|
||||
vtkm::cont::CoordinateSystem(coordsNm, make_ArrayHandleCompositeVector(X, Y, Z)));
|
||||
vtkm::Id nPts = X.GetNumberOfValues();
|
||||
vtkm::cont::CellSetExplicit<> cellSet(cellNm);
|
||||
vtkm::cont::CellSetExplicit<> cellSet("cells");
|
||||
|
||||
cellSet.Fill(nPts, shapes, numIndices, connectivity);
|
||||
dataSet.SetCellSet(cellSet);
|
||||
@ -226,8 +212,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::Create(
|
||||
const std::vector<vtkm::UInt8>& shapes,
|
||||
const std::vector<vtkm::IdComponent>& numIndices,
|
||||
const std::vector<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm)
|
||||
const std::string& coordsNm)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<Vec<T, 3>> coordsArray;
|
||||
DataSetBuilderExplicit::CopyInto(coords, coordsArray);
|
||||
@ -239,7 +224,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::Create(
|
||||
DataSetBuilderExplicit::CopyInto(numIndices, Nc);
|
||||
DataSetBuilderExplicit::CopyInto(connectivity, Cc);
|
||||
|
||||
return DataSetBuilderExplicit::Create(coordsArray, Sc, Nc, Cc, coordsNm, cellNm);
|
||||
return DataSetBuilderExplicit::Create(coordsArray, Sc, Nc, Cc, coordsNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -248,14 +233,13 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::BuildDataSet(
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8>& shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent>& numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm)
|
||||
const std::string& coordsNm)
|
||||
{
|
||||
vtkm::cont::DataSet dataSet;
|
||||
|
||||
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem(coordsNm, coords));
|
||||
vtkm::Id nPts = static_cast<vtkm::Id>(coords.GetNumberOfValues());
|
||||
vtkm::cont::CellSetExplicit<> cellSet(cellNm);
|
||||
vtkm::cont::CellSetExplicit<> cellSet("cells");
|
||||
|
||||
cellSet.Fill(nPts, shapes, numIndices, connectivity);
|
||||
dataSet.SetCellSet(cellSet);
|
||||
@ -269,8 +253,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::Create(
|
||||
CellShapeTag tag,
|
||||
vtkm::IdComponent numberOfPointsPerCell,
|
||||
const std::vector<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm)
|
||||
const std::string& coordsNm)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<Vec<T, 3>> coordsArray;
|
||||
DataSetBuilderExplicit::CopyInto(coords, coordsArray);
|
||||
@ -278,8 +261,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::Create(
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> Cc;
|
||||
DataSetBuilderExplicit::CopyInto(connectivity, Cc);
|
||||
|
||||
return DataSetBuilderExplicit::Create(
|
||||
coordsArray, tag, numberOfPointsPerCell, Cc, coordsNm, cellNm);
|
||||
return DataSetBuilderExplicit::Create(coordsArray, tag, numberOfPointsPerCell, Cc, coordsNm);
|
||||
}
|
||||
|
||||
template <typename T, typename CellShapeTag>
|
||||
@ -288,14 +270,13 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::BuildDataSet(
|
||||
CellShapeTag tag,
|
||||
vtkm::IdComponent numberOfPointsPerCell,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
|
||||
const std::string& coordsNm,
|
||||
const std::string& cellNm)
|
||||
const std::string& coordsNm)
|
||||
{
|
||||
(void)tag; //C4100 false positive workaround
|
||||
vtkm::cont::DataSet dataSet;
|
||||
|
||||
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem(coordsNm, coords));
|
||||
vtkm::cont::CellSetSingleType<> cellSet(cellNm);
|
||||
vtkm::cont::CellSetSingleType<> cellSet("cells");
|
||||
|
||||
cellSet.Fill(coords.GetNumberOfValues(), tag.Id, numberOfPointsPerCell, connectivity);
|
||||
dataSet.SetCellSet(cellSet);
|
||||
@ -310,7 +291,7 @@ public:
|
||||
DataSetBuilderExplicitIterative();
|
||||
|
||||
VTKM_CONT
|
||||
void Begin(const std::string& coordName = "coords", const std::string& cellName = "cells");
|
||||
void Begin(const std::string& coordName = "coords");
|
||||
|
||||
//Define points.
|
||||
VTKM_CONT
|
||||
@ -349,7 +330,7 @@ public:
|
||||
void AddCellPoint(vtkm::Id pointIndex);
|
||||
|
||||
private:
|
||||
std::string coordNm, cellNm;
|
||||
std::string coordNm;
|
||||
|
||||
std::vector<vtkm::Vec3f_32> points;
|
||||
std::vector<vtkm::UInt8> shapes;
|
||||
|
@ -50,46 +50,41 @@ public:
|
||||
//1D grids.
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const std::vector<T>& xvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
std::vector<T> yvals(1, 0), zvals(1, 0);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(vtkm::Id nx,
|
||||
T* xvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
T yvals = 0, zvals = 0;
|
||||
return DataSetBuilderRectilinear::BuildDataSet(
|
||||
nx, 1, 1, xvals, &yvals, &zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(nx, 1, 1, xvals, &yvals, &zvals, coordNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::cont::ArrayHandle<T>& xvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> yvals, zvals;
|
||||
yvals.Allocate(1);
|
||||
yvals.GetPortalControl().Set(0, 0.0);
|
||||
zvals.Allocate(1);
|
||||
zvals.GetPortalControl().Set(0, 0.0);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm);
|
||||
}
|
||||
|
||||
//2D grids.
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const std::vector<T>& xvals,
|
||||
const std::vector<T>& yvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
std::vector<T> zvals(1, 0);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -97,24 +92,21 @@ public:
|
||||
vtkm::Id ny,
|
||||
T* xvals,
|
||||
T* yvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
T zvals = 0;
|
||||
return DataSetBuilderRectilinear::BuildDataSet(
|
||||
nx, ny, 1, xvals, yvals, &zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(nx, ny, 1, xvals, yvals, &zvals, coordNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::cont::ArrayHandle<T>& xvals,
|
||||
const vtkm::cont::ArrayHandle<T>& yvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T> zvals;
|
||||
zvals.Allocate(1);
|
||||
zvals.GetPortalControl().Set(0, 0.0);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm);
|
||||
}
|
||||
|
||||
//3D grids.
|
||||
@ -125,31 +117,27 @@ public:
|
||||
T* xvals,
|
||||
T* yvals,
|
||||
T* zvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
return DataSetBuilderRectilinear::BuildDataSet(
|
||||
nx, ny, nz, xvals, yvals, zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(nx, ny, nz, xvals, yvals, zvals, coordNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const std::vector<T>& xvals,
|
||||
const std::vector<T>& yvals,
|
||||
const std::vector<T>& zvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::cont::ArrayHandle<T>& xvals,
|
||||
const vtkm::cont::ArrayHandle<T>& yvals,
|
||||
const vtkm::cont::ArrayHandle<T>& zvals,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(xvals, yvals, zvals, coordNm);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -157,15 +145,14 @@ private:
|
||||
VTKM_CONT static vtkm::cont::DataSet BuildDataSet(const std::vector<T>& xvals,
|
||||
const std::vector<T>& yvals,
|
||||
const std::vector<T>& zvals,
|
||||
std::string coordNm,
|
||||
std::string cellNm)
|
||||
const std::string& coordNm)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> Xc, Yc, Zc;
|
||||
DataSetBuilderRectilinear::CopyInto(xvals, Xc);
|
||||
DataSetBuilderRectilinear::CopyInto(yvals, Yc);
|
||||
DataSetBuilderRectilinear::CopyInto(zvals, Zc);
|
||||
|
||||
return DataSetBuilderRectilinear::BuildDataSet(Xc, Yc, Zc, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(Xc, Yc, Zc, coordNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -175,24 +162,23 @@ private:
|
||||
const T* xvals,
|
||||
const T* yvals,
|
||||
const T* zvals,
|
||||
std::string coordNm,
|
||||
std::string cellNm)
|
||||
const std::string& coordNm)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::FloatDefault> Xc, Yc, Zc;
|
||||
DataSetBuilderRectilinear::CopyInto(xvals, nx, Xc);
|
||||
DataSetBuilderRectilinear::CopyInto(yvals, ny, Yc);
|
||||
DataSetBuilderRectilinear::CopyInto(zvals, nz, Zc);
|
||||
|
||||
return DataSetBuilderRectilinear::BuildDataSet(Xc, Yc, Zc, coordNm, cellNm);
|
||||
return DataSetBuilderRectilinear::BuildDataSet(Xc, Yc, Zc, coordNm);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet BuildDataSet(const vtkm::cont::ArrayHandle<T>& X,
|
||||
const vtkm::cont::ArrayHandle<T>& Y,
|
||||
const vtkm::cont::ArrayHandle<T>& Z,
|
||||
std::string coordNm,
|
||||
std::string cellNm)
|
||||
const std::string& coordNm)
|
||||
{
|
||||
const std::string cellNm("cells");
|
||||
vtkm::cont::DataSet dataSet;
|
||||
|
||||
//Convert all coordinates to floatDefault.
|
||||
|
@ -22,39 +22,31 @@ DataSetBuilderUniform::DataSetBuilderUniform()
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DataSet DataSetBuilderUniform::Create(const vtkm::Id& dimension,
|
||||
std::string coordNm,
|
||||
std::string cellNm)
|
||||
const std::string& coordNm)
|
||||
{
|
||||
return CreateDataSet(vtkm::Id3(dimension, 1, 1), VecType(0), VecType(1), coordNm, cellNm);
|
||||
return CreateDataSet(vtkm::Id3(dimension, 1, 1), VecType(0), VecType(1), coordNm);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DataSet DataSetBuilderUniform::Create(const vtkm::Id2& dimensions,
|
||||
std::string coordNm,
|
||||
std::string cellNm)
|
||||
const std::string& coordNm)
|
||||
{
|
||||
return CreateDataSet(
|
||||
vtkm::Id3(dimensions[0], dimensions[1], 1), VecType(0), VecType(1), coordNm, cellNm);
|
||||
return CreateDataSet(vtkm::Id3(dimensions[0], dimensions[1], 1), VecType(0), VecType(1), coordNm);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DataSet DataSetBuilderUniform::Create(const vtkm::Id3& dimensions,
|
||||
std::string coordNm,
|
||||
std::string cellNm)
|
||||
const std::string& coordNm)
|
||||
{
|
||||
return CreateDataSet(vtkm::Id3(dimensions[0], dimensions[1], dimensions[2]),
|
||||
VecType(0),
|
||||
VecType(1),
|
||||
coordNm,
|
||||
cellNm);
|
||||
return CreateDataSet(
|
||||
vtkm::Id3(dimensions[0], dimensions[1], dimensions[2]), VecType(0), VecType(1), coordNm);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::DataSet DataSetBuilderUniform::CreateDataSet(const vtkm::Id3& dimensions,
|
||||
const vtkm::Vec3f& origin,
|
||||
const vtkm::Vec3f& spacing,
|
||||
std::string coordNm,
|
||||
std::string cellNm)
|
||||
const std::string& coordNm)
|
||||
{
|
||||
vtkm::Id dims[3] = { 1, 1, 1 };
|
||||
int ndims = 0;
|
||||
@ -75,6 +67,7 @@ vtkm::cont::DataSet DataSetBuilderUniform::CreateDataSet(const vtkm::Id3& dimens
|
||||
vtkm::cont::CoordinateSystem cs(coordNm, coords);
|
||||
dataSet.AddCoordinateSystem(cs);
|
||||
|
||||
const std::string cellNm("cells");
|
||||
if (ndims == 1)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<1> cellSet(cellNm);
|
||||
|
@ -31,29 +31,25 @@ public:
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id& dimension,
|
||||
const T& origin,
|
||||
const T& spacing,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
return DataSetBuilderUniform::CreateDataSet(
|
||||
vtkm::Id3(dimension, 1, 1),
|
||||
VecType(static_cast<vtkm::FloatDefault>(origin), 0, 0),
|
||||
VecType(static_cast<vtkm::FloatDefault>(spacing), 1, 1),
|
||||
coordNm,
|
||||
cellNm);
|
||||
coordNm);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
static vtkm::cont::DataSet Create(const vtkm::Id& dimension,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells");
|
||||
const std::string& coordNm = "coords");
|
||||
|
||||
//2D uniform grids.
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id2& dimensions,
|
||||
const vtkm::Vec<T, 2>& origin,
|
||||
const vtkm::Vec<T, 2>& spacing,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
return DataSetBuilderUniform::CreateDataSet(vtkm::Id3(dimensions[0], dimensions[1], 1),
|
||||
VecType(static_cast<vtkm::FloatDefault>(origin[0]),
|
||||
@ -62,22 +58,19 @@ public:
|
||||
VecType(static_cast<vtkm::FloatDefault>(spacing[0]),
|
||||
static_cast<vtkm::FloatDefault>(spacing[1]),
|
||||
1),
|
||||
coordNm,
|
||||
cellNm);
|
||||
coordNm);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
static vtkm::cont::DataSet Create(const vtkm::Id2& dimensions,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells");
|
||||
const std::string& coordNm = "coords");
|
||||
|
||||
//3D uniform grids.
|
||||
template <typename T>
|
||||
VTKM_CONT static vtkm::cont::DataSet Create(const vtkm::Id3& dimensions,
|
||||
const vtkm::Vec<T, 3>& origin,
|
||||
const vtkm::Vec<T, 3>& spacing,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells")
|
||||
const std::string& coordNm = "coords")
|
||||
{
|
||||
return DataSetBuilderUniform::CreateDataSet(
|
||||
vtkm::Id3(dimensions[0], dimensions[1], dimensions[2]),
|
||||
@ -87,22 +80,19 @@ public:
|
||||
VecType(static_cast<vtkm::FloatDefault>(spacing[0]),
|
||||
static_cast<vtkm::FloatDefault>(spacing[1]),
|
||||
static_cast<vtkm::FloatDefault>(spacing[2])),
|
||||
coordNm,
|
||||
cellNm);
|
||||
coordNm);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
static vtkm::cont::DataSet Create(const vtkm::Id3& dimensions,
|
||||
std::string coordNm = "coords",
|
||||
std::string cellNm = "cells");
|
||||
const std::string& coordNm = "coords");
|
||||
|
||||
private:
|
||||
VTKM_CONT
|
||||
static vtkm::cont::DataSet CreateDataSet(const vtkm::Id3& dimensions,
|
||||
const vtkm::Vec3f& origin,
|
||||
const vtkm::Vec3f& spacing,
|
||||
std::string coordNm,
|
||||
std::string cellNm);
|
||||
const std::string& coordNm);
|
||||
};
|
||||
|
||||
} // namespace cont
|
||||
|
@ -156,7 +156,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make1DExplicitDataSet0()
|
||||
vtkm::cont::DataSet dataSet;
|
||||
vtkm::cont::DataSetBuilderExplicit dsb;
|
||||
|
||||
dataSet = dsb.Create(coords, vtkm::CellShapeTagLine(), 2, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, vtkm::CellShapeTagLine(), 2, conn, "coordinates");
|
||||
|
||||
vtkm::cont::DataSetFieldAdd dsf;
|
||||
constexpr vtkm::Float32 var[nVerts] = { -1.0f, .5f, -.2f, 1.7f, .8f };
|
||||
@ -585,7 +585,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make2DExplicitDataSet0()
|
||||
conn.push_back(15);
|
||||
conn.push_back(14);
|
||||
conn.push_back(12);
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
// Field data
|
||||
vtkm::Float32 pointvar[nVerts] = { 100.0f, 78.0f, 49.0f, 17.0f, 94.0f, 71.0f, 47.0f, 33.0f,
|
||||
@ -633,7 +633,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet0()
|
||||
conn.push_back(4);
|
||||
|
||||
//Create the dataset.
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
vtkm::Float32 vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f };
|
||||
vtkm::Float32 cellvar[2] = { 100.1f, 100.2f };
|
||||
@ -987,7 +987,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet6()
|
||||
conn.push_back(0);
|
||||
conn.push_back(7);
|
||||
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
// Field data
|
||||
vtkm::Float32 pointvar[nVerts] = { 100.0f, 78.0f, 49.0f, 17.0f, 94.0f, 71.0f, 47.0f, 57.0f };
|
||||
@ -1228,7 +1228,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSetZoo()
|
||||
conn.push_back(7);
|
||||
conn.push_back(16);
|
||||
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
// Field data
|
||||
vtkm::Float32 pointvar[nVerts] =
|
||||
@ -1302,7 +1302,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet7()
|
||||
conn.push_back(7);
|
||||
|
||||
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
// Field data
|
||||
vtkm::Float32 pointvar[nVerts] = { 100.0f, 78.0f, 49.0f, 17.0f, 10.f, 20.f, 33.f, 52.f };
|
||||
@ -1382,7 +1382,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet8()
|
||||
conn.push_back(5);
|
||||
conn.push_back(6);
|
||||
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
// Field data
|
||||
vtkm::Float32 pointvar[nVerts] = { 100.0f, 78.0f, 49.0f, 17.0f, 94.0f, 71.0f, 47.0f, 57.0f };
|
||||
@ -1465,7 +1465,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSetPolygonal()
|
||||
conn.push_back(6);
|
||||
conn.push_back(2);
|
||||
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
// Field data
|
||||
vtkm::Float32 pointvar[nVerts] = { 100.0f, 78.0f, 49.0f, 17.0f, 94.0f, 71.0f, 47.0f, 33.0f };
|
||||
|
@ -201,14 +201,14 @@ static vtkm::cont::DataSet MakeExplicit(vtkm::Id numI, vtkm::Id numJ, vtkm::Id n
|
||||
vtkm::Id2 dims(numI, numJ);
|
||||
MakeExplicitCells(
|
||||
cellSet.Cast<vtkm::cont::CellSetStructured<2>>(), dims, numIndices, shapes, conn);
|
||||
ds = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates", "cells");
|
||||
ds = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates");
|
||||
}
|
||||
else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>())
|
||||
{
|
||||
vtkm::Id3 dims(numI, numJ, numK);
|
||||
MakeExplicitCells(
|
||||
cellSet.Cast<vtkm::cont::CellSetStructured<3>>(), dims, numIndices, shapes, conn);
|
||||
ds = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates", "cells");
|
||||
ds = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates");
|
||||
}
|
||||
|
||||
auto ghosts = StructuredGhostCellArray(numI, numJ, numK, numLayers);
|
||||
|
@ -182,7 +182,7 @@ inline vtkm::cont::DataSet Make3DExplicitDataSet()
|
||||
conn.push_back(7);
|
||||
conn.push_back(2);
|
||||
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
return dataSet;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ vtkm::cont::DataSet Make3DExplicitSimpleCube()
|
||||
conn.push_back(1);
|
||||
|
||||
//Create the dataset.
|
||||
dataSet = dsb.Create(coords, shapes, numIndices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numIndices, conn, "coordinates");
|
||||
|
||||
vtkm::FloatDefault vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f, 60.3f, 70.3f, 80.3f };
|
||||
vtkm::FloatDefault cellvar[nCells] = { 100.1f, 200.2f, 300.3f, 400.4f, 500.5f, 600.6f };
|
||||
|
@ -90,7 +90,7 @@ vtkm::cont::DataSet MakeCosmo_2DDataSet_0()
|
||||
numindices.push_back(1);
|
||||
conn.push_back(pt);
|
||||
}
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
// Field data
|
||||
vtkm::Float32 xLocation[nCells] = { 1, 1, 2, 1, 3, 1, 1, 3, 2, 3, 4, 3, 5, 5, 4, 5, 6 };
|
||||
@ -149,7 +149,7 @@ vtkm::cont::DataSet MakeCosmo_3DDataSet_0()
|
||||
numindices.push_back(1);
|
||||
conn.push_back(pt);
|
||||
}
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates");
|
||||
|
||||
// Field data
|
||||
vtkm::Float32 xLocation[nCells] = { 20.8125f, 29.6871f, 29.724f, 29.6783f, 29.7051f,
|
||||
|
@ -216,9 +216,9 @@ vtkm::cont::DataSet CreateExplicitFromStructuredDataSet(const vtkm::cont::DataSe
|
||||
vtkm::Id2 cellDims = cells2D.GetCellDimensions();
|
||||
MakeExplicitCells(cells2D, cellDims, numIndices, shapes, conn);
|
||||
if (createSingleType)
|
||||
output = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates", "cells");
|
||||
output = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates");
|
||||
else
|
||||
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates", "cells");
|
||||
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates");
|
||||
}
|
||||
else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>())
|
||||
{
|
||||
@ -226,10 +226,9 @@ vtkm::cont::DataSet CreateExplicitFromStructuredDataSet(const vtkm::cont::DataSe
|
||||
vtkm::Id3 cellDims = cells3D.GetCellDimensions();
|
||||
MakeExplicitCells(cells3D, cellDims, numIndices, shapes, conn);
|
||||
if (createSingleType)
|
||||
output =
|
||||
dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates", "cells");
|
||||
output = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates");
|
||||
else
|
||||
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates", "cells");
|
||||
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates");
|
||||
}
|
||||
|
||||
return output;
|
||||
|
@ -97,7 +97,7 @@ vtkm::cont::DataSet Make3DExplicitSimpleCube()
|
||||
conn.push_back(1);
|
||||
|
||||
//Create the dataset.
|
||||
dataSet = dsb.Create(coords, shapes, numIndices, conn, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numIndices, conn, "coordinates");
|
||||
|
||||
vtkm::FloatDefault vars[nVerts] = { 10.1f, 20.1f, 30.2f, 40.2f, 50.3f, 60.3f, 70.3f, 80.3f };
|
||||
vtkm::FloatDefault cellvar[nCells] = { 100.1f, 200.2f, 300.3f, 400.4f, 500.5f, 600.6f };
|
||||
|
Loading…
Reference in New Issue
Block a user