Sorry, in the code I was comparing
*mesh.n_nodes_on_proc()*, not the elements*. *
I messed up when copy and pasting in the email. Thus, in the code I'm still
having trouble.

- Namu​


On Mon, Aug 24, 2015 at 6:08 PM, namu patel <namu.pat...@gmail.com> wrote:

> Hello Everyone,
>
> In my code, I am trying to loop over all the local nodes and then sum them
> up to make sure that the all the nodes are accounted for. To do so, I am
> using a simple loop:
>
> *int num_nodes = 0; *
> *for (MeshBase::node_iterator n_it = mesh.local_nodes_begin(); n_it !=
> mesh.local_nodes_end(); ++n_it)*
> *{  *
> *    // ... extra code that I commented out for now *
> *    num_nodes++; *
> *}    *
> *​​TBOX_ASSERT(num_nodes == ​​std::distance
> (mesh.pid_elements_begin(SAMRAI_MPI::getRank()),
> mesh.pid_elements_end(SAMRAI_MPI::getRank()))); *
> *SAMRAI_MPI::sumReduction(num_nodes);*
> *TBOX_ASSERT(num_nodes == mesh.n_nodes());*
>
> Both of the above assertions fail when using more than one processor. I'm
> not sure why this is the case. If someone has any ideas or suggestions, I'd
> appreciate it.
>
> Thank you,
> Namu
>
>
------------------------------------------------------------------------------
_______________________________________________
Libmesh-users mailing list
Libmesh-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to