Commit c06a9720 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Merge branch 'feature/flexible-discreteglobalbasisfunction-range' into 'master'

Make DiscreteGlobalBasisFunction work non-istl range types like array and TupleVector

See merge request !343
parents 8888e28f 03ae7b87
Pipeline #41491 passed with stage
in 31 minutes and 20 seconds
......@@ -239,8 +239,9 @@ class ISTLVectorBackend
std::enable_if_t<not std::is_assignable<C&,T>::value, int> = 0>
void recursiveAssign(C& c, const T& t)
{
for(auto&& ci: c)
Dune::Hybrid::forEach(c, [&](auto&& ci) {
recursiveAssign(ci, t);
});
}
public:
......
......@@ -196,7 +196,7 @@ public:
Range operator()(const Domain& x) const
{
Range y;
y = 0;
istlVectorBackend(y) = 0;
TypeTree::forEachLeafNode(localView_.tree(), [&](auto&& node, auto&& treePath) {
const auto& nodeToRangeEntry = globalFunction_->nodeToRangeEntry();
......
......@@ -206,6 +206,31 @@ int main (int argc, char* argv[]) try
passed = passed and passedThisTest;
}
// complex nested Lagrange basis
{
auto feBasis = makeBasis(gridView,
power<2>(
composite(
lagrange<2>(),
power<2>(
lagrange<1>(),
flatLexicographic()),
flatLexicographic()),
flatLexicographic()));
using Range = std::array<Dune::TupleVector<double, std::array<double,2>>,2>;
auto f = [](const auto& x) -> Range {
return std::array{
Dune::makeTupleVector(x[0]+x[1], std::array{x[0]+x[1]+1.0, x[0]+x[1]+2.0}),
Dune::makeTupleVector(x[0]+x[1]+3.0, std::array{x[0]+x[1]+4.0, x[0]+x[1]+5.0}),
};
};
std::vector<double> x;
interpolate(feBasis, x, f);
auto passedThisTest = checkInterpolationConsistency<Range>(feBasis, x);
std::cout << "checkInterpolationConsistency for complex nested Lagrange basis" << (passedThisTest? " " : " NOT ") << "successful." << std::endl;
passed = passed and passedThisTest;
}
// Sample the function f(x,y) = x on the grid vertices
// If we use that as the coefficients of a finite element function,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment