| 44 |  | * | 
| 45 |  | *  Created by Xiuquan Sun on 05/09/06. | 
| 46 |  | *  @author  Xiuquan Sun | 
| 47 | < | *  @version $Id: Hxy.cpp,v 1.3 2006-05-16 20:38:23 gezelter Exp $ | 
| 47 | > | *  @version $Id: Hxy.cpp,v 1.4 2006-05-17 21:51:42 tim Exp $ | 
| 48 |  | * | 
| 49 |  | */ | 
| 50 |  |  | 
| 92 |  | int nFrames = reader.getNFrames(); | 
| 93 |  | nProcessed_ = nFrames/step_; | 
| 94 |  |  | 
| 95 | < | std::vector<double> mag, newmag; | 
| 96 | < | double lenX_, lenY_; | 
| 97 | < | double gridX_, gridY_; | 
| 98 | < | double halfBoxX_, halfBoxY_; | 
| 95 | > | std::vector<RealType> mag, newmag; | 
| 96 | > | RealType lenX_, lenY_; | 
| 97 | > | RealType gridX_, gridY_; | 
| 98 | > | RealType halfBoxX_, halfBoxY_; | 
| 99 |  | int binNoX, binNoY; | 
| 100 | < | double interpsum, value; | 
| 100 | > | RealType interpsum, value; | 
| 101 |  | int ninterp, px, py, newp; | 
| 102 |  | int newx, newy, newindex, index; | 
| 103 |  | int new_i, new_j, new_index; | 
| 104 | < | double freq_x, freq_y, zero_freq_x, zero_freq_y, freq; | 
| 105 | < | double maxfreqx, maxfreqy, maxfreq, dfreq; | 
| 104 | > | RealType freq_x, freq_y, zero_freq_x, zero_freq_y, freq; | 
| 105 | > | RealType maxfreqx, maxfreqy, maxfreq, dfreq; | 
| 106 |  | int whichbin; | 
| 107 |  | int nMolecules; | 
| 108 |  |  | 
| 158 |  | gridX_ = lenX_ /(nBinsX_); | 
| 159 |  | gridY_ = lenY_ /(nBinsY_); | 
| 160 |  |  | 
| 161 | < | double halfBoxX_ = lenX_ / 2.0; | 
| 162 | < | double halfBoxY_ = lenY_ / 2.0; | 
| 161 | > | RealType halfBoxX_ = lenX_ / 2.0; | 
| 162 | > | RealType halfBoxY_ = lenY_ / 2.0; | 
| 163 |  |  | 
| 164 |  | if (evaluator_.isDynamic()) { | 
| 165 |  | seleMan_.setSelectionSet(evaluator_.evaluate()); | 
| 198 |  | for(j = 0; j < nBinsY_; j++){ | 
| 199 |  | newindex = i * nBinsY_ + j; | 
| 200 |  | if(gridsample_[newindex] > 0){ | 
| 201 | < | gridZ_[newindex] = gridZ_[newindex] / (double)gridsample_[newindex]; | 
| 201 | > | gridZ_[newindex] = gridZ_[newindex] / (RealType)gridsample_[newindex]; | 
| 202 |  | } | 
| 203 |  | } | 
| 204 |  | } | 
| 252 |  | ninterp++; | 
| 253 |  | } | 
| 254 |  |  | 
| 255 | < | value = interpsum / (double)ninterp; | 
| 255 | > | value = interpsum / (RealType)ninterp; | 
| 256 |  |  | 
| 257 |  | gridZ_[newindex] = value; | 
| 258 |  | } | 
| 333 |  | //  printf("%lf\t%lf\t%lf\t%lf\n", dx, dy, maxfreqx, maxfreqy); | 
| 334 |  |  | 
| 335 |  | maxfreq = sqrt(maxfreqx*maxfreqx + maxfreqy*maxfreqy); | 
| 336 | < | dfreq = maxfreq/(double)(nbins_-1); | 
| 336 | > | dfreq = maxfreq/(RealType)(nbins_-1); | 
| 337 |  |  | 
| 338 |  | //printf("%lf\n", dfreq); | 
| 339 |  |  | 
| 343 |  | for (i=0; i< nBinsX_; i++) { | 
| 344 |  | for(j=0; j< nBinsY_; j++) { | 
| 345 |  |  | 
| 346 | < | freq_x = (double)(i - zero_freq_x)*maxfreqx*2 / nBinsX_; | 
| 347 | < | freq_y = (double)(j - zero_freq_y)*maxfreqy*2 / nBinsY_; | 
| 346 | > | freq_x = (RealType)(i - zero_freq_x)*maxfreqx*2 / nBinsX_; | 
| 347 | > | freq_y = (RealType)(j - zero_freq_y)*maxfreqy*2 / nBinsY_; | 
| 348 |  |  | 
| 349 |  | freq = sqrt(freq_x*freq_x + freq_y*freq_y); | 
| 350 |  |  | 
| 358 |  |  | 
| 359 |  | for ( i = 0; i < nbins_; i++) { | 
| 360 |  | if ( samples[i][istep] > 0) { | 
| 361 | < | bin[i][istep] = 4.0 * sqrt(bin[i][istep] / (double)samples[i][istep]) / (double)nMolecules; | 
| 361 | > | bin[i][istep] = 4.0 * sqrt(bin[i][istep] / (RealType)samples[i][istep]) / (RealType)nMolecules; | 
| 362 |  | } | 
| 363 |  | } | 
| 364 |  |  | 
| 369 |  | sum_bin[i] += bin[i][j]; | 
| 370 |  | sum_bin_sq[i] += bin[i][j] * bin[i][j]; | 
| 371 |  | } | 
| 372 | < | avg_bin[i] = sum_bin[i] / (double)nFrames; | 
| 373 | < | avg_bin_sq[i] = sum_bin_sq[i] / (double)nFrames; | 
| 372 | > | avg_bin[i] = sum_bin[i] / (RealType)nFrames; | 
| 373 | > | avg_bin_sq[i] = sum_bin_sq[i] / (RealType)nFrames; | 
| 374 |  | for (int j = 0; j < nFrames; j++) { | 
| 375 |  | errbin_sum[i] += pow((bin[i][j] - avg_bin[i]), 2); | 
| 376 |  | errbin_sum_sq[i] += pow((bin[i][j] * bin[i][j] - avg_bin_sq[i]), 2); | 
| 377 |  | } | 
| 378 | < | errbin[i] = sqrt( errbin_sum[i] / (double)nFrames ); | 
| 379 | < | errbin_sq[i] = sqrt( errbin_sum_sq[i] / (double)nFrames ); | 
| 378 | > | errbin[i] = sqrt( errbin_sum[i] / (RealType)nFrames ); | 
| 379 | > | errbin_sq[i] = sqrt( errbin_sum_sq[i] / (RealType)nFrames ); | 
| 380 |  | } | 
| 381 |  |  | 
| 382 |  | printSpectrum(); |