Skip to content
Snippets Groups Projects
Select Git revision
  • f25b9639bbe06abde2e9b00fb5ebd40786eb26bf
  • develop default protected
  • feature/advection
  • feature/composite-scheme-other-fluxes
  • origin/stage/bouguettaia
  • save_clemence
  • feature/local-dt-fsi
  • feature/variational-hydro
  • feature/gmsh-reader
  • feature/reconstruction
  • feature/kinetic-schemes
  • feature/composite-scheme-sources
  • feature/serraille
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

MeshEdgeBoundary.cpp

Blame
  • test_PolynomialReconstruction.cpp 23.02 KiB
    #include <catch2/catch_approx.hpp>
    #include <catch2/catch_test_macros.hpp>
    #include <catch2/matchers/catch_matchers_all.hpp>
    
    #include <Kokkos_Core.hpp>
    
    #include <utils/PugsAssert.hpp>
    #include <utils/Types.hpp>
    
    #include <algebra/SmallMatrix.hpp>
    #include <algebra/SmallVector.hpp>
    #include <mesh/Mesh.hpp>
    #include <mesh/MeshDataManager.hpp>
    #include <scheme/DiscreteFunctionP0.hpp>
    #include <scheme/DiscreteFunctionVariant.hpp>
    #include <scheme/PolynomialReconstruction.hpp>
    
    #include <MeshDataBaseForTests.hpp>
    
    template <typename... DiscreteFunctionT>
    std::vector<std::shared_ptr<const DiscreteFunctionVariant>>
    build_list(DiscreteFunctionT... input)
    {
      std::vector<std::shared_ptr<const DiscreteFunctionVariant>> variant_vector;
      auto convert = [&variant_vector](auto&& df) {
        using DF_T = std::decay_t<decltype(df)>;
        if constexpr (is_discrete_function_v<DF_T> or std::is_same_v<DiscreteFunctionVariant, DF_T>) {
          variant_vector.push_back(std::make_shared<DiscreteFunctionVariant>(df));
        } else if constexpr (is_shared_ptr_v<DF_T>) {
          using DF_Value_T = std::decay_t<typename DF_T::element_type>;
          if constexpr (is_discrete_function_v<DF_Value_T> or std::is_same_v<DiscreteFunctionVariant, DF_Value_T>) {
            variant_vector.push_back(std::make_shared<DiscreteFunctionVariant>(*df));
          } else {
            static_assert(is_false_v<DF_T>, "unexpected type");
          }
        } else {
          static_assert(is_false_v<DF_T>, "unexpected type");
        }
      };
    
      (convert(input), ...);
      return variant_vector;
    }
    
    // clazy:excludeall=non-pod-global-static
    
    TEST_CASE("PolynomialReconstruction", "[scheme]")
    {
      SECTION("1D")
      {
        using R1 = TinyVector<1>;
    
        SECTION("R data")
        {
          for (auto named_mesh : MeshDataBaseForTests::get().all1DMeshes()) {
            SECTION(named_mesh.name())
            {
              auto p_mesh = named_mesh.mesh()->get<Mesh<1>>();
              auto& mesh  = *p_mesh;
    
              auto affine = [](const R1& x) { return 2.3 + 1.7 * x[0]; };
              auto xj     = MeshDataManager::instance().getMeshData(mesh).xj();
    
              DiscreteFunctionP0<double> fh{p_mesh};
    
              parallel_for(
                mesh.numberOfCells(), PUGS_LAMBDA(const CellId cell_id) { fh[cell_id] = affine(xj[cell_id]); });
    
              DiscreteFunctionVariant fh_v(fh);
              std::shared_ptr<const DiscreteFunctionVariant> p_fh_v = std::make_shared<DiscreteFunctionVariant>(fh);