Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 91688a5f authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#527 GlobalMatrix and GlobalVector: add free functions that provide operators...

#527 GlobalMatrix and GlobalVector: add free functions that provide operators < and == for numbering subset(s).
parent adea34d2
......@@ -40,6 +40,25 @@ namespace HappyHeart
Swap(static_cast<Parent&>(A), static_cast<Parent&>(B));
}
bool NumberingSubsetEqual(const GlobalMatrix& lhs, const GlobalMatrix& rhs)
{
return lhs.GetRowNumberingSubset() == rhs.GetRowNumberingSubset()
&& lhs.GetColNumberingSubset() == rhs.GetColNumberingSubset();
}
bool NumberingSubsetLess(const GlobalMatrix& lhs, const GlobalMatrix& rhs)
{
const auto& lhs_row_subset = lhs.GetRowNumberingSubset();
const auto& rhs_row_subset = rhs.GetRowNumberingSubset();
if (lhs_row_subset == rhs_row_subset)
return lhs.GetColNumberingSubset() < rhs.GetColNumberingSubset();
return lhs_row_subset < rhs_row_subset;
}
} // namespace HappyHeart
......@@ -99,6 +99,27 @@ namespace HappyHeart
};
/*!
* \brief Returns true when two GlobalMatrices share the same numbering subsets.
*
* This is intended to be used in containers in which at most one GlobalMatrix with (row_numbering_subset,
* col_numbering_subset) may be found.
*/
bool NumberingSubsetEqual(const GlobalMatrix& lhs, const GlobalMatrix& rhs);
/*!
* \brief operator< for the numbering subsets.
*
* Row subset are compared first, and in case of equality columns ones are looked at.
*
* This is intended to be used in containers in which at most one GlobalMatrix with (row_numbering_subset,
* col_numbering_subset) may be found.
*/
bool NumberingSubsetLess(const GlobalMatrix& lhs, const GlobalMatrix& rhs);
/*!
* \brief Swap two matrices.
......
......@@ -24,7 +24,7 @@ namespace HappyHeart
{
return col_numbering_subset_;
}
} // namespace HappyHeart
......
......@@ -36,6 +36,20 @@ namespace HappyHeart
Swap(static_cast<Parent&>(A), static_cast<Parent&>(B));
}
bool NumberingSubsetEqual(const GlobalVector& lhs, const GlobalVector& rhs)
{
return lhs.GetNumberingSubset() == rhs.GetNumberingSubset();
}
bool NumberingSubsetLess(const GlobalVector& lhs, const GlobalVector& rhs)
{
return lhs.GetNumberingSubset()< rhs.GetNumberingSubset();
}
} // namespace HappyHeart
......@@ -90,6 +90,25 @@ namespace HappyHeart
};
/*!
* \brief Returns true when two GlobalVectors share the same numbering subset.
*
* This is intended to be used in containers in which at most one GlobalVector with a given numbering
* subset may be found.
*/
bool NumberingSubsetEqual(const GlobalVector& lhs, const GlobalVector& rhs);
/*!
* \brief operator< for the numbering subsets.
*
* This is intended to be used in containers in which at most one GlobalVector with a given numbering
* subset may be found.
*/
bool NumberingSubsetLess(const GlobalVector& lhs, const GlobalVector& rhs);
/*!
* \brief Swap two vectors.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment