* @return pointer to an array of 3 doubles containing the coordinates of the node
*/
template<class MyMeshType>
- 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<class MyMeshType, int NB_NODES>
+ inline void getBarycentricCoordinates(const double* point,
+ typename MyMeshType::MyConnType element,
+ const MyMeshType& mesh,
+ 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 );
+ }
+ barycentric_coodrs( nodes, point, barycentricCoords );
+ }
+
}
#endif