Exemplo n.º 1
0
int check_times2(real t, real t0, gmx_bool bDouble)
{
    int  r;

#if !GMX_DOUBLE
    /* since t is float, we can not use double precision for bRmod */
    bDouble = FALSE;
#endif

    r = -1;
    if ((!bTimeSet(TBEGIN) || (t >= rTimeValue(TBEGIN)))  &&
        (!bTimeSet(TEND)   || (t <= rTimeValue(TEND))))
    {
        if (bTimeSet(TDELTA) && !bRmod_fd(t, t0, rTimeValue(TDELTA), bDouble))
        {
            r = -1;
        }
        else
        {
            r = 0;
        }
    }
    else if (bTimeSet(TEND) && (t >= rTimeValue(TEND)))
    {
        r = 1;
    }
    if (debug)
    {
        fprintf(debug, "t=%g, t0=%g, b=%g, e=%g, dt=%g: r=%d\n",
                t, t0, rTimeValue(TBEGIN), rTimeValue(TEND), rTimeValue(TDELTA), r);
    }
    return r;
}
Exemplo n.º 2
0
int check_times2(real t,real t0,real tp, real tpp, bool bDouble)
{
  int  r;
  real margin;
  
#ifndef GMX_DOUBLE
  /* since t is float, we can not use double precision for bRmod */
  bDouble = FALSE;
#endif

  if (t-tp>0 && tp-tpp>0)
    margin = 0.1*min(t-tp,tp-tpp);
  else
    margin = 0;

  r=-1;
  if ((!bTimeSet(TBEGIN) || (t >= rTimeValue(TBEGIN)))  &&
      (!bTimeSet(TEND)   || (t <= rTimeValue(TEND)))) {
    if (bTimeSet(TDELTA) && !bRmod_fd(t,t0,rTimeValue(TDELTA),bDouble))
      r = -1;
    else
      r = 0;
  }
  else if (bTimeSet(TEND) && (t >= rTimeValue(TEND)))
    r = 1;
  if (debug) 
    fprintf(debug,"t=%g, t0=%g, b=%g, e=%g, dt=%g: r=%d\n",
	    t,t0,rTimeValue(TBEGIN),rTimeValue(TEND),rTimeValue(TDELTA),r);
  return r;
}