zoltan2: fixed ArrayView usage in graph metrics' directory calls
Created by: kddevin
@trilinos/zoltan2
Description
When some processors have no IDs to partition or no graph edges, the graph metrics calculation core-dumped or caused a hang. The culprit was attempts to compute the address of element 0 of an ArrayView of length zero. I added tests for zero-length arrays before the attempted accesses.
Motivation and Context
Test Zoltan2_zoltanCompare.exe failed in the metric computation for input graph nograph (which doesn't have edges). These changes allow Zoltan2_zoltanCompare.exe to succeed.
Related Issues
- Related to #1533
How Has This Been Tested?
New tests are added that exercise the graph metrics in these conditions: chacoGraphMetricTestNoGraph.xml -- tests graph metric computation on graph with no edges chacoGraphMetricTestNoGraphNoDistribute.xml -- tests on graph with no edges and all input on rank 0 chacoGraphMetricTestNoDistribute.xml -- tests on graph with all input on rank 0 chacoGraphMetricTest.xml -- tests on graph with edge weights
Checklist
-
My commit messages mention the appropriate GitHub issue numbers. - [ x] My code follows the code style of the affected package(s).
-
My change requires a change to the documentation. -
I have updated the documentation accordingly. -
I have read the code contribution guidelines for this project. - [x ] I have added tests to cover my changes.
- [ x] All new and existing tests passed.
- [ x] No new compiler warnings were introduced.
-
These changes break backwards compatibility.