Hi Jaekwang,

With what you've shown I'm going to guess that your problem might simply be 
related to numerical / round-off error associated with floating point 
calculations. 

if ( cell->face(f)->center()[0]==1 ) // The LHS value is a computed double, 
> and the RHS value is an integer which will be cast to a double for 
> comparison


Take a look at the mesh-generation part in the introduction to step-2 
<https://www.dealii.org/developer/doxygen/deal.II/step_2.html#Meshgenerationhttps://www.dealii.org/developer/doxygen/deal.II/step_2.html#Meshgeneration>
 for 
how one best implements these types of comparisons. They're particularly 
relevant when dealing with the geometry, especially in more complex 
scenarios. Admittedly the step-2 example is for a circular geometry but the 
same concept applies: 

if ( std::abs(cell->face(f)->center()[0]) < 1e-10 ) ...

if ( std::abs(cell->face(f)->center()[0] - 1.0) < 1e-10 ) ...

You can almost never be certain that any calculated floating point value 
will be an exact match to an implicitly cast integer value right down to 
machine precision, which is what will be checked with the equality operator.
>
>
I hope that this fixes your issue.

Regards,
J-P

-- 
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.

Reply via email to