refactor: store runtime objects in domain

This commit is contained in:
김경종
2026-06-09 10:08:34 +09:00
parent 8f24213ab7
commit f4196efb10
20 changed files with 754 additions and 368 deletions
+42
View File
@@ -0,0 +1,42 @@
{
"project": "FESA Structural Solver",
"phase": "domain-runtime-storage",
"steps": [
{
"step": 0,
"name": "runtime-storage-contract",
"status": "completed",
"summary": "Created the Domain runtime storage implementation plan and recorded the parser-record-to-factory-to-runtime-Domain contract."
},
{
"step": 1,
"name": "element-material-property-runtime-storage",
"status": "completed",
"summary": "Migrated Domain element, material, and shell property storage to runtime objects and moved ElementType to ModelTypes."
},
{
"step": 2,
"name": "load-boundary-runtime-storage",
"status": "completed",
"summary": "Migrated Domain load and boundary storage to runtime polymorphic objects with node-reference and duplicate-key validation."
},
{
"step": 3,
"name": "step-and-set-runtime-references",
"status": "completed",
"summary": "Updated element set and linear static step validation to reference runtime element, load, and boundary containers."
},
{
"step": 4,
"name": "legacy-definition-extraction",
"status": "completed",
"summary": "Removed core definition DTOs from Domain public API and persistent storage while keeping focused definition tests for parser/factory records."
},
{
"step": 5,
"name": "validation-report-handoff",
"status": "completed",
"summary": "Validated with script self-tests, targeted CTest, workspace validation, and git diff whitespace checks."
}
]
}
+50
View File
@@ -0,0 +1,50 @@
# Step 0: runtime-storage-contract
## Read First
Read these files before editing:
- `/AGENTS.md`
- `/docs/PLAN.md`
- `/docs/PROGRESS.md`
- `/docs/WORKNOTE.md`
- `/docs/AGENT_RULES.md`
- `/docs/ARCHITECTURE.md`
- `/docs/ADR.md`
- `/docs/implementation-plans/domain-model-foundation-implementation-plan.md`
- `/docs/implementation-plans/analysis-model-objects-implementation-plan.md`
- `/include/fesa/core/Domain.hpp`
- `/src/core/Domain.cpp`
## Task
Create `/docs/implementation-plans/domain-runtime-storage-implementation-plan.md`.
The plan must state that `Domain` owns runtime model objects as its canonical storage:
- nodes remain value objects under `fesa::core::Node`;
- elements are stored as `fesa::element::Element` objects;
- materials are stored as `fesa::material::Material` objects;
- shell properties are stored as `fesa::property::ShellProperty` runtime objects;
- loads are stored as `fesa::load::Load` objects;
- boundary conditions are stored as `fesa::boundary::BoundaryCondition` objects;
- steps may remain `LinearStaticStepDefinition` until an analysis-step object is introduced, but step indices must reference runtime load and boundary containers;
- `core::*Definition` classes may remain as parser/factory-local records, but `Domain` must not persist them.
The plan must also list the migration order and identify the C++ tests that will be rewritten or added.
## Tests To Write First
- Documentation-only step. No C++ test is required in this step.
## Acceptance Criteria
```powershell
python -m unittest discover -s scripts -p "test_*.py"
```
## Verification Notes
1. Confirm the plan does not introduce parser implementation work.
2. Confirm the plan does not change MITC4 formulation, reference artifacts, or tolerance policy.
3. Update `phases/domain-runtime-storage/index.json` for this step result.
+64
View File
@@ -0,0 +1,64 @@
# 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.
+59
View File
@@ -0,0 +1,59 @@
# Step 2: load-boundary-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/load/Load.hpp`
- `/include/fesa/load/NodalLoad.hpp`
- `/include/fesa/boundary/BoundaryCondition.hpp`
- `/include/fesa/boundary/SinglePointConstraint.hpp`
- `/src/core/Domain.cpp`
- `/tests/core/domain_storage_test.cpp`
- `/tests/core/domain_model_object_test.cpp`
## Task
Make runtime load and boundary objects the canonical Domain storage.
Required API shape:
- `std::size_t Domain::addLoad(std::unique_ptr<fesa::load::Load> load)`
- `const fesa::load::Load* Domain::findLoad(std::size_t index) const noexcept`
- `const fesa::load::Load& Domain::load(std::size_t index) const`
- `std::size_t Domain::loadCount() const noexcept`
- `std::size_t Domain::addBoundaryCondition(std::unique_ptr<fesa::boundary::BoundaryCondition> boundary)`
- `const fesa::boundary::BoundaryCondition* Domain::findBoundaryCondition(std::size_t index) const noexcept`
- `const fesa::boundary::BoundaryCondition& Domain::boundaryCondition(std::size_t index) const`
- `std::size_t Domain::boundaryConditionCount() const noexcept`
Rules:
- Reject null load and boundary pointers.
- `NodalLoad` must reference an existing node.
- `SinglePointConstraint` must reference an existing node.
- Duplicate `(node, dof)` nodal loads must throw.
- Duplicate `(node, dof)` single-point constraints must throw.
- Runtime load and boundary storage must not use `core::NodalLoadDefinition` or `core::BoundaryCondition`.
## Tests To Write First
- Rewrite or extend `/tests/core/domain_storage_test.cpp` so load and boundary storage uses runtime objects.
- Add missing-node tests for `NodalLoad` and `SinglePointConstraint` runtime insertion.
## 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 targeted CTest before production edits and confirm failure.
2. Keep solver state out of `Domain`.
3. Update `phases/domain-runtime-storage/index.json` for this step result.
+42
View File
@@ -0,0 +1,42 @@
# Step 3: step-and-set-runtime-references
## 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/StepDefinition.hpp`
- `/src/core/Domain.cpp`
- `/tests/core/domain_storage_test.cpp`
## Task
Make Domain set and step validation reference runtime storage.
Rules:
- `Domain::addElementSet` must validate ids against runtime elements stored by `Domain::findElement`.
- `Domain::addStep(LinearStaticStepDefinition)` may remain for now, but its boundary and load indices must validate against runtime boundary and load containers.
- Failed insertions must not mutate Domain counts.
- No equation ids, solver vectors, residuals, reactions, current time, or iteration state may be added to Domain.
## Tests To Write First
- Rewrite `/tests/core/domain_storage_test.cpp` set and step tests so they build elements, loads, and boundary conditions through runtime object APIs.
- Preserve count-stability tests for failed insertions.
## Acceptance Criteria
```powershell
ctest --test-dir build/msvc-debug --output-on-failure -C Debug -R domain
python scripts/validate_workspace.py
```
## Verification Notes
1. Run targeted CTest before production edits and confirm failure.
2. Keep `LinearStaticStepDefinition` as the only remaining step record until a separate step-model phase exists.
3. Update `phases/domain-runtime-storage/index.json` for this step result.
+47
View File
@@ -0,0 +1,47 @@
# Step 4: legacy-definition-extraction
## 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`
- `/src/core/Domain.cpp`
- `/tests/core/domain_storage_test.cpp`
- `/CMakeLists.txt`
## Task
Remove parser-definition DTO persistence from `Domain`.
Rules:
- `Domain` must no longer include or store:
- `fesa/core/BoundaryCondition.hpp`
- `fesa/core/ElementDefinition.hpp`
- `fesa/core/LoadDefinition.hpp`
- `fesa/core/MaterialDefinition.hpp`
- `fesa/core/PropertyDefinition.hpp`
- `Domain` may still include `StepDefinition.hpp` until a runtime step object is designed.
- Definition classes may remain in the repository and their focused tests may remain, but they must not be part of Domain storage or Domain public API.
- Do not implement parser or factory behavior in this step.
## Tests To Write First
- Add or update a compile-time assertion in `/tests/core/domain_storage_test.cpp` or a dedicated domain API test proving Domain retrieval returns runtime types for elements, materials, properties, loads, and boundary conditions.
## Acceptance Criteria
```powershell
python -m unittest discover -s scripts -p "test_*.py"
python scripts/validate_workspace.py
git diff --check
```
## Verification Notes
1. Confirm no `Domain` method returns a definition DTO except `LinearStaticStepDefinition`.
2. Confirm `include/fesa/element/Element.hpp` no longer includes `ElementDefinition.hpp`.
3. Update `phases/domain-runtime-storage/index.json` for this step result.
+42
View File
@@ -0,0 +1,42 @@
# Step 5: validation-report-handoff
## Read First
Read these files before editing:
- `/AGENTS.md`
- `/docs/PLAN.md`
- `/docs/PROGRESS.md`
- `/docs/WORKNOTE.md`
- `/docs/AGENT_RULES.md`
- `/docs/implementation-plans/domain-runtime-storage-implementation-plan.md`
- `/phases/domain-runtime-storage/index.json`
## Task
Record validation evidence and handoff notes after the runtime Domain storage migration.
Required updates:
- Update `/docs/PROGRESS.md` with completed runtime Domain storage work and validation commands.
- Update `/docs/PLAN.md` only if this migration changes sequencing or acceptance criteria.
- Update `/docs/WORKNOTE.md` only if there were failures, repeated mistakes, or environment traps.
- Mark `/phases/domain-runtime-storage/index.json` steps and `/phases/index.json` phase status according to actual results.
## Tests To Write First
- Documentation/reporting step. No new C++ test is required.
## Acceptance Criteria
```powershell
python -m unittest discover -s scripts -p "test_*.py"
python scripts/validate_workspace.py
git diff --check
```
## Verification Notes
1. Do not claim numerical solver correctness.
2. Do not mark the phase completed unless all previous steps are complete and validation passed.
3. Keep validation evidence concrete: command, result, and scope.