gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GaussIntegration.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 "GmshDefines.h"
7 #include "GaussIntegration.h"
8 #include "fullMatrix.h"
9 
10 static void pts2fullMatrix(int npts, IntPt *pts, fullMatrix<double> &pMatrix,
11  fullVector<double> &wMatrix)
12 {
13  pMatrix.resize(npts, 3);
14  wMatrix.resize(npts, 1);
15  for(int i = 0; i < npts; i++) {
16  pMatrix(i, 0) = pts[i].pt[0];
17  pMatrix(i, 1) = pts[i].pt[1];
18  pMatrix(i, 2) = pts[i].pt[2];
19  wMatrix(i) = pts[i].weight;
20  }
21 }
22 
24  fullVector<double> &weights)
25 {
26  pts2fullMatrix(getNGQTPts(order), getGQTPts(order), pts, weights);
27 }
28 
30  fullVector<double> &weights)
31 {
32  pts2fullMatrix(getNGQLPts(order), getGQLPts(order), pts, weights);
33 }
34 
36  fullVector<double> &weights)
37 {
38  pts2fullMatrix(getNGQQPts(order), getGQQPts(order), pts, weights);
39 }
40 
42  fullVector<double> &weights)
43 {
44  pts2fullMatrix(getNGQTetPts(order), getGQTetPts(order), pts, weights);
45 }
46 
48  fullVector<double> &weights)
49 {
50  pts2fullMatrix(getNGQHPts(order), getGQHPts(order), pts, weights);
51 }
52 
54  fullVector<double> &weights)
55 {
56  pts2fullMatrix(getNGQPriPts(order), getGQPriPts(order), pts, weights);
57 }
58 
60  fullVector<double> &weights)
61 {
62  pts2fullMatrix(getNGQPyrPts(order), getGQPyrPts(order), pts, weights);
63 }
64 
65 void gaussIntegration::get(int elementType, int order, fullMatrix<double> &pts,
66  fullVector<double> &weights, bool forceTensorRule)
67 {
68  switch(elementType) {
69  case TYPE_TRI:
70  pts2fullMatrix(getNGQTPts(order, forceTensorRule),
71  getGQTPts(order, forceTensorRule), pts, weights);
72  break;
73  case TYPE_LIN:
74  pts2fullMatrix(getNGQLPts(order), getGQLPts(order), pts, weights);
75  break;
76  case TYPE_QUA:
77  pts2fullMatrix(getNGQQPts(order, forceTensorRule),
78  getGQQPts(order, forceTensorRule), pts, weights);
79  break;
80  case TYPE_TET:
81  pts2fullMatrix(getNGQTetPts(order, forceTensorRule),
82  getGQTetPts(order, forceTensorRule), pts, weights);
83  break;
84  case TYPE_HEX:
85  pts2fullMatrix(getNGQHPts(order, forceTensorRule),
86  getGQHPts(order, forceTensorRule), pts, weights);
87  break;
88  case TYPE_PRI:
89  pts2fullMatrix(getNGQPriPts(order, forceTensorRule),
90  getGQPriPts(order, forceTensorRule), pts, weights);
91  break;
92  case TYPE_PYR:
94  getGQPyrPts(order), pts, weights);
95  break;
96  case TYPE_PNT:
97  weights.resize(1, 1);
98  weights(0) = 1.;
99  pts.resize(1, 3);
100  break;
101  default: Msg::Error("No integration rules defined for type %i", elementType);
102  }
103 }
getGQLPts
IntPt * getGQLPts(int order)
Definition: GaussQuadratureLin.cpp:12
fullVector< double >
TYPE_LIN
#define TYPE_LIN
Definition: GmshDefines.h:65
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
gaussIntegration::getLine
static void getLine(int order, fullMatrix< double > &pts, fullVector< double > &weights)
Definition: GaussIntegration.cpp:29
TYPE_PNT
#define TYPE_PNT
Definition: GmshDefines.h:64
TYPE_TRI
#define TYPE_TRI
Definition: GmshDefines.h:66
getGQTetPts
IntPt * getGQTetPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureTet.cpp:3346
fullVector::resize
bool resize(int r, bool resetValue=true)
Definition: fullMatrix.h:103
GaussIntegration.h
getNGQHPts
int getNGQHPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureHex.cpp:115
IntPt::pt
double pt[3]
Definition: GaussIntegration.h:13
pts2fullMatrix
static void pts2fullMatrix(int npts, IntPt *pts, fullMatrix< double > &pMatrix, fullVector< double > &wMatrix)
Definition: GaussIntegration.cpp:10
TYPE_PRI
#define TYPE_PRI
Definition: GmshDefines.h:70
getNGQLPts
int getNGQLPts(int order)
Definition: GaussQuadratureLin.cpp:33
gaussIntegration::getHexahedron
static void getHexahedron(int order, fullMatrix< double > &pts, fullVector< double > &weights)
Definition: GaussIntegration.cpp:47
fullMatrix< double >
getNGQPriPts
int getNGQPriPts(int order, bool forceTensorRule=false)
Definition: GaussQuadraturePri.cpp:47
IntPt::weight
double weight
Definition: GaussIntegration.h:14
getNGQTPts
int getNGQTPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureTri.cpp:904
getNGQQPts
int getNGQQPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureQuad.cpp:124
getNGQTetPts
int getNGQTetPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureTet.cpp:3362
GmshDefines.h
getGQQPts
IntPt * getGQQPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureQuad.cpp:99
gaussIntegration::getPyramid
static void getPyramid(int order, fullMatrix< double > &pts, fullVector< double > &weights)
Definition: GaussIntegration.cpp:59
gaussIntegration::getQuad
static void getQuad(int order, fullMatrix< double > &pts, fullVector< double > &weights)
Definition: GaussIntegration.cpp:35
gaussIntegration::getTetrahedron
static void getTetrahedron(int order, fullMatrix< double > &pts, fullVector< double > &weights)
Definition: GaussIntegration.cpp:41
TYPE_PYR
#define TYPE_PYR
Definition: GmshDefines.h:69
TYPE_QUA
#define TYPE_QUA
Definition: GmshDefines.h:67
IntPt
Definition: GaussIntegration.h:12
getNGQPyrPts
int getNGQPyrPts(int order)
Definition: GaussQuadraturePyr.cpp:59
TYPE_HEX
#define TYPE_HEX
Definition: GmshDefines.h:71
TYPE_TET
#define TYPE_TET
Definition: GmshDefines.h:68
getGQTPts
IntPt * getGQTPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureTri.cpp:889
gaussIntegration::get
static void get(int elementType, int order, fullMatrix< double > &pts, fullVector< double > &weights, bool forceTensorRule=false)
Definition: GaussIntegration.cpp:65
gaussIntegration::getTriangle
static void getTriangle(int order, fullMatrix< double > &pts, fullVector< double > &weights)
Definition: GaussIntegration.cpp:23
fullMatrix::resize
bool resize(int r, int c, bool resetValue=true)
Definition: fullMatrix.h:307
getGQPyrPts
IntPt * getGQPyrPts(int order)
Definition: GaussQuadraturePyr.cpp:13
getGQPriPts
IntPt * getGQPriPts(int order, bool forceTensorRule=false)
Definition: GaussQuadraturePri.cpp:12
getGQHPts
IntPt * getGQHPts(int order, bool forceTensorRule=false)
Definition: GaussQuadratureHex.cpp:88
fullMatrix.h
gaussIntegration::getPrism
static void getPrism(int order, fullMatrix< double > &pts, fullVector< double > &weights)
Definition: GaussIntegration.cpp:53