mesh_conv::MC_int_vector Class Reference

A container class for a vector of int. More...

Collaboration diagram for mesh_conv::MC_int_vector:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MC_int_vector ()
 standard constructor
 MC_int_vector (const int &u0)
 direct constructor with one value
 MC_int_vector (const int &u0, const int &u1)
 direct constructor with multiple values
 MC_int_vector (const int &u0, const int &u1, const int &u2)
 direct constructor with multiple values
 MC_int_vector (const int &u0, const int &u1, const int &u2, const int &u3)
 direct constructor with multiple values
 MC_int_vector (const int &u0, const int &u1, const int &u2, const int &u3, const int &u4)
 direct constructor with multiple values
 MC_int_vector (const int &u0, const int &u1, const int &u2, const int &u3, const int &u4, const int &u5)
 direct constructor with multiple values
 MC_int_vector (const std::string &in, const std::string &separator=" ")
 direct constructor from string
 MC_int_vector (const std::set< int > &vec)
 constructor from a set
 MC_int_vector (const std::map< int, int > &vec)
 constructor from an indexed map
 MC_int_vector (const std::list< int > &vec)
 constructor from a list
 MC_int_vector (const std::vector< int > &vec)
 constructor from a vector
 MC_int_vector (const MC_int_vector &vec)
 copy constructor
void assert_bounds (const int &u) const
 Assert the value stays within the bounds.
std::vector< int > & get_vector ()
 get the internal vector
const std::vector< int > & to_vector () const
 convert to vector (get internal vector)
std::set< int > to_set () const
 convert to std::set
std::map< int, int > to_map () const
 convert to std::map
std::list< int > to_list () const
 convert to std::list
void clear ()
 clear the vector to size 0
MC_int_vectorresize (const int &new_size)
 resize the vector in deleting value of adding zeros
MC_int_vectoradd (const int &val)
 add a value at the end of the vector
MC_int_vectoradd (const MC_int_vector &val)
 add some values at the end of the vector
MC_int_vectorset (const int &k_index, const int &new_value)
 set an indexed value to a certain component. Adjust the size automatically
MC_int_vectorset (const MC_int_vector &k_index, const MC_int_vector &new_value)
 set an indexed value to a certain component. Adjust the size automatically
std::pair< MC_int_vector, int > delete_index (const int &index_to_delete) const
 delete the k_th value
std::pair< MC_int_vector,
MC_int_vector
delete_index (const MC_int_vector &index_to_delete) const
 delete the k_th value
std::pair< MC_int_vector,
MC_int_vector
sort () const
 ordonate the vector in increasing order
MC_int_vector mapping (const std::map< int, int > map_to_apply) const
 apply a mapping to the values
int size () const
 inverse a mapping <index_0->index_1> from a map (the mapping must be a bijection)
int find (const int &to_find) const
 try to find an existing value in the vector
MC_int_vector operator- () const
 change the opposite sign of the current vector (unary negation)
MC_int_vectoroperator+= (const int &to_add)
 internal add a value
MC_int_vectoroperator-= (const int &to_sub)
 internal substraction
MC_int_vectoroperator*= (const int &to_mult)
 internal multiplication
MC_int_vectoroperator/= (const int &to_subdiv)
 internal divide
MC_int_vectoroperator+= (const MC_int_vector &to_add)
 internal add values
MC_int_vectoroperator-= (const MC_int_vector &to_sub)
 internal substraction
MC_int_vectoroperator*= (const MC_int_vector &to_mult)
 internal multiplication
MC_int_vectoroperator/= (const MC_int_vector &to_subdiv)
 internal divide
const int & operator() (const int &index) const
 get operator with bounds checks
int & operator() (const int &index)
 get operator with bounds checks
const int & operator[] (const int &index) const
 get operator with bounds asserts
int & operator[] (const int &index)
 get operator with bounds asserts
MC_int_vector operator() (const MC_int_vector &index) const
 get a set of value
MC_int_vector operator[] (const MC_int_vector &index) const
 get a set of value
const int & first () const
 return the first value
int & first ()
 return the first value
const int & last () const
 return the last value
int & last ()
 return the last value
MC_int_vectorerase_last ()
 internal delete the last value
const int * pointer () const
 get the pointer on the data

Static Public Member Functions

static MC_int_vector zeros (const int &new_size)
 build a vector of size new_size filled with zero
static MC_int_vector linspace (const int &begin, const int &end, const double &iteration=1)
 linspace vector

Private Attributes

std::vector< int > int_list
 the internal storage: vector of int

Friends

MC_int_vector operator<< (const MC_int_vector &vec, const int &value)
 add a value at the end of the vertex
MC_int_vector operator<< (const MC_int_vector &vec, const MC_int_vector &to_add)
 add some values at the end of the vertex
MC_int_vector operator+ (const MC_int_vector &vec, const int &to_add)
 add a int value to the vector
MC_int_vector operator- (const MC_int_vector &vec, const int &to_sub)
 substract a int value to the vector
MC_int_vector operator* (const MC_int_vector &vec, const int &to_mult)
 multiply a int value to the vector
MC_int_vector operator/ (const MC_int_vector &vec, const int &to_subdiv)
 divide a int value to the vector
MC_int_vector operator+ (const MC_int_vector &vec, const MC_int_vector &to_add)
 add a set of value to the vector
MC_int_vector operator- (const MC_int_vector &vec, const MC_int_vector &to_sub)
 substract a int value to the vector
MC_int_vector operator* (const MC_int_vector &vec, const MC_int_vector &to_mult)
 multiply a int value to the vector
MC_int_vector operator/ (const MC_int_vector &vec, const MC_int_vector &to_subdiv)
 divide a int value to the vector
MC_int_vector operator< (const MC_int_vector &vec, const int &val)
 pointwise boolean comparison
MC_int_vector operator<= (const MC_int_vector &vec, const int &val)
 pointwise boolean comparison
MC_int_vector operator> (const MC_int_vector &vec, const int &val)
 pointwise boolean comparison
MC_int_vector operator>= (const MC_int_vector &vec, const int &val)
 pointwise boolean comparison
MC_int_vector operator== (const MC_int_vector &vec, const int &val)
 pointwise boolean comparison
MC_int_vector operator< (const int &val, const MC_int_vector &vec)
 pointwise boolean comparison
MC_int_vector operator<= (const int &val, const MC_int_vector &vec)
 pointwise boolean comparison
MC_int_vector operator> (const int &val, const MC_int_vector &vec)
 pointwise boolean comparison
MC_int_vector operator>= (const int &val, const MC_int_vector &vec)
 pointwise boolean comparison
MC_int_vector operator== (const int &val, const MC_int_vector &vec)
 pointwise boolean comparison
std::ostream & operator<< (std::ostream &output, const mesh_conv::MC_int_vector &in)
 write to ostream the list (u0 u1 u2 ... )
mesh_conv::MC_int_vectoroperator>> (std::istream &input, mesh_conv::MC_int_vector &vec)
 load from istream a list

Detailed Description

A container class for a vector of int.

internal storage is std::vector <int>


Constructor & Destructor Documentation

mesh_conv::MC_int_vector::MC_int_vector (  ) 

standard constructor

mesh_conv::MC_int_vector::MC_int_vector ( const int &  u0  ) 

direct constructor with one value

References int_list.

mesh_conv::MC_int_vector::MC_int_vector ( const int &  u0,
const int &  u1 
)

direct constructor with multiple values

References int_list.

mesh_conv::MC_int_vector::MC_int_vector ( const int &  u0,
const int &  u1,
const int &  u2 
)

direct constructor with multiple values

References int_list.

mesh_conv::MC_int_vector::MC_int_vector ( const int &  u0,
const int &  u1,
const int &  u2,
const int &  u3 
)

direct constructor with multiple values

References int_list.

mesh_conv::MC_int_vector::MC_int_vector ( const int &  u0,
const int &  u1,
const int &  u2,
const int &  u3,
const int &  u4 
)

direct constructor with multiple values

References int_list.

mesh_conv::MC_int_vector::MC_int_vector ( const int &  u0,
const int &  u1,
const int &  u2,
const int &  u3,
const int &  u4,
const int &  u5 
)

direct constructor with multiple values

References int_list.

mesh_conv::MC_int_vector::MC_int_vector ( const std::string &  in,
const std::string &  separator = " " 
)

direct constructor from string

Can handle any string with given separator "5,4,6,7,4..." means <5,4,6,7,4,...>

References add(), and mesh_conv::MC_string_tokenizer::tokenize().

Here is the call graph for this function:

mesh_conv::MC_int_vector::MC_int_vector ( const std::set< int > &  vec  ) 

constructor from a set

References int_list.

mesh_conv::MC_int_vector::MC_int_vector ( const std::map< int, int > &  vec  ) 

constructor from an indexed map

suppose that the second value is the index of the values

mesh_conv::MC_int_vector::MC_int_vector ( const std::list< int > &  vec  ) 

constructor from a list

References add().

Here is the call graph for this function:

mesh_conv::MC_int_vector::MC_int_vector ( const std::vector< int > &  vec  ) 

constructor from a vector

References int_list.

mesh_conv::MC_int_vector::MC_int_vector ( const MC_int_vector vec  ) 

copy constructor

References int_list, and to_vector().

Here is the call graph for this function:


Member Function Documentation

MC_int_vector & mesh_conv::MC_int_vector::add ( const MC_int_vector val  ) 

add some values at the end of the vector

Returns:
the new current vector

References int_list, and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::add ( const int &  val  ) 

add a value at the end of the vector

Returns:
the current vector

References int_list.

Referenced by delete_index(), linspace(), MC_int_vector(), mesh_conv::operator>>(), and mesh_conv::MC_io_off::read_off().

void mesh_conv::MC_int_vector::assert_bounds ( const int &  u  )  const

Assert the value stays within the bounds.

Returns:
nothing, but stop the programm if it goes outside bounds

References int_list.

Referenced by operator()(), and operator[]().

void mesh_conv::MC_int_vector::clear (  ) 

clear the vector to size 0

References int_list.

std::pair< MC_int_vector, MC_int_vector > mesh_conv::MC_int_vector::delete_index ( const MC_int_vector index_to_delete  )  const

delete the k_th value

Warning:
, this is internaly slow

return <the new vector,the deleted value>

References add(), int_list, size(), and to_set().

Here is the call graph for this function:

std::pair< MC_int_vector, int > mesh_conv::MC_int_vector::delete_index ( const int &  index_to_delete  )  const

delete the k_th value

Warning:
, this is internaly slow

return <the new vector, the deleted value>

References add(), int_list, and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::erase_last (  ) 

internal delete the last value

References resize(), and size().

Here is the call graph for this function:

int mesh_conv::MC_int_vector::find ( const int &  to_find  )  const

try to find an existing value in the vector

Returns:
the index of the value if found, -1 if not

References int_list, and size().

Here is the call graph for this function:

int & mesh_conv::MC_int_vector::first (  ) 

return the first value

References int_list, and size().

Here is the call graph for this function:

const int & mesh_conv::MC_int_vector::first (  )  const

return the first value

References int_list, and size().

Referenced by mesh_conv::operator*(), operator*=(), mesh_conv::operator+(), operator+=(), mesh_conv::operator-(), operator-=(), mesh_conv::operator/(), and operator/=().

Here is the call graph for this function:

std::vector< int > & mesh_conv::MC_int_vector::get_vector (  ) 

get the internal vector

Returns:
the std::vector of the internal parameters

References int_list.

int & mesh_conv::MC_int_vector::last (  ) 

return the last value

References int_list, and size().

Here is the call graph for this function:

const int & mesh_conv::MC_int_vector::last (  )  const

return the last value

References int_list, and size().

Here is the call graph for this function:

MC_int_vector mesh_conv::MC_int_vector::linspace ( const int &  begin,
const int &  end,
const double &  iteration = 1 
) [static]

linspace vector

ex. linspace(4,8)=[4,5,6,7,8] ex. linspace(7,-2,-2)=[7,5,3,1,-1]

References add().

Referenced by mesh_conv::MC_matrix::operator()(), mesh_conv::MC_matrix::repmat(), mesh_conv::MC_matrix::rotation_parameter(), and mesh_conv::MC_matrix::set_block().

Here is the call graph for this function:

MC_int_vector mesh_conv::MC_int_vector::mapping ( const std::map< int, int >  map_to_apply  )  const

apply a mapping to the values

References int_list, size(), and zeros().

Here is the call graph for this function:

MC_int_vector mesh_conv::MC_int_vector::operator() ( const MC_int_vector index  )  const

get a set of value

References int_list, size(), and zeros().

Here is the call graph for this function:

int & mesh_conv::MC_int_vector::operator() ( const int &  index  ) 

get operator with bounds checks

References assert_bounds(), and int_list.

Here is the call graph for this function:

const int & mesh_conv::MC_int_vector::operator() ( const int &  index  )  const

get operator with bounds checks

References assert_bounds(), and int_list.

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::operator*= ( const MC_int_vector to_mult  ) 

internal multiplication

to_add must be of size 1 or this->size()

References first(), int_list, and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::operator*= ( const int &  to_mult  ) 

internal multiplication

References int_list, and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::operator+= ( const MC_int_vector to_add  ) 

internal add values

to_add must be of size 1 or this->size()

References first(), int_list, and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::operator+= ( const int &  to_add  ) 

internal add a value

References int_list, and size().

Here is the call graph for this function:

MC_int_vector mesh_conv::MC_int_vector::operator- (  )  const

change the opposite sign of the current vector (unary negation)

Returns:
a new vector with opposite sign

References int_list, resize(), and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::operator-= ( const MC_int_vector to_sub  ) 

internal substraction

to_add must be of size 1 or this->size()

References first(), int_list, and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::operator-= ( const int &  to_sub  ) 

internal substraction

References int_list, and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::operator/= ( const MC_int_vector to_subdiv  ) 

internal divide

to_add must be of size 1 or this->size()

References first(), int_list, and size().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::operator/= ( const int &  to_subdiv  ) 

internal divide

References int_list, and size().

Here is the call graph for this function:

MC_int_vector mesh_conv::MC_int_vector::operator[] ( const MC_int_vector index  )  const

get a set of value

int & mesh_conv::MC_int_vector::operator[] ( const int &  index  ) 

get operator with bounds asserts

References assert_bounds(), and int_list.

Here is the call graph for this function:

const int & mesh_conv::MC_int_vector::operator[] ( const int &  index  )  const

get operator with bounds asserts

References assert_bounds(), and int_list.

Here is the call graph for this function:

const int * mesh_conv::MC_int_vector::pointer (  )  const

get the pointer on the data

References int_list.

MC_int_vector & mesh_conv::MC_int_vector::resize ( const int &  new_size  ) 

resize the vector in deleting value of adding zeros

Returns:
the new value

References int_list.

Referenced by erase_last(), operator-(), and zeros().

MC_int_vector & mesh_conv::MC_int_vector::set ( const MC_int_vector k_index,
const MC_int_vector new_value 
)

set an indexed value to a certain component. Adjust the size automatically

Returns:
the new vector

new_value and k_index must have the same size, or new_value must be of size 1 ex. set(MC_int_vector("4 5 6 8"),MC_int_vector("1 7 -5 -8")) or set(MC_int_vector("4 5 6 8"),MC_int_vector("-1"))

References size(), and zeros().

Here is the call graph for this function:

MC_int_vector & mesh_conv::MC_int_vector::set ( const int &  k_index,
const int &  new_value 
)

set an indexed value to a certain component. Adjust the size automatically

Returns:
the new vector

References int_list, and size().

Here is the call graph for this function:

int mesh_conv::MC_int_vector::size (  )  const
std::pair< MC_int_vector, MC_int_vector > mesh_conv::MC_int_vector::sort (  )  const

ordonate the vector in increasing order

Returns:
the ordonated value (MC_int_vector)
the corresponding mapping (MC_int_vector)

References int_list, and size().

Here is the call graph for this function:

std::list< int > mesh_conv::MC_int_vector::to_list (  )  const

convert to std::list

References int_list, and size().

Here is the call graph for this function:

std::map< int, int > mesh_conv::MC_int_vector::to_map (  )  const

convert to std::map

Returns:
the std::map corresponding to this vector (the int value return its index in the vector)

References size().

Here is the call graph for this function:

std::set< int > mesh_conv::MC_int_vector::to_set (  )  const

convert to std::set

Returns:
the std::set corresponding to this vector

References int_list.

Referenced by delete_index(), and mesh_conv::MC_double_vector::delete_index().

const std::vector< int > & mesh_conv::MC_int_vector::to_vector (  )  const

convert to vector (get internal vector)

Returns:
the std::vector corresponding to the MC_int_vector

return the const reference of the internal parameter.

References int_list.

Referenced by MC_int_vector().

MC_int_vector mesh_conv::MC_int_vector::zeros ( const int &  new_size  )  [static]

Friends And Related Function Documentation

MC_int_vector operator* ( const MC_int_vector vec,
const MC_int_vector to_mult 
) [friend]

multiply a int value to the vector

Returns:
the new vector

to_mult must be of size 1 or vec.size()

MC_int_vector operator* ( const MC_int_vector vec,
const int &  to_mult 
) [friend]

multiply a int value to the vector

Returns:
the new vector
MC_int_vector operator+ ( const MC_int_vector vec,
const MC_int_vector to_add 
) [friend]

add a set of value to the vector

Returns:
the new vector

to_add must be of size 1 or vec.size()

MC_int_vector operator+ ( const MC_int_vector vec,
const int &  to_add 
) [friend]

add a int value to the vector

Returns:
the new vector
MC_int_vector operator- ( const MC_int_vector vec,
const MC_int_vector to_sub 
) [friend]

substract a int value to the vector

Returns:
the new vector

to_sub must be of size 1 or vec.size()

MC_int_vector operator- ( const MC_int_vector vec,
const int &  to_sub 
) [friend]

substract a int value to the vector

Returns:
the new vector
MC_int_vector operator/ ( const MC_int_vector vec,
const MC_int_vector to_subdiv 
) [friend]

divide a int value to the vector

Returns:
the new vector

to_subdiv must be of size 1 or vec.size()

MC_int_vector operator/ ( const MC_int_vector vec,
const int &  to_subdiv 
) [friend]

divide a int value to the vector

Returns:
the new vector
MC_int_vector operator< ( const int &  val,
const MC_int_vector vec 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
MC_int_vector operator< ( const MC_int_vector vec,
const int &  val 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
std::ostream& operator<< ( std::ostream &  output,
const mesh_conv::MC_int_vector in 
) [friend]

write to ostream the list (u0 u1 u2 ... )

MC_int_vector operator<< ( const MC_int_vector vec,
const MC_int_vector to_add 
) [friend]

add some values at the end of the vertex

Returns:
the new vector (copy)
MC_int_vector operator<< ( const MC_int_vector vec,
const int &  value 
) [friend]

add a value at the end of the vertex

Returns:
the current vector (copy)
MC_int_vector operator<= ( const int &  val,
const MC_int_vector vec 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
MC_int_vector operator<= ( const MC_int_vector vec,
const int &  val 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
MC_int_vector operator== ( const int &  val,
const MC_int_vector vec 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
MC_int_vector operator== ( const MC_int_vector vec,
const int &  val 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
MC_int_vector operator> ( const int &  val,
const MC_int_vector vec 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
MC_int_vector operator> ( const MC_int_vector vec,
const int &  val 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
MC_int_vector operator>= ( const int &  val,
const MC_int_vector vec 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
MC_int_vector operator>= ( const MC_int_vector vec,
const int &  val 
) [friend]

pointwise boolean comparison

Returns:
a MC_int_vector with the same size as the entry (result is given by 0 or 1)
mesh_conv::MC_int_vector& operator>> ( std::istream &  input,
mesh_conv::MC_int_vector vec 
) [friend]

load from istream a list

stop at the first bad character encountered


Member Data Documentation

std::vector<int> mesh_conv::MC_int_vector::int_list [private]

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

Generated on Wed Nov 11 17:13:49 2009 by  doxygen 1.6.1