19 #ifndef viskores_filter_flow_internal_DataSetIntegratorSteadyState_h
20 #define viskores_filter_flow_internal_DataSetIntegratorSteadyState_h
35 template <
typename ParticleType,
37 typename TerminationType,
38 typename AnalysisType>
39 class AdvectHelperSteadyState
42 using WorkletType = viskores::worklet::flow::ParticleAdvection;
43 using SteadyStateGridEvalType = viskores::worklet::flow::GridEvaluator<FieldType>;
45 template <
template <
typename>
class SolverType>
47 const FieldType& field,
49 const TerminationType& termination,
51 AnalysisType& analysis)
53 using StepperType = viskores::worklet::flow::Stepper<SolverType<SteadyStateGridEvalType>,
54 SteadyStateGridEvalType>;
55 SteadyStateGridEvalType eval(dataset, field);
56 StepperType stepper(eval, stepSize);
59 worklet.Run(stepper, seedArray, termination, analysis);
63 const FieldType& field,
65 const TerminationType& termination,
68 AnalysisType& analysis)
72 DoAdvect<viskores::worklet::flow::RK4Integrator>(
73 seedArray, field, dataset, termination, stepSize, analysis);
77 DoAdvect<viskores::worklet::flow::EulerIntegrator>(
78 seedArray, field, dataset, termination, stepSize, analysis);
86 template <
typename ParticleType,
88 typename TerminationType,
89 typename AnalysisType>
90 class DataSetIntegratorSteadyState
91 :
public viskores::filter::flow::internal::DataSetIntegrator<
92 DataSetIntegratorSteadyState<ParticleType, FieldType, TerminationType, AnalysisType>,
96 using BaseType = viskores::filter::flow::internal::DataSetIntegrator<
97 DataSetIntegratorSteadyState<ParticleType, FieldType, TerminationType, AnalysisType>,
99 using PType = ParticleType;
100 using FType = FieldType;
101 using TType = TerminationType;
102 using AType = AnalysisType;
105 const FieldType& field,
108 const TerminationType& termination,
109 const AnalysisType& analysis)
110 : BaseType(id, solverType)
113 , Termination(termination)
119 viskores::filter::flow::internal::DSIHelperInfo<ParticleType>& block,
125 using AdvectionHelper =
126 detail::AdvectHelperSteadyState<ParticleType, FieldType, TerminationType, AnalysisType>;
127 AnalysisType analysis;
128 analysis.UseAsTemplate(this->Analysis);
130 AdvectionHelper::Advect(seedArray,
138 this->UpdateResult(analysis, block);
142 AnalysisType& analysis,
143 viskores::filter::flow::internal::DSIHelperInfo<ParticleType>& dsiInfo)
145 this->ClassifyParticles(analysis.Particles, dsiInfo);
146 if (std::is_same<AnalysisType, viskores::worklet::flow::NoAnalysis<ParticleType>>::value)
148 if (dsiInfo.TermIdx.empty())
154 analysis.FinalizeAnalysis(termParticles);
155 this->Analyses.emplace_back(analysis);
159 this->Analyses.emplace_back(analysis);
165 std::size_t nAnalyses = this->Analyses.size();
168 return AnalysisType::MakeDataSet(ds, this->Analyses);
174 TerminationType Termination;
176 AnalysisType Analysis;
177 std::vector<AnalysisType> Analyses;
185 #endif //viskores_filter_flow_internal_DataSetIntegratorSteadyState_h