gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GaussQuadraturePri.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 
10 static std::vector<IntPt *> GQP(40, nullptr), GQPGL(40, nullptr);
11 
12 IntPt *getGQPriPts(int order, bool forceTensorRule)
13 {
14  int nLin = (order + 3) / 2;
15  int nTri = getNGQTPts(order, forceTensorRule);
16  int n = nLin * nTri;
17  if(forceTensorRule && static_cast<int>(GQPGL.size()) < order + 1)
18  GQPGL.resize(order + 1, nullptr);
19  else if(!forceTensorRule && static_cast<int>(GQP.size()) < order + 1)
20  GQP.resize(order + 1, nullptr);
21  if((forceTensorRule && !GQPGL[order]) ||
22  (!forceTensorRule && !GQP[order])) {
23  double *linPt, *linWt;
24  IntPt *triPts = getGQTPts(order, forceTensorRule);
25  gmshGaussLegendre1D(nLin, &linPt, &linWt);
26  IntPt *intpt = new IntPt[n];
27  int l = 0;
28  for(int i = 0; i < nTri; i++) {
29  for(int j = 0; j < nLin; j++) {
30  intpt[l].pt[0] = triPts[i].pt[0];
31  intpt[l].pt[1] = triPts[i].pt[1];
32  intpt[l].pt[2] = linPt[j];
33  intpt[l++].weight = triPts[i].weight * linWt[j];
34  }
35  }
36  if(forceTensorRule)
37  GQPGL[order] = intpt;
38  else
39  GQP[order] = intpt;
40  }
41  if(forceTensorRule)
42  return GQPGL[order];
43  else
44  return GQP[order];
45 }
46 
47 int getNGQPriPts(int order, bool forceTensorRule)
48 {
49  int nLin = (order + 3) / 2;
50  int nTri = getNGQTPts(order, forceTensorRule);
51  return nLin * nTri;
52 }
getGQPriPts
IntPt * getGQPriPts(int order, bool forceTensorRule)
Definition: GaussQuadraturePri.cpp:12
GaussLegendre1D.h
gmshGaussLegendre1D
void gmshGaussLegendre1D(int nbQuadPoints, double **t, double **w)
Definition: GaussLegendre1D.h:217
GQPGL
static std::vector< IntPt * > GQPGL(40, nullptr)
GaussIntegration.h
IntPt::pt
double pt[3]
Definition: GaussIntegration.h:13
IntPt::weight
double weight
Definition: GaussIntegration.h:14
getNGQTPts
int getNGQTPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureTri.cpp:904
getNGQPriPts
int getNGQPriPts(int order, bool forceTensorRule)
Definition: GaussQuadraturePri.cpp:47
GQP
static std::vector< IntPt * > GQP(40, nullptr)
IntPt
Definition: GaussIntegration.h:12
getGQTPts
IntPt * getGQTPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureTri.cpp:889