Loading src/Python/pytnl/tnl/Mesh.h +22 −20 Original line number Diff line number Diff line Loading @@ -13,15 +13,12 @@ namespace py = pybind11; #include <type_traits> struct _general {}; struct _special : _general {}; template< typename MeshEntity, int Superdimension, typename Scope, typename = typename std::enable_if< Superdimension <= MeshEntity::MeshTraitsType::meshDimension >::type > std::enable_if_t< Superdimension <= MeshEntity::MeshType::getMeshDimension(), bool > = true > // && MeshEntity::template SuperentityTraits< Superdimension >::storageEnabled >::type > void export_getSuperentityIndex( Scope & m, _special ) void export_getSuperentityIndex( Scope & m ) { m.def("getSuperentityIndex", []( const MeshEntity& entity, const typename MeshEntity::LocalIndexType& i ) { return entity.template getSuperentityIndex< Superdimension >( i ); Loading @@ -31,8 +28,9 @@ void export_getSuperentityIndex( Scope & m, _special ) template< typename MeshEntity, int Superdimension, typename Scope > void export_getSuperentityIndex( Scope &, _general ) typename Scope, std::enable_if_t< ! ( Superdimension <= MeshEntity::MeshType::getMeshDimension() ), bool > = true > void export_getSuperentityIndex( Scope & ) { } Loading @@ -40,9 +38,9 @@ void export_getSuperentityIndex( Scope &, _general ) template< typename MeshEntity, int Subdimension, typename Scope, typename = typename std::enable_if< Subdimension <= MeshEntity::MeshTraitsType::meshDimension && (Subdimension < MeshEntity::getEntityDimension()) >::type > void export_getSubentityIndex( Scope & m, const char* name, _special ) std::enable_if_t< Subdimension <= MeshEntity::MeshType::getMeshDimension() && (Subdimension < MeshEntity::getEntityDimension()), bool > = true > void export_getSubentityIndex( Scope & m, const char* name ) { m.def(name, []( const MeshEntity& entity, const typename MeshEntity::LocalIndexType& i ) { return entity.template getSubentityIndex< Subdimension >( i ); Loading @@ -51,17 +49,20 @@ void export_getSubentityIndex( Scope & m, const char* name, _special ) } template< typename MeshEntity, int Superdimension, typename Scope > void export_getSubentityIndex( Scope &, const char*, _general ) int Subdimension, typename Scope, std::enable_if_t< ! ( Subdimension <= MeshEntity::MeshType::getMeshDimension() && (Subdimension < MeshEntity::getEntityDimension()) ), bool > = true > void export_getSubentityIndex( Scope &, const char* ) { } template< typename MeshEntity, typename Scope, typename = typename std::enable_if< MeshEntity::getEntityDimension() == 0 >::type > void export_getPoint( Scope & scope, _special ) std::enable_if_t< MeshEntity::getEntityDimension() == 0, bool > = true > void export_getPoint( Scope & scope ) { scope.def("getPoint", []( const MeshEntity& entity ) { return entity.getPoint(); Loading @@ -70,8 +71,9 @@ void export_getPoint( Scope & scope, _special ) } template< typename MeshEntity, typename Scope > void export_getPoint( Scope &, _general ) typename Scope, std::enable_if_t< MeshEntity::getEntityDimension() != 0, bool > = true > void export_getPoint( Scope & ) { } Loading @@ -85,9 +87,9 @@ void export_MeshEntity( Scope & scope, const char* name ) // TODO ; export_getSuperentityIndex< MeshEntity, MeshEntity::getEntityDimension() + 1 >( entity, _special() ); export_getSubentityIndex< MeshEntity, 0 >( entity, "getSubvertexIndex", _special() ); export_getPoint< MeshEntity >( entity, _special() ); export_getSuperentityIndex< MeshEntity, MeshEntity::getEntityDimension() + 1 >( entity ); export_getSubentityIndex< MeshEntity, 0 >( entity, "getSubvertexIndex" ); export_getPoint< MeshEntity >( entity ); } template< typename Mesh > Loading Loading
src/Python/pytnl/tnl/Mesh.h +22 −20 Original line number Diff line number Diff line Loading @@ -13,15 +13,12 @@ namespace py = pybind11; #include <type_traits> struct _general {}; struct _special : _general {}; template< typename MeshEntity, int Superdimension, typename Scope, typename = typename std::enable_if< Superdimension <= MeshEntity::MeshTraitsType::meshDimension >::type > std::enable_if_t< Superdimension <= MeshEntity::MeshType::getMeshDimension(), bool > = true > // && MeshEntity::template SuperentityTraits< Superdimension >::storageEnabled >::type > void export_getSuperentityIndex( Scope & m, _special ) void export_getSuperentityIndex( Scope & m ) { m.def("getSuperentityIndex", []( const MeshEntity& entity, const typename MeshEntity::LocalIndexType& i ) { return entity.template getSuperentityIndex< Superdimension >( i ); Loading @@ -31,8 +28,9 @@ void export_getSuperentityIndex( Scope & m, _special ) template< typename MeshEntity, int Superdimension, typename Scope > void export_getSuperentityIndex( Scope &, _general ) typename Scope, std::enable_if_t< ! ( Superdimension <= MeshEntity::MeshType::getMeshDimension() ), bool > = true > void export_getSuperentityIndex( Scope & ) { } Loading @@ -40,9 +38,9 @@ void export_getSuperentityIndex( Scope &, _general ) template< typename MeshEntity, int Subdimension, typename Scope, typename = typename std::enable_if< Subdimension <= MeshEntity::MeshTraitsType::meshDimension && (Subdimension < MeshEntity::getEntityDimension()) >::type > void export_getSubentityIndex( Scope & m, const char* name, _special ) std::enable_if_t< Subdimension <= MeshEntity::MeshType::getMeshDimension() && (Subdimension < MeshEntity::getEntityDimension()), bool > = true > void export_getSubentityIndex( Scope & m, const char* name ) { m.def(name, []( const MeshEntity& entity, const typename MeshEntity::LocalIndexType& i ) { return entity.template getSubentityIndex< Subdimension >( i ); Loading @@ -51,17 +49,20 @@ void export_getSubentityIndex( Scope & m, const char* name, _special ) } template< typename MeshEntity, int Superdimension, typename Scope > void export_getSubentityIndex( Scope &, const char*, _general ) int Subdimension, typename Scope, std::enable_if_t< ! ( Subdimension <= MeshEntity::MeshType::getMeshDimension() && (Subdimension < MeshEntity::getEntityDimension()) ), bool > = true > void export_getSubentityIndex( Scope &, const char* ) { } template< typename MeshEntity, typename Scope, typename = typename std::enable_if< MeshEntity::getEntityDimension() == 0 >::type > void export_getPoint( Scope & scope, _special ) std::enable_if_t< MeshEntity::getEntityDimension() == 0, bool > = true > void export_getPoint( Scope & scope ) { scope.def("getPoint", []( const MeshEntity& entity ) { return entity.getPoint(); Loading @@ -70,8 +71,9 @@ void export_getPoint( Scope & scope, _special ) } template< typename MeshEntity, typename Scope > void export_getPoint( Scope &, _general ) typename Scope, std::enable_if_t< MeshEntity::getEntityDimension() != 0, bool > = true > void export_getPoint( Scope & ) { } Loading @@ -85,9 +87,9 @@ void export_MeshEntity( Scope & scope, const char* name ) // TODO ; export_getSuperentityIndex< MeshEntity, MeshEntity::getEntityDimension() + 1 >( entity, _special() ); export_getSubentityIndex< MeshEntity, 0 >( entity, "getSubvertexIndex", _special() ); export_getPoint< MeshEntity >( entity, _special() ); export_getSuperentityIndex< MeshEntity, MeshEntity::getEntityDimension() + 1 >( entity ); export_getSubentityIndex< MeshEntity, 0 >( entity, "getSubvertexIndex" ); export_getPoint< MeshEntity >( entity ); } template< typename Mesh > Loading