static inline void apply(Point const& point, Box& mbr)
    {
        Point normalized_point = detail::return_normalized<Point>(point);

        typename point_type<Box>::type box_point;

        // transform units of input point to units of a box point
        transform_units(normalized_point, box_point);

        geometry::set<min_corner, 0>(mbr, geometry::get<0>(box_point));
        geometry::set<min_corner, 1>(mbr, geometry::get<1>(box_point));

        geometry::set<max_corner, 0>(mbr, geometry::get<0>(box_point));
        geometry::set<max_corner, 1>(mbr, geometry::get<1>(box_point));

        envelope_one_point
            <
                2, dimension<Point>::value
            >::apply(normalized_point, mbr);
    }
Ejemplo n.º 2
0
void preProcessSimple1 (pulsar *psr, int tempo1, double thelast)
{  
  logdbg("In preProcessSimple1");

  ECLIPTIC_OBLIQUITY = ECLIPTIC_OBLIQUITY_VAL;

  int i = 0;

  /* Check whitening */
  if (psr->param[param_wave_om].paramSet[0] == 1 && psr->param[param_wave_om].val[0] == 0.0) /* Set fundamental frequency */
    {  
      longdouble first=-1,last=-1;
      for (i=0;i<psr->nobs;i++)
	{
	  if (psr->obsn[i].deleted==0 && first==-1) first=psr->obsn[i].sat;
	  if (psr->obsn[i].deleted==0 && last==-1)  last=psr->obsn[i].sat;
	  if (psr->obsn[i].deleted==0 && psr->obsn[i].sat < first) first = psr->obsn[i].sat;
	  if (psr->obsn[i].deleted==0 && psr->obsn[i].sat > last)   last = psr->obsn[i].sat;
	}
      psr->param[param_wave_om].val[0] = 2.0*M_PI/(last-first)/
	(1.0+4.0/(double)(psr->nWhite));
      fprintf(stderr, "%.3e\n",   psr->param[param_wave_om].val[0]);
     
    }


   /* Check whitening */
  if (psr->param[param_wave_dm].paramSet[0] == 1 && psr->param[param_wave_dm].val[0] == 0.0) /* Set fundamental frequency */
    {  
      longdouble first=-1,last=-1;
      for (i=0;i<psr->nobs;i++)
	{
	  if (psr->obsn[i].deleted==0 && first==-1) first=psr->obsn[i].sat;
	  if (psr->obsn[i].deleted==0 && last==-1)  last=psr->obsn[i].sat;
	  if (psr->obsn[i].deleted==0 && psr->obsn[i].sat < first) first = psr->obsn[i].sat;
	  if (psr->obsn[i].deleted==0 && psr->obsn[i].sat > last)   last = psr->obsn[i].sat;
	}
      psr->param[param_wave_dm].val[0] = 2.0*M_PI/(last-first)/
	(1.0+4.0/(double)(psr->nWhite));
    }



  /* Set tempo emulation mode */
  if (psr->param[param_ephver].paramSet[0]==1)
    {
      if (psr->param[param_ephver].val[0] < 5)
	{
	  printf("************************************************* \n");
	  printf("Warning: you are running in tempo1 emulation mode \n");
	  printf("************************************************* \n");
	  tempo1 = 1;
	}
      else
	tempo1 = 0;
    }
  else if (tempo1 == 1)
    {
      psr->param[param_ephver].paramSet[0]=1;
      psr->param[param_ephver].val[0]=2;
    }
  else 
    {
      psr->param[param_ephver].paramSet[0]=1;
      psr->param[param_ephver].val[0]=5;
    }
  if (thelast>0)
    /* Define the start parameter based upon the last observation */
    {
      psr->param[param_start].val[0] = psr->obsn[psr->nobs-1].sat-thelast;
      psr->param[param_start].fitFlag[0] = 1;
      psr->param[param_start].paramSet[0] = 1;
    }

  psr->tempo1 = 0;
  if (tempo1 == 1)
    {
      psr->tempo1 = 1;
      psr->units = TDB_UNITS;
      psr->timeEphemeris = FB90_TIMEEPH;
      psr->dilateFreq = 0;
      psr->planetShapiro=0;
      psr->t2cMethod = T2C_TEMPO;
      psr->correctTroposphere = 0;
      psr->ne_sw = 9.961;
      ECLIPTIC_OBLIQUITY = 84381.412;
    }
  /* XXXX Hack!! -- removed - should use transform plugin*/
  /* Problem, if a function is not called then the compiler does not include
   * it in the library - so the plugin cannot find it */
  if (psr->units==100) /* SI_UNITS)  */
    transform_units(psr, TDB_UNITS, SI_UNITS);
}