On Mon, 16 Jun 2008, Benjamin Kirk wrote:

>> If there's anything that's confusing you now, it'll probably be
>> confusing me a year from now when I reread the same source after
>> having forgotten the process of writing it.

You know, you two are only illustrating my point via the underhanded
trick of pulling out code that I wrote one or two years ago.

>      if (h_flag_me &&
>          (neighbor->level() < my_level) ||
>          ((neighbor->active()) &&
>           (neighbor->refinement_flag() != Elem::REFINE))
>              || (neighbor->refinement_flag() ==
>                  Elem::COARSEN_INACTIVE))
>            {
>
>
> I'm not sure that any amount of ()'s will preclude the need for a long, hard
> stare to figure this one out.

Adding more parenthesis won't help this, but fixing the parentheses
that are already there might.  On first glance it looks to me like
this line isn't just uncommented, it's wrong.  I'd say that we can't
possibly have a bug here that's getting past our
"find_unrefined_islands" unit tests, but then I remembered that we
don't have any MeshRefinement unit tests.  Or any Mesh unit tests yet,
for that matter.

How's this, for both code and comments?

// If the neighbor will be equally or less refined than
// we are, then we will not become an unrefined island.
// So if we are still considering h refinement:
if (h_flag_me &&
   // If our neighbor is already at a lower level,
   // it can't end up at a higher level even if it
   // is flagged for refinement once
    ((neighbor->level < my_level) ||
   // If our neighbor is at the same level but isn't
   // flagged for refinement, it won't end up at a
   // higher level
    ((neighbor->active()) &&
     (neighbor->refinement_flag() != Elem::REFINE)) ||
   // If our neighbor is currently more refined but is
   // a parent flagged for coarsening, it will end up
   // at the same level.
    (neighbor->refinement_flag() == Elem::COARSEN_INACTIVE)))
   {
     // We've proven we won't become an unrefined island,
     // so don't h refine to avoid that.
     h_flag_me = false;

     // If we've also proven we don't need to p refine,
     // we don't need to check more neighbors
     if (!p_flag_me)
       break;
   }


---
Roy

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to