1 |
|
1 |
/*****************************************************************
|
2 |
|
|
|
3 |
|
|
m3d_analyse.cpp Type:Func
|
4 |
|
|
|
5 |
|
|
Analyse du respect de la densite en 3D
|
6 |
|
|
|
7 |
|
|
Date de creation : 15-4-1999 14 :30 :43
|
8 |
|
|
Derniere version : 15-4-1999 14 :30 :43
|
9 |
|
|
|
10 |
|
|
Vincent FRANCOIS
|
11 |
|
|
|
12 |
|
|
*****************************************************************/
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
/**************************/
|
19 |
|
|
/* include */
|
20 |
|
|
#include <stdio.h>
|
21 |
|
|
#include <math.h>
|
22 |
|
|
#include <string.h>
|
23 |
|
|
#include "memoire.h"
|
24 |
|
|
#include "const.h"
|
25 |
|
|
#include "struct.h"
|
26 |
|
|
#include "prototype.h"
|
27 |
|
|
|
28 |
|
|
/**************************/
|
29 |
|
|
/* variables globales */
|
30 |
|
|
extern struct environnement env;
|
31 |
|
|
extern struct s_mesh *mesh;
|
32 |
|
|
extern struct s_acis *acis;
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
/**************************/
|
37 |
|
|
/* programme principal */
|
38 |
|
|
|
39 |
|
|
void m3d_analyse(void)
|
40 |
|
|
{
|
41 |
|
|
struct s_tetra *tet;
|
42 |
|
|
struct s_noeud *no1,*no2,*no3,*no4;
|
43 |
|
|
float a,b,poids_gauss[4],xsi_gauss[4],eta_gauss[4],zeta_gauss[4];
|
44 |
|
|
float total_integ,integ;
|
45 |
|
|
float n1n2[4],n1n3[4],n1n4[4],vec[4];
|
46 |
|
|
float det_j,facteur;
|
47 |
|
|
float x,y,z,dens;
|
48 |
|
|
int i,j,n;
|
49 |
|
|
char mess[255];
|
50 |
|
|
|
51 |
|
|
a=0.1381966012;
|
52 |
|
|
b=0.5854101965;
|
53 |
|
|
poids_gauss[0]=0.041666666666666;xsi_gauss[0]=a;eta_gauss[0]=a;zeta_gauss[0]=a;
|
54 |
|
|
poids_gauss[1]=0.041666666666666;xsi_gauss[1]=a;eta_gauss[1]=a;zeta_gauss[1]=b;
|
55 |
|
|
poids_gauss[2]=0.041666666666666;xsi_gauss[2]=a;eta_gauss[2]=b;zeta_gauss[2]=a;
|
56 |
|
|
poids_gauss[3]=0.041666666666666;xsi_gauss[3]=b;eta_gauss[3]=a;zeta_gauss[3]=a;
|
57 |
|
|
total_integ=0.;
|
58 |
|
|
|
59 |
|
|
for (i=0;i<mesh->nb_tetra;i++)
|
60 |
|
|
{
|
61 |
|
|
tet=ADRESSE(i,tetra,mesh->);
|
62 |
|
|
no1=ADRESSE(tet->n1,noeud,mesh->);
|
63 |
|
|
no2=ADRESSE(tet->n2,noeud,mesh->);
|
64 |
|
|
no3=ADRESSE(tet->n3,noeud,mesh->);
|
65 |
|
|
no4=ADRESSE(tet->n4,noeud,mesh->);
|
66 |
|
|
VEC(n1n2,no1,no2);
|
67 |
|
|
VEC(n1n3,no1,no3);
|
68 |
|
|
VEC(n1n4,no1,no4);
|
69 |
|
|
PVEC(vec,n1n2,n1n3);
|
70 |
|
|
det_j=PSCA(vec,n1n4);
|
71 |
|
|
facteur=8.485281374*det_j;
|
72 |
|
|
integ=0.;
|
73 |
|
|
for (j=0;j<4;j++)
|
74 |
|
|
{
|
75 |
|
|
x=(1-xsi_gauss[j]-eta_gauss[j]-zeta_gauss[j])*no1->x+xsi_gauss[j]*no2->x+eta_gauss[j]*no3->x+zeta_gauss[j]*no4->x;
|
76 |
|
|
y=(1-xsi_gauss[j]-eta_gauss[j]-zeta_gauss[j])*no1->y+xsi_gauss[j]*no2->y+eta_gauss[j]*no3->y+zeta_gauss[j]*no4->y;
|
77 |
|
|
z=(1-xsi_gauss[j]-eta_gauss[j]-zeta_gauss[j])*no1->z+xsi_gauss[j]*no2->z+eta_gauss[j]*no3->z+zeta_gauss[j]*no4->z;
|
78 |
|
|
dens=eval_fdn3(x,y,z);
|
79 |
|
|
dens=dens*dens*dens;
|
80 |
|
|
integ=integ+poids_gauss[j]*facteur/dens;
|
81 |
|
|
}
|
82 |
|
|
total_integ=total_integ+integ;
|
83 |
|
|
}
|
84 |
|
|
n=(int)floor(total_integ);
|
85 |
|
|
if (total_integ-n>0.5) n++;
|
86 |
|
|
sprintf(mess,M2D_ANA_RES1,n,mesh->nb_tetra);
|
87 |
|
|
aff_text(mess);
|
88 |
|
|
sprintf(mess,M2D_ANA_RES2,(n-mesh->nb_tetra)*1.0/n);
|
89 |
|
|
aff_text(mess);
|
90 |
|
|
}
|