From 21d641e62a5fb85ef4499d082da7105dd4cc16fd Mon Sep 17 00:00:00 2001
From: labourasse <labourassee@gmail.com>
Date: Thu, 9 Jun 2022 19:11:50 +0200
Subject: [PATCH] [ci-skip] Update polynomial 1d in progress

---
 src/algebra/TinyMatrix.hpp            | 16 +++---------
 src/language/modules/SchemeModule.cpp | 37 ---------------------------
 tests/test_Polynomial.cpp             |  2 +-
 3 files changed, 5 insertions(+), 50 deletions(-)

diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp
index de64a635e..d596e3518 100644
--- a/src/algebra/TinyMatrix.hpp
+++ b/src/algebra/TinyMatrix.hpp
@@ -501,17 +501,9 @@ inverse(const TinyMatrix<3, 3, T>& A)
   return A_cofactors_T *= 1. / determinent;
 }
 
-PUGS_INLINE constexpr void
-_swap(double& a, double& b)
-{
-  double temp = a;
-  a           = b;
-  b           = temp;
-}
-
 template <size_t N, typename T>
-PUGS_INLINE constexpr TinyMatrix<N, T>
-inverse(const TinyMatrix<N, T>& A)
+PUGS_INLINE constexpr TinyMatrix<N, N, T>
+inverse(const TinyMatrix<N, N, T>& A)
 {
   static_assert(std::is_arithmetic<T>::value, "inverse is not defined for non-arithmetic types");
   static_assert(std::is_floating_point<T>::value, "inverse is defined for floating point types only");
@@ -546,7 +538,7 @@ inverse(const TinyMatrix<N, T>& A)
     // We found the pivot A(irow,icol), now we swap columns to put the pivot on the diagonal
     if (irow != icol) {
       for (size_t l = 0; l < N; ++l) {
-        _swap(inv_A(irow, l), inv_A(icol, l));
+        std::swap(inv_A(irow, l), inv_A(icol, l));
       }
     }
     // we save the swap to invert it at the end
@@ -571,7 +563,7 @@ inverse(const TinyMatrix<N, T>& A)
   for (size_t l = N; l > 0; --l) {
     if (indexr[l - 1] != indexc[l - 1]) {
       for (size_t k = 0; k < N; ++k) {
-        _swap(inv_A(k, indexr[l - 1]), inv_A(k, indexc[l - 1]));
+        std::swap(inv_A(k, indexr[l - 1]), inv_A(k, indexc[l - 1]));
       }
     }
   }
diff --git a/src/language/modules/SchemeModule.cpp b/src/language/modules/SchemeModule.cpp
index 1e85ba119..5aff2713e 100644
--- a/src/language/modules/SchemeModule.cpp
+++ b/src/language/modules/SchemeModule.cpp
@@ -3,7 +3,6 @@
 #include <analysis/GaussLegendreQuadratureDescriptor.hpp>
 #include <analysis/GaussLobattoQuadratureDescriptor.hpp>
 #include <analysis/GaussQuadratureDescriptor.hpp>
-#include <language/algorithms/AcousticSolverAlgorithm.hpp>
 #include <language/modules/BinaryOperatorRegisterForVh.hpp>
 #include <language/modules/MathFunctionRegisterForVh.hpp>
 #include <language/modules/UnaryOperatorRegisterForVh.hpp>
@@ -485,42 +484,6 @@ SchemeModule::SchemeModule()
 
                               ));
 
-  this->_addBuiltinFunction("odediscontinuousgalerkin1D",
-                            std::make_shared<
-                              BuiltinFunctionEmbedder<void(std::shared_ptr<const BasisType> basis_type, const size_t&,
-                                                           std::shared_ptr<const IMesh>, const FunctionSymbolId&)>>(
-                              [](std::shared_ptr<const BasisType> basis_type, const size_t& Degree,
-                                 std::shared_ptr<const IMesh> p_mesh, const FunctionSymbolId& uex_id) -> void {
-                                Assert(p_mesh->dimension() == 1, "invalid mesh dimension");
-                                switch (Degree) {
-                                case 0: {
-                                  ODEDiscontinuousGalerkin1D<1, 0>(*basis_type, p_mesh, uex_id);
-                                  break;
-                                }
-                                case 1: {
-                                  ODEDiscontinuousGalerkin1D<1, 1>(*basis_type, p_mesh, uex_id);
-                                  break;
-                                }
-                                case 2: {
-                                  ODEDiscontinuousGalerkin1D<1, 2>(*basis_type, p_mesh, uex_id);
-                                  break;
-                                }
-                                case 3: {
-                                  ODEDiscontinuousGalerkin1D<1, 3>(*basis_type, p_mesh, uex_id);
-                                  break;
-                                }
-                                case 4: {
-                                  ODEDiscontinuousGalerkin1D<1, 4>(*basis_type, p_mesh, uex_id);
-                                  break;
-                                }
-                                default: {
-                                  throw UnexpectedError("invalid polynomial degree");
-                                }
-                                }
-                              }
-
-                              ));
-
   this
     ->_addBuiltinFunction("lagrangian",
                           std::make_shared<BuiltinFunctionEmbedder<
diff --git a/tests/test_Polynomial.cpp b/tests/test_Polynomial.cpp
index 3ce64db09..74f8e295e 100644
--- a/tests/test_Polynomial.cpp
+++ b/tests/test_Polynomial.cpp
@@ -22,7 +22,7 @@ TEST_CASE("Polynomial", "[analysis]")
 {
   SECTION("construction")
   {
-    REQUIRE_NOTHROW(Polynomial<2>{{2, 3, 4}});
+    REQUIRE_NOTHROW(Polynomial<2>({2, 3, 4}));
   }
   SECTION("degree")
   {
-- 
GitLab