@@ -122,39 +122,23 @@ namespace Step64
122122 class HelmholtzOperatorQuad
123123 {
124124 public:
125- DEAL_II_HOST_DEVICE HelmholtzOperatorQuad (
126- const typename Portable::MatrixFree<dim, double >::Data *gpu_data,
127- double *coef,
128- int cell)
129- : gpu_data(gpu_data)
130- , coef(coef)
131- , cell(cell)
125+ DEAL_II_HOST_DEVICE HelmholtzOperatorQuad (double *coef)
126+ : coef(coef)
132127 {}
133128
134129 DEAL_II_HOST_DEVICE void operator ()(
135130 Portable::FEEvaluation<dim, fe_degree, fe_degree + 1 , 1 , double > *fe_eval,
136131 const int q_point) const ;
137132
138- DEAL_II_HOST_DEVICE void set_matrix_free_data (
139- const typename Portable::MatrixFree<dim, double >::Data &data)
140- {
141- gpu_data = &data;
142- }
143133
144- DEAL_II_HOST_DEVICE void set_cell (int new_cell)
145- {
146- cell = new_cell;
147- }
148134
149135 static const unsigned int n_q_points =
150136 dealii::Utilities::pow (fe_degree + 1 , dim);
151137
152138 static const unsigned int n_local_dofs = n_q_points;
153139
154140 private:
155- const typename Portable::MatrixFree<dim, double >::Data *gpu_data;
156- double *coef;
157- int cell;
141+ double *coef;
158142 };
159143
160144
@@ -170,10 +154,17 @@ namespace Step64
170154 Portable::FEEvaluation<dim, fe_degree, fe_degree + 1 , 1 , double > *fe_eval,
171155 const int q_point) const
172156 {
173- const unsigned int pos =
174- gpu_data->local_q_point_id (cell, n_q_points, q_point);
157+ const int cell_index = fe_eval->get_current_cell_index ();
158+ const typename Portable::MatrixFree<dim, double >::Data *gpu_data =
159+ fe_eval->get_matrix_free_data ();
175160
176- fe_eval->submit_value (coef[pos] * fe_eval->get_value (q_point), q_point);
161+ const unsigned int position =
162+ gpu_data->local_q_point_id (cell_index, n_q_points, q_point);
163+ auto coeff = coef[position];
164+
165+ auto value = fe_eval->get_value (q_point);
166+
167+ fe_eval->submit_value (coeff * value, q_point);
177168 fe_eval->submit_gradient (fe_eval->get_gradient (q_point), q_point);
178169 }
179170
@@ -218,7 +209,7 @@ namespace Step64
218209 // vector.
219210 template <int dim, int fe_degree>
220211 DEAL_II_HOST_DEVICE void LocalHelmholtzOperator<dim, fe_degree>::operator ()(
221- const unsigned int cell,
212+ const unsigned int /* cell*/ ,
222213 const typename Portable::MatrixFree<dim, double >::Data *gpu_data,
223214 Portable::SharedData<dim, double > *shared_data,
224215 const double *src,
@@ -229,7 +220,7 @@ namespace Step64
229220 fe_eval.read_dof_values (src);
230221 fe_eval.evaluate (EvaluationFlags::values | EvaluationFlags::gradients);
231222 fe_eval.apply_for_each_quad_point (
232- HelmholtzOperatorQuad<dim, fe_degree>(gpu_data, coef, cell ));
223+ HelmholtzOperatorQuad<dim, fe_degree>(coef));
233224 fe_eval.integrate (EvaluationFlags::values | EvaluationFlags::gradients);
234225 fe_eval.distribute_local_to_global (dst);
235226 }
@@ -363,7 +354,7 @@ namespace Step64
363354 initialize_dof_vector (inverse_diagonal);
364355
365356 HelmholtzOperatorQuad<dim, fe_degree> helmholtz_operator_quad (
366- nullptr , coef.get_values (), - 1 );
357+ coef.get_values ());
367358
368359 MatrixFreeTools::compute_diagonal<dim, fe_degree, fe_degree + 1 , 1 , double >(
369360 mf_data,
0 commit comments