--- trunk/src/applications/staticProps/RadialDistrFunc.cpp 2005/02/15 15:24:54 346 +++ trunk/src/applications/staticProps/RadialDistrFunc.cpp 2005/02/15 17:11:35 347 @@ -60,6 +60,19 @@ RadialDistrFunc:: RadialDistrFunc(SimInfo* info seleMan2_.setSelectionSet(evaluator2_.evaluate()); } + if (!evaluator1_.isDynamic() && !evaluator2_.isDynamic()) { + //if all selections are static, we can precompute the number of real pairs + + int nSelected1 = seleMan1_->getSelectionCount(); + int nSelected2 = seleMan2_->getSelectionCount(); + + BitSet bs = seleMan1_.getSelectionSet(); + bs &= seleMan2_.getSelectionSet(); + int nIntersect = bs.countBits(); + + nRealPairs_ = nSelected1 * nSelected2 - (nIntersect +1) * nIntersect/2; + } + } void RadialDistrFunc::process() { @@ -101,7 +114,9 @@ void RadialDistrFunc::process() { StuntDouble* sd2; int k; for (sd2 = seleMan2_.beginSelected(k); sd2 != NULL; sd2 = seleMan2_.nextSelected(k)) { - collectHistogram(sd1, sd2); + if (sd1 != sd2) { + collectHistogram(sd1, sd2); + } } } @@ -114,4 +129,21 @@ void RadialDistrFunc::process() { writeRdf(); } +int RadialDistrFunc::getNRealPairs() { + if (evaluator1_.isDynamic() || evaluator2_.isDynamic()) { + //if one of the selection is static, need to recompute it + + int nSelected1 = seleMan1_->getSelectionCount(); + int nSelected2 = seleMan2_->getSelectionCount(); + + BitSet bs = seleMan1_.getSelectionSet(); + bs &= seleMan2_.getSelectionSet(); + int nIntersect = bs.countBits(); + + nRealPairs_ = nSelected1 * nSelected2 - (nIntersect +1) * nIntersect/2; + } + + return nRealPairs_ } + +}