示例#1
0
void Pulsar::ComponentModel::evaluate (float *vals,
				       unsigned nvals, int icomp_selected) 
{
  //Construct the summed model
  SumRule< Univariate<Scalar> > m; 
  if (icomp_selected >= 0)
  {
    check ("evaluate", icomp_selected);
    m += components[icomp_selected];
  }
  else
  {
    for (unsigned icomp=0; icomp < components.size(); icomp++)
      m += components[icomp];
  }

  // evaluate
  Axis<double> argument;  
  m.set_argument (0, &argument);

  for (unsigned i=0; i < nvals; i++)
  { 
    argument.set_value( (i+0.5)/nvals * 2*M_PI );
    vals[i] = m.evaluate();
  }
}
void Pulsar::ComponentModel::evaluate (float *vals,
				       unsigned nvals, int icomp_selected) 
{
  double phase_offset = 0;
  if (report_absolute_phases)
    phase_offset = phase->get_value().val;

  if (verbose)
    cerr << "Pulsar::ComponentModel::evaluate"
      " phase_offset=" << phase_offset/(2*M_PI) << " turns" << endl;
  
  //Construct the summed model
  SumRule< Univariate<Scalar> > m; 
  if (icomp_selected >= 0)
  {
    check ("evaluate", icomp_selected);
    m += components[icomp_selected];
  }
  else
  {
    for (unsigned icomp=0; icomp < components.size(); icomp++)
      m += components[icomp];
  }

  // evaluate
  Axis<double> argument;  
  m.set_argument (0, &argument);

  for (unsigned i=0; i < nvals; i++)
  { 
    argument.set_value( (i+0.5)/nvals * 2*M_PI + phase_offset );
    vals[i] = m.evaluate();
  }
}