Example #1
0
IntPt *getGQPriPts(int order)
{
  int nLin = (order+3)/2;
  int nTri = getNGQTPts(order);
  int n = nLin*nTri;
  int index = order;
  if (order >= (int)(sizeof(GQP) / sizeof(IntPt*)))
    Msg::Fatal("Increase size of GQP in gauss quadrature prism");
  if(!GQP[index]){
    double *linPt,*linWt;
    IntPt *triPts = getGQTPts(order);
    gmshGaussLegendre1D(nLin,&linPt,&linWt);
    GQP[index] = new IntPt[n];
    int l = 0;
    for(int i=0; i < nTri; i++) {
      for(int j=0; j < nLin; j++) {
        GQP[index][l].pt[0] = triPts[i].pt[0];
        GQP[index][l].pt[1] = triPts[i].pt[1];
        GQP[index][l].pt[2] = linPt[j];
        GQP[index][l++].weight = triPts[i].weight*linWt[j];
      }
    }
  }
  return GQP[index];
}
Example #2
0
int getNGQPriPts(int order)
{
  int nLin = (order+3)/2;
  int nTri = getNGQTPts(order);
  return nLin * nTri;

//   if(order == 3)return 8;
//   if(order == 2)return 8;
//   if(order < 2)
//     return GQPnPt[order];
//   return ((order+3)/2)*((order+3)/2)*((order+3)/2);
}
Example #3
0
void MSubTriangle::getIntegrationPoints(int pOrder, int *npts, IntPt **pts)
{
  if(_pts)
  {
    if(pOrder==_pOrder)
    {
      *npts = _npts;
      *pts = _pts;
      return;
    }
    else
      delete [] _pts;
  }

  _pOrder = pOrder;

  if(!_orig)
  {
    getBaseElement()->getIntegrationPoints(pOrder, &_npts, &_pts);
    *npts = _npts;
    *pts = _pts;
    return;
  }
  // work in the parametric space of the parent element
  _pts = new IntPt[getNGQTPts(pOrder)];

  // (i) get the integration points of the base element in its parametric space
  IntPt *ptsb;
  getBaseElement()->getIntegrationPoints(pOrder, &_npts, &ptsb);

  // (ii) get the coordinates of these points in the parametric space of parent element
  double u,v,w;
  double jac[3][3];
  double baseJac, origJac;
  for(int i=0; i<_npts; ++i)
  {
    u = ptsb[i].pt[0];
    v = ptsb[i].pt[1];
    w = ptsb[i].pt[2];
    baseJac = getBaseElement()->getJacobian(u, v, w, jac);

    movePointFromElementSpaceToParentSpace(u, v, w);
    origJac = _orig->getJacobian(u, v, w, jac);

    _pts[i].pt[0] = u;
    _pts[i].pt[1] = v;
    _pts[i].pt[2] = w;
    _pts[i].weight = ptsb[i].weight * baseJac/origJac;
  }
  *npts = _npts;
  *pts = _pts;
}