Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linkedcell.cpp

    rbdc91e r36166d  
    1010#include "helpers.hpp"
    1111#include "linkedcell.hpp"
     12#include "verbose.hpp"
    1213#include "log.hpp"
    1314#include "molecule.hpp"
     
    187188    N[i] = 0;
    188189  index = -1;
     190  max.Zero();
     191  min.Zero();
    189192};
    190193
     
    197200  for(int i=0;i<NDIM;i++)
    198201    status = status && ((n[i] >=0) && (n[i] < N[i]));
    199 //  if (!status)
    200 //    DoeLog(1) && (eLog()<< Verbose(1) << "indices are out of bounds!" << endl);
     202  if (!status)
     203  DoeLog(1) && (eLog()<< Verbose(1) << "indices are out of bounds!" << endl);
    201204  return status;
    202205};
     
    277280
    278281/** Calculates the interval bounds of the linked cell grid.
    279  * \param lower lower bounds
    280  * \param upper upper bounds
     282 * \param *lower lower bounds
     283 * \param *upper upper bounds
    281284 * \param step how deep to check the neighbouring cells (i.e. number of layers to check)
    282285 */
     
    284287{
    285288  for (int i=0;i<NDIM;i++) {
    286     lower[i] = n[i]-step;
    287     if (lower[i] < 0)
    288       lower[i] = 0;
    289     if (lower[i] >= N[i])
    290       lower[i] = N[i]-1;
    291     upper[i] = n[i]+step;
    292     if (upper[i] >= N[i])
    293       upper[i] = N[i]-1;
    294     if (upper[i] < 0)
    295       upper[i] = 0;
     289    lower[i] = n[i];
     290    for (int s=step; s>0;--s)
     291      if ((n[i]-s) >= 0) {
     292        lower[i] = n[i]-s;
     293        break;
     294      }
     295    upper[i] = n[i];
     296    for (int s=step; s>0;--s)
     297      if ((n[i]+s) < N[i]) {
     298        upper[i] = n[i]+s;
     299        break;
     300      }
    296301    //Log() << Verbose(0) << "axis " << i << " has bounds [" << lower[i] << "," << upper[i] << "]" << endl;
    297302  }
Note: See TracChangeset for help on using the changeset viewer.