Loading src/TNL/Meshes/Geometry/getEntityCenter.h +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ getEntityCenter( const Mesh< MeshConfig, Device > & mesh, /* * Get an arithmetic mean of the entity's subvertices. * * For an simplex entity this corresponds to the centroid of the entity, but * For a simplex entity this corresponds to the centroid of the entity, but * note that other shapes such as general polygons have different formulas for * the centroid: https://en.wikipedia.org/wiki/Centroid#Centroid_of_a_polygon */ Loading src/TNL/Meshes/Geometry/getEntityMeasure.h +24 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <TNL/Meshes/Topologies/Triangle.h> #include <TNL/Meshes/Topologies/Quadrangle.h> #include <TNL/Meshes/Topologies/Tetrahedron.h> #include <TNL/Meshes/Topologies/Hexahedron.h> namespace TNL { namespace Meshes { Loading Loading @@ -148,5 +149,28 @@ getEntityMeasure( const Mesh< MeshConfig, Device > & mesh, return getTetrahedronVolume( v3 - v0, v2 - v0, v1 - v0 ); } template< typename MeshConfig, typename Device > __cuda_callable__ typename MeshConfig::RealType getEntityMeasure( const Mesh< MeshConfig, Device > & mesh, const MeshEntity< MeshConfig, Device, Topologies::Hexahedron > & entity ) { const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) ); const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) ); const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) ); const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) ); const auto& v4 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 4 ) ); const auto& v5 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 5 ) ); const auto& v6 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 6 ) ); const auto& v7 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 7 ) ); // https://www.cfd-online.com/Forums/main/163122-volume-general-hexahedron.html#post574650 return getTetrahedronVolume( v0 - v4, v3 - v4, v1 - v4 ) + getTetrahedronVolume( v2 - v4, v3 - v4, v1 - v4 ) + getTetrahedronVolume( v1 - v4, v2 - v4, v5 - v4 ) + getTetrahedronVolume( v6 - v4, v2 - v4, v5 - v4 ) + getTetrahedronVolume( v3 - v4, v2 - v4, v7 - v4 ) + getTetrahedronVolume( v6 - v4, v2 - v4, v7 - v4 ); } } // namespace Meshes } // namespace TNL Loading
src/TNL/Meshes/Geometry/getEntityCenter.h +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ getEntityCenter( const Mesh< MeshConfig, Device > & mesh, /* * Get an arithmetic mean of the entity's subvertices. * * For an simplex entity this corresponds to the centroid of the entity, but * For a simplex entity this corresponds to the centroid of the entity, but * note that other shapes such as general polygons have different formulas for * the centroid: https://en.wikipedia.org/wiki/Centroid#Centroid_of_a_polygon */ Loading
src/TNL/Meshes/Geometry/getEntityMeasure.h +24 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <TNL/Meshes/Topologies/Triangle.h> #include <TNL/Meshes/Topologies/Quadrangle.h> #include <TNL/Meshes/Topologies/Tetrahedron.h> #include <TNL/Meshes/Topologies/Hexahedron.h> namespace TNL { namespace Meshes { Loading Loading @@ -148,5 +149,28 @@ getEntityMeasure( const Mesh< MeshConfig, Device > & mesh, return getTetrahedronVolume( v3 - v0, v2 - v0, v1 - v0 ); } template< typename MeshConfig, typename Device > __cuda_callable__ typename MeshConfig::RealType getEntityMeasure( const Mesh< MeshConfig, Device > & mesh, const MeshEntity< MeshConfig, Device, Topologies::Hexahedron > & entity ) { const auto& v0 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 0 ) ); const auto& v1 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 1 ) ); const auto& v2 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 2 ) ); const auto& v3 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 3 ) ); const auto& v4 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 4 ) ); const auto& v5 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 5 ) ); const auto& v6 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 6 ) ); const auto& v7 = mesh.getPoint( entity.template getSubentityIndex< 0 >( 7 ) ); // https://www.cfd-online.com/Forums/main/163122-volume-general-hexahedron.html#post574650 return getTetrahedronVolume( v0 - v4, v3 - v4, v1 - v4 ) + getTetrahedronVolume( v2 - v4, v3 - v4, v1 - v4 ) + getTetrahedronVolume( v1 - v4, v2 - v4, v5 - v4 ) + getTetrahedronVolume( v6 - v4, v2 - v4, v5 - v4 ) + getTetrahedronVolume( v3 - v4, v2 - v4, v7 - v4 ) + getTetrahedronVolume( v6 - v4, v2 - v4, v7 - v4 ); } } // namespace Meshes } // namespace TNL