X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FMeshUtils.hxx;h=8d0d56110f62a510f2c0f888cbf0ac99d0946317;hb=ffdef130a5a36893d8e58d538884e79413975c7a;hp=1b4b404d8f25eea8debd0788037b6557b7d76fc4;hpb=48782c06022ca2caa36f849cb5a29ea4fe2aaa83;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/MeshUtils.hxx b/src/INTERP_KERNEL/MeshUtils.hxx index 1b4b404d8..8d0d56110 100644 --- a/src/INTERP_KERNEL/MeshUtils.hxx +++ b/src/INTERP_KERNEL/MeshUtils.hxx @@ -1,21 +1,22 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D // -// 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 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, or (at your option) any later version. // -// 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. +// 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 +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef __MESHUTILS_HXX__ #define __MESHUTILS_HXX__ @@ -29,7 +30,7 @@ namespace INTERP_KERNEL * @param node the node for which the global number is sought (ALWAYS in C mode) * @param element an element of the mesh (in numPol policy) * @param mesh a mesh - * @return the node's global number so that (its coordinates in the coordinates array are at [SPACEDIM*globalNumber, SPACEDIM*globalNumber + 2] + * @return the node's global number so that (its coordinates in the coordinates array are at [SPACEDIM*globalNumber, SPACEDIM*globalNumber + SPACEDIM] */ template inline typename MyMeshType::MyConnType getGlobalNumberOfNode(typename MyMeshType::MyConnType node, typename MyMeshType::MyConnType element, const MyMeshType& mesh) @@ -37,7 +38,20 @@ namespace INTERP_KERNEL typedef typename MyMeshType::MyConnType ConnType; const NumberingPolicy numPol=MyMeshType::My_numPol; const ConnType elemIdx=OTT::conn2C(mesh.getConnectivityIndexPtr()[OTT::ind2C(element)]); - return OTT::coo2C(mesh.getConnectivityPtr()[elemIdx + node]); + if(mesh.getTypeOfElement(element)!=INTERP_KERNEL::NORM_POLYHED) + return OTT::coo2C(mesh.getConnectivityPtr()[elemIdx + node]); + else + { + const ConnType *startNodalConnOfElem=mesh.getConnectivityPtr()+elemIdx; + ConnType ptr=0,ret=0; + while(startNodalConnOfElem[ret]==-1 || ptr!=node) + { + ret++; + if(startNodalConnOfElem[ret]!=-1) + ptr++; + } + return OTT::coo2C(startNodalConnOfElem[ret]); + } } /** @@ -53,7 +67,8 @@ namespace INTERP_KERNEL { typedef typename MyMeshType::MyConnType ConnType; const ConnType connIdx = getGlobalNumberOfNode(node, element, mesh); - return mesh.getCoordinatesPtr()+MyMeshType::MY_SPACEDIM*connIdx; + const double *ret=mesh.getCoordinatesPtr()+MyMeshType::MY_SPACEDIM*connIdx; + return ret; } /** @@ -68,7 +83,6 @@ namespace INTERP_KERNEL template inline const double* getCoordsOfNode2(typename MyMeshType::MyConnType node, typename MyMeshType::MyConnType element, const MyMeshType& mesh, typename MyMeshType::MyConnType& nodeId) { - typedef typename MyMeshType::MyConnType ConnType; nodeId= getGlobalNumberOfNode(node, element, mesh); return mesh.getCoordinatesPtr()+MyMeshType::MY_SPACEDIM*nodeId; } @@ -88,7 +102,6 @@ namespace INTERP_KERNEL double* barycentricCoords) { std::vector nodes( NB_NODES ); - typedef typename MyMeshType::MyConnType ConnType; for ( int node = 0; node < NB_NODES; ++node ) { nodes[ node ] = getCoordsOfNode( node, element, mesh );