svFSIplus
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Vector< T > Class Template Reference

The Vector template class is used for storing int and double data. More...

#include <Vector.h>

Classes

class  Iterator
 This class provides an interface to access Vector like STL containers. More...
 

Public Member Functions

 Vector (const int size)
 
 Vector (const int size, T *data)
 
 Vector (std::initializer_list< T > values)
 
 Vector (const Vector &rhs)
 
bool allocated () const
 
void clear ()
 Free the array data. More...
 
void print (const std::string &label)
 
void resize (const int size)
 Resize the vector's memory. More...
 
void grow (const int size, T value={})
 Grow the vector. More...
 
void set_values (std::initializer_list< T > values)
 
void set_values (std::vector< T > values)
 
void read (const std::string &file_name)
 
void write (const std::string &label, const T offset={}) const
 
Vectoroperator= (const Vector &rhs)
 Vector assigment. More...
 
Vectoroperator= (const double value)
 
int size () const
 
int msize () const
 
const T & operator() (const int i) const
 
T & operator() (const int i)
 
const T & operator[] (const int i) const
 
T & operator[] (const int i)
 
Vector< T > operator+ (const Vector< T > &vec) const
 Add and subtract vectors. More...
 
Vector< T > operator- (const Vector< T > &x) const
 
Vector< T > operator+ (const T value) const
 Add and subtract a scalar from a vector. More...
 
Vector< T > operator- (const T value) const
 
Vector< T > operator/ (const T value) const
 Divide by a scalar. More...
 
Vector< T > operator* (const T value) const
 Multiply by a scalar. More...
 
Vector< T > operator- () const
 Negate. More...
 
Vector< T > abs () const
 Absolute value. More...
 
Vector< T > cross (const Vector< T > &v2)
 Cross product. More...
 
dot (const Vector< T > &v2)
 Dot product. More...
 
min () const
 
max () const
 
sum () const
 
Iterator begin () const
 
Iterator end () const
 
T * data () const
 
void allocate (const int size)
 
void check_index (const int i) const
 
void check_type () const
 Check that the Vector template type is int or double. More...
 
bool show_index_check_message
 
double memory_in_use
 
double memory_returned
 
int num_allocated
 
int active
 
bool write_enabled
 
bool show_index_check_message
 
double memory_in_use
 
double memory_returned
 
int num_allocated
 
int active
 
bool write_enabled
 

Static Public Member Functions

static void memory (const std::string &prefix="")
 
static void stats (const std::string &prefix="")
 

Static Public Attributes

static int num_allocated
 
static int active
 
static double memory_in_use
 
static double memory_returned
 
static bool write_enabled
 
static bool show_index_check_message
 

Detailed Description

template<typename T>
class Vector< T >

The Vector template class is used for storing int and double data.

Member Function Documentation

◆ abs()

template<typename T >
Vector<T> Vector< T >::abs ( ) const
inline

Absolute value.

◆ check_type()

template<typename T >
void Vector< T >::check_type ( ) const
inline

Check that the Vector template type is int or double.

◆ clear()

template<typename T >
void Vector< T >::clear ( )
inline

Free the array data.

This is to replicate the Fortran DEALLOCATE().

◆ cross()

template<typename T >
Vector<T> Vector< T >::cross ( const Vector< T > &  v2)
inline

Cross product.

◆ dot()

template<typename T >
T Vector< T >::dot ( const Vector< T > &  v2)
inline

Dot product.

◆ grow()

template<typename T >
void Vector< T >::grow ( const int  size,
value = {} 
)
inline

Grow the vector.

◆ operator*()

template<typename T >
Vector<T> Vector< T >::operator* ( const T  value) const
inline

Multiply by a scalar.

◆ operator+() [1/2]

template<typename T >
Vector<T> Vector< T >::operator+ ( const T  value) const
inline

Add and subtract a scalar from a vector.

◆ operator+() [2/2]

template<typename T >
Vector<T> Vector< T >::operator+ ( const Vector< T > &  vec) const
inline

Add and subtract vectors.

◆ operator-()

template<typename T >
Vector<T> Vector< T >::operator- ( ) const
inline

Negate.

◆ operator/()

template<typename T >
Vector<T> Vector< T >::operator/ ( const T  value) const
inline

Divide by a scalar.

◆ operator=()

template<typename T >
Vector& Vector< T >::operator= ( const Vector< T > &  rhs)
inline

Vector assigment.

Note: There are two ways to do this:

1) Swap pointers to data_

2) Copy data_

Fortran using 2) I think.

◆ resize()

template<typename T >
void Vector< T >::resize ( const int  size)
inline

Resize the vector's memory.


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