// SMESH SMDS : implementaion of Salome mesh data structure // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // // File : SMDS_PntHasher.lxx // Author : Jean-Michel BOULCOURT // Module : SMESH #include static Standard_Real tab1[3]; static Standard_Real tab2[3]; //======================================================================= //function : HashCode //purpose : //======================================================================= inline Standard_Integer SMDS_PntHasher::HashCode (const gp_Pnt& point, const Standard_Integer Upper) { union { Standard_Real R[3]; Standard_Integer I[6]; } U; point.Coord(U.R[0],U.R[1],U.R[2]); 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); // 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); } //======================================================================= //function : IsEqual //purpose : //======================================================================= inline Standard_Boolean SMDS_PntHasher::IsEqual (const gp_Pnt& point1, const gp_Pnt& point2) { point1.Coord(tab1[0],tab1[1],tab1[2]); point2.Coord(tab2[0],tab2[1],tab2[2]); return (memcmp(tab1,tab2,sizeof(tab1)) == 0); }