@@ -2828,6 +2828,23 @@ namespace ttk {
28282828 return -1 ;
28292829 }
28302830
2831+ inline ttk::SimplexId getSimplexLocalId (const SimplexId gsid,
2832+ const int type) const {
2833+ if (!ttk::isRunningWithMPI ()) {
2834+ return gsid;
2835+ }
2836+ switch (type) {
2837+ case 0 :
2838+ return this ->getVertexLocalId (gsid);
2839+ case 1 :
2840+ return this ->getEdgeLocalId (gsid);
2841+ case 2 :
2842+ return this ->getTriangleLocalId (gsid);
2843+ default :
2844+ return this ->getCellLocalId (gsid);
2845+ }
2846+ }
2847+
28312848 virtual inline int getVertexRank (const SimplexId lvid) const {
28322849
28332850 if (!ttk::isRunningWithMPI ()) {
@@ -2852,6 +2869,54 @@ namespace ttk {
28522869 return this ->getVertexRankInternal (lvid);
28532870 }
28542871
2872+ virtual inline int getEdgeRank (const SimplexId lvid) const {
2873+
2874+ if (!ttk::isRunningWithMPI ()) {
2875+ return 0 ;
2876+ }
2877+ #ifndef TTK_ENABLE_KAMIKAZE
2878+ if (this ->getDimensionality () != 1 && this ->getDimensionality () != 2
2879+ && this ->getDimensionality () != 3 ) {
2880+ this ->printErr (" Only 1D, 2D and 3D datasets are supported" );
2881+ return -1 ;
2882+ }
2883+ if (!this ->hasPreconditionedDistributedEdges_ ) {
2884+ this ->printErr (" EdgeRankId query without pre-process!" );
2885+ this ->printErr (
2886+ " Please call preconditionDistributedEdges() in a pre-process." );
2887+ return -1 ;
2888+ }
2889+ if (lvid < 0 || lvid >= this ->getNumberOfEdges ()) {
2890+ return -1 ;
2891+ }
2892+ #endif // TTK_ENABLE_KAMIKAZE
2893+ return this ->getEdgeRankInternal (lvid);
2894+ }
2895+
2896+ virtual inline int getTriangleRank (const SimplexId lvid) const {
2897+
2898+ if (!ttk::isRunningWithMPI ()) {
2899+ return 0 ;
2900+ }
2901+ #ifndef TTK_ENABLE_KAMIKAZE
2902+ if (this ->getDimensionality () != 1 && this ->getDimensionality () != 2
2903+ && this ->getDimensionality () != 3 ) {
2904+ this ->printErr (" Only 1D, 2D and 3D datasets are supported" );
2905+ return -1 ;
2906+ }
2907+ if (!this ->hasPreconditionedDistributedTriangles_ ) {
2908+ this ->printErr (" TriangleRankId query without pre-process!" );
2909+ this ->printErr (
2910+ " Please call preconditionDistributedTriangles() in a pre-process." );
2911+ return -1 ;
2912+ }
2913+ if (lvid < 0 || lvid >= this ->getNumberOfTriangles ()) {
2914+ return -1 ;
2915+ }
2916+ #endif // TTK_ENABLE_KAMIKAZE
2917+ return this ->getTriangleRankInternal (lvid);
2918+ }
2919+
28552920 virtual inline int getCellRank (const SimplexId lcid) const {
28562921#ifndef TTK_ENABLE_KAMIKAZE
28572922 if (this ->getDimensionality () != 1 && this ->getDimensionality () != 2
@@ -2870,11 +2935,31 @@ namespace ttk {
28702935 }
28712936#endif // TTK_ENABLE_KAMIKAZE
28722937 if (!ttk::isRunningWithMPI ()) {
2873- return lcid ;
2938+ return ttk::MPIrank_ ;
28742939 }
28752940 return this ->getCellRankInternal (lcid);
28762941 }
28772942
2943+ inline int getSimplexRank (const SimplexId lsid, const int type) const {
2944+ if (!ttk::isRunningWithMPI ()) {
2945+ return ttk::MPIrank_;
2946+ }
2947+ switch (type) {
2948+ case 0 :
2949+ return this ->getVertexRank (lsid);
2950+ case 1 :
2951+ return this ->getEdgeRank (lsid);
2952+ case 2 : {
2953+ if (getDimensionality () == 3 )
2954+ return this ->getTriangleRank (lsid);
2955+ return this ->getCellRank (lsid);
2956+ }
2957+ case 3 :
2958+ return this ->getCellRank (lsid);
2959+ }
2960+ return -1 ;
2961+ }
2962+
28782963 virtual inline const std::vector<int > &getNeighborRanks () const {
28792964 return this ->neighborRanks_ ;
28802965 }
@@ -3046,6 +3131,16 @@ namespace ttk {
30463131 return -1 ;
30473132 }
30483133
3134+ virtual inline int
3135+ getEdgeRankInternal (const SimplexId ttkNotUsed (lvid)) const {
3136+ return -1 ;
3137+ }
3138+
3139+ virtual inline int
3140+ getTriangleRankInternal (const SimplexId ttkNotUsed (lvid)) const {
3141+ return -1 ;
3142+ }
3143+
30493144 virtual inline int
30503145 getCellRankInternal (const SimplexId ttkNotUsed (lcid)) const {
30513146 return -1 ;
0 commit comments