Cal_AnalyticIntegration.cpp (getdp-3.4.0-source.tgz) | : | Cal_AnalyticIntegration.cpp (getdp-3.5.0-source.tgz) | ||
---|---|---|---|---|
// GetDP - Copyright (C) 1997-2021 P. Dular and C. Geuzaine, University of Liege | // GetDP - Copyright (C) 1997-2022 P. Dular and C. Geuzaine, University of Liege | |||
// | // | |||
// See the LICENSE.txt file for license information. Please report all | // See the LICENSE.txt file for license information. Please report all | |||
// 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 "ProData.h" | #include "ProData.h" | |||
#include "BF.h" | #include "BF.h" | |||
#include "Message.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 */ | /* 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, | double Cal_AnalyticIntegration(struct Element *E, void (*BFEqu)(), | |||
void (*BFEqu)(), void (*BFDof)(), | void (*BFDof)(), int i, int j, | |||
int i, int j, double (*Cal_Productx)()) | double (*Cal_Productx)()) | |||
{ | { | |||
double DetJ ; | double DetJ; | |||
if ((E->Type != TRIANGLE) || | if((E->Type != TRIANGLE) || (BFEqu != (void (*)())BF_GradNode) || | |||
(BFEqu != (void (*)())BF_GradNode) || (BFDof != (void (*)())BF_GradNode) ) | (BFDof != (void (*)())BF_GradNode)) { | |||
{ | Message::Error("Unknown analytic method for integration"); | |||
Message::Error("Unknown analytic method for integration") ; | ||||
return 0.; | return 0.; | |||
} | } | |||
DetJ = (E->x[2] - E->x[0]) * (E->y[1] - E->y[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]) ; | (E->x[1] - E->x[0]) * (E->y[2] - E->y[0]); | |||
switch (i) { | ||||
case 0 : | switch(i) { | |||
switch (j) { | case 0: | |||
case 0 : | switch(j) { | |||
return( ((E->y[2]-E->y[1])*(E->y[2]-E->y[1]) + | case 0: | |||
(E->x[1]-E->x[2])*(E->x[1]-E->x[2])) * fabs(DetJ) | return (((E->y[2] - E->y[1]) * (E->y[2] - E->y[1]) + | |||
/ (2. * DetJ * DetJ) ) ; | (E->x[1] - E->x[2]) * (E->x[1] - E->x[2])) * | |||
case 1 : | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
return( ((E->y[2]-E->y[1])*(E->y[0]-E->y[2]) + | case 1: | |||
(E->x[1]-E->x[2])*(E->x[2]-E->x[0])) * fabs(DetJ) | return (((E->y[2] - E->y[1]) * (E->y[0] - E->y[2]) + | |||
/ (2. * DetJ * DetJ) ) ; | (E->x[1] - E->x[2]) * (E->x[2] - E->x[0])) * | |||
case 2 : | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
return( ((E->y[2]-E->y[1])*(E->y[1]-E->y[0]) + | case 2: | |||
(E->x[1]-E->x[2])*(E->x[0]-E->x[1])) * fabs(DetJ) | return (((E->y[2] - E->y[1]) * (E->y[1] - E->y[0]) + | |||
/ (2. * DetJ * DetJ) ) ; | (E->x[1] - E->x[2]) * (E->x[0] - E->x[1])) * | |||
default : | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
default: | ||||
Message::Error("Something wrong in Cal_AnalyticIntegration"); | Message::Error("Something wrong in Cal_AnalyticIntegration"); | |||
return 0. ; | return 0.; | |||
} | } | |||
case 1 : | case 1: | |||
switch (j) { | switch(j) { | |||
case 0 : | case 0: | |||
return( ((E->y[2]-E->y[1])*(E->y[0]-E->y[2]) + | 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) | (E->x[1] - E->x[2]) * (E->x[2] - E->x[0])) * | |||
/ (2. * DetJ * DetJ) ) ; | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
case 1 : | case 1: | |||
return( ((E->y[0]-E->y[2])*(E->y[0]-E->y[2]) + | 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) | (E->x[2] - E->x[0]) * (E->x[2] - E->x[0])) * | |||
/ (2. * DetJ * DetJ) ) ; | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
case 2 : | case 2: | |||
return( ((E->y[0]-E->y[2])*(E->y[1]-E->y[0]) + | 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) | (E->x[2] - E->x[0]) * (E->x[0] - E->x[1])) * | |||
/ (2. * DetJ * DetJ) ) ; | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
default : | default: | |||
Message::Error("Something wrong in Cal_AnalyticIntegration"); | Message::Error("Something wrong in Cal_AnalyticIntegration"); | |||
return 0. ; | return 0.; | |||
} | } | |||
case 2 : | case 2: | |||
switch (j) { | switch(j) { | |||
case 0 : | case 0: | |||
return( ((E->y[2]-E->y[1])*(E->y[1]-E->y[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) | (E->x[1] - E->x[2]) * (E->x[0] - E->x[1])) * | |||
/ (2. * DetJ * DetJ) ) ; | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
case 1 : | case 1: | |||
return( ((E->y[0]-E->y[2])*(E->y[1]-E->y[0]) + | 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) | (E->x[2] - E->x[0]) * (E->x[0] - E->x[1])) * | |||
/ (2. * DetJ * DetJ) ) ; | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
case 2 : | case 2: | |||
return( ((E->y[1]-E->y[0])*(E->y[1]-E->y[0]) + | 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) | (E->x[0] - E->x[1]) * (E->x[0] - E->x[1])) * | |||
/ (2. * DetJ * DetJ) ) ; | fabs(DetJ) / (2. * DetJ * DetJ)); | |||
default : | default: | |||
Message::Error("Something wrong in Cal_AnalyticIntegration"); | Message::Error("Something wrong in Cal_AnalyticIntegration"); | |||
return 0.; | return 0.; | |||
} | } | |||
default : | default: | |||
Message::Error("Something wrong in Cal_AnalyticIntegration"); | Message::Error("Something wrong in Cal_AnalyticIntegration"); | |||
return 0. ; | return 0.; | |||
} | } | |||
} | } | |||
End of changes. 13 change blocks. | ||||
63 lines changed or deleted | 59 lines changed or added |