From: eap Date: Wed, 14 Jan 2009 10:26:41 +0000 (+0000) Subject: MEDMEM Industrialization 2008 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0a5e2de782388549dbf08497acc6a115ece7f80c;p=tools%2Fmedcoupling.git MEDMEM Industrialization 2008 Form interpolation matrix in intersectors + template + inline void getBarycentricCoordinates(const double* point, + typename MyMeshType::MyConnType element, + const MyMeshType& mesh, + double* barycentricCoords) --- diff --git a/src/INTERP_KERNEL/MeshUtils.hxx b/src/INTERP_KERNEL/MeshUtils.hxx index d3a151b79..ff2c6074c 100644 --- a/src/INTERP_KERNEL/MeshUtils.hxx +++ b/src/INTERP_KERNEL/MeshUtils.hxx @@ -33,13 +33,36 @@ namespace INTERP_KERNEL * @return pointer to an array of 3 doubles containing the coordinates of the node */ template - inline const double* getCoordsOfNode(int node, int element, const MyMeshType& mesh) + inline const double* getCoordsOfNode(int node, typename MyMeshType::MyConnType element, const MyMeshType& mesh) { typedef typename MyMeshType::MyConnType ConnType; const ConnType connIdx = getGlobalNumberOfNode(node, element, mesh); return mesh.getCoordinatesPtr()+MyMeshType::MY_SPACEDIM*connIdx; } + /** + * Returns the barycentric coordinates of a point within a triangle or tetrahedron + * + * @param point the point for which the barycentric coordinates are sought + * @param element an element of the mesh + * @param mesh a mesh + * @param barycentricCoords an array of 3 doubles containing the coordinates of the node + */ + template + inline void getBarycentricCoordinates(const double* point, + typename MyMeshType::MyConnType element, + const MyMeshType& mesh, + 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 ); + } + barycentric_coodrs( nodes, point, barycentricCoords ); + } + } #endif