Commit 0cdcc273 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#531 Add static_assert to check tuple includes only expected types.

parent 10979afd
......@@ -122,18 +122,18 @@ namespace HappyHeart
* \brief Useful typedef to avoid cluttering the main programs with too low-level C++.
*
* \code
* GlobalVectorWithCoefficient(vm.GetNonCstForce(), 1.)
* GlobalMatrixWithCoefficient(global_matrix, 1.)
* \endcode
*
* is probably easier to grasp than either:
* \code
* std::pair<GlobalVector&, double>(vm.GetNonCstForce(), 1.)
* std::pair<GlobalMatrix&, double>(global_matrix, 1.)
* \endcode
*
* or
*
* \code
* std::make_pair(std::ref(vm.GetNonCstForce()), 1.)
* std::make_pair(std::ref(global_matrix, 1.)
* \endcode
*/
using GlobalMatrixWithCoefficient = std::pair<GlobalMatrix&, double>;
......
......@@ -11,6 +11,9 @@
# include "Utilities/Numeric/Numeric.hpp"
# include "Core/LinearAlgebra/GlobalMatrix.hpp"
# include "Core/LinearAlgebra/GlobalVector.hpp"
# include "FiniteElement/FiniteElement/LocalFEltSpace.hpp"
......@@ -32,6 +35,10 @@ namespace HappyHeart
using current_type = typename std::tuple_element<I, LinearAlgebraTupleT>::type;
static_assert(std::is_same<current_type, GlobalMatrixWithCoefficient>::value
|| std::is_same<current_type, GlobalVectorWithCoefficient>::value
, "Tuple is expected to include only one of those types.");
static void Assembly531(const LinearAlgebraTupleT& linear_algebra_tuple);
template<class LocalVariationalOperatorT>
......
......@@ -217,7 +217,7 @@ namespace HappyHeart
public:
GlobalMatrix::unique_ptr foo = nullptr;
GlobalMatrix::unique_ptr foo = nullptr; // \todo #531 Remove this once ticket is done!
GlobalMatrix::unique_ptr bar = nullptr;
///@}
......
......@@ -238,15 +238,15 @@ namespace HappyHeart
this->GetNonCstMassPerSquareTimeStepOperator().
Assemble(std::make_tuple(std::move(matrix1), std::move(matrix2), std::move(matrix3)));
vm.GetNonCstMassPerSquareTime().View(this->MpiHappyHeart(),
"/Users/sebastien/Desktop/original.txt", __FILE__, __LINE__);
foo->View(this->MpiHappyHeart(),
"/Users/sebastien/Desktop/foo.txt", __FILE__, __LINE__);
bar->View(this->MpiHappyHeart(),
"/Users/sebastien/Desktop/bar.txt", __FILE__, __LINE__);
// vm.GetNonCstMassPerSquareTime().View(this->MpiHappyHeart(),
// "/Users/sebastien/Desktop/original.txt", __FILE__, __LINE__);
//
// foo->View(this->MpiHappyHeart(),
// "/Users/sebastien/Desktop/foo.txt", __FILE__, __LINE__);
//
//
// bar->View(this->MpiHappyHeart(),
// "/Users/sebastien/Desktop/bar.txt", __FILE__, __LINE__);
}
......
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