# Step 14: DofManager ## 담당 역할과 필수 스킬 - 담당 역할: `implementation-agent` - 필수 스킬: `fesa-cpp-msvc-tdd` - 모든 C++ build/test와 최종 VERIFY는 MSVC x64 Debug 기준으로 수행한다. ## 읽어야 할 파일 - `/AGENTS.md` - `/docs/ARCHITECTURE.md` - `/docs/ADR.md` - `/docs/linear-static-3d-euler-beam/requirements.md` - `/docs/linear-static-3d-euler-beam/io.md` - `/docs/linear-static-3d-euler-beam/implementation-plan.md` - `/include/fesa/model/domain.hpp` - `/include/fesa/analysis/analysis_model.hpp` - `/src/fesa/analysis/analysis_model.cpp` - `/tests/unit/analysis/analysis_model_test.cpp` - `/src/fesa/CMakeLists.txt` - `/tests/CMakeLists.txt` ## 소유 파일 - Create: `/include/fesa/fem/dof_manager.hpp` - Create: `/src/fesa/fem/dof_manager.cpp` - Create: `/tests/unit/fem/dof_manager_test.cpp` - Modify: `/src/fesa/CMakeLists.txt` - Modify: `/tests/CMakeLists.txt` ## 작업 node별 여섯 DOF, prescribed constraints, full/free numbering, element scatter map와 sparse pattern을 단독 소유하는 `DofManager`를 구현하라. ```cpp enum class DofComponent : std::uint8_t { ux, uy, uz, urx, ury, urz }; struct SparsePattern { std::vector rowOffsets; std::vector columnIndices; }; class DofManager { public: static Result create(const AnalysisModel& model); std::size_t fullDofCount() const noexcept; std::size_t freeDofCount() const noexcept; std::size_t constrainedDofCount() const noexcept; std::size_t fullDof(EntityIndex node, DofComponent component) const; std::optional freeEquation(std::size_t fullDof) const; const std::array& elementScatter(EntityIndex element) const; const std::vector& freeDofs() const noexcept; const std::vector& constrainedDofs() const noexcept; const Vector& prescribedValues() const noexcept; const SparsePattern& sparsePattern() const noexcept; }; ``` Node internal index와 fixed component 순서로 full DOF를 부여하고, free/constrained mapping도 stable하게 만든다. Boundary target expansion과 overlapping equal prescriptions를 처리하고, 서로 다른 prescribed value conflict는 diagnostic으로 거부한다. Sparse pattern은 active element scatter에서 생성하고 각 row column을 sorted unique로 유지한다. Node/Element model objects를 수정하지 않는다. `prescribedValues()`는 `constrainedDofCount()` 크기이며 `constrainedDofs()`와 동일 순서의 `dc`를 반환한다. Tests는 6-DOF numbering, set expansion, zero/nonzero constraints, overlapping/conflicting BC, free equation mapping, 12-DOF element scatter, CSR pattern sorted uniqueness, full/reduced round-trip를 포함하고 `DofManager` regex로 등록한다. ## Acceptance Criteria ```powershell cmake --build .harness/build --config Debug --target fesa_tests ctest --test-dir .harness/build -C Debug -R DofManager --output-on-failure ``` 위 command의 RED를 확인한 뒤 구현하고 다음 GREEN/VERIFY를 실행한다. ```powershell cmake -S . -B .harness/build -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 ctest --test-dir .harness/build -C Debug -R DofManager --output-on-failure ctest --test-dir .harness/build -C Debug --show-only=json-v1 ctest --test-dir .harness/build -C Debug --output-on-failure ``` ## 검증 절차 1. numbering/constraint/pattern tests를 먼저 작성하고 RED를 확인한다. 2. deterministic mapping에 필요한 최소 구현으로 GREEN을 만든다. 3. model objects에 equation ID가 추가되지 않았는지 review하고 full VERIFY를 수행한다. 4. `/docs/linear-static-3d-euler-beam/implementation-report.md`의 Step 14 section에 실제 RED/GREEN/VERIFY command, exit code, 핵심 output과 변경 파일을 기록한다. 5. Step 14를 `completed`로 갱신하고 numbering/pattern evidence를 summary에 기록한다. ## 금지사항 - equation ID를 Node나 Element에 저장하지 마라. 이유: DofManager 단독 ownership 계약이다. - penalty method, MPC, RBE를 추가하지 마라. 이유: V0 essential elimination 범위 밖이다. - sparse numeric values를 저장하지 마라. 이유: assembly step 책임이다. - 직접 commit하지 마라. 이유: Harness executor가 담당한다.