283 const CellIteratorType &begin,
284 const CellIteratorType &end,
287 const CopierType &copier,
299 const unsigned int chunk_size = 8
301 const CellIteratorType &begin,
316 std::function<
void(
const CellIteratorBaseType &,
320 std::function<
void(
const CellIteratorBaseType &,
326 std::function<
void(
const CellIteratorBaseType &,
329 const CellIteratorBaseType &,
334 std::function<
void(
const CellIteratorBaseType &,
337 const CellIteratorBaseType &,
344 const unsigned int chunk_size = 8
351 "If you provide a cell worker function, you also need to request "
352 "that work should be done on cells by setting the 'work_on_cells' flag. "
353 "Conversely, if you don't provide a cell worker function, you "
354 "cannot set the 'work_on_cells' flag. One of these two "
355 "conditions is not satisfied."));
362 "If you provide a face worker function, you also need to request "
363 "that work should be done on interior faces by setting either the "
364 "'assemble_own_interior_faces_once' flag or the "
365 "'assemble_own_interior_faces_both' flag. "
366 "Conversely, if you don't provide a face worker function, you "
367 "cannot set either of these two flags. One of these two "
368 "conditions is not satisfied."));
373 "You can only 'specify assemble_ghost_faces_once' "
374 "OR 'assemble_ghost_faces_both', but not both of these flags."));
380 "The option 'cells_after_faces' only makes sense if you assemble on cells."));
385 "If you provide a face worker function, you also need to request "
386 "that work should be done on faces by setting the 'work_on_faces' flag. "
387 "Conversely, if you don't provide a face worker function, you "
388 "cannot set the 'work_on_faces' flag. One of these two "
389 "conditions is not satisfied."));
394 "If you provide a boundary face worker function, you also need to request "
395 "that work should be done on boundary faces by setting the 'assemble_boundary_faces' flag. "
396 "Conversely, if you don't provide a boundary face worker function, you "
397 "cannot set the 'assemble_boundary_faces' flag. One of these two "
398 "conditions is not satisfied."));
400 auto cell_action = [&](
const CellIteratorBaseType &cell,
405 copy = sample_copy_data;
408 const auto dim = cell->get_triangulation().dimension;
410 const bool ignore_subdomain =
411 (cell->get_triangulation().locally_owned_subdomain() ==
415 (cell->is_level_cell() ? cell->level_subdomain_id() :
416 cell->subdomain_id());
418 const bool own_cell =
420 (current_subdomain_id ==
421 cell->get_triangulation().locally_owned_subdomain());
423 if ((!ignore_subdomain) &&
430 cell_worker(cell, scratch, copy);
433 for (
const unsigned int face_no : cell->face_indices())
435 if (cell->at_boundary(face_no) &&
436 !cell->has_periodic_neighbor(face_no))
440 boundary_worker(cell, face_no, scratch, copy);
446 neighbor = cell->neighbor_or_periodic_neighbor(face_no);
450 if (neighbor->is_level_cell())
451 neighbor_subdomain_id = neighbor->level_subdomain_id();
453 else if (neighbor->is_active())
454 neighbor_subdomain_id = neighbor->subdomain_id();
456 const bool own_neighbor =
458 (neighbor_subdomain_id ==
459 cell->get_triangulation().locally_owned_subdomain());
462 if (!own_cell && !own_neighbor)
466 if (own_cell && own_neighbor &&
472 if (own_cell != own_neighbor &&
480 const bool periodic_neighbor =
481 cell->has_periodic_neighbor(face_no);
483 if (dim > 1 && ((!periodic_neighbor &&
484 cell->neighbor_is_coarser(face_no) &&
485 neighbor->is_active()) ||
486 (periodic_neighbor &&
487 cell->periodic_neighbor_is_coarser(face_no) &&
488 neighbor->is_active())))
497 const std::pair<unsigned int, unsigned int>
500 cell->periodic_neighbor_of_coarser_periodic_neighbor(
502 cell->neighbor_of_coarser_neighbor(face_no);
508 neighbor_face_no.first,
509 neighbor_face_no.second,
519 face_worker(neighbor,
520 neighbor_face_no.first,
521 neighbor_face_no.second,
529 else if (dim == 1 && cell->level() > neighbor->level())
532 const unsigned int neighbor_face_no =
534 cell->periodic_neighbor_face_no(face_no) :
535 cell->neighbor_face_no(face_no);
536 Assert(periodic_neighbor ||
537 neighbor->face(neighbor_face_no) ==
554 face_worker(neighbor,
569 neighbor->has_children())
574 Assert((!periodic_neighbor &&
575 !cell->neighbor_is_coarser(face_no)) ||
576 (periodic_neighbor &&
577 !cell->periodic_neighbor_is_coarser(face_no)),
583 if (own_cell && own_neighbor &&
596 if (own_cell && !own_neighbor &&
598 (neighbor_subdomain_id < current_subdomain_id))
601 const unsigned int neighbor_face_no =
603 cell->periodic_neighbor_face_no(face_no) :
604 cell->neighbor_face_no(face_no);
605 Assert(periodic_neighbor ||
606 neighbor->face(neighbor_face_no) ==
626 cell_worker(cell, scratch, copy);
842 MainClass &main_class,
843 void (MainClass::*cell_worker)(const CellIteratorType &,
846 void (MainClass::*copier)(const
CopyData &),
850 void (MainClass::*boundary_worker)(const CellIteratorType &,
854 void (MainClass::*face_worker)(const CellIteratorType &,
857 const CellIteratorType &,
863 const unsigned
int chunk_size = 8)
872 std::function<void(
const CellIteratorType &,
875 const CellIteratorType &,
882 if (cell_worker !=
nullptr)
883 f_cell_worker = [&main_class,
884 cell_worker](
const CellIteratorType &cell_iterator,
887 (main_class.*cell_worker)(cell_iterator, scratch_data, copy_data);
890 if (boundary_worker !=
nullptr)
892 [&main_class, boundary_worker](
const CellIteratorType &cell_iterator,
893 const unsigned int face_no,
897 boundary_worker)(cell_iterator, face_no, scratch_data, copy_data);
900 if (face_worker !=
nullptr)
901 f_face_worker = [&main_class,
902 face_worker](
const CellIteratorType &cell_iterator_1,
903 const unsigned int face_index_1,
904 const unsigned int subface_index_1,
905 const CellIteratorType &cell_iterator_2,
906 const unsigned int face_index_2,
907 const unsigned int subface_index_2,
910 (main_class.*face_worker)(cell_iterator_1,
924 [&main_class, copier](
const CopyData ©_data) {
925 (main_class.*copier)(copy_data);
1023 MainClass &main_class,
1024 void (MainClass::*cell_worker)(const CellIteratorBaseType &,
1027 void (MainClass::*copier)(const
CopyData &),
1031 void (MainClass::*boundary_worker)(const CellIteratorBaseType &,
1035 void (MainClass::*face_worker)(const CellIteratorBaseType &,
1038 const CellIteratorBaseType &,
1044 const unsigned
int chunk_size = 8)
1047 mesh_loop<typename IteratorRange<CellIteratorType>::IteratorOverIterators,
1051 CellIteratorBaseType>(iterator_range.
begin(),
1052 iterator_range.
end(),
1056 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)