I pressed reply instead of reply all...
On Nov 6, 2015 10:50 AM, "Miguel Angel Salazar de Troya" <
salazardetr...@gmail.com> wrote:

> I found out I can use elem->id () == mesh.processor_id() instead of
> elem->is_remote(). However, there's a problem when I iterate over all the
> elements and it's that not all processors iterate over all the elements.
> This code snippet:
>
> MeshBase::const_element_iterator       el
> =this->get_mesh().active_elements_begin();
>
> const MeshBase::const_element_iterator end_el =
> this->get_mesh().active_elements_end();
>
> int n_elem = 0;
>
> for (; el != end_el;
> el++)
>    n_elem++;
>
> std::cout<<"n_elem = "<<n_elem<<" processor id =
> "<<this->get_mesh().processor_id()<<std::endl;
> returns different values of n_elem for each processor.
>
> Miguel
>
> I need to go element by element because every time I access each element,
> I'm modifying a global vector and making an evaluation using that vector. I
> can't modify that global vector concurrently with other processors.
>
> Miguel
> On Nov 6, 2015 7:31 AM, "Paul T. Bauman" <ptbau...@gmail.com> wrote:
>
>> On Fri, Nov 6, 2015 at 10:29 AM, Miguel Angel Salazar de Troya <
>> salazardetr...@gmail.com> wrote:
>>
>>> Hello
>>>
>>> I'm trying to do the following operation. I want to iterate over all the
>>> elements using the iterators active_elements_begin()/end().
>>
>>
>> You can use the active_local_elements_begin()/end() iterators to only
>> iterate over active elements on the current processor.
>>
>> HTH,
>>
>> Paul
>>
>
------------------------------------------------------------------------------
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to