int GaussLegendreTri(int n1,int n2,double GLr[][3],double *GLwt) {
  /* get degenerate n1Xn2 Gauss-Legendre scheme to integrate over a tet */
  int i,j,index=0;
  double *pt1,*pt2,*wt1,*wt2,dJ;
  const double two = 2.0000000000000000;

  GaussLegendre1D(n1,&pt1,&wt1);
  GaussLegendre1D(n2,&pt2,&wt2);
  for(i=0; i < n1; i++) {
    for(j=0; j < n2; j++) {
      quadToTri(pt1[i],pt2[j],&GLr[index][0],&GLr[index][1],&dJ);
      GLr[index][2] = 1.0e0-GLr[index][0]-GLr[index][1];
      GLwt[index++] = dJ*wt1[i]*wt2[j]*two;
    }
  }
  return index;
}
int GaussLegendreTri(int n1,int n2,IntPt *pts) 
{
  /* get degenerate n1Xn2 Gauss-Legendre scheme to integrate over a tri */
  int i,j,index=0;
  double *pt1,*pt2,*wt1,*wt2,dJ;
  //const double two = 2.0000000000000000;

  gmshGaussLegendre1D(n1,&pt1,&wt1);
  gmshGaussLegendre1D(n2,&pt2,&wt2);
  for(i=0; i < n1; i++) {
    for(j=0; j < n2; j++) {
      quadToTri(pt1[i],pt2[j],&(pts[index].pt[0]),&(pts[index].pt[1]),&dJ);
      pts[index].pt[2] = 0;
      pts[index++].weight = dJ*wt1[i]*wt2[j];
    }
  }
  return index;
}