Skip to content

Feature: CreateCollection using basiskey

Issue/feature addressed

In the original CreateCollection(), we compare nCoeffs nPhys ShapeType and Deformed one by one, to see if the two elements are the same type or not. However, it's possible (although it is seldom used) to set different modes and points along different directions, but leading to the same number of total points or modes. For example, Hex{nm1=2, nm2=3, nm3=4} and Hex{nm1=4, nm2=3, nm3=2}.

The original code also looks lengthy and a bit hard to read. For example, prevCoeffOffset + nCoeffs != coeffOffset is used to check if two elements (of the same type) are stored contiguously in m_exp. If not, we will create a new collection. The intention is to make sure the original storage order in m_exp is not changed. But we may have a better way to do that.

Proposed solution

This new CreateCollection() function is inspired by the redesign work. Instead of using nCoeffs nPhys and shapeType, we now use 3 basisKey to check if two elements are of the same type or not. This should be more general, and also more concise and readable than before. We loop over each exp in m_exp sequentially, check if the current is different from the previous and decide to either insert it into the existing collection or start a new collection. Thus, the original storage order is also kept.

Tests

No additional test cases.

Suggested reviewers

@ccantwel @CFD-Xing

Checklist

  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by BOYANG XIA

Merge request reports