Fix docstrings, remove dead typedef, and fix getElapsedTimeStep off-by-one - #1412
Open
dweep-desai wants to merge 3 commits into
Open
dweep-desai wants to merge 3 commits into
dweep-desai wants to merge 3 commits into
Conversation
Author
|
I have read the CLA Document and I hereby sign the CLA |
Member
Presumably you're using static analysis/AI? Ideally each fix should be in a distinct commit, this makes it easier to review them properly. The team is currently busy at a national conference, we'll hopefully be able to discuss this internally in a week or two. |
- getElapsedTimeExitFunctions: stepFunctions() -> exitFunctions() - getElapsedTimeRTCInitialisation: fix typo iniitliased -> initialised - All getElapsedTime* methods: fix copy-pasted @return tags to be method-specific - getElapsedTimeSteps comment: fix typos mutabililty -> mutability, performacne -> performance Fixes FLAMEGPU#1392
The typedef was defined as the element type of CUDARTCFuncMap but was never referenced anywhere in the codebase. Other similar dead typedefs were removed in earlier refactors; this one was missed. Fixes FLAMEGPU#1378
The bounds check used > instead of >=, allowing step == size() to pass the guard. std::vector::at() then threw std::out_of_range instead of the project's own exception::OutOfBoundsException. Also enables the previously commented-out @todo out-of-bounds test and adds a boundary regression test for step == STEPS. Fixes FLAMEGPU#1411
dweep-desai
force-pushed
the
fix/code-quality-dead-code-docstrings-obo
branch
from
September 7, 2026 14:50
6897e3b to
a45b827
Compare
Author
|
Thanks for the review @Robadob! I've addressed your feedback:
Force-pushed to update the branch. No rush on the review — enjoy the conference! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Code quality PR addressing 3 open issues: incorrect/copy-pasted docstrings, an unused typedef, and a newly discovered off-by-one bounds check bug in
getElapsedTimeStep().Each fix is in a distinct commit for ease of review.
Changes
Commit 1: Fix
getElapsedTime*docstrings (Fixes #1392)The docstring for
CUDASimulation::getElapsedTimeExitFunctionsincorrectly referred tostepFunctions()instead ofexitFunctions(). As suggested in the issue, a wider pass was done over allgetElapsedTime*docstrings, revealing:getElapsedTimeRTCInitialisation: Typo "iniitliased" corrected to "initialised".@return elapsed time of last simulation call in seconds.corrected to method-specific descriptions.getElapsedTimeStepscomment: Typos "mutabililty" and "performacne" corrected.Commit 2: Remove unused
CUDARTCFuncMapPairtypedef (Fixes #1378)CUDAAgent::CUDARTCFuncMapPairwas defined as a typedef but never referenced anywhere in the codebase. The docstring described it as "Element type of CUDARTCFuncMap" butCUDARTCFuncMapis astd::map, not using this pair type. Removed the typedef and its docstring.Commit 3: Fix
getElapsedTimeStepoff-by-one bounds check (Fixes #1411)CUDASimulation::getElapsedTimeStep(unsigned int step)usedstep > size()instead ofstep >= size(). Whenstep == size()(e.g., requesting step 10 after a 10-step simulation where valid indices are 0–9):10 > 10evaluated tofalse, passing the check.at(10)then threwstd::out_of_rangeinstead ofexception::OutOfBoundsExceptionAlso enables the previously commented-out
// @todoout-of-bounds test and adds a boundary regression test.Files Changed
include/flamegpu/simulation/CUDASimulation.hgetElapsedTime*methodsinclude/flamegpu/simulation/detail/CUDAAgent.hCUDARTCFuncMapPairtypedefsrc/flamegpu/simulation/CUDASimulation.cutests/test_cases/simulation/test_cuda_simulation.cuValidation
cpplintpassed on all 4 modified files with 0 errors.Fixes #1392, #1378, #1411