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

fluxing 3D for quadrangular faces

parent abd6eb6f
No related branches found
No related tags found
1 merge request!167Improve fluxing based remapping
...@@ -43,6 +43,18 @@ class [[nodiscard]] TinyMatrix ...@@ -43,6 +43,18 @@ class [[nodiscard]] TinyMatrix
} }
} }
template <typename... Args>
PUGS_FORCEINLINE constexpr void
_unpackVariadicInput(const TinyVector<M, T>& t, Args&&... args) noexcept
{
for (size_t j = 0; j < M; ++j) {
m_values[_index(j, N - 1 - sizeof...(args))] = t[j];
}
if constexpr (sizeof...(args) > 0) {
this->_unpackVariadicInput(std::forward<Args>(args)...);
}
}
public: public:
PUGS_INLINE PUGS_INLINE
constexpr bool constexpr bool
...@@ -322,6 +334,13 @@ class [[nodiscard]] TinyMatrix ...@@ -322,6 +334,13 @@ class [[nodiscard]] TinyMatrix
this->_unpackVariadicInput(t, std::forward<Args>(args)...); this->_unpackVariadicInput(t, std::forward<Args>(args)...);
} }
template <typename... Args>
PUGS_INLINE explicit constexpr TinyMatrix(const TinyVector<M, T>& t, Args&&... args) noexcept
{
static_assert(sizeof...(args) == N - 1, "wrong number of parameters");
this->_unpackVariadicInput(t, std::forward<Args>(args)...);
}
// One does not use the '=default' constructor to avoid (unexpected) // One does not use the '=default' constructor to avoid (unexpected)
// performances issues // performances issues
PUGS_INLINE PUGS_INLINE
......
...@@ -205,10 +205,10 @@ FluxingAdvectionSolver<3>::_computeAlgebraicFluxingVolume() ...@@ -205,10 +205,10 @@ FluxingAdvectionSolver<3>::_computeAlgebraicFluxingVolume()
const Rd& x2 = old_xr[face_to_node[2]]; const Rd& x2 = old_xr[face_to_node[2]];
const Rd& x3 = old_xr[face_to_node[3]]; const Rd& x3 = old_xr[face_to_node[3]];
const Rd& x4 = new_xr[face_to_node[1]]; const Rd& x4 = new_xr[face_to_node[0]];
const Rd& x5 = new_xr[face_to_node[0]]; const Rd& x5 = new_xr[face_to_node[1]];
const Rd& x6 = new_xr[face_to_node[1]]; const Rd& x6 = new_xr[face_to_node[2]];
const Rd& x7 = new_xr[face_to_node[0]]; const Rd& x7 = new_xr[face_to_node[3]];
const Rd& a1 = x6 - x1; const Rd& a1 = x6 - x1;
const Rd& a2 = x6 - x3; const Rd& a2 = x6 - x3;
......
...@@ -32,10 +32,14 @@ TEST_CASE("TinyMatrix", "[algebra]") ...@@ -32,10 +32,14 @@ TEST_CASE("TinyMatrix", "[algebra]")
REQUIRE(TinyMatrix<5, 4, int>::NumberOfColumns == 4); REQUIRE(TinyMatrix<5, 4, int>::NumberOfColumns == 4);
TinyMatrix<3, 4, int> A(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); TinyMatrix<3, 4, int> A(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
TinyVector<3, int> x1(1, 5, 9);
TinyVector<3, int> x2(2, 6, 10);
TinyVector<3, int> x3(3, 7, 11);
TinyVector<3, int> x4(4, 8, 12);
REQUIRE(((A(0, 0) == 1) and (A(0, 1) == 2) and (A(0, 2) == 3) and (A(0, 3) == 4) and // REQUIRE(((A(0, 0) == 1) and (A(0, 1) == 2) and (A(0, 2) == 3) and (A(0, 3) == 4) and //
(A(1, 0) == 5) and (A(1, 1) == 6) and (A(1, 2) == 7) and (A(1, 3) == 8) and // (A(1, 0) == 5) and (A(1, 1) == 6) and (A(1, 2) == 7) and (A(1, 3) == 8) and //
(A(2, 0) == 9) and (A(2, 1) == 10) and (A(2, 2) == 11) and (A(2, 3) == 12))); (A(2, 0) == 9) and (A(2, 1) == 10) and (A(2, 2) == 11) and (A(2, 3) == 12)));
REQUIRE(A == TinyMatrix<3, 4, int>(x1, x2, x3, x4));
TinyMatrix<3, 4, int> B(6, 5, 3, 8, 34, 6, 35, 6, 7, 1, 3, 6); TinyMatrix<3, 4, int> B(6, 5, 3, 8, 34, 6, 35, 6, 7, 1, 3, 6);
SECTION("checking for opposed matrix") SECTION("checking for opposed matrix")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment