-
Notifications
You must be signed in to change notification settings - Fork 35
Run some code checks #1416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Run some code checks #1416
Conversation
@@ -234,7 +235,8 @@ int which_kind_of_ode(serac::TimestepMethod m) | |||
if (m == serac::TimestepMethod::CentralDifference) return 2; | |||
if (m == serac::TimestepMethod::FoxGoodwin) return 2; | |||
|
|||
return -1; | |||
SLIC_ERROR(axom::fmt::format("Unsupported serac::TimestepMethod {0}", static_cast<int>(m))); | |||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clang-tidy complained this was returning -1, because it figured out the return value was being used as an index. I can see we'd still want to fail in this case, so I decided to explicitly print an error instead.
for (const auto& state_name : state_names) { | ||
checkpoint_states_[state_name].push_back(state(state_name)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removes virtual function call in constructor. Warning was the following:
Call to virtual method 'Thermal::stateNames' during construction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall]
for (const auto& state_name : state_names) { | ||
checkpoint_states_[state_name].push_back(state(state_name)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added resetting of checkpoint states to completeSetup()
to fix thermomech_finite_diff
segfault. I think this was supposed to be here anyway.
/style |
int lineSearchIter = 0; | ||
while (!happyAboutTrSize && lineSearchIter <= nonlinear_options.max_line_search_iterations) { | ||
while (lineSearchIter <= nonlinear_options.max_line_search_iterations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tupek2 let me know if removing this var was the right call
Running basic code checks to ensure quality
cppcheck
didn't catch too much
clang-tidy
how i ran clang-tidy
[ignored] warning related to logger
[solved] warning related to
stateNames()
stateNames()
intoresetStates()
instead (see PR diff, also simplified godbolt example showcasing warning https://godbolt.org/z/P391j9YP3)[ignored] memory leak warning related to
generateParFiniteElementSpace()
generateParFiniteElementSpace
, which creates amfem::FiniteElementCollection
(fec) and amfem::ParFiniteElementSpace
(fes). Fes takes a raw pointer of fec in its constructor.// NOLINT
is kind of unreasonable, since it would have to be added to every timegenerateParFiniteElementSpace
is called (it cannot be added to functions - it can only be added to lines of code that triggers the warning).