gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GaussQuadratureLin.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 *> GQL(40, nullptr);
11 
12 IntPt *getGQLPts(int order)
13 {
14  if(static_cast<int>(GQL.size()) < order + 1)
15  GQL.resize(order + 1, nullptr);
16  if(!GQL[order]) {
17  // number of Gauss Point: (order + 1) / 2 *ROUNDED UP*
18  int n = (order + 1) / (double)2 + 0.5;
19  double *pt, *wt;
20  gmshGaussLegendre1D(n, &pt, &wt);
21  IntPt *intpt = new IntPt[n];
22  for(int i = 0; i < n; i++) {
23  intpt[i].pt[0] = pt[i];
24  intpt[i].pt[1] = 0.0;
25  intpt[i].pt[2] = 0.0;
26  intpt[i].weight = wt[i];
27  }
28  GQL[order] = intpt;
29  }
30  return GQL[order];
31 }
32 
33 int getNGQLPts(int order)
34 {
35  return (order + 1) / (double)2 + 0.5;
36 }
GaussLegendre1D.h
gmshGaussLegendre1D
void gmshGaussLegendre1D(int nbQuadPoints, double **t, double **w)
Definition: GaussLegendre1D.h:217
getNGQLPts
int getNGQLPts(int order)
Definition: GaussQuadratureLin.cpp:33
GaussIntegration.h
IntPt::pt
double pt[3]
Definition: GaussIntegration.h:13
GQL
static std::vector< IntPt * > GQL(40, nullptr)
IntPt::weight
double weight
Definition: GaussIntegration.h:14
getGQLPts
IntPt * getGQLPts(int order)
Definition: GaussQuadratureLin.cpp:12
IntPt
Definition: GaussIntegration.h:12