Skip to content
Snippets Groups Projects
Commit ae848b3a authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

method for checking structure

parent aeabe238
No related branches found
No related tags found
1 merge request!414Resolve "IsMotion used in Problem::getState()"
...@@ -69,13 +69,7 @@ class VectorComposite : public std::unordered_map < char, Eigen::VectorXd > ...@@ -69,13 +69,7 @@ class VectorComposite : public std::unordered_map < char, Eigen::VectorXd >
void set(const VectorXd& _v, const StateStructure& _structure, const std::list<int>& _sizes); void set(const VectorXd& _v, const StateStructure& _structure, const std::list<int>& _sizes);
void setZero(); void setZero();
bool includesStructure(const StateStructure& _structure) bool includesStructure(const StateStructure &_structure) const;
{
for (auto key : _structure)
if (count(key) == 0)
return false;
return true;
}
friend std::ostream& operator <<(std::ostream &_os, const wolf::VectorComposite &_x); friend std::ostream& operator <<(std::ostream &_os, const wolf::VectorComposite &_x);
friend wolf::VectorComposite operator +(const wolf::VectorComposite &_x, const wolf::VectorComposite &_y); friend wolf::VectorComposite operator +(const wolf::VectorComposite &_x, const wolf::VectorComposite &_y);
......
...@@ -81,6 +81,14 @@ Eigen::VectorXd VectorComposite::vector(const StateStructure &_structure) const ...@@ -81,6 +81,14 @@ Eigen::VectorXd VectorComposite::vector(const StateStructure &_structure) const
return x; return x;
} }
bool VectorComposite::includesStructure(const StateStructure &_structure) const
{
for (auto key : _structure)
if (count(key) == 0)
return false;
return true;
}
std::ostream& operator <<(std::ostream &_os, const wolf::VectorComposite &_x) std::ostream& operator <<(std::ostream &_os, const wolf::VectorComposite &_x)
{ {
for (const auto &pair_key_vec : _x) for (const auto &pair_key_vec : _x)
......
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