mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Moving base class flow filters into CXX
This commit is contained in:
parent
6f57f33318
commit
2a7149481e
@ -12,6 +12,7 @@
|
||||
#define vtk_m_filter_flow_FilterParticleAdvection_h
|
||||
|
||||
#include <vtkm/Particle.h>
|
||||
#include <vtkm/cont/ErrorFilterExecution.h>
|
||||
#include <vtkm/filter/FilterField.h>
|
||||
#include <vtkm/filter/flow/FlowTypes.h>
|
||||
#include <vtkm/filter/flow/vtkm_filter_flow_export.h>
|
||||
@ -87,7 +88,6 @@ public:
|
||||
protected:
|
||||
VTKM_CONT virtual void ValidateOptions() const;
|
||||
|
||||
|
||||
bool BlockIdsSet = false;
|
||||
std::vector<vtkm::Id> BlockIds;
|
||||
|
||||
|
@ -10,6 +10,10 @@
|
||||
|
||||
#include <vtkm/filter/flow/FilterParticleAdvectionSteadyState.h>
|
||||
|
||||
#include <vtkm/filter/flow/internal/BoundsMap.h>
|
||||
#include <vtkm/filter/flow/internal/DataSetIntegratorSteadyState.h>
|
||||
#include <vtkm/filter/flow/internal/ParticleAdvector.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
@ -17,6 +21,72 @@ namespace filter
|
||||
namespace flow
|
||||
{
|
||||
|
||||
template <typename Derived>
|
||||
VTKM_CONT typename FilterParticleAdvectionSteadyState<Derived>::FieldType
|
||||
FilterParticleAdvectionSteadyState<Derived>::GetField(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetField(data);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
VTKM_CONT typename FilterParticleAdvectionSteadyState<Derived>::TerminationType
|
||||
FilterParticleAdvectionSteadyState<Derived>::GetTermination(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetTermination(data);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
VTKM_CONT typename FilterParticleAdvectionSteadyState<Derived>::AnalysisType
|
||||
FilterParticleAdvectionSteadyState<Derived>::GetAnalysis(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetAnalysis(data);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
VTKM_CONT vtkm::cont::PartitionedDataSet
|
||||
FilterParticleAdvectionSteadyState<Derived>::DoExecutePartitions(
|
||||
const vtkm::cont::PartitionedDataSet& input)
|
||||
{
|
||||
//using ParticleType = FilterParticleAdvectionSteadyState<Derived>::ParticleType;
|
||||
//using FieldType = FilterParticleAdvectionSteadyState<Derived>::FieldType;
|
||||
//using TerminationType = FilterParticleAdvectionSteadyState<Derived>::TerminationType;
|
||||
//using AnalysisType = FilterParticleAdvectionSteadyState<Derived>::AnalysisType;
|
||||
using DSIType = vtkm::filter::flow::internal::
|
||||
DataSetIntegratorSteadyState<ParticleType, FieldType, TerminationType, AnalysisType>;
|
||||
|
||||
this->ValidateOptions();
|
||||
|
||||
|
||||
vtkm::filter::flow::internal::BoundsMap boundsMap(input);
|
||||
std::vector<DSIType> dsi;
|
||||
for (vtkm::Id i = 0; i < input.GetNumberOfPartitions(); i++)
|
||||
{
|
||||
vtkm::Id blockId = boundsMap.GetLocalBlockId(i);
|
||||
auto dataset = input.GetPartition(i);
|
||||
|
||||
// Build the field for the current dataset
|
||||
FieldType field = this->GetField(dataset);
|
||||
// Build the termination for the current dataset
|
||||
TerminationType termination = this->GetTermination(dataset);
|
||||
// Build the analysis for the current dataset
|
||||
AnalysisType analysis = this->GetAnalysis(dataset);
|
||||
|
||||
dsi.emplace_back(blockId, field, dataset, this->SolverType, termination, analysis);
|
||||
}
|
||||
|
||||
vtkm::filter::flow::internal::ParticleAdvector<DSIType> pav(
|
||||
boundsMap, dsi, this->UseThreadedAlgorithm, this->UseAsynchronousCommunication);
|
||||
|
||||
vtkm::cont::ArrayHandle<ParticleType> particles;
|
||||
this->Seeds.AsArrayHandle(particles);
|
||||
return pav.Execute(particles, this->StepSize);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter::flow
|
||||
|
||||
#include <vtkm/filter/flow/FilterParticleAdvectionSteadyState.inl>
|
||||
|
@ -15,10 +15,6 @@
|
||||
#include <vtkm/filter/flow/FlowTypes.h>
|
||||
#include <vtkm/filter/flow/vtkm_filter_flow_export.h>
|
||||
|
||||
#include <vtkm/filter/flow/internal/BoundsMap.h>
|
||||
#include <vtkm/filter/flow/internal/DataSetIntegratorSteadyState.h>
|
||||
#include <vtkm/filter/flow/internal/ParticleAdvector.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
@ -39,56 +35,14 @@ public:
|
||||
using AnalysisType = typename FlowTraits<Derived>::AnalysisType;
|
||||
|
||||
private:
|
||||
VTKM_CONT FieldType GetField(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetField(data);
|
||||
}
|
||||
VTKM_CONT FieldType GetField(const vtkm::cont::DataSet& data) const;
|
||||
|
||||
VTKM_CONT TerminationType GetTermination(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetTermination(data);
|
||||
}
|
||||
VTKM_CONT TerminationType GetTermination(const vtkm::cont::DataSet& data) const;
|
||||
|
||||
VTKM_CONT AnalysisType GetAnalysis(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetAnalysis(data);
|
||||
}
|
||||
VTKM_CONT AnalysisType GetAnalysis(const vtkm::cont::DataSet& data) const;
|
||||
|
||||
VTKM_CONT vtkm::cont::PartitionedDataSet DoExecutePartitions(
|
||||
const vtkm::cont::PartitionedDataSet& input)
|
||||
{
|
||||
this->ValidateOptions();
|
||||
|
||||
using DSIType = vtkm::filter::flow::internal::
|
||||
DataSetIntegratorSteadyState<ParticleType, FieldType, TerminationType, AnalysisType>;
|
||||
|
||||
vtkm::filter::flow::internal::BoundsMap boundsMap(input);
|
||||
std::vector<DSIType> dsi;
|
||||
for (vtkm::Id i = 0; i < input.GetNumberOfPartitions(); i++)
|
||||
{
|
||||
vtkm::Id blockId = boundsMap.GetLocalBlockId(i);
|
||||
auto dataset = input.GetPartition(i);
|
||||
|
||||
// Build the field for the current dataset
|
||||
FieldType field = this->GetField(dataset);
|
||||
// Build the termination for the current dataset
|
||||
TerminationType termination = this->GetTermination(dataset);
|
||||
// Build the analysis for the current dataset
|
||||
AnalysisType analysis = this->GetAnalysis(dataset);
|
||||
|
||||
dsi.emplace_back(blockId, field, dataset, this->SolverType, termination, analysis);
|
||||
}
|
||||
|
||||
vtkm::filter::flow::internal::ParticleAdvector<DSIType> pav(
|
||||
boundsMap, dsi, this->UseThreadedAlgorithm, this->UseAsynchronousCommunication);
|
||||
|
||||
vtkm::cont::ArrayHandle<ParticleType> particles;
|
||||
this->Seeds.AsArrayHandle(particles);
|
||||
return pav.Execute(particles, this->StepSize);
|
||||
}
|
||||
const vtkm::cont::PartitionedDataSet& input) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
18
vtkm/filter/flow/FilterParticleAdvectionSteadyState.inl
Normal file
18
vtkm/filter/flow/FilterParticleAdvectionSteadyState.inl
Normal file
@ -0,0 +1,18 @@
|
||||
#include<vtkm/filter/flow/ParticleAdvection.h>
|
||||
#include<vtkm/filter/flow/Streamline.h>
|
||||
#include<vtkm/filter/flow/WarpXStreamline.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace flow
|
||||
{
|
||||
|
||||
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::ParticleAdvection>;
|
||||
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::Streamline>;
|
||||
template class FilterParticleAdvectionSteadyState<vtkm::filter::flow::WarpXStreamline>;
|
||||
|
||||
} // namespace flow
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
@ -10,6 +10,10 @@
|
||||
|
||||
#include <vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.h>
|
||||
|
||||
#include <vtkm/filter/flow/internal/BoundsMap.h>
|
||||
#include <vtkm/filter/flow/internal/DataSetIntegratorUnsteadyState.h>
|
||||
#include <vtkm/filter/flow/internal/ParticleAdvector.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
@ -17,6 +21,79 @@ namespace filter
|
||||
namespace flow
|
||||
{
|
||||
|
||||
template <typename Derived>
|
||||
VTKM_CONT typename FilterParticleAdvectionUnsteadyState<Derived>::FieldType
|
||||
FilterParticleAdvectionUnsteadyState<Derived>::GetField(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetField(data);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
VTKM_CONT typename FilterParticleAdvectionUnsteadyState<Derived>::TerminationType
|
||||
FilterParticleAdvectionUnsteadyState<Derived>::GetTermination(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetTermination(data);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
VTKM_CONT typename FilterParticleAdvectionUnsteadyState<Derived>::AnalysisType
|
||||
FilterParticleAdvectionUnsteadyState<Derived>::GetAnalysis(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetAnalysis(data);
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
VTKM_CONT vtkm::cont::PartitionedDataSet
|
||||
FilterParticleAdvectionUnsteadyState<Derived>::DoExecutePartitions(
|
||||
const vtkm::cont::PartitionedDataSet& input)
|
||||
{
|
||||
this->ValidateOptions();
|
||||
|
||||
using DSIType = vtkm::filter::flow::internal::
|
||||
DataSetIntegratorUnsteadyState<ParticleType, FieldType, TerminationType, AnalysisType>;
|
||||
|
||||
vtkm::filter::flow::internal::BoundsMap boundsMap(input);
|
||||
|
||||
std::vector<DSIType> dsi;
|
||||
for (vtkm::Id i = 0; i < input.GetNumberOfPartitions(); i++)
|
||||
{
|
||||
vtkm::Id blockId = boundsMap.GetLocalBlockId(i);
|
||||
auto ds1 = input.GetPartition(i);
|
||||
auto ds2 = this->Input2.GetPartition(i);
|
||||
|
||||
// Build the field for the current dataset
|
||||
FieldType field1 = this->GetField(ds1);
|
||||
FieldType field2 = this->GetField(ds2);
|
||||
|
||||
// Build the termination for the current dataset
|
||||
TerminationType termination = this->GetTermination(ds1);
|
||||
|
||||
AnalysisType analysis = this->GetAnalysis(ds1);
|
||||
|
||||
dsi.emplace_back(blockId,
|
||||
field1,
|
||||
field2,
|
||||
ds1,
|
||||
ds2,
|
||||
this->Time1,
|
||||
this->Time2,
|
||||
this->SolverType,
|
||||
termination,
|
||||
analysis);
|
||||
}
|
||||
vtkm::filter::flow::internal::ParticleAdvector<DSIType> pav(
|
||||
boundsMap, dsi, this->UseThreadedAlgorithm, this->UseAsynchronousCommunication);
|
||||
|
||||
vtkm::cont::ArrayHandle<ParticleType> particles;
|
||||
this->Seeds.AsArrayHandle(particles);
|
||||
return pav.Execute(particles, this->StepSize);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::filter::flow
|
||||
|
||||
#include <vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.inl>
|
||||
|
@ -14,10 +14,6 @@
|
||||
#include <vtkm/filter/flow/FilterParticleAdvection.h>
|
||||
#include <vtkm/filter/flow/vtkm_filter_flow_export.h>
|
||||
|
||||
#include <vtkm/filter/flow/internal/BoundsMap.h>
|
||||
#include <vtkm/filter/flow/internal/DataSetIntegratorUnsteadyState.h>
|
||||
#include <vtkm/filter/flow/internal/ParticleAdvector.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
@ -46,68 +42,14 @@ public:
|
||||
VTKM_CONT void SetNextDataSet(const vtkm::cont::PartitionedDataSet& pds) { this->Input2 = pds; }
|
||||
|
||||
private:
|
||||
VTKM_CONT FieldType GetField(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetField(data);
|
||||
}
|
||||
VTKM_CONT FieldType GetField(const vtkm::cont::DataSet& data) const;
|
||||
|
||||
VTKM_CONT TerminationType GetTermination(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetTermination(data);
|
||||
}
|
||||
VTKM_CONT TerminationType GetTermination(const vtkm::cont::DataSet& data) const;
|
||||
|
||||
VTKM_CONT AnalysisType GetAnalysis(const vtkm::cont::DataSet& data) const
|
||||
{
|
||||
const Derived* inst = static_cast<const Derived*>(this);
|
||||
return inst->GetAnalysis(data);
|
||||
}
|
||||
VTKM_CONT AnalysisType GetAnalysis(const vtkm::cont::DataSet& data) const;
|
||||
|
||||
VTKM_CONT vtkm::cont::PartitionedDataSet DoExecutePartitions(
|
||||
const vtkm::cont::PartitionedDataSet& input)
|
||||
{
|
||||
this->ValidateOptions();
|
||||
|
||||
using DSIType = vtkm::filter::flow::internal::
|
||||
DataSetIntegratorUnsteadyState<ParticleType, FieldType, TerminationType, AnalysisType>;
|
||||
|
||||
vtkm::filter::flow::internal::BoundsMap boundsMap(input);
|
||||
|
||||
std::vector<DSIType> dsi;
|
||||
for (vtkm::Id i = 0; i < input.GetNumberOfPartitions(); i++)
|
||||
{
|
||||
vtkm::Id blockId = boundsMap.GetLocalBlockId(i);
|
||||
auto ds1 = input.GetPartition(i);
|
||||
auto ds2 = this->Input2.GetPartition(i);
|
||||
|
||||
// Build the field for the current dataset
|
||||
FieldType field1 = this->GetField(ds1);
|
||||
FieldType field2 = this->GetField(ds2);
|
||||
|
||||
// Build the termination for the current dataset
|
||||
TerminationType termination = this->GetTermination(ds1);
|
||||
|
||||
AnalysisType analysis = this->GetAnalysis(ds1);
|
||||
|
||||
dsi.emplace_back(blockId,
|
||||
field1,
|
||||
field2,
|
||||
ds1,
|
||||
ds2,
|
||||
this->Time1,
|
||||
this->Time2,
|
||||
this->SolverType,
|
||||
termination,
|
||||
analysis);
|
||||
}
|
||||
vtkm::filter::flow::internal::ParticleAdvector<DSIType> pav(
|
||||
boundsMap, dsi, this->UseThreadedAlgorithm, this->UseAsynchronousCommunication);
|
||||
|
||||
vtkm::cont::ArrayHandle<ParticleType> particles;
|
||||
this->Seeds.AsArrayHandle(particles);
|
||||
return pav.Execute(particles, this->StepSize);
|
||||
}
|
||||
const vtkm::cont::PartitionedDataSet& input);
|
||||
|
||||
vtkm::cont::PartitionedDataSet Input2;
|
||||
vtkm::FloatDefault Time1 = -1;
|
||||
|
16
vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.inl
Normal file
16
vtkm/filter/flow/FilterParticleAdvectionUnsteadyState.inl
Normal file
@ -0,0 +1,16 @@
|
||||
#include<vtkm/filter/flow/PathParticle.h>
|
||||
#include<vtkm/filter/flow/Pathline.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
namespace flow
|
||||
{
|
||||
|
||||
template class FilterParticleAdvectionUnsteadyState<vtkm::filter::flow::PathParticle>;
|
||||
template class FilterParticleAdvectionUnsteadyState<vtkm::filter::flow::Pathline>;
|
||||
|
||||
} // namespace flow
|
||||
} // namespace filter
|
||||
} // namespace vtkm
|
Loading…
Reference in New Issue
Block a user