Skip to content
Snippets Groups Projects

Add generalized derivative and local-to-global adapter to handle the global derivatives uniformly

Merged Praetorius, Simon requested to merge feature/gridfunctions_localtoglobal_adaptor into master
4 unresolved threads

Summary

Cleanup of Gridfunctions, i.e. separate order, derivative and gridfunction concepts. Add generalized derivative with gradient, divergence and partial derivatives. Add a local-to-global adapter similar to the one found in dune-localfunctions.

Details

  1. Cleanup of Gridfunctions: The GridFunctionConcepts is split into several parts, Order.hpp, Derivative.hpp and GridFunction.hpp for a cleaner structure. Thereby, the free functions order(), derivative() and localFunctions() now redirect to the corresponding member functions when those member functions are available.

  2. Generalized derivatives: The function derivative() is extended by an argument characterizing the type of the derivative, i.e. tag::gradient, tag::divergence, or tag::partial where the last one accepts an argument for the component of the partial derivative. In order to determine the range type of the grid functions, a class DerivativeTraits is added, parametrized with the derivative type and the function signature. For the discrete function it is possible to calculate all three derivative types. This is tested in GradienTest finally.

  3. Local-to-Global adapter: The calculation of global derivatives from local-basis and geometry Jacobians is abstracted and put into the new class LocalToGlobalBasisAdapter that performes cached evaluation of the local basis jacobians and geometry jacobians and the transforms those into global derivatives. This class can be used in the localoperators and is partially adapted already.

Merge request reports

Checking pipeline status.

Approval is optional

Merged by Praetorius, SimonPraetorius, Simon 5 years ago (Jun 8, 2019 1:02pm UTC)

Merge details

  • Changes merged into master with bbf80751.
  • Deleted the source branch.
  • Auto-merge enabled

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
97 99 * **Requirements:**
98 100 * - The functor `F` must fulfill the concept \ref Concepts::HasPartial
  • 103 * geometries this returns the order of the local basis plus the global
    104 * dimension minus 1. The assumption for non-affine geometries is that
    105 * they are still multi-linear.
    106 */
    107 std::size_t order() const
    108 {
    109 if (geometry_.affine())
    110 // affine linear
    111 return localBasis_.order();
    112 else
    113 // assume at most order dim
    114 return localBasis_.order() + Traits::dimDomainGlobal - 1;
    115 }
    116
    117 /// Evaluate the local basis functions in the local coordinate `in`
    118 void evaluateFunction(typename Traits::DomainLocal const& x,
    • There are CMakeLists entries missing for src/amdis/utility/LocalToGlobalAdapter.hpp and src/amdis/common/DerivativeTraits.hpp.

  • 26 44 class DerivativeGridFunction
    27 45 {
    28 46 using GridFctRange = typename GridFunction::Range;
    29 47 using GridFctDomain = typename GridFunction::Domain;
    30 48 using RawSignature = typename Dune::Functions::SignatureTraits<GridFctRange(GridFctDomain)>::RawSignature;
    31 using DerivativeTraits = Dune::Functions::DefaultDerivativeTraits<RawSignature>;
    32 using LocalFunction = TYPEOF( derivative(localFunction(std::declval<GridFunction>())) ) ;
    49
    50 using Traits = DerivativeTraits<RawSignature, Type>;
    51 using LocalFunction = TYPEOF( derivative(localFunction(std::declval<GridFunction>()), std::declval<Type>()) ) ;
    52
    53 using LocalFctRange = typename Traits::Range;
    54 using LocalFctDomain = typename GridFunction::EntitySet::LocalCoordinate;
    55
    56 using _CHECK1_ = Impl::CheckValidRange<Traits>;
    57 using _CHECK2_ = Impl::CheckFunctorConcept<LocalFunction, LocalFctRange(LocalFctDomain)>;
    • This seems to be unused.

    • Yes, it is not used. It is just a Concept check for the Traits class and the LocalFunction. If those do not fulfill the concepts ValidRange and Functor, than a static assert is thrown. But when writing directly

      static_assert(!std::is_same<typename Traits::Range, Dune::Functions::InvalidRange>::value, "Invalid Range.");

      I do not get any information about the Traits type that is tested (or the LocalFunction type). This workaround print the type information, since the error happens in a separate class parametrized with those types.

      Maybe I have to add a comment there. Actually, I have not tested this recently. Before, I just instantiated the check classes to get theerror. I hope that the same checks are performed just by those typedefs. Maybe should be tested.

    • Yeah some explanatory comment why that is there would be much appreciated. Thanks!

    • Please register or sign in to reply
  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 885ab6d8 - correct some typos and CMakeLists

    Compare with previous version

  • Praetorius, Simon enabled an automatic merge when the pipeline for 885ab6d8 succeeds

    enabled an automatic merge when the pipeline for 885ab6d8 succeeds

  • mentioned in commit bbf80751

  • Please register or sign in to reply
    Loading