# Step 7: Shell Sparse Assembly

## 담당 역할과 필수 스킬

- 담당 역할: `implementation-agent`
- 필수 스킬: `harness`, `fesa-cpp-msvc-tdd`

## 읽어야 할 파일

- `/.agents/skills/harness/SKILL.md`, `/.codex/skills/fesa-cpp-msvc-tdd/SKILL.md`
- `/AGENTS.md`, `/docs/PRD.md`, `/docs/ARCHITECTURE.md`, `/docs/ADR.md`
- `/docs/HARNESS.md`, `/docs/HARNESS_WORKFLOW.md`, `/.codex/hooks.json`
- `/docs/linear-static-mitc4-shell/implementation-plan.md`
- `/docs/linear-static-mitc4-shell/requirements.md` Requirements 027/030/037/050/056
- `/docs/linear-static-mitc4-shell/research.md`
- `/docs/linear-static-mitc4-shell/formulation.md`
- `/docs/linear-static-mitc4-shell/numerical-review.md`
- `/docs/linear-static-mitc4-shell/io.md`
- `/docs/linear-static-mitc4-shell/reference-model.md`
- phase indexes, `step7.md`, completed Steps 4/6 paths and summaries
- `/include/fesa/assembly/sparse_assembler.hpp`
- `/src/fesa/assembly/sparse_assembler.cpp`
- `/src/fesa/math/sparse_matrix.cpp`
- `/tests/unit/assembly/sparse_assembler_test.cpp`

## 작업

1. `MITC4-ASM-001..003` tests를 먼저 작성한다.
2. Shell topology를 concrete MITC4 global 24x24 stiffness에 dispatch한다.
3. Active source-element order로 worker-owned local buffers를 만들고 element당
   576 COO entries에 stable `elementOrder`와 `localOrder`를 부여한다.
4. Existing `SparseMatrix::fromCoo` canonical reduction과 every diagonal slot을
   보존하며 worker가 global CSR을 직접 수정하지 않게 한다.
5. Serial/TBB/repeated run CSR bytes/values를 비교하고 identical semantic S4/S4R
   fixtures가 identical K를 만드는지 검증한다.

## Acceptance Criteria

```powershell
$requiredBuildPaths=@("C:/git/googletest","C:/Program Files (x86)/Intel/oneAPI/mkl/2026.1/lib/cmake/mkl","C:/Program Files (x86)/Intel/oneAPI/tbb/2023.1/lib/cmake/tbb","C:/Program Files/HDF_Group/HDF5/2.1.1/cmake")
foreach($p in $requiredBuildPaths){if(-not(Test-Path -LiteralPath $p)){throw "Missing $p"}}
cmake --fresh -S . -B .harness/build -G "Visual Studio 18 2026" -A x64 `
  "-DFESA_GTEST_SOURCE_DIR=C:/git/googletest" `
  "-DMKL_DIR=C:/Program Files (x86)/Intel/oneAPI/mkl/2026.1/lib/cmake/mkl" `
  "-DTBB_DIR=C:/Program Files (x86)/Intel/oneAPI/tbb/2023.1/lib/cmake/tbb" `
  "-DHDF5_DIR=C:/Program Files/HDF_Group/HDF5/2.1.1/cmake"
cmake --build .harness/build --config Debug --target fesa_unit_tests
ctest --test-dir .harness/build -C Debug -R "SparseAssembly" --output-on-failure
```

Four-node/24-DOF RED를 확인하고 minimal GREEN. 이후:

```powershell
cmake --build .harness/build --config Debug --target fesa_unit_tests
ctest --test-dir .harness/build -C Debug -R "SparseAssembly|DofManager|Mitc4ShellKernel" --output-on-failure
cmake --build .harness/build --config Debug
ctest --test-dir .harness/build -C Debug --show-only=json-v1
ctest --test-dir .harness/build -C Debug --output-on-failure
```

## 검증 및 상태 갱신

RED와 deterministic focused/full evidence를 summary에 기록하고 current Step만 갱신한다.

## 금지사항

- Worker가 global CSR을 직접 갱신하거나 unordered reduction을 사용하지 마라.
- Source type으로 quadrature/hourglass를 분기하지 마라.
- Load, solve, recovery를 구현하지 마라.
- 직접 commit/hook 실행 또는 reference/upstream 변경을 하지 마라.
