Commit 8dcda52e authored by Praetorius, Simon's avatar Praetorius, Simon

reimplement polynomial order of nodes

parent 605d1fc1
Pipeline #4532 canceled with stage
in 6 minutes and 47 seconds
......@@ -126,20 +126,20 @@ namespace AMDiS
* \tparam CN ColNode
**/
template <class RN, class CN>
int getDegree(int order, int coeffDegree, RN const& rowNode, CN const& colNode) const
int getDegree(int derivOrder, int coeffDegree, RN const& rowNode, CN const& colNode) const
{
assert( bound_ );
test_warning(coeffDegree >= 0,
"polynomial order of coefficient function not determined. Use order 4 by default.");
int psiDegree = polynomialDegree(rowNode);
int phiDegree = polynomialDegree(colNode);
int psiDegree = order(rowNode);
int phiDegree = order(colNode);
int degree = psiDegree + phiDegree + (coeffDegree >= 0 ? coeffDegree : 4);
if (isSimplex_)
degree -= order;
degree -= derivOrder;
if (isAffine_)
degree += 1; // oder += (order+1)
degree += 1; // oder += (derivOrder+1)
return degree;
}
......@@ -151,19 +151,19 @@ namespace AMDiS
* the order of derivatives, this operator implements.
**/
template <class Node>
int getDegree(int order, int coeffDegree, Node const& node) const
int getDegree(int derivOrder, int coeffDegree, Node const& node) const
{
assert( bound_ );
test_warning(coeffDegree >= 0,
"polynomial order of coefficient function not determined. Use order 4 by default.");
int psiDegree = polynomialDegree(node);
int psiDegree = order(node);
int degree = psiDegree + (coeffDegree >= 0 ? coeffDegree : 4);
if (isSimplex_)
degree -= order;
degree -= derivOrder;
if (isAffine_)
degree += 1; // oder += (order+1)
degree += 1; // oder += (derivOrder+1)
return degree;
}
......
......@@ -4,6 +4,7 @@
#include <amdis/common/DerivativeTraits.hpp>
#include <amdis/common/FieldMatVec.hpp>
#include <amdis/functions/NodeIndices.hpp>
#include <amdis/typetree/FiniteElementType.hpp>
#include <amdis/utility/LocalBasisCache.hpp>
#include <amdis/utility/LocalToGlobalAdapter.hpp>
......@@ -130,11 +131,12 @@ public:
return PartialLocalFunction{globalFunction_, type};
}
/// \brief The \ref polynomialDegree() of the LocalFunctions
/// \brief The \ref order() of the LocalFunctions
int order() const
{
using AMDiS::order;
assert( bound_ );
return polynomialDegree(*subTree_);
return order(*subTree_);
}
/// \brief Return the bound element
......@@ -209,8 +211,9 @@ public:
int order() const
{
using AMDiS::order;
assert( bound_ );
return std::max(0, polynomialDegree(*subTree_)-1);
return std::max(0, order(*subTree_)-1);
}
/// Return the bound element
......
......@@ -5,6 +5,7 @@
#include <dune/common/typetraits.hh>
#include <dune/typetree/nodetags.hh>
#include <amdis/common/Concepts.hpp>
#include <amdis/common/ForEach.hpp>
#include <amdis/common/Index.hpp>
#include <amdis/common/Tags.hpp>
......@@ -16,10 +17,11 @@ namespace AMDiS
template <class Node, class NodeTag>
struct FiniteElementTypeImpl
{
static_assert( Dune::AlwaysFalse<NodeTag>::value, "Unknown node-type for range definition" );
// polynomial degree of finite-element basis functions
static int order(Node const&) { return 0; }
using type = tag::unknown;
static int order(Node const& node)
{
return 1;
}
};
}
......@@ -31,12 +33,12 @@ namespace AMDiS
using FiniteElementType_t = typename FiniteElementType<Node>::type;
template <class Node>
int polynomialDegree(Node const& node)
auto order(Node const& node)
-> decltype(FiniteElementType<Node>::order(node))
{
return FiniteElementType<Node>::order(node);
}
namespace Impl
{
// Leaf node
......@@ -60,7 +62,8 @@ namespace AMDiS
static int order(Node const& node)
{
return FiniteElementType<ChildNode>::order(node.child(0));
using AMDiS::order;
return order(node.child(0u));
}
};
......@@ -72,14 +75,14 @@ namespace AMDiS
static int order(Node const& node)
{
using AMDiS::order;
int degree = 0;
Tools::for_range<0,Node::CHILDREN>([&](auto const _i) {
degree = std::max(degree, polynomialDegree(node.child(_i)));
degree = std::max(degree, order(node.child(_i)));
});
return degree;
}
};
} // end namespace Impl
} // end namespace AMDiS
......@@ -36,14 +36,14 @@ int main()
localView.bind(e);
auto node = localView.tree();
AMDIS_TEST_EQ( polynomialDegree(node), k+1 ); // maximum over all polynomial degrees
AMDIS_TEST_EQ( order(node), k+1 ); // maximum over all polynomial degrees
static_assert( std::is_same_v<tag::unknown, FiniteElementType_t<decltype(node)>>, "" );
auto v_node = TypeTree::child(node, _0);
AMDIS_TEST_EQ( polynomialDegree(v_node), k+1 );
AMDIS_TEST_EQ( order(v_node), k+1 );
auto p_node = TypeTree::child(node, _1);
AMDIS_TEST_EQ( polynomialDegree(p_node), k );
AMDIS_TEST_EQ( order(p_node), k );
}
return report_errors();
......
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