66 lines
2.2 KiB
Markdown
66 lines
2.2 KiB
Markdown
# Step 2: analysis-state-guards
|
|
|
|
## 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/analysis-state-analysis-base-implementation-plan.md`
|
|
- `/include/fesa/core/AnalysisState.hpp`
|
|
- `/src/core/AnalysisState.cpp`
|
|
- `/tests/core/analysis_state_test.cpp`
|
|
- `/CMakeLists.txt`
|
|
|
|
## Task
|
|
|
|
Extend `AnalysisState` with mutation and guard behavior.
|
|
|
|
Required contract:
|
|
|
|
- `resize(std::size_t dof_count)` resets every vector to the new size and fills with zero.
|
|
- `setDisplacement(std::vector<double>)`, `setExternalForce(std::vector<double>)`, `setInternalForce(std::vector<double>)`, `setResidual(std::vector<double>)`, and `setReaction(std::vector<double>)` replace one vector.
|
|
- setter inputs must match `dofCount()`.
|
|
- size mismatch throws `std::invalid_argument`.
|
|
- a failed setter must not mutate the existing vector.
|
|
- `clearForces()` zeros external force, internal force, residual, and reaction while leaving displacement unchanged.
|
|
- `currentTime()`, `incrementIndex()`, and `iterationIndex()` accessors exist with setters.
|
|
|
|
## Tests To Write First
|
|
|
|
Add tests in `/tests/core/analysis_state_test.cpp` before production changes:
|
|
|
|
- setters replace vectors when sizes match.
|
|
- mismatched setter input throws and preserves old values.
|
|
- resize resets all vectors to zero.
|
|
- clearForces preserves displacement and zeros force-like vectors.
|
|
- time, increment, and iteration counters can be updated.
|
|
|
|
Run the targeted test and confirm it fails before implementation:
|
|
|
|
```powershell
|
|
ctest --test-dir build/msvc-debug --output-on-failure -C Debug -R analysis
|
|
```
|
|
|
|
Then implement the minimum code needed to pass.
|
|
|
|
## Acceptance Criteria
|
|
|
|
Run:
|
|
|
|
```powershell
|
|
ctest --test-dir build/msvc-debug --output-on-failure -C Debug -R analysis
|
|
python scripts/validate_workspace.py
|
|
```
|
|
|
|
Update `/phases/analysis-state-analysis-base/index.json` step 2 with `completed`, `error`, or `blocked`.
|
|
|
|
## Do Not
|
|
|
|
- Do not add dynamics-only velocity or acceleration vectors in this phase.
|
|
- Do not add thermal temperature fields in this phase.
|
|
- Do not add equation numbering or DOF mapping responsibilities.
|