A container class for a vector of int. More...
#include <MC_int_vector.hpp>

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::set< unsigned 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 | |
| MC_v3d | to_v3d () const |
| 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 | |
| MC_int_vector | inverted () const |
| invert the vector order (last<->first) | |
| int | size () const |
| return the size of the MC_int_vector | |
| 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 | |
| static std::list< MC_int_vector > | connected_component (const std::set< MC_int_pair, MC_int_pair_less > &pair_set) |
| inverse a mapping <index_0->index_1> from a map (the mapping must be a bijection) | |
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>
Definition at line 51 of file MC_int_vector.hpp.
| mesh_conv::MC_int_vector::MC_int_vector | ( | ) |
standard constructor
Definition at line 11 of file MC_int_vector.cpp.
Referenced by connected_component().

| mesh_conv::MC_int_vector::MC_int_vector | ( | const int & | u0 | ) |
direct constructor with one value
Definition at line 13 of file MC_int_vector.cpp.
References int_list.
00014 {int_list.push_back(u0);}
| mesh_conv::MC_int_vector::MC_int_vector | ( | const int & | u0, | |
| const int & | u1 | |||
| ) |
direct constructor with multiple values
Definition at line 15 of file MC_int_vector.cpp.
References int_list.
| mesh_conv::MC_int_vector::MC_int_vector | ( | const int & | u0, | |
| const int & | u1, | |||
| const int & | u2 | |||
| ) |
| mesh_conv::MC_int_vector::MC_int_vector | ( | const int & | u0, | |
| const int & | u1, | |||
| const int & | u2, | |||
| const int & | u3 | |||
| ) |
| mesh_conv::MC_int_vector::MC_int_vector | ( | const int & | u0, | |
| const int & | u1, | |||
| const int & | u2, | |||
| const int & | u3, | |||
| const int & | u4 | |||
| ) |
| 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 | |||
| ) |
| 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,...>
Definition at line 52 of file MC_int_vector.cpp.
References add(), and mesh_conv::MC_string_tokenizer::tokenize().
00053 { 00054 std::vector <std::string> v_string=MC_string_tokenizer::tokenize(in,delimiter); 00055 bool is_converted=false; 00056 for(unsigned int k=0;k<v_string.size();k++) 00057 { 00058 int value=MC_string_converter::value_of<int>(v_string[k],&is_converted); 00059 if(is_converted==true) 00060 add(value); 00061 } 00062 }

| mesh_conv::MC_int_vector::MC_int_vector | ( | const std::set< int > & | vec | ) |
constructor from a set
Definition at line 130 of file MC_int_vector.cpp.
References int_list.
00131 { 00132 for(std::set <int> :: const_iterator it=vec.begin();it!=vec.end();++it) 00133 int_list.push_back(*it); 00134 }
| mesh_conv::MC_int_vector::MC_int_vector | ( | const std::set< unsigned int > & | vec | ) |
constructor from a set
Definition at line 729 of file MC_int_vector.cpp.
References add().
00730 { 00731 for(std::set<unsigned int>::const_iterator it=vec.begin(),it_end=vec.end();it!=it_end;++it) 00732 add(*it); 00733 }

| 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
Definition at line 135 of file MC_int_vector.cpp.
| mesh_conv::MC_int_vector::MC_int_vector | ( | const std::list< int > & | vec | ) |
constructor from a list
Definition at line 638 of file MC_int_vector.cpp.
References add().
00639 { 00640 for(std::list <int>::const_iterator it=vec.begin();it!=vec.end();++it) 00641 add(*it); 00642 }

| mesh_conv::MC_int_vector::MC_int_vector | ( | const std::vector< int > & | vec | ) |
constructor from a vector
Definition at line 140 of file MC_int_vector.cpp.
References int_list.
00141 { 00142 int_list=vec; 00143 }
| mesh_conv::MC_int_vector::MC_int_vector | ( | const MC_int_vector & | vec | ) |
copy constructor
Definition at line 144 of file MC_int_vector.cpp.
References int_list, and to_vector().
00145 { 00146 int_list=vec.to_vector(); 00147 }

| MC_int_vector & mesh_conv::MC_int_vector::add | ( | const MC_int_vector & | val | ) |
add some values at the end of the vector
Definition at line 72 of file MC_int_vector.cpp.
References int_list, and size().
00073 { 00074 int N=val.size(); 00075 int end=int_list.size(); 00076 int_list.resize(int_list.size()+N); 00077 for(int k=0;k<N;++k) 00078 int_list[end+k]=val[k]; 00079 return *this; 00080 }

| MC_int_vector & mesh_conv::MC_int_vector::add | ( | const int & | val | ) |
add a value at the end of the vector
Definition at line 65 of file MC_int_vector.cpp.
References int_list.
Referenced by mesh_conv::MC_mesh_index_vector::add_unique_polygon(), mesh_conv::MC_grid_3d_scalar_marching_cube::create_polygon(), delete_index(), mesh_conv::MC_mesh_index_vector::delete_polygon(), mesh_conv::MC_mesh_index_vector::delete_vertex(), linspace(), MC_int_vector(), mesh_conv::operator>>(), mesh_conv::MC_mesh_index_vector::polygons_inside_sphere(), mesh_conv::MC_io_obj::read_obj(), mesh_conv::MC_io_obj::read_obj_texture(), mesh_conv::MC_io_off::read_off(), mesh_conv::MC_mesh_index_vector::segment_intersection(), mesh_conv::MC_polygon::subdivide_barycenter_mid_edge(), mesh_conv::MC_mesh_index_vector::subdivide_barycenter_mid_edge_unchanged_boundary(), mesh_conv::MC_polygon::subdivide_mid_edge(), mesh_conv::MC_mesh_index_vector::subdivide_mid_edge(), mesh_conv::MC_mesh_index_vector::subdivide_mid_edge_unchanged_boundary(), and mesh_conv::MC_mesh_index_vector::subdivide_mixed_mid_edge_unchanged_boundary().
00066 {int_list.push_back(val);return *this;}
| void mesh_conv::MC_int_vector::assert_bounds | ( | const int & | u | ) | const |
Assert the value stays within the bounds.
Definition at line 21 of file MC_int_vector.cpp.
References int_list.
Referenced by operator()(), and operator[]().
00022 { 00023 if(u<0 || u>=int(int_list.size())) 00024 {std::cout<<"Assert mesh_conv::MC_int_vector::assert_bounds("<<u<<") failed, because size="<<int_list.size()<<std::endl;exit(-1);} 00025 }

| void mesh_conv::MC_int_vector::clear | ( | ) |
clear the vector to size 0
Definition at line 39 of file MC_int_vector.cpp.
References int_list.
Referenced by mesh_conv::MC_mesh_index_vector::plane_intersection().
00040 {int_list.clear();}

