2 #ifndef MEDMEM_WRAPPER_NODES_HXX
3 #define MEDMEM_WRAPPER_NODES_HXX
9 // les classes de wrapping
11 template <int DIMENSION> class Wrapper_Noeud
16 Wrapper_Noeud():coordonnees(NULL)
19 Wrapper_Noeud(double * coord):coordonnees(coord)
25 void positionne(double *place)
29 const double & operator[] (int i) const
31 return coordonnees[i];
33 double operator[] (int i)
35 return coordonnees[i];
37 friend double DistanceInf(const Wrapper_Noeud<DIMENSION> &A,const Wrapper_Noeud<DIMENSION> &B)
41 for (int i=0;i<DIMENSION;i++)
48 friend double DistanceL2(const Wrapper_Noeud<DIMENSION> &A,const Wrapper_Noeud<DIMENSION> &B)
51 for (int i=0;i<DIMENSION;i++)
58 friend int operator==(const Wrapper_Noeud<DIMENSION> &A,const Wrapper_Noeud<DIMENSION> &B)
60 for (int i=0;i<DIMENSION;i++) if (A[i]!=B[i]) return 1;
63 friend ostream & operator<<(ostream &os,const Wrapper_Noeud<DIMENSION> &A)
66 for (int i=0;i<DIMENSION;i++) os<<A[i]<<" "<<flush;
72 template <int DIMENSION> class Wrapper_Nuage_Noeud
77 Wrapper_Noeud<DIMENSION> show;
79 Wrapper_Nuage_Noeud():nbr_noeuds(0),noeuds(NULL) {}
80 Wrapper_Nuage_Noeud(int nn, double *n):nbr_noeuds(nn),noeuds(n),show(noeuds) {}
81 ~Wrapper_Nuage_Noeud() {}
82 Wrapper_Noeud<DIMENSION> & operator [] (int i)
84 if ((i<0)||(i>=nbr_noeuds))
86 cerr<<"Outbound call dans Wrapper Nuage Noeud"<<endl;
87 cerr<<"Inférior Bound = "<<0<<endl;
88 cerr<<"Supérior Bound = "<<nbr_noeuds-1<<endl;
89 cerr<<"Call = "<<i<<endl;
92 show.positionne((double *) &noeuds[DIMENSION*i]);
95 int size() const {return nbr_noeuds;}
96 int SIZE() const {return nbr_noeuds;}
100 for (i=0;i<nbr_noeuds;i++)
102 cout<<"Noeud "<<i<<" : "<<flush;
103 for (j=0;j<DIMENSION;j++) cout<<noeuds[i*DIMENSION+j]<<" "<<flush;