3#ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_GRIDFUNCTIONSPACEUTILITIES_HH
4#define DUNE_PDELAB_GRIDFUNCTIONSPACE_GRIDFUNCTIONSPACEUTILITIES_HH
13#include <dune/localfunctions/common/interfaceswitch.hh>
15#include"../common/function.hh"
16#include <dune/pdelab/common/jacobiantocurl.hh>
17#include"gridfunctionspace.hh"
18#include <dune/pdelab/gridfunctionspace/localfunctionspace.hh>
19#include <dune/pdelab/gridfunctionspace/lfsindexcache.hh>
53 template<
typename T,
typename X>
57 typename T::Traits::GridViewType,
58 typename BasisInterfaceSwitch<
59 typename FiniteElementInterfaceSwitch<
60 typename T::Traits::FiniteElementType
64 typename FiniteElementInterfaceSwitch<
65 typename T::Traits::FiniteElementType
68 typename BasisInterfaceSwitch<
69 typename FiniteElementInterfaceSwitch<
70 typename T::Traits::FiniteElementType
74 DiscreteGridFunction<T,X>
81 typename T::Traits::FiniteElementType
86 typename T::Traits::GridViewType,
107 , xl(gfs.maxLocalSize())
108 , yb(gfs.maxLocalSize())
122 , xl(gfs->maxLocalSize())
123 , yb(gfs->maxLocalSize())
129 inline void evaluate (
const typename Traits::ElementType& e,
130 const typename Traits::DomainType& x,
131 typename Traits::RangeType& y)
const
138 x_view.bind(lfs_cache);
141 FESwitch::basis(lfs.finiteElement()).evaluateFunction(x,yb);
143 for (
unsigned int i=0; i<yb.size(); i++)
152 return pgfs->gridView();
158 typedef LFSIndexCache<LFS> LFSCache;
159 typedef typename X::template ConstLocalView<LFSCache> XView;
161 std::shared_ptr<GFS const> pgfs;
163 mutable LFSCache lfs_cache;
164 mutable XView x_view;
165 mutable std::vector<typename Traits::RangeFieldType> xl;
166 mutable std::vector<typename Traits::RangeType> yb;
167 std::shared_ptr<const X> px;
179 template<
typename T,
typename X>
183 typename T::Traits::GridViewType,
184 typename JacobianToCurl<typename T::Traits::FiniteElementType::
185 Traits::LocalBasisType::Traits::JacobianType>::CurlField,
186 JacobianToCurl<typename T::Traits::FiniteElementType::Traits::LocalBasisType::
187 Traits::JacobianType>::dimCurl,
188 typename JacobianToCurl<typename T::Traits::FiniteElementType::
189 Traits::LocalBasisType::Traits::JacobianType>::Curl
191 DiscreteGridFunctionCurl<T,X>
195 typedef typename T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::
196 JacobianType Jacobian;
201 typename T::Traits::GridViewType,
202 typename J2C::CurlField, J2C::dimCurl,
typename J2C::Curl
215 , xl(gfs.maxLocalSize())
216 , jacobian(gfs.maxLocalSize())
217 , yb(gfs.maxLocalSize())
231 , xl(gfs->maxLocalSize())
232 , jacobian(gfs->maxLocalSize())
233 , yb(gfs->maxLocalSize())
242 static const J2C& j2C = J2C();
246 x_view.bind(lfs_cache);
250 lfs.finiteElement().basis().evaluateJacobian(x,jacobian);
253 for (std::size_t i=0; i < lfs.size(); i++) {
254 j2C(jacobian[i], yb);
261 {
return pgfs->gridView(); }
267 typedef LFSIndexCache<LFS> LFSCache;
268 typedef typename X::template ConstLocalView<LFSCache> XView;
270 std::shared_ptr<GFS const> pgfs;
272 mutable LFSCache lfs_cache;
273 mutable XView x_view;
274 mutable std::vector<typename Traits::RangeFieldType> xl;
275 mutable std::vector<Jacobian> jacobian;
276 mutable std::vector<typename Traits::RangeType> yb;
277 std::shared_ptr<const X> px;
293 template<
typename GV,
typename RangeFieldType,
int dimRangeOfBasis>
296 "DiscreteGridFunctionCurl (and friends) work in 2D "
306 template<
typename GV,
typename RangeFieldType>
310 FieldVector<RangeFieldType, 2> >
312 static_assert(GV::dimensionworld == 2,
313 "World dimension of grid must be 2 for the curl of a "
314 "scalar (1D) quantity");
322 template<
typename GV,
typename RangeFieldType>
326 FieldVector<RangeFieldType, 1> >
328 static_assert(GV::dimensionworld == 2,
329 "World dimension of grid must be 2 for the curl of a"
338 template<
typename GV,
typename RangeFieldType>
342 FieldVector<RangeFieldType, 3> >
344 static_assert(GV::dimensionworld == 3,
345 "World dimension of grid must be 3 for the curl of a"
365 template<
typename T,
typename X>
368 DiscreteGridFunctionCurlTraits<
369 typename T::Traits::GridViewType,
370 typename T::Traits::FiniteElementType::Traits::
371 LocalBasisType::Traits::RangeFieldType,
372 T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::
374 DiscreteGridFunctionGlobalCurl<T,X> >
378 typename T::Traits::GridViewType,
379 typename T::Traits::FiniteElementType::Traits::
380 LocalBasisType::Traits::RangeFieldType,
381 T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::
389 typedef typename T::Traits::FiniteElementType::Traits::
390 LocalBasisType::Traits LBTraits;
403 , xl(gfs.maxLocalSize())
404 , J(gfs.maxLocalSize())
418 , xl(gfs->maxLocalSize())
419 , J(gfs->maxLocalSize())
424 inline void evaluate (
const typename Traits::ElementType& e,
425 const typename Traits::DomainType& x,
426 typename Traits::RangeType& y)
const
430 x_view.bind(lfs_cache);
434 lfs.finiteElement().localBasis().
435 evaluateJacobianGlobal(x,J,e.geometry());
437 for (
unsigned int i=0; i<J.size(); i++)
441 switch(
unsigned(Traits::dimRange)) {
443 y[0] += xl[i] * J[i][0][1];
444 y[1] += xl[i] * -J[i][0][0];
447 y[0] += xl[i]*(J[i][1][0] - J[i][0][1]);
450 y[0] += xl[i]*(J[i][2][1] - J[i][1][2]);
451 y[1] += xl[i]*(J[i][0][2] - J[i][2][0]);
452 y[2] += xl[i]*(J[i][1][0] - J[i][0][1]);
463 return pgfs->gridView();
468 typedef LFSIndexCache<LFS> LFSCache;
469 typedef typename X::template ConstLocalView<LFSCache> XView;
471 std::shared_ptr<GFS const> pgfs;
473 mutable LFSCache lfs_cache;
474 mutable XView x_view;
475 mutable std::vector<typename Traits::RangeFieldType> xl;
476 mutable std::vector<typename T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::JacobianType> J;
477 std::shared_ptr<const X> px;
490 template<
typename T,
typename X>
494 typename T::Traits::GridViewType,
495 typename T::Traits::FiniteElementType::Traits::LocalBasisType
496 ::Traits::RangeFieldType,
497 T::Traits::FiniteElementType::Traits::LocalBasisType::Traits
500 typename T::Traits::FiniteElementType::Traits
501 ::LocalBasisType::Traits::RangeFieldType,
502 T::Traits::FiniteElementType::Traits::LocalBasisType::Traits
504 DiscreteGridFunctionGradient<T,X> >
507 typedef typename GFS::Traits::FiniteElementType::Traits::
508 LocalBasisType::Traits LBTraits;
512 typename GFS::Traits::GridViewType,
513 typename LBTraits::RangeFieldType,
516 typename LBTraits::RangeFieldType,
517 LBTraits::dimDomain> >
Traits;
559 x_view.bind(lfs_cache);
562 xl.resize(lfs.size());
567 const typename Traits::ElementType::Geometry::JacobianInverseTransposed
568 JgeoIT = e.geometry().jacobianInverseTransposed(x);
571 std::vector<typename LBTraits::JacobianType> J(lfs.size());
572 lfs.finiteElement().localBasis().evaluateJacobian(x,J);
576 for(
unsigned int i = 0; i < lfs.size(); ++i) {
579 JgeoIT.umv(J[i][0], gradphi);
582 y.axpy(xl[i], gradphi);
590 return pgfs->gridView();
595 typedef LFSIndexCache<LFS> LFSCache;
596 typedef typename X::template ConstLocalView<LFSCache> XView;
598 std::shared_ptr<GFS const> pgfs;
600 mutable LFSCache lfs_cache;
601 mutable XView x_view;
602 mutable std::vector<typename Traits::RangeFieldType> xl;
609 template<
typename T,
typename X>
613 typename T::Traits::GridViewType,
614 typename T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
615 T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::dimRange,
616 typename T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeType
618 DiscreteGridFunctionPiola<T,X>
625 typename T::Traits::GridViewType,
626 typename T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
627 T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::dimRange,
628 typename T::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeType
645 , xl(pgfs->maxLocalSize())
646 , yb(pgfs->maxLocalSize())
660 , xl(pgfs->maxLocalSize())
661 , yb(pgfs->maxLocalSize())
665 inline void evaluate (
const typename Traits::ElementType& e,
666 const typename Traits::DomainType& x,
667 typename Traits::RangeType& y)
const
672 x_view.bind(lfs_cache);
676 lfs.finiteElement().localBasis().evaluateFunction(x,yb);
677 typename Traits::RangeType yhat;
679 for (
unsigned int i=0; i<yb.size(); i++)
680 yhat.axpy(xl[i],yb[i]);
683 typename Traits::ElementType::Geometry::JacobianInverseTransposed
684 J = e.geometry().jacobianInverseTransposed(x);
688 y /= J.determinant();
694 return pgfs->gridView();
700 typedef LFSIndexCache<LFS> LFSCache;
701 typedef typename X::template ConstLocalView<LFSCache> XView;
703 std::shared_ptr<GFS const> pgfs;
705 mutable LFSCache lfs_cache;
706 mutable XView x_view;
707 mutable std::vector<typename Traits::RangeFieldType> xl;
708 mutable std::vector<typename Traits::RangeType> yb;
725 template<typename T, typename X, std::size_t dimR = TypeTree::StaticDegree<T>::value>
727 template<typename T, typename X, std::size_t dimR = TypeTree::StaticDegree<T>::value>
732 typename T::Traits::GridViewType,
733 typename T::template Child<0>::Type::Traits::FiniteElementType
734 ::Traits::LocalBasisType::Traits::RangeFieldType,
737 typename T::template Child<0>::Type::Traits::FiniteElementType
738 ::Traits::LocalBasisType::Traits::RangeFieldType,
742 VectorDiscreteGridFunction<T,X>
749 typename T::Traits::GridViewType,
750 typename T::template Child<0>::Type::Traits::FiniteElementType
751 ::Traits::LocalBasisType::Traits::RangeFieldType,
754 typename T::template Child<0>::Type::Traits::FiniteElementType
755 ::Traits::LocalBasisType::Traits::RangeFieldType,
764 typedef typename T::template Child<0>::Type ChildType;
765 typedef typename ChildType::Traits::FiniteElementType
766 ::Traits::LocalBasisType::Traits::RangeFieldType RF;
767 typedef typename ChildType::Traits::FiniteElementType
768 ::Traits::LocalBasisType::Traits::RangeType RT;
777 std::size_t start = 0)
782 , xl(gfs.maxLocalSize())
783 , yb(gfs.maxLocalSize())
785 for(std::size_t i = 0; i < dimR; ++i)
786 remap[i] = i + start;
796 std::size_t start = 0)
801 , xl(pgfs->maxLocalSize())
802 , yb(pgfs->maxLocalSize())
804 for(std::size_t i = 0; i < dimR; ++i)
805 remap[i] = i + start;
820 template<
class Remap>
827 , xl(gfs.maxLocalSize())
828 , yb(gfs.maxLocalSize())
831 for(std::size_t i = 0; i < dimR; ++i)
832 remap[i] = remap_[i];
847 template<
class Remap>
854 , xl(pgfs->maxLocalSize())
855 , yb(pgfs->maxLocalSize())
858 for(std::size_t i = 0; i < dimR; ++i)
859 remap[i] = remap_[i];
862 inline void evaluate (
const typename Traits::ElementType& e,
863 const typename Traits::DomainType& x,
864 typename Traits::RangeType& y)
const
868 x_view.bind(lfs_cache);
871 for (
unsigned int k=0; k < dimR; k++)
873 lfs.child(remap[k]).finiteElement().localBasis().
874 evaluateFunction(x,yb);
876 for (
unsigned int i=0; i<yb.size(); i++)
877 y[k] += xl[lfs.child(remap[k]).localIndex(i)]*yb[i];
884 return pgfs->gridView();
889 typedef LFSIndexCache<LFS> LFSCache;
890 typedef typename X::template ConstLocalView<LFSCache> XView;
892 std::shared_ptr<GFS const> pgfs;
893 std::size_t remap[dimR];
895 mutable LFSCache lfs_cache;
896 mutable XView x_view;
897 mutable std::vector<RF> xl;
898 mutable std::vector<RT> yb;
899 std::shared_ptr<const X> px;
907 template<
typename T,
typename X>
911 typename T::Traits::GridViewType,
912 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
914 TypeTree::StaticDegree<T>::value,
916 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
917 TypeTree::StaticDegree<T>::value,
918 T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::dimDomain
921 VectorDiscreteGridFunctionGradient<T,X>
928 typename T::Traits::GridViewType,
929 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
933 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
935 T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::dimDomain>
942 typedef typename T::template Child<0>::Type ChildType;
943 typedef typename ChildType::Traits::FiniteElementType::Traits::LocalBasisType::Traits LBTraits;
945 typedef typename LBTraits::RangeFieldType RF;
946 typedef typename LBTraits::JacobianType JT;
958 , xl(gfs.maxLocalSize())
959 , J(gfs.maxLocalSize())
973 , xl(pgfs->maxLocalSize())
974 , J(pgfs->maxLocalSize())
978 inline void evaluate(
const typename Traits::ElementType& e,
979 const typename Traits::DomainType& x,
980 typename Traits::RangeType& y)
const
985 x_view.bind(lfs_cache);
990 const typename Traits::ElementType::Geometry::JacobianInverseTransposed
991 JgeoIT = e.geometry().jacobianInverseTransposed(x);
999 std::vector<typename LBTraits::JacobianType> J(lfs.child(k).size());
1000 lfs.child(k).finiteElement().localBasis().evaluateJacobian(x,J);
1003 for (
typename LFS::Traits::SizeType i=0; i<lfs.child(k).
size(); i++)
1006 JgeoIT.umv(J[i][0], gradphi);
1008 y[k].
axpy(xl[lfs.child(k).localIndex(i)], gradphi);
1017 return pgfs->gridView();
1022 typedef LFSIndexCache<LFS> LFSCache;
1023 typedef typename X::template ConstLocalView<LFSCache> XView;
1025 std::shared_ptr<GFS const> pgfs;
1027 mutable LFSCache lfs_cache;
1028 mutable XView x_view;
1029 mutable std::vector<RF> xl;
1030 mutable std::vector<JT> J;
1031 std::shared_ptr<const X> px;
1047 template<
typename Mat,
typename RF, std::
size_t size>
1053 template<
typename T>
1058 mat.umv(t,grad_phi);
1072 template<
typename RF, std::
size_t size>
1079 template<
typename T>
1096 template<
typename RF, std::
size_t size>
1103 template<
typename T>
1106 return mat[k][k]*t[k];
1120 template<
typename T,
typename X>
1123 Dune::PDELab::GridFunctionTraits<
1124 typename T::Traits::GridViewType,
1125 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
1126 T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::dimRange,
1127 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeType>,
1128 VectorDiscreteGridFunctionDiv<T,X> >
1134 typename T::Traits::GridViewType,
1135 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
1136 T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::dimRange,
1137 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeType>,
1141 typedef typename T::template Child<0>::Type ChildType;
1142 typedef typename ChildType::Traits::FiniteElementType::Traits::LocalBasisType::Traits LBTraits;
1144 typedef typename LBTraits::RangeFieldType RF;
1145 typedef typename LBTraits::JacobianType JT;
1157 , xl(gfs.maxLocalSize())
1158 , J(gfs.maxLocalSize())
1161 "dimDomain and number of children has to be the same");
1174 , xl(pgfs->maxLocalSize())
1175 , J(pgfs->maxLocalSize())
1178 "dimDomain and number of children has to be the same");
1181 inline void evaluate(
const typename Traits::ElementType& e,
1182 const typename Traits::DomainType& x,
1183 typename Traits::RangeType& y)
const
1188 x_view.bind(lfs_cache);
1193 const typename Traits::ElementType::Geometry::JacobianInverseTransposed
1194 JgeoIT = e.geometry().jacobianInverseTransposed(x);
1196 const typename Traits::ElementType::Geometry::JacobianInverseTransposed::size_type N =
1197 Traits::ElementType::Geometry::JacobianInverseTransposed::rows;
1205 std::vector<typename LBTraits::JacobianType> J(lfs.child(k).size());
1206 lfs.child(k).finiteElement().localBasis().evaluateJacobian(x,J);
1209 for(
typename LFS::Traits::SizeType i=0; i<lfs.child(k).
size(); i++) {
1213 typename Traits::ElementType::Geometry::JacobianInverseTransposed,
1214 typename Traits::ElementType::Geometry::JacobianInverseTransposed::field_type,
1215 N>::template compute_derivative<typename LBTraits::JacobianType::row_type>
1218 y += xl[lfs.child(k).localIndex(i)] * d_k_phi;
1226 return pgfs->gridView();
1231 typedef Dune::PDELab::LFSIndexCache<LFS> LFSCache;
1232 typedef typename X::template ConstLocalView<LFSCache> XView;
1234 std::shared_ptr<GFS const> pgfs;
1236 mutable LFSCache lfs_cache;
1237 mutable XView x_view;
1238 mutable std::vector<RF> xl;
1239 mutable std::vector<JT> J;
1240 std::shared_ptr<const X> px;
1255 template<typename T, typename X, std::size_t dimR = TypeTree::StaticDegree<T>::value>
1264 "Curl computation can only be done in two or three dimensions");
1270 "Curl computation can only be done in two or three dimensions");
1285 template<
typename T,
typename X>
1288 Dune::PDELab::GridFunctionTraits<
1289 typename T::Traits::GridViewType,
1290 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
1292 TypeTree::StaticDegree<T>::value,
1294 typename T::template Child<0>::Type::Traits::FiniteElementType
1295 ::Traits::LocalBasisType::Traits::RangeFieldType,
1297 TypeTree::StaticDegree<T>::value
1300 VectorDiscreteGridFunctionCurl<T,X>
1307 typename T::Traits::GridViewType,
1308 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
1312 typename T::template Child<0>::Type::Traits::FiniteElementType
1313 ::Traits::LocalBasisType::Traits::RangeFieldType,
1322 typedef typename T::template Child<0>::Type ChildType;
1323 typedef typename ChildType::Traits::FiniteElementType::Traits::LocalBasisType::Traits LBTraits;
1325 typedef typename LBTraits::RangeFieldType RF;
1326 typedef typename LBTraits::JacobianType JT;
1338 , xl(gfs.maxLocalSize())
1339 , J(gfs.maxLocalSize())
1342 "dimDomain and number of children has to be the same");
1355 , xl(pgfs->maxLocalSize())
1356 , J(pgfs->maxLocalSize())
1359 "dimDomain and number of children has to be the same");
1362 inline void evaluate(
const typename Traits::ElementType& e,
1363 const typename Traits::DomainType& x,
1364 typename Traits::RangeType& y)
const
1369 x_view.bind(lfs_cache);
1374 const typename Traits::ElementType::Geometry::JacobianInverseTransposed
1375 JgeoIT = e.geometry().jacobianInverseTransposed(x);
1377 const typename Traits::ElementType::Geometry::JacobianInverseTransposed::size_type N =
1378 Traits::ElementType::Geometry::JacobianInverseTransposed::rows;
1389 std::vector<typename LBTraits::JacobianType> J(lfs.child(k).size());
1390 lfs.child(k).finiteElement().localBasis().evaluateJacobian(x,J);
1397 for(
typename LFS::Traits::SizeType i=0; i<lfs.child(k).size(); i++) {
1401 typename Traits::ElementType::Geometry::JacobianInverseTransposed,
1402 typename Traits::ElementType::Geometry::JacobianInverseTransposed::field_type,
1403 N>::template compute_derivative<typename LBTraits::JacobianType::row_type>
1404 (JgeoIT,J[i][0],i2);
1406 y[i1] += xl[lfs.child(k).localIndex(i)] * d_k_phi;
1411 typename Traits::ElementType::Geometry::JacobianInverseTransposed,
1412 typename Traits::ElementType::Geometry::JacobianInverseTransposed::field_type,
1413 N>::template compute_derivative<typename LBTraits::JacobianType::row_type>
1414 (JgeoIT,J[i][0],i1);
1416 y[i2] -= xl[lfs.child(k).localIndex(i)] * d_k_phi;
1424 return pgfs->gridView();
1429 typedef Dune::PDELab::LFSIndexCache<LFS> LFSCache;
1430 typedef typename X::template ConstLocalView<LFSCache> XView;
1432 std::shared_ptr<GFS const> pgfs;
1434 mutable LFSCache lfs_cache;
1435 mutable XView x_view;
1436 mutable std::vector<RF> xl;
1437 mutable std::vector<JT> J;
1438 std::shared_ptr<const X> px;
1451 template<
typename T,
typename X>
1454 Dune::PDELab::GridFunctionTraits<
1455 typename T::Traits::GridViewType,
1456 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
1457 T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::dimRange,
1458 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeType>,
1459 VectorDiscreteGridFunctionDiv<T,X> >
1465 typename T::Traits::GridViewType,
1466 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType,
1467 T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::dimRange,
1468 typename T::template Child<0>::Type::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeType>,
1472 typedef typename T::template Child<0>::Type ChildType;
1473 typedef typename ChildType::Traits::FiniteElementType::Traits::LocalBasisType::Traits LBTraits;
1475 typedef typename LBTraits::RangeFieldType RF;
1476 typedef typename LBTraits::JacobianType JT;
1488 , xl(gfs.maxLocalSize())
1489 , J(gfs.maxLocalSize())
1492 "dimDomain and number of children has to be the same");
1505 , xl(pgfs->maxLocalSize())
1506 , J(pgfs->maxLocalSize())
1509 "dimDomain and number of children has to be the same");
1512 inline void evaluate(
const typename Traits::ElementType& e,
1513 const typename Traits::DomainType& x,
1514 typename Traits::RangeType& y)
const
1519 x_view.bind(lfs_cache);
1524 const typename Traits::ElementType::Geometry::JacobianInverseTransposed
1525 JgeoIT = e.geometry().jacobianInverseTransposed(x);
1527 const typename Traits::ElementType::Geometry::JacobianInverseTransposed::size_type N =
1528 Traits::ElementType::Geometry::JacobianInverseTransposed::rows;
1540 std::vector<typename LBTraits::JacobianType> J(lfs.child(k).size());
1541 lfs.child(k).finiteElement().localBasis().evaluateJacobian(x,J);
1546 for(
typename LFS::Traits::SizeType i=0; i<lfs.child(k).
size(); i++) {
1550 typename Traits::ElementType::Geometry::JacobianInverseTransposed,
1551 typename Traits::ElementType::Geometry::JacobianInverseTransposed::field_type,
1552 N>::template compute_derivative<typename LBTraits::JacobianType::row_type>
1553 (JgeoIT,J[i][0],i2);
1555 y +=
sign * xl[lfs.child(k).localIndex(i)] * d_k_phi;
1564 return pgfs->gridView();
1569 typedef Dune::PDELab::LFSIndexCache<LFS> LFSCache;
1570 typedef typename X::template ConstLocalView<LFSCache> XView;
1572 std::shared_ptr<GFS const> pgfs;
1574 mutable LFSCache lfs_cache;
1575 mutable XView x_view;
1576 mutable std::vector<RF> xl;
1577 mutable std::vector<JT> J;
1578 std::shared_ptr<const X> px;
derived_type & axpy(const field_type &a, const DenseVector< Other > &x)
vector space axpy operation ( *this += a x )
Definition: densevector.hh:575
A diagonal matrix of static size.
Definition: diagonalmatrix.hh:53
A dense n x m matrix.
Definition: fmatrix.hh:117
vector space out of a tensor product of fields.
Definition: fvector.hh:91
convert a grid function space and a coefficient vector into a grid function of the curl
Definition: gridfunctionspaceutilities.hh:193
DiscreteGridFunctionCurl(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a DiscreteGridFunctionCurl.
Definition: gridfunctionspaceutilities.hh:226
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:260
DiscreteGridFunctionCurl(const GFS &gfs, const X &x_)
Construct a DiscreteGridFunctionCurl.
Definition: gridfunctionspaceutilities.hh:210
convert a single component function space with experimental global finite elements into a grid functi...
Definition: gridfunctionspaceutilities.hh:375
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:461
DiscreteGridFunctionGlobalCurl(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a DiscreteGridFunctionGlobalCurl.
Definition: gridfunctionspaceutilities.hh:413
DiscreteGridFunctionGlobalCurl(const GFS &gfs, const X &x_)
Construct a DiscreteGridFunctionGlobalCurl.
Definition: gridfunctionspaceutilities.hh:398
convert a single component function space with a grid function representing the gradient
Definition: gridfunctionspaceutilities.hh:505
DiscreteGridFunctionGradient(const GFS &gfs, const X &x_)
Construct a DiscreteGridFunctionGradient.
Definition: gridfunctionspaceutilities.hh:530
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:588
DiscreteGridFunctionGradient(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a DiscreteGridFunctionGradient.
Definition: gridfunctionspaceutilities.hh:543
DiscreteGridFunction with Piola transformation.
Definition: gridfunctionspaceutilities.hh:620
DiscreteGridFunctionPiola(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a DiscreteGridFunctionPiola.
Definition: gridfunctionspaceutilities.hh:655
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:692
DiscreteGridFunctionPiola(const GFS &gfs, const X &x_)
Construct a DiscreteGridFunctionPiola.
Definition: gridfunctionspaceutilities.hh:640
convert a grid function space and a coefficient vector into a grid function
Definition: gridfunctionspaceutilities.hh:76
DiscreteGridFunction(const GFS &gfs, const X &x_)
Construct a DiscreteGridFunction.
Definition: gridfunctionspaceutilities.hh:102
DiscreteGridFunction(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a DiscreteGridFunction.
Definition: gridfunctionspaceutilities.hh:117
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:150
leaf of a function tree
Definition: function.hh:302
T Traits
Export type traits.
Definition: function.hh:193
extract the curl of a function from the jacobian of that function
Definition: jacobiantocurl.hh:27
Create a local function space from a global function space.
Definition: localfunctionspace.hh:754
VectorDiscreteGridFunctionCurl(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a VectorDiscreteGridFunctionCurl.
Definition: gridfunctionspaceutilities.hh:1500
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:1562
VectorDiscreteGridFunctionCurl(const GFS &gfs, const X &x_)
Construct a VectorDiscreteGridFunctionCurl.
Definition: gridfunctionspaceutilities.hh:1483
VectorDiscreteGridFunctionCurl(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a VectorDiscreteGridFunctionCurl.
Definition: gridfunctionspaceutilities.hh:1350
VectorDiscreteGridFunctionCurl(const GFS &gfs, const X &x_)
Construct a VectorDiscreteGridFunctionCurl.
Definition: gridfunctionspaceutilities.hh:1333
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:1422
Compute curl of vector-valued functions.
Definition: gridfunctionspaceutilities.hh:1257
Compute divergence of vector-valued functions.
Definition: gridfunctionspaceutilities.hh:1129
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:1224
VectorDiscreteGridFunctionDiv(const GFS &gfs, const X &x_)
Construct a VectorDiscreteGridFunctionDiv.
Definition: gridfunctionspaceutilities.hh:1152
VectorDiscreteGridFunctionDiv(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a VectorDiscreteGridFunctionDiv.
Definition: gridfunctionspaceutilities.hh:1169
Equivalent of DiscreteGridFunctionGradient for vector-valued functions.
Definition: gridfunctionspaceutilities.hh:923
VectorDiscreteGridFunctionGradient(const GFS &gfs, const X &x_)
Construct a VectorDiscreteGridFunctionGradient.
Definition: gridfunctionspaceutilities.hh:953
VectorDiscreteGridFunctionGradient(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_)
Construct a VectorDiscreteGridFunctionGradient.
Definition: gridfunctionspaceutilities.hh:968
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:1015
DiscreteGridFunction for vector-valued functions.
Definition: gridfunctionspaceutilities.hh:744
const Traits::GridViewType & getGridView() const
get a reference to the GridView
Definition: gridfunctionspaceutilities.hh:882
VectorDiscreteGridFunction(const GFS &gfs, const X &x_, const Remap &remap_)
construct
Definition: gridfunctionspaceutilities.hh:821
VectorDiscreteGridFunction(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_, const Remap &remap_)
Construct a VectorDiscreteGridFunction.
Definition: gridfunctionspaceutilities.hh:848
VectorDiscreteGridFunction(std::shared_ptr< const GFS > gfs, std::shared_ptr< const X > x_, std::size_t start=0)
Construct a VectorDiscreteGridFunction.
Definition: gridfunctionspaceutilities.hh:795
VectorDiscreteGridFunction(const GFS &gfs, const X &x_, std::size_t start=0)
construct
Definition: gridfunctionspaceutilities.hh:776
A few common exception classes.
Implements a vector constructed from a given type representing a field and a compile-time given size.
std::size_t degree(const Node &node)
Returns the degree of node as run time information.
Definition: nodeinterface.hh:79
decltype(Node::degree()) StaticDegree
Returns the statically known degree of the given Node type as a std::integral_constant.
Definition: nodeinterface.hh:107
Dune namespace.
Definition: alignedallocator.hh:13
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Create a shared_ptr for a stack-allocated object.
Definition: shared_ptr.hh:72
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
int sign(const T &val)
Return the sign of the value.
Definition: math.hh:180
This file implements several utilities related to std::shared_ptr.
template which always yields a false value
Definition: typetraits.hh:124
Switch for uniform treatment of local and global basis classes.
Definition: interfaceswitch.hh:154
static const std::size_t dimRange
export dimension of the values
Definition: interfaceswitch.hh:165
Basis::Traits::RangeField RangeField
export field type of the values
Definition: interfaceswitch.hh:163
Basis::Traits::Range Range
export vector type of the values
Definition: interfaceswitch.hh:167
Switch for uniform treatment of finite element with either the local or the global interface.
Definition: interfaceswitch.hh:30
Helper class to calculate the Traits of DiscreteGridFunctionCurl.
Definition: gridfunctionspaceutilities.hh:294
Dune::FieldVector< GV::Grid::ctype, GV::dimension > DomainType
domain type in dim-size coordinates
Definition: function.hh:50
R RangeType
range type
Definition: function.hh:62
RangeFieldType RangeFieldType
Export type for range field.
Definition: function.hh:53
traits class holding the function signature, same as in local function
Definition: function.hh:183
GV::Traits::template Codim< 0 >::Entity ElementType
codim 0 entity
Definition: function.hh:119
GV GridViewType
The type of the grid view the function lives on.
Definition: function.hh:116
static RF compute_derivative(const Dune::DiagonalMatrix< RF, size > &mat, const T &t, const unsigned int k)
Definition: gridfunctionspaceutilities.hh:1104
static RF compute_derivative(const Dune::FieldMatrix< RF, size, size > &mat, const T &t, const unsigned int k)
Definition: gridfunctionspaceutilities.hh:1080
Helper class to compute a single derivative of scalar basis functions.
Definition: gridfunctionspaceutilities.hh:1048
static RF compute_derivative(const Mat &mat, const T &t, const unsigned int k)
Definition: gridfunctionspaceutilities.hh:1054