Take a look at this PR for a few examples of usage of mesh_loop:
https://github.com/dealii/dealii/pull/7806
The function WorkStream::run
takes (a minimum of) 5 arguments:
WorkStream::run(cell, endc, cell_worker, copier, scratch, copy);
initial and final iterator, a worker function, a copier function, a scratch object, and a copy object.
Logically, WorkStream::run does the following:
for(it = cell; it != endc; ++it) {
cell_worker(cell, scratch, copy);
copier(copy);
}
and is agnostic about what type of iterator you pass to it.
MeshWorker::mesh_loop is a specific implementation of the above in which the iterator is a cell iterator, and the loop is thought to run also on each face of each cell as well, in order to assemble DG type contributions, i.e., it allows you to specify two additional functions, a boundary_worker and a face_worker:
WorkStream::mesh_loop(cell, endc, cell_worker, copier, scratch, copy, flags, boundary_worker, face_worker);
This is logically identical to
for(it = cell; it != endc; ++it) {
cell_worker(cell, scratch, copy);
for(unsigned int f=0; f<NFaces; ++f) {
if(cell->face(f)->at_boundary() {
boundary_worker(cell, f, scratch, copy);
} else {
// Get subface, neighbor face index, and neighbor subface index
const auto [sf, nf, nsf] = get_neighbor_info(cell, f);
// Run the face worker
face_worker(cell, f, sf, cell->neighbor(f), nf, nsf);
}
}
copier(copy);
}
What mesh_loop does is controlled in a finer way by the assembly flags. For example it is possible to visit each face only once, or to assemble first faces and then cells, etc.
MeshWorker::integration_loop
is a specific implementation of MeshWorker::mesh_loop where you use the DoFInfo and DoFInfoBox objects, that contain scratch and copy data with a different structure. The two behave in a substantially identical way, but with different data structures.
In particular, you could implement MeshWorker::integration_loop using MeshWorker::mesh_loop, and some wrapping around DoFInfo and DoFInfoBox objects.
I hope this clarifies a little the scope of run (agnostic about iterators) and mesh_loop (actually expecting cell iterators, and taking care of subface/face/neighbor matching when looping over faces).
Best,
Luca.
> --
> The deal.II project is located at
http://www.dealii.org/
> For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
dealii+un...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.