Changeset 296798 for molecuilder
- Timestamp:
- Mar 3, 2010, 7:17:49 PM (15 years ago)
- Children:
- 1540c8c
- Parents:
- 3d575e (diff), b1c92e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- molecuilder/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/analysis_correlation.cpp
r3d575e r296798 353 353 }; 354 354 355 /** Returns the startof the bin for a given value.355 /** Returns the index of the bin for a given value. 356 356 * \param value value whose bin to look for 357 357 * \param BinWidth width of bin 358 358 * \param BinStart first bin 359 359 */ 360 doubleGetBin ( const double value, const double BinWidth, const double BinStart )361 { 362 Info FunctionInfo(__func__); 363 double bin =(double) (floor((value - BinStart)/BinWidth));364 return (bin *BinWidth+BinStart);360 int GetBin ( const double value, const double BinWidth, const double BinStart ) 361 { 362 Info FunctionInfo(__func__); 363 int bin =(int) (floor((value - BinStart)/BinWidth)); 364 return (bin); 365 365 }; 366 366 -
molecuilder/src/analysis_correlation.hpp
r3d575e r296798 51 51 CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] ); 52 52 CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] ); 53 doubleGetBin ( const double value, const double BinWidth, const double BinStart );53 int GetBin ( const double value, const double BinWidth, const double BinStart ); 54 54 void OutputCorrelation( ofstream * const file, const BinPairMap * const map ); 55 55 void OutputPairCorrelation( ofstream * const file, const PairCorrelationMap * const map ); … … 103 103 { 104 104 BinPairMap *outmap = new BinPairMap; 105 double bin = 0.;105 int bin = 0; 106 106 double start = 0.; 107 107 double end = 0.; … … 122 122 start = BinStart; 123 123 end = BinEnd; 124 for (double runner = start; runner <= end; runner += BinWidth)125 outmap->insert( pair<double, int> (runner, 0) );126 124 } 125 for (int runner = 0; runner <= ceil((end-start)/BinWidth); runner++) 126 outmap->insert( pair<double, int> ((double)runner*BinWidth+start, 0) ); 127 127 128 128 for (typename T::iterator runner = map->begin(); runner != map->end(); ++runner) { 129 129 bin = GetBin (runner->first, BinWidth, start); 130 BinPairMapInserter = outmap->insert ( pair<double, int> ( bin, 1) );130 BinPairMapInserter = outmap->insert ( pair<double, int> ((double)bin*BinWidth+start, 1) ); 131 131 if (!BinPairMapInserter.second) { // bin already present, increase 132 132 BinPairMapInserter.first->second += 1;
Note:
See TracChangeset
for help on using the changeset viewer.