| std::list< MC_int_vector > mesh_conv::MC_int_vector::connected_component | ( | const std::set< MC_int_pair, MC_int_pair_less > & | pair_set | ) | [static] |
inverse a mapping <index_0->index_1> from a map (the mapping must be a bijection)
build a connected list of indexed given a set of pairs
Definition at line 567 of file MC_int_vector.cpp.
References MC_int_vector().
Referenced by mesh_conv::MC_mesh_index_vector::boundary_curve().
00568 { 00569 std::list <MC_int_vector> full; 00570 00571 00572 std::list <MC_int_pair> list_pair; 00573 for(std::set <MC_int_pair,MC_int_pair_less>::iterator it=pair_set.begin();it!=pair_set.end();++it) 00574 list_pair.push_back(*it); 00575 00576 00577 00578 00579 // add forward 00580 std::list <MC_int_pair> :: iterator it; 00581 std::list <int> current_curve; 00582 00583 // while the list is not empty 00584 while(list_pair.size()>0) 00585 { 00586 // fill the first found 00587 it=list_pair.begin(); 00588 int to_find=(*it)[1]; 00589 current_curve.push_back( (*it)[0] ); 00590 current_curve.push_back( to_find ); 00591 list_pair.erase(it); 00592 00593 // find the next index until no more index 00594 bool find_next=true; 00595 while(find_next==true) 00596 { 00597 find_next=false; 00598 std::list<MC_int_pair>::iterator searcher; 00599 00600 // exhaustive research 00601 for(searcher=list_pair.begin();searcher!=list_pair.end();++searcher) 00602 { 00603 if( (*searcher)[0]==to_find ) 00604 { 00605 current_curve.push_back( (*searcher)[1] ); 00606 to_find=(*searcher)[1]; 00607 break; 00608 } 00609 else if((*searcher)[1]==to_find ) 00610 { 00611 current_curve.push_back( (*searcher)[0] ); 00612 to_find=(*searcher)[0]; 00613 break; 00614 } 00615 } 00616 if(searcher!=list_pair.end()) 00617 { 00618 list_pair.erase(searcher); 00619 find_next=true; 00620 } 00621 } 00622 00623 // 00624 // for(std::list <MC_int_pair>:: iterator it=list_pair.begin();it!=list_pair.end();++it) 00625 // std::cout<<*it<<std::endl; 00626 // for(std::list <int>:: iterator it=current_curve.begin();it!=current_curve.end();++it) 00627 // std::cout<<"plop "<<*it<<std::endl; 00628 00629 // add the curve in the list 00630 full.push_back(MC_int_vector(current_curve)); 00631 current_curve.clear(); 00632 00633 } 00634 00635 return full; 00636 }


| 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
return <the new vector,the deleted value>
Definition at line 463 of file MC_int_vector.cpp.
References add(), int_list, size(), and to_set().
00464 { 00465 std::set <int> set_index=index_to_delete.to_set(); 00466 MC_int_vector new_vec; 00467 MC_int_vector deleted_vec; 00468 int N=size(); 00469 for(int k=0;k<N;k++) 00470 { 00471 if(set_index.find(k)!=set_index.end()) 00472 new_vec.add(int_list[k]); 00473 else 00474 deleted_vec.add(int_list[k]); 00475 } 00476 return std::pair <MC_int_vector,MC_int_vector> (new_vec,deleted_vec); 00477 }

| std::pair< MC_int_vector, int > mesh_conv::MC_int_vector::delete_index | ( | const int & | index_to_delete | ) | const |
delete the k_th value
return <the new vector, the deleted value>
Definition at line 452 of file MC_int_vector.cpp.
References add(), int_list, and size().
00453 { 00454 if(index_to_delete<0 || index_to_delete>=size()) 00455 {std::cout<<"Error in MC_int_vector::delete("<<index_to_delete<<", when size="<<size()<<std::endl;exit(-1);} 00456 MC_int_vector new_vec; 00457 int N=size(); 00458 for(int k=0;k<N;++k) 00459 if(k!=index_to_delete) 00460 new_vec.add(int_list[k]); 00461 return std::pair <MC_int_vector,int>(new_vec,int_list[index_to_delete]); 00462 }

| MC_int_vector & mesh_conv::MC_int_vector::erase_last | ( | ) |
| int mesh_conv::MC_int_vector::find | ( | const int & | to_find | ) | const |
try to find an existing value in the vector
Definition at line 652 of file MC_int_vector.cpp.
References int_list, and size().
Referenced by mesh_conv::MC_polygon::projected_direction(), mesh_conv::MC_polygon::subdivide_barycenter_mid_edge(), and mesh_conv::MC_polygon::subdivide_mid_edge().
00653 { 00654 int N=size(); 00655 for(int k=0;k<N;++k) 00656 if(to_find==int_list[k]) 00657 return k; 00658 return -1; 00659 }


| int & mesh_conv::MC_int_vector::first | ( | ) |
return the first value
Definition at line 423 of file MC_int_vector.cpp.
References int_list, and size().
00424 { 00425 if(size()>0) 00426 return int_list[0]; 00427 else 00428 { 00429 std::cout<<"Error, call MC_int_vector::first() with size=0"<<std::endl;exit(-1); 00430 exit(-1); 00431 } 00432 }

| const int & mesh_conv::MC_int_vector::first | ( | ) | const |
return the first value
Definition at line 413 of file MC_int_vector.cpp.
References int_list, and size().
Referenced by mesh_conv::MC_mesh_index_vector::delete_polygon(), mesh_conv::operator*(), operator*=(), mesh_conv::operator+(), operator+=(), mesh_conv::operator-(), operator-=(), mesh_conv::operator/(), and operator/=().
00414 { 00415 if(size()>0) 00416 return int_list[0]; 00417 else 00418 { 00419 std::cout<<"Error, call MC_int_vector::first() with size=0"<<std::endl;exit(-1); 00420 exit(-1); 00421 } 00422 }


| std::vector< int > & mesh_conv::MC_int_vector::get_vector | ( | ) |
get the internal vector
Definition at line 82 of file MC_int_vector.cpp.
References int_list.
00082 {return int_list;}
| MC_int_vector mesh_conv::MC_int_vector::inverted | ( | ) | const |
invert the vector order (last<->first)
Definition at line 721 of file MC_int_vector.cpp.
References int_list, size(), and zeros().
00722 { 00723 unsigned int N=size(); 00724 MC_int_vector inv=MC_int_vector::zeros(N); 00725 for(int k=0;k<N;++k) 00726 inv[k]=int_list[N-k-1]; 00727 return inv; 00728 }

| int & mesh_conv::MC_int_vector::last | ( | ) |
return the last value
Definition at line 442 of file MC_int_vector.cpp.
References int_list, and size().
00443 { 00444 if(size()>0) 00445 return int_list[size()-1]; 00446 else 00447 { 00448 std::cout<<"Error, call MC_int_vector::last() with size=0"<<std::endl;exit(-1); 00449 } 00450 }

| const int & mesh_conv::MC_int_vector::last | ( | ) | const |
return the last value
Definition at line 433 of file MC_int_vector.cpp.
References int_list, and size().
00434 { 00435 if(size()>0) 00436 return int_list[size()-1]; 00437 else 00438 { 00439 std::cout<<"Error, call MC_int_vector::last() with size=0"<<std::endl;exit(-1); 00440 } 00441 }

| 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]
Definition at line 155 of file MC_int_vector.cpp.
References add().
Referenced by mesh_conv::MC_connectivity_index::fliped_polygon(), mesh_conv::MC_matrix::get_col(), mesh_conv::MC_mesh_index_vector::get_polygon_mesh(), mesh_conv::MC_matrix::get_row(), mesh_conv::MC_v3d_vector::inverted_position(), mesh_conv::MC_matrix::operator()(), mesh_conv::MC_matrix::repmat(), mesh_conv::MC_matrix::set_block(), mesh_conv::MC_polygon::subdivide_barycenter_mid_edge(), mesh_conv::MC_polygon::subdivide_mid_edge(), and mesh_conv::MC_curve::unclosed().
00156 { 00157 MC_int_vector temp; 00158 double d_begin=static_cast<double>(begin); 00159 double d_end=static_cast<double>(end); 00160 00161 if(d_end>=d_begin && iteration>0) 00162 { 00163 for(double u=d_begin;u<=d_end;u+=iteration) 00164 temp.add(static_cast<int>(u)); 00165 } 00166 else if(iteration<0) 00167 { 00168 for(double u=d_begin;u>=d_end;u+=iteration) 00169 temp.add(static_cast<int>(u)); 00170 } 00171 else 00172 {std::cout<<"Error in MC_int_vector::linspace("<<begin<<","<<end<<","<<iteration<<"), parameters will infinitely loop"<<std::endl;exit(-1);} 00173 00174 return temp; 00175 }

| MC_int_vector mesh_conv::MC_int_vector::mapping | ( | const std::map< int, int > | map_to_apply | ) | const |
apply a mapping to the values
Definition at line 702 of file MC_int_vector.cpp.
References int_list, size(), and zeros().
00703 { 00704 std::map <int,int> :: const_iterator it_end=map_to_apply.end(); 00705 std::map <int,int> :: const_iterator it; 00706 00707 int N=size(); 00708 MC_int_vector mapped_value=MC_int_vector::zeros(N); 00709 for(int k=0;k<N;++k) 00710 { 00711 int current_index=int_list[k]; 00712 it=map_to_apply.find(current_index); 00713 if(it==it_end) 00714 mapped_value[k]=-1; 00715 else 00716 mapped_value[k]=it->second; 00717 } 00718 return mapped_value; 00719 }

| MC_int_vector mesh_conv::MC_int_vector::operator() | ( | const MC_int_vector & | index | ) | const |
get a set of value
Definition at line 479 of file MC_int_vector.cpp.
References int_list, size(), and zeros().
00480 { 00481 int N=size(); 00482 int N2=index.size(); 00483 MC_int_vector new_vec=zeros(N2); 00484 for(int k=0;k<N2;++k) 00485 { 00486 if(index[k]<0 || index[k]>N) 00487 {std::cout<<"Error in MC_int_vector::operator()(MC_int_vector), value index["<<k<<"]="<<index[k]<<" not correct for size="<<N<<std::endl;exit(-1);} 00488 new_vec[k]=int_list[index[k]]; 00489 } 00490 return new_vec; 00491 }

