Add generalized derivative and local-to-global adapter to handle the global derivatives uniformly
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
-
Cleanup of Gridfunctions: The
GridFunctionConcepts
is split into several parts,Order.hpp
,Derivative.hpp
andGridFunction.hpp
for a cleaner structure. Thereby, the free functionsorder()
,derivative()
andlocalFunctions()
now redirect to the corresponding member functions when those member functions are available. -
Generalized derivatives: The function
derivative()
is extended by an argument characterizing the type of the derivative, i.e.tag::gradient
,tag::divergence
, ortag::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 classDerivativeTraits
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 inGradienTest
finally. -
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
Activity
added 4 commits
-
238e98bc...ae94a0e6 - 2 commits from branch
master
- 78ab6415 - Add generalized derivative and local-to-global adapter to handle the global derivatives uniformly
- 1ba68264 - removed obsolete helper functions
-
238e98bc...ae94a0e6 - 2 commits from branch
added 1 commit
- 18b54d5b - rewritten gradient of discretefunction to overcome lambda problem
97 99 * **Requirements:** 98 100 * - The functor `F` must fulfill the concept \ref Concepts::HasPartial changed this line in version 6 of the diff
- src/amdis/utility/LocalToGlobalAdapter.hpp 0 → 100644
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, 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)>; 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
andFunctor
, than a static assert is thrown. But when writing directlystatic_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 theLocalFunction
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.
changed this line in version 6 of the diff
enabled an automatic merge when the pipeline for 885ab6d8 succeeds
mentioned in commit bbf80751