[deal.II] Re: nearest neighbor

2016-09-13 Thread Joel Davidsson
Thanks Daniel,

I had confused the dof_index with the vertex_number. Now It works as 
expected.

Best,
Joel

On Wednesday, September 7, 2016 at 3:47:21 PM UTC+2, Daniel Arndt wrote:
>
> Joel,
>
> In GridTools::find_cells_adjacent_to_vertex(dof_handler,center_id) you 
> need to give the number of the vertex_number as center_id, not the number 
> of the degree of freedom.
> Then, you want to use 
>
> Quadrature  
> quadrature_formula(dof_handler.get_fe().get_unit_support_points());
>
> to create a Quadrature object that gives you the support points on each 
> cell.
> Finally, you can output the global dof number and their support point on 
> each cell by: 
>
> for (unsigned int j=0; j   std::cout << local_dof_indices[j] << ": "<< 
> fe_values.quadrature_point(j) << std::endl;
>
> In this ouput, you can then search for the dofs with support_point nearest 
> to the vertex you wanted to consider.
>
> Best,
> Daniel
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[deal.II] Re: nearest neighbor

2016-09-07 Thread Daniel Arndt
Joel,

In GridTools::find_cells_adjacent_to_vertex(dof_handler,center_id) you need 
to give the number of the vertex_number as center_id, not the number of the 
degree of freedom.
Then, you want to use 

Quadrature  
quadrature_formula(dof_handler.get_fe().get_unit_support_points());

to create a Quadrature object that gives you the support points on each 
cell.
Finally, you can output the global dof number and their support point on 
each cell by: 

for (unsigned int j=0; j

[deal.II] Re: nearest neighbor

2016-09-01 Thread Jean-Paul Pelteret
Hi Joel,

Do you mean the index to a vertex? And by nearest, do you mean the vertex 
that shares the shortest common edge with the specified vertex? If so, then 
no. But it shouldn't be hard to write such a function. You would need to 
find all cells that share the initial vertex (I believe this is implemented 
),
 
then from that find all edges that share this vertex and simply compute the 
edge lengths and sort/filter accordingly. If you really need the DoFs 
associated with this index, then you can determine them at this point.

Regards,
J-P

On Thursday, September 1, 2016 at 4:05:39 PM UTC+2, Joel Davidsson wrote:
>
> Dear all,
>
> If I have the index to a dof, is there any easy way I can get indexes to 
> the nearest neighbor?
>
> Thanks,
>
> Joel
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.