14#include <dune/localfunctions/utility/field.hh>
31 template <
class F,
int dimD,
unsigned int deriv>
34 typedef LFETensor<F,dimD,deriv> This;
35 typedef LFETensor<F,dimD-1,deriv> BaseDim;
36 typedef LFETensor<F,dimD,deriv-1> BaseDeriv;
40 static const unsigned int size = BaseDim::size+BaseDeriv::size;
44 This &operator= (
const FF &f )
46 block() = field_cast< F >( f );
50 This &operator= (
const Block &b )
56 This &operator*= (
const field_type &f )
62 const field_type &operator[] (
const unsigned int i )
const
67 field_type &operator[] (
const unsigned int i )
76 const Block &block()
const
80 void axpy(
const F& a,
const This &y)
82 block().axpy(a,y.block());
85 void assign(
const LFETensor<Fy,dimD,deriv> &y)
93 template <
class F,
int dimD,
unsigned int deriv>
94 struct FieldTraits<LFETensor<F,dimD,deriv>>
97 using real_type =
typename FieldTraits<field_type>::real_type;
101 template <
class F,
unsigned int deriv>
102 struct LFETensor<F,0,deriv>
104 static const int size = 0;
108 struct LFETensor<F,0,0>
110 static const int size = 1;
113 template <
class F,
int dimD>
114 class LFETensor<F,dimD,0>
116 typedef LFETensor<F,dimD,0> This;
119 typedef F field_type;
120 static const int size = 1;
124 This &operator= (
const FF &f )
126 block() = field_cast< F >( f );
130 This &operator= (
const Block &b )
136 This &operator*= (
const field_type &f )
142 const F &operator[] (
const unsigned int i )
const
147 F &operator[] (
const unsigned int i )
152 void axpy(
const F& a,
const This &y)
154 block().axpy(a,y.block());
157 void assign(
const LFETensor<Fy,dimD,0> &y)
166 const Block &block()
const
175 namespace DerivativeLayoutNS {
176 enum DerivativeLayout {value,derivative};
178 template <
class F,
int dimD,
int dimR,
unsigned int deriv,
179 DerivativeLayoutNS::DerivativeLayout layout>
182 template <
class F,
int dimD,
int dimR,
unsigned int deriv,
183 DerivativeLayoutNS::DerivativeLayout layout>
184 struct FieldTraits<Derivatives<F,dimD,dimR,deriv,layout>>
186 using field_type = F;
187 using real_type =
typename FieldTraits<field_type>::real_type;
191 template <
class F,
int dimD,
int dimR,
unsigned int deriv>
192 struct Derivatives<F,dimD,dimR,deriv,DerivativeLayoutNS::value>
193 :
public Derivatives<F,dimD,dimR,deriv-1,DerivativeLayoutNS::value>
195 typedef Derivatives<F,dimD,dimR,deriv,DerivativeLayoutNS::value> This;
196 typedef Derivatives<F,dimD,dimR,deriv-1,DerivativeLayoutNS::value> Base;
197 typedef LFETensor<F,dimD,deriv> ThisLFETensor;
200 typedef F field_type;
202 static const DerivativeLayoutNS::DerivativeLayout layout = DerivativeLayoutNS::value;
203 static const unsigned int dimDomain = dimD;
204 static const unsigned int dimRange = dimR;
205 constexpr static int size = Base::size+ThisLFETensor::size*dimR;
208 This &operator=(
const F& f)
218 template <
unsigned int dorder>
221 tensor<dorder>() = t;
224 This &operator=(
const Block &t)
230 This &operator*= (
const field_type &f )
236 void axpy(
const F &a,
const This &y)
238 block().
axpy(a,y.block());
243 void assign(
const Derivatives<Fy,dimD,dimR,deriv,DerivativeLayoutNS::value> &y)
249 void assign(
const Derivatives<Fy,dimD,dimR,deriv,DerivativeLayoutNS::derivative> &y)
252 for (
int rr=0; rr<dimR; ++rr)
253 tensor_[rr] = y[rr].
template tensor<deriv>()[0];
256 template <
class Fy,
int dimRy>
257 void assign(
const Derivatives<Fy,dimD,dimRy,deriv,DerivativeLayoutNS::value> &y,
unsigned int r)
259 assign<Fy,dimRy>(y.block(),r);
263 void assign(
unsigned int r,
const Derivatives<Fy,dimD,1,deriv,DerivativeLayoutNS::value> &y)
268 void assign(
unsigned int r,
const Derivatives<Fy,dimD,1,deriv,DerivativeLayoutNS::derivative> &y)
275 return reinterpret_cast<Block&
>(*this);
277 const Block &block()
const
279 return reinterpret_cast<const Block&
>(*this);
282 template <
unsigned int dorder>
286 const std::integral_constant<int,dorder> a = {};
289 template <
unsigned int dorder>
293 return tensor(std::integral_constant<int,dorder>());
295 template <
unsigned int dorder>
299 const std::integral_constant<int,dorder> a = {};
302 template <
unsigned int dorder>
306 const std::integral_constant<int,dorder> a = {};
309 ThisLFETensor &operator[](
int r) {
312 const ThisLFETensor &operator[](
int r)
const {
316 template <
class Fy,
int dimRy>
317 void assign(
const FieldVector<Fy,size*dimRy> &y,
unsigned int r)
319 Base::template assign<Fy,dimRy>(
reinterpret_cast<const FieldVector<Fy,Base::size*dimRy>&
>(y),r);
320 tensor_[0] =
reinterpret_cast<const FieldVector<Fy,ThisLFETensor::size>&
>(y[Base::size*dimRy+r*ThisLFETensor::size]);
323 void assign(
unsigned int r,
const FieldVector<Fy,size/dimR> &y)
325 Base::assign(r,
reinterpret_cast<const FieldVector<Fy,Base::size/dimR
>&>(y));
326 tensor_[r] =
reinterpret_cast<const FieldVector<Fy,ThisLFETensor::size>&
>(y[Base::size/dimR]);
329 template <
class Fy,
unsigned int dy>
330 void assign(
const Derivatives<Fy,dimD,dimR,dy,DerivativeLayoutNS::derivative> &y)
333 for (
int rr=0; rr<dimR; ++rr)
334 tensor_[rr] = y[rr].
template tensor<deriv>()[0];
337 template <
int dorder>
339 tensor(
const std::integral_constant<int,dorder> &dorderVar)
const
341 return Base::tensor(dorderVar);
344 tensor(
const std::integral_constant<int,deriv> &dorderVar)
const
348 template <
int dorder>
350 tensor(
const std::integral_constant<int,dorder> &dorderVar)
352 return Base::tensor(dorderVar);
355 tensor(
const std::integral_constant<int,deriv> &dorderVar)
362 template <
class F,
int dimD,
int dimR>
363 struct Derivatives<F,dimD,dimR,0,DerivativeLayoutNS::value>
365 typedef Derivatives<F,dimD,dimR,0,DerivativeLayoutNS::value> This;
366 typedef LFETensor<F,dimD,0> ThisLFETensor;
369 typedef F field_type;
371 static const DerivativeLayoutNS::DerivativeLayout layout = DerivativeLayoutNS::value;
372 static const unsigned int dimDomain = dimD;
373 static const unsigned int dimRange = dimR;
374 constexpr static int size = ThisLFETensor::size*dimR;
378 This &operator=(
const FF& f)
380 for (
int r=0; r<dimR; ++r)
381 tensor_[r] = field_cast<F>(f);
390 This &operator=(
const Block &t)
396 This &operator*= (
const field_type &f )
402 void axpy(
const F &a,
const This &y)
404 block().
axpy(a,y.block());
407 void assign(
const Derivatives<Fy,dimD,dimR,0,DerivativeLayoutNS::value> &y)
412 void assign(
const Derivatives<Fy,dimD,dimR,0,DerivativeLayoutNS::derivative> &y)
414 for (
int rr=0; rr<dimR; ++rr)
415 tensor_[rr] = y[rr].
template tensor<0>()[0];
417 template <
class Fy,
int dimRy>
418 void assign(
const Derivatives<Fy,dimD,dimRy,0,DerivativeLayoutNS::value> &y,
unsigned int r)
420 assign<Fy,dimRy>(y.block(),r);
423 void assign(
unsigned int r,
const Derivatives<Fy,dimD,1,0,DerivativeLayoutNS::value> &y)
425 tensor_[r].assign(y[0]);
428 void assign(
unsigned int r,
const Derivatives<Fy,dimD,1,0,DerivativeLayoutNS::derivative> &y)
430 tensor_[r].assign(y[0][0]);
435 return reinterpret_cast<Block&
>(*this);
437 const Block &block()
const
439 return reinterpret_cast<const Block&
>(*this);
442 ThisLFETensor &operator[](
int r) {
445 const ThisLFETensor &operator[](
int r)
const {
448 template <
int dorder>
457 template <
unsigned int dorder>
461 const std::integral_constant<int,dorder> a = {};
464 template <
unsigned int dorder>
468 const std::integral_constant<int,dorder> a = {};
474 tensor(
const std::integral_constant<int,0> &dorderVar)
const
479 tensor(
const std::integral_constant<int,0> &dorderVar)
483 template <
class Fy,
unsigned int dy>
484 void assign(
const Derivatives<Fy,dimD,dimR,dy,DerivativeLayoutNS::derivative> &y)
486 for (
int rr=0; rr<dimR; ++rr)
487 tensor_[rr] = y[rr].
template tensor<0>()[0];
489 template <
class Fy,
int dimRy>
490 void assign(
const FieldVector<Fy,size*dimRy> &y,
unsigned int r)
492 tensor_[0] =
reinterpret_cast<const FieldVector<Fy,ThisLFETensor::size>&
>(y[r*ThisLFETensor::size]);
495 void assign(
unsigned int r,
const FieldVector<Fy,size/dimR> &y)
503 template <
class F,
int dimD,
int dimR,
unsigned int deriv>
504 struct Derivatives<F,dimD,dimR,deriv,DerivativeLayoutNS::derivative>
506 typedef Derivatives<F,dimD,dimR,deriv,DerivativeLayoutNS::derivative> This;
507 typedef Derivatives<F,dimD,1,deriv,DerivativeLayoutNS::value> ScalarDeriv;
510 typedef F field_type;
512 static const DerivativeLayoutNS::DerivativeLayout layout = DerivativeLayoutNS::value;
513 static const unsigned int dimDomain = dimD;
514 static const unsigned int dimRange = dimR;
515 constexpr static int size = ScalarDeriv::size*dimR;
519 This &operator=(
const FF& f)
521 block() = field_cast<F>(f);
524 This &operator=(
const Block &t)
530 This &operator*= (
const field_type &f )
537 void axpy(
const FF &a,
const This &y)
539 block().axpy(field_cast<F>(a),y.block());
543 void assign(
const Derivatives<Fy,dimD,dimR,deriv,DerivativeLayoutNS::derivative> &y)
549 void assign(
const Derivatives<Fy,dimD,dimR,deriv,DerivativeLayoutNS::value> &y)
551 for (
unsigned int rr=0; rr<dimR; ++rr)
555 template <
class Fy,DerivativeLayoutNS::DerivativeLayout layouty>
556 void assign(
unsigned int r,
const Derivatives<Fy,dimD,1,deriv,layouty> &y)
558 deriv_[r].assign(r,y);
563 return reinterpret_cast<Block&
>(*this);
565 const Block &block()
const
567 return reinterpret_cast<const Block&
>(*this);
570 ScalarDeriv &operator[](
int r) {
573 const ScalarDeriv &operator[](
int r)
const {
583 template <
class Vec1,
class Vec2,
unsigned int deriv>
586 template <
class Field>
587 static void apply(
unsigned int r,
const Field &a,
588 const Vec1 &x, Vec2 &y)
593 template <
class F1,
int dimD,
int dimR,
597 struct LFETensorAxpy<Derivatives<F1,dimD,dimR,d,DerivativeLayoutNS::value>,Vec2,deriv>
599 typedef Derivatives<F1,dimD,dimR,d,DerivativeLayoutNS::value> Vec1;
600 template <
class Field>
601 static void apply(
unsigned int r,
const Field &a,
602 const Vec1 &x, Vec2 &y)
604 const FieldVector<F1,Vec2::size> &xx = x.template block<deriv>();
605 for (
int i=0; i<y.size; ++i)
609 template <
class F1,
int dimD,
int dimR,
613 struct LFETensorAxpy<Derivatives<F1,dimD,dimR,d,DerivativeLayoutNS::derivative>,Vec2,deriv>
615 typedef Derivatives<F1,dimD,dimR,d,DerivativeLayoutNS::derivative> Vec1;
616 template <
class Field>
617 static void apply(
unsigned int r,
const Field &a,
618 const Vec1 &x, Vec2 &y)
620 for (
int rr=0; rr<dimR; ++rr)
621 LFETensorAxpy<Derivatives<F1,dimD,1,d,DerivativeLayoutNS::value>,
622 Vec2,deriv>::apply(rr,a,x[rr],y);
625 template <
class F1,
int dimD,
629 struct LFETensorAxpy<Derivatives<F1,dimD,1,d,DerivativeLayoutNS::derivative>,Vec2,deriv>
631 typedef Derivatives<F1,dimD,1,d,DerivativeLayoutNS::derivative> Vec1;
632 template <
class Field>
633 static void apply(
unsigned int r,
const Field &a,
634 const Vec1 &x, Vec2 &y)
636 LFETensorAxpy<Derivatives<F1,dimD,1,d,DerivativeLayoutNS::value>,
637 Vec2,deriv>::apply(r,a,x[0],y);
640 template <
class F1,
int dimD,
644 struct LFETensorAxpy<Derivatives<F1,dimD,1,d,DerivativeLayoutNS::value>,Vec2,deriv>
646 typedef Derivatives<F1,dimD,1,d,DerivativeLayoutNS::value> Vec1;
647 template <
class Field>
648 static void apply(
unsigned int r,
const Field &a,
649 const Vec1 &x, Vec2 &y)
651 typedef LFETensor<F1,dimD,deriv> LFETensorType;
652 const unsigned int rr = r*LFETensorType::size;
653 const FieldVector<F1,LFETensorType::size> &xx = x.template block<deriv>();
654 for (
int i=0; i<FieldVector<F1,LFETensorType::size>::dimension; ++i)
662 template <
class Vec1,
class Vec2>
663 struct DerivativeAssign
665 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
670 template <
int dimD,
int dimR,
unsigned int deriv, DerivativeLayoutNS::DerivativeLayout layout,
672 struct DerivativeAssign<Derivatives<F1,dimD,dimR,deriv,layout>,
673 Derivatives<F2,dimD,dimR,deriv,layout> >
675 typedef Derivatives<F1,dimD,dimR,deriv,layout> Vec1;
676 typedef Derivatives<F2,dimD,dimR,deriv,layout> Vec2;
677 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
682 template <
int dimD,
int dimR,
unsigned int deriv,
684 struct DerivativeAssign<Derivatives<F1,dimD,dimR,deriv,DerivativeLayoutNS::value>,
685 Derivatives<F2,dimD,dimR,deriv,DerivativeLayoutNS::derivative> >
687 typedef Derivatives<F1,dimD,dimR,deriv,DerivativeLayoutNS::value> Vec1;
688 typedef Derivatives<F2,dimD,dimR,deriv,DerivativeLayoutNS::derivative> Vec2;
689 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
694 template <
int dimD,
int dimR,
unsigned int deriv,
696 struct DerivativeAssign<Derivatives<F1,dimD,dimR,deriv,DerivativeLayoutNS::derivative>,
697 Derivatives<F2,dimD,dimR,deriv,DerivativeLayoutNS::value> >
699 typedef Derivatives<F1,dimD,dimR,deriv,DerivativeLayoutNS::derivative> Vec1;
700 typedef Derivatives<F2,dimD,dimR,deriv,DerivativeLayoutNS::value> Vec2;
701 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
706 template <
int dimD,
int dimR,
unsigned int deriv,DerivativeLayoutNS::DerivativeLayout layout,
708 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,layout>,
709 Derivatives<F2,dimD,dimR,deriv,DerivativeLayoutNS::value> >
711 typedef Derivatives<F1,dimD,1,deriv,layout> Vec1;
712 typedef Derivatives<F2,dimD,dimR,deriv,DerivativeLayoutNS::value> Vec2;
713 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
718 template <
int dimD,
int dimR,
unsigned int deriv,DerivativeLayoutNS::DerivativeLayout layout,
720 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,layout>,
721 Derivatives<F2,dimD,dimR,deriv,DerivativeLayoutNS::derivative> >
723 typedef Derivatives<F1,dimD,1,deriv,layout> Vec1;
724 typedef Derivatives<F2,dimD,dimR,deriv,DerivativeLayoutNS::derivative> Vec2;
725 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
730 template <
int dimD,
unsigned int deriv,
732 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::value>,
733 Derivatives<F2,dimD,1,deriv,DerivativeLayoutNS::value> >
735 typedef Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::value> Vec1;
736 typedef Derivatives<F2,dimD,1,deriv,DerivativeLayoutNS::value> Vec2;
737 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
742 template <
int dimD,
unsigned int deriv,
744 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::derivative>,
745 Derivatives<F2,dimD,1,deriv,DerivativeLayoutNS::derivative> >
747 typedef Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::derivative> Vec1;
748 typedef Derivatives<F2,dimD,1,deriv,DerivativeLayoutNS::derivative> Vec2;
749 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
754 template <
int dimD,
unsigned int deriv,
756 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::derivative>,
757 Derivatives<F2,dimD,1,deriv,DerivativeLayoutNS::value> >
759 typedef Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::derivative> Vec1;
760 typedef Derivatives<F2,dimD,1,deriv,DerivativeLayoutNS::value> Vec2;
761 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
766 template <
int dimD,
unsigned int deriv,
768 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::value>,
769 Derivatives<F2,dimD,1,deriv,DerivativeLayoutNS::derivative> >
771 typedef Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::value> Vec1;
772 typedef Derivatives<F2,dimD,1,deriv,DerivativeLayoutNS::derivative> Vec2;
773 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
778 template <
int dimD,
unsigned int deriv,DerivativeLayoutNS::DerivativeLayout layout,
780 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,layout>,
783 typedef Derivatives<F1,dimD,1,deriv,layout> Vec1;
785 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
790 template <
int dimD,
int dimR,
791 class F1,
unsigned int deriv,
793 struct DerivativeAssign<Derivatives<F1,dimD,dimR,deriv,DerivativeLayoutNS::value>,FieldVector<F2,dimR> >
795 typedef Derivatives<F1,dimD,dimR,deriv,DerivativeLayoutNS::value> Vec1;
796 typedef FieldVector<F2,dimR> Vec2;
797 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
802 template <
int dimD,
int dimR,
803 class F1,
unsigned int deriv,
805 struct DerivativeAssign<Derivatives<F1,dimD,dimR,deriv,DerivativeLayoutNS::derivative>,FieldVector<F2,dimR> >
807 typedef Derivatives<F1,dimD,dimR,deriv,DerivativeLayoutNS::derivative> Vec1;
808 typedef FieldVector<F2,dimR> Vec2;
809 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
811 for (
int rr=0; rr<dimR; ++rr)
812 field_cast(vec1[rr].
template tensor<0>()[0].block(),vec2[rr]);
816 class F1,
unsigned int deriv,
818 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::value>,FieldVector<F2,dimR> >
820 typedef Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::value> Vec1;
821 typedef FieldVector<F2,dimR> Vec2;
822 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
824 field_cast(vec1.template tensor<0>()[0].block(),vec2[r]);
828 class F1,
unsigned int deriv,
830 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::derivative>,FieldVector<F2,dimR> >
832 typedef Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::derivative> Vec1;
833 typedef FieldVector<F2,dimR> Vec2;
834 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
836 field_cast(vec1[0].
template tensor<0>()[0].block(),vec2[r]);
840 class F1,
unsigned int deriv,
842 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::value>,FieldVector<F2,1> >
844 typedef Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::value> Vec1;
845 typedef FieldVector<F2,1> Vec2;
846 static void apply(
unsigned int r,
const Vec1 &vec1,Vec2 &vec2)
848 field_cast(vec1.template tensor<0>()[0].block(),vec2);
852 class F1,
unsigned int deriv,
854 struct DerivativeAssign<Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::derivative>,FieldVector<F2,1> >
856 typedef Derivatives<F1,dimD,1,deriv,DerivativeLayoutNS::derivative> Vec1;
857 typedef FieldVector<F2,1> Vec2;
858 static void apply(
unsigned int ,
const Vec1 &vec1,Vec2 &vec2)
860 field_cast(vec1[0].
template tensor<0>()[0].block(),vec2);
867 template <
class F,
int dimD,
unsigned int deriv>
868 std::ostream &operator<< ( std::ostream &out,
const LFETensor< F,dimD,deriv > &tensor )
870 return out << tensor.block();
873 template <
class F,
int dimD,
unsigned int deriv>
874 std::ostream &operator<< ( std::ostream &out,
const ScalarDerivatives< F,dimD,deriv > &d )
876 out <<
static_cast<const ScalarDerivatives< F,dimD,deriv-1
> &>(d);
877 out <<
" , " << d.tensor() << std::endl;
880 template <
class F,
int dimD>
881 std::ostream &operator<< ( std::ostream &out,
const ScalarDerivatives< F,dimD,0 > &d )
883 out << d.tensor() << std::endl;
887 template <
class F,
int dimD,
int dimR,
unsigned int deriv>
888 std::ostream &operator<< ( std::ostream &out,
const Derivatives< F,dimD,dimR,deriv,DerivativeLayoutNS::derivative > &d )
892 for (
int r=1; r<dimR; ++r)
894 out <<
" , " << d[r];
896 out <<
" ) " << std::endl;
899 template <
class F,
int dimD,
int dimR,
unsigned int deriv>
900 std::ostream &operator<< ( std::ostream &out,
const Derivatives< F,dimD,dimR,deriv,DerivativeLayoutNS::value > &d )
902 out <<
static_cast<const Derivatives< F,dimD,dimR,deriv-1,DerivativeLayoutNS::value
> &>(d);
905 for (
int r=1; r<dimR; ++r)
907 out <<
" , " << d[r];
909 out <<
" ) " << std::endl;
912 template <
class F,
int dimD,
int dimR>
913 std::ostream &operator<< ( std::ostream &out,
const Derivatives< F,dimD,dimR,0,DerivativeLayoutNS::derivative > &d )
917 for (
int r=1; r<dimR; ++r)
919 out <<
" , " << d[r];
921 out <<
" ) " << std::endl;
924 template <
class F,
int dimD,
int dimR>
925 std::ostream &operator<< ( std::ostream &out,
const Derivatives< F,dimD,dimR,0,DerivativeLayoutNS::value > &d )
929 for (
int r=1; r<dimR; ++r)
931 out <<
" , " << d[r];
933 out <<
" ) " << std::endl;
936 template <
class F,
int dimD,
int dimR,
unsigned int deriv,DerivativeLayoutNS::DerivativeLayout layout>
937 std::ostream &operator<< ( std::ostream &out,
const std::vector<Derivatives< F,dimD,dimR,deriv,layout > > &y )
939 out <<
"Number of basis functions: " << y.size() << std::endl;
940 for (
unsigned int i=0; i<y.size(); ++i)
942 out <<
"Base " << i <<
" : " << std::endl;
derived_type & axpy(const field_type &a, const DenseVector< Other > &x)
vector space axpy operation ( *this += a x )
Definition: densevector.hh:575
Implements a vector constructed from a given type representing a field and a compile-time given size.
Dune namespace.
Definition: alignedallocator.hh:13
void field_cast(const F1 &f1, F2 &f2)
a helper class to cast from one field to another
Definition: field.hh:159
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
void assign(T &dst, const T &src, bool mask)
masked Simd assignment (scalar version)
Definition: simd.hh:447