19 #ifndef viskores_filter_flow_internal_DataSetIntegratorUnsteadyState_h
20 #define viskores_filter_flow_internal_DataSetIntegratorUnsteadyState_h
24 #include <viskores/filter/flow/worklet/TemporalGridEvaluators.h>
36 template <
typename ParticleType,
38 typename TerminationType,
39 typename AnalysisType>
40 class AdvectHelperUnsteadyState
43 using WorkletType = viskores::worklet::flow::ParticleAdvection;
44 using UnsteadyStateGridEvalType = viskores::worklet::flow::TemporalGridEvaluator<FieldType>;
46 template <
template <
typename>
class SolverType>
48 const FieldType& field1,
51 const FieldType& field2,
54 const TerminationType& termination,
56 AnalysisType& analysis)
59 using StepperType = viskores::worklet::flow::Stepper<SolverType<UnsteadyStateGridEvalType>,
60 UnsteadyStateGridEvalType>;
62 UnsteadyStateGridEvalType eval(ds1, t1, field1, ds2, t2, field2);
63 StepperType stepper(eval, stepSize);
64 worklet.Run(stepper, seedArray, termination, analysis);
68 const FieldType& field1,
71 const FieldType& field2,
74 const TerminationType& termination,
77 AnalysisType& analysis)
81 DoAdvect<viskores::worklet::flow::RK4Integrator>(
82 seedArray, field1, ds1, t1, field2, ds2, t2, termination, stepSize, analysis);
86 DoAdvect<viskores::worklet::flow::EulerIntegrator>(
87 seedArray, field1, ds1, t1, field2, ds2, t2, termination, stepSize, analysis);
95 template <
typename ParticleType,
97 typename TerminationType,
98 typename AnalysisType>
99 class DataSetIntegratorUnsteadyState
100 :
public viskores::filter::flow::internal::DataSetIntegrator<
101 DataSetIntegratorUnsteadyState<ParticleType, FieldType, TerminationType, AnalysisType>,
105 using BaseType = viskores::filter::flow::internal::DataSetIntegrator<
106 DataSetIntegratorUnsteadyState<ParticleType, FieldType, TerminationType, AnalysisType>,
108 using PType = ParticleType;
109 using FType = FieldType;
110 using TType = TerminationType;
111 using AType = AnalysisType;
114 const FieldType& field1,
115 const FieldType& field2,
121 const TerminationType& termination,
122 const AnalysisType& analysis)
123 : BaseType(id, solverType)
130 , Termination(termination)
136 viskores::filter::flow::internal::DSIHelperInfo<ParticleType>& block,
142 using AdvectionHelper =
143 detail::AdvectHelperUnsteadyState<ParticleType, FieldType, TerminationType, AnalysisType>;
144 AnalysisType analysis;
145 analysis.UseAsTemplate(this->Analysis);
147 AdvectionHelper::Advect(seedArray,
158 this->UpdateResult(analysis, block);
162 AnalysisType& analysis,
163 viskores::filter::flow::internal::DSIHelperInfo<ParticleType>& dsiInfo)
165 this->ClassifyParticles(analysis.Particles, dsiInfo);
166 if (std::is_same<AnalysisType, viskores::worklet::flow::NoAnalysis<ParticleType>>::value)
168 if (dsiInfo.TermIdx.empty())
174 analysis.FinalizeAnalysis(termParticles);
175 this->Analyses.emplace_back(analysis);
179 this->Analyses.emplace_back(analysis);
185 std::size_t nAnalyses = this->Analyses.size();
188 return AnalysisType::MakeDataSet(ds, this->Analyses);
198 TerminationType Termination;
199 AnalysisType Analysis;
200 std::vector<AnalysisType> Analyses;
208 #endif //viskores_filter_flow_internal_DataSetIntegratorUnsteadyState_h