Skip to content

Improve implementation of NeuBndCond, DirBndCond, RobBndCond, and AddTraceIntegral and tidy LoopExecution

Issue/feature addressed

Improve implementation of NeuBndCond, DirBndCond, RobBndCond, and AddTraceIntegral to prevent repeated copy to Array.

Proposed solution

  • Consider padding element in the m_traceCoeffsToElmtTrace and m_traceCoeffsToElmtMap mapping to avoid copy to an array for AddTraceIntegral
  • Consider padding element in the mapping to avoid copy to an array for DirBndCond. Also pre-collect the Dirichlet coefficient data in a contiguous MemoryRegion for better memory access
  • Consider padding element in the mapping to avoid copy to an array for NeuBndCond. Also pre-collect the Neumann coefficient data in a contiguous MemoryRegion for better memory access
  • Consider padding element in the mapping to avoid copy to an array for RobBndCond. Also pre-collect the Robin coefficient data in a contiguous MemoryRegion for better memory access
  • Split LoopExecution into back-end specific file.

Implementation

The previous implementation require a copy of a MemoryRegion to an array to skip over the padding elements in order to access a mapping array. The present MR propose to take into consideration padding elements by pre-processing the legacy mapping array in the following way

        // Set mapping to skip over padding elements
        int i, j;

        i = 0, j = 0;
        Array<OneD, int> alignmentMap(expansionList->GetNcoeffs());
        auto blocks =
            GetBlockAttributes(FieldState::Coeff, expansionList, vec_t::width);
        for (auto &block : blocks)
        {
            auto const ncoeff    = block.num_pts;
            auto const nElmts    = block.num_elements;
            auto const nPadElmts = block.num_padding_elements;
            for (unsigned int e = 0; e < nElmts; e++)
            {
                for (unsigned int n = 0; n < ncoeff; n++)
                {
                    alignmentMap[i++] = j++;
                }
            }
            j += nPadElmts * ncoeff;
        }
        // Compute aligned map to skip over padding elements
        for (int i = 0; i < alignedMap.size(); i++)
        {
            alignedMap[i] =
                alignmentMap[map[i]];
        }

Tests

Suggested reviewers

Please suggest any people who would be appropriate to review your code.

Notes

Please add any other information that could be useful for reviewers.

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 Jacques Xing

Merge request reports

Loading