SCOREC core
Parallel unstructured mesh tools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
mth::Vector< T, 0 > Class Template Reference

run-time (dynamic) vector More...

Inheritance diagram for mth::Vector< T, 0 >:
can::Array< T, 0 >

Public Member Functions

 Vector ()
 default constructor - no allocation
 
 Vector (unsigned n)
 construct with n elements
 
T & operator() (unsigned i)
 mutable index operator More...
 
T const & operator() (unsigned i) const
 immutable index operator
 
Vector< T, 0 > & operator+= (Vector< T, 0 > const &b)
 add a vector to this vector
 
Vector< T, 0 > & operator-= (Vector< T, 0 > const &b)
 subtract a vector from this vector
 
Vector< T, 0 > & operator*= (T const &s)
 multiply this vector by a scalar
 
Vector< T, 0 > & operator/= (T const &s)
 divide this vector by a scalar
 
getLength () const
 get the vector magnitude
 
void zero ()
 zero the vector
 
- Public Member Functions inherited from can::Array< T, 0 >
 Array ()
 default constructor - no allocation
 
 Array (unsigned n)
 construct with n elems
 
 Array (Array< T, 0 > const &other)
 copy constructor
 
 ~Array ()
 destructor - need to delete elems
 
Array< T, 0 > & operator= (Array< T, 0 > const &other)
 assignment operator
 
T & operator[] (unsigned i)
 mutable index operator
 
T const & operator[] (unsigned i) const
 immutable index operator
 
unsigned size () const
 get the size of this array
 
void resize (unsigned n)
 resize the array
 

Detailed Description

template<class T>
class mth::Vector< T, 0 >

run-time (dynamic) vector

A runtime-sized equivalent of mth::Vector<T,N>. All values are stored in a single dynamically allocated array. Due to the use of dynamic allocation, users should avoid copying class as much as possible. To help with this, we provide things like operator+= instead of operator+ to discourage users from creating temporary copies. The code for these methods is inlined in an effort to keep linear algebra running quickly

Definition at line 132 of file mthVector.h.

Member Function Documentation

template<class T >
T& mth::Vector< T, 0 >::operator() ( unsigned  i)
inline

mutable index operator

An index operator (i) is provided so that mth::Vector and mth::Matrix share a common index operator

Definition at line 142 of file mthVector.h.

142 {return (*this)[i];}

The documentation for this class was generated from the following file: