3#ifndef DUNE_ISTL_VBVECTOR_HH
4#define DUNE_ISTL_VBVECTOR_HH
11#include <dune/common/iteratorfacades.hh>
36 template<
class B,
class A=std::allocator<B> >
111 block = windowAllocator_.allocate(nblocks);
134 this->
n = _nblocks*m;
137 this->
p = allocator_.allocate(this->
n);
138 new (this->
p)B[this->
n];
151 block = windowAllocator_.allocate(nblocks);
156 block[i].set(m,this->
p+(i*m));
176 this->
p = allocator_.allocate(this->
n);
177 new (this->
p)B[this->
n];
180 for (size_type i=0; i<this->
n; i++) this->
p[i]=a.
p[i];
193 block = windowAllocator_.allocate(nblocks);
198 for (size_type i=1; i<nblocks; ++i)
218 allocator_.deallocate(this->
p,this->
n);
223 block[--i].~window_type();
224 windowAllocator_.deallocate(block,nblocks);
238 allocator_.deallocate(this->
p,this->
n);
243 block[--i].~window_type();
244 windowAllocator_.deallocate(block,nblocks);
253 block = windowAllocator_.allocate(nblocks);
274 allocator_.deallocate(this->
p,this->
n);
279 block[--i].~window_type();
280 windowAllocator_.deallocate(block,nblocks);
284 this->
n = _nblocks*m;
287 this->
p = allocator_.allocate(this->
n);
288 new (this->
p)B[this->
n];
301 block = windowAllocator_.allocate(nblocks);
306 block[i].set(m,this->
p+(i*m));
325 if (this->
n!=a.
n || nblocks!=a.nblocks)
332 allocator_.deallocate(this->
p,this->
n);
337 block[--i].~window_type();
338 windowAllocator_.deallocate(block,nblocks);
346 this->
p = allocator_.allocate(this->
n);
347 new (this->
p)B[this->
n];
360 block = windowAllocator_.allocate(nblocks);
375 for (size_type i=1; i<nblocks; ++i)
439 v.
p = v.allocator_.allocate(n);
457 v.initialized =
true;
468 return (i!=
it.i) || (&v!=&
it.v);
474 return (i==
it.i) && (&v==&
it.v);
502#ifdef DUNE_ISTL_WITH_CHECKING
522#ifdef DUNE_ISTL_WITH_CHECKING
531#ifdef DUNE_ISTL_WITH_CHECKING
538 template <
class T,
class R>
540 :
public RandomAccessIteratorFacade<RealIterator<T,R>, T, R>
570 return (p+i)==(
it.p+
it.i);
671 return Iterator(block,std::min(i,nblocks));
This file implements a vector space as a tensor product of a given vector space. The number of compon...
Definition basearray.hh:19
size_type n
Definition basearray.hh:254
B * p
Definition basearray.hh:255
Statistics about compression achieved in implicit mode.
Definition bcrsmatrix.hh:81
An unmanaged vector of blocks.
Definition bvector.hh:42
B * getptr()
get pointer
Definition bvector.hh:774
void set(size_type _n, B *_p)
set size and pointer
Definition bvector.hh:755
size_type getsize()
get size
Definition bvector.hh:780
void setsize(size_type _n)
set size only
Definition bvector.hh:762
void setptr(B *_p)
set pointer only
Definition bvector.hh:768
derive error class from the base class in common
Definition istlexception.hh:16
A Vector of blocks with different blocksizes.
Definition vbvector.hh:41
RealIterator< value_type, window_type & > Iterator
Definition vbvector.hh:606
VariableBlockVector()
Definition vbvector.hh:94
A allocator_type
export the allocator type
Definition vbvector.hh:53
VariableBlockVector(size_type _nblocks, size_type m)
Definition vbvector.hh:131
size_type size() const
Definition vbvector.hh:692
size_type N() const
number of blocks in the vector (are of variable size here)
Definition vbvector.hh:683
VariableBlockVector(const VariableBlockVector &a)
copy constructor, has copy semantics
Definition vbvector.hh:169
VariableBlockVector(size_type _nblocks)
Definition vbvector.hh:105
~VariableBlockVector()
free dynamic memory
Definition vbvector.hh:212
window_type & operator[](size_type i)
random access to blocks
Definition vbvector.hh:520
CreateIterator createend()
get create iterator pointing to one after the last block
Definition vbvector.hh:509
B::field_type field_type
export the type representing the field
Definition vbvector.hh:50
Iterator beforeBegin() const
Definition vbvector.hh:629
CreateIterator createbegin()
get initial create iterator
Definition vbvector.hh:500
VariableBlockVector & operator=(const VariableBlockVector &a)
assignment
Definition vbvector.hh:319
ConstIterator rend() const
end ConstIterator
Definition vbvector.hh:663
@ blocklevel
The number of blocklevels this vector contains.
Definition vbvector.hh:86
A::size_type size_type
The size type for the index access.
Definition vbvector.hh:68
ConstIterator find(size_type i) const
random access returning iterator (end if not contained)
Definition vbvector.hh:675
ConstIterator beforeEnd() const
Definition vbvector.hh:657
Iterator find(size_type i)
random access returning iterator (end if not contained)
Definition vbvector.hh:669
const window_type & const_reference
Export type used for const references to container entries.
Definition vbvector.hh:65
RealIterator< const value_type, const window_type & > ConstIterator
Const iterator.
Definition vbvector.hh:638
Iterator end()
end Iterator
Definition vbvector.hh:615
ConstIterator begin() const
begin ConstIterator
Definition vbvector.hh:644
BlockVector< B, A > value_type
Type of the elements of the outer vector, i.e., dynamic vectors of B.
Definition vbvector.hh:75
ConstIterator end() const
end ConstIterator
Definition vbvector.hh:650
BlockVector< B, A > block_type
Same as value_type, here for historical reasons.
Definition vbvector.hh:79
void resize(size_type _nblocks, size_type m)
same effect as constructor with same argument
Definition vbvector.hh:267
window_type & reference
Export type used for references to container entries.
Definition vbvector.hh:59
void resize(size_type _nblocks)
same effect as constructor with same argument
Definition vbvector.hh:231
Iterator beforeEnd()
Definition vbvector.hh:622
Iterator begin()
begin Iterator
Definition vbvector.hh:609
Iterator class for sequential creation of blocks.
Definition vbvector.hh:404
bool operator==(const CreateIterator &it) const
equality
Definition vbvector.hh:472
size_type index() const
dereferencing
Definition vbvector.hh:478
bool operator!=(const CreateIterator &it) const
inequality
Definition vbvector.hh:466
void setblocksize(size_type _k)
set size of current block
Definition vbvector.hh:484
CreateIterator(VariableBlockVector &_v, int _i)
constructor
Definition vbvector.hh:407
CreateIterator & operator++()
prefix increment
Definition vbvector.hh:415
Iterator class for sequential access.
Definition vbvector.hh:541
RealIterator(window_type *_p, size_type _i)
constructor
Definition vbvector.hh:551
bool equals(const RealIterator &it) const
equality
Definition vbvector.hh:568
size_type index() const
Return the index of the entry this iterator is pointing to.
Definition vbvector.hh:596
window_type & elementAt(std::ptrdiff_t offset) const
Definition vbvector.hh:590
void decrement()
prefix decrement
Definition vbvector.hh:562
void advance(std::ptrdiff_t d)
Definition vbvector.hh:579
void increment()
prefix increment
Definition vbvector.hh:556
RealIterator()
constructor, no arguments
Definition vbvector.hh:544
std::ptrdiff_t distanceTo(const RealIterator &o) const
Definition vbvector.hh:584
window_type & dereference() const
dereferencing
Definition vbvector.hh:574