packages/MC/geometry/Cartesian_Mesh.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Small private function to return index with sign.
 *
 * If val is less than or equal to the first element, the result is -1; if
 * greater than the last element, the result is N.
 */
\brief Small private function to return index with sign.
If val is less than or equal to the first element, the result is -1; if
greater than the last element, the result is N.
\ brief Small private function to return index with sign . If val is less than or equal to the first element the result is - 1 ; if greater than the last element the result is N .
inline int edge_signed_index(const std::vector<double>& edges,
                             double                     val)
{
    std::vector<double>::const_iterator result =
        std::lower_bound(edges.begin(), edges.end(), val);
    CHECK(result != edges.end());
    if (*result != val)
    {
        return result - edges.begin() - 1;
    }
    else
    {
        return edges.begin() - result;
    }
}
inline int edge_signed_index ( const std :: vector < double > & edges , double val ) { std :: vector < double > :: const_iterator result = std :: lower_bound ( edges . begin ( ) , edges . end ( ) , val ) ; CHECK ( result != edges . end ( ) ) ; if ( * result != val ) { return result - edges . begin ( ) - 1 ; } else { return edges . begin ( ) - result ; } }
\brief Small private function to return index with sign.
\ brief Small private function to return index with sign .
// not on an edge: positive cell // not on an edge: negative cell