gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GaussQuadraturePyr.cpp
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #include <vector>
7 #include "GaussIntegration.h"
8 #include "GaussLegendre1D.h"
9 #include "GaussJacobi1D.h"
10 
11 static std::vector<IntPt *> GQPyr(40, nullptr);
12 
13 IntPt *getGQPyrPts(int order)
14 {
15  if(static_cast<int>(GQPyr.size()) < order + 1)
16  GQPyr.resize(order + 1, nullptr);
17  if(!GQPyr[order]) {
18  int nbPtUV = order / 2 + 1;
19  int nbPtW = order / 2 + 1;
20  int nbPtUV2 = nbPtUV * nbPtUV;
21 
22  double *linPt, *linWt;
23  gmshGaussLegendre1D(nbPtUV, &linPt, &linWt);
24 
25  double *GJ20Pt, *GJ20Wt;
26  getGaussJacobiQuadrature(2, 0, nbPtW, &GJ20Pt, &GJ20Wt);
27 
28  IntPt *intpt = new IntPt[getNGQPyrPts(order)];
29 
30  int l = 0;
31  for(int i = 0; i < getNGQPyrPts(order); i++) {
32  // compose an integration rule for (1-w)^2 f(u,v,w) on the standard
33  // hexahedron
34 
35  int iW = i / (nbPtUV2);
36  int iU = (i - iW * nbPtUV2) / nbPtUV;
37  int iV = (i - iW * nbPtUV2 - iU * nbPtUV);
38 
39  double wt = linWt[iU] * linWt[iV] * GJ20Wt[iW];
40 
41  double up = linPt[iU];
42  double vp = linPt[iV];
43  double wp = GJ20Pt[iW];
44 
45  // now incorporate the Duffy transformation from pyramid to hexahedron
46 
47  intpt[l].pt[0] = 0.5 * (1 - wp) * up;
48  intpt[l].pt[1] = 0.5 * (1 - wp) * vp;
49  intpt[l].pt[2] = 0.5 * (1 + wp);
50 
51  wt *= 0.125;
52  intpt[l++].weight = wt * 4. / 3.;
53  }
54  GQPyr[order] = intpt;
55  }
56  return GQPyr[order];
57 }
58 
59 int getNGQPyrPts(int order)
60 {
61  int nbPtUV = order / 2 + 1;
62  int nbPtW = order / 2 + 1;
63  return nbPtUV * nbPtUV * nbPtW;
64 }
GaussLegendre1D.h
gmshGaussLegendre1D
void gmshGaussLegendre1D(int nbQuadPoints, double **t, double **w)
Definition: GaussLegendre1D.h:217
GaussIntegration.h
IntPt::pt
double pt[3]
Definition: GaussIntegration.h:13
getGQPyrPts
IntPt * getGQPyrPts(int order)
Definition: GaussQuadraturePyr.cpp:13
IntPt::weight
double weight
Definition: GaussIntegration.h:14
getGaussJacobiQuadrature
void getGaussJacobiQuadrature(int a, int b, int n, double **pt, double **wt)
Definition: GaussJacobi1D.cpp:4179
IntPt
Definition: GaussIntegration.h:12
getNGQPyrPts
int getNGQPyrPts(int order)
Definition: GaussQuadraturePyr.cpp:59
GQPyr
static std::vector< IntPt * > GQPyr(40, nullptr)
GaussJacobi1D.h