| int & mesh_conv::MC_int_vector::operator() | ( | const int & | index | ) |
get operator with bounds checks
Definition at line 32 of file MC_int_vector.cpp.
References assert_bounds(), and int_list.
00033 {assert_bounds(index); return int_list[index];}

| const int & mesh_conv::MC_int_vector::operator() | ( | const int & | index | ) | const |
get operator with bounds checks
Definition at line 30 of file MC_int_vector.cpp.
References assert_bounds(), and int_list.
00031 {assert_bounds(index); return int_list[index];}

| 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()
Definition at line 377 of file MC_int_vector.cpp.
References first(), int_list, and size().
00378 { 00379 if(to_mult.size()==1) 00380 return *this*=to_mult.first(); 00381 else 00382 { 00383 if(size()!=to_mult.size()) 00384 {std::cout<<"Error in MC_int_vector::operator*=(MC_int_vector), size are not compatible "<<size()<<";"<<to_mult.size()<<std::endl;exit(-1);} 00385 00386 int N=size(); 00387 for(int k=0;k<N;++k) 00388 int_list[k]*=to_mult[k]; 00389 return *this; 00390 } 00391 }

| 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 | ) |
internal add values
to_add must be of size 1 or this->size()
Definition at line 346 of file MC_int_vector.cpp.
References first(), int_list, and size().
00347 { 00348 if(to_add.size()==1) 00349 return *this+=to_add.first(); 00350 else 00351 { 00352 if(size()!=to_add.size()) 00353 {std::cout<<"Error in MC_int_vector::operator+=(MC_int_vector), size are not compatible "<<size()<<";"<<to_add.size()<<std::endl;exit(-1);} 00354 00355 int N=size(); 00356 for(int k=0;k<N;++k) 00357 int_list[k]+=to_add[k]; 00358 return *this; 00359 } 00360 }

| MC_int_vector & mesh_conv::MC_int_vector::operator+= | ( | const int & | to_add | ) |
| MC_int_vector mesh_conv::MC_int_vector::operator- | ( | ) | const |
change the opposite sign of the current vector (unary negation)
Definition at line 191 of file MC_int_vector.cpp.
References int_list, resize(), and size().
00192 { 00193 MC_int_vector opposite; 00194 int N=size(); 00195 opposite.resize(N); 00196 for(int k=0;k<N;++k) 00197 opposite[k]=-int_list[k]; 00198 return opposite; 00199 }

| 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()
Definition at line 361 of file MC_int_vector.cpp.
References first(), int_list, and size().
00362 { 00363 if(to_sub.size()==1) 00364 return *this-=to_sub.first(); 00365 else 00366 { 00367 if(size()!=to_sub.size()) 00368 {std::cout<<"Error in MC_int_vector::operator-=(MC_int_vector), size are not compatible "<<size()<<";"<<to_sub.size()<<std::endl;exit(-1);} 00369 00370 int N=size(); 00371 for(int k=0;k<N;++k) 00372 int_list[k]-=to_sub[k]; 00373 return *this; 00374 } 00375 00376 }

| 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 | ) |
internal divide
to_add must be of size 1 or this->size()
Definition at line 392 of file MC_int_vector.cpp.
References first(), int_list, and size().
00393 { 00394 if(to_subdiv.size()==1) 00395 return *this/=to_subdiv.first(); 00396 else 00397 { 00398 if(size()!=to_subdiv.size()) 00399 {std::cout<<"Error in MC_int_vector::operator/=(MC_int_vector), size are not compatible "<<size()<<";"<<to_subdiv.size()<<std::endl;exit(-1);} 00400 00401 int N=size(); 00402 for(int k=0;k<N;++k) 00403 { 00404 int current=to_subdiv[k]; 00405 if(current==0) 00406 {std::cout<<"Error in MC_int_vector::operator/=(MC_int_vector), try do divide by u["<<k<<"]=0"<<std::endl;exit(-1);} 00407 int_list[k]*=current; 00408 } 00409 return *this; 00410 } 00411 }

| MC_int_vector & mesh_conv::MC_int_vector::operator/= | ( | const int & | to_subdiv | ) |
internal divide
Definition at line 257 of file MC_int_vector.cpp.
References int_list, and size().
00258 { 00259 if(to_subdiv==0) 00260 {std::cout<<"Error in MC_int_vector::operator/=(int), int value is 0"<<std::endl;exit(-1);} 00261 int N=size(); 00262 for(int k=0;k<N;++k) 00263 int_list[k]/=to_subdiv; 00264 return *this; 00265 }

| 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 asserts
Definition at line 36 of file MC_int_vector.cpp.
References assert_bounds(), and int_list.
00037 {assert_bounds(index); return int_list[index];}

| const int & mesh_conv::MC_int_vector::operator[] | ( | const int & | index | ) | const |
get operator with bounds asserts
Definition at line 34 of file MC_int_vector.cpp.
References assert_bounds(), and int_list.
00035 {assert_bounds(index); return int_list[index];}

| const int * mesh_conv::MC_int_vector::pointer | ( | ) | const |
get the pointer on the data
Definition at line 565 of file MC_int_vector.cpp.
References int_list.
Referenced by mesh_conv::MC_opengl_drawer::draw().
00565 {return &int_list[0];}

