1.9 KiB
1.9 KiB
Step 8: domain-polymorphic-ownership
Read First
Read these files before editing:
/AGENTS.md/docs/AGENT_RULES.md/docs/ARCHITECTURE.md/docs/implementation-plans/analysis-model-objects-implementation-plan.md/include/fesa/core/Domain.hpp- all model object headers created by previous steps
Task
Extend Domain with RAII ownership APIs for polymorphic model objects while preserving existing definition-storage tests.
Allowed files:
- Modify
/include/fesa/core/Domain.hpp - Modify
/src/core/Domain.cpp - Create
/tests/core/domain_model_object_test.cpp - Modify
/tests/core/domain_bootstrap_test.cpp - Modify
/CMakeLists.txt
Required behavior:
Domain::addElementObject(std::unique_ptr<Element>)Domain::findElementObject(ElementId)andDomain::elementObject(ElementId)- equivalent add/find/direct APIs for
Material,Load, and modelBoundaryCondition. - duplicate ids or duplicate load/boundary keys throw
std::invalid_argument. - missing direct lookup throws
std::out_of_range. - retrieval returns const base references or const base pointers.
- existing
DefinitionAPIs remain available.
Tests To Write First
Write /tests/core/domain_model_object_test.cpp before production changes:
- Domain owns
Mitc4Element,LinearElasticMaterial,NodalLoad, andSinglePointConstraintthroughstd::unique_ptr. - Find/direct lookup through base APIs works.
- Duplicate ids throw for element/material.
- Missing direct lookup throws.
Run targeted build and confirm RED.
Acceptance Criteria
Run:
python scripts/validate_workspace.py
ctest --test-dir build/msvc-debug --output-on-failure -C Debug -R model-object
ctest --test-dir build/msvc-debug --output-on-failure -C Debug -R domain
Update step 8 status.
Do Not
- Do not remove existing definition APIs in this step.
- Do not add solver state to Domain.