Files
FESADev/phases/domain-runtime-storage/step1.md
T
2026-06-09 10:08:34 +09:00

65 lines
2.8 KiB
Markdown

# Step 1: element-material-property-runtime-storage
## Read First
Read these files before editing:
- `/AGENTS.md`
- `/docs/AGENT_RULES.md`
- `/docs/implementation-plans/domain-runtime-storage-implementation-plan.md`
- `/include/fesa/core/Domain.hpp`
- `/include/fesa/core/ModelTypes.hpp`
- `/include/fesa/core/ElementDefinition.hpp`
- `/include/fesa/element/Element.hpp`
- `/include/fesa/element/Mitc4Element.hpp`
- `/include/fesa/material/Material.hpp`
- `/include/fesa/material/LinearElasticMaterial.hpp`
- `/include/fesa/property/ShellProperty.hpp`
- `/src/core/Domain.cpp`
- `/tests/core/domain_storage_test.cpp`
- `/tests/core/domain_model_object_test.cpp`
## Task
Make runtime element, material, and shell property objects the canonical Domain storage.
Required API shape:
- `void Domain::addElement(std::unique_ptr<fesa::element::Element> element)`
- `const fesa::element::Element* Domain::findElement(ElementId id) const noexcept`
- `const fesa::element::Element& Domain::element(ElementId id) const`
- `std::size_t Domain::elementCount() const noexcept`
- `void Domain::addMaterial(std::unique_ptr<fesa::material::Material> material)`
- `const fesa::material::Material* Domain::findMaterial(MaterialId id) const noexcept`
- `const fesa::material::Material& Domain::material(MaterialId id) const`
- `std::size_t Domain::materialCount() const noexcept`
- `void Domain::addShellProperty(fesa::property::ShellProperty property)`
- `const fesa::property::ShellProperty* Domain::findShellProperty(PropertyId id) const noexcept`
- `const fesa::property::ShellProperty& Domain::shellProperty(PropertyId id) const`
- `std::size_t Domain::shellPropertyCount() const noexcept`
Rules:
- Move `ElementType` to `/include/fesa/core/ModelTypes.hpp` so runtime `Element` no longer includes `/include/fesa/core/ElementDefinition.hpp`.
- `Domain::addShellProperty` must reject duplicate property ids and missing material ids.
- `Domain::addElement` must reject null pointers, duplicate element ids, missing node ids, and missing shell property ids.
- Keep C++17/MSVC compatibility and RAII ownership.
## Tests To Write First
- Rewrite or extend `/tests/core/domain_storage_test.cpp` so element, material, and shell property storage uses runtime objects instead of `ElementDefinition`, `LinearElasticMaterialDefinition`, and `ShellPropertyDefinition`.
- Add or adjust a test that proves `Element` no longer depends on `ElementDefinition` for `ElementType`.
## Acceptance Criteria
```powershell
ctest --test-dir build/msvc-debug --output-on-failure -C Debug -R "domain|model-object"
python scripts/validate_workspace.py
```
## Verification Notes
1. Run the targeted CTest before and after implementation to capture RED then GREEN.
2. Do not delete definition classes in this step; only remove them from Domain storage.
3. Update `phases/domain-runtime-storage/index.json` for this step result.