Skip to content

Remove duplicate getEntityNDIndex definition and fix entity indexing bugs#4

Draft
Copilot wants to merge 5 commits intoFEMContainerfrom
copilot/patient-lungfish
Draft

Remove duplicate getEntityNDIndex definition and fix entity indexing bugs#4
Copilot wants to merge 5 commits intoFEMContainerfrom
copilot/patient-lungfish

Conversation

Copy link

Copilot AI commented Nov 19, 2025

The TODO in DOFHandler.hpp was misleading—getEntityNDIndex was already implemented inline in DOFHandler.h. However, inspection revealed critical bugs in the helper functions it dispatches to.

Changes

  • Removed duplicate definition: Eliminated out-of-line declaration with TODO in DOFHandler.hpp (lines 296-300)

  • Fixed vertex/edge indexing: Replaced incorrect bit operations with explicit offset arrays matching counter-clockwise ordering from fillLagrangeDOFMappingTable

    • getVertexNDIndex: 2D vertex 2 was computing [0,1] instead of [1,1]
    • getEdgeNDIndex: All 3D edge types (EdgeX, EdgeY, EdgeZ) produced wrong orderings
  • Completed getFaceNDIndex: Added missing FaceXZ and FaceYZ implementations for 3D

  • Fixed spelling: HexahedronHexaedron to match Entity.h definition

// Before: incorrect bit operations
vertexNDIndex[0] += vertexLocalIndex & 1;        // 0,1,0,1 ❌
vertexNDIndex[1] += (vertexLocalIndex >> 1) & 1; // 0,0,1,1 ❌

// After: explicit counter-clockwise ordering
constexpr size_t offsets[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
vertexNDIndex[0] += offsets[vertexLocalIndex][0]; // 0,1,1,0 ✓
vertexNDIndex[1] += offsets[vertexLocalIndex][1]; // 0,0,1,1 ✓

The indexing bugs would have caused incorrect DOF mappings throughout FEM assembly operations.

Original prompt

Work on TODO: implement the mapping to get entity NDIndex (from src/FEM/DOFHandler.hpp)

Created from VS Code via the GitHub Pull Request extension.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits November 19, 2025 22:49
- Removed duplicate out-of-line definition of getEntityNDIndex from DOFHandler.hpp (the function is already correctly implemented inline in DOFHandler.h)
- Completed getFaceNDIndex implementation by adding FaceXZ and FaceYZ cases
- Fixed spelling inconsistency: Hexahedron -> Hexaedron to match Entity.h definition

Co-authored-by: anekslen <91374074+anekslen@users.noreply.github.com>
- Fixed getVertexNDIndex to use explicit offset arrays matching fillLagrangeDOFMappingTable
- Fixed getEdgeNDIndex for all edge types to use counter-clockwise ordering
- Previous bit-operation implementations produced incorrect orderings

Co-authored-by: anekslen <91374074+anekslen@users.noreply.github.com>
Co-authored-by: anekslen <91374074+anekslen@users.noreply.github.com>
Co-authored-by: anekslen <91374074+anekslen@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement mapping to get entity NDIndex Remove duplicate getEntityNDIndex definition and fix entity indexing bugs Nov 19, 2025
Copilot AI requested a review from anekslen November 19, 2025 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments