34 template <
int dim,
int spacedim>
36 pack_particles(std::vector<ParticleIterator<dim, spacedim>> &particles)
38 std::vector<char> buffer;
40 if (particles.empty())
43 buffer.resize(particles.size() *
44 particles.front()->serialized_size_in_bytes());
45 void *current_data = buffer.data();
47 for (
const auto &particle : particles)
49 current_data = particle->write_particle_data_to_memory(current_data);
58 template <
int dim,
int spacedim>
63 , global_number_of_particles(0)
64 , number_of_locally_owned_particles(0)
65 , global_max_particles_per_cell(0)
66 , next_free_particle_index(0)
70 , tria_attached_data_index(
numbers::invalid_unsigned_int)
78 template <
int dim,
int spacedim>
82 const unsigned int n_properties)
84 , mapping(&mapping, typeid(*this).name())
85 , property_pool(
std::make_unique<
PropertyPool<dim, spacedim>>(n_properties))
86 , cells_to_particle_cache(
triangulation.n_active_cells(), particles.end())
87 , global_number_of_particles(0)
88 , number_of_locally_owned_particles(0)
89 , global_max_particles_per_cell(0)
90 , next_free_particle_index(0)
94 , tria_attached_data_index(
numbers::invalid_unsigned_int)
95 , triangulation_cache(
106 template <
int dim,
int spacedim>
111 for (
const auto &connection : tria_listeners)
112 connection.disconnect();
117 template <
int dim,
int spacedim>
122 const unsigned int n_properties)
127 mapping = &new_mapping;
129 reset_particle_container(particles);
132 property_pool = std::make_unique<PropertyPool<dim, spacedim>>(n_properties);
136 triangulation_cache =
137 std::make_unique<GridTools::Cache<dim, spacedim>>(new_triangulation,
140 cells_to_particle_cache.resize(
triangulation->n_active_cells(),
143 connect_to_triangulation_signals();
148 template <
int dim,
int spacedim>
153 const unsigned int n_properties =
159 property_pool = std::make_unique<PropertyPool<dim, spacedim>>(
164 number_of_locally_owned_particles =
167 global_max_particles_per_cell =
173 particles.insert(particle_container_owned_end(),
176 particles.insert(particle_container_ghost_end(),
180 for (
auto it = particles.begin(); it != particles.end(); ++it)
181 if (!it->particles.empty())
182 cells_to_particle_cache[it->cell->active_cell_index()] = it;
184 ghost_particles_cache.ghost_particles_by_domain =
191 template <
int dim,
int spacedim>
196 global_number_of_particles = 0;
197 number_of_locally_owned_particles = 0;
198 next_free_particle_index = 0;
199 global_max_particles_per_cell = 0;
204 template <
int dim,
int spacedim>
208 for (
auto &particles_in_cell : particles)
209 for (
auto &particle : particles_in_cell.particles)
211 property_pool->deregister_particle(particle);
213 cells_to_particle_cache.clear();
214 reset_particle_container(particles);
216 cells_to_particle_cache.resize(
triangulation->n_active_cells(),
221 property_pool->clear();
226 template <
int dim,
int spacedim>
230 property_pool->reserve(n_particles);
235 template <
int dim,
int spacedim>
243 past_the_end_iterator =
248 given_particles.clear();
249 for (
unsigned int i = 0; i < 3; ++i)
250 given_particles.emplace_back(
252 past_the_end_iterator);
255 const_cast<typename particle_container::iterator &
>(owned_particles_end) =
256 ++given_particles.begin();
261 template <
int dim,
int spacedim>
266 bool sort_is_necessary =
false;
268 auto previous = particle_container_owned_begin();
269 for (
auto next = previous; next != particle_container_owned_end(); ++next)
273 previous->cell > next->cell)
275 sort_is_necessary =
true;
281 if (sort_is_necessary)
296 reset_particle_container(sorted_particles);
299 for (
const auto &cell :
triangulation->active_cell_iterators())
300 if (!cell->is_artificial())
301 if (cells_to_particle_cache[cell->active_cell_index()] !=
308 typename particle_container::iterator insert_position =
309 cell->is_locally_owned() ? particle_container_owned_end() :
310 --sorted_particles.end();
311 typename particle_container::iterator new_entry =
312 sorted_particles.insert(
313 insert_position,
typename particle_container::value_type());
314 new_entry->cell = cell;
315 new_entry->particles =
316 std::move(cells_to_particle_cache[cell->active_cell_index()]
319 particles = std::move(sorted_particles);
322 cells_to_particle_cache.clear();
323 cells_to_particle_cache.resize(
triangulation->n_active_cells(),
325 for (
auto it = particles.begin(); it != particles.end(); ++it)
326 if (!it->particles.empty())
327 cells_to_particle_cache[it->cell->active_cell_index()] = it;
333 particles.front().particles.empty() &&
335 particles.back().particles.empty() &&
337 owned_particles_end->particles.empty(),
344 for (
const auto &it : cells_to_particle_cache)
345 Assert(it != particles.begin() && it != owned_particles_end &&
346 it != --(particles.end()),
351 for (
auto it = particle_container_owned_begin();
352 it != particle_container_owned_end();
357 std::vector<typename particle_container::iterator> verify_cache(
359 for (
auto it = particles.begin(); it != particles.end(); ++it)
360 if (!it->particles.empty())
361 verify_cache[it->cell->active_cell_index()] = it;
363 for (
unsigned int i = 0; i < verify_cache.size(); ++i)
364 Assert(verify_cache[i] == cells_to_particle_cache[i],
370 number_of_locally_owned_particles = 0;
373 for (
const auto &particles_in_cell : particles)
376 particles_in_cell.particles.size();
379 result[0] =
std::max(result[0], n_particles_in_cell);
382 if (n_particles_in_cell > 0 &&
383 particles_in_cell.cell->is_locally_owned())
384 number_of_locally_owned_particles += n_particles_in_cell;
387 for (
const auto &particle : particles_in_cell.particles)
388 result[1] =
std::max(result[1], property_pool->get_id(particle));
391 global_number_of_particles =
395 if (global_number_of_particles == 0)
397 next_free_particle_index = 0;
398 global_max_particles_per_cell = 0;
406 next_free_particle_index = result[1] + 1;
407 global_max_particles_per_cell = result[0];
413 template <
int dim,
int spacedim>
419 if (cells_to_particle_cache.empty())
422 if (cell->is_artificial() ==
false)
424 return cells_to_particle_cache[cell->active_cell_index()] !=
426 cells_to_particle_cache[cell->active_cell_index()]
432 ExcMessage(
"You can't ask for the particles on an artificial "
433 "cell since we don't know what exists on these "
441 template <
int dim,
int spacedim>
448 ->particles_in_cell(cell);
453 template <
int dim,
int spacedim>
458 const unsigned int active_cell_index = cell->active_cell_index();
460 if (cell->is_artificial() ==
false)
462 if (cells_to_particle_cache[active_cell_index] == particles.end())
464 return boost::make_iterator_range(
470 const typename particle_container::iterator
471 particles_in_current_cell =
472 cells_to_particle_cache[active_cell_index];
473 typename particle_container::iterator particles_in_next_cell =
474 particles_in_current_cell;
475 ++particles_in_next_cell;
476 return boost::make_iterator_range(
483 ExcMessage(
"You can't ask for the particles on an artificial "
484 "cell since we don't know what exists on these "
492 template <
int dim,
int spacedim>
497 auto &particles_on_cell = particle->particles_in_cell->particles;
502 auto handle = particle->get_handle();
504 property_pool->deregister_particle(handle);
509 const auto cell = particle->get_surrounding_cell();
510 const bool owned_cell = cell->is_locally_owned();
512 --number_of_locally_owned_particles;
514 if (particles_on_cell.size() > 1)
516 particles_on_cell[particle->particle_index_within_cell] =
517 std::move(particles_on_cell.back());
518 particles_on_cell.resize(particles_on_cell.size() - 1);
522 particles.erase(particle->particles_in_cell);
523 cells_to_particle_cache[cell->active_cell_index()] = particles.end();
529 template <
int dim,
int spacedim>
533 &particles_to_remove)
541 return a->particles_in_cell->cell > b->particles_in_cell->cell ||
542 (a->particles_in_cell->cell == b->particles_in_cell->cell &&
543 a->particle_index_within_cell > b->particle_index_within_cell);
546 bool particles_are_sorted =
true;
547 auto previous = particles_to_remove.begin();
548 for (
auto next = previous; next != particles_to_remove.end(); ++next)
550 if (check_greater(*previous, *next))
552 particles_are_sorted =
false;
557 if (particles_are_sorted)
560 for (
auto it = particles_to_remove.rbegin();
561 it != particles_to_remove.rend();
563 remove_particle(*it);
567 std::vector<ParticleHandler<dim, spacedim>::particle_iterator>
568 sorted_particles(particles_to_remove);
569 std::sort(sorted_particles.begin(),
570 sorted_particles.end(),
573 for (
const auto &particle : sorted_particles)
574 remove_particle(particle);
577 update_cached_numbers();
582 template <
int dim,
int spacedim>
597 template <
int dim,
int spacedim>
603 const unsigned int active_cell_index = cell->active_cell_index();
604 typename particle_container::iterator &cache =
605 cells_to_particle_cache[active_cell_index];
606 if (cache == particles.end())
608 const typename particle_container::iterator insert_position =
609 cell->is_locally_owned() ? particle_container_owned_end() :
610 particle_container_ghost_end();
611 cache = particles.emplace(
618 cache->particles.push_back(handle);
623 cache->particles.size() - 1);
628 template <
int dim,
int spacedim>
637 Assert(cell->is_locally_owned(),
638 ExcMessage(
"You tried to insert particles into a cell that is not "
639 "locally owned. This is not supported."));
642 insert_particle(property_pool->register_particle(), cell);
644 data = particle_it->read_particle_data_from_memory(
data);
646 ++number_of_locally_owned_particles;
653 template <
int dim,
int spacedim>
666 Assert(cell->is_locally_owned(),
667 ExcMessage(
"You tried to insert particles into a cell that is not "
668 "locally owned. This is not supported."));
671 insert_particle(property_pool->register_particle(), cell);
673 particle_it->set_location(position);
674 particle_it->set_reference_location(reference_position);
675 particle_it->set_id(particle_index);
677 if (properties.
size() != 0)
678 particle_it->set_properties(properties);
680 ++number_of_locally_owned_particles;
687 template <
int dim,
int spacedim>
694 reserve(n_locally_owned_particles() + new_particles.size());
695 for (
const auto &cell_and_particle : new_particles)
696 insert_particle(cell_and_particle.second, cell_and_particle.first);
698 update_cached_numbers();
703 template <
int dim,
int spacedim>
710 update_cached_numbers();
711 reserve(n_locally_owned_particles() + positions.size());
718 get_next_free_particle_index();
721#ifdef DEAL_II_WITH_MPI
722 if (
const auto parallel_triangulation =
728 MPI_Scan(&particles_to_add_locally,
731 Utilities::MPI::mpi_type_id_for_type<types::particle_index>,
733 parallel_triangulation->get_mpi_communicator());
735 local_start_index -= particles_to_add_locally;
739 local_start_index += local_next_particle_index;
741 auto point_locations =
745 auto &cells = std::get<0>(point_locations);
746 auto &local_positions = std::get<1>(point_locations);
747 auto &index_map = std::get<2>(point_locations);
748 auto &missing_points = std::get<3>(point_locations);
754 (void)missing_points;
756 for (
unsigned int i = 0; i < cells.size(); ++i)
757 for (
unsigned int p = 0; p < local_positions[i].size(); ++p)
758 insert_particle(positions[index_map[i][p]],
759 local_positions[i][p],
760 local_start_index + index_map[i][p],
763 update_cached_numbers();
768 template <
int dim,
int spacedim>
769 std::map<unsigned int, IndexSet>
773 &global_bounding_boxes,
774 const std::vector<std::vector<double>> &properties,
775 const std::vector<types::particle_index> &ids)
777 if (!properties.empty())
782 for (
const auto &p : properties)
795 const auto n_global_properties =
799 const auto n_particles_per_proc =
803 std::vector<unsigned int> particle_start_indices(n_mpi_processes);
805 unsigned int particle_start_index = get_next_free_particle_index();
806 for (
unsigned int process = 0; process < particle_start_indices.size();
809 particle_start_indices[process] = particle_start_index;
810 particle_start_index += n_particles_per_proc[process];
814 const auto cells_positions_and_index_maps =
817 global_bounding_boxes);
821 const auto &local_cells_containing_particles =
822 std::get<0>(cells_positions_and_index_maps);
826 const auto &local_reference_positions =
827 std::get<1>(cells_positions_and_index_maps);
830 const auto &original_indices_of_local_particles =
831 std::get<2>(cells_positions_and_index_maps);
834 const auto &local_positions = std::get<3>(cells_positions_and_index_maps);
836 const auto &calling_process_indices =
837 std::get<4>(cells_positions_and_index_maps);
840 std::map<unsigned int, std::vector<unsigned int>>
841 original_process_to_local_particle_indices_tmp;
842 for (
unsigned int i_cell = 0;
843 i_cell < local_cells_containing_particles.size();
846 for (
unsigned int i_particle = 0;
847 i_particle < local_positions[i_cell].size();
850 const unsigned int local_id_on_calling_process =
851 original_indices_of_local_particles[i_cell][i_particle];
852 const unsigned int calling_process =
853 calling_process_indices[i_cell][i_particle];
855 original_process_to_local_particle_indices_tmp[calling_process]
856 .push_back(local_id_on_calling_process);
859 std::map<unsigned int, IndexSet> original_process_to_local_particle_indices;
860 for (
auto &process_and_particle_indices :
861 original_process_to_local_particle_indices_tmp)
863 const unsigned int calling_process = process_and_particle_indices.first;
864 original_process_to_local_particle_indices.insert(
865 {calling_process,
IndexSet(n_particles_per_proc[calling_process])});
866 std::sort(process_and_particle_indices.second.begin(),
867 process_and_particle_indices.second.end());
868 original_process_to_local_particle_indices[calling_process].add_indices(
869 process_and_particle_indices.second.begin(),
870 process_and_particle_indices.second.end());
871 original_process_to_local_particle_indices[calling_process].compress();
879 std::map<unsigned int, std::vector<std::vector<double>>>
880 locally_owned_properties_from_other_processes;
887 std::map<unsigned int, std::vector<types::particle_index>>
888 locally_owned_ids_from_other_processes;
890 if (n_global_properties > 0 || !ids.empty())
895 comm, original_process_to_local_particle_indices);
898 if (n_global_properties > 0)
900 std::map<unsigned int, std::vector<std::vector<double>>>
901 non_locally_owned_properties;
903 for (
const auto &it : send_to_cpu)
905 std::vector<std::vector<double>> properties_to_send(
906 it.second.n_elements(),
907 std::vector<double>(n_properties_per_particle()));
908 unsigned int index = 0;
909 for (
const auto el : it.second)
910 properties_to_send[index++] = properties[el];
911 non_locally_owned_properties.insert(
912 {it.first, properties_to_send});
917 locally_owned_properties_from_other_processes =
921 locally_owned_properties_from_other_processes.size(),
922 original_process_to_local_particle_indices.size());
927 std::map<unsigned int, std::vector<types::particle_index>>
928 non_locally_owned_ids;
929 for (
const auto &it : send_to_cpu)
931 std::vector<types::particle_index> ids_to_send(
932 it.second.n_elements());
933 unsigned int index = 0;
934 for (
const auto el : it.second)
935 ids_to_send[index++] = ids[el];
936 non_locally_owned_ids.insert({it.first, ids_to_send});
941 locally_owned_ids_from_other_processes =
945 original_process_to_local_particle_indices.size());
950 for (
unsigned int i_cell = 0;
951 i_cell < local_cells_containing_particles.size();
954 for (
unsigned int i_particle = 0;
955 i_particle < local_positions[i_cell].size();
958 const unsigned int local_id_on_calling_process =
959 original_indices_of_local_particles[i_cell][i_particle];
961 const unsigned int calling_process =
962 calling_process_indices[i_cell][i_particle];
964 const unsigned int index_within_set =
965 original_process_to_local_particle_indices[calling_process]
966 .index_within_set(local_id_on_calling_process);
968 const unsigned int particle_id =
970 local_id_on_calling_process +
971 particle_start_indices[calling_process] :
972 locally_owned_ids_from_other_processes[calling_process]
976 insert_particle(local_positions[i_cell][i_particle],
977 local_reference_positions[i_cell][i_particle],
979 local_cells_containing_particles[i_cell]);
981 if (n_global_properties > 0)
983 particle_it->set_properties(
984 locally_owned_properties_from_other_processes
985 [calling_process][index_within_set]);
990 update_cached_numbers();
992 return original_process_to_local_particle_indices;
997 template <
int dim,
int spacedim>
998 std::map<unsigned int, IndexSet>
1002 &global_bounding_boxes)
1006 std::vector<Point<spacedim>> positions;
1007 std::vector<std::vector<double>> properties;
1008 std::vector<types::particle_index> ids;
1009 positions.resize(particles.size());
1010 ids.resize(particles.size());
1011 if (n_properties_per_particle() > 0)
1012 properties.resize(particles.size(),
1013 std::vector<double>(n_properties_per_particle()));
1016 for (
const auto &p : particles)
1018 positions[i] = p.get_location();
1019 ids[i] = p.get_id();
1020 if (p.has_properties())
1021 properties[i] = {p.get_properties().begin(),
1022 p.get_properties().end()};
1026 return insert_global_particles(positions,
1027 global_bounding_boxes,
1034 template <
int dim,
int spacedim>
1038 return global_number_of_particles;
1043 template <
int dim,
int spacedim>
1047 return global_max_particles_per_cell;
1052 template <
int dim,
int spacedim>
1056 return number_of_locally_owned_particles;
1061 template <
int dim,
int spacedim>
1065 return property_pool->n_properties_per_slot();
1070 template <
int dim,
int spacedim>
1074 return next_free_particle_index;
1079 template <
int dim,
int spacedim>
1083 IndexSet set(get_next_free_particle_index());
1084 std::vector<types::particle_index> indices;
1085 indices.reserve(n_locally_owned_particles());
1086 for (
const auto &p : *
this)
1087 indices.push_back(p.get_id());
1095 template <
int dim,
int spacedim>
1099 return property_pool->n_slots();
1104 template <
int dim,
int spacedim>
1108 const bool add_to_output_vector)
1114 for (
auto it = begin(); it != end(); ++it, ++i)
1116 if (add_to_output_vector)
1117 positions[i] = positions[i] + it->get_location();
1119 positions[i] = it->get_location();
1125 template <
int dim,
int spacedim>
1129 const bool displace_particles)
1135 for (
auto it = begin(); it != end(); ++it, ++i)
1138 if (displace_particles)
1139 location += new_positions[i];
1141 location = new_positions[i];
1143 sort_particles_into_subdomains_and_cells();
1148 template <
int dim,
int spacedim>
1152 const bool displace_particles)
1159 for (
auto &particle : *
this)
1162 function.
vector_value(particle_location, new_position);
1163 if (displace_particles)
1164 for (
unsigned int d = 0; d < spacedim; ++d)
1165 particle_location[d] += new_position[d];
1167 for (
unsigned int d = 0; d < spacedim; ++d)
1168 particle_location[d] = new_position[d];
1170 sort_particles_into_subdomains_and_cells();
1175 template <
int dim,
int spacedim>
1179 return *property_pool;
1197 compare_particle_association(
1198 const unsigned int a,
1199 const unsigned int b,
1203 const double scalar_product_a = center_directions[a] * particle_direction;
1204 const double scalar_product_b = center_directions[b] * particle_direction;
1209 return (scalar_product_a > scalar_product_b);
1215 template <
int dim,
int spacedim>
1231 std::vector<particle_iterator> particles_out_of_cell;
1236 particles_out_of_cell.reserve(n_locally_owned_particles() / 4);
1239 std::vector<Point<spacedim>> real_locations;
1240 std::vector<Point<dim>> reference_locations;
1241 real_locations.reserve(global_max_particles_per_cell);
1242 reference_locations.reserve(global_max_particles_per_cell);
1244 for (
const auto &cell :
triangulation->active_cell_iterators())
1251 if (cell->is_locally_owned() ==
false)
1256 const unsigned int n_pic = n_particles_in_cell(cell);
1257 auto pic = particles_in_cell(cell);
1259 real_locations.clear();
1260 for (
const auto &particle : pic)
1261 real_locations.push_back(particle.get_location());
1263 reference_locations.resize(n_pic);
1264 mapping->transform_points_real_to_unit_cell(cell,
1266 reference_locations);
1268 auto particle = pic.begin();
1269 for (
const auto &p_unit : reference_locations)
1272 cell->reference_cell().contains_point(p_unit,
1273 tolerance_inside_cell))
1274 particle->set_reference_location(p_unit);
1276 particles_out_of_cell.push_back(particle);
1288 std::map<types::subdomain_id, std::vector<particle_iterator>>
1292 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>>
1300 using vector_size =
typename std::vector<particle_iterator>::size_type;
1302 std::set<types::subdomain_id> ghost_owners;
1303 if (
const auto parallel_triangulation =
1306 ghost_owners = parallel_triangulation->ghost_owners();
1311 for (
const auto &ghost_owner : ghost_owners)
1312 moved_particles[ghost_owner].reserve(particles_out_of_cell.size() / 4);
1313 for (
const auto &ghost_owner : ghost_owners)
1314 moved_cells[ghost_owner].reserve(particles_out_of_cell.size() / 4);
1319 std::set<typename Triangulation<dim, spacedim>::active_cell_iterator>>
1320 &vertex_to_cells = triangulation_cache->get_vertex_to_cell_map();
1324 const std::vector<std::vector<Tensor<1, spacedim>>>
1325 &vertex_to_cell_centers =
1326 triangulation_cache->get_vertex_to_cell_centers_directions();
1328 std::vector<unsigned int> search_order;
1336 for (
auto &out_particle : particles_out_of_cell)
1341 auto current_cell = out_particle->get_surrounding_cell();
1343 real_locations[0] = out_particle->get_location();
1346 bool found_cell =
false;
1350 const unsigned int closest_vertex =
1351 GridTools::find_closest_vertex_of_cell<dim, spacedim>(
1352 current_cell, out_particle->get_location(), *mapping);
1353 const unsigned int closest_vertex_index =
1354 current_cell->vertex_index(closest_vertex);
1356 const auto &candidate_cells = vertex_to_cells[closest_vertex_index];
1357 const unsigned int n_candidate_cells = candidate_cells.size();
1361 search_order.resize(n_candidate_cells);
1362 for (
unsigned int i = 0; i < n_candidate_cells; ++i)
1363 search_order[i] = i;
1369 out_particle->get_location() - current_cell->vertex(closest_vertex);
1374 1e4 * std::numeric_limits<double>::epsilon() *
1375 std::numeric_limits<double>::epsilon() *
1376 vertex_to_cell_centers[closest_vertex_index][0].norm_square())
1378 vertex_to_particle /= vertex_to_particle.
norm();
1379 const auto &vertex_to_cells =
1380 vertex_to_cell_centers[closest_vertex_index];
1382 std::sort(search_order.begin(),
1384 [&vertex_to_particle,
1385 &vertex_to_cells](
const unsigned int a,
1386 const unsigned int b) {
1387 return compare_particle_association(
1388 a, b, vertex_to_particle, vertex_to_cells);
1394 for (
unsigned int i = 0; i < n_candidate_cells; ++i)
1398 const_iterator candidate_cell = candidate_cells.begin();
1400 std::advance(candidate_cell, search_order[i]);
1401 mapping->transform_points_real_to_unit_cell(*candidate_cell,
1403 reference_locations);
1405 if ((*candidate_cell)
1407 .contains_point(reference_locations[0],
1408 tolerance_inside_cell))
1410 current_cell = *candidate_cell;
1426#if defined(DEAL_II_WITH_BOOST_BUNDLED) || \
1427 !(defined(__clang_major__) && __clang_major__ >= 16) || \
1428 BOOST_VERSION >= 108100
1430 std::vector<std::pair<Point<spacedim>,
unsigned int>>
1431 closest_vertex_in_domain;
1432 triangulation_cache->get_used_vertices_rtree().query(
1433 boost::geometry::index::nearest(out_particle->get_location(),
1435 std::back_inserter(closest_vertex_in_domain));
1439 const unsigned int closest_vertex_index_in_domain =
1440 closest_vertex_in_domain[0].second;
1442 const unsigned int closest_vertex_index_in_domain =
1445 out_particle->get_location());
1450 for (
const auto &cell :
1451 vertex_to_cells[closest_vertex_index_in_domain])
1453 mapping->transform_points_real_to_unit_cell(
1454 cell, real_locations, reference_locations);
1456 if (cell->reference_cell().contains_point(
1457 reference_locations[0], tolerance_inside_cell))
1459 current_cell = cell;
1471 signals.particle_lost(out_particle,
1472 out_particle->get_surrounding_cell());
1478 out_particle->set_reference_location(reference_locations[0]);
1482 if (current_cell->is_locally_owned())
1485 out_particle->particles_in_cell
1486 ->particles[out_particle->particle_index_within_cell];
1489 const auto old_value = old;
1493 insert_particle(old_value, current_cell);
1497 moved_particles[current_cell->subdomain_id()].push_back(
1499 moved_cells[current_cell->subdomain_id()].push_back(current_cell);
1505#ifdef DEAL_II_WITH_MPI
1506 if (
const auto parallel_triangulation =
1511 parallel_triangulation->get_mpi_communicator()) > 1)
1512 send_recv_particles(moved_particles, moved_cells);
1517 remove_particles(particles_out_of_cell);
1520 std::vector<typename PropertyPool<dim, spacedim>::Handle> unsorted_handles;
1521 unsorted_handles.reserve(property_pool->n_registered_slots());
1524 for (
auto &particles_in_cell : particles)
1525 for (
auto &particle : particles_in_cell.particles)
1527 unsorted_handles.push_back(particle);
1528 particle = sorted_handle++;
1531 property_pool->sort_memory_slots(unsorted_handles);
1537 template <
int dim,
int spacedim>
1540 const bool enable_cache)
1543 const auto parallel_triangulation =
1546 if (parallel_triangulation !=
nullptr)
1549 parallel_triangulation->get_mpi_communicator()) == 1)
1555#ifndef DEAL_II_WITH_MPI
1559 for (
const auto &cell :
triangulation->active_cell_iterators())
1560 if (cell->is_ghost() &&
1561 cells_to_particle_cache[cell->active_cell_index()] != particles.end())
1563 Assert(cells_to_particle_cache[cell->active_cell_index()]->cell ==
1567 for (
auto &ghost_particle :
1568 cells_to_particle_cache[cell->active_cell_index()]->particles)
1569 property_pool->deregister_particle(ghost_particle);
1572 particles.erase(cells_to_particle_cache[cell->active_cell_index()]);
1573 cells_to_particle_cache[cell->active_cell_index()] = particles.end();
1577 ghost_particles_cache.ghost_particles_by_domain.clear();
1578 ghost_particles_cache.valid =
false;
1585 const std::map<unsigned int, std::set<types::subdomain_id>>
1587 triangulation_cache->get_vertices_with_ghost_neighbors();
1589 const std::set<types::subdomain_id> ghost_owners =
1590 parallel_triangulation->ghost_owners();
1591 for (
const auto ghost_owner : ghost_owners)
1592 ghost_particles_cache.ghost_particles_by_domain[ghost_owner].reserve(
1593 n_locally_owned_particles() / 4);
1595 const std::vector<std::set<unsigned int>> vertex_to_neighbor_subdomain =
1596 triangulation_cache->get_vertex_to_neighbor_subdomain();
1598 for (
const auto &cell :
triangulation->active_cell_iterators())
1600 if (cell->is_locally_owned())
1602 std::set<unsigned int> cell_to_neighbor_subdomain;
1603 for (
const unsigned int v : cell->vertex_indices())
1605 const auto vertex_ghost_neighbors =
1607 if (vertex_ghost_neighbors !=
1610 cell_to_neighbor_subdomain.insert(
1611 vertex_ghost_neighbors->second.begin(),
1612 vertex_ghost_neighbors->second.end());
1616 if (cell_to_neighbor_subdomain.size() > 0)
1619 particles_in_cell(cell);
1621 for (
const auto domain : cell_to_neighbor_subdomain)
1623 for (
typename particle_iterator_range::iterator particle =
1624 particle_range.begin();
1625 particle != particle_range.end();
1627 ghost_particles_cache.ghost_particles_by_domain[domain]
1628 .push_back(particle);
1634 send_recv_particles(
1635 ghost_particles_cache.ghost_particles_by_domain,
1646 template <
int dim,
int spacedim>
1651 const auto parallel_triangulation =
1654 if (parallel_triangulation ==
nullptr ||
1656 parallel_triangulation->get_mpi_communicator()) == 1)
1662#ifdef DEAL_II_WITH_MPI
1665 Assert(ghost_particles_cache.valid,
1667 "Ghost particles cannot be updated if they first have not been "
1668 "exchanged at least once with the cache enabled"));
1671 send_recv_particles_properties_and_location(
1672 ghost_particles_cache.ghost_particles_by_domain);
1678#ifdef DEAL_II_WITH_MPI
1679 template <
int dim,
int spacedim>
1688 const bool build_cache)
1694 ghost_particles_cache.valid = build_cache;
1696 const auto parallel_triangulation =
1699 Assert(parallel_triangulation,
1700 ExcMessage(
"This function is only implemented for "
1701 "parallel::TriangulationBase objects."));
1704 const std::set<types::subdomain_id> ghost_owners =
1705 parallel_triangulation->ghost_owners();
1706 const std::vector<types::subdomain_id> neighbors(ghost_owners.begin(),
1707 ghost_owners.end());
1708 const unsigned int n_neighbors = neighbors.size();
1710 if (send_cells.size() != 0)
1716 particles_to_send.end(),
1721 for (
auto send_particles = particles_to_send.begin();
1722 send_particles != particles_to_send.end();
1724 Assert(ghost_owners.find(send_particles->first) != ghost_owners.end(),
1727 std::size_t n_send_particles = 0;
1728 for (
auto send_particles = particles_to_send.begin();
1729 send_particles != particles_to_send.end();
1731 n_send_particles += send_particles->second.size();
1737 std::vector<unsigned int> n_send_data(n_neighbors, 0);
1738 std::vector<unsigned int> send_offsets(n_neighbors, 0);
1739 std::vector<char> send_data;
1744 const unsigned int individual_particle_data_size =
1746 (size_callback ? size_callback() : 0);
1748 const unsigned int individual_total_particle_data_size =
1749 individual_particle_data_size + cellid_size;
1754 if (n_send_particles > 0)
1757 send_data.resize(n_send_particles *
1758 individual_total_particle_data_size);
1760 void *
data =
static_cast<void *
>(&send_data.front());
1763 for (
unsigned int i = 0; i < n_neighbors; ++i)
1765 send_offsets[i] =
reinterpret_cast<std::size_t
>(
data) -
1766 reinterpret_cast<std::size_t
>(&send_data.front());
1768 const unsigned int n_particles_to_send =
1769 particles_to_send.at(neighbors[i]).size();
1771 Assert(
static_cast<std::size_t
>(n_particles_to_send) *
1772 individual_total_particle_data_size ==
1773 static_cast<std::size_t
>(
1774 n_particles_to_send *
1775 individual_total_particle_data_size),
1776 ExcMessage(
"Overflow when trying to send particle "
1779 for (
unsigned int j = 0; j < n_particles_to_send; ++j)
1785 if (send_cells.empty())
1786 cell = particles_to_send.at(neighbors[i])[j]
1787 ->get_surrounding_cell();
1789 cell = send_cells.at(neighbors[i])[j];
1792 cell->id().template to_binary<dim>();
1793 memcpy(
data, &cellid, cellid_size);
1794 data =
static_cast<char *
>(
data) + cellid_size;
1796 data = particles_to_send.at(neighbors[i])[j]
1797 ->write_particle_data_to_memory(
data);
1800 store_callback(particles_to_send.at(neighbors[i])[j],
data);
1802 n_send_data[i] = n_particles_to_send;
1807 std::vector<unsigned int> n_recv_data(n_neighbors);
1808 std::vector<unsigned int> recv_offsets(n_neighbors);
1814 std::vector<MPI_Request> n_requests(2 * n_neighbors);
1815 for (
unsigned int i = 0; i < n_neighbors; ++i)
1818 MPI_Irecv(&(n_recv_data[i]),
1823 parallel_triangulation->get_mpi_communicator(),
1824 &(n_requests[2 * i]));
1827 for (
unsigned int i = 0; i < n_neighbors; ++i)
1830 MPI_Isend(&(n_send_data[i]),
1835 parallel_triangulation->get_mpi_communicator(),
1836 &(n_requests[2 * i + 1]));
1840 MPI_Waitall(2 * n_neighbors, n_requests.data(), MPI_STATUSES_IGNORE);
1845 unsigned int total_recv_data = 0;
1846 for (
unsigned int neighbor_id = 0; neighbor_id < n_neighbors; ++neighbor_id)
1848 recv_offsets[neighbor_id] = total_recv_data;
1850 n_recv_data[neighbor_id] * individual_total_particle_data_size;
1854 std::vector<char> recv_data(total_recv_data);
1858 std::vector<MPI_Request> requests(2 * n_neighbors);
1859 unsigned int send_ops = 0;
1860 unsigned int recv_ops = 0;
1865 for (
unsigned int i = 0; i < n_neighbors; ++i)
1866 if (n_recv_data[i] > 0)
1869 MPI_Irecv(&(recv_data[recv_offsets[i]]),
1870 n_recv_data[i] * individual_total_particle_data_size,
1874 parallel_triangulation->get_mpi_communicator(),
1875 &(requests[send_ops]));
1880 for (
unsigned int i = 0; i < n_neighbors; ++i)
1881 if (n_send_data[i] > 0)
1884 MPI_Isend(&(send_data[send_offsets[i]]),
1885 n_send_data[i] * individual_total_particle_data_size,
1889 parallel_triangulation->get_mpi_communicator(),
1890 &(requests[send_ops + recv_ops]));
1895 MPI_Waitall(send_ops + recv_ops, requests.data(), MPI_STATUSES_IGNORE);
1901 const void *recv_data_it =
static_cast<const void *
>(recv_data.data());
1904 auto &ghost_particles_iterators =
1905 ghost_particles_cache.ghost_particles_iterators;
1909 ghost_particles_iterators.clear();
1911 auto &send_pointers_particles = ghost_particles_cache.send_pointers;
1912 send_pointers_particles.assign(n_neighbors + 1, 0);
1914 for (
unsigned int i = 0; i < n_neighbors; ++i)
1915 send_pointers_particles[i + 1] =
1916 send_pointers_particles[i] +
1917 n_send_data[i] * individual_particle_data_size;
1919 auto &recv_pointers_particles = ghost_particles_cache.recv_pointers;
1920 recv_pointers_particles.assign(n_neighbors + 1, 0);
1922 for (
unsigned int i = 0; i < n_neighbors; ++i)
1923 recv_pointers_particles[i + 1] =
1924 recv_pointers_particles[i] +
1925 n_recv_data[i] * individual_particle_data_size;
1927 ghost_particles_cache.neighbors = neighbors;
1929 ghost_particles_cache.send_data.resize(
1930 ghost_particles_cache.send_pointers.back());
1931 ghost_particles_cache.recv_data.resize(
1932 ghost_particles_cache.recv_pointers.back());
1935 while (
reinterpret_cast<std::size_t
>(recv_data_it) -
1936 reinterpret_cast<std::size_t
>(recv_data.data()) <
1940 memcpy(&binary_cellid, recv_data_it, cellid_size);
1941 const CellId id(binary_cellid);
1942 recv_data_it =
static_cast<const char *
>(recv_data_it) + cellid_size;
1947 insert_particle(property_pool->register_particle(), cell);
1948 const typename particle_container::iterator &cache =
1949 cells_to_particle_cache[cell->active_cell_index()];
1954 cache->particles.size() - 1);
1957 particle_it->read_particle_data_from_memory(recv_data_it);
1960 recv_data_it = load_callback(particle_it, recv_data_it);
1963 ghost_particles_iterators.push_back(particle_it);
1966 AssertThrow(recv_data_it == recv_data.data() + recv_data.size(),
1968 "The amount of data that was read into new particles "
1969 "does not match the amount of data sent around."));
1975#ifdef DEAL_II_WITH_MPI
1976 template <
int dim,
int spacedim>
1982 const auto parallel_triangulation =
1986 parallel_triangulation,
1988 "This function is only implemented for parallel::TriangulationBase "
1991 const auto &neighbors = ghost_particles_cache.neighbors;
1992 const auto &send_pointers = ghost_particles_cache.send_pointers;
1993 const auto &recv_pointers = ghost_particles_cache.recv_pointers;
1995 std::vector<char> &send_data = ghost_particles_cache.send_data;
1998 if (send_pointers.back() > 0)
2000 void *
data =
static_cast<void *
>(&send_data.front());
2003 for (
const auto i : neighbors)
2004 for (
const auto &p : particles_to_send.at(i))
2006 data = p->write_particle_data_to_memory(
data);
2012 std::vector<char> &recv_data = ghost_particles_cache.recv_data;
2016 std::vector<MPI_Request> requests(2 * neighbors.size());
2017 unsigned int send_ops = 0;
2018 unsigned int recv_ops = 0;
2023 for (
unsigned int i = 0; i < neighbors.size(); ++i)
2024 if ((recv_pointers[i + 1] - recv_pointers[i]) > 0)
2027 MPI_Irecv(recv_data.data() + recv_pointers[i],
2028 recv_pointers[i + 1] - recv_pointers[i],
2032 parallel_triangulation->get_mpi_communicator(),
2033 &(requests[send_ops]));
2038 for (
unsigned int i = 0; i < neighbors.size(); ++i)
2039 if ((send_pointers[i + 1] - send_pointers[i]) > 0)
2042 MPI_Isend(send_data.data() + send_pointers[i],
2043 send_pointers[i + 1] - send_pointers[i],
2047 parallel_triangulation->get_mpi_communicator(),
2048 &(requests[send_ops + recv_ops]));
2053 MPI_Waitall(send_ops + recv_ops, requests.data(), MPI_STATUSES_IGNORE);
2059 const void *recv_data_it =
static_cast<const void *
>(recv_data.data());
2062 auto &ghost_particles_iterators =
2063 ghost_particles_cache.ghost_particles_iterators;
2065 for (
auto &recv_particle : ghost_particles_iterators)
2070 recv_particle->read_particle_data_from_memory(recv_data_it);
2072 Assert(recv_particle->particles_in_cell->cell->is_ghost(),
2076 recv_data_it = load_callback(
2079 recv_particle->particle_index_within_cell),
2083 AssertThrow(recv_data_it == recv_data.data() + recv_data.size(),
2085 "The amount of data that was read into new particles "
2086 "does not match the amount of data sent around."));
2090 template <
int dim,
int spacedim>
2093 const std::function<std::size_t()> &size_callb,
2098 size_callback = size_callb;
2099 store_callback = store_callb;
2100 load_callback = load_callb;
2104 template <
int dim,
int spacedim>
2109 for (
const auto &connection : tria_listeners)
2110 connection.disconnect();
2112 tria_listeners.clear();
2114 tria_listeners.push_back(
triangulation->signals.create.connect([&]() {
2115 this->initialize(*(this->triangulation),
2117 this->property_pool->n_properties_per_slot());
2120 this->tria_listeners.push_back(
2121 this->
triangulation->signals.clear.connect([&]() { this->clear(); }));
2127 tria_listeners.push_back(
2129 [&]() { this->post_mesh_change_action(); }));
2130 tria_listeners.push_back(
2131 triangulation->signals.post_distributed_repartition.connect(
2132 [&]() { this->post_mesh_change_action(); }));
2133 tria_listeners.push_back(
2135 [&]() { this->post_mesh_change_action(); }));
2139 tria_listeners.push_back(
triangulation->signals.post_refinement.connect(
2140 [&]() { this->post_mesh_change_action(); }));
2146 template <
int dim,
int spacedim>
2152 const bool distributed_triangulation =
2155 &(*triangulation)) !=
nullptr;
2156 (void)distributed_triangulation;
2159 distributed_triangulation || number_of_locally_owned_particles == 0,
2161 "Mesh refinement in a non-distributed triangulation is not supported "
2162 "by the ParticleHandler class. Either insert particles after mesh "
2163 "creation, or use a distributed triangulation."));
2167 if (number_of_locally_owned_particles == 0)
2168 cells_to_particle_cache.resize(
triangulation->n_active_cells(),
2174 template <
int dim,
int spacedim>
2178 register_data_attach();
2183 template <
int dim,
int spacedim>
2187 register_data_attach();
2192 template <
int dim,
int spacedim>
2196 const auto callback_function =
2200 return this->pack_callback(cell_iterator, cell_status);
2203 tria_attached_data_index =
2205 ->register_data_attach(callback_function,
2211 template <
int dim,
int spacedim>
2215 const bool serialization =
false;
2216 notify_ready_to_unpack(serialization);
2221 template <
int dim,
int spacedim>
2225 const bool serialization =
true;
2226 notify_ready_to_unpack(serialization);
2230 template <
int dim,
int spacedim>
2233 const bool serialization)
2243 register_data_attach();
2248 const auto callback_function =
2252 const boost::iterator_range<std::vector<char>::const_iterator>
2254 this->unpack_callback(cell_iterator, cell_status, range_iterator);
2258 ->notify_ready_to_unpack(tria_attached_data_index, callback_function);
2262 update_cached_numbers();
2268 template <
int dim,
int spacedim>
2274 std::vector<particle_iterator> stored_particles_on_cell;
2283 const unsigned int n_particles = n_particles_in_cell(cell);
2284 stored_particles_on_cell.reserve(n_particles);
2286 for (
unsigned int i = 0; i < n_particles; ++i)
2288 cells_to_particle_cache[cell->active_cell_index()],
2298 for (
const auto &child : cell->child_iterators())
2300 const unsigned int n_particles = n_particles_in_cell(child);
2302 stored_particles_on_cell.reserve(
2303 stored_particles_on_cell.size() + n_particles);
2305 const typename particle_container::iterator &cache =
2306 cells_to_particle_cache[child->active_cell_index()];
2307 for (
unsigned int i = 0; i < n_particles; ++i)
2308 stored_particles_on_cell.push_back(
2319 return pack_particles(stored_particles_on_cell);
2324 template <
int dim,
int spacedim>
2329 const boost::iterator_range<std::vector<char>::const_iterator> &data_range)
2331 if (data_range.begin() == data_range.end())
2334 const auto cell_to_store_particles =
2338 if (data_range.begin() != data_range.end())
2340 const void *
data =
static_cast<const void *
>(&(*data_range.begin()));
2341 const void *end =
static_cast<const void *
>(
2342 &(*data_range.begin()) + (data_range.end() - data_range.begin()));
2346 const void *old_data =
data;
2347 const auto x = insert_particle(
data, cell_to_store_particles);
2351 const void *new_data =
data;
2356 x->serialized_size_in_bytes());
2361 "The particle data could not be deserialized successfully. "
2362 "Check that when deserializing the particles you expect "
2363 "the same number of properties that were serialized."));
2366 auto loaded_particles_on_cell = particles_in_cell(cell_to_store_particles);
2381 for (
auto &particle : loaded_particles_on_cell)
2384 mapping->transform_real_to_unit_cell(cell_to_store_particles,
2385 particle.get_location());
2386 particle.set_reference_location(p_unit);
2395 typename particle_container::iterator &cache =
2396 cells_to_particle_cache[cell_to_store_particles
2397 ->active_cell_index()];
2404 auto particle = loaded_particles_on_cell.begin();
2405 for (
unsigned int i = 0; i < cache->particles.size();)
2407 bool found_new_cell =
false;
2409 for (
const auto &child : cell->child_iterators())
2416 mapping->transform_real_to_unit_cell(
2417 child, particle->get_location());
2418 if (cell->reference_cell().contains_point(
2419 p_unit, tolerance_inside_cell))
2421 found_new_cell =
true;
2422 particle->set_reference_location(p_unit);
2426 if (child != cell_to_store_particles)
2429 insert_particle(cache->particles[i], child);
2431 cache->particles[i] = cache->particles.back();
2432 cache->particles.pop_back();
2449 if (found_new_cell ==
false)
2458 signals.particle_lost(particle,
2459 particle->get_surrounding_cell());
2460 if (cache->particles[i] !=
2462 property_pool->deregister_particle(cache->particles[i]);
2463 cache->particles[i] = cache->particles.back();
2464 cache->particles.pop_back();
2468 if (cache->particles.empty())
2470 particles.erase(cache);
2471 cache = particles.end();
2483#include "particles/particle_handler.inst"
@ children_will_be_coarsened
std::array< unsigned int, 4 > binary_type
const unsigned int n_components
virtual void vector_value(const Point< dim > &p, Vector< RangeNumberType > &values) const
void add_indices(const ForwardIterator &begin, const ForwardIterator &end)
Abstract base class for mapping classes.
void register_additional_store_load_functions(const std::function< std::size_t()> &size_callback, const std::function< void *(const particle_iterator &, void *)> &store_callback, const std::function< const void *(const particle_iterator &, const void *)> &load_callback)
void exchange_ghost_particles(const bool enable_ghost_cache=false)
unsigned int tria_attached_data_index
types::particle_index n_global_particles() const
unsigned int global_max_particles_per_cell
void unpack_after_coarsening_and_refinement()
void register_data_attach()
internal::GhostParticlePartitioner< dim, spacedim > ghost_particles_cache
particle_container::iterator particle_container_ghost_begin() const
void prepare_for_serialization()
unsigned int n_properties_per_particle() const
types::particle_index global_number_of_particles
void get_particle_positions(VectorType &output_vector, const bool add_to_output_vector=false)
particle_container::iterator particle_container_owned_end() const
void update_cached_numbers()
void prepare_for_coarsening_and_refinement()
particle_container::iterator particle_container_ghost_end() const
boost::iterator_range< particle_iterator > particle_iterator_range
void post_mesh_change_action()
void send_recv_particles(const std::map< types::subdomain_id, std::vector< particle_iterator > > &particles_to_send, const std::map< types::subdomain_id, std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > > &new_cells_for_particles=std::map< types::subdomain_id, std::vector< typename Triangulation< dim, spacedim >::active_cell_iterator > >(), const bool enable_cache=false)
ObserverPointer< const Mapping< dim, spacedim >, ParticleHandler< dim, spacedim > > mapping
void send_recv_particles_properties_and_location(const std::map< types::subdomain_id, std::vector< particle_iterator > > &particles_to_send)
types::particle_index number_of_locally_owned_particles
PropertyPool< dim, spacedim > & get_property_pool() const
void initialize(const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping, const unsigned int n_properties=0)
std::unique_ptr< PropertyPool< dim, spacedim > > property_pool
types::particle_index get_max_local_particle_index() const
void reserve(const std::size_t n_particles)
std::map< unsigned int, IndexSet > insert_global_particles(const std::vector< Point< spacedim > > &positions, const std::vector< std::vector< BoundingBox< spacedim > > > &global_bounding_boxes, const std::vector< std::vector< double > > &properties={}, const std::vector< types::particle_index > &ids={})
void notify_ready_to_unpack(const bool serialization)
void connect_to_triangulation_signals()
std::enable_if_t< std::is_convertible_v< VectorType *, Function< spacedim > * >==false > set_particle_positions(const VectorType &input_vector, const bool displace_particles=true)
std::vector< char > pack_callback(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellStatus status) const
void insert_particles(const std::multimap< typename Triangulation< dim, spacedim >::active_cell_iterator, Particle< dim, spacedim > > &particles)
types::particle_index next_free_particle_index
void remove_particle(const particle_iterator &particle)
types::particle_index n_locally_owned_particles() const
void reset_particle_container(particle_container &particles)
types::particle_index n_particles_in_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell) const
void update_ghost_particles()
typename ParticleAccessor< dim, spacedim >::particle_container particle_container
ObserverPointer< const Triangulation< dim, spacedim >, ParticleHandler< dim, spacedim > > triangulation
particle_iterator_range particles_in_cell(const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)
particle_iterator insert_particle(const Particle< dim, spacedim > &particle, const typename Triangulation< dim, spacedim >::active_cell_iterator &cell)
void sort_particles_into_subdomains_and_cells()
void remove_particles(const std::vector< particle_iterator > &particles)
types::particle_index n_global_max_particles_per_cell() const
particle_container::iterator particle_container_owned_begin() const
void unpack_callback(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const CellStatus status, const boost::iterator_range< std::vector< char >::const_iterator > &data_range)
virtual ~ParticleHandler()
void copy_from(const ParticleHandler< dim, spacedim > &particle_handler)
types::particle_index get_next_free_particle_index() const
particle_container particles
IndexSet locally_owned_particle_ids() const
void set_property_pool(PropertyPool< dim, spacedim > &property_pool)
const Point< dim > & get_reference_location() const
const Point< spacedim > & get_location() const
std::size_t serialized_size_in_bytes() const
types::particle_index get_id() const
ArrayView< double > get_properties()
numbers::NumberTraits< Number >::real_type norm() const
constexpr numbers::NumberTraits< Number >::real_type norm_square() const
IteratorState::IteratorStates state() const
#define DEAL_II_NAMESPACE_OPEN
constexpr bool running_in_debug_mode()
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_ASSERT_UNREACHABLE()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcPointNotAvailableHere()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
TriaIterator< CellAccessor< dim, spacedim > > cell_iterator
std::vector< index_type > data
@ past_the_end
Iterator reached end of container.
@ valid
Iterator points to a valid object.
T sum(const T &t, const MPI_Comm mpi_communicator)
std::map< unsigned int, T > some_to_some(const MPI_Comm comm, const std::map< unsigned int, T > &objects_to_send)
unsigned int n_mpi_processes(const MPI_Comm mpi_communicator)
T max(const T &t, const MPI_Comm mpi_communicator)
std::vector< T > all_gather(const MPI_Comm comm, const T &object_to_send)
constexpr unsigned int invalid_unsigned_int
constexpr types::subdomain_id artificial_subdomain_id
bool is_finite(const double x)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
unsigned int subdomain_id
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
std::map< unsigned int, std::set<::types::subdomain_id > > * vertices_with_ghost_neighbors