Skip to content
Snippets Groups Projects
Commit d1d616e1 authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Continue interface improvement for grouped reconstructions

parent b4c6ee70
No related branches found
No related tags found
1 merge request!205High-order polynomial reconstruction
......@@ -17,13 +17,28 @@
#include <MeshDataBaseForTests.hpp>
template <typename... DataType>
template <typename... DiscreteFunctionT>
std::vector<std::shared_ptr<const DiscreteFunctionVariant>>
build_list(DiscreteFunctionP0<DataType>... input)
build_list(DiscreteFunctionT... input)
{
std::vector<std::shared_ptr<const DiscreteFunctionVariant>> variant_vector;
variant_vector.push_back(std::make_shared<DiscreteFunctionVariant>(input...));
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;
}
......@@ -51,7 +66,10 @@ TEST_CASE("PolynomialReconstruction", "[scheme]")
parallel_for(
mesh.numberOfCells(), PUGS_LAMBDA(const CellId cell_id) { fh[cell_id] = affine(xj[cell_id]); });
auto reconstructions = PolynomialReconstruction{}.build(build_list(fh));
DiscreteFunctionVariant fh_v(fh);
std::shared_ptr<const DiscreteFunctionVariant> p_fh_v = std::make_shared<DiscreteFunctionVariant>(fh);
auto reconstructions = PolynomialReconstruction{}.build(build_list(p_fh_v, fh_v, fh));
auto dpk = reconstructions[0]->get<DiscreteFunctionDPk<1, const double>>();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment