DUNE-FEM (unstable)

Dune::Fem::DynamicArray< T, Allocator > Class Template Reference

An implementation of DenseVector which uses a C-array of dynamic size as storage. More...

#include <dune/fem/storage/dynamicarray.hh>

Public Types

typedef Traits::derived_type derived_type
 type of derived vector class
 
typedef FieldTraits< value_type >::field_type field_type
 export the type representing the field
 
typedef Traits::value_type block_type
 export the type representing the components
 
typedef DenseIterator< DenseVector, value_type > Iterator
 Iterator class for sequential access.
 
typedef Iterator iterator
 typedef for stl compliant access
 
typedef DenseIterator< const DenseVector, const value_type > ConstIterator
 ConstIterator class for sequential access.
 
typedef ConstIterator const_iterator
 typedef for stl compliant access
 

Public Member Functions

 DynamicArray (const ThisType &other)
 copy constructor
 
 DynamicArray (size_type size, const value_type &value, AllocatorType allocator=AllocatorType())
 create array of length size with initialized values
 
 DynamicArray (size_type size=0, AllocatorType allocator=AllocatorType())
 create array of length size without initializing the values
 
void setMemoryFactor (double memFactor)
 set memory factor
 
 ~DynamicArray ()
 destructor
 
size_type capacity () const
 return number of total enties of array
 
void assign (const ThisType &org)
 assign arrays
 
ThisTypeoperator= (const ThisType &org)
 assign arrays
 
void resize (size_type nsize)
 
void resize (size_type nsize, const value_type &value)
 
void reserve (size_type mSize)
 
size_type usedMemorySize () const
 return size of vector in bytes
 
size_type size () const
 return size of array
 
value_type & operator[] (size_type i)
 random access operator
 
const value_type & operator[] (size_type i) const
 random access operator
 
void clear ()
 set all entries to 0
 
void memmove (size_type length, size_type oldStartIdx, size_type newStartIdx)
 move memory from old to new destination
 
bool operator== (const ThisType &other) const
 
bool operator== (const DenseVector< Other > &x) const
 Binary vector comparison.
 
value_type * data ()
 return pointer to data
 
const value_type * data () const
 return pointer to data
 
value_type & front ()
 return reference to first element
 
const value_type & front () const
 return reference to first element
 
value_type & back ()
 return reference to last element
 
const value_type & back () const
 return reference to last element
 
bool empty () const
 checks whether the container is empty
 
Iterator begin ()
 begin iterator
 
ConstIterator begin () const
 begin ConstIterator
 
Iterator end ()
 end iterator
 
ConstIterator end () const
 end ConstIterator
 
Iterator beforeEnd ()
 
ConstIterator beforeEnd () const
 
Iterator beforeBegin ()
 
ConstIterator beforeBegin () const
 
Iterator find (size_type i)
 return iterator to given element or end()
 
ConstIterator find (size_type i) const
 return iterator to given element or end()
 
derived_typeoperator+= (const DenseVector< Other > &x)
 vector space addition
 
std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator+= (const ValueType &kk)
 vector space add scalar to all comps More...
 
derived_typeoperator-= (const DenseVector< Other > &x)
 vector space subtraction
 
std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator-= (const ValueType &kk)
 vector space subtract scalar from all comps More...
 
derived_type operator+ (const DenseVector< Other > &b) const
 Binary vector addition.
 
derived_type operator- (const DenseVector< Other > &b) const
 Binary vector subtraction.
 
derived_type operator- () const
 Vector negation.
 
std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator*= (const FieldType &kk)
 vector space multiplication with scalar More...
 
std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator/= (const FieldType &kk)
 vector space division by scalar More...
 
bool operator!= (const DenseVector< Other > &x) const
 Binary vector incomparison.
 
derived_typeaxpy (const field_type &a, const DenseVector< Other > &x)
 vector space axpy operation ( *this += a x )
 
PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType operator* (const DenseVector< Other > &x) const
 indefinite vector dot product \(\left (x^T \cdot y \right)\) which corresponds to Petsc's VecTDot More...
 
PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType dot (const DenseVector< Other > &x) const
 vector dot product \(\left (x^H \cdot y \right)\) which corresponds to Petsc's VecDot More...
 
FieldTraits< value_type >::real_type one_norm () const
 one norm (sum over absolute values of entries)
 
FieldTraits< value_type >::real_type one_norm_real () const
 simplified one norm (uses Manhattan norm for complex values)
 
FieldTraits< value_type >::real_type two_norm () const
 two norm sqrt(sum over squared values of entries)
 
FieldTraits< value_type >::real_type two_norm2 () const
 square of two norm (sum over squared values of entries), need for block recursion
 
FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries)
 
FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries)
 
FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
 
FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
 
size_type N () const
 number of blocks in the vector (are of size 1 here)
 
size_type dim () const
 dimension of the vector space
 

Static Public Attributes

static constexpr int blocklevel
 The number of block levels we contain. This is the leaf, that is, 1.
 

Protected Member Functions

void adjustMemory (size_type mSize, bool initializeNewValues, const value_type &value=value_type())
 adjust the memory
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &s, const DenseVector< StaticArray< T > > &v)
 Write a DenseVector to an output stream. More...
 

Detailed Description

template<class T, class Allocator>
class Dune::Fem::DynamicArray< T, Allocator >

An implementation of DenseVector which uses a C-array of dynamic size as storage.

Template Parameters
Tis the field type (use float, double, complex, etc)
Allocatoris the allocator type

Member Function Documentation

◆ beforeBegin() [1/2]

Iterator Dune::DenseVector< StaticArray< T > >::beforeBegin ( )
inlineinherited
Returns
an iterator that is positioned before the first entry of the vector.

◆ beforeBegin() [2/2]

ConstIterator Dune::DenseVector< StaticArray< T > >::beforeBegin ( ) const
inlineinherited
Returns
an iterator that is positioned before the first entry of the vector.

◆ beforeEnd() [1/2]

Iterator Dune::DenseVector< StaticArray< T > >::beforeEnd ( )
inlineinherited
Returns
an iterator that is positioned before the end iterator of the vector, i.e. at the last entry.

◆ beforeEnd() [2/2]

ConstIterator Dune::DenseVector< StaticArray< T > >::beforeEnd ( ) const
inlineinherited
Returns
an iterator that is positioned before the end iterator of the vector. i.e. at the last element

◆ dot()

PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType Dune::DenseVector< StaticArray< T > >::dot ( const DenseVector< Other > &  x) const
inlineinherited

vector dot product \(\left (x^H \cdot y \right)\) which corresponds to Petsc's VecDot

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecDot.html

Parameters
xother vector
Returns

◆ operator*()

PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType Dune::DenseVector< StaticArray< T > >::operator* ( const DenseVector< Other > &  x) const
inlineinherited

indefinite vector dot product \(\left (x^T \cdot y \right)\) which corresponds to Petsc's VecTDot

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecTDot.html

Parameters
xother vector
Returns

◆ operator*=()

std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & Dune::DenseVector< StaticArray< T > >::operator*= ( const FieldType &  kk)
inlineinherited

vector space multiplication with scalar

we use enable_if to avoid an ambiguity, if the function parameter can be converted to field_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to field_type.

◆ operator+=()

std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & Dune::DenseVector< StaticArray< T > >::operator+= ( const ValueType &  kk)
inlineinherited

vector space add scalar to all comps

we use enable_if to avoid an ambiguity, if the function parameter can be converted to value_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to value_type.

◆ operator-=()

std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & Dune::DenseVector< StaticArray< T > >::operator-= ( const ValueType &  kk)
inlineinherited

vector space subtract scalar from all comps

we use enable_if to avoid an ambiguity, if the function parameter can be converted to value_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to value_type.

◆ operator/=()

std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & Dune::DenseVector< StaticArray< T > >::operator/= ( const FieldType &  kk)
inlineinherited

vector space division by scalar

we use enable_if to avoid an ambiguity, if the function parameter can be converted to field_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to field_type.

◆ operator==()

template<class T >
bool Dune::Fem::StaticArray< T >::operator== ( const ThisType other) const
inlineinherited

comparison operator: checks for object identity, i.e. if this and other are the same objects in memory rather than containing the same data

◆ reserve()

template<class T , class Allocator >
void Dune::Fem::DynamicArray< T, Allocator >::reserve ( size_type  mSize)
inline

reserve vector size with new mSizeif if mSize is smaller then actual memSize, then nothing is done

References Dune::Fem::DynamicArray< T, Allocator >::adjustMemory().

◆ resize() [1/2]

template<class T , class Allocator >
void Dune::Fem::DynamicArray< T, Allocator >::resize ( size_type  nsize)
inline

resize vector with new size nsize if nsize is smaller then actual memSize, size is just set to new value

Referenced by Dune::Fem::DynamicArray< T, Allocator >::assign(), and Dune::Fem::ThreadIterator< GridPart, ptype >::update().

◆ resize() [2/2]

template<class T , class Allocator >
void Dune::Fem::DynamicArray< T, Allocator >::resize ( size_type  nsize,
const value_type &  value 
)
inline

resize vector with new size nsize if nsize is smaller then actual memSize, size is just set to new value

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  s,
const DenseVector< StaticArray< T > > &  v 
)
related

Write a DenseVector to an output stream.

Parameters
[in]sstd :: ostream to write to
[in]vDenseVector to write
Returns
the output stream (s)

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)