# Step 13: Element Definition and Domain Ownership ## 담당 역할과 필수 스킬 - 담당 역할: `implementation-agent` - 필수 스킬: `harness`, `fesa-cpp-msvc-tdd` - 이 Step만 `RED -> observed failure -> minimal GREEN -> focused/full VERIFY`로 수행한다. ## 읽어야 할 파일 - `/AGENTS.md` - `/docs/CODINGSTYLE.md` - `/docs/ARCHITECTURE.md` - `/docs/ADR.md` - `/docs/cpp-object-oriented-modular-refactoring/implementation-plan.md` - Step 11 `source_target_resolver` files - Step 12 material/property headers and tests - `/include/fesa/model/model_types.h` - `/include/fesa/model/domain.h`, `/src/fesa/model/domain.cpp` - `/include/fesa/analysis/analysis_model.h`, `/src/fesa/analysis/analysis_model.cpp` - `/src/fesa/io/abaqus/domain_mapper.cpp` - matching Domain, AnalysisModel and DomainMapper tests - `/src/fesa/CMakeLists.txt`, `/tests/CMakeLists.txt` - `/phases/cpp-object-oriented-modular-refactoring/index.json` - `/phases/cpp-object-oriented-modular-refactoring/step13.md` ## 작업 Requirements `R-MODEL-001` and `R-ELEMENT-001`의 semantic ownership을 구현한다. 1. Domain/AnalysisModel/mapper tests에 `C-MODEL-002`를 먼저 추가한다. Tests verify mixed B33/MITC4 definition ownership through base references, vector-position `EntityIndex`, insertion order, const access, move-only Domain, and Domain-outlives-AnalysisModel contract. 2. Missing base/ownership API로 RED compile failure를 기록한다. 3. Candidate interface: ```cpp enum class ElementDefinitionKind { kEulerBeam3D, kMitc4Shell }; class ElementDefinition { public: virtual ~ElementDefinition() = default; virtual ElementDefinitionKind Kind() const noexcept = 0; virtual const SourceEntityId& SourceId() const noexcept = 0; virtual std::string_view SourceElementType() const noexcept = 0; virtual const std::vector& NodeIndices() const noexcept = 0; virtual EntityIndex PropertyIndex() const noexcept = 0; }; ``` 4. Create `/include/fesa/elements/element_definition.h`. Keep concrete definitions in the current `/include/fesa/elements/euler_beam_3d.h` and `/include/fesa/elements/mitc4_shell.h` ownership modules rather than creating a second record location. 5. Existing `EulerBeam3DDefinition` and `Mitc4ShellDefinition` become final concrete definitions; preserve B33 vs S4/S4R source type and FESA internal identity. 6. Domain owns `std::vector>`, `std::vector>`, and `std::vector>`. Accessors return const base references or const collection views; Domain copy is disabled and move is allowed if existing construction needs it. 7. Mapper builds a complete validated candidate before moving it into Domain. Failed mapping must not leave a partially visible Domain. 8. AnalysisModel remains a non-owning active index/reference view and never copies Domain. ## Acceptance Criteria ```powershell cmake --build .harness/build --config Debug --target fesa_unit_tests ctest --test-dir .harness/build -C Debug ` -R "ElementDefinition|DomainModel|AnalysisModel|InpDomainMapping" --output-on-failure & "C:/Program Files/LLVM/bin/clang-format.exe" --dry-run --Werror ` include/fesa/elements/element_definition.h ` include/fesa/model/domain.h src/fesa/model/domain.cpp ` tests/unit/model/domain_test.cpp tests/unit/analysis/analysis_model_test.cpp ` tests/unit/io/abaqus/domain_mapper_test.cpp 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, stable ownership/order/lifetime focused tests, mapper and full CTest를 summary에 기록한다. - Index/order/lifetime regression is `error`; missing ownership decision is `blocked`. - 성공 시 현재 Step만 `completed`로 갱신한다. - timestamp, retry, commit, advancement는 Executor 소유다. ## 금지사항 - `Clone()` or `shared_ptr`를 추가하지 마라. 이유: Domain has unique immutable ownership. - Node/Element에 equation id를 저장하지 마라. - Runtime Element methods를 semantic definition에 넣지 마라. - 직접 commit하거나 hook script를 수동 실행하지 마라.