A container class for a vector of int. More...
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_vector & | resize (const int &new_size) |
resize the vector in deleting value of adding zeros | |
MC_int_vector & | add (const int &val) |
add a value at the end of the vector | |
MC_int_vector & | add (const MC_int_vector &val) |
add some values at the end of the vector | |
MC_int_vector & | set (const int &k_index, const int &new_value) |
set an indexed value to a certain component. Adjust the size automatically | |
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 | |
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_vector & | operator+= (const int &to_add) |
internal add a value | |
MC_int_vector & | operator-= (const int &to_sub) |
internal substraction | |
MC_int_vector & | operator*= (const int &to_mult) |
internal multiplication | |
MC_int_vector & | operator/= (const int &to_subdiv) |
internal divide | |
MC_int_vector & | operator+= (const MC_int_vector &to_add) |
internal add values | |
MC_int_vector & | operator-= (const MC_int_vector &to_sub) |
internal substraction | |
MC_int_vector & | operator*= (const MC_int_vector &to_mult) |
internal multiplication | |
MC_int_vector & | operator/= (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_vector & | erase_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_vector & | operator>> (std::istream &input, mesh_conv::MC_int_vector &vec) |
load from istream a list |
A container class for a vector of int.
internal storage is std::vector <int>
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().
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 | ) |
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 | ) |
MC_int_vector & mesh_conv::MC_int_vector::add | ( | const MC_int_vector & | val | ) |
MC_int_vector & mesh_conv::MC_int_vector::add | ( | const int & | val | ) |
add a value at the end of the 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.
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 |
std::pair< MC_int_vector, int > mesh_conv::MC_int_vector::delete_index | ( | const int & | index_to_delete | ) | const |
MC_int_vector & mesh_conv::MC_int_vector::erase_last | ( | ) |
int mesh_conv::MC_int_vector::find | ( | const int & | to_find | ) | const |
int & mesh_conv::MC_int_vector::first | ( | ) |
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/=().
std::vector< int > & mesh_conv::MC_int_vector::get_vector | ( | ) |
int & mesh_conv::MC_int_vector::last | ( | ) |
const int & mesh_conv::MC_int_vector::last | ( | ) | const |
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().
MC_int_vector mesh_conv::MC_int_vector::mapping | ( | const std::map< int, int > | map_to_apply | ) | const |
MC_int_vector mesh_conv::MC_int_vector::operator() | ( | const MC_int_vector & | index | ) | const |
int & mesh_conv::MC_int_vector::operator() | ( | const int & | index | ) |
get operator with bounds checks
References assert_bounds(), and int_list.
const int & mesh_conv::MC_int_vector::operator() | ( | const int & | index | ) | const |
get operator with bounds checks
References assert_bounds(), and int_list.
MC_int_vector & mesh_conv::MC_int_vector::operator*= | ( | const MC_int_vector & | to_mult | ) |
MC_int_vector & mesh_conv::MC_int_vector::operator*= | ( | const int & | to_mult | ) |
MC_int_vector & mesh_conv::MC_int_vector::operator+= | ( | const MC_int_vector & | to_add | ) |
MC_int_vector & mesh_conv::MC_int_vector::operator+= | ( | const int & | to_add | ) |
MC_int_vector mesh_conv::MC_int_vector::operator- | ( | ) | const |
MC_int_vector & mesh_conv::MC_int_vector::operator-= | ( | const MC_int_vector & | to_sub | ) |
MC_int_vector & mesh_conv::MC_int_vector::operator-= | ( | const int & | to_sub | ) |
MC_int_vector & mesh_conv::MC_int_vector::operator/= | ( | const MC_int_vector & | to_subdiv | ) |
MC_int_vector & mesh_conv::MC_int_vector::operator/= | ( | const int & | to_subdiv | ) |
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.
const int & mesh_conv::MC_int_vector::operator[] | ( | const int & | index | ) | const |
get operator with bounds asserts
References assert_bounds(), and int_list.
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
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
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().
MC_int_vector & mesh_conv::MC_int_vector::set | ( | const int & | k_index, | |
const int & | new_value | |||
) |
int mesh_conv::MC_int_vector::size | ( | ) | const |
inverse a mapping <index_0->index_1> from a map (the mapping must be a bijection)
return the size of the MC_int_vector
References int_list.
Referenced by add(), delete_index(), erase_last(), find(), first(), last(), mapping(), mesh_conv::MC_v3d_vector::operator()(), mesh_conv::MC_matrix::operator()(), operator()(), mesh_conv::MC_double_vector::operator()(), mesh_conv::operator*(), operator*=(), mesh_conv::operator+(), operator+=(), mesh_conv::operator-(), operator-(), operator-=(), mesh_conv::operator/(), operator/=(), mesh_conv::operator<(), mesh_conv::operator<<(), mesh_conv::operator<=(), mesh_conv::operator==(), mesh_conv::operator>(), mesh_conv::operator>=(), mesh_conv::MC_io_off::read_off(), mesh_conv::MC_matrix::repmat(), mesh_conv::MC_v3d_vector::set(), set(), mesh_conv::MC_double_vector::set(), mesh_conv::MC_matrix::set_block(), sort(), to_list(), to_map(), and mesh_conv::MC_io_off::write_off().
std::pair< MC_int_vector, MC_int_vector > mesh_conv::MC_int_vector::sort | ( | ) | const |
ordonate the vector in increasing order
References int_list, and size().
std::list< int > mesh_conv::MC_int_vector::to_list | ( | ) | const |
std::map< int, int > mesh_conv::MC_int_vector::to_map | ( | ) | const |
convert to std::map
References size().
std::set< int > mesh_conv::MC_int_vector::to_set | ( | ) | const |
convert to std::set
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)
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] |
build a vector of size new_size filled with zero
References resize().
Referenced by mapping(), operator()(), mesh_conv::operator*(), mesh_conv::operator+(), mesh_conv::operator-(), mesh_conv::operator/(), mesh_conv::operator<(), mesh_conv::operator<=(), mesh_conv::operator==(), mesh_conv::operator>(), mesh_conv::operator>=(), and set().
MC_int_vector operator* | ( | const MC_int_vector & | vec, | |
const MC_int_vector & | to_mult | |||
) | [friend] |
multiply a int value to the 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
MC_int_vector operator+ | ( | const MC_int_vector & | vec, | |
const MC_int_vector & | to_add | |||
) | [friend] |
add a set of value to the 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
MC_int_vector operator- | ( | const MC_int_vector & | vec, | |
const MC_int_vector & | to_sub | |||
) | [friend] |
substract a int value to the 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
MC_int_vector operator/ | ( | const MC_int_vector & | vec, | |
const MC_int_vector & | to_subdiv | |||
) | [friend] |
divide a int value to the 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
MC_int_vector operator< | ( | const int & | val, | |
const MC_int_vector & | vec | |||
) | [friend] |
pointwise boolean comparison
MC_int_vector operator< | ( | const MC_int_vector & | vec, | |
const int & | val | |||
) | [friend] |
pointwise boolean comparison
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
MC_int_vector operator<< | ( | const MC_int_vector & | vec, | |
const int & | value | |||
) | [friend] |
add a value at the end of the vertex
MC_int_vector operator<= | ( | const int & | val, | |
const MC_int_vector & | vec | |||
) | [friend] |
pointwise boolean comparison
MC_int_vector operator<= | ( | const MC_int_vector & | vec, | |
const int & | val | |||
) | [friend] |
pointwise boolean comparison
MC_int_vector operator== | ( | const int & | val, | |
const MC_int_vector & | vec | |||
) | [friend] |
pointwise boolean comparison
MC_int_vector operator== | ( | const MC_int_vector & | vec, | |
const int & | val | |||
) | [friend] |
pointwise boolean comparison
MC_int_vector operator> | ( | const int & | val, | |
const MC_int_vector & | vec | |||
) | [friend] |
pointwise boolean comparison
MC_int_vector operator> | ( | const MC_int_vector & | vec, | |
const int & | val | |||
) | [friend] |
pointwise boolean comparison
MC_int_vector operator>= | ( | const int & | val, | |
const MC_int_vector & | vec | |||
) | [friend] |
pointwise boolean comparison
MC_int_vector operator>= | ( | const MC_int_vector & | vec, | |
const int & | val | |||
) | [friend] |
pointwise boolean comparison
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
std::vector<int> mesh_conv::MC_int_vector::int_list [private] |
the internal storage: vector of int
Referenced by add(), assert_bounds(), clear(), delete_index(), find(), first(), get_vector(), last(), mapping(), MC_int_vector(), operator()(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), pointer(), resize(), set(), size(), sort(), to_list(), to_set(), and to_vector().