// $Id: fixgrid_spiketuft.hoc,v 1.1 2007/03/16 02:17:07 ted Exp ted $

/*
Ensure that the spatial grid is appropriate for "bracketing simulations"
1.  Turn off Continuous Create
2.  Double Ra and cm
3.  Regrid the model using d_lambda rule
4.  Finally, restore original Ra and cm
*/

CellBuild[0].continuous = 0

forall {
  Ra*=2
  for (x,0) cm(x)*=2
}

// assumes using standard library so lambda_f() is known

proc geom_nseg() {
// why forsec all, and not just forall?
// if all is ever not all-inclusive, this is a bug waiting to happen
//  forsec all { nseg = int((L/(0.1*lambda_f(100))+.9)/2)*2 + 1  }
  forall { nseg = int((L/(0.1*lambda_f(100))+.9)/2)*2 + 1  }
}

geom_nseg()

forall {
  Ra/=2
  for (x,0) cm(x)/=2
}