gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GaussQuadratureHex.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 const double a1 = 0.40824826;
11 const double ma1 = -0.40824826;
12 const double a2 = 0.81649658;
13 const double ma2 = -0.81649658;
14 const double b1 = 0.70710678;
15 const double mb1 = -0.70710678;
16 const double c1 = 0.57735027;
17 const double mc1 = -0.57735027;
18 const double w1 = 1.3333333333;
19 const double xh6[6] = {a1, a1, ma1, ma1, ma2, a2};
20 const double yh6[6] = {b1, mb1, b1, mb1, 0., 0.};
21 const double zh6[6] = {mc1, mc1, c1, c1, mc1, c1};
22 const double ph6[6] = {w1, w1, w1, w1, w1, w1};
23 
24 IntPt GQH1[1] = {{{0.0, 0.0, 0.0}, 8.0}};
25 
26 IntPt GQH6[6] = {
27  {{xh6[0], yh6[0], zh6[0]}, ph6[0]}, {{xh6[1], yh6[1], zh6[1]}, ph6[1]},
28  {{xh6[2], yh6[2], zh6[2]}, ph6[2]}, {{xh6[3], yh6[3], zh6[3]}, ph6[3]},
29  {{xh6[4], yh6[4], zh6[4]}, ph6[4]}, {{xh6[5], yh6[5], zh6[5]}, ph6[5]}};
30 
31 const double xh8[8] = {
32  0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626,
33  0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626};
34 const double yh8[8] = {
35  0.577350269189626, 0.577350269189626, -0.577350269189626, -0.577350269189626,
36  0.577350269189626, 0.577350269189626, -0.577350269189626, -0.577350269189626};
37 const double zh8[8] = {-0.577350269189626, -0.577350269189626,
38  -0.577350269189626, -0.577350269189626,
39  0.577350269189626, 0.577350269189626,
40  0.577350269189626, 0.577350269189626};
41 const double ph8[8] = {1., 1., 1., 1., 1., 1., 1., 1.};
42 IntPt GQH8[8] = {
43  {{xh8[0], yh8[0], zh8[0]}, ph8[0]}, {{xh8[1], yh8[1], zh8[1]}, ph8[1]},
44  {{xh8[2], yh8[2], zh8[2]}, ph8[2]}, {{xh8[3], yh8[3], zh8[3]}, ph8[3]},
45  {{xh8[4], yh8[4], zh8[4]}, ph8[4]}, {{xh8[5], yh8[5], zh8[5]}, ph8[5]},
46  {{xh8[6], yh8[6], zh8[6]}, ph8[6]}, {{xh8[7], yh8[7], zh8[7]}, ph8[7]}};
47 
48 IntPt GQH34[34] = {
49  {{0.9317380000, 0., 0.}, 0.28465447168},
50  {{-0.9317380000, 0., 0.}, 0.28465447168},
51  {{0., 0.9317380000, 0.}, 0.28465447168},
52  {{0., -0.9317380000, 0.}, 0.28465447168},
53  {{0., 0., 0.9317380000}, 0.28465447168},
54  {{0., 0., -0.9317380000}, 0.28465447168},
55  {{0.9167441779, 0.9167441779, 0.}, 0.09983142160},
56  {{-0.9167441779, 0.9167441779, 0.}, 0.09983142160},
57  {{0.9167441779, -0.9167441779, 0.}, 0.09983142160},
58  {{-0.9167441779, -0.9167441779, 0.}, 0.09983142160},
59  {{0., 0.9167441779, 0.9167441779}, 0.09983142160},
60  {{0., -0.9167441779, 0.9167441779}, 0.09983142160},
61  {{0., 0.9167441779, -0.9167441779}, 0.09983142160},
62  {{0., -0.9167441779, -0.9167441779}, 0.09983142160},
63  {{0.9167441779, 0., 0.9167441779}, 0.09983142160},
64  {{-0.9167441779, 0., 0.9167441779}, 0.09983142160},
65  {{0.9167441779, 0., -0.9167441779}, 0.09983142160},
66  {{-0.9167441779, 0., -0.9167441779}, 0.09983142160},
67  {{0.4086003800, 0.4086003800, 0.4086003800}, 0.42294183928},
68  {{0.4086003800, 0.4086003800, -0.4086003800}, 0.42294183928},
69  {{0.4086003800, -0.4086003800, 0.4086003800}, 0.42294183928},
70  {{0.4086003800, -0.4086003800, -0.4086003800}, 0.42294183928},
71  {{-0.4086003800, 0.4086003800, 0.4086003800}, 0.42294183928},
72  {{-0.4086003800, 0.4086003800, -0.4086003800}, 0.42294183928},
73  {{-0.4086003800, -0.4086003800, 0.4086003800}, 0.42294183928},
74  {{-0.4086003800, -0.4086003800, -0.4086003800}, 0.42294183928},
75  {{0.7398529500, 0.7398529500, 0.7398529500}, 0.21382017456},
76  {{0.7398529500, 0.7398529500, -0.7398529500}, 0.21382017456},
77  {{0.7398529500, -0.7398529500, 0.7398529500}, 0.21382017456},
78  {{0.7398529500, -0.7398529500, -0.7398529500}, 0.21382017456},
79  {{-0.7398529500, 0.7398529500, 0.7398529500}, 0.21382017456},
80  {{-0.7398529500, 0.7398529500, -0.7398529500}, 0.21382017456},
81  {{-0.7398529500, -0.7398529500, 0.7398529500}, 0.21382017456},
82  {{-0.7398529500, -0.7398529500, -0.7398529500}, 0.21382017456}};
83 
84 static IntPt *GQH[2] = {GQH1, GQH6};
85 static int GQHnPt[2] = {1, 6};
86 static std::vector<IntPt *> GQHGL(40, nullptr);
87 
88 IntPt *getGQHPts(int order, bool forceTensorRule)
89 {
90  if(!forceTensorRule && order <= 1) return GQH[order];
91 
92  if(static_cast<int>(GQHGL.size()) < order + 1)
93  GQHGL.resize(order + 1, nullptr);
94  if(!GQHGL[order]) {
95  int n = (order + 1) / (float)2 + 0.5;
96  double *pt, *wt;
97  gmshGaussLegendre1D(n, &pt, &wt);
98  IntPt *intpt = new IntPt[n * n * n];
99  int l = 0;
100  for(int i = 0; i < n; i++) {
101  for(int j = 0; j < n; j++) {
102  for(int k = 0; k < n; k++) {
103  intpt[l].pt[0] = pt[i];
104  intpt[l].pt[1] = pt[j];
105  intpt[l].pt[2] = pt[k];
106  intpt[l++].weight = wt[i] * wt[j] * wt[k];
107  }
108  }
109  }
110  GQHGL[order] = intpt;
111  }
112  return GQHGL[order];
113 }
114 
115 int getNGQHPts(int order, bool forceTensorRule)
116 {
117  if(!forceTensorRule && order <= 1) return GQHnPt[order];
118  int n = (order + 1) / (float)2 + 0.5;
119  return n * n * n;
120 }
GaussLegendre1D.h
gmshGaussLegendre1D
void gmshGaussLegendre1D(int nbQuadPoints, double **t, double **w)
Definition: GaussLegendre1D.h:217
yh6
const double yh6[6]
Definition: GaussQuadratureHex.cpp:20
GQHGL
static std::vector< IntPt * > GQHGL(40, nullptr)
zh8
const double zh8[8]
Definition: GaussQuadratureHex.cpp:37
ma1
const double ma1
Definition: GaussQuadratureHex.cpp:11
mc1
const double mc1
Definition: GaussQuadratureHex.cpp:17
xh6
const double xh6[6]
Definition: GaussQuadratureHex.cpp:19
GaussIntegration.h
GQH
static IntPt * GQH[2]
Definition: GaussQuadratureHex.cpp:84
w1
const double w1
Definition: GaussQuadratureHex.cpp:18
IntPt::pt
double pt[3]
Definition: GaussIntegration.h:13
yh8
const double yh8[8]
Definition: GaussQuadratureHex.cpp:34
ph8
const double ph8[8]
Definition: GaussQuadratureHex.cpp:41
zh6
const double zh6[6]
Definition: GaussQuadratureHex.cpp:21
IntPt::weight
double weight
Definition: GaussIntegration.h:14
mb1
const double mb1
Definition: GaussQuadratureHex.cpp:15
a1
const double a1
Definition: GaussQuadratureHex.cpp:10
GQH34
IntPt GQH34[34]
Definition: GaussQuadratureHex.cpp:48
GQH1
IntPt GQH1[1]
Definition: GaussQuadratureHex.cpp:24
xh8
const double xh8[8]
Definition: GaussQuadratureHex.cpp:31
a2
const double a2
Definition: GaussQuadratureHex.cpp:12
GQH8
IntPt GQH8[8]
Definition: GaussQuadratureHex.cpp:42
b1
const double b1
Definition: GaussQuadratureHex.cpp:14
IntPt
Definition: GaussIntegration.h:12
GQHnPt
static int GQHnPt[2]
Definition: GaussQuadratureHex.cpp:85
getNGQHPts
int getNGQHPts(int order, bool forceTensorRule)
Definition: GaussQuadratureHex.cpp:115
ph6
const double ph6[6]
Definition: GaussQuadratureHex.cpp:22
GQH6
IntPt GQH6[6]
Definition: GaussQuadratureHex.cpp:26
getGQHPts
IntPt * getGQHPts(int order, bool forceTensorRule)
Definition: GaussQuadratureHex.cpp:88
c1
const double c1
Definition: GaussQuadratureHex.cpp:16
ma2
const double ma2
Definition: GaussQuadratureHex.cpp:13