@@ -48,32 +48,8 @@ namespace aspect
4848 ExcMessage (" Internal error: the particle property interpolator was "
4949 " called without a specified component to interpolate." ));
5050
51- const Point<dim> approximated_cell_midpoint = std::accumulate (positions.begin (), positions.end (), Point<dim>())
52- / static_cast <double > (positions.size ());
53-
54- typename parallel::distributed::Triangulation<dim>::active_cell_iterator found_cell;
55-
56- if (cell == typename parallel::distributed::Triangulation<dim>::active_cell_iterator ())
57- {
58- // We can not simply use one of the points as input for find_active_cell_around_point
59- // because for vertices of mesh cells we might end up getting ghost_cells as return value
60- // instead of the local active cell. So make sure we are well in the inside of a cell.
61- Assert (positions.size () > 0 ,
62- ExcMessage (" The particle property interpolator was not given any "
63- " positions to evaluate the particle cell_properties at." ));
64-
65-
66- found_cell =
67- (GridTools::find_active_cell_around_point<> (this ->get_mapping (),
68- this ->get_triangulation (),
69- approximated_cell_midpoint)).first ;
70- }
71- else
72- found_cell = cell;
73-
7451 const typename ParticleHandler<dim>::particle_iterator_range particle_range =
75- particle_handler.particles_in_cell (found_cell);
76-
52+ particle_handler.particles_in_cell (cell);
7753
7854 std::vector<std::vector<double >> cell_properties (positions.size (),
7955 std::vector<double >(n_particle_properties,
@@ -88,7 +64,7 @@ namespace aspect
8864 return fallback_interpolator.properties_at_points (particle_handler,
8965 positions,
9066 selected_properties,
91- found_cell );
67+ cell );
9268
9369 // Noticed that the size of matrix A is n_particles x n_matrix_columns
9470 // which usually is not a square matrix. Therefore, we find the
@@ -138,7 +114,7 @@ namespace aspect
138114 if (use_linear_least_squares_limiter.n_selected_components () != 0 )
139115 {
140116 std::vector<typename parallel::distributed::Triangulation<dim>::active_cell_iterator> active_neighbors;
141- GridTools::get_active_neighbors<parallel::distributed::Triangulation<dim>>(found_cell , active_neighbors);
117+ GridTools::get_active_neighbors<parallel::distributed::Triangulation<dim>>(cell , active_neighbors);
142118 for (const auto &active_neighbor : active_neighbors)
143119 {
144120 if (active_neighbor->is_artificial ())
@@ -153,23 +129,23 @@ namespace aspect
153129 }
154130 }
155131 }
156- if (found_cell ->at_boundary ())
132+ if (cell ->at_boundary ())
157133 {
158- const std::vector<double > cell_average_values = fallback_interpolator.properties_at_points (particle_handler, {positions[0 ]}, selected_properties, found_cell )[0 ];
159- for (unsigned int face_id = 0 ; face_id < found_cell ->reference_cell ().n_faces (); ++face_id)
134+ const std::vector<double > cell_average_values = fallback_interpolator.properties_at_points (particle_handler, {positions[0 ]}, selected_properties, cell )[0 ];
135+ for (unsigned int face_id = 0 ; face_id < cell ->reference_cell ().n_faces (); ++face_id)
160136 {
161- if (found_cell ->at_boundary (face_id))
137+ if (cell ->at_boundary (face_id))
162138 {
163139 const unsigned int opposing_face_id = GeometryInfo<dim>::opposite_face[face_id];
164- const auto &opposing_cell = found_cell ->neighbor (opposing_face_id);
140+ const auto &opposing_cell = cell ->neighbor (opposing_face_id);
165141 if (opposing_cell.state () == IteratorState::IteratorStates::valid && opposing_cell->is_active () && opposing_cell->is_artificial () == false )
166142 {
167143 const auto neighbor_cell_average = fallback_interpolator.properties_at_points (particle_handler, {positions[0 ]}, selected_properties, opposing_cell)[0 ];
168144 for (unsigned int property_index = 0 ; property_index < n_particle_properties; ++property_index)
169145 {
170146 if (selected_properties[property_index] == true && use_boundary_extrapolation[property_index] == true )
171147 {
172- Assert (found_cell ->reference_cell ().is_hyper_cube () == true , ExcNotImplemented ());
148+ Assert (cell ->reference_cell ().is_hyper_cube () == true , ExcNotImplemented ());
173149 const double expected_boundary_value = 1.5 * cell_average_values[property_index] - 0.5 * neighbor_cell_average[property_index];
174150 property_minimums[property_index] = std::min (property_minimums[property_index], expected_boundary_value);
175151 property_maximums[property_index] = std::max (property_maximums[property_index], expected_boundary_value);
@@ -192,7 +168,7 @@ namespace aspect
192168 return fallback_interpolator.properties_at_points (particle_handler,
193169 positions,
194170 selected_properties,
195- found_cell );
171+ cell );
196172
197173 std::vector<Vector<double >> QTb (n_particle_properties, Vector<double >(n_matrix_columns));
198174 std::vector<Vector<double >> c (n_particle_properties, Vector<double >(n_matrix_columns));
@@ -233,7 +209,7 @@ namespace aspect
233209 std::size_t positions_index = 0 ;
234210 for (typename std::vector<Point<dim>>::const_iterator itr = positions.begin (); itr != positions.end (); ++itr, ++positions_index)
235211 {
236- Point<dim> relative_support_point_location = this ->get_mapping ().transform_real_to_unit_cell (found_cell , *itr);
212+ Point<dim> relative_support_point_location = this ->get_mapping ().transform_real_to_unit_cell (cell , *itr);
237213 double interpolated_value = c[property_index][0 ];
238214 for (unsigned int i = 1 ; i < n_matrix_columns; ++i)
239215 {
0 commit comments