| MC_int_vector & mesh_conv::MC_int_vector::resize | ( | const int & | new_size | ) |
resize the vector in deleting value of adding zeros
Definition at line 178 of file MC_int_vector.cpp.
References int_list.
Referenced by erase_last(), operator-(), mesh_conv::MC_polygon::plane_intersection(), mesh_conv::MC_mesh_index_vector::plane_intersection(), mesh_conv::MC_polygon::subdivide_mid_edge(), and zeros().
00179 { 00180 int N=int_list.size(); 00181 if(N==new_size) //same size 00182 return *this; 00183 00184 if(new_size<0) 00185 {std::cout<<"Error in MC_int_vector::resize("<<new_size<<") new size must be >0"<<std::endl;exit(-1);} 00186 00187 int_list.resize(new_size); 00188 return *this; 00189 00190 }

| 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"))
Definition at line 114 of file MC_int_vector.cpp.
References size(), and zeros().
00115 { 00116 MC_int_vector v_new_value=new_value; 00117 if(new_value.size()!=1 && new_value.size()!=k_index.size()) 00118 {std::cout<<"Error in MC_int_vector::set(MC_int_vector,MC_int_vector), size are not correct: "<<k_index.size()<<","<<new_value.size()<<std::endl;exit(-1);} 00119 if(new_value.size()==1) 00120 v_new_value=MC_int_vector::zeros(k_index.size())+new_value; 00121 00122 00123 int N=v_new_value.size(); 00124 for(int k=0;k<N;k++) 00125 set(k_index[k],v_new_value[k]); 00126 return *this; 00127 }

| 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
Definition at line 104 of file MC_int_vector.cpp.
References int_list, and size().
00105 { 00106 if(k_index<0) 00107 {std::cout<<"Error in MC_int_vector::set("<<k_index<<","<<new_value<<"), index must be >0"<<std::endl;exit(-1);} 00108 if(k_index>=size()) 00109 int_list.resize(k_index+1); 00110 int_list[k_index]=new_value; 00111 return *this; 00112 }

| int mesh_conv::MC_int_vector::size | ( | ) | const |
return the size of the MC_int_vector
Definition at line 27 of file MC_int_vector.cpp.
References int_list.
Referenced by add(), mesh_conv::MC_mesh_index_vector::area(), mesh_conv::MC_mesh_index_vector::area_gradient(), mesh_conv::MC_mesh_index_vector::average_edge_length(), mesh_conv::MC_mesh_index_vector::barycentric_coordinates(), mesh_conv::MC_connectivity_index::boundary(), mesh_conv::MC_connectivity_index::boundary_polygon(), mesh_conv::MC_connectivity_index::build_ring(), mesh_conv::MC_connectivity_index::build_star(), mesh_conv::MC_mesh_index_vector::build_wireframe(), delete_index(), mesh_conv::MC_mesh_index_vector::delete_polygon(), mesh_conv::MC_mesh_index_vector::delete_vertex(), mesh_conv::MC_opengl_drawer::draw(), mesh_conv::MC_opengl_drawer::draw_grid(), mesh_conv::MC_connectivity_index::edges(), erase_last(), find(), first(), mesh_conv::MC_connectivity_index::fliped_polygon(), mesh_conv::MC_grid_3d< VALUE >::get(), inverted(), mesh_conv::MC_curve::isometric_deformation(), last(), mapping(), mesh_conv::MC_grid_3d< VALUE >::MC_grid_3d(), mesh_conv::MC_int_pair_unique::MC_int_pair_unique(), mesh_conv::MC_mesh_index_vector::normal_vertex(), mesh_conv::MC_v3d_vector::operator()(), mesh_conv::MC_matrix::operator()(), mesh_conv::MC_int_vector_vector::operator()(), operator()(), mesh_conv::MC_double_vector_vector::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_connectivity_index::polygon_neighbors(), mesh_conv::MC_mesh_index_vector::polygons_inside_sphere(), mesh_conv::MC_matrix::repmat(), mesh_conv::MC_v3d_vector::set(), mesh_conv::MC_int_vector_vector::set(), set(), mesh_conv::MC_double_vector_vector::set(), mesh_conv::MC_double_vector::set(), mesh_conv::MC_grid_3d< VALUE >::set(), mesh_conv::MC_matrix::set_block(), sort(), mesh_conv::MC_polygon::subdivide_barycenter_mid_edge(), mesh_conv::MC_mesh_index_vector::subdivide_barycenter_mid_edge(), mesh_conv::MC_mesh_index_vector::subdivide_barycenter_mid_edge_unchanged_boundary(), mesh_conv::MC_polygon::subdivide_mid_edge(), mesh_conv::MC_mesh_index_vector::subdivide_mid_edge(), mesh_conv::MC_mesh_index_vector::subdivide_mid_edge_unchanged_boundary(), mesh_conv::MC_mesh_index_vector::subdivide_mixed_mid_edge(), mesh_conv::MC_mesh_index_vector::subdivide_mixed_mid_edge_unchanged_boundary(), to_list(), to_map(), mesh_conv::MC_connectivity_index::triangulated(), mesh_conv::MC_connectivity_index::used_vertex(), mesh_conv::MC_curve::value(), mesh_conv::MC_mesh_index_vector::volume(), mesh_conv::MC_mesh_index_vector::volume_gradient(), mesh_conv::MC_io_obj::write_obj(), and mesh_conv::MC_io_off::write_off().
00028 {return int_list.size();}
| std::pair< MC_int_vector, MC_int_vector > mesh_conv::MC_int_vector::sort | ( | ) | const |
ordonate the vector in increasing order
Definition at line 665 of file MC_int_vector.cpp.
References int_list, and size().
00666 { 00667 //prepare the sorting structure 00668 int N=size(); 00669 std::vector <std::pair<int,int> > vec_to_sort(N); 00670 for(int k=0;k<N;++k) 00671 vec_to_sort[k]=std::pair <int,int>(int_list[k],k); 00672 00673 //sort 00674 std::sort(vec_to_sort.begin(), 00675 vec_to_sort.end(), 00676 comparator_less_int_int()); 00677 00678 //redistribute 00679 std::pair <MC_int_vector,MC_int_vector> res; 00680 res.first.resize(N);res.second.resize(N); 00681 for(int k=0;k<N;++k) 00682 { 00683 res.first[k]=vec_to_sort[k].first; 00684 res.second[k]=vec_to_sort[k].second; 00685 } 00686 return res; 00687 }

| 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
Definition at line 92 of file MC_int_vector.cpp.
References size().
00093 { 00094 std::map <int,int> map_int; 00095 int N=size(); 00096 for(int k=0;k<N;k++) 00097 map_int.insert(std::pair<int,int>(this->operator()(k),k)); 00098 return map_int; 00099 }

| std::set< int > mesh_conv::MC_int_vector::to_set | ( | ) | const |
convert to std::set
Definition at line 86 of file MC_int_vector.cpp.
References int_list.
Referenced by mesh_conv::MC_int_vector_vector::delete_index(), delete_index(), mesh_conv::MC_double_vector_vector::delete_index(), mesh_conv::MC_double_vector::delete_index(), mesh_conv::MC_v3d_vector::removed(), mesh_conv::MC_polygon::subdivide_mid_edge(), and mesh_conv::MC_connectivity_index::triangle_propagation_using_vertex_field().
00087 { 00088 std::set <int> set_int; 00089 set_int.insert(int_list.begin(),int_list.end()); 00090 return set_int; 00091 }

| MC_v3d mesh_conv::MC_int_vector::to_v3d | ( | ) | const |
| 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.
Definition at line 83 of file MC_int_vector.cpp.
References int_list.
Referenced by MC_int_vector().
00083 {return int_list;}

| MC_int_vector mesh_conv::MC_int_vector::zeros | ( | const int & | new_size | ) | [static] |
build a vector of size new_size filled with zero
Definition at line 149 of file MC_int_vector.cpp.
References resize().
Referenced by mesh_conv::MC_mesh_index_vector::delete_polygon(), inverted(), 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>=(), mesh_conv::MC_mesh_index_vector::segment_intersection(), set(), and mesh_conv::MC_mesh_index_vector::subdivide_mixed_mid_edge().
00150 { 00151 MC_int_vector vec;vec.resize(new_size); 00152 return vec; 00153 }

| 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
Definition at line 447 of file MC_int_vector.hpp.
Referenced by add(), assert_bounds(), clear(), delete_index(), find(), first(), get_vector(), inverted(), last(), mapping(), MC_int_vector(), operator()(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator[](), pointer(), resize(), set(), size(), sort(), to_list(), to_set(), to_v3d(), and to_vector().
1.6.1