Skip to content
Snippets Groups Projects
Commit 636e552e authored by Mederic Fourmy's avatar Mederic Fourmy
Browse files

[skip-ci] fix the ::getState() bug but gtest_has_state_blocks fails

parent 0b9f635b
No related branches found
No related tags found
1 merge request!450Resolve "HasStateBlocks::getState behaves in a non predictible way"
...@@ -341,11 +341,7 @@ inline void HasStateBlocks::setState(const StateStructure& _structure, const std ...@@ -341,11 +341,7 @@ inline void HasStateBlocks::setState(const StateStructure& _structure, const std
//// _structure can be either stateblock structure of the node or a subset of this structure //// _structure can be either stateblock structure of the node or a subset of this structure
inline VectorXd HasStateBlocks::getStateVector(const StateStructure& _structure) const inline VectorXd HasStateBlocks::getStateVector(const StateStructure& _structure) const
{ {
StateStructure structure; const StateStructure& structure = (_structure == "" ? structure_ : _structure);
if (_structure == "")
structure = structure_;
else
structure = _structure;
VectorXd state(getSize(structure)); VectorXd state(getSize(structure));
...@@ -370,11 +366,11 @@ inline VectorComposite HasStateBlocks::getState(const StateStructure& _structure ...@@ -370,11 +366,11 @@ inline VectorComposite HasStateBlocks::getState(const StateStructure& _structure
for (const auto key : structure) for (const auto key : structure)
{ {
auto state_it = state_block_map_.find(key); const auto& sb = getStateBlock(key);
if (state_it != state_block_map_.end()) assert(sb != nullptr && "Requested StateBlock key not in the structure");
state.emplace(key, state_it->second->getState()); state.emplace(key, sb->getState());
} }
return state; return state;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment