Changes in / [70429af:b72091]


Ignore:
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/analysis_correlation.cpp

    r70429af rb72091  
    353353};
    354354
    355 /** Returns the index of the bin for a given value.
     355/** Returns the start of the bin for a given value.
    356356 * \param value value whose bin to look for
    357357 * \param BinWidth width of bin
    358358 * \param BinStart first bin
    359359 */
    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);
     360double GetBin ( 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);
    365365};
    366366
  • src/analysis_correlation.hpp

    r70429af rb72091  
    5151CorrelationToPointMap *PeriodicCorrelationToPoint(MoleculeListClass * const &molecules, const element * const type, const Vector *point, const int ranges[NDIM] );
    5252CorrelationToSurfaceMap *PeriodicCorrelationToSurface(MoleculeListClass * const &molecules, const element * const type, const Tesselation * const Surface, const LinkedCell *LC, const int ranges[NDIM] );
    53 int GetBin ( const double value, const double BinWidth, const double BinStart );
     53double GetBin ( const double value, const double BinWidth, const double BinStart );
    5454void OutputCorrelation( ofstream * const file, const BinPairMap * const map );
    5555void OutputPairCorrelation( ofstream * const file, const PairCorrelationMap * const map );
     
    103103{
    104104  BinPairMap *outmap = new BinPairMap;
    105   int bin = 0;
     105  double bin = 0.;
    106106  double start = 0.;
    107107  double end = 0.;
     
    122122    start = BinStart;
    123123    end = BinEnd;
     124    for (double runner = start; runner <= end; runner += BinWidth)
     125      outmap->insert( pair<double, int> (runner, 0) );
    124126  }
    125   for (int runner = 0; runner <= ceil((end-start)/BinWidth); runner++)
    126     outmap->insert( pair<double, int> ((double)runner*BinWidth+start, 0) );
    127127
    128128  for (typename T::iterator runner = map->begin(); runner != map->end(); ++runner) {
    129129    bin = GetBin (runner->first, BinWidth, start);
    130     BinPairMapInserter = outmap->insert ( pair<double, int> ((double)bin*BinWidth+start, 1) );
     130    BinPairMapInserter = outmap->insert ( pair<double, int> (bin, 1) );
    131131    if (!BinPairMapInserter.second) {  // bin already present, increase
    132132      BinPairMapInserter.first->second += 1;
  • src/linkedcell.cpp

    r70429af rb72091  
    4646  min.Zero();
    4747  Log() << Verbose(1) << "Begin of LinkedCell" << endl;
    48   if ((set == NULL) || (set->IsEmpty())) {
    49     eLog() << Verbose(1) << "set is NULL or contains no linked cell nodes!" << endl;
     48  if (set->IsEmpty()) {
     49    eLog() << Verbose(1) << "set contains no linked cell nodes!" << endl;
    5050    return;
    5151  }
Note: See TracChangeset for help on using the changeset viewer.