Hi, Folks --
We recently ran into a floating point exception coming from
location_maps.C. The problem is that when LIBMESH_DIM is 3 but the mesh
has DIM < 3, _lower_bound[i] == _upper_bound[i] for some dimensions.
Because LocationMap<T>::key() computes, e.g.,
zscaled = (p(2) - _lower_bound[2])/
(_upper_bound[2] - _lower_bound[2]);
if this happens, LocationMap<T>::key() results in a floating point
exception for some choices of compiler/compiler flags.
An easy fix appears to be to offset the bounding box by machine epsilon
when computing the extents, e.g., in LocationMap<T>::init(). It looks
like these values are only used in LocationMap<T>::key(), so this change
appears to be otherwise innocuous. Patch attached.
-- Boyce
Index: src/utils/location_maps.C
===================================================================
--- src/utils/location_maps.C (revision 4142)
+++ src/utils/location_maps.C (working copy)
@@ -80,9 +80,9 @@
{
// Expand the bounding box if necessary
_lower_bound[i] = std::min(_lower_bound[i],
- (*node)(i));
+
(*node)(i)-std::numeric_limits<Real>::epsilon());
_upper_bound[i] = std::max(_upper_bound[i],
- (*node)(i));
+
(*node)(i)+std::numeric_limits<Real>::epsilon());
}
}
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel