Salome HOME
adding a new test for makeMesh method.
[modules/med.git] / src / INTERPOLATION / MEDMEM_dTreeSommet.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 #ifndef SOMMET_HPP
23 #define SOMMET_HPP
24
25
26 // La classe qui suit sert UNIQUEMENT pour les sommets du dTree
27
28 template <int DIMENSION> class Sommet_dTree
29 {
30 protected :
31         double coord[DIMENSION];
32 public :
33         Sommet_dTree() 
34                 {
35                 }
36         Sommet_dTree(double *c) 
37                 {
38                 for (int i=0;i<DIMENSION;i++) coord[i]=c[i];
39                 }
40         Sommet_dTree(double c)
41                 {
42                 for (int i=0;i<DIMENSION;i++) coord[i]=c;
43                 }
44         Sommet_dTree(const Sommet_dTree & SO) 
45                 {
46                 for (int i=0;i<DIMENSION;i++) coord[i]=SO.coord[i];
47                 }
48         Sommet_dTree(const Sommet_dTree &s1,const Sommet_dTree &s2) 
49                 {
50                 for (int i=0;i<DIMENSION;i++) coord[i]=0.5*(s1[i]+s2[i]);
51                 }
52         ~Sommet_dTree() 
53                 {
54                 }
55         const double operator[](int i) const 
56                 {
57                 return coord[i];
58                 }
59         double & operator[](int i) 
60                 {
61                 return coord[i];
62                 }
63         Sommet_dTree & operator=(const Sommet_dTree &f) 
64                 {
65                 for (int i=0;i<DIMENSION;i++) coord[i]=f.coord[i];return *this;
66                 }
67         friend double DistanceInf(const Sommet_dTree<DIMENSION> &A,const Sommet_dTree<DIMENSION> &B) 
68                 {
69                 double max=0;
70                 double tmp;
71                 for (int i=0;i<DIMENSION;i++)
72                         {
73                         tmp=fabs(A[i]-B[i]);
74                         if (tmp>max) max=tmp;
75                         }
76                 return max;
77                 }
78 };
79
80 #endif