1 // SMESH SMDS : implementaion of Salome mesh data structure
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMDS_PntHasher.lxx
25 // Author : Jean-Michel BOULCOURT
30 static Standard_Real tab1[3];
31 static Standard_Real tab2[3];
33 //=======================================================================
36 //=======================================================================
37 inline Standard_Integer SMDS_PntHasher::HashCode
38 (const gp_Pnt& point, const Standard_Integer Upper)
43 Standard_Integer I[6];
46 point.Coord(U.R[0],U.R[1],U.R[2]);
48 return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper);
49 // return ::HashCode((U.I[0]>>4)+(U.I[1]>>3)+(U.I[2]>>2)+(U.I[3]>>1)+(U.I[4]>>4)+(U.I[5]>>3),Upper);
53 //=======================================================================
56 //=======================================================================
57 inline Standard_Boolean SMDS_PntHasher::IsEqual
58 (const gp_Pnt& point1, const gp_Pnt& point2)
60 point1.Coord(tab1[0],tab1[1],tab1[2]);
61 point2.Coord(tab2[0],tab2[1],tab2[2]);
62 return (memcmp(tab1,tab2,sizeof(tab1)) == 0);