Skip to content
Snippets Groups Projects
Commit 21d641e6 authored by Emmanuel Labourasse's avatar Emmanuel Labourasse
Browse files

[ci-skip] Update polynomial 1d in progress

parent 649d3b81
Branches
No related tags found
No related merge requests found
...@@ -501,17 +501,9 @@ inverse(const TinyMatrix<3, 3, T>& A) ...@@ -501,17 +501,9 @@ inverse(const TinyMatrix<3, 3, T>& A)
return A_cofactors_T *= 1. / determinent; 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> template <size_t N, typename T>
PUGS_INLINE constexpr TinyMatrix<N, T> PUGS_INLINE constexpr TinyMatrix<N, N, T>
inverse(const TinyMatrix<N, T>& A) 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_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"); 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) ...@@ -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 // We found the pivot A(irow,icol), now we swap columns to put the pivot on the diagonal
if (irow != icol) { if (irow != icol) {
for (size_t l = 0; l < N; ++l) { 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 // we save the swap to invert it at the end
...@@ -571,7 +563,7 @@ inverse(const TinyMatrix<N, T>& A) ...@@ -571,7 +563,7 @@ inverse(const TinyMatrix<N, T>& A)
for (size_t l = N; l > 0; --l) { for (size_t l = N; l > 0; --l) {
if (indexr[l - 1] != indexc[l - 1]) { if (indexr[l - 1] != indexc[l - 1]) {
for (size_t k = 0; k < N; ++k) { 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]));
} }
} }
} }
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
#include <analysis/GaussLegendreQuadratureDescriptor.hpp> #include <analysis/GaussLegendreQuadratureDescriptor.hpp>
#include <analysis/GaussLobattoQuadratureDescriptor.hpp> #include <analysis/GaussLobattoQuadratureDescriptor.hpp>
#include <analysis/GaussQuadratureDescriptor.hpp> #include <analysis/GaussQuadratureDescriptor.hpp>
#include <language/algorithms/AcousticSolverAlgorithm.hpp>
#include <language/modules/BinaryOperatorRegisterForVh.hpp> #include <language/modules/BinaryOperatorRegisterForVh.hpp>
#include <language/modules/MathFunctionRegisterForVh.hpp> #include <language/modules/MathFunctionRegisterForVh.hpp>
#include <language/modules/UnaryOperatorRegisterForVh.hpp> #include <language/modules/UnaryOperatorRegisterForVh.hpp>
...@@ -485,42 +484,6 @@ SchemeModule::SchemeModule() ...@@ -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 this
->_addBuiltinFunction("lagrangian", ->_addBuiltinFunction("lagrangian",
std::make_shared<BuiltinFunctionEmbedder< std::make_shared<BuiltinFunctionEmbedder<
......
...@@ -22,7 +22,7 @@ TEST_CASE("Polynomial", "[analysis]") ...@@ -22,7 +22,7 @@ TEST_CASE("Polynomial", "[analysis]")
{ {
SECTION("construction") SECTION("construction")
{ {
REQUIRE_NOTHROW(Polynomial<2>{{2, 3, 4}}); REQUIRE_NOTHROW(Polynomial<2>({2, 3, 4}));
} }
SECTION("degree") SECTION("degree")
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment