Example #1
0
static void test(buffer *buf)
{
  const double *const x_base[D]=INITD(testx,testx+1,testx+2);
  const unsigned x_stride[D]=
    INITD(D*sizeof(double),D*sizeof(double),D*sizeof(double));
  struct findpts_local_data fld;
  rand_mesh();
  test_mesh();
  findpts_local_setup(&fld,elx,nr,NEL,mr,BBOX_TOL,MAX_HASH_SIZE,
                      NPT_MAX,NEWT_TOL);
  findpts_local(&testp[0].code , sizeof(struct pt_data),
                &testp[0].el   , sizeof(struct pt_data),
                 testp[0].r    , sizeof(struct pt_data),
                &testp[0].dist2, sizeof(struct pt_data),
                x_base, x_stride,
                NEL*MULD(TN,TN,TN), &fld, buf);
  findpts_local_free(&fld);
  print_ptdata();
}
avtIVPField::Result
avtIVPNek5000Field::operator()( const double &t,
                                const avtVector &p,
                                avtVector &vec ) const
{
  // These are return values.
  unsigned long code_base[1], el_base[1];
  double r_base[3], dist2_base[1];

  // Stuff the one point into the array for findpts.
  double xpt[3] = { p[0], p[1], p[2] };
  double * const x_base[3] = { &(xpt[0]), &(xpt[1]), &(xpt[2]) };

  // Strides for all of the return data.
  unsigned int x_stride[3] = { 3*sizeof( double ),
                               3*sizeof( double ),
                               3*sizeof( double ) };

  unsigned int  code_stride = sizeof( unsigned long );
  unsigned int    el_stride = sizeof( unsigned long );
  unsigned int    r_stride = 3 * sizeof( double );
  unsigned int dist2_stride = sizeof( double );
  unsigned int out_stride = sizeof( double );

  unsigned long npts = 1;

  // Translate world space coordinates into the spectral parameteric
  // coordinate space.
  findpts_local( code_base,  code_stride,
                 el_base,    el_stride,
                 r_base,     r_stride,
                 dist2_base, dist2_stride,
                 x_base,     x_stride,
                 npts, nek_fld );

  // Now loop through each coordinate and do the appropriate
  // interpolation.
  for( unsigned int i=0; i<3; ++i )
  {
    double tmp;

    findpts_local_eval( &tmp,    out_stride,
                        el_base, el_stride,
                        r_base,  r_stride,
                        npts, nek_vec[i], nek_fld );

    vec[i] = tmp;
  }

  return OK;
    // static int el = 0; // element

    // // Locate the cell that surrounds the point.
    // avtInterpolationWeights iw[8];

    // double xpt[3];

    // xpt[0] = p[0];
    // xpt[1] = p[1];
    // xpt[2] = p[2];

    // el = loc->FindCell( xpt, iw, false );

    // if( el < 0 )
    //   return OUTSIDE_SPATIAL;

    // // The above element is based on the linear mesh not the spectral
    // // element mesh so find the element in the spectral mesh.

    // // Note this is integer arthimetic. 
    // el /= hexes_per_element;

    //return avtIVPVTKField::operator()( t, p, vec );
}