c_nclasses.c 655 B

12345678910111213141516171819202122232425262728293031323334
  1. /*!
  2. \file cluster/c_nclasses.c
  3. \brief Cluster library - Number of classes
  4. (C) 2001-2009 by the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Original author CERL
  8. */
  9. #include <grass/cluster.h>
  10. /*!
  11. \brief Get number of classes
  12. \param C pointer to Cluster structure
  13. \param minsize minimum class size
  14. \return number of classes
  15. */
  16. int I_cluster_nclasses(struct Cluster *C, int minsize)
  17. {
  18. int i, n;
  19. n = 0;
  20. for (i = 0; i < C->nclasses; i++)
  21. if (C->count[i] >= minsize)
  22. n++;
  23. return n;
  24. }