Commit d1c40bd3 authored by Praetorius, Simon's avatar Praetorius, Simon

add shortcuts zot(), fot(), and sot() for backward compatibility/similarity with old AMDiS

parent 138c15d3
Pipeline #1785 passed with stage
in 37 minutes and 35 seconds
...@@ -14,6 +14,7 @@ namespace AMDiS ...@@ -14,6 +14,7 @@ namespace AMDiS
namespace tag namespace tag
{ {
struct gradtest_trial {}; struct gradtest_trial {};
struct grad_test {};
} }
...@@ -33,6 +34,14 @@ namespace AMDiS ...@@ -33,6 +34,14 @@ namespace AMDiS
{} {}
}; };
/// Create a first-order term with derivative on trial-function
template <class Expr, class... QuadratureArgs>
auto fot(Expr&& expr, tag::grad_test, QuadratureArgs&&... args)
{
return makeOperator(tag::gradtest_trial{}, FWD(expr), FWD(args)...);
}
/** @} **/ /** @} **/
} // end namespace AMDiS } // end namespace AMDiS
...@@ -17,6 +17,11 @@ namespace AMDiS ...@@ -17,6 +17,11 @@ namespace AMDiS
{ {
std::size_t comp; std::size_t comp;
}; };
struct partial_test
{
std::size_t comp;
};
} }
...@@ -36,6 +41,14 @@ namespace AMDiS ...@@ -36,6 +41,14 @@ namespace AMDiS
{} {}
}; };
/// Create a first-order term with derivative on trial-function
template <class Expr, class... QuadratureArgs>
auto fot(Expr&& expr, tag::partial_test t, QuadratureArgs&&... args)
{
return makeOperator(tag::partialtest_trial{t.comp}, FWD(expr), FWD(args)...);
}
/** @} **/ /** @} **/
} // end namespace AMDiS } // end namespace AMDiS
...@@ -17,6 +17,7 @@ namespace AMDiS ...@@ -17,6 +17,7 @@ namespace AMDiS
namespace tag namespace tag
{ {
struct test_gradtrial {}; struct test_gradtrial {};
struct grad_trial {};
} }
...@@ -97,6 +98,14 @@ namespace AMDiS ...@@ -97,6 +98,14 @@ namespace AMDiS
} }
}; };
/// Create a first-order term with derivative on test-function
template <class Expr, class... QuadratureArgs>
auto fot(Expr&& expr, tag::grad_trial, QuadratureArgs&&... args)
{
return makeOperator(tag::test_gradtrial{}, FWD(expr), FWD(args)...);
}
/** @} **/ /** @} **/
} // end namespace AMDiS } // end namespace AMDiS
...@@ -20,6 +20,11 @@ namespace AMDiS ...@@ -20,6 +20,11 @@ namespace AMDiS
{ {
std::size_t comp; std::size_t comp;
}; };
struct partial_trial
{
std::size_t comp;
};
} }
...@@ -104,6 +109,14 @@ namespace AMDiS ...@@ -104,6 +109,14 @@ namespace AMDiS
std::size_t comp_; std::size_t comp_;
}; };
/// Create a first-order term with derivative on trial-function
template <class Expr, class... QuadratureArgs>
auto fot(Expr&& expr, tag::partial_trial t, QuadratureArgs&&... args)
{
return makeOperator(tag::test_partialtrial{t.comp}, FWD(expr), FWD(args)...);
}
/** @} **/ /** @} **/
} // end namespace AMDiS } // end namespace AMDiS
...@@ -230,6 +230,15 @@ namespace AMDiS ...@@ -230,6 +230,15 @@ namespace AMDiS
} }
}; };
/// Create a second-order term
template <class Expr, class... QuadratureArgs>
auto sot(Expr&& expr, QuadratureArgs&&... args)
{
auto pqf = makePreQuadratureFactory(FWD(args)...);
using PreOp = PreGridFunctionOperator<tag::gradtest_gradtrial, TYPEOF(expr), TYPEOF(pqf)>;
return PreOp{tag::gradtest_gradtrial{}, FWD(expr), std::move(pqf)};
}
/** @} **/ /** @} **/
} // end namespace AMDiS } // end namespace AMDiS
...@@ -114,6 +114,14 @@ namespace AMDiS ...@@ -114,6 +114,14 @@ namespace AMDiS
std::size_t compTrial_; std::size_t compTrial_;
}; };
/// Create a second-order term of partial derivatives
template <class Expr, class... QuadratureArgs>
auto sot_ij(Expr&& expr, std::size_t comp_test, std::size_t comp_trial, QuadratureArgs&&... args)
{
return makeOperator(tag::partialtest_partialtrial{comp_test, comp_trial}, FWD(expr), FWD(args)...);
}
/** @} **/ /** @} **/
} // end namespace AMDiS } // end namespace AMDiS
...@@ -51,7 +51,39 @@ namespace AMDiS ...@@ -51,7 +51,39 @@ namespace AMDiS
getElementMatrixStandard(context, quad, rowNode, colNode, elementMatrix); getElementMatrixStandard(context, quad, rowNode, colNode, elementMatrix);
} }
template <class Context, class Node, class ElementVector>
void getElementVector(Context const& context,
Node const& node,
ElementVector& elementVector)
{
static_assert(Node::isLeaf, "Operator can be applied to Leaf-Nodes only");
auto const& quad = this->getQuadratureRule(context.type(), node);
auto const& localFE = node.finiteElement();
std::size_t size = localFE.size();
NodeQuadCache<Node> cache(localFE.localBasis());
auto const& shapeValuesCache = cache.evaluateFunctionAtQP(context,quad);
for (std::size_t iq = 0; iq < quad.size(); ++iq) {
// Position of the current quadrature point in the reference element
decltype(auto) local = context.local(quad[iq].position());
// The multiplicative factor in the integral transformation formula
const auto factor = Super::coefficient(local) * context.integrationElement(quad[iq].position())
* quad[iq].weight();
auto const& shapeValues = shapeValuesCache[iq];
for (std::size_t i = 0; i < size; ++i) {
const auto local_i = node.localIndex(i);
elementVector[local_i] += factor * shapeValues[i];
}
}
}
protected: protected:
template <class Context, class QuadratureRule, class RowNode, class ColNode, class ElementMatrix> template <class Context, class QuadratureRule, class RowNode, class ColNode, class ElementMatrix>
void getElementMatrixStandard(Context const& context, void getElementMatrixStandard(Context const& context,
QuadratureRule const& quad, QuadratureRule const& quad,
...@@ -138,6 +170,14 @@ namespace AMDiS ...@@ -138,6 +170,14 @@ namespace AMDiS
} }
}; };
/// Create a zero-order term
template <class Expr, class... QuadratureArgs>
auto zot(Expr&& expr, QuadratureArgs&&... args)
{
return makeOperator(tag::test_trial{}, FWD(expr), FWD(args)...);
}
/** @} **/ /** @} **/
} // end namespace AMDiS } // end namespace AMDiS
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