Exemplo n.º 1
0
void load_fields_on_fft( const Triangulation& T , CH_FFT& fft  ) {

  int Nb = fft.Nx();

  size_t align=fft.alignment();

  c_array ux( Nb , Nb , align );
  c_array uy( Nb , Nb , align );

  for(F_v_it vit=T.vertices_begin();
      vit != T.vertices_end();
      vit++) {

    int nx = vit->nx.val();
    int ny = vit->ny.val();

    // "right" ordering 
    int i = ( Nb - 1 ) - ny ;
    int j = nx;

    // "wrong" ordering
    // int i = nx;
    // int j = ny;
    
    Vector_2 vv =  vit->Uold.val();
    //FT val =  vit->alpha.val();

    ux(i,j) = vv.x();
    uy(i,j) = vv.y();

  }

  fft.set_u( ux , uy );
  
  return;
}
Exemplo n.º 2
0
int quadratic_line_intersection(const double a, const double b, const double c,
                                const double d, const double e, const double f,
                                const Point_2& B, const Vector_2& V,
                                double t[2], Point_2 p_[2])
{
  const double A_ = a*V.x()*V.x()+b*V.x()*V.y()+c*V.y()*V.y();
  const double B_ = 2*a*B.x()*V.x()+b*(B.y()*V.x()+B.x()*V.y())+2*c*B.y()*V.y()+d*V.x()+e*V.y();
  const double C_ = a*B.x()*B.x()+b*B.x()*B.y()+c*B.y()*B.y()+d*B.x()+e*B.y()+f;
  int ret = quadratic(A_, B_, C_, t);
  if (ret == 0) {
    p_[0] = B + t[0]*V;
    p_[1] = p_[0];
  }
  else if (ret == 1) {
    p_[0] = B + t[0]*V;
    p_[1] = B + t[1]*V;
  }
  return ret;
}