Dune Core Modules (2.4.2)

bvector.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4#ifndef DUNE_ISTL_BVECTOR_HH
5#define DUNE_ISTL_BVECTOR_HH
6
7#include <cmath>
8#include <complex>
9#include <memory>
10#include <limits>
11
15
16#include "istlexception.hh"
17#include "basearray.hh"
18
26namespace Dune {
27
28
40 template<class B, class A=std::allocator<B> >
42 {
43 public:
44
45 //===== type definitions and constants
46
48 typedef typename B::field_type field_type;
49
51 typedef B block_type;
52
54 typedef A allocator_type;
55
57 typedef typename A::size_type size_type;
58
61
64
66 typedef B value_type;
67
68 //===== assignment from scalar
70
72 {
73 for (size_type i=0; i<this->n; i++)
74 (*this)[i] = k;
75 return *this;
76 }
77
78 //===== vector space arithmetic
81 {
82#ifdef DUNE_ISTL_WITH_CHECKING
83 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
84#endif
85 for (size_type i=0; i<this->n; ++i) (*this)[i] += y[i];
86 return *this;
87 }
88
91 {
92#ifdef DUNE_ISTL_WITH_CHECKING
93 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
94#endif
95 for (size_type i=0; i<this->n; ++i) (*this)[i] -= y[i];
96 return *this;
97 }
98
101 {
102 for (size_type i=0; i<this->n; ++i) (*this)[i] *= k;
103 return *this;
104 }
105
108 {
109 for (size_type i=0; i<this->n; ++i) (*this)[i] /= k;
110 return *this;
111 }
112
115 {
116#ifdef DUNE_ISTL_WITH_CHECKING
117 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
118#endif
119 for (size_type i=0; i<this->n; ++i) (*this)[i].axpy(a,y[i]);
120 return *this;
121 }
122
123
131 template<class OtherB, class OtherA>
132 typename PromotionTraits<field_type,typename OtherB::field_type>::PromotedType operator* (const block_vector_unmanaged<OtherB,OtherA>& y) const
133 {
134 typedef typename PromotionTraits<field_type,typename OtherB::field_type>::PromotedType PromotedType;
135 PromotedType sum(0);
136#ifdef DUNE_ISTL_WITH_CHECKING
137 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
138#endif
139 for (size_type i=0; i<this->n; ++i) {
140 sum += PromotedType(((*this)[i])*y[i]);
141 }
142 return sum;
143 }
144
152 template<class OtherB, class OtherA>
153 typename PromotionTraits<field_type,typename OtherB::field_type>::PromotedType dot(const block_vector_unmanaged<OtherB,OtherA>& y) const
154 {
155 typedef typename PromotionTraits<field_type,typename OtherB::field_type>::PromotedType PromotedType;
156 PromotedType sum(0);
157#ifdef DUNE_ISTL_WITH_CHECKING
158 if (this->n!=y.N()) DUNE_THROW(ISTLError,"vector size mismatch");
159#endif
160 for (size_type i=0; i<this->n; ++i) sum += ((*this)[i]).dot(y[i]);
161 return sum;
162 }
163
164 //===== norms
165
167 typename FieldTraits<field_type>::real_type one_norm () const
168 {
169 typename FieldTraits<field_type>::real_type sum=0;
170 for (size_type i=0; i<this->n; ++i) sum += (*this)[i].one_norm();
171 return sum;
172 }
173
175 typename FieldTraits<field_type>::real_type one_norm_real () const
176 {
177 typename FieldTraits<field_type>::real_type sum=0;
178 for (size_type i=0; i<this->n; ++i) sum += (*this)[i].one_norm_real();
179 return sum;
180 }
181
183 typename FieldTraits<field_type>::real_type two_norm () const
184 {
185 typename FieldTraits<field_type>::real_type sum=0;
186 for (size_type i=0; i<this->n; ++i) sum += (*this)[i].two_norm2();
187 return sqrt(sum);
188 }
189
191 typename FieldTraits<field_type>::real_type two_norm2 () const
192 {
193 typename FieldTraits<field_type>::real_type sum=0;
194 for (size_type i=0; i<this->n; ++i) sum += (*this)[i].two_norm2();
195 return sum;
196 }
197
199 typename FieldTraits<field_type>::real_type infinity_norm () const
200 {
201 typename FieldTraits<field_type>::real_type max=0;
202 for (size_type i=0; i<this->n; ++i) max = std::max(max,(*this)[i].infinity_norm());
203 return max;
204 }
205
207 typename FieldTraits<field_type>::real_type infinity_norm_real () const
208 {
209 typename FieldTraits<field_type>::real_type max=0;
210 for (size_type i=0; i<this->n; ++i) max = std::max(max,(*this)[i].infinity_norm_real());
211 return max;
212 }
213
214 //===== sizes
215
217 size_type N () const
218 {
219 return this->n;
220 }
221
223 size_type dim () const
224 {
225 size_type d=0;
226 for (size_type i=0; i<this->n; i++)
227 d += (*this)[i].dim();
228 return d;
229 }
230
231 protected:
234 { }
235 };
236
251 template<class B, class A=std::allocator<B> >
253 {
254 public:
255
256 //===== type definitions and constants
257
259 typedef typename B::field_type field_type;
260
262 typedef B block_type;
263
265 typedef A allocator_type;
266
268 typedef typename A::size_type size_type;
269
271 enum {
273 blocklevel = B::blocklevel+1
274 };
275
278
281
282 //===== constructors and such
283
286 capacity_(0)
287 {}
288
290 explicit BlockVector (size_type _n)
291 {
292 this->n = _n;
293 capacity_ = _n;
294 if (capacity_>0) {
295 this->p = this->allocator_.allocate(capacity_);
296 // actually construct the objects
297 new(this->p)B[capacity_];
298 } else
299 {
300 this->p = 0;
301 this->n = 0;
302 capacity_ = 0;
303 }
304 }
305
317 template<typename S>
318 BlockVector (size_type _n, S _capacity)
319 {
320 static_assert(std::numeric_limits<S>::is_integer,
321 "capacity must be an unsigned integral type (be aware, that this constructor does not set the default value!)" );
322 size_type capacity = _capacity;
323 this->n = _n;
324 if(this->n > capacity)
325 capacity_ = _n;
326 else
327 capacity_ = capacity;
328
329 if (capacity_>0) {
330 this->p = this->allocator_.allocate(capacity_);
331 new (this->p)B[capacity_];
332 } else
333 {
334 this->p = 0;
335 this->n = 0;
336 capacity_ = 0;
337 }
338 }
339
340
357 void reserve(size_type capacity, bool copyOldValues=true)
358 {
359 if(capacity >= block_vector_unmanaged<B,A>::N() && capacity != capacity_) {
360 // save the old data
361 B* pold = this->p;
362
363 if(capacity>0) {
364 // create new array with capacity
365 this->p = this->allocator_.allocate(capacity);
366 new (this->p)B[capacity];
367
368 if(copyOldValues) {
369 // copy the old values
370 B* to = this->p;
371 B* from = pold;
372
373 for(size_type i=0; i < block_vector_unmanaged<B,A>::N(); ++i, ++from, ++to)
374 *to = *from;
375 }
376 if(capacity_ > 0) {
377 // Destruct old objects and free memory
378 int i=capacity_;
379 while (i)
380 pold[--i].~B();
381 this->allocator_.deallocate(pold,capacity_);
382 }
383 }else{
384 if(capacity_ > 0)
385 // free old data
386 this->p = 0;
387 capacity_ = 0;
388 }
389
390 capacity_ = capacity;
391 }
392 }
393
401 {
402 return capacity_;
403 }
404
419 void resize(size_type size, bool copyOldValues=true)
420 {
422 if(capacity_ < size)
423 this->reserve(size, copyOldValues);
424 this->n = size;
425 }
426
427
428
429
433 {
434 // allocate memory with same size as a
435 this->n = a.n;
436 capacity_ = a.capacity_;
437
438 if (capacity_>0) {
439 this->p = this->allocator_.allocate(capacity_);
440 new (this->p)B[capacity_];
441 } else
442 {
443 this->n = 0;
444 this->p = 0;
445 }
446
447 // and copy elements
448 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
449 }
450
453 {
454 // upcast, because protected data inaccessible
455 const BlockVector& a = static_cast<const BlockVector&>(_a);
456
457 // allocate memory with same size as a
458 this->n = a.n;
459 capacity_ = a.capacity_;
460
461 if (capacity_>0) {
462 this->p = this->allocator_.allocate(capacity_);
463 new (this->p)B[capacity_];
464 } else
465 {
466 this->n = 0;
467 this->p = 0;
468 capacity_ = 0;
469 }
470
471 // and copy elements
472 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
473 }
474
477 {
478 if (capacity_>0) {
479 int i=capacity_;
480 while (i)
481 this->p[--i].~B();
482 this->allocator_.deallocate(this->p,capacity_);
483 }
484 }
485
488 {
489 if (&a!=this) // check if this and a are different objects
490 {
491 // adjust size of vector
492 if (capacity_!=a.capacity_) // check if size is different
493 {
494 if (capacity_>0) {
495 int i=capacity_;
496 while (i)
497 this->p[--i].~B();
498 this->allocator_.deallocate(this->p,capacity_); // free old memory
499 }
500 capacity_ = a.capacity_;
501 if (capacity_>0) {
502 this->p = this->allocator_.allocate(capacity_);
503 new (this->p)B[capacity_];
504 } else
505 {
506 this->p = 0;
507 capacity_ = 0;
508 }
509 }
510 this->n = a.n;
511 // copy data
512 for (size_type i=0; i<this->n; i++)
513 this->p[i]=a.p[i];
514 }
515 return *this;
516 }
517
520 {
521 // forward to regular assignement operator
522 return this->operator=(static_cast<const BlockVector&>(a));
523 }
524
527 {
528 // forward to operator= in base class
529 (static_cast<block_vector_unmanaged<B,A>&>(*this)) = k;
530 return *this;
531 }
532 protected:
533 size_type capacity_;
534
535 A allocator_;
536
537 };
538
544 template<class B, class A>
545 struct FieldTraits< BlockVector<B, A> >
546 {
547 typedef typename FieldTraits<B>::field_type field_type;
548 typedef typename FieldTraits<B>::real_type real_type;
549 };
555 template<class K, class A>
556 std::ostream& operator<< (std::ostream& s, const BlockVector<K, A>& v)
557 {
558 typedef typename BlockVector<K, A>::size_type size_type;
559
560 for (size_type i=0; i<v.size(); i++)
561 s << v[i] << std::endl;
562
563 return s;
564 }
565
582 template<class B, class A=std::allocator<B> >
584 {
585 public:
586
587 //===== type definitions and constants
588
590 typedef typename B::field_type field_type;
591
593 typedef B block_type;
594
596 typedef A allocator_type;
597
599 typedef typename A::size_type size_type;
600
602 enum {
604 blocklevel = B::blocklevel+1
605 };
606
609
612
613
614 //===== constructors and such
617 { }
618
621 {
622 this->n = _n;
623 this->p = _p;
624 }
625
628 {
629 this->n = a.n;
630 this->p = a.p;
631 }
632
635 {
636 // cast needed to access protected data
637 const BlockVectorWindow& a = static_cast<const BlockVectorWindow&>(_a);
638
639 // make me point to the other's data
640 this->n = a.n;
641 this->p = a.p;
642 }
643
644
647 {
648 // check correct size
649#ifdef DUNE_ISTL_WITH_CHECKING
650 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch");
651#endif
652
653 if (&a!=this) // check if this and a are different objects
654 {
655 // copy data
656 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
657 }
658 return *this;
659 }
660
663 {
664 // forward to regular assignment operator
665 return this->operator=(static_cast<const BlockVectorWindow&>(a));
666 }
667
670 {
671 (static_cast<block_vector_unmanaged<B,A>&>(*this)) = k;
672 return *this;
673 }
674
675
676 //===== window manipulation methods
677
679 void set (size_type _n, B* _p)
680 {
681 this->n = _n;
682 this->p = _p;
683 }
684
687 {
688 this->n = _n;
689 }
690
692 void setptr (B* _p)
693 {
694 this->p = _p;
695 }
696
698 B* getptr ()
699 {
700 return this->p;
701 }
702
705 {
706 return this->n;
707 }
708 };
709
710
711
720 template<class B, class A=std::allocator<B> >
722 {
723 public:
724
725 //===== type definitions and constants
726
728 typedef typename B::field_type field_type;
729
731 typedef B block_type;
732
734 typedef A allocator_type;
735
738
741
743 typedef typename A::size_type size_type;
744
745 //===== assignment from scalar
746
748 {
749 for (size_type i=0; i<this->n; i++)
750 (this->p)[i] = k;
751 return *this;
752 }
753
754
755 //===== vector space arithmetic
756
758 template<class V>
760 {
761#ifdef DUNE_ISTL_WITH_CHECKING
762 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
763#endif
764 for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) += y.p[i];
765 return *this;
766 }
767
769 template<class V>
771 {
772#ifdef DUNE_ISTL_WITH_CHECKING
773 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
774#endif
775 for (size_type i=0; i<y.n; ++i) this->operator[](y.j[i]) -= y.p[i];
776 return *this;
777 }
778
780 template<class V>
782 {
783#ifdef DUNE_ISTL_WITH_CHECKING
784 if (!includesindexset(y)) DUNE_THROW(ISTLError,"index set mismatch");
785#endif
786 for (size_type i=0; i<y.n; ++i) (this->operator[](y.j[i])).axpy(a,y.p[i]);
787 return *this;
788 }
789
792 {
793 for (size_type i=0; i<this->n; ++i) (this->p)[i] *= k;
794 return *this;
795 }
796
799 {
800 for (size_type i=0; i<this->n; ++i) (this->p)[i] /= k;
801 return *this;
802 }
803
804
805 //===== Euclidean scalar product
806
809 {
810#ifdef DUNE_ISTL_WITH_CHECKING
811 if (!includesindexset(y) || !y.includesindexset(*this) )
812 DUNE_THROW(ISTLError,"index set mismatch");
813#endif
814 field_type sum=0;
815 for (size_type i=0; i<this->n; ++i)
816 sum += (this->p)[i] * y[(this->j)[i]];
817 return sum;
818 }
819
820
821 //===== norms
822
824 typename FieldTraits<field_type>::real_type one_norm () const
825 {
826 typename FieldTraits<field_type>::real_type sum=0;
827 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].one_norm();
828 return sum;
829 }
830
832 typename FieldTraits<field_type>::real_type one_norm_real () const
833 {
834 typename FieldTraits<field_type>::real_type sum=0;
835 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].one_norm_real();
836 return sum;
837 }
838
840 typename FieldTraits<field_type>::real_type two_norm () const
841 {
842 typename FieldTraits<field_type>::real_type sum=0;
843 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].two_norm2();
844 return sqrt(sum);
845 }
846
848 typename FieldTraits<field_type>::real_type two_norm2 () const
849 {
850 typename FieldTraits<field_type>::real_type sum=0;
851 for (size_type i=0; i<this->n; ++i) sum += (this->p)[i].two_norm2();
852 return sum;
853 }
854
856 typename FieldTraits<field_type>::real_type infinity_norm () const
857 {
858 typename FieldTraits<field_type>::real_type max=0;
859 for (size_type i=0; i<this->n; ++i) max = std::max(max,(this->p)[i].infinity_norm());
860 return max;
861 }
862
864 typename FieldTraits<field_type>::real_type infinity_norm_real () const
865 {
866 typename FieldTraits<field_type>::real_type max=0;
867 for (size_type i=0; i<this->n; ++i) max = std::max(max,(this->p)[i].infinity_norm_real());
868 return max;
869 }
870
871
872 //===== sizes
873
875 size_type N () const
876 {
877 return this->n;
878 }
879
881 size_type dim () const
882 {
883 size_type d=0;
884 for (size_type i=0; i<this->n; i++)
885 d += (this->p)[i].dim();
886 return d;
887 }
888
889 protected:
892 { }
893
895 template<class V>
896 bool includesindexset (const V& y)
897 {
898 typename V::ConstIterator e=this->end();
899 for (size_type i=0; i<y.n; i++)
900 if (this->find(y.j[i])==e)
901 return false;
902 return true;
903 }
904 };
905
906
923 template<class B, class A=std::allocator<B> >
925 {
926 public:
927
928 //===== type definitions and constants
929
931 typedef typename B::field_type field_type;
932
934 typedef B block_type;
935
937 typedef A allocator_type;
938
940 typedef typename A::size_type size_type;
941
943 enum {
945 blocklevel = B::blocklevel+1
946 };
947
950
953
954
955 //===== constructors and such
958 { }
959
962 {
963 this->n = _n;
964 this->p = _p;
965 this->j = _j;
966 }
967
970 {
971 this->n = a.n;
972 this->p = a.p;
973 this->j = a.j;
974 }
975
978 {
979 // cast needed to access protected data (upcast)
980 const CompressedBlockVectorWindow& a = static_cast<const CompressedBlockVectorWindow&>(_a);
981
982 // make me point to the other's data
983 this->n = a.n;
984 this->p = a.p;
985 this->j = a.j;
986 }
987
988
991 {
992 // check correct size
993#ifdef DUNE_ISTL_WITH_CHECKING
994 if (this->n!=a.N()) DUNE_THROW(ISTLError,"vector size mismatch");
995#endif
996
997 if (&a!=this) // check if this and a are different objects
998 {
999 // copy data
1000 for (size_type i=0; i<this->n; i++) this->p[i]=a.p[i];
1001 for (size_type i=0; i<this->n; i++) this->j[i]=a.j[i];
1002 }
1003 return *this;
1004 }
1005
1008 {
1009 // forward to regular assignment operator
1010 return this->operator=(static_cast<const CompressedBlockVectorWindow&>(a));
1011 }
1012
1015 {
1016 (static_cast<compressed_block_vector_unmanaged<B,A>&>(*this)) = k;
1017 return *this;
1018 }
1019
1020
1021 //===== window manipulation methods
1022
1024 void set (size_type _n, B* _p, size_type* _j)
1025 {
1026 this->n = _n;
1027 this->p = _p;
1028 this->j = _j;
1029 }
1030
1033 {
1034 this->n = _n;
1035 }
1036
1038 void setptr (B* _p)
1039 {
1040 this->p = _p;
1041 }
1042
1045 {
1046 this->j = _j;
1047 }
1048
1051 {
1052 return this->p;
1053 }
1054
1057 {
1058 return this->j;
1059 }
1060
1062 const B* getptr () const
1063 {
1064 return this->p;
1065 }
1066
1068 const size_type* getindexptr () const
1069 {
1070 return this->j;
1071 }
1074 {
1075 return this->n;
1076 }
1077 };
1078
1079} // end namespace
1080
1081#endif
Implements several basic array containers.
Definition: bvector.hh:584
B * getptr()
get pointer
Definition: bvector.hh:698
A allocator_type
export the allocator type
Definition: bvector.hh:596
BlockVectorWindow & operator=(const BlockVectorWindow &a)
assignment
Definition: bvector.hh:646
BlockVectorWindow(const BlockVectorWindow &a)
copy constructor, this has reference semantics!
Definition: bvector.hh:627
@ blocklevel
The number of blocklevels we contain.
Definition: bvector.hh:604
void set(size_type _n, B *_p)
set size and pointer
Definition: bvector.hh:679
block_vector_unmanaged< B, A >::Iterator Iterator
make iterators available as types
Definition: bvector.hh:608
size_type getsize()
get size
Definition: bvector.hh:704
B::field_type field_type
export the type representing the field
Definition: bvector.hh:590
void setsize(size_type _n)
set size only
Definition: bvector.hh:686
BlockVectorWindow(B *_p, size_type _n)
make array from given pointer and size
Definition: bvector.hh:620
B block_type
export the type representing the components
Definition: bvector.hh:593
BlockVectorWindow()
makes empty array
Definition: bvector.hh:616
A::size_type size_type
The type for the index access.
Definition: bvector.hh:599
BlockVectorWindow(const block_vector_unmanaged< B, A > &_a)
construct from base class object with reference semantics!
Definition: bvector.hh:634
void setptr(B *_p)
set pointer only
Definition: bvector.hh:692
block_vector_unmanaged< B, A >::ConstIterator ConstIterator
make iterators available as types
Definition: bvector.hh:611
A vector of blocks with memory management.
Definition: bvector.hh:253
BlockVector()
makes empty vector
Definition: bvector.hh:285
block_vector_unmanaged< B, A >::ConstIterator ConstIterator
make iterators available as types
Definition: bvector.hh:280
@ blocklevel
The number of blocklevel we contain.
Definition: bvector.hh:273
void resize(size_type size, bool copyOldValues=true)
Resize the vector.
Definition: bvector.hh:419
BlockVector & operator=(const BlockVector &a)
assignment
Definition: bvector.hh:487
BlockVector(const block_vector_unmanaged< B, A > &_a)
construct from base class object
Definition: bvector.hh:452
BlockVector(size_type _n)
make vector with _n components
Definition: bvector.hh:290
void reserve(size_type capacity, bool copyOldValues=true)
Reserve space.
Definition: bvector.hh:357
A allocator_type
export the allocator type
Definition: bvector.hh:265
BlockVector(const BlockVector &a)
copy constructor
Definition: bvector.hh:431
block_vector_unmanaged< B, A >::Iterator Iterator
make iterators available as types
Definition: bvector.hh:277
A::size_type size_type
The type for the index access.
Definition: bvector.hh:268
~BlockVector()
free dynamic memory
Definition: bvector.hh:476
size_type capacity() const
Get the capacity of the vector.
Definition: bvector.hh:400
B::field_type field_type
export the type representing the field
Definition: bvector.hh:259
BlockVector(size_type _n, S _capacity)
Make vector with _n components but preallocating capacity components.
Definition: bvector.hh:318
B block_type
export the type representing the components
Definition: bvector.hh:262
Definition: bvector.hh:925
compressed_block_vector_unmanaged< B, A >::ConstIterator ConstIterator
make iterators available as types
Definition: bvector.hh:952
const B * getptr() const
get pointer
Definition: bvector.hh:1062
CompressedBlockVectorWindow(const CompressedBlockVectorWindow &a)
copy constructor, this has reference semantics!
Definition: bvector.hh:969
void set(size_type _n, B *_p, size_type *_j)
set size and pointer
Definition: bvector.hh:1024
size_type * getindexptr()
get pointer
Definition: bvector.hh:1056
void setsize(size_type _n)
set size only
Definition: bvector.hh:1032
const size_type * getindexptr() const
get pointer
Definition: bvector.hh:1068
compressed_block_vector_unmanaged< B, A >::Iterator Iterator
make iterators available as types
Definition: bvector.hh:949
CompressedBlockVectorWindow(B *_p, size_type *_j, size_type _n)
make array from given pointers and size
Definition: bvector.hh:961
A::size_type size_type
The type for the index access.
Definition: bvector.hh:940
B::field_type field_type
export the type representing the field
Definition: bvector.hh:931
@ blocklevel
The number of block level this vector contains.
Definition: bvector.hh:945
A allocator_type
export the allocator type
Definition: bvector.hh:937
B block_type
export the type representing the components
Definition: bvector.hh:934
CompressedBlockVectorWindow & operator=(const CompressedBlockVectorWindow &a)
assignment
Definition: bvector.hh:990
void setptr(B *_p)
set pointer only
Definition: bvector.hh:1038
B * getptr()
get pointer
Definition: bvector.hh:1050
CompressedBlockVectorWindow()
makes empty array
Definition: bvector.hh:957
size_type getsize() const
get size
Definition: bvector.hh:1073
void setindexptr(size_type *_j)
set pointer only
Definition: bvector.hh:1044
CompressedBlockVectorWindow(const compressed_block_vector_unmanaged< B, A > &_a)
construct from base class object with reference semantics!
Definition: bvector.hh:977
derive error class from the base class in common
Definition: istlexception.hh:16
Iterator implementation class
Definition: basearray.hh:80
A simple array container for objects of type B.
Definition: basearray.hh:41
size_type size() const
number of blocks in the array (are of size 1 here)
Definition: basearray.hh:236
An unmanaged vector of blocks.
Definition: bvector.hh:42
block_vector_unmanaged & operator*=(const field_type &k)
vector space multiplication with scalar
Definition: bvector.hh:100
FieldTraits< field_type >::real_type two_norm() const
two norm sqrt(sum over squared values of entries)
Definition: bvector.hh:183
A::size_type size_type
The size type for the index access.
Definition: bvector.hh:57
block_vector_unmanaged()
make constructor protected, so only derived classes can be instantiated
Definition: bvector.hh:233
FieldTraits< field_type >::real_type two_norm2() const
Square of the two-norm (the sum over the squared values of the entries)
Definition: bvector.hh:191
base_array_unmanaged< B, A >::iterator Iterator
make iterators available as types
Definition: bvector.hh:60
FieldTraits< field_type >::real_type one_norm_real() const
simplified one norm (uses Manhattan norm for complex values)
Definition: bvector.hh:175
block_vector_unmanaged & operator-=(const block_vector_unmanaged &y)
vector space subtraction
Definition: bvector.hh:90
B::field_type field_type
export the type representing the field
Definition: bvector.hh:48
base_array_unmanaged< B, A >::const_iterator ConstIterator
make iterators available as types
Definition: bvector.hh:63
block_vector_unmanaged & axpy(const field_type &a, const block_vector_unmanaged &y)
vector space axpy operation
Definition: bvector.hh:114
block_vector_unmanaged & operator+=(const block_vector_unmanaged &y)
vector space addition
Definition: bvector.hh:80
size_type N() const
number of blocks in the vector (are of size 1 here)
Definition: bvector.hh:217
size_type dim() const
dimension of the vector space
Definition: bvector.hh:223
B value_type
for STL compatibility
Definition: bvector.hh:66
block_vector_unmanaged & operator/=(const field_type &k)
vector space division by scalar
Definition: bvector.hh:107
PromotionTraits< field_type, typenameOtherB::field_type >::PromotedType dot(const block_vector_unmanaged< OtherB, OtherA > &y) const
vector dot product which corresponds to Petsc's VecDot
Definition: bvector.hh:153
FieldTraits< field_type >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition: bvector.hh:207
block_vector_unmanaged & operator=(const field_type &k)
Assignment from a scalar.
Definition: bvector.hh:71
PromotionTraits< field_type, typenameOtherB::field_type >::PromotedType operator*(const block_vector_unmanaged< OtherB, OtherA > &y) const
indefinite vector dot product which corresponds to Petsc's VecTDot
Definition: bvector.hh:132
FieldTraits< field_type >::real_type infinity_norm() const
infinity norm (maximum of absolute values of entries)
Definition: bvector.hh:199
B block_type
export the type representing the components
Definition: bvector.hh:51
FieldTraits< field_type >::real_type one_norm() const
one norm (sum over absolute values of entries)
Definition: bvector.hh:167
A allocator_type
export the allocator type
Definition: bvector.hh:54
A simple array container with non-consecutive index set.
Definition: basearray.hh:544
iterator find(size_type i)
random access returning iterator (end if not contained)
Definition: basearray.hh:703
iterator end()
end iterator
Definition: basearray.hh:683
Definition: bvector.hh:722
compressed_block_vector_unmanaged & operator*=(const field_type &k)
vector space multiplication with scalar
Definition: bvector.hh:791
FieldTraits< field_type >::real_type two_norm2() const
Square of the two-norm (the sum over the squared values of the entries)
Definition: bvector.hh:848
compressed_block_vector_unmanaged & operator-=(const V &y)
vector space subtraction
Definition: bvector.hh:770
A::size_type size_type
The type for the index access.
Definition: bvector.hh:743
size_type N() const
number of blocks in the vector (are of size 1 here)
Definition: bvector.hh:875
FieldTraits< field_type >::real_type one_norm_real() const
simplified one norm (uses Manhattan norm for complex values)
Definition: bvector.hh:832
field_type operator*(const compressed_block_vector_unmanaged &y) const
scalar product
Definition: bvector.hh:808
B block_type
export the type representing the components
Definition: bvector.hh:731
bool includesindexset(const V &y)
return true if index sets coincide
Definition: bvector.hh:896
A allocator_type
export the allocator type
Definition: bvector.hh:734
compressed_block_vector_unmanaged & operator/=(const field_type &k)
vector space division by scalar
Definition: bvector.hh:798
FieldTraits< field_type >::real_type one_norm() const
one norm (sum over absolute values of entries)
Definition: bvector.hh:824
B::field_type field_type
export the type representing the field
Definition: bvector.hh:728
size_type dim() const
dimension of the vector space
Definition: bvector.hh:881
compressed_block_vector_unmanaged()
make constructor protected, so only derived classes can be instantiated
Definition: bvector.hh:891
compressed_block_vector_unmanaged & axpy(const field_type &a, const V &y)
vector space axpy operation
Definition: bvector.hh:781
FieldTraits< field_type >::real_type infinity_norm() const
infinity norm (maximum of absolute values of entries)
Definition: bvector.hh:856
compressed_base_array_unmanaged< B, A >::const_iterator ConstIterator
make iterators available as types
Definition: bvector.hh:740
compressed_block_vector_unmanaged & operator+=(const V &y)
vector space addition
Definition: bvector.hh:759
compressed_base_array_unmanaged< B, A >::iterator Iterator
make iterators available as types
Definition: bvector.hh:737
FieldTraits< field_type >::real_type infinity_norm_real() const
simplified infinity norm (uses Manhattan norm for complex values)
Definition: bvector.hh:864
FieldTraits< field_type >::real_type two_norm() const
two norm sqrt(sum over squared values of entries)
Definition: bvector.hh:840
Provides the functions dot(a,b) := and dotT(a,b) := .
Type traits to determine the type of reals (when working with complex numbers)
std::ostream & operator<<(std::ostream &s, const array< T, N > &e)
Output operator for array.
Definition: array.hh:26
#define DUNE_THROW(E, m)
Definition: exceptions.hh:243
Dune namespace.
Definition: alignment.hh:10
Provides some promotion traits.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)