3 #ifndef DUNE_VBVECTOR_HH
4 #define DUNE_VBVECTOR_HH
35 template<
class B,
class A=std::allocator<B> >
94 block = windowAllocator_.allocate(nblocks);
117 this->
n = _nblocks*m;
120 this->
p = allocator_.allocate(this->
n);
121 new (this->
p)B[this->
n];
134 block = windowAllocator_.allocate(nblocks);
139 block[i].set(m,this->
p+(i*m));
159 this->
p = allocator_.allocate(this->
n);
160 new (this->
p)B[this->
n];
176 block = windowAllocator_.allocate(nblocks);
201 allocator_.deallocate(this->
p,this->
n);
206 block[--i].~window_type();
207 windowAllocator_.deallocate(block,nblocks);
221 allocator_.deallocate(this->
p,this->
n);
226 block[--i].~window_type();
227 windowAllocator_.deallocate(block,nblocks);
236 block = windowAllocator_.allocate(nblocks);
257 allocator_.deallocate(this->
p,this->
n);
262 block[--i].~window_type();
263 windowAllocator_.deallocate(block,nblocks);
267 this->
n = _nblocks*m;
270 this->
p = allocator_.allocate(this->
n);
271 new (this->
p)B[this->
n];
284 block = windowAllocator_.allocate(nblocks);
289 block[i].set(m,this->
p+(i*m));
308 if (this->
n!=a.
n || nblocks!=a.nblocks)
315 allocator_.deallocate(this->
p,this->
n);
320 block[--i].~window_type();
321 windowAllocator_.deallocate(block,nblocks);
329 this->
p = allocator_.allocate(this->
n);
330 new (this->
p)B[this->
n];
343 block = windowAllocator_.allocate(nblocks);
422 v.
p = v.allocator_.allocate(n);
440 v.initialized =
true;
451 return (i!=it.i) || (&v!=&it.v);
457 return (i==it.i) && (&v==&it.v);
485 #ifdef DUNE_ISTL_WITH_CHECKING
486 if (initialized) DUNE_THROW(
ISTLError,
"no CreateIterator in initialized state");
505 #ifdef DUNE_ISTL_WITH_CHECKING
506 if (i>=nblocks) DUNE_THROW(
ISTLError,
"index out of range");
514 #ifdef DUNE_ISTL_WITH_CHECKING
515 if (i<0 || i>=nblocks) DUNE_THROW(
ISTLError,
"index out of range");
555 return (p+i)==(it.p+it.i);
561 return (p+i)!=(it.p+it.i);
567 return (p+i)==(it.p+it.i);
573 return (p+i)!=(it.p+it.i);
630 if (i>=0 && i<nblocks)
639 if (i>=0 && i<nblocks)
681 return (p+i)==(it.p+it.i);
687 return (p+i)!=(it.p+it.i);
693 return (p+i)==(it.p+it.i);
699 return (p+i)!=(it.p+it.i);
769 typename A::template rebind<window_type>::other windowAllocator_;
base_array_unmanaged< T, A >::iterator Iterator
make iterators available as types
Definition: bvector.hh:61
CreateIterator & operator++()
prefix increment
Definition: vbvector.hh:398
CreateIterator createend()
get create iterator pointing to one after the last block
Definition: vbvector.hh:492
A allocator_type
export the allocator type
Definition: vbvector.hh:49
ConstIterator & operator--()
prefix decrement
Definition: vbvector.hh:672
Iterator()
constructor, no arguments
Definition: vbvector.hh:528
window_type & operator*() const
dereferencing
Definition: vbvector.hh:577
bool operator!=(const ConstIterator &it) const
inequality
Definition: vbvector.hh:685
B * p
Definition: basearray.hh:251
window_type & operator[](size_type i)
random access to blocks
Definition: vbvector.hh:503
VariableBlockVector(size_type _nblocks, size_type m)
Definition: vbvector.hh:114
size_type N() const
number of blocks in the vector (are of variable size here)
Definition: vbvector.hh:756
bool operator==(const ConstIterator &it) const
equality
Definition: vbvector.hh:679
This file implements a vector space as a tensor product of a given vector space. The number of compon...
ConstIterator & operator++()
prefix increment
Definition: vbvector.hh:665
CreateIterator createbegin()
get initial create iterator
Definition: vbvector.hh:483
ConstIterator find(size_type i) const
random access returning iterator (end if not contained)
Definition: vbvector.hh:637
size_type index() const
Definition: vbvector.hh:715
A vector of blocks with memory management.
Definition: bvector.hh:253
A Vector of blocks with different blocksizes.
Definition: vbvector.hh:36
ConstIterator class for sequential access.
Definition: vbvector.hh:646
ConstIterator(const window_type *_p, size_type _i)
constructor from pointer
Definition: vbvector.hh:657
bool operator!=(const Iterator &it) const
inequality
Definition: vbvector.hh:559
VariableBlockVector(size_type _nblocks)
Definition: vbvector.hh:88
~VariableBlockVector()
free dynamic memory
Definition: vbvector.hh:195
size_type index() const
dereferencing
Definition: vbvector.hh:461
BlockVectorWindow< B, A > window_type
Definition: vbvector.hh:69
ConstIterator(const Iterator &it)
constructor from non_const iterator
Definition: vbvector.hh:661
ConstIterator beforeEnd() const
Definition: vbvector.hh:741
A::size_type size_type
The size type for the index access.
Definition: vbvector.hh:52
void setptr(B *_p)
set pointer only
Definition: bvector.hh:693
A::size_type size_type
the type for the index access
Definition: basearray.hh:53
ConstIterator begin() const
begin ConstIterator
Definition: vbvector.hh:728
base_array_unmanaged< B, A >::const_iterator ConstIterator
make iterators available as types
Definition: bvector.hh:64
window_type * operator->() const
arrow
Definition: vbvector.hh:583
Iterator class for sequential creation of blocks.
Definition: vbvector.hh:386
Iterator class for sequential access.
Definition: vbvector.hh:524
Matrix & A
Definition: matrixmatrix.hh:216
size_type n
Definition: basearray.hh:250
void resize(size_type _nblocks, size_type m)
same effect as constructor with same argument
Definition: vbvector.hh:250
void setblocksize(size_type _k)
set size of current block
Definition: vbvector.hh:467
void set(size_type _n, B *_p)
set size and pointer
Definition: bvector.hh:680
B * getptr()
get pointer
Definition: bvector.hh:699
bool operator==(const Iterator &it) const
equality
Definition: vbvector.hh:553
const window_type & operator*() const
dereferencing
Definition: vbvector.hh:703
Iterator find(size_type i)
random access returning iterator (end if not contained)
Definition: vbvector.hh:628
Iterator & operator--()
prefix decrement
Definition: vbvector.hh:546
Iterator beforeBegin() const
Definition: vbvector.hh:622
bool operator!=(const CreateIterator &it) const
inequality
Definition: vbvector.hh:449
VariableBlockVector()
Definition: vbvector.hh:77
BlockVector< B, A > block_type
Definition: vbvector.hh:58
VariableBlockVector & operator=(const VariableBlockVector &a)
assignment
Definition: vbvector.hh:302
Iterator end()
end Iterator
Definition: vbvector.hh:608
derive error class from the base class in common
Definition: istlexception.hh:16
Iterator & operator++()
prefix increment
Definition: vbvector.hh:539
ConstIterator rend() const
end ConstIterator
Definition: vbvector.hh:747
ConstIterator end() const
end ConstIterator
Definition: vbvector.hh:734
Iterator(window_type *_p, size_type _i)
constructor
Definition: vbvector.hh:535
size_type getsize()
get size
Definition: bvector.hh:705
Iterator beforeEnd()
Definition: vbvector.hh:615
The number of blocklevels this vector contains.
Definition: vbvector.hh:65
Iterator begin()
begin Iterator
Definition: vbvector.hh:602
Definition: bvector.hh:584
friend class CreateIterator
Definition: vbvector.hh:480
T::field_type field_type
export the type representing the field
Definition: bvector.hh:49
const window_type * operator->() const
arrow
Definition: vbvector.hh:709
void setsize(size_type _n)
set size only
Definition: bvector.hh:687
void resize(size_type _nblocks)
same effect as constructor with same argument
Definition: vbvector.hh:214
VariableBlockVector(const VariableBlockVector &a)
copy constructor, has copy semantics
Definition: vbvector.hh:152
ConstIterator()
constructor
Definition: vbvector.hh:650
An unmanaged vector of blocks.
Definition: bvector.hh:42
size_type index() const
Definition: vbvector.hh:589
B::field_type field_type
export the type representing the field
Definition: vbvector.hh:46
bool operator==(const CreateIterator &it) const
equality
Definition: vbvector.hh:455
CreateIterator(VariableBlockVector &_v, int _i)
constructor
Definition: vbvector.hh:390