$extrastylesheet
LIBMESH_DEFINE_HASH_POINTERS::FuzzyPointCompare Class Reference

List of all members.

Public Member Functions

 FuzzyPointCompare (Real tol)
bool operator() (const Point &lhs, const Point &rhs)
bool operator() (const std::pair< Point, dof_id_type > &lhs, const std::pair< Point, dof_id_type > &rhs)
bool operator() (const Point &lhs, std::pair< Point, dof_id_type > &rhs)
bool operator() (std::pair< Point, dof_id_type > &lhs, const Point &rhs)

Private Attributes

Real _tol

Detailed Description

Definition at line 40 of file serial_mesh.C.


Constructor & Destructor Documentation

Definition at line 47 of file serial_mesh.C.

: _tol(tol) {}

Member Function Documentation

bool LIBMESH_DEFINE_HASH_POINTERS::FuzzyPointCompare::operator() ( const Point lhs,
const Point rhs 
) [inline]

Definition at line 50 of file serial_mesh.C.

References std::abs(), std::max(), and libMesh::Real.

  {
    for (unsigned i=0; i<LIBMESH_DIM; ++i)
      {
        // If the current components are within some tolerance
        // of one another, then don't attempt the less-than comparison.
        // Note that this may cause something strange to happen, as Roy
        // believes he can prove it is not a total ordering...
        Real rel_size = std::max(std::abs(lhs(i)), std::abs(rhs(i)));

        // Don't use relative tolerance if both numbers are already small.
        // How small?  Some possible options are:
        // * std::numeric_limits<Real>::epsilon()
        // * TOLERANCE
        // * 1.0
        // If we use std::numeric_limits<Real>::epsilon(), we'll
        // do more relative comparisons for small numbers, but
        // increase the chance for false positives?  If we pick 1.0,
        // we'll never "increase" the difference between small numbers
        // in the test below.
        if (rel_size < 1.)
          rel_size = 1.;

        // Don't attempt the comparison if lhs(i) and rhs(i) are too close
        // together.
        if ( std::abs(lhs(i) - rhs(i)) / rel_size < _tol)
          continue;

        if (lhs(i) < rhs(i))
          return true;
        if (lhs(i) > rhs(i))
          return false;
      }

    // We compared all the components without returning yet, so
    // each component was neither greater than nor less than they other.
    // They might be equal, so return false.
    return false;
  }
bool LIBMESH_DEFINE_HASH_POINTERS::FuzzyPointCompare::operator() ( const std::pair< Point, dof_id_type > &  lhs,
const std::pair< Point, dof_id_type > &  rhs 
) [inline]

Definition at line 91 of file serial_mesh.C.

  {
    return (*this)(lhs.first, rhs.first);
  }
bool LIBMESH_DEFINE_HASH_POINTERS::FuzzyPointCompare::operator() ( const Point lhs,
std::pair< Point, dof_id_type > &  rhs 
) [inline]

Definition at line 100 of file serial_mesh.C.

  {
    return (*this)(lhs, rhs.first);
  }
bool LIBMESH_DEFINE_HASH_POINTERS::FuzzyPointCompare::operator() ( std::pair< Point, dof_id_type > &  lhs,
const Point rhs 
) [inline]

Definition at line 106 of file serial_mesh.C.

  {
    return (*this)(lhs.first, rhs);
  }

Member Data Documentation

Definition at line 43 of file serial_mesh.C.


The documentation for this class was generated from the following file: