ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/fem_element2.cpp
Revision: 628
Committed: Tue Jan 13 17:17:54 2015 UTC (10 years, 4 months ago) by francois
File size: 3916 byte(s)
Log Message:
ajout d'une projection d'une solution sur un autre maillage
ajout d'un outil de comparaison de deux solutions 
Attention fonctionnel pour le moment avec des resultats d'un calcul bidim

File Contents

# User Rev Content
1 francois 283 //------------------------------------------------------------
2     //------------------------------------------------------------
3     // MAGiC
4     // Jean Christophe Cuilli�re et Vincent FRANCOIS
5     // D�partement de G�nie M�canique - UQTR
6     //------------------------------------------------------------
7     // Le projet MAGIC est un projet de recherche du d�partement
8     // de g�nie m�canique de l'Universit� du Qu�bec �
9     // Trois Rivi�res
10     // Les librairies ne peuvent �tre utilis�es sans l'accord
11     // des auteurs (contact : francois@uqtr.ca)
12     //------------------------------------------------------------
13     //------------------------------------------------------------
14     //
15     // fem_triangle.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 � 11H22
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25     #include "gestionversion.h"
26     #include <math.h>
27 francois 309 #include "fem_element2.h"
28 francois 283 #include "fem_noeud.h"
29     #include "mg_element_maillage.h"
30 francois 628 #include "ot_mathematique.h"
31 francois 283
32 francois 309 FEM_ELEMENT2::FEM_ELEMENT2(unsigned long num,class MG_ELEMENT_MAILLAGE* mai):FEM_ELEMENT_MAILLAGE(num,mai)
33 francois 283 {
34     }
35 francois 378 FEM_ELEMENT2::FEM_ELEMENT2(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo):FEM_ELEMENT_MAILLAGE(num,topo)
36     {
37     }
38     FEM_ELEMENT2::FEM_ELEMENT2(unsigned long num,class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai):FEM_ELEMENT_MAILLAGE(num,topo,mai)
39     {
40     }
41 francois 283
42 francois 309 FEM_ELEMENT2::FEM_ELEMENT2(class MG_ELEMENT_MAILLAGE* mai):FEM_ELEMENT_MAILLAGE(mai)
43 francois 283 {
44     }
45 francois 378 FEM_ELEMENT2::FEM_ELEMENT2(class MG_ELEMENT_TOPOLOGIQUE* topo):FEM_ELEMENT_MAILLAGE(topo)
46     {
47     }
48     FEM_ELEMENT2::FEM_ELEMENT2(class MG_ELEMENT_TOPOLOGIQUE* topo,class MG_ELEMENT_MAILLAGE* mai):FEM_ELEMENT_MAILLAGE(topo,mai)
49     {
50     }
51 francois 283
52 francois 309 FEM_ELEMENT2::FEM_ELEMENT2(FEM_ELEMENT2& mdd):FEM_ELEMENT_MAILLAGE(mdd)
53 francois 283 {
54     }
55    
56 gervaislavoie 385 int FEM_ELEMENT2::get_etat(void)
57     {
58     return etat;
59     }
60     void FEM_ELEMENT2::change_etat(int num)
61     {
62     etat=num;
63     }
64 francois 283
65 francois 309 FEM_ELEMENT2::~FEM_ELEMENT2()
66 francois 283 {
67     }
68    
69    
70 francois 309 void FEM_ELEMENT2::extrapoler_solution_noeud(void)
71 francois 283 {
72     int nb=get_nb_fem_noeud();
73     for (int i=0;i<nb;i++)
74 francois 377 for (int j=0;j<MAX_TYPE_SOLUTION;j++)
75 francois 375 get_fem_noeud(i)->change_solution(solution[j],j);
76 francois 283 }
77    
78 francois 628 bool FEM_ELEMENT2::get_param_element_fini_2D(double *xyz,double *uv)
79     {
80     OT_MATRICE_3D mat;
81     OT_VECTEUR_3D vec;
82     uv[0]=0.;
83     uv[1]=0.;
84 francois 283
85 francois 628 int compteur=0;
86     int ok=0;
87    
88     while (ok==0)
89     {
90     mat(0,0)=0.;mat(0,1)=0.;mat(0,2)=0.;
91     mat(1,0)=0.;mat(1,1)=0.;mat(1,2)=0.;
92     mat(2,0)=0.;mat(2,1)=0.;mat(2,2)=0.;
93     vec(0)=xyz[0];vec(1)=xyz[1];vec(2)=xyz[2];
94    
95     for (int i=0;i<get_nb_fem_noeud();i++)
96     {
97     mat(0,0)=mat(0,0)+get_fonction_derive_interpolation(i+1,1,uv)*get_fem_noeud(i)->get_x();
98     mat(0,1)=mat(0,1)+get_fonction_derive_interpolation(i+1,2,uv)*get_fem_noeud(i)->get_x();
99     mat(1,0)=mat(1,0)+get_fonction_derive_interpolation(i+1,1,uv)*get_fem_noeud(i)->get_y();
100     mat(1,1)=mat(1,1)+get_fonction_derive_interpolation(i+1,2,uv)*get_fem_noeud(i)->get_y();
101     vec(0)=vec(0)-get_fonction_interpolation(i+1,uv)*get_fem_noeud(i)->get_x();
102     vec(1)=vec(1)-get_fonction_interpolation(i+1,uv)*get_fem_noeud(i)->get_y();
103     }
104     double det=mat(0,0)*mat(1,1)-mat(0,1)*mat(1,0);
105     if (fabs(det)<1e-12) return false;
106     double d1=(vec(0)*mat(1,1)-vec(1)*mat(0,1))/det;
107     double d2=(vec(1)*mat(0,0)-vec(0)*mat(1,0))/det;
108     compteur++;
109     if (compteur>100) return false;
110     if ((fabs(d1)<1e-8)&&(fabs(d2)<1e-8)) ok=1;
111     uv[0]=uv[0]+d1;
112     uv[1]=uv[1]+d2;
113     }
114     return true;
115    
116     }
117    
118    
119     void FEM_ELEMENT2::get_interpolation_xyz(double* uv, double* xyz)
120     {
121     xyz[0]=0.;xyz[1]=0.;xyz[2]=0;
122     for (int i=0;i<get_nb_fem_noeud();i++)
123     {
124     xyz[0]=xyz[0]+get_fonction_interpolation(i+1,uv)*get_fem_noeud(i)->get_x();
125     xyz[1]=xyz[1]+get_fonction_interpolation(i+1,uv)*get_fem_noeud(i)->get_y();
126     xyz[2]=xyz[2]+get_fonction_interpolation(i+1,uv)*get_fem_noeud(i)->get_z();
127     }
128     }
129