Fix compiler warnings. Add ArrayHandle method for getting cell id
This commit is contained in:
parent
79cdd5f754
commit
6a480bad65
@ -183,6 +183,20 @@ public:
|
||||
ids[i] = this->PointToCell.Connectivity.GetPortalConstControl().Get(start + i);
|
||||
}
|
||||
|
||||
VTKM_CONT void GetIndices(vtkm::Id index, vtkm::cont::ArrayHandle<vtkm::Id>& ids) const
|
||||
{
|
||||
this->PointToCell.BuildIndexOffsets(VTKM_DEFAULT_DEVICE_ADAPTER_TAG());
|
||||
vtkm::IdComponent numIndices = this->GetNumberOfPointsInCell(index);
|
||||
ids.Allocate(numIndices);
|
||||
vtkm::Id start = this->PointToCell.IndexOffsets.GetPortalConstControl().Get(index);
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>::PortalControl idPortal = ids.GetPortalControl();
|
||||
auto PtCellPortal = this->PointToCell.Connectivity.GetPortalConstControl();
|
||||
|
||||
for (vtkm::IdComponent i = 0; i < numIndices && i < numIndices; i++)
|
||||
idPortal.Set(i, PtCellPortal.Get(start + i));
|
||||
}
|
||||
|
||||
|
||||
/// First method to add cells -- one at a time.
|
||||
VTKM_CONT
|
||||
void PrepareToAddCells(vtkm::Id numCells, vtkm::Id connectivityMaxLen)
|
||||
|
@ -187,14 +187,14 @@ private:
|
||||
|
||||
out << "CELLS " << nCells << " " << conn_length << std::endl;
|
||||
|
||||
vtkm::Vec<vtkm::Id, 8> ids;
|
||||
for (vtkm::Id i = 0; i < nCells; ++i)
|
||||
{
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> ids;
|
||||
vtkm::Id nids = cellSet.GetNumberOfPointsInCell(i);
|
||||
cellSet.GetIndices(i, ids);
|
||||
out << nids;
|
||||
for (int j = 0; j < nids; ++j)
|
||||
out << " " << ids[j];
|
||||
out << " " << ids.GetPortalControl().Get(j);
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
|
@ -257,6 +257,7 @@ private:
|
||||
PosPortal history;
|
||||
};
|
||||
|
||||
#if 0
|
||||
template <typename T, typename DeviceAdapterTag>
|
||||
class StateRecordingParticlesRound : public vtkm::exec::ExecutionObjectBase
|
||||
{
|
||||
@ -378,6 +379,7 @@ private:
|
||||
public:
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>> historyArray;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <vtkm/worklet/particleadvection/Integrators.h>
|
||||
#include <vtkm/worklet/particleadvection/Particles.h>
|
||||
|
||||
#include <vtkm/io/writer/VTKDataSetWriter.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -108,7 +110,7 @@ void TestParticleAdvection()
|
||||
|
||||
std::cout << "Testing Integrators for ParticleAdvection Worklet" << std::endl;
|
||||
|
||||
FieldType stepSize = 0.01f;
|
||||
FieldType stepSize = 0.05f;
|
||||
|
||||
vtkm::cont::DataSetBuilderUniform dataSetBuilder;
|
||||
|
||||
@ -158,16 +160,24 @@ void TestParticleAdvection()
|
||||
{
|
||||
vtkm::worklet::Streamline streamline;
|
||||
vtkm::worklet::StreamlineResult<FieldType> res;
|
||||
std::cout << __FILE__ << " " << __LINE__ << std::endl;
|
||||
res = streamline.Run(rk4, seeds, fieldArray, 5, DeviceAdapter());
|
||||
std::cout << __FILE__ << " " << __LINE__ << std::endl;
|
||||
res = streamline.Run(rk4, seeds, fieldArray, 1000, DeviceAdapter());
|
||||
// VTKM_TEST_ASSERT(res.positions.GetNumberOfValues() == seeds.GetNumberOfValues(),
|
||||
// "Number of output particles does not match input.");
|
||||
std::cout << "pos: ";
|
||||
printSummary_ArrayHandle(res.positions, std::cout, true);
|
||||
|
||||
printSummary_ArrayHandle(res.positions, std::cout);
|
||||
printSummary_ArrayHandle(res.status, std::cout, true);
|
||||
printSummary_ArrayHandle(res.stepsTaken, std::cout, true);
|
||||
res.polyLines.PrintSummary(std::cout);
|
||||
|
||||
vtkm::cont::DataSet Output;
|
||||
Output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", res.positions));
|
||||
Output.AddCellSet(res.polyLines);
|
||||
Output.AddField(vtkm::cont::Field("status", vtkm::cont::Field::ASSOC_POINTS, res.status));
|
||||
Output.AddField(vtkm::cont::Field("steps", vtkm::cont::Field::ASSOC_POINTS, res.stepsTaken));
|
||||
Output.PrintSummary(std::cout);
|
||||
|
||||
vtkm::io::writer::VTKDataSetWriter writer("streamlines.vtk");
|
||||
writer.WriteDataSet(Output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user