packages/SPn/spn/Isotropic_Source.cc
//---------------------------------------------------------------------------//
/*!
 * \brief Verify that the sources have been assigned.
 */
\brief Verify that the sources have been assigned.
\ brief Verify that the sources have been assigned .
bool Isotropic_Source::verify() const
{
    if (d_shapes.empty()) return false;
    int num_groups = d_shapes[0].size();
    for (int i = 0, N = d_shapes.size(); i < N; i++)
        if (d_shapes[i].size() != num_groups) return false;
    if (d_ids.empty())
        return false;
    ID_Field::const_iterator min = std::min_element(d_ids.begin(), d_ids.end());
    ID_Field::const_iterator max = std::max_element(d_ids.begin(), d_ids.end());
    if (*min < 0)
        return false;
    if (*max >= d_shapes.size())
        return false;
    if (d_ids.size() != d_source.size()) return false;
    return true;
}
bool Isotropic_Source :: verify ( ) const { if ( d_shapes . empty ( ) ) return false ; int num_groups = d_shapes [ 0 ] . size ( ) ; for ( int i = 0 , N = d_shapes . size ( ) ; i < N ; i ++ ) if ( d_shapes [ i ] . size ( ) != num_groups ) return false ; if ( d_ids . empty ( ) ) return false ; ID_Field :: const_iterator min = std :: min_element ( d_ids . begin ( ) , d_ids . end ( ) ) ; ID_Field :: const_iterator max = std :: max_element ( d_ids . begin ( ) , d_ids . end ( ) ) ; if ( * min < 0 ) return false ; if ( * max >= d_shapes . size ( ) ) return false ; if ( d_ids . size ( ) != d_source . size ( ) ) return false ; return true ; }
\brief Verify that the sources have been assigned.
\ brief Verify that the sources have been assigned .
// make sure shapes have been assigned // make sure the number of groups is consistent // check the min and max elements in the ids to make sure they are in // range