Is there a reason then that there are several examples using integration_loop(), but (afaik) only one using mesh_loop?
Am Montag, 18. März 2019 19:46:41 UTC+1 schrieb Luca Heltai: > > 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. > > > > On 18 Mar 2019, at 17:46, 'Maxi Miller' via deal.II User Group < > [email protected] <javascript:>> wrote: > > > > Similar question: How are the different loop-functions differentiated, > i.e. MeshWorker::integration_loop and MeshWorker::mesh_loop? Both are able > to loop over faces, boundaries and cells, but what are the differences > here? > > Thanks! > > > > Am Dienstag, 22. Januar 2019 16:56:28 UTC+1 schrieb Bruno Turcksin: > > Le mar. 22 janv. 2019 à 10:48, 'Maxi Miller' via deal.II User Group > > <[email protected]> a écrit : > > > I. e. if I would like to calculate f. ex. the L2-norm of a vector > (while neglecting that there already is a function for that), I can use > WorkStream for parallelization of that, but not MeshWorker, is that > correct? > > That's right. You can use WorkStream using the iterators for the > > vector but MeshWorker won't work because it expects cell iterators. > > > > Best, > > > > Bruno > > > > -- > > 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 [email protected] <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
