Skip to content
Snippets Groups Projects
Commit bc36f05e authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Remove size() from the API

parent 050558b1
No related branches found
No related tags found
1 merge request!377Resolve "Fix Problem::getState() and getState(ts)"
...@@ -49,8 +49,6 @@ class VectorComposite : public std::unordered_map < std::string, Eigen::VectorXd ...@@ -49,8 +49,6 @@ class VectorComposite : public std::unordered_map < std::string, Eigen::VectorXd
VectorComposite(const VectorXd& _v, const StateStructure& _structure, const std::list<int>& _sizes); VectorComposite(const VectorXd& _v, const StateStructure& _structure, const std::list<int>& _sizes);
VectorComposite(const StateStructure& _structure, const std::list<VectorXd>& _vectors); VectorComposite(const StateStructure& _structure, const std::list<VectorXd>& _vectors);
unsigned int size(const StateStructure& _structure) const;
Eigen::VectorXd vector(const StateStructure& _structure) const; Eigen::VectorXd vector(const StateStructure& _structure) const;
/** /**
......
...@@ -62,18 +62,6 @@ VectorComposite::VectorComposite (const StateStructure& _structure, const std::l ...@@ -62,18 +62,6 @@ VectorComposite::VectorComposite (const StateStructure& _structure, const std::l
} }
unsigned int VectorComposite::size(const StateStructure &_structure) const
{
unsigned int size = 0;
for (const auto& ckey : _structure)
{
std::string key(1,ckey); // ckey is char
const VectorXd& v = this->at(key);
size += v.size();
}
return size;
}
Eigen::VectorXd VectorComposite::vector(const StateStructure &_structure) const Eigen::VectorXd VectorComposite::vector(const StateStructure &_structure) const
{ {
// traverse once with unordered_map access // traverse once with unordered_map access
......
...@@ -331,20 +331,6 @@ TEST(VectorComposite, unary_Minus) ...@@ -331,20 +331,6 @@ TEST(VectorComposite, unary_Minus)
ASSERT_MATRIX_APPROX((-x).at("O"), Vector3d(-2,-2,-2), 1e-20); ASSERT_MATRIX_APPROX((-x).at("O"), Vector3d(-2,-2,-2), 1e-20);
} }
TEST(VectorComposite, size)
{
VectorComposite x;
x.emplace("P", Vector2d(1,1));
x.emplace("O", Vector3d(2,2,2));
x.emplace("V", Vector4d(3,3,3,3));
ASSERT_EQ(x.size("PO"), 5);
ASSERT_EQ(x.size("VO"), 7);
ASSERT_EQ(x.size("PVO"), 9);
ASSERT_EQ(x.size("OPV"), 9);
}
TEST(VectorComposite, stateVector) TEST(VectorComposite, stateVector)
{ {
VectorComposite x; VectorComposite 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