11 #ifndef vtk_m_filter_flow_internal_DataSetIntegratorUnsteadyState_h
12 #define vtk_m_filter_flow_internal_DataSetIntegratorUnsteadyState_h
16 #include <vtkm/filter/flow/worklet/TemporalGridEvaluators.h>
28 template <
typename ParticleType,
30 typename TerminationType,
31 typename AnalysisType>
32 class AdvectHelperUnsteadyState
35 using WorkletType = vtkm::worklet::flow::ParticleAdvection;
36 using UnsteadyStateGridEvalType = vtkm::worklet::flow::TemporalGridEvaluator<FieldType>;
38 template <
template <
typename>
class SolverType>
40 const FieldType& field1,
43 const FieldType& field2,
46 const TerminationType& termination,
48 AnalysisType& analysis)
51 using StepperType = vtkm::worklet::flow::Stepper<SolverType<UnsteadyStateGridEvalType>,
52 UnsteadyStateGridEvalType>;
54 UnsteadyStateGridEvalType eval(ds1, t1, field1, ds2, t2, field2);
55 StepperType stepper(eval, stepSize);
56 worklet.Run(stepper, seedArray, termination, analysis);
60 const FieldType& field1,
63 const FieldType& field2,
66 const TerminationType& termination,
69 AnalysisType& analysis)
73 DoAdvect<vtkm::worklet::flow::RK4Integrator>(
74 seedArray, field1, ds1, t1, field2, ds2, t2, termination, stepSize, analysis);
78 DoAdvect<vtkm::worklet::flow::EulerIntegrator>(
79 seedArray, field1, ds1, t1, field2, ds2, t2, termination, stepSize, analysis);
87 template <
typename ParticleType,
89 typename TerminationType,
90 typename AnalysisType>
91 class DataSetIntegratorUnsteadyState
92 :
public vtkm::filter::flow::internal::DataSetIntegrator<
93 DataSetIntegratorUnsteadyState<ParticleType, FieldType, TerminationType, AnalysisType>,
97 using BaseType = vtkm::filter::flow::internal::DataSetIntegrator<
98 DataSetIntegratorUnsteadyState<ParticleType, FieldType, TerminationType, AnalysisType>,
100 using PType = ParticleType;
101 using FType = FieldType;
102 using TType = TerminationType;
103 using AType = AnalysisType;
105 DataSetIntegratorUnsteadyState(
vtkm::Id id,
106 const FieldType& field1,
107 const FieldType& field2,
113 const TerminationType& termination,
114 const AnalysisType& analysis)
115 : BaseType(id, solverType)
122 , Termination(termination)
127 VTKM_CONT inline void DoAdvect(vtkm::filter::flow::internal::DSIHelperInfo<ParticleType>& block,
133 using AdvectionHelper =
134 detail::AdvectHelperUnsteadyState<ParticleType, FieldType, TerminationType, AnalysisType>;
135 AnalysisType analysis;
136 analysis.UseAsTemplate(this->Analysis);
138 AdvectionHelper::Advect(seedArray,
149 this->UpdateResult(analysis, block);
152 VTKM_CONT void UpdateResult(AnalysisType& analysis,
153 vtkm::filter::flow::internal::DSIHelperInfo<ParticleType>& dsiInfo)
155 this->ClassifyParticles(analysis.Particles, dsiInfo);
156 if (std::is_same<AnalysisType, vtkm::worklet::flow::NoAnalysis<ParticleType>>::value)
158 if (dsiInfo.TermIdx.empty())
164 analysis.FinalizeAnalysis(termParticles);
165 this->Analyses.emplace_back(analysis);
169 this->Analyses.emplace_back(analysis);
175 std::size_t nAnalyses = this->Analyses.size();
178 return AnalysisType::MakeDataSet(ds, this->Analyses);
188 TerminationType Termination;
189 AnalysisType Analysis;
190 std::vector<AnalysisType> Analyses;
198 #endif //vtk_m_filter_flow_internal_DataSetIntegratorUnsteadyState_h