Exemple #1
0
/*
 void TypeOfFE_RT::FB(const Mesh & Th,const Triangle & K,const R2 & PHat,RNMK_ & val) const
{ //  
//  const Triangle & K(FE.T);
  R2 P(K(PHat));
  R2 A(K[0]), B(K[1]),C(K[2]);
  R l0=1-P.x-P.y,l1=P.x,l2=P.y; 
 // R2 Dl0(K.H(0)), Dl1(K.H(1)), Dl2(K.H(2));
  if (val.N() <3) 
   throwassert(val.N() >=3);
  throwassert(val.M()==2 );
  throwassert(val.K()==3 );
  RN_ f0(val('.',0,0)); 
  RN_ f1(val('.',1,0)); 
  val=0;  
//  RN_ df0(val(0,'.',0)); 
//  RN_ fy(val('.','.',2)); 
  //     a_i ([x,y]-c_i) , ou  c_i = A,B , C si i= 0,1,2 
  //   int_T a_i div([x,y]-c_i) = 1
  //    div div([x,y]-c_i) = 2 
  //   donc a_i = 1/(2 area T)
  
  R a=1./(2*K.area);
  R a0=   K.EdgeOrientation(0) * a ;
  R a1=   K.EdgeOrientation(1) * a  ;
  R a2=   K.EdgeOrientation(2) * a ;
 // if (Th(K)< 2) cout << Th(K) << " " <<  A << " "  << B << " " << C << "; " <<  a0 << " " << a1 << " "<< a2 << endl;;

  //  ------------
  f0[0] = (P.x-A.x)*a0;
  f1[0] = (P.y-A.y)*a0;
  
  f0[1] = (P.x-B.x)*a1;
  f1[1] = (P.y-B.y)*a1;
  
  f0[2] = (P.x-C.x)*a2;
  f1[2] = (P.y-C.y)*a2;
  // ----------------
  // ----------------
  // BUG dans RT correct FH le 17 sept 2002 
  //  dx [x,y] = [1,0] et non [1,1]
  //  dy [x,y] = [0,1] et non [1,1] 
  // -------------------------------------
  
  val(0,0,1) =  a0;  
  val(1,0,1) =  a1;  
  val(2,0,1) =  a2;  
  val(0,1,2) =  a0;  
  val(1,1,2) =  a1;  
  val(2,1,2) =  a2;  
  
}
*/
 void TypeOfFE_RT::FB(const bool *whatd,const Mesh & Th,const Triangle & K,const R2 & PHat,RNMK_ & val) const
{ //  
//  const Triangle & K(FE.T);
  R2 P(K(PHat));
  R2 A(K[0]), B(K[1]),C(K[2]);
  // R l0=1-P.x-P.y,l1=P.x,l2=P.y; 
 // R2 Dl0(K.H(0)), Dl1(K.H(1)), Dl2(K.H(2));
  if (val.N() <3) 
   throwassert(val.N() >=3);
  throwassert(val.M()==2 );
//  throwassert(val.K()==3 );
  val=0;     
  R a=1./(2*K.area);
  R a0=   K.EdgeOrientation(0) * a ;
  R a1=   K.EdgeOrientation(1) * a  ;
  R a2=   K.EdgeOrientation(2) * a ;
 // if (Th(K)< 2) cout << Th(K) << " " <<  A << " "  << B << " " << C << "; " <<  a0 << " " << a1 << " "<< a2 << endl;;

  //  ------------
  if (whatd[op_id])
   {
   assert(val.K()>op_id);
  RN_ f0(val('.',0,0)); 
  RN_ f1(val('.',1,0)); 
  f0[0] = (P.x-A.x)*a0;
  f1[0] = (P.y-A.y)*a0;
  
  f0[1] = (P.x-B.x)*a1;
  f1[1] = (P.y-B.y)*a1;
  
  f0[2] = (P.x-C.x)*a2;
  f1[2] = (P.y-C.y)*a2;
  }
  // ----------------
  // BUG dans RT correct FH le 17 sept 2002 
  //  dx [x,y] = [1,0] et non [1,1]
  //  dy [x,y] = [0,1] et non [1,1] 
  // -------------------------------------
    if (whatd[op_dx])
   {
   assert(val.K()>op_dx);
   val(0,0,op_dx) =  a0;  
   val(1,0,op_dx) =  a1;  
   val(2,0,op_dx) =  a2; 
  } 
    if (whatd[op_dy])
   {
    assert(val.K()>op_dy);
    val(0,1,op_dy) =  a0;  
    val(1,1,op_dy) =  a1;  
    val(2,1,op_dy) =  a2;  
  }
}
    void TypeOfFE_PkEdge::FB(const bool * whatd,const Mesh & ,const Triangle & K,const R2 & P,RNMK_ & val) const
    {
      
      R2 A(K[0]), B(K[1]),C(K[2]);
      R l0=1-P.x-P.y,l1=P.x,l2=P.y; 
      R L[3]={l0,l1,l2};
      assert( val.N()>=ndf);
      assert(val.M()==1);
      int ee=0;
      if (L[0] <= min(L[1],L[2]) ) ee=0; // arete  
      else if  (L[1] <= min(L[0],L[2]) ) ee=1;
      else ee=2;
      int e3=ee*npe;
      double s=1.-L[ee];
      R xe = L[VerticesOfTriangularEdge[ee][0]]/s;//  go from 0 to 1 on edge 
      if(K.EdgeOrientation(ee) <0.) 
	xe = 1-xe;
      //cout << P << " ee = " << ee << " xe " << xe << " " << L[ee]<< " s=" <<s  << " orient: " << K.EdgeOrientation(ee) <<endl;
      assert(s);
      val=0; 
      if (whatd[op_id])
	{
	  RN_ f0(val('.',0,op_id)); 
	  for (int l=0;l<npe;l++)
	    {
	      int df= e3+l;
	      R f=1.;
	      for (int i=0;i<npe;++i)
		if(i != l) 
		  f *= (xe-X[i])/(X[l]-X[i]);
	      f0[df] = f;
	    }
	  //cout << " f0 = " << f0 << " X= "<< X << endl;
	}

      
      if(  whatd[op_dx] || whatd[op_dy] || whatd[op_dxx] || whatd[op_dyy] ||  whatd[op_dxy])
	{
	  cerr << " TO DO ???  FH " << endl;
	  ffassert(0);
	}
    }