-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2014 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__
* @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<class MyMeshType>
inline typename MyMeshType::MyConnType getGlobalNumberOfNode(typename MyMeshType::MyConnType node, typename MyMeshType::MyConnType element, const MyMeshType& mesh)
typedef typename MyMeshType::MyConnType ConnType;
const NumberingPolicy numPol=MyMeshType::My_numPol;
const ConnType elemIdx=OTT<ConnType,numPol>::conn2C(mesh.getConnectivityIndexPtr()[OTT<ConnType,numPol>::ind2C(element)]);
- return OTT<ConnType,numPol>::coo2C(mesh.getConnectivityPtr()[elemIdx + node]);
+ if(mesh.getTypeOfElement(element)!=INTERP_KERNEL::NORM_POLYHED)
+ return OTT<ConnType,numPol>::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<ConnType,numPol>::coo2C(startNodalConnOfElem[ret]);
+ }
}
/**
{
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;
}
/**
double* barycentricCoords)
{
std::vector<const double*> nodes( NB_NODES );
- typedef typename MyMeshType::MyConnType ConnType;
for ( int node = 0; node < NB_NODES; ++node )
{
nodes[ node ] = getCoordsOfNode( node, element, mesh );