Skip to content
Snippets Groups Projects

Resolve "HasStateBlocks::getState behaves in a non predictible way"

@@ -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
inline VectorXd HasStateBlocks::getStateVector(const StateStructure& _structure) const
{
StateStructure structure;
if (_structure == "")
structure = structure_;
else
structure = _structure;
const StateStructure& structure = (_structure == "" ? structure_ : _structure);
VectorXd state(getSize(structure));
@@ -370,11 +366,11 @@ inline VectorComposite HasStateBlocks::getState(const StateStructure& _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;
Loading