Hey Timo, Thanks for your response, I kind of suspected that there was no random index for grid entities since I could not find any example code.
The reason I would prefer a raw index loop is because the velocity vector returned from velocityoutput.hh is in global coordinates. For each time step I want to multiply the velocity times the time step size times the cross section area to get the volume of the phase which has exited. I only want to do this on the boundary cells to obtain a phase volume recovery graph with respect to time. To figure out whether a I am at the boundary I plan to use similar code as that which is used in boundaryTypesAtPos (), which relies on GlobalPosition. So I guess that instead of a raw loop, I need to loop on elements and for each subcontrol volume in the finite volume geometry obtain the dof global index and the global position. With these two data items at hand, construct a temporary list with the boundary indexes of interest to act upon. The list would only have to be constructed once if the grid is not adaptative. Does that logic seem right? Kind regards, Edscott Enviado desde mi smartphone Sony Xperia™ ---- Timo Koch escribió ---- > Am 06.10.2017 um 22:23 schrieb Ed Scott Wilson Garcia <[email protected]>: > > Hello, > > I hope someone on this list can help me with this, which apparently should > have a simple solution. > I have added a loop indexed from zero to this->numDofs() in the > 2pnc/implicit/model.hh, but I need to obtain a GlobalPosition from the index. > I see that the GlobalPosition can be obtained from the element and the > subcontrol volume indexes (scvIdx), but I am looking for a simpler solution > with a plain loop on the degrees of freedom, numDofs. > Is this possible? If so, could someone point me to an example code? Hi Edscott, this is not possible. Unless you want to store a vector of ElementSeeds or a vector of all global dof positions first. There is no random index access for grid entities in Dune. Why would you want to have a raw index loop instead of an iterator loop / range-based for loop over elements in your case? Best wishes Timo > Thanks in advance, > > Edscott Wilson Garcia > IMP > _______________________________________________ > Dumux mailing list > [email protected] > https://listserv.uni-stuttgart.de/mailman/listinfo/dumux _______________________________________________ Dumux mailing list [email protected] https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
_______________________________________________ Dumux mailing list [email protected] https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
