Salome HOME
DCQ : Merge with Ecole Ete a6.
[modules/med.git] / src / MEDMEM / INTERPOLATION / UseCasedTree.cxx
1 #include "stdio.h"
2 #include "stdlib.h"
3
4 #include <iostream.h>
5
6 #include "MEDMEM_InterpolationHighLevelObjects.hxx"
7
8 #define affiche(NOEUD) cout<<flush;for (int iii=0;iii<DIMENSION;iii++) cout<<NOEUD[iii]<<" "<<flush;
9
10 int main (void) 
11 {
12 int i;
13
14 const int DIMENSION  = 3;
15 const int NBR_NOEUDS = 8;
16 const int NBR_INC    = 3;
17
18 double noeuds[DIMENSION*NBR_NOEUDS] = { 0,0,0,
19                                         1,0,0,
20                                         0,1,0,
21                                         0,0,1,
22                                         1,1,0,
23                                         1,0,1,
24                                         0,1,1,
25                                         1,1,1 };
26                                         
27 double noeuds_inconnus[DIMENSION*NBR_INC] =   { 2  ,2  ,2  ,
28                                                 0.2,0.2,0.2,
29                                                 0  ,0.9,0.9 };
30
31 double * tmp1, * tmp2;
32
33 for (i=0;i<NBR_NOEUDS;i++)
34         {
35         cout<<"Noeud["<<i<<"] = ";
36         tmp1=&noeuds[DIMENSION*i];
37         affiche(tmp1);
38         cout<<endl;
39         }
40
41 Meta_dTree<DIMENSION> Octree(NBR_NOEUDS,noeuds);
42
43 for (i=0;i<NBR_INC;i++)
44         {
45         cout<<"Noeud le plus proche de ";
46         tmp1=&noeuds_inconnus[DIMENSION*i];
47         affiche(tmp1);
48         cout<<" : ";
49         tmp2=&noeuds[DIMENSION*Octree.trouve_plus_proche_point(tmp1)];
50         affiche(tmp2);
51         cout<<" ; VĂ©rification par mĂ©thode bourrin : ";
52         tmp2=&noeuds[DIMENSION*Octree.trouve_plus_proche_point_bourrin(tmp1)];
53         affiche(tmp2);
54         cout<<endl;
55         }
56
57 }
58