Fix merges with master.
This commit is contained in:
parent
1c0f721b96
commit
7e69b9606d
@ -122,18 +122,7 @@ public:
|
||||
template <vtkm::IdComponent ItemTupleLength>
|
||||
VTKM_CONT void GetIndices(vtkm::Id index, vtkm::Vec<vtkm::Id, ItemTupleLength>& ids) const;
|
||||
|
||||
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));
|
||||
}
|
||||
VTKM_CONT void GetIndices(vtkm::Id index, vtkm::cont::ArrayHandle<vtkm::Id>& ids) const;
|
||||
|
||||
/// First method to add cells -- one at a time.
|
||||
VTKM_CONT void PrepareToAddCells(vtkm::Id numCells, vtkm::Id connectivityMaxLen);
|
||||
|
@ -216,6 +216,25 @@ CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, O
|
||||
}
|
||||
}
|
||||
|
||||
template <typename ShapeStorageTag,
|
||||
typename NumIndicesStorageTag,
|
||||
typename ConnectivityStorageTag,
|
||||
typename OffsetsStorageTag>
|
||||
VTKM_CONT void
|
||||
CellSetExplicit<ShapeStorageTag, NumIndicesStorageTag, ConnectivityStorageTag, OffsetsStorageTag>::
|
||||
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));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
template <typename ShapeStorageTag,
|
||||
|
@ -147,12 +147,10 @@ public:
|
||||
template <typename IntegratorType,
|
||||
typename FieldType,
|
||||
typename PointStorage,
|
||||
typename FieldStorage,
|
||||
typename DeviceAdapter>
|
||||
StreamlineResult<FieldType> Run(
|
||||
const IntegratorType& it,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>, PointStorage>& seedArray,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>, FieldStorage>& fieldArray,
|
||||
const vtkm::Id& nSteps,
|
||||
const DeviceAdapter&)
|
||||
{
|
||||
@ -165,17 +163,18 @@ public:
|
||||
|
||||
//Allocate status and steps arrays.
|
||||
vtkm::Id numSeeds = seedArray.GetNumberOfValues();
|
||||
vtkm::Id val = vtkm::worklet::particleadvection::ParticleStatus::OK;
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, FieldStorage> status, steps;
|
||||
vtkm::Id val = vtkm::worklet::particleadvection::ParticleStatus::STATUS_OK;
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> status, steps;
|
||||
vtkm::cont::ArrayHandleConstant<vtkm::Id> ok(val, numSeeds);
|
||||
status.Allocate(numSeeds);
|
||||
|
||||
DeviceAlgorithm::Copy(ok, status);
|
||||
|
||||
vtkm::cont::ArrayHandleConstant<vtkm::Id> zero(0, numSeeds);
|
||||
steps.Allocate(numSeeds);
|
||||
DeviceAlgorithm::Copy(zero, steps);
|
||||
|
||||
worklet.Run(it, seedArray, fieldArray, nSteps, positions, polyLines, status, steps);
|
||||
worklet.Run(it, seedArray, nSteps, positions, polyLines, status, steps);
|
||||
|
||||
StreamlineResult<FieldType> res(positions, polyLines, status, steps);
|
||||
return res;
|
||||
|
@ -87,6 +87,7 @@ template <typename IntegratorType, typename FieldType, typename DeviceAdapterTag
|
||||
class ParticleAdvectionWorklet
|
||||
{
|
||||
public:
|
||||
typedef typename vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapterTag> DeviceAlgorithm;
|
||||
typedef vtkm::worklet::particleadvection::ParticleAdvectWorklet<IntegratorType,
|
||||
FieldType,
|
||||
DeviceAdapterTag>
|
||||
@ -162,7 +163,6 @@ public:
|
||||
template <typename PointStorage, typename FieldStorage>
|
||||
void Run(const IntegratorType& it,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>, PointStorage>& pts,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>, FieldStorage> fieldArray,
|
||||
const vtkm::Id& nSteps,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>, PointStorage>& positions,
|
||||
vtkm::cont::CellSetExplicit<>& polyLines,
|
||||
@ -172,7 +172,6 @@ public:
|
||||
integrator = it;
|
||||
seedArray = pts;
|
||||
maxSteps = nSteps;
|
||||
field = fieldArray.PrepareForInput(DeviceAdapterTag());
|
||||
|
||||
run(positions, polyLines, statusArray, stepsTaken);
|
||||
}
|
||||
@ -214,6 +213,7 @@ private:
|
||||
//Compact history into positions.
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>> history;
|
||||
StreamlineType streamlines(seedArray, history, stepsTaken, status, validPoint, maxSteps);
|
||||
|
||||
particleWorkletDispatch.Invoke(idxArray, streamlines);
|
||||
DeviceAlgorithm::CopyIf(history, validPoint, positions, IsOne());
|
||||
|
||||
@ -241,7 +241,6 @@ private:
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>> seedArray;
|
||||
vtkm::cont::DataSet ds;
|
||||
vtkm::Id maxSteps;
|
||||
FieldPortalConstType field;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -242,15 +242,17 @@ public:
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& historyArray,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& stepsArray,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& statusArray,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id>& validPointArray,
|
||||
const vtkm::Id& _maxSteps)
|
||||
{
|
||||
this->Pos = posArray.PrepareForInPlace(DeviceAdapterTag());
|
||||
this->Steps = stepsArray.PrepareForInPlace(DeviceAdapterTag());
|
||||
this->Status = statusArray.PrepareForInPlace(DeviceAdapterTag());
|
||||
this->ValidPoint = validPointArray.PrepareForInPlace(DeviceAdapterTag());
|
||||
this->MaxSteps = _maxSteps;
|
||||
HistSize = _maxSteps;
|
||||
NumPos = posArray.GetNumberOfValues();
|
||||
History = HistoryArray.PrepareForOutput(NumPos * HistSize, DeviceAdapterTag());
|
||||
History = historyArray.PrepareForOutput(NumPos * HistSize, DeviceAdapterTag());
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
@ -266,10 +268,11 @@ public:
|
||||
this->Pos = posArray.PrepareForInPlace(DeviceAdapterTag());
|
||||
this->Steps = stepsArray.PrepareForInPlace(DeviceAdapterTag());
|
||||
this->Status = statusArray.PrepareForInPlace(DeviceAdapterTag());
|
||||
this->ValidPoint = validPointArray.PrepareForInPlace(DeviceAdapterTag());
|
||||
this->MaxSteps = _maxSteps;
|
||||
HistSize = _histSize;
|
||||
NumPos = posArray.GetNumberOfValues();
|
||||
History = HistoryArray.PrepareForOutput(NumPos * HistSize, DeviceAdapterTag());
|
||||
History = historyArray.PrepareForOutput(NumPos * HistSize, DeviceAdapterTag());
|
||||
}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
@ -296,10 +299,8 @@ public:
|
||||
|
||||
private:
|
||||
vtkm::Id NumPos, HistSize;
|
||||
IdPortal ValidPoint;
|
||||
PosPortal History;
|
||||
|
||||
public:
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>> HistoryArray;
|
||||
};
|
||||
|
||||
} //namespace particleadvection
|
||||
|
@ -456,14 +456,11 @@ void TestParticleWorklets()
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>> seeds;
|
||||
seeds = vtkm::cont::make_ArrayHandle(pts);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>> fieldArray;
|
||||
fieldArray = vtkm::cont::make_ArrayHandle(field);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
vtkm::worklet::ParticleAdvection particleAdvection;
|
||||
vtkm::worklet::ParticleAdvectionResult<FieldType> res;
|
||||
res = particleAdvection.Run(rk4, seeds, fieldArray, 1000, DeviceAdapter());
|
||||
res = particleAdvection.Run(rk4, seeds, 1000, DeviceAdapter());
|
||||
VTKM_TEST_ASSERT(res.positions.GetNumberOfValues() == seeds.GetNumberOfValues(),
|
||||
"Number of output particles does not match input.");
|
||||
}
|
||||
@ -471,10 +468,11 @@ void TestParticleWorklets()
|
||||
{
|
||||
vtkm::worklet::Streamline streamline;
|
||||
vtkm::worklet::StreamlineResult<FieldType> res;
|
||||
res = streamline.Run(rk4, seeds, fieldArray, 1000, DeviceAdapter());
|
||||
// VTKM_TEST_ASSERT(res.positions.GetNumberOfValues() == seeds.GetNumberOfValues(),
|
||||
// "Number of output particles does not match input.");
|
||||
res = streamline.Run(rk4, seeds, 1000, DeviceAdapter());
|
||||
VTKM_TEST_ASSERT(res.positions.GetNumberOfValues() == seeds.GetNumberOfValues(),
|
||||
"Number of output particles does not match input.");
|
||||
|
||||
/*
|
||||
printSummary_ArrayHandle(res.positions, std::cout);
|
||||
printSummary_ArrayHandle(res.status, std::cout, true);
|
||||
printSummary_ArrayHandle(res.stepsTaken, std::cout, true);
|
||||
@ -486,9 +484,7 @@ void TestParticleWorklets()
|
||||
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