1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
// Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
#include "GmshDefines.h"
#include "GaussIntegration.h"
#include "fullMatrix.h"
static void pts2fullMatrix(int npts, IntPt *pts, fullMatrix<double> &pMatrix,
fullVector<double> &wMatrix)
{
pMatrix.resize(npts, 3);
wMatrix.resize(npts, 1);
for(int i = 0; i < npts; i++) {
pMatrix(i, 0) = pts[i].pt[0];
pMatrix(i, 1) = pts[i].pt[1];
pMatrix(i, 2) = pts[i].pt[2];
wMatrix(i) = pts[i].weight;
}
}
void gaussIntegration::getTriangle(int order, fullMatrix<double> &pts,
fullVector<double> &weights)
{
pts2fullMatrix(getNGQTPts(order), getGQTPts(order), pts, weights);
}
void gaussIntegration::getLine(int order, fullMatrix<double> &pts,
fullVector<double> &weights)
{
pts2fullMatrix(getNGQLPts(order), getGQLPts(order), pts, weights);
}
void gaussIntegration::getQuad(int order, fullMatrix<double> &pts,
fullVector<double> &weights)
{
pts2fullMatrix(getNGQQPts(order), getGQQPts(order), pts, weights);
}
void gaussIntegration::getTetrahedron(int order, fullMatrix<double> &pts,
fullVector<double> &weights)
{
pts2fullMatrix(getNGQTetPts(order), getGQTetPts(order), pts, weights);
}
void gaussIntegration::getHexahedron(int order, fullMatrix<double> &pts,
fullVector<double> &weights)
{
pts2fullMatrix(getNGQHPts(order), getGQHPts(order), pts, weights);
}
void gaussIntegration::getPrism(int order, fullMatrix<double> &pts,
fullVector<double> &weights)
{
pts2fullMatrix(getNGQPriPts(order), getGQPriPts(order), pts, weights);
}
void gaussIntegration::getPyramid(int order, fullMatrix<double> &pts,
fullVector<double> &weights)
{
pts2fullMatrix(getNGQPyrPts(order), getGQPyrPts(order), pts, weights);
}
void gaussIntegration::get(int elementType, int order, fullMatrix<double> &pts,
fullVector<double> &weights)
{
switch(elementType) {
case TYPE_TRI:
pts2fullMatrix(getNGQTPts(order), getGQTPts(order), pts, weights);
break;
case TYPE_LIN:
pts2fullMatrix(getNGQLPts(order), getGQLPts(order), pts, weights);
break;
case TYPE_QUA:
pts2fullMatrix(getNGQQPts(order), getGQQPts(order), pts, weights);
break;
case TYPE_TET:
pts2fullMatrix(getNGQTetPts(order), getGQTetPts(order), pts, weights);
break;
case TYPE_HEX:
pts2fullMatrix(getNGQHPts(order), getGQHPts(order), pts, weights);
break;
case TYPE_PRI:
pts2fullMatrix(getNGQPriPts(order), getGQPriPts(order), pts, weights);
break;
case TYPE_PYR:
pts2fullMatrix(getNGQPyrPts(order), getGQPyrPts(order), pts, weights);
break;
case TYPE_PNT:
weights.resize(1, 1);
weights(0) = 1.;
pts.resize(1, 3);
break;
default: Msg::Error("No integration rules defined for type %i", elementType);
}
}
|