Correct. If you only iterate over local elements and modify the mesh it will 
become inconsistent across processors; and you'd need to fix that with 
communication. So it's cleaner to loop over all elements.

On Apr 16, 2014, at 9:35 PM, "walter kou" 
<[email protected]<mailto:[email protected]>> wrote:

So I guess, If I want to modify the subdomain_id, I will also need to use 
mesh.elements_{begin,end},

Right?


On Wed, Apr 16, 2014 at 9:33 PM, walter kou 
<[email protected]<mailto:[email protected]>> wrote:
It works with mesh.elements_{begin,end}().

Thanks,




On Wed, Apr 16, 2014 at 8:42 PM, Kirk, Benjamin (JSC-EG311) 
<[email protected]<mailto:[email protected]>> wrote:
You're modifying the mesh, so you need to be sure to do it the same on all 
processors.  In this case, the culprit I think is looping over the local 
elements.  What happens when you loop over mesh.elements_{begin,end}(); instead?

-Ben

On Apr 16, 2014, at 8:35 PM, walter kou 
<[email protected]<mailto:[email protected]>> wrote:

> 1) Given a 3D mesh, I try to write a separate code to add boundary id,
> using:
>
>    Mesh::element_iterator       it_el      =
> mesh.active_local_elements_begin();
>    const Mesh::element_iterator it_last_el =
> mesh.active_local_elements_end();
>    for ( ; it_el != it_last_el ; ++it_el) {
>        Elem* elem = *it_el;
> // some code to detect null-neighbour
>  mesh.boundary_info->add_side(elem->id(), side, bc_code);
>
>  equation_systems.init();



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to