mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
removing cell set dimensionality and splitting tetrahedralizer.
This commit is contained in:
parent
59f5f24845
commit
0c18278028
@ -68,7 +68,7 @@ int mouse_state = 1;
|
||||
vtkm::cont::DataSet MakeTetrahedralizeExplicitDataSet()
|
||||
{
|
||||
vtkm::cont::DataSetBuilderExplicitIterative builder;
|
||||
builder.Begin(3);
|
||||
builder.Begin();
|
||||
|
||||
builder.AddPoint( 0, 0, 0);
|
||||
builder.AddPoint( 1, 0, 0);
|
||||
|
@ -61,7 +61,7 @@ vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float64, 3> > vertexArray;
|
||||
vtkm::cont::DataSet MakeTriangulateExplicitDataSet()
|
||||
{
|
||||
vtkm::cont::DataSetBuilderExplicitIterative builder;
|
||||
builder.Begin(2);
|
||||
builder.Begin();
|
||||
|
||||
builder.AddPoint(0, 0, 0); // 0
|
||||
builder.AddPoint(1, 0, 0); // 1
|
||||
|
@ -39,15 +39,14 @@ class CellSet
|
||||
{
|
||||
public:
|
||||
VTKM_CONT_EXPORT
|
||||
CellSet(const std::string &name, vtkm::IdComponent dimensionality)
|
||||
: Name(name), Dimensionality(dimensionality), LogicalStructure()
|
||||
CellSet(const std::string &name)
|
||||
: Name(name), LogicalStructure()
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSet(const vtkm::cont::CellSet &src)
|
||||
: Name(src.Name),
|
||||
Dimensionality(src.Dimensionality),
|
||||
LogicalStructure(src.LogicalStructure)
|
||||
{ }
|
||||
|
||||
@ -55,7 +54,6 @@ public:
|
||||
CellSet &operator=(const vtkm::cont::CellSet &src)
|
||||
{
|
||||
this->Name = src.Name;
|
||||
this->Dimensionality = src.Dimensionality;
|
||||
this->LogicalStructure = src.LogicalStructure;
|
||||
return *this;
|
||||
}
|
||||
@ -69,19 +67,6 @@ public:
|
||||
return this->Name;
|
||||
}
|
||||
|
||||
/// The Dimensionality of the cells inside the cell set.
|
||||
/// Lines = 1
|
||||
/// Triangles, Quads = 2
|
||||
/// Tets, Hexs, etc = 3
|
||||
///
|
||||
/// CellSetExplicit has the ability to contain cells of multiple
|
||||
/// dimensions. These datasets generally report a dimensionality
|
||||
/// of 3.
|
||||
virtual vtkm::IdComponent GetDimensionality() const
|
||||
{
|
||||
return this->Dimensionality;
|
||||
}
|
||||
|
||||
virtual vtkm::Id GetNumberOfCells() const = 0;
|
||||
|
||||
virtual vtkm::Id GetNumberOfFaces() const
|
||||
@ -100,7 +85,6 @@ public:
|
||||
|
||||
protected:
|
||||
std::string Name;
|
||||
vtkm::IdComponent Dimensionality;
|
||||
vtkm::cont::LogicalStructure LogicalStructure;
|
||||
};
|
||||
|
||||
|
@ -107,9 +107,8 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetExplicit(vtkm::Id numpoints = 0,
|
||||
const std::string &name = std::string(),
|
||||
vtkm::IdComponent dimensionality = 3)
|
||||
: CellSet(name, dimensionality),
|
||||
const std::string &name = std::string())
|
||||
: CellSet(name),
|
||||
ConnectivityLength(-1),
|
||||
NumberOfCells(-1),
|
||||
NumberOfPoints(numpoints)
|
||||
@ -117,8 +116,8 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetExplicit(vtkm::Id numpoints, int dimensionality)
|
||||
: CellSet(std::string(), dimensionality),
|
||||
CellSetExplicit(vtkm::Id numpoints)
|
||||
: CellSet(std::string()),
|
||||
ConnectivityLength(-1),
|
||||
NumberOfCells(-1),
|
||||
NumberOfPoints(numpoints)
|
||||
@ -438,8 +437,7 @@ public:
|
||||
|
||||
virtual void PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out << " ExplicitCellSet: " << this->Name
|
||||
<< " dim= " << this->Dimensionality << std::endl;
|
||||
out << " ExplicitCellSet: " << this->Name << std::endl;
|
||||
out << " PointToCell: " << std::endl;
|
||||
this->PointToCell.PrintSummary(out);
|
||||
out << " CellToPoint: " << std::endl;
|
||||
|
@ -41,18 +41,16 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetGeneralPermutation(const PermutationArrayHandleType& validCellIds,
|
||||
const OriginalCellSet& cellset,
|
||||
const std::string &name,
|
||||
vtkm::IdComponent dimensionality)
|
||||
: CellSet(name,dimensionality),
|
||||
const std::string &name)
|
||||
: CellSet(name),
|
||||
ValidCellIds(validCellIds),
|
||||
FullCellSet(cellset)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetGeneralPermutation(const std::string &name,
|
||||
vtkm::IdComponent dimensionality)
|
||||
: CellSet(name,dimensionality),
|
||||
CellSetGeneralPermutation(const std::string &name)
|
||||
: CellSet(name),
|
||||
ValidCellIds(),
|
||||
FullCellSet()
|
||||
{
|
||||
@ -140,16 +138,14 @@ public:
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetPermutation(const PermutationArrayHandleType& validCellIds,
|
||||
const OriginalCellSet& cellset,
|
||||
const std::string &name = std::string(),
|
||||
vtkm::IdComponent dimensionality = 3)
|
||||
: ParentType(validCellIds, cellset, name, dimensionality)
|
||||
const std::string &name = std::string())
|
||||
: ParentType(validCellIds, cellset, name)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetPermutation(const std::string &name = std::string(),
|
||||
vtkm::IdComponent dimensionality = 3)
|
||||
: ParentType(name, dimensionality)
|
||||
CellSetPermutation(const std::string &name = std::string())
|
||||
: ParentType(name)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -56,14 +56,14 @@ public:
|
||||
template<typename CellShapeTag>
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetSingleType(CellShapeTag, const std::string &name = std::string())
|
||||
: Superclass(0, name, vtkm::CellTraits<CellShapeTag>::TOPOLOGICAL_DIMENSIONS),
|
||||
: Superclass(0, name),
|
||||
CellTypeAsId(CellShapeTag::Id)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetSingleType(const std::string &name = std::string())
|
||||
: Superclass(0, name, vtkm::CellTraits<CellShapeTagEmpty>::TOPOLOGICAL_DIMENSIONS),
|
||||
: Superclass(0, name),
|
||||
CellTypeAsId(CellShapeTagEmpty::Id)
|
||||
{
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
CellSetStructured(const std::string &name = std::string())
|
||||
: CellSet(name,Dimension)
|
||||
: CellSet(name)
|
||||
{
|
||||
}
|
||||
|
||||
@ -130,8 +130,7 @@ public:
|
||||
|
||||
virtual void PrintSummary(std::ostream &out) const
|
||||
{
|
||||
out << " StructuredCellSet: " << this->GetName()
|
||||
<< " dim= " << this->GetDimensionality() << std::endl;
|
||||
out << " StructuredCellSet: " << this->GetName() << std::endl;
|
||||
this->Structure.PrintSummary(out);
|
||||
}
|
||||
|
||||
|
@ -61,14 +61,13 @@ public:
|
||||
const std::vector<vtkm::UInt8> &shapes,
|
||||
const std::vector<vtkm::IdComponent> &numIndices,
|
||||
const std::vector<vtkm::Id> &connectivity,
|
||||
int dimensionality=2,
|
||||
const std::string &coordsNm="coords",
|
||||
const std::string &cellNm="cells")
|
||||
{
|
||||
std::vector<T> zVals(xVals.size(),0);
|
||||
return DataSetBuilderExplicit::Create(xVals,yVals,zVals,
|
||||
shapes,numIndices,connectivity,
|
||||
dimensionality, coordsNm,cellNm);
|
||||
coordsNm,cellNm);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -81,7 +80,6 @@ public:
|
||||
const std::vector<vtkm::UInt8> &shapes,
|
||||
const std::vector<vtkm::IdComponent> &numIndices,
|
||||
const std::vector<vtkm::Id> &connectivity,
|
||||
int dimensionality=3,
|
||||
const std::string &coordsNm="coords",
|
||||
const std::string &cellNm="cells");
|
||||
|
||||
@ -95,14 +93,13 @@ public:
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8> &shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent> &numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id> &connectivity,
|
||||
int dimensionality=3,
|
||||
const std::string &coordsNm="coords",
|
||||
const std::string &cellNm="cells")
|
||||
{
|
||||
return DataSetBuilderExplicit::BuildDataSet(
|
||||
xVals,yVals,zVals,
|
||||
shapes,numIndices,connectivity,
|
||||
dimensionality, coordsNm,cellNm);
|
||||
coordsNm,cellNm);
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +111,6 @@ public:
|
||||
const std::vector<vtkm::UInt8> &shapes,
|
||||
const std::vector<vtkm::IdComponent> &numIndices,
|
||||
const std::vector<vtkm::Id> &connectivity,
|
||||
int dimensionality=3,
|
||||
const std::string &coordsNm="coords",
|
||||
const std::string &cellNm="cells");
|
||||
|
||||
@ -126,7 +122,6 @@ public:
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8> &shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent> &numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id> &connectivity,
|
||||
int dimensionality=3,
|
||||
const std::string &coordsNm="coords",
|
||||
const std::string &cellNm="cells")
|
||||
{
|
||||
@ -134,7 +129,6 @@ public:
|
||||
shapes,
|
||||
numIndices,
|
||||
connectivity,
|
||||
dimensionality,
|
||||
coordsNm,
|
||||
cellNm);
|
||||
}
|
||||
@ -176,7 +170,6 @@ private:
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8> &shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent> &numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id> &connectivity,
|
||||
int dimensionality,
|
||||
const std::string &coordsNm,
|
||||
const std::string &cellNm);
|
||||
|
||||
@ -188,7 +181,6 @@ private:
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8> &shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent> &numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id> &connectivity,
|
||||
int dimensionality,
|
||||
const std::string &coordsNm,
|
||||
const std::string &cellNm);
|
||||
|
||||
@ -211,7 +203,6 @@ DataSetBuilderExplicit::Create(const std::vector<T> &xVals,
|
||||
const std::vector<vtkm::UInt8> &shapes,
|
||||
const std::vector<vtkm::IdComponent> &numIndices,
|
||||
const std::vector<vtkm::Id> &connectivity,
|
||||
int dimensionality,
|
||||
const std::string &coordsNm,
|
||||
const std::string &cellNm)
|
||||
{
|
||||
@ -232,7 +223,7 @@ DataSetBuilderExplicit::Create(const std::vector<T> &xVals,
|
||||
DataSetBuilderExplicit::CopyInto(connectivity, Cc);
|
||||
|
||||
return DataSetBuilderExplicit::BuildDataSet(
|
||||
Xc,Yc,Zc, Sc,Nc,Cc, dimensionality, coordsNm, cellNm);
|
||||
Xc,Yc,Zc, Sc,Nc,Cc, coordsNm, cellNm);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -244,7 +235,6 @@ DataSetBuilderExplicit::BuildDataSet(
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8> &shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent> &numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id> &connectivity,
|
||||
int dimensionality,
|
||||
const std::string &coordsNm,
|
||||
const std::string &cellNm)
|
||||
{
|
||||
@ -258,7 +248,7 @@ DataSetBuilderExplicit::BuildDataSet(
|
||||
vtkm::cont::CoordinateSystem(coordsNm,
|
||||
make_ArrayHandleCompositeVector(X,0, Y,0, Z,0)));
|
||||
vtkm::Id nPts = X.GetNumberOfValues();
|
||||
vtkm::cont::CellSetExplicit<> cellSet(nPts, cellNm, dimensionality);
|
||||
vtkm::cont::CellSetExplicit<> cellSet(nPts, cellNm);
|
||||
|
||||
cellSet.Fill(shapes, numIndices, connectivity);
|
||||
dataSet.AddCellSet(cellSet);
|
||||
@ -272,7 +262,6 @@ DataSetBuilderExplicit::Create(const std::vector<vtkm::Vec<T,3> > &coords,
|
||||
const std::vector<vtkm::UInt8> &shapes,
|
||||
const std::vector<vtkm::IdComponent> &numIndices,
|
||||
const std::vector<vtkm::Id> &connectivity,
|
||||
int dimensionality,
|
||||
const std::string &coordsNm,
|
||||
const std::string &cellNm)
|
||||
{
|
||||
@ -287,7 +276,7 @@ DataSetBuilderExplicit::Create(const std::vector<vtkm::Vec<T,3> > &coords,
|
||||
DataSetBuilderExplicit::CopyInto(connectivity, Cc);
|
||||
|
||||
return DataSetBuilderExplicit::Create(
|
||||
coordsArray, Sc, Nc, Cc, dimensionality, coordsNm, cellNm);
|
||||
coordsArray, Sc, Nc, Cc, coordsNm, cellNm);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -297,7 +286,6 @@ DataSetBuilderExplicit::BuildDataSet(const vtkm::cont::ArrayHandle<vtkm::Vec<T,3
|
||||
const vtkm::cont::ArrayHandle<vtkm::UInt8> &shapes,
|
||||
const vtkm::cont::ArrayHandle<vtkm::IdComponent> &numIndices,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id> &connectivity,
|
||||
int dimensionality,
|
||||
const std::string &coordsNm,
|
||||
const std::string &cellNm)
|
||||
{
|
||||
@ -306,7 +294,7 @@ DataSetBuilderExplicit::BuildDataSet(const vtkm::cont::ArrayHandle<vtkm::Vec<T,3
|
||||
dataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem(coordsNm,
|
||||
coords));
|
||||
vtkm::Id nPts = static_cast<vtkm::Id>(coords.GetNumberOfValues());
|
||||
vtkm::cont::CellSetExplicit<> cellSet(nPts, cellNm, dimensionality);
|
||||
vtkm::cont::CellSetExplicit<> cellSet(nPts, cellNm);
|
||||
|
||||
cellSet.Fill(shapes, numIndices, connectivity);
|
||||
dataSet.AddCellSet(cellSet);
|
||||
@ -359,11 +347,9 @@ public:
|
||||
DataSetBuilderExplicitIterative() {}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
void Begin(int dim,
|
||||
const std::string &coordName="coords",
|
||||
void Begin(const std::string &coordName="coords",
|
||||
const std::string &cellName="cells")
|
||||
{
|
||||
this->dimensionality = dim;
|
||||
this->coordNm = coordName;
|
||||
this->cellNm = cellName;
|
||||
this->points.resize(0);
|
||||
@ -447,7 +433,6 @@ public:
|
||||
|
||||
private:
|
||||
std::string coordNm, cellNm;
|
||||
int dimensionality;
|
||||
|
||||
std::vector<vtkm::Vec<vtkm::Float32,3> > points;
|
||||
std::vector<vtkm::UInt8> shapes;
|
||||
@ -459,7 +444,7 @@ vtkm::cont::DataSet
|
||||
DataSetBuilderExplicitIterative::Create()
|
||||
{
|
||||
DataSetBuilderExplicit dsb;
|
||||
return dsb.Create(points, shapes, numIdx, connectivity, dimensionality, coordNm, cellNm);
|
||||
return dsb.Create(points, shapes, numIdx, connectivity, coordNm, cellNm);
|
||||
}
|
||||
|
||||
|
||||
|
@ -262,7 +262,7 @@ MakeTestDataSet::Make3DExplicitDataSet0()
|
||||
conn.push_back(4);
|
||||
|
||||
//Create the dataset.
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, 2, "coordinates", "cells");
|
||||
dataSet = dsb.Create(coords, shapes, numindices, conn, "coordinates", "cells");
|
||||
|
||||
vtkm::Float32 vars[nVerts] = {10.1f, 20.1f, 30.2f, 40.2f, 50.3f};
|
||||
vtkm::Float32 cellvar[2] = {100.1f, 100.2f};
|
||||
@ -334,7 +334,7 @@ MakeTestDataSet::Make3DExplicitDataSet1()
|
||||
|
||||
dataSet.AddCoordinateSystem(
|
||||
vtkm::cont::CoordinateSystem("coordinates", coordinates, nVerts));
|
||||
vtkm::cont::CellSetExplicit<> cellSet(nVerts, "cells", 2);
|
||||
vtkm::cont::CellSetExplicit<> cellSet(nVerts, "cells");
|
||||
cellSet.PrepareToAddCells(2, 7);
|
||||
cellSet.AddCell(vtkm::CELL_SHAPE_TRIANGLE, 3, make_Vec<vtkm::Id>(0,1,2));
|
||||
cellSet.AddCell(vtkm::CELL_SHAPE_QUAD, 4, make_Vec<vtkm::Id>(2,1,3,4));
|
||||
|
@ -67,8 +67,7 @@ public:
|
||||
typedef vtkm::cont::CellSetPermutation<CellSetType> PermutationCellSetType;
|
||||
|
||||
PermutationCellSetType permCellSet(*this->ValidIds, cellset,
|
||||
cellset.GetName(),
|
||||
cellset.GetDimensionality());
|
||||
cellset.GetName());
|
||||
|
||||
this->Output->AddCellSet(permCellSet);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ void TestExternalFacesExplicitGrid()
|
||||
{4,7,6,3}, {4,6,3,2}, {4,0,3,2},
|
||||
{4,6,5,2}, {4,5,0,2}, {1,0,5,2}
|
||||
};
|
||||
vtkm::cont::CellSetExplicit<> cs(nVerts, "cells", nCells);
|
||||
vtkm::cont::CellSetExplicit<> cs(nVerts, "cells");
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::UInt8> shapes;
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices;
|
||||
|
@ -48,7 +48,7 @@ vtkm::cont::DataSet MakePointElevationTestDataSet()
|
||||
dataSet.AddCoordinateSystem(
|
||||
vtkm::cont::CoordinateSystem("coordinates", coordinates));
|
||||
|
||||
vtkm::cont::CellSetExplicit<> cellSet(vtkm::Id(coordinates.size()), "cells", 3);
|
||||
vtkm::cont::CellSetExplicit<> cellSet(vtkm::Id(coordinates.size()), "cells");
|
||||
cellSet.PrepareToAddCells(numCells, numCells * 4);
|
||||
for (vtkm::Id j = 0; j < dim - 1; ++j)
|
||||
{
|
||||
|
@ -39,6 +39,8 @@ set(headers
|
||||
StreamLineUniformGrid.h
|
||||
TetrahedralizeExplicitGrid.h
|
||||
TetrahedralizeUniformGrid.h
|
||||
TriangulateExplicitGrid.h
|
||||
TriangulateUniformGrid.h
|
||||
Threshold.h
|
||||
VertexClustering.h
|
||||
)
|
||||
|
@ -46,32 +46,6 @@ class TetrahedralizeFilterExplicitGrid
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Worklet to count the number of triangles generated per cell
|
||||
//
|
||||
class TrianglesPerCell : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<> shapes,
|
||||
FieldIn<> numPoints,
|
||||
ExecObject tables,
|
||||
FieldOut<> triangleCount);
|
||||
typedef _4 ExecutionSignature(_1,_2,_3);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
TrianglesPerCell() {}
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::IdComponent operator()(
|
||||
vtkm::UInt8 shape,
|
||||
vtkm::IdComponent numPoints,
|
||||
const vtkm::worklet::internal::TriangulateTablesExecutionObject<DeviceAdapter> &tables) const
|
||||
{
|
||||
return tables.GetCount(vtkm::CellShapeTagGeneric(shape), numPoints);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Worklet to count the number of tetrahedra generated per cell
|
||||
//
|
||||
@ -80,7 +54,7 @@ public:
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<> shapes,
|
||||
ExecObject tables,
|
||||
FieldOut<> triangleCount);
|
||||
FieldOut<> tetrahedronCount);
|
||||
typedef _3 ExecutionSignature(_1, _2);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
@ -96,55 +70,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Worklet to turn cells into triangles
|
||||
// Vertices remain the same and each cell is processed with needing topology
|
||||
//
|
||||
class TriangulateCell : public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(TopologyIn topology,
|
||||
ExecObject tables,
|
||||
FieldOutCell<> connectivityOut);
|
||||
typedef void ExecutionSignature(CellShape, PointIndices, _2, _3, VisitIndex);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
typedef vtkm::worklet::ScatterCounting ScatterType;
|
||||
VTKM_CONT_EXPORT
|
||||
ScatterType GetScatter() const
|
||||
{
|
||||
return this->Scatter;
|
||||
}
|
||||
|
||||
template<typename CountArrayType>
|
||||
VTKM_CONT_EXPORT
|
||||
TriangulateCell(const CountArrayType &countArray)
|
||||
: Scatter(countArray, DeviceAdapter())
|
||||
{ }
|
||||
|
||||
// Each cell produces triangles and write result at the offset
|
||||
template<typename CellShapeTag,
|
||||
typename ConnectivityInVec,
|
||||
typename ConnectivityOutVec>
|
||||
VTKM_EXEC_EXPORT
|
||||
void operator()(
|
||||
CellShapeTag shape,
|
||||
const ConnectivityInVec &connectivityIn,
|
||||
const vtkm::worklet::internal::TriangulateTablesExecutionObject<DeviceAdapter> &tables,
|
||||
ConnectivityOutVec &connectivityOut,
|
||||
vtkm::IdComponent visitIndex) const
|
||||
{
|
||||
vtkm::Vec<vtkm::IdComponent,3> triIndices =
|
||||
tables.GetIndices(shape, visitIndex);
|
||||
connectivityOut[0] = connectivityIn[triIndices[0]];
|
||||
connectivityOut[1] = connectivityIn[triIndices[1]];
|
||||
connectivityOut[2] = connectivityIn[triIndices[2]];
|
||||
}
|
||||
|
||||
private:
|
||||
ScatterType Scatter;
|
||||
};
|
||||
|
||||
//
|
||||
// Worklet to turn cells into tetrahedra
|
||||
// Vertices remain the same and each cell is processed with needing topology
|
||||
@ -207,7 +132,7 @@ public:
|
||||
vtkm::cont::DataSet OutDataSet; // output dataset with explicit cell set
|
||||
|
||||
//
|
||||
// Populate the output dataset with triangles or tetrahedra based on input explicit dataset
|
||||
// Populate the output dataset with tetrahedra based on input explicit dataset
|
||||
//
|
||||
void Run()
|
||||
{
|
||||
@ -217,9 +142,6 @@ public:
|
||||
vtkm::cont::CellSetSingleType<> &cellSet =
|
||||
this->OutDataSet.GetCellSet(0).template Cast<vtkm::cont::CellSetSingleType<> >();
|
||||
|
||||
// Input dataset vertices and cell counts
|
||||
vtkm::Id dimensionality = inCellSet.GetDimensionality();
|
||||
|
||||
// Input topology
|
||||
vtkm::cont::ArrayHandle<vtkm::UInt8> inShapes = inCellSet.GetShapesArray(
|
||||
vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
|
||||
@ -229,30 +151,6 @@ public:
|
||||
// Output topology
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> outConnectivity;
|
||||
|
||||
if (dimensionality == 2)
|
||||
{
|
||||
vtkm::worklet::internal::TriangulateTables tables;
|
||||
|
||||
// Determine the number of output cells each input cell will generate
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> numOutCellArray;
|
||||
vtkm::worklet::DispatcherMapField<TrianglesPerCell,DeviceAdapter>
|
||||
triPerCellDispatcher;
|
||||
triPerCellDispatcher.Invoke(inShapes,
|
||||
inNumIndices,
|
||||
tables.PrepareForInput(DeviceAdapter()),
|
||||
numOutCellArray);
|
||||
|
||||
// Build new cells
|
||||
TriangulateCell triangulateWorklet(numOutCellArray);
|
||||
vtkm::worklet::DispatcherMapTopology<TriangulateCell,DeviceAdapter>
|
||||
triangulateDispatcher(triangulateWorklet);
|
||||
triangulateDispatcher.Invoke(
|
||||
inCellSet,
|
||||
tables.PrepareForInput(DeviceAdapter()),
|
||||
vtkm::cont::make_ArrayHandleGroupVec<3>(outConnectivity));
|
||||
}
|
||||
else if (dimensionality == 3)
|
||||
{
|
||||
vtkm::worklet::internal::TetrahedralizeTables tables;
|
||||
|
||||
// Determine the number of output cells each input cell will generate
|
||||
@ -271,12 +169,6 @@ public:
|
||||
inCellSet,
|
||||
tables.PrepareForInput(DeviceAdapter()),
|
||||
vtkm::cont::make_ArrayHandleGroupVec<4>(outConnectivity));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadValue(
|
||||
"Unsupported dimensionality for TetrahedralizeExplicitGrid.");
|
||||
}
|
||||
|
||||
// Add cells to output cellset
|
||||
cellSet.Fill(outConnectivity);
|
||||
|
@ -40,12 +40,6 @@ namespace worklet {
|
||||
|
||||
namespace detail {
|
||||
|
||||
VTKM_EXEC_CONSTANT_EXPORT
|
||||
const static vtkm::IdComponent StructuredTriangleIndices[2][3] = {
|
||||
{ 0, 1, 2 },
|
||||
{ 0, 2, 3 }
|
||||
};
|
||||
|
||||
VTKM_EXEC_CONSTANT_EXPORT
|
||||
const static vtkm::IdComponent StructuredTetrahedronIndices[2][5][4] = {
|
||||
{
|
||||
@ -72,42 +66,6 @@ class TetrahedralizeFilterUniformGrid
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Worklet to turn quads into triangles
|
||||
// Vertices remain the same and each cell is processed with needing topology
|
||||
//
|
||||
class TriangulateCell : public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(TopologyIn topology,
|
||||
FieldOutCell<> connectivityOut);
|
||||
typedef void ExecutionSignature(PointIndices, _2, VisitIndex);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
typedef vtkm::worklet::ScatterUniform ScatterType;
|
||||
VTKM_CONT_EXPORT
|
||||
ScatterType GetScatter() const
|
||||
{
|
||||
return ScatterType(2);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
TriangulateCell()
|
||||
{ }
|
||||
|
||||
// Each quad cell produces 2 triangle cells
|
||||
template<typename ConnectivityInVec, typename ConnectivityOutVec>
|
||||
VTKM_EXEC_EXPORT
|
||||
void operator()(const ConnectivityInVec &connectivityIn,
|
||||
ConnectivityOutVec &connectivityOut,
|
||||
vtkm::IdComponent visitIndex) const
|
||||
{
|
||||
connectivityOut[0] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][0]];
|
||||
connectivityOut[1] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][1]];
|
||||
connectivityOut[2] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][2]];
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Worklet to turn hexahedra into tetrahedra
|
||||
// Vertices remain the same and each cell is processed with needing topology
|
||||
@ -168,7 +126,7 @@ public:
|
||||
vtkm::cont::DataSet OutDataSet; // output dataset with explicit cell set
|
||||
|
||||
//
|
||||
// Populate the output dataset with triangles or tetrahedra based on input uniform dataset
|
||||
// Populate the output dataset with tetrahedra based on input uniform dataset
|
||||
//
|
||||
void Run()
|
||||
{
|
||||
@ -178,27 +136,11 @@ public:
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> connectivity;
|
||||
|
||||
if (cellSet.GetDimensionality() == 2)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<2> inCellSet;
|
||||
InDataSet.GetCellSet(0).CopyTo(inCellSet);
|
||||
vtkm::worklet::DispatcherMapTopology<TriangulateCell,DeviceAdapter> dispatcher;
|
||||
dispatcher.Invoke(inCellSet,
|
||||
vtkm::cont::make_ArrayHandleGroupVec<3>(connectivity));
|
||||
}
|
||||
else if (cellSet.GetDimensionality() == 3)
|
||||
{
|
||||
vtkm::cont::CellSetStructured<3> inCellSet;
|
||||
InDataSet.GetCellSet(0).CopyTo(inCellSet);
|
||||
vtkm::worklet::DispatcherMapTopology<TetrahedralizeCell,DeviceAdapter> dispatcher;
|
||||
dispatcher.Invoke(inCellSet,
|
||||
vtkm::cont::make_ArrayHandleGroupVec<4>(connectivity));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw vtkm::cont::ErrorControlBadValue(
|
||||
"Unsupported dimensionality for TetrahedralizeUniformGrid.");
|
||||
}
|
||||
|
||||
// Add cells to output cellset
|
||||
cellSet.Fill(connectivity);
|
||||
|
@ -140,8 +140,7 @@ public:
|
||||
vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapter>
|
||||
::StreamCompact(passFlags, this->ValidCellIds);
|
||||
|
||||
return OutputType(this->ValidCellIds, cellSet, cellSet.GetName(),
|
||||
cellSet.GetDimensionality());
|
||||
return OutputType(this->ValidCellIds, cellSet, cellSet.GetName());
|
||||
}
|
||||
|
||||
class PermuteCellData
|
||||
|
184
vtkm/worklet/TriangulateExplicitGrid.h
Normal file
184
vtkm/worklet/TriangulateExplicitGrid.h
Normal file
@ -0,0 +1,184 @@
|
||||
//============================================================================
|
||||
// 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 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_worklet_TriangulateExplicitGrid_h
|
||||
#define vtk_m_worklet_TriangulateExplicitGrid_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleGroupVec.h>
|
||||
#include <vtkm/cont/CellSetExplicit.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DeviceAdapter.h>
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/ScatterCounting.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
#include <vtkm/worklet/internal/TriangulateTables.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace worklet {
|
||||
|
||||
/// \brief Compute the triangulate cells for an explicit grid data set
|
||||
template <typename DeviceAdapter>
|
||||
class TriangulateFilterExplicitGrid
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Worklet to count the number of triangles generated per cell
|
||||
//
|
||||
class TrianglesPerCell : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<> shapes,
|
||||
FieldIn<> numPoints,
|
||||
ExecObject tables,
|
||||
FieldOut<> triangleCount);
|
||||
typedef _4 ExecutionSignature(_1,_2,_3);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
TrianglesPerCell() {}
|
||||
|
||||
VTKM_EXEC_EXPORT
|
||||
vtkm::IdComponent operator()(
|
||||
vtkm::UInt8 shape,
|
||||
vtkm::IdComponent numPoints,
|
||||
const vtkm::worklet::internal::TriangulateTablesExecutionObject<DeviceAdapter> &tables) const
|
||||
{
|
||||
return tables.GetCount(vtkm::CellShapeTagGeneric(shape), numPoints);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Worklet to turn cells into triangles
|
||||
// Vertices remain the same and each cell is processed with needing topology
|
||||
//
|
||||
class TriangulateCell : public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(TopologyIn topology,
|
||||
ExecObject tables,
|
||||
FieldOutCell<> connectivityOut);
|
||||
typedef void ExecutionSignature(CellShape, PointIndices, _2, _3, VisitIndex);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
typedef vtkm::worklet::ScatterCounting ScatterType;
|
||||
VTKM_CONT_EXPORT
|
||||
ScatterType GetScatter() const
|
||||
{
|
||||
return this->Scatter;
|
||||
}
|
||||
|
||||
template<typename CountArrayType>
|
||||
VTKM_CONT_EXPORT
|
||||
TriangulateCell(const CountArrayType &countArray)
|
||||
: Scatter(countArray, DeviceAdapter())
|
||||
{ }
|
||||
|
||||
// Each cell produces triangles and write result at the offset
|
||||
template<typename CellShapeTag,
|
||||
typename ConnectivityInVec,
|
||||
typename ConnectivityOutVec>
|
||||
VTKM_EXEC_EXPORT
|
||||
void operator()(
|
||||
CellShapeTag shape,
|
||||
const ConnectivityInVec &connectivityIn,
|
||||
const vtkm::worklet::internal::TriangulateTablesExecutionObject<DeviceAdapter> &tables,
|
||||
ConnectivityOutVec &connectivityOut,
|
||||
vtkm::IdComponent visitIndex) const
|
||||
{
|
||||
vtkm::Vec<vtkm::IdComponent,3> triIndices =
|
||||
tables.GetIndices(shape, visitIndex);
|
||||
connectivityOut[0] = connectivityIn[triIndices[0]];
|
||||
connectivityOut[1] = connectivityIn[triIndices[1]];
|
||||
connectivityOut[2] = connectivityIn[triIndices[2]];
|
||||
}
|
||||
|
||||
private:
|
||||
ScatterType Scatter;
|
||||
};
|
||||
|
||||
//
|
||||
// Construct the filter to triangulate explicit grid
|
||||
//
|
||||
TriangulateFilterExplicitGrid(const vtkm::cont::DataSet &inDataSet,
|
||||
vtkm::cont::DataSet &outDataSet) :
|
||||
InDataSet(inDataSet),
|
||||
OutDataSet(outDataSet)
|
||||
{}
|
||||
|
||||
vtkm::cont::DataSet InDataSet; // input dataset with structured cell set
|
||||
vtkm::cont::DataSet OutDataSet; // output dataset with explicit cell set
|
||||
|
||||
//
|
||||
// Populate the output dataset with triangles based on input explicit dataset
|
||||
//
|
||||
void Run()
|
||||
{
|
||||
// Cell sets belonging to input and output datasets
|
||||
vtkm::cont::CellSetExplicit<> inCellSet;
|
||||
InDataSet.GetCellSet(0).CopyTo(inCellSet);
|
||||
vtkm::cont::CellSetSingleType<> &cellSet =
|
||||
this->OutDataSet.GetCellSet(0).template Cast<vtkm::cont::CellSetSingleType<> >();
|
||||
|
||||
// Input topology
|
||||
vtkm::cont::ArrayHandle<vtkm::UInt8> inShapes = inCellSet.GetShapesArray(
|
||||
vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> inNumIndices = inCellSet.GetNumIndicesArray(
|
||||
vtkm::TopologyElementTagPoint(), vtkm::TopologyElementTagCell());
|
||||
|
||||
// Output topology
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> outConnectivity;
|
||||
|
||||
vtkm::worklet::internal::TriangulateTables tables;
|
||||
|
||||
// Determine the number of output cells each input cell will generate
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> numOutCellArray;
|
||||
vtkm::worklet::DispatcherMapField<TrianglesPerCell,DeviceAdapter>
|
||||
triPerCellDispatcher;
|
||||
triPerCellDispatcher.Invoke(inShapes,
|
||||
inNumIndices,
|
||||
tables.PrepareForInput(DeviceAdapter()),
|
||||
numOutCellArray);
|
||||
|
||||
// Build new cells
|
||||
TriangulateCell triangulateWorklet(numOutCellArray);
|
||||
vtkm::worklet::DispatcherMapTopology<TriangulateCell,DeviceAdapter>
|
||||
triangulateDispatcher(triangulateWorklet);
|
||||
triangulateDispatcher.Invoke(
|
||||
inCellSet,
|
||||
tables.PrepareForInput(DeviceAdapter()),
|
||||
vtkm::cont::make_ArrayHandleGroupVec<3>(outConnectivity));
|
||||
|
||||
// Add cells to output cellset
|
||||
cellSet.Fill(outConnectivity);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::worklet
|
||||
|
||||
#endif // vtk_m_worklet_TriangulateExplicitGrid_h
|
131
vtkm/worklet/TriangulateUniformGrid.h
Normal file
131
vtkm/worklet/TriangulateUniformGrid.h
Normal file
@ -0,0 +1,131 @@
|
||||
//============================================================================
|
||||
// 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 2015 Sandia Corporation.
|
||||
// Copyright 2015 UT-Battelle, LLC.
|
||||
// Copyright 2015 Los Alamos National Security.
|
||||
//
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// 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_worklet_TriangulateUniformGrid_h
|
||||
#define vtk_m_worklet_TriangulateUniformGrid_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleGroupVec.h>
|
||||
#include <vtkm/cont/CellSetSingleType.h>
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DeviceAdapter.h>
|
||||
#include <vtkm/cont/DynamicArrayHandle.h>
|
||||
#include <vtkm/cont/ErrorControlBadValue.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/ScatterUniform.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
namespace vtkm {
|
||||
namespace worklet {
|
||||
|
||||
namespace detail {
|
||||
|
||||
VTKM_EXEC_CONSTANT_EXPORT
|
||||
const static vtkm::IdComponent StructuredTriangleIndices[2][3] = {
|
||||
{ 0, 1, 2 },
|
||||
{ 0, 2, 3 }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/// \brief Compute the triangulate cells for a uniform grid data set
|
||||
template <typename DeviceAdapter>
|
||||
class TriangulateFilterUniformGrid
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Worklet to turn quads into triangles
|
||||
// Vertices remain the same and each cell is processed with needing topology
|
||||
//
|
||||
class TriangulateCell : public vtkm::worklet::WorkletMapPointToCell
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(TopologyIn topology,
|
||||
FieldOutCell<> connectivityOut);
|
||||
typedef void ExecutionSignature(PointIndices, _2, VisitIndex);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
typedef vtkm::worklet::ScatterUniform ScatterType;
|
||||
VTKM_CONT_EXPORT
|
||||
ScatterType GetScatter() const
|
||||
{
|
||||
return ScatterType(2);
|
||||
}
|
||||
|
||||
VTKM_CONT_EXPORT
|
||||
TriangulateCell()
|
||||
{ }
|
||||
|
||||
// Each quad cell produces 2 triangle cells
|
||||
template<typename ConnectivityInVec, typename ConnectivityOutVec>
|
||||
VTKM_EXEC_EXPORT
|
||||
void operator()(const ConnectivityInVec &connectivityIn,
|
||||
ConnectivityOutVec &connectivityOut,
|
||||
vtkm::IdComponent visitIndex) const
|
||||
{
|
||||
connectivityOut[0] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][0]];
|
||||
connectivityOut[1] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][1]];
|
||||
connectivityOut[2] = connectivityIn[detail::StructuredTriangleIndices[visitIndex][2]];
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Construct the filter to triangulate uniform grid
|
||||
//
|
||||
TriangulateFilterUniformGrid(const vtkm::cont::DataSet &inDataSet,
|
||||
vtkm::cont::DataSet &outDataSet) :
|
||||
InDataSet(inDataSet),
|
||||
OutDataSet(outDataSet)
|
||||
{
|
||||
}
|
||||
|
||||
vtkm::cont::DataSet InDataSet; // input dataset with structured cell set
|
||||
vtkm::cont::DataSet OutDataSet; // output dataset with explicit cell set
|
||||
|
||||
//
|
||||
// Populate the output dataset with triangles based on input uniform dataset
|
||||
//
|
||||
void Run()
|
||||
{
|
||||
// Get the cell set from the output data set
|
||||
vtkm::cont::CellSetSingleType<> &cellSet =
|
||||
this->OutDataSet.GetCellSet(0).template Cast<vtkm::cont::CellSetSingleType<> >();
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> connectivity;
|
||||
|
||||
vtkm::cont::CellSetStructured<2> inCellSet;
|
||||
InDataSet.GetCellSet(0).CopyTo(inCellSet);
|
||||
vtkm::worklet::DispatcherMapTopology<TriangulateCell,DeviceAdapter> dispatcher;
|
||||
dispatcher.Invoke(inCellSet,
|
||||
vtkm::cont::make_ArrayHandleGroupVec<3>(connectivity));
|
||||
|
||||
// Add cells to output cellset
|
||||
cellSet.Fill(connectivity);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::worklet
|
||||
|
||||
#endif // vtk_m_worklet_TriangulateUniformGrid_h
|
@ -61,7 +61,7 @@ vtkm::cont::DataSet RunExternalFaces(vtkm::cont::DataSet &ds)
|
||||
}
|
||||
|
||||
|
||||
vtkm::cont::CellSetExplicit<> new_cs(cellset.GetNumberOfPoints(),"cells", 2);
|
||||
vtkm::cont::CellSetExplicit<> new_cs(cellset.GetNumberOfPoints(),"cells");
|
||||
new_cs.Fill(output_shapes, output_numIndices, output_conn);
|
||||
new_ds.AddCellSet(new_cs);
|
||||
|
||||
|
@ -53,7 +53,7 @@ vtkm::cont::DataSet MakePointElevationTestDataSet()
|
||||
dataSet.AddCoordinateSystem(
|
||||
vtkm::cont::CoordinateSystem("coordinates", coordinates));
|
||||
|
||||
vtkm::cont::CellSetExplicit<> cellSet(vtkm::Id(coordinates.size()), "cells", 3);
|
||||
vtkm::cont::CellSetExplicit<> cellSet(vtkm::Id(coordinates.size()), "cells");
|
||||
cellSet.PrepareToAddCells(numCells, numCells * 4);
|
||||
for (vtkm::Id j = 0; j < dim - 1; ++j)
|
||||
{
|
||||
|
@ -19,6 +19,7 @@
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/worklet/TetrahedralizeExplicitGrid.h>
|
||||
#include <vtkm/worklet/TriangulateExplicitGrid.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
@ -33,7 +34,7 @@ namespace {
|
||||
vtkm::cont::DataSet MakeTriangulateExplicitDataSet()
|
||||
{
|
||||
vtkm::cont::DataSetBuilderExplicitIterative builder;
|
||||
builder.Begin(2);
|
||||
builder.Begin();
|
||||
|
||||
builder.AddPoint(0, 0, 0); // 0
|
||||
builder.AddPoint(1, 0, 0); // 1
|
||||
@ -103,7 +104,7 @@ vtkm::cont::DataSet MakeTriangulateExplicitDataSet()
|
||||
vtkm::cont::DataSet MakeTetrahedralizeExplicitDataSet()
|
||||
{
|
||||
vtkm::cont::DataSetBuilderExplicitIterative builder;
|
||||
builder.Begin(3);
|
||||
builder.Begin();
|
||||
|
||||
builder.AddPoint(0, 0, 0);
|
||||
builder.AddPoint(1, 0, 0);
|
||||
@ -168,7 +169,7 @@ vtkm::cont::DataSet MakeTetrahedralizeExplicitDataSet()
|
||||
//
|
||||
void TestExplicitGrid2D()
|
||||
{
|
||||
std::cout << "Testing TriangulationExplicitGrid Filter" << std::endl;
|
||||
std::cout << "Testing TriangulateExplicitGrid Filter" << std::endl;
|
||||
typedef VTKM_DEFAULT_DEVICE_ADAPTER_TAG DeviceAdapter;
|
||||
|
||||
// Create the input uniform cell set
|
||||
@ -181,9 +182,9 @@ void TestExplicitGrid2D()
|
||||
outDataSet.AddCoordinateSystem(inDataSet.GetCoordinateSystem(0));
|
||||
|
||||
// Convert explicit cells to triangles
|
||||
vtkm::worklet::TetrahedralizeFilterExplicitGrid<DeviceAdapter>
|
||||
tetrahedralizeFilter(inDataSet, outDataSet);
|
||||
tetrahedralizeFilter.Run();
|
||||
vtkm::worklet::TriangulateFilterExplicitGrid<DeviceAdapter>
|
||||
triangulateFilter(inDataSet, outDataSet);
|
||||
triangulateFilter.Run();
|
||||
|
||||
vtkm::cont::CellSetSingleType<> cellSet;
|
||||
outDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
|
@ -19,6 +19,7 @@
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/worklet/TetrahedralizeUniformGrid.h>
|
||||
#include <vtkm/worklet/TriangulateUniformGrid.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
@ -107,10 +108,10 @@ void TestUniformGrid2D()
|
||||
outDataSet.AddCellSet(outCellSet);
|
||||
outDataSet.AddCoordinateSystem(inDataSet.GetCoordinateSystem(0));
|
||||
|
||||
// Convert uniform hexahedra to tetrahedra
|
||||
vtkm::worklet::TetrahedralizeFilterUniformGrid<DeviceAdapter>
|
||||
tetrahedralizeFilter(inDataSet, outDataSet);
|
||||
tetrahedralizeFilter.Run();
|
||||
// Convert uniform quadrilaterals to triangles
|
||||
vtkm::worklet::TriangulateFilterUniformGrid<DeviceAdapter>
|
||||
triangulateFilter(inDataSet, outDataSet);
|
||||
triangulateFilter.Run();
|
||||
|
||||
vtkm::cont::CellSetSingleType<> cellSet;
|
||||
outDataSet.GetCellSet(0).CopyTo(cellSet);
|
||||
|
Loading…
Reference in New Issue
Block a user