From 507805c33067e7a9e2cfe877fc0a3c29ebb96622 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Sun, 5 Nov 2023 16:19:51 +0100 Subject: [PATCH] ENH: partly align globalIndex and CompactListList methods - CompactListList::size() corresponds to the number of sub-lists whereas globalIndex::size() corresponds to the totalSize(). This difference can lead to potential coding errors when switching between pure addressing (eg globalIndex) and addressing with content (eg, CompactListList). Within the source tree, there are no longer any occurances of globalIndex::size() but it is nonetheless unsafe to change its meaning now. Instead provide a commonly named length() method that corresponds to the natural length: ie, the number of offsets minus 1 (with guards). - add CompactListList::writeMatrix for writing the compact contents in an unpacked form (eg, for debugging) without actually needing to unpack into storage. - provide globalIndex::whichProcID() two-parameter version with myProcNo as the first argument. Symmetric with isLocal etc, useful when using a communicator that is not worldComm. --- .../CompactListList/Test-CompactListList.C | 3 +- .../CompactListList/CompactListList.C | 105 +++++++++--------- .../CompactListList/CompactListList.H | 25 ++++- .../CompactListList/CompactListListI.H | 16 ++- .../CompactListList/CompactListListIO.C | 32 +++++- .../parallel/globalIndex/globalIndex.H | 13 ++- .../parallel/globalIndex/globalIndexI.H | 45 +++++--- 7 files changed, 161 insertions(+), 78 deletions(-) diff --git a/applications/test/CompactListList/Test-CompactListList.C b/applications/test/CompactListList/Test-CompactListList.C index 892fe58644..45d45e0996 100644 --- a/applications/test/CompactListList/Test-CompactListList.C +++ b/applications/test/CompactListList/Test-CompactListList.C @@ -171,7 +171,8 @@ int main(int argc, char *argv[]) CompactListList