Skip to content
Snippets Groups Projects
Commit 979f6514 authored by Médéric Fourmy's avatar Médéric Fourmy
Browse files

Merge branch '287-complete-state-vector-new-data-structure' into...

Merge branch '287-complete-state-vector-new-data-structure' into adapting-to-multiple-processor-motion-285
parents a58dff6e a13278ce
No related branches found
No related tags found
1 merge request!339Adapting to multiple processor motion 285
Pipeline #4985 passed
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
namespace wolf namespace wolf
{ {
/// State of nodes containing several state blocks
typedef std::unordered_map<std::string, Eigen::VectorXd> State;
class HasStateBlocks class HasStateBlocks
{ {
public: public:
...@@ -70,6 +74,8 @@ class HasStateBlocks ...@@ -70,6 +74,8 @@ class HasStateBlocks
unsigned int getSize(std::string _sub_structure="") const; unsigned int getSize(std::string _sub_structure="") const;
unsigned int getLocalSize(std::string _sub_structure="") const; unsigned int getLocalSize(std::string _sub_structure="") const;
State getStateComposite();
private: private:
std::string structure_; std::string structure_;
std::map<std::string, StateBlockPtr> state_block_map_; std::map<std::string, StateBlockPtr> state_block_map_;
...@@ -266,6 +272,15 @@ inline Eigen::VectorXd HasStateBlocks::getState(std::string _sub_structure) cons ...@@ -266,6 +272,15 @@ inline Eigen::VectorXd HasStateBlocks::getState(std::string _sub_structure) cons
return state; return state;
} }
inline State HasStateBlocks::getStateComposite()
{
State state;
for (auto& pair_key_kf : state_block_map_)
{
state.emplace(pair_key_kf.first, pair_key_kf.second->getState());
}
return state;
}
inline unsigned int HasStateBlocks::getSize(std::string _sub_structure) const inline unsigned int HasStateBlocks::getSize(std::string _sub_structure) const
{ {
...@@ -303,6 +318,5 @@ inline unsigned int HasStateBlocks::getLocalSize(std::string _sub_structure) con ...@@ -303,6 +318,5 @@ inline unsigned int HasStateBlocks::getLocalSize(std::string _sub_structure) con
return size; return size;
} }
} // namespace wolf } // namespace wolf
#endif /* STATE_BLOCK_HAS_STATE_BLOCKS_H_ */ #endif /* STATE_BLOCK_HAS_STATE_BLOCKS_H_ */
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