## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "Kernel/Gauss_Quadrangle.cpp" betweengetdp-3.4.0-source.tgz and getdp-3.5.0-source.tgz

About: GetDP is a general finite element solver using mixed elements to discretize de Rham-type complexes in one, two and three dimensions.

// GetDP - Copyright (C) 1997-202 P. Dular and C. Geuzaine, University of Liege // GetDP - Copyright (C) 1997-2022 P. Dular and C. Geuzaine, University of Liege
// //
// issues on https://gitlab.onelab.info/getdp/getdp/issues. // issues on https://gitlab.onelab.info/getdp/getdp/issues.
#include <math.h> #include <math.h>
#include "Gauss.h" #include "Gauss.h"
#include "Message.h" #include "Message.h"
#include "MallocUtils.h" #include "MallocUtils.h"
/* Classic Gauss Integration over a quadrangle */ /* Classic Gauss Integration over a quadrangle */
void Nbr_Points, int Num, void Gauss_Quadrangle(int Nbr_Points, int Num, double *u, double *v, double *w,
double *u, double *v, double *w, double *wght) double *wght)
{ {
{ switch(Nbr_Points) {
case case 1:
case *u = xq1[Num];
case *v = yq1[Num];
case *w = 0.;
*wght = pq1[Num];
break;
case 3:
*u = xq3[Num];
*v = yq3[Num];
*w = 0.;
*wght = pq3[Num];
break;
case 4:
*u = xq4[Num];
*v = yq4[Num];
*w = 0.;
*wght = pq4[Num];
break;
case 7:
*u = xq7[Num];
*v = yq7[Num];
*w = 0.;
*wght = pq7[Num];
break;
default:
Message::Error("Wrong number of Gauss points for Quadrangle: " Message::Error("Wrong number of Gauss points for Quadrangle: "
"valid choices: 1, 3, 4, 7"); "valid choices: 1, 3, 4, 7");
break; break;
} }
} }
/* Gauss-Legendre scheme to integrate over a quadrangle */ /* Gauss-Legendre scheme to integrate over a quadrangle */
static int glq[MAX_LINE_POINTS] = {-1}; static int glq[MAX_LINE_POINTS] = {-1};
static double *glxq[MAX_LINE_POINTS], *glyq[MAX_LINE_POINTS], static double *glxq[MAX_LINE_POINTS], *glyq[MAX_LINE_POINTS],
*glpq[MAX_LINE_POINTS];
void GaussLegendre_Quadrangle(int Nbr_Points, int Num, void GaussLegendre_Quadrangle(int Nbr_Points, int Num, double *u, double *v,
double *u, double *v, double *w, double *wght) double *w, double *wght)
{ {
int i, j, index = 0, nb; int i, j, index = 0, nb;
double pt1, pt2, wt1, wt2, dum; double pt1, pt2, wt1, wt2, dum;
nb = (int)); nb = (int)(sqrt((double)Nbr_Points) + 0.5);
if(nb * nb != Nbr_Points || nb > if(nb * nb != Nbr_Points || nb > MAX_LINE_POINTS) {
Message::Error("Number of points should be n^2 with n in [1,%d]", Message::Error("Number of points should be n^2 with n in [1,%d]",
MAX_LINE_POINTS);
return; return;
} }
if(glq[0] < 0) for(i = 0; i < MAX_LINE_POINTS; i++) glq[i] = 0; if(glq[0] < 0)
for(i = 0; i < MAX_LINE_POINTS; i++) glq[i] = 0;
if(!glq[nb - 1]){ if(!glq[nb - 1]) {
Message::Info("Computing GaussLegendre %dX%d for Quadrangle", nb, nb); Message::Info("Computing GaussLegendre %dX%d for Quadrangle", nb, nb);
glxq[nb - 1] = * sizeof(double)); glxq[nb - 1] = (double *)Malloc(Nbr_Points * sizeof(double));
glyq[nb - 1] = * sizeof(double)); glyq[nb - 1] = (double *)Malloc(Nbr_Points * sizeof(double));
glpq[nb - 1] = * sizeof(double)); glpq[nb - 1] = (double *)Malloc(Nbr_Points * sizeof(double));
for(i = 0; i < nb; i++) { for(i = 0; i < nb; i++) {
Gauss_Line(nb, i, &pt1, &dum, &dum, &wt1); Gauss_Line(nb, i, &pt1, &dum, &dum, &wt1);
for(j = 0; j < nb; j++) { for(j = 0; j < nb; j++) {
Gauss_Line(nb, j, &pt2, &dum, &dum, &wt2); Gauss_Line(nb, j, &pt2, &dum, &dum, &wt2);
glxq[nb - 1][index] = pt1; glxq[nb - 1][index] = pt1;
glyq[nb - 1][index] = pt2; glyq[nb - 1][index] = pt2;
glpq[nb - 1][index++] = glpq[nb - 1][index++] = wt1 * wt2;
} }
} }
glq[nb - 1] = 1; glq[nb - 1] = 1;
} }
*u = glxq[nb - *v = glyq[nb - *w = *wght = glpq[nb - *u = glxq[nb - 1][Num];
*v = glyq[nb - 1][Num];
*w = 0.;
*wght = glpq[nb - 1][Num];
} }
/* Gauss Integration over a quadrangle with a 1/R singularity over node /* Gauss Integration over a quadrangle with a 1/R singularity over node
*/ * (-1,-1,0) */
void GaussSingularR_Quadrangle(int Nbr_Points, int Num, void GaussSingularR_Quadrangle(int Nbr_Points, int Num, double *u, double *v,
double *u, double *v, double *w, double *wght) double *w, double *wght)
{ {
{ switch(Nbr_Points) {
case case 1:
*u = xqs1[Num];
case *v = yqs1[Num];
*w = 0.;
case *wght = pqs1[Num];
break;
case 3:
*u = xqs3[Num];
*v = yqs3[Num];
*w = 0.;
*wght = pqs3[Num];
break;
case 4:
*u = xqs4[Num];
*v = yqs4[Num];
*w = 0.;
*wght = pqs4[Num];
break;
default:
Message::Error("Wrong number of (modified) Gauss Points for Quadrangle: " Message::Error("Wrong number of (modified) Gauss Points for Quadrangle: "
"valid choices: 1, 3, 4"); "valid choices: 1, 3, 4");
break; break;
} }
} }
End of changes. 15 change blocks.
40 lines changed or deleted 75 lines changed or added