// 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_MeshElement.lxx // Author : Jean-Michel BOULCOURT // Module : SMESH inline Standard_Integer SMDS_MeshElement::HashCode(const Standard_Integer Upper) const { return (GetKey() % Upper); } //======================================================================= //function : IsEqual //purpose : //======================================================================= inline Standard_Boolean SMDS_MeshElement::IsEqual(const Handle(SMDS_MeshElement)& other) const { if (this->NbNodes()!=other->NbNodes()) return Standard_False; Standard_Integer *c1,*c2; Standard_Integer n = this->NbNodes(); c1 = (Standard_Integer *)this->GetConnections(); c2 = (Standard_Integer *)other->GetConnections(); if (*c1 != *c2) return Standard_False; n--; c1++; c2++; for (;n--; c1++,c2++) { if (*c1 != *c2) { return Standard_False; } } return Standard_True; } //======================================================================= //function : IsSame //purpose : //======================================================================= inline Standard_Boolean SMDS_MeshElement::IsSame(const Handle(SMDS_MeshElement)& other) const { if (this->NbNodes()!=other->NbNodes()) return Standard_False; Standard_Integer *c1,*c2; Standard_Integer n = this->NbNodes(); c1 = (Standard_Integer *)this->GetConnections(); c2 = (Standard_Integer *)other->GetConnections(); if (*c1 != *c2) return Standard_False; n--; c1++; c2++; Standard_Integer off = n-1; for (;n--; c1++,c2++) { if (*c1 != *c2 && *c1 != *(c2+off)) { return Standard_False; } off -= 2; } return Standard_True; } //======================================================================= //function : IsNodeInElement //purpose : //======================================================================= inline Standard_Boolean SMDS_MeshElement::IsNodeInElement(const Standard_Integer idnode) const { if (idnode < GetConnection(1)) return Standard_False; Standard_Integer *c; c = (Standard_Integer *)this->GetConnections(); Standard_Integer n = myNbNodes; for (;n--; c++) { if (*c == idnode) return Standard_True; } return Standard_False; } //======================================================================= //function : NbNodes //purpose : // //======================================================================= inline Standard_Integer SMDS_MeshElement::NbNodes() const { return myNbNodes; } //======================================================================= //function : GetID //purpose : //======================================================================= inline Standard_Integer SMDS_MeshElement::GetID() const { return myID; } //======================================================================= //function : GetType //purpose : //======================================================================= inline SMDSAbs_ElementType SMDS_MeshElement::GetType() const { return myType; }