| 68 | 
  | 
  SimInfo::MoleculeIterator mi; | 
| 69 | 
  | 
  Molecule::RigidBodyIterator rbIter; | 
| 70 | 
  | 
   | 
| 71 | 
+ | 
  counts_.clear(); | 
| 72 | 
+ | 
  counts_.resize(10, 0); | 
| 73 | 
  | 
  DumpReader reader(info_, dumpFilename_);     | 
| 74 | 
  | 
  int nFrames = reader.getNFrames(); | 
| 75 | 
+ | 
  unsigned long int nsum = 0; | 
| 76 | 
+ | 
  unsigned long int n2sum = 0; | 
| 77 | 
+ | 
 | 
| 78 | 
  | 
  for (int i = 0; i < nFrames; i += step_) { | 
| 79 | 
  | 
    reader.readFrame(i); | 
| 80 | 
  | 
    currentSnapshot_ = info_->getSnapshotManager()->getCurrentSnapshot(); | 
| 92 | 
  | 
        seleMan_.setSelectionSet(evaluator_.evaluate()); | 
| 93 | 
  | 
    } | 
| 94 | 
  | 
         | 
| 95 | 
< | 
    int count = 0; | 
| 91 | 
< | 
    int k;  | 
| 95 | 
> | 
    int count = seleMan_.getSelectionCount(); | 
| 96 | 
  | 
 | 
| 97 | 
< | 
    for (StuntDouble* sd = seleMan_.beginSelected(k);  | 
| 98 | 
< | 
         sd != NULL; sd = seleMan_.nextSelected(k)) { | 
| 95 | 
< | 
      count++; | 
| 97 | 
> | 
    if (counts_.size() <= count)  { | 
| 98 | 
> | 
      counts_.resize(count, 0); | 
| 99 | 
  | 
    } | 
| 100 | 
< | 
     | 
| 98 | 
< | 
    if (counts_.size() < count) counts_.resize(count); | 
| 100 | 
> | 
 | 
| 101 | 
  | 
    counts_[count]++; | 
| 102 | 
+ | 
 | 
| 103 | 
+ | 
    nsum += count; | 
| 104 | 
+ | 
    n2sum += count * count; | 
| 105 | 
  | 
  } | 
| 106 | 
  | 
    | 
| 107 | 
  | 
  int nProcessed = nFrames /step_; | 
| 108 | 
  | 
 | 
| 104 | 
– | 
  vector<int>::iterator it; | 
| 105 | 
– | 
  unsigned long int n; | 
| 106 | 
– | 
  unsigned long int nsum = 0; | 
| 107 | 
– | 
  unsigned long int n2sum = 0; | 
| 108 | 
– | 
  for (it = counts_.begin(); it != counts_.end(); ++it) { | 
| 109 | 
– | 
    n = (*it); | 
| 110 | 
– | 
    nsum += n; | 
| 111 | 
– | 
    n2sum += n*n; | 
| 112 | 
– | 
  } | 
| 113 | 
– | 
 | 
| 109 | 
  | 
  nAvg = nsum / nProcessed; | 
| 110 | 
  | 
  n2Avg = n2sum / nProcessed; | 
| 111 | 
  | 
  sDev = sqrt(n2Avg - nAvg*nAvg); | 
| 120 | 
  | 
      ofs << "# <N> = "<< nAvg << "\n"; | 
| 121 | 
  | 
      ofs << "# <N^2> = " << n2Avg << "\n"; | 
| 122 | 
  | 
      ofs << "# sqrt(<N^2> - <N>^2)  = " << sDev << "\n"; | 
| 123 | 
< | 
      ofs << "# N\tcount(N)\n"; | 
| 129 | 
< | 
       | 
| 123 | 
> | 
      ofs << "# N\tcounts[N]\n"; | 
| 124 | 
  | 
      for (int i = 0; i < counts_.size(); ++i) { | 
| 125 | 
< | 
        ofs << i <<"\t" << counts_[i]<< std::endl; | 
| 126 | 
< | 
      }         | 
| 125 | 
> | 
        ofs << i << "\t" << counts_[i] << "\n"; | 
| 126 | 
> | 
      } | 
| 127 | 
> | 
       | 
| 128 | 
  | 
    } else { | 
| 129 | 
  | 
       | 
| 130 | 
  | 
      sprintf(painCave.errMsg, "ObjectCount: unable to open %s\n", outputFilename_.c_str()); |