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.
This commit is contained in:
Mark Olesen
2023-11-05 16:19:51 +01:00
parent 0338cf9a84
commit 507805c330
7 changed files with 161 additions and 78 deletions

View File

@ -171,7 +171,8 @@ int main(int argc, char *argv[])
CompactListList<label>::pack(subfaces)
);
Info<< "compact faces:" << subCompact << endl;
Info<< "deserialized:" << subCompact.unpack() << endl;
Info<< "matrix content:" << nl;
subCompact.writeMatrix(Info) << endl;
}
return 0;