Bayesian clustering of curves and the search of the partition space