Add pathparticle2 filter
This commit is contained in:
parent
6e097a5eb3
commit
c40356bc8a
@ -109,6 +109,7 @@ set(extra_headers
|
||||
Pathline.h
|
||||
Pathline2.h
|
||||
PathParticle.h
|
||||
PathParticle2.h
|
||||
Streamline.h
|
||||
Streamline2.h
|
||||
StreamSurface.h
|
||||
@ -127,6 +128,7 @@ set(extra_header_template_sources
|
||||
Pathline.hxx
|
||||
Pathline2.hxx
|
||||
PathParticle.hxx
|
||||
PathParticle2.hxx
|
||||
Streamline.hxx
|
||||
Streamline2.hxx
|
||||
StreamSurface.hxx
|
||||
|
62
vtkm/filter/PathParticle2.h
Normal file
62
vtkm/filter/PathParticle2.h
Normal file
@ -0,0 +1,62 @@
|
||||
//============================================================================
|
||||
// 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.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_PathParticle2_h
|
||||
#define vtk_m_filter_PathParticle2_h
|
||||
|
||||
#include <vtkm/Particle.h>
|
||||
#include <vtkm/filter/FilterParticleAdvection.h>
|
||||
#include <vtkm/filter/NewFilterField.h>
|
||||
#include <vtkm/filter/particleadvection/ParticleAdvectionTypes.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
/// \brief Advect particles in a vector field.
|
||||
|
||||
/// Takes as input a vector field and seed locations and generates the
|
||||
/// end points for each seed through the vector field.
|
||||
|
||||
class PathParticle2
|
||||
: public vtkm::filter::FilterTemporalParticleAdvection<PathParticle2, vtkm::Particle>
|
||||
{
|
||||
public:
|
||||
VTKM_CONT PathParticle2();
|
||||
|
||||
template <typename DerivedPolicy>
|
||||
vtkm::cont::PartitionedDataSet PrepareForExecution(
|
||||
const vtkm::cont::PartitionedDataSet& input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
|
||||
|
||||
vtkm::cont::UnknownArrayHandle SeedArray;
|
||||
};
|
||||
|
||||
class PathParticle3 : public vtkm::filter::NewFilterField
|
||||
{
|
||||
public:
|
||||
// VTKM_CONT PathParticle3() {}
|
||||
|
||||
protected:
|
||||
VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& inData) override;
|
||||
VTKM_CONT vtkm::cont::PartitionedDataSet DoExecutePartitions(
|
||||
const vtkm::cont::PartitionedDataSet& inData) override;
|
||||
|
||||
vtkm::cont::UnknownArrayHandle SeedArray;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
||||
#ifndef vtk_m_filter_PathParticle2_hxx
|
||||
#include <vtkm/filter/PathParticle2.hxx>
|
||||
#endif
|
||||
|
||||
#endif // vtk_m_filter_PathParticle2_h
|
110
vtkm/filter/PathParticle2.hxx
Normal file
110
vtkm/filter/PathParticle2.hxx
Normal file
@ -0,0 +1,110 @@
|
||||
//============================================================================
|
||||
// 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.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_filter_PathParticle2_hxx
|
||||
#define vtk_m_filter_PathParticle2_hxx
|
||||
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
#include <vtkm/filter/PathParticle2.h>
|
||||
#include <vtkm/filter/particleadvection/BoundsMap.h>
|
||||
#include <vtkm/filter/particleadvection/DataSetIntegrator.h>
|
||||
#include <vtkm/filter/particleadvection/ParticleAdvectionAlgorithm.h>
|
||||
|
||||
#include <vtkm/filter/particleadvection/DSI.h>
|
||||
#include <vtkm/filter/particleadvection/PAV.h>
|
||||
#include <vtkm/filter/particleadvection/ParticleAdvectionTypes.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
inline VTKM_CONT PathParticle2::PathParticle2()
|
||||
: vtkm::filter::FilterTemporalParticleAdvection<PathParticle2, vtkm::Particle>()
|
||||
{
|
||||
this->ResultType = vtkm::filter::particleadvection::PARTICLE_ADVECT_TYPE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename DerivedPolicy>
|
||||
inline VTKM_CONT vtkm::cont::PartitionedDataSet PathParticle2::PrepareForExecution(
|
||||
const vtkm::cont::PartitionedDataSet& input,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
// using AlgorithmType = vtkm::filter::particleadvection::ParticleAdvectionAlgorithm;
|
||||
// using ThreadedAlgorithmType = vtkm::filter::particleadvection::ParticleAdvectionThreadedAlgorithm;
|
||||
using DSIType = vtkm::filter::particleadvection::DSI;
|
||||
|
||||
this->ValidateOptions();
|
||||
//Make sure everything matches up ok.
|
||||
this->VecFieldType = vtkm::filter::particleadvection::VELOCITY_FIELD_TYPE;
|
||||
|
||||
vtkm::filter::particleadvection::BoundsMap boundsMap(input);
|
||||
std::string activeField = this->GetActiveFieldName();
|
||||
|
||||
std::vector<DSIType*> dsi;
|
||||
for (vtkm::Id i = 0; i < input.GetNumberOfPartitions(); i++)
|
||||
{
|
||||
vtkm::Id blockId = boundsMap.GetLocalBlockId(i);
|
||||
auto ds = input.GetPartition(i);
|
||||
if (!ds.HasPointField(activeField) && !ds.HasCellField(activeField))
|
||||
throw vtkm::cont::ErrorFilterExecution("Unsupported field assocation");
|
||||
|
||||
dsi.push_back(new DSIType(
|
||||
ds, blockId, activeField, this->SolverType, this->VecFieldType, this->ResultType));
|
||||
}
|
||||
|
||||
this->SeedArray = this->Seeds;
|
||||
vtkm::filter::particleadvection::PAV pav(
|
||||
boundsMap, dsi, this->UseThreadedAlgorithm, this->ResultType);
|
||||
return pav.Execute(this->NumberOfSteps, this->StepSize, this->SeedArray);
|
||||
|
||||
#if 0
|
||||
//std::vector<DSIType> ddsi;
|
||||
/*
|
||||
vtkm::filter::particleadvection::RunAlgo<DSIType, AlgorithmType>(
|
||||
boundsMap, ddsi, this->NumberOfSteps, this->StepSize, this->Seeds);
|
||||
*/
|
||||
|
||||
vtkm::cont::PartitionedDataSet output;
|
||||
return output;
|
||||
|
||||
/*
|
||||
//using DSIType = vtkm::filter::particleadvection::DataSetIntegrator;
|
||||
//std::vector<DSIType> dsi;
|
||||
auto dsi = this->CreateDataSetIntegrators(input, boundsMap);
|
||||
|
||||
if (this->GetUseThreadedAlgorithm())
|
||||
return vtkm::filter::particleadvection::RunAlgo<DSIType, ThreadedAlgorithmType>(
|
||||
boundsMap, dsi, this->NumberOfSteps, this->StepSize, this->Seeds);
|
||||
else
|
||||
return vtkm::filter::particleadvection::RunAlgo<DSIType, AlgorithmType>(
|
||||
boundsMap, dsi, this->NumberOfSteps, this->StepSize, this->Seeds);
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
VTKM_CONT vtkm::cont::DataSet PathParticle3::DoExecute(const vtkm::cont::DataSet& inData)
|
||||
{
|
||||
std::cout << "Meow DS" << std::endl;
|
||||
auto result = this->DoExecutePartitions(inData);
|
||||
return result.GetPartition(0);
|
||||
}
|
||||
|
||||
VTKM_CONT vtkm::cont::PartitionedDataSet PathParticle3::DoExecutePartitions(
|
||||
const vtkm::cont::PartitionedDataSet& inData)
|
||||
{
|
||||
std::cout << "Meow pDS" << std::endl;
|
||||
return inData;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
#endif
|
@ -29,7 +29,7 @@ namespace filter
|
||||
inline VTKM_CONT Pathline2::Pathline2()
|
||||
: vtkm::filter::FilterTemporalParticleAdvection<Pathline2, vtkm::Particle>()
|
||||
{
|
||||
this->ResultType = vtkm::filter::particleadvection::PARTICLE_ADVECT_TYPE;
|
||||
this->ResultType = vtkm::filter::particleadvection::STREAMLINE_TYPE;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <vtkm/filter/ParticleAdvection.h>
|
||||
#include <vtkm/filter/ParticleAdvection2.h>
|
||||
#include <vtkm/filter/PathParticle.h>
|
||||
#include <vtkm/filter/PathParticle2.h>
|
||||
#include <vtkm/filter/Pathline.h>
|
||||
#include <vtkm/filter/Pathline2.h>
|
||||
#include <vtkm/filter/Streamline.h>
|
||||
@ -472,7 +473,7 @@ void TestPartitionedDataSet(vtkm::Id num, bool useGhost, FilterType fType)
|
||||
auto pds2 = allPDs2[idx];
|
||||
AddVectorFields(pds2, fieldName, vecX);
|
||||
|
||||
vtkm::filter::PathParticle pathParticle;
|
||||
vtkm::filter::PathParticle2 pathParticle;
|
||||
pathParticle.SetPreviousTime(0);
|
||||
pathParticle.SetNextTime(1000);
|
||||
pathParticle.SetNextDataSet(pds2);
|
||||
@ -610,7 +611,8 @@ void TestStreamlineFilters()
|
||||
FilterType::PATHLINE,
|
||||
FilterType::PATH_PARTICLE };
|
||||
|
||||
fTypes = { FilterType::PARTICLE_ADVECTION, FilterType::STREAMLINE };
|
||||
//fTypes = {FilterType::PARTICLE_ADVECTION,FilterType::STREAMLINE};
|
||||
//fTypes = {FilterType::PATH_PARTICLE};
|
||||
for (int n = 1; n < 3; n++)
|
||||
{
|
||||
for (auto useGhost : flags)
|
||||
|
Loading…
Reference in New Issue
Block a user