11 #ifndef vtk_m_filter_flow_internal_DataSetIntegratorSteadyState_h
12 #define vtk_m_filter_flow_internal_DataSetIntegratorSteadyState_h
27 template <
typename ParticleType,
29 typename TerminationType,
30 typename AnalysisType>
31 class AdvectHelperSteadyState
34 using WorkletType = vtkm::worklet::flow::ParticleAdvection;
35 using SteadyStateGridEvalType = vtkm::worklet::flow::GridEvaluator<FieldType>;
37 template <
template <
typename>
class SolverType>
39 const FieldType& field,
41 const TerminationType& termination,
43 AnalysisType& analysis)
46 vtkm::worklet::flow::Stepper<SolverType<SteadyStateGridEvalType>, SteadyStateGridEvalType>;
47 SteadyStateGridEvalType eval(dataset, field);
48 StepperType stepper(eval, stepSize);
51 worklet.Run(stepper, seedArray, termination, analysis);
55 const FieldType& field,
57 const TerminationType& termination,
60 AnalysisType& analysis)
64 DoAdvect<vtkm::worklet::flow::RK4Integrator>(
65 seedArray, field, dataset, termination, stepSize, analysis);
69 DoAdvect<vtkm::worklet::flow::EulerIntegrator>(
70 seedArray, field, dataset, termination, stepSize, analysis);
78 template <
typename ParticleType,
80 typename TerminationType,
81 typename AnalysisType>
82 class DataSetIntegratorSteadyState
83 :
public vtkm::filter::flow::internal::DataSetIntegrator<
84 DataSetIntegratorSteadyState<ParticleType, FieldType, TerminationType, AnalysisType>,
88 using BaseType = vtkm::filter::flow::internal::DataSetIntegrator<
89 DataSetIntegratorSteadyState<ParticleType, FieldType, TerminationType, AnalysisType>,
91 using PType = ParticleType;
92 using FType = FieldType;
93 using TType = TerminationType;
94 using AType = AnalysisType;
96 DataSetIntegratorSteadyState(
vtkm::Id id,
97 const FieldType& field,
100 const TerminationType& termination,
101 const AnalysisType& analysis)
102 : BaseType(id, solverType)
105 , Termination(termination)
110 VTKM_CONT inline void DoAdvect(vtkm::filter::flow::internal::DSIHelperInfo<ParticleType>& block,
116 using AdvectionHelper =
117 detail::AdvectHelperSteadyState<ParticleType, FieldType, TerminationType, AnalysisType>;
118 AnalysisType analysis;
119 analysis.UseAsTemplate(this->Analysis);
121 AdvectionHelper::Advect(seedArray,
129 this->UpdateResult(analysis, block);
132 VTKM_CONT void UpdateResult(AnalysisType& analysis,
133 vtkm::filter::flow::internal::DSIHelperInfo<ParticleType>& dsiInfo)
135 this->ClassifyParticles(analysis.Particles, dsiInfo);
136 if (std::is_same<AnalysisType, vtkm::worklet::flow::NoAnalysis<ParticleType>>::value)
138 if (dsiInfo.TermIdx.empty())
144 analysis.FinalizeAnalysis(termParticles);
145 this->Analyses.emplace_back(analysis);
149 this->Analyses.emplace_back(analysis);
155 std::size_t nAnalyses = this->Analyses.size();
158 return AnalysisType::MakeDataSet(ds, this->Analyses);
164 TerminationType Termination;
166 AnalysisType Analysis;
167 std::vector<AnalysisType> Analyses;
175 #endif //vtk_m_filter_flow_internal_DataSetIntegratorSteadyState_h