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
|
// GetDP - Copyright (C) 1997-2018 P. Dular and C. Geuzaine, University of Liege
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/getdp/getdp/issues
#include <math.h>
#include "ProData.h"
#include "BF.h"
#include "Message.h"
/* ------------------------------------------------------------------------ */
/* C a l _ A n a l y t i c I n t e g r a t i o n */
/* ------------------------------------------------------------------------ */
double Cal_AnalyticIntegration(struct Element * E,
void (*BFEqu)(), void (*BFDof)(),
int i, int j, double (*Cal_Productx)())
{
double DetJ ;
if ((E->Type != TRIANGLE) ||
(BFEqu != (void (*)())BF_GradNode) || (BFDof != (void (*)())BF_GradNode) ) {
Message::Error("Unknown analytic method for integration") ;
return 0.;
}
DetJ = (E->x[2] - E->x[0]) * (E->y[1] - E->y[0]) -
(E->x[1] - E->x[0]) * (E->y[2] - E->y[0]) ;
switch (i) {
case 0 :
switch (j) {
case 0 :
return( ((E->y[2]-E->y[1])*(E->y[2]-E->y[1]) +
(E->x[1]-E->x[2])*(E->x[1]-E->x[2])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
case 1 :
return( ((E->y[2]-E->y[1])*(E->y[0]-E->y[2]) +
(E->x[1]-E->x[2])*(E->x[2]-E->x[0])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
case 2 :
return( ((E->y[2]-E->y[1])*(E->y[1]-E->y[0]) +
(E->x[1]-E->x[2])*(E->x[0]-E->x[1])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
default :
Message::Error("Something wrong in Cal_AnalyticIntegration");
return 0. ;
}
case 1 :
switch (j) {
case 0 :
return( ((E->y[2]-E->y[1])*(E->y[0]-E->y[2]) +
(E->x[1]-E->x[2])*(E->x[2]-E->x[0])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
case 1 :
return( ((E->y[0]-E->y[2])*(E->y[0]-E->y[2]) +
(E->x[2]-E->x[0])*(E->x[2]-E->x[0])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
case 2 :
return( ((E->y[0]-E->y[2])*(E->y[1]-E->y[0]) +
(E->x[2]-E->x[0])*(E->x[0]-E->x[1])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
default :
Message::Error("Something wrong in Cal_AnalyticIntegration");
return 0. ;
}
case 2 :
switch (j) {
case 0 :
return( ((E->y[2]-E->y[1])*(E->y[1]-E->y[0]) +
(E->x[1]-E->x[2])*(E->x[0]-E->x[1])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
case 1 :
return( ((E->y[0]-E->y[2])*(E->y[1]-E->y[0]) +
(E->x[2]-E->x[0])*(E->x[0]-E->x[1])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
case 2 :
return( ((E->y[1]-E->y[0])*(E->y[1]-E->y[0]) +
(E->x[0]-E->x[1])*(E->x[0]-E->x[1])) * fabs(DetJ)
/ (2. * DetJ * DetJ) ) ;
default :
Message::Error("Something wrong in Cal_AnalyticIntegration");
return 0.;
}
default :
Message::Error("Something wrong in Cal_AnalyticIntegration");
return 0. ;
}
}
|