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