finding iterator to the cell surrounding a point for different classes.

23 views
Skip to first unread message

nsn...@gmail.com

unread,
Jun 11, 2021, 10:42:36 AM6/11/21
to deal.II User Group
Hello,

In my code, I have two DoFHandler objects one corresponding to a vector solution and another corresponding to a scalar solution. I need to find an active cell iterator that surrounds a given point for both DoFHandler objects.  I am using the function  GridTools::find_active_cell_around_point twice to find the cell iterator corresponding to each DofHandler. Now both iterators are pointing to the same cell but have to search twice. So is there any other way where to find an iterator, given a particular iterator that belongs to a different object? Similarly, if we have a traingulation::active_cell_iterator that points to a particular cell, is there any way to find the iterator which points to the same cell but belongs to a DofHandler class? Thank you.

Regards,
Narendra Nanal

Wolfgang Bangerth

unread,
Jun 11, 2021, 1:13:00 PM6/11/21
to dea...@googlegroups.com
Yes, you can do

DoFHandler::active_cell_iterator iterator_1 = ...

DoFHandler::active_cell_iterator iterator_2 (iterator_1->get_triangulation(),
iterator_1->level(),
iterator_1->index(),
&dof_handler_2);

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages