281 const CellIteratorType &
begin,
282 const CellIteratorType &
end,
285 const CopierType &copier,
297 const unsigned int chunk_size = 8
299 const CellIteratorType &
begin,
314 std::function<
void(
const CellIteratorBaseType &,
318 std::function<
void(
const CellIteratorBaseType &,
324 std::function<
void(
const CellIteratorBaseType &,
327 const CellIteratorBaseType &,
332 std::function<
void(
const CellIteratorBaseType &,
335 const CellIteratorBaseType &,
342 const unsigned int chunk_size = 8
349 "If you provide a cell worker function, you also need to request "
350 "that work should be done on cells by setting the 'work_on_cells' flag. "
351 "Conversely, if you don't provide a cell worker function, you "
352 "cannot set the 'work_on_cells' flag. One of these two "
353 "conditions is not satisfied."));
360 "If you provide a face worker function, you also need to request "
361 "that work should be done on interior faces by setting either the "
362 "'assemble_own_interior_faces_once' flag or the "
363 "'assemble_own_interior_faces_both' flag. "
364 "Conversely, if you don't provide a face worker function, you "
365 "cannot set either of these two flags. One of these two "
366 "conditions is not satisfied."));
371 "You can only 'specify assemble_ghost_faces_once' "
372 "OR 'assemble_ghost_faces_both', but not both of these flags."));
378 "The option 'cells_after_faces' only makes sense if you assemble on cells."));
383 "If you provide a face worker function, you also need to request "
384 "that work should be done on faces by setting the 'work_on_faces' flag. "
385 "Conversely, if you don't provide a face worker function, you "
386 "cannot set the 'work_on_faces' flag. One of these two "
387 "conditions is not satisfied."));
392 "If you provide a boundary face worker function, you also need to request "
393 "that work should be done on boundary faces by setting the 'assemble_boundary_faces' flag. "
394 "Conversely, if you don't provide a boundary face worker function, you "
395 "cannot set the 'assemble_boundary_faces' flag. One of these two "
396 "conditions is not satisfied."));
398 auto cell_action = [&](
const CellIteratorBaseType &cell,
403 copy = sample_copy_data;
406 const auto dim = cell->get_triangulation().dimension;
408 const bool ignore_subdomain =
409 (cell->get_triangulation().locally_owned_subdomain() ==
413 (cell->is_level_cell() ? cell->level_subdomain_id() :
414 cell->subdomain_id());
416 const bool own_cell =
418 (current_subdomain_id ==
419 cell->get_triangulation().locally_owned_subdomain());
421 if ((!ignore_subdomain) &&
428 cell_worker(cell, scratch, copy);
431 for (
const unsigned int face_no : cell->face_indices())
433 if (cell->at_boundary(face_no) &&
434 !cell->has_periodic_neighbor(face_no))
438 boundary_worker(cell, face_no, scratch, copy);
444 neighbor = cell->neighbor_or_periodic_neighbor(face_no);
448 if (neighbor->is_level_cell())
449 neighbor_subdomain_id = neighbor->level_subdomain_id();
451 else if (neighbor->is_active())
452 neighbor_subdomain_id = neighbor->subdomain_id();
454 const bool own_neighbor =
456 (neighbor_subdomain_id ==
457 cell->get_triangulation().locally_owned_subdomain());
460 if (!own_cell && !own_neighbor)
464 if (own_cell && own_neighbor &&
470 if (own_cell != own_neighbor &&
478 const bool periodic_neighbor =
479 cell->has_periodic_neighbor(face_no);
481 if (dim > 1 && ((!periodic_neighbor &&
482 cell->neighbor_is_coarser(face_no) &&
483 neighbor->is_active()) ||
484 (periodic_neighbor &&
485 cell->periodic_neighbor_is_coarser(face_no) &&
486 neighbor->is_active())))
495 const std::pair<unsigned int, unsigned int>
498 cell->periodic_neighbor_of_coarser_periodic_neighbor(
500 cell->neighbor_of_coarser_neighbor(face_no);
506 neighbor_face_no.first,
507 neighbor_face_no.second,
517 face_worker(neighbor,
518 neighbor_face_no.first,
519 neighbor_face_no.second,
527 else if (dim == 1 && cell->level() > neighbor->level())
530 const unsigned int neighbor_face_no =
532 cell->periodic_neighbor_face_no(face_no) :
533 cell->neighbor_face_no(face_no);
534 Assert(periodic_neighbor ||
535 neighbor->face(neighbor_face_no) ==
552 face_worker(neighbor,
567 neighbor->has_children())
572 Assert((!periodic_neighbor &&
573 !cell->neighbor_is_coarser(face_no)) ||
574 (periodic_neighbor &&
575 !cell->periodic_neighbor_is_coarser(face_no)),
581 if (own_cell && own_neighbor &&
594 if (own_cell && !own_neighbor &&
596 (neighbor_subdomain_id < current_subdomain_id))
599 const unsigned int neighbor_face_no =
601 cell->periodic_neighbor_face_no(face_no) :
602 cell->neighbor_face_no(face_no);
603 Assert(periodic_neighbor ||
604 neighbor->face(neighbor_face_no) ==
624 cell_worker(cell, scratch, copy);
840 MainClass &main_class,
841 void (MainClass::*cell_worker)(const CellIteratorType &,
844 void (MainClass::*copier)(const
CopyData &),
848 void (MainClass::*boundary_worker)(const CellIteratorType &,
852 void (MainClass::*face_worker)(const CellIteratorType &,
855 const CellIteratorType &,
861 const unsigned
int chunk_size = 8)
870 std::function<void(
const CellIteratorType &,
873 const CellIteratorType &,
880 if (cell_worker !=
nullptr)
881 f_cell_worker = [&main_class,
882 cell_worker](
const CellIteratorType &cell_iterator,
885 (main_class.*cell_worker)(cell_iterator, scratch_data, copy_data);
888 if (boundary_worker !=
nullptr)
890 [&main_class, boundary_worker](
const CellIteratorType &cell_iterator,
891 const unsigned int face_no,
895 boundary_worker)(cell_iterator, face_no, scratch_data, copy_data);
898 if (face_worker !=
nullptr)
899 f_face_worker = [&main_class,
900 face_worker](
const CellIteratorType &cell_iterator_1,
901 const unsigned int face_index_1,
902 const unsigned int subface_index_1,
903 const CellIteratorType &cell_iterator_2,
904 const unsigned int face_index_2,
905 const unsigned int subface_index_2,
908 (main_class.*face_worker)(cell_iterator_1,
922 [&main_class, copier](
const CopyData ©_data) {
923 (main_class.*copier)(copy_data);
1021 MainClass &main_class,
1022 void (MainClass::*cell_worker)(const CellIteratorBaseType &,
1025 void (MainClass::*copier)(const
CopyData &),
1029 void (MainClass::*boundary_worker)(const CellIteratorBaseType &,
1033 void (MainClass::*face_worker)(const CellIteratorBaseType &,
1036 const CellIteratorBaseType &,
1042 const unsigned
int chunk_size = 8)
1045 mesh_loop<typename IteratorRange<CellIteratorType>::IteratorOverIterators,
1049 CellIteratorBaseType>(iterator_range.
begin(),
1050 iterator_range.
end(),
1054 sample_scratch_data,
void cell_action(IteratorType cell, DoFInfoBox< dim, DOFINFO > &dof_info, INFOBOX &info, const std::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &cell_worker, const std::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &boundary_worker, const std::function< void(DOFINFO &, DOFINFO &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, const LoopControl &loop_control)
void mesh_loop(const CellIteratorType &begin, const CellIteratorType &end, const CellWorkerFunctionType &cell_worker, const CopierType &copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const AssembleFlags flags=assemble_own_cells, const BoundaryWorkerFunctionType &boundary_worker=BoundaryWorkerFunctionType(), const FaceWorkerFunctionType &face_worker=FaceWorkerFunctionType(), const unsigned int queue_length=2 *MultithreadInfo::n_threads(), const unsigned int chunk_size=8)
std::function< void(const CellIteratorBaseType &, const unsigned int, const unsigned int, const CellIteratorBaseType &, const unsigned int, const unsigned int, ScratchData &, CopyData &)> FaceWorkerFunctionType
void run(const std::vector< std::vector< Iterator > > &colored_iterators, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length=2 *MultithreadInfo::n_threads(), const unsigned int chunk_size=8)