mesh_conv::MC_int_vector_vector Class Reference

Container class for MC_int_vector. More...

#include <MC_int_vector_vector.hpp>

Inheritance diagram for mesh_conv::MC_int_vector_vector:
Inheritance graph
[legend]
Collaboration diagram for mesh_conv::MC_int_vector_vector:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MC_int_vector_vector ()
 standard constructor
 MC_int_vector_vector (const MC_int_vector &v0)
 direct constructor from some MC_int_vector
 MC_int_vector_vector (const MC_int_vector &v0, const MC_int_vector &v1)
 direct constructor from some MC_int_vector
 MC_int_vector_vector (const MC_int_vector &v0, const MC_int_vector &v1, const MC_int_vector &v2)
 direct constructor from some MC_int_vector
 MC_int_vector_vector (const MC_int_vector &v0, const MC_int_vector &v1, const MC_int_vector &v2, const MC_int_vector &v3)
 direct constructor from some MC_int_vector
 MC_int_vector_vector (const MC_int_list_vector &v)
 constructor from a MC_int_list_vector
 MC_int_vector_vector (const std::list< MC_int_vector > &vec)
 direct constructor from a std::list <MC_int_vector>
void assert_bounds (const int &u) const
 Assert the value stays within the bounds.
int size () const
 get the size of the vector
void clear ()
 clear the vector to size 0
MC_int_vector_vectorresize (const int &new_size)
 resize the vector in deleting value of adding zeros
MC_int_vector_vectoradd (const MC_int_vector &val)
 add a value at the end of the vector
MC_int_vector_vectoradd (const MC_int_vector_vector &val)
 add some values at the end of the vector
MC_int_vector_vectorset (const int &k_index, const MC_int_vector &new_value)
 set an indexed value to a certain component. Adjust the size automatically
MC_int_vector_vectorset (const MC_int_vector &k_index, const MC_int_vector_vector &new_value)
 set an indexed value to a certain component. Adjust the size automatically
std::pair
< MC_int_vector_vector,
MC_int_vector
delete_index (const int &index_to_delete) const
 delete the k_th value
std::pair
< MC_int_vector_vector,
MC_int_vector_vector
delete_index (const MC_int_vector &index_to_delete) const
 delete the k_th value
const MC_int_vectoroperator() (const int &index) const
 get operator with bounds checks
MC_int_vectoroperator() (const int &index)
 get operator with bounds checks
const MC_int_vectoroperator[] (const int &index) const
 get operator with bounds asserts
MC_int_vectoroperator[] (const int &index)
 get operator with bounds asserts
MC_int_vector_vector operator() (const MC_int_vector &index) const
 get operator from a vector of index
const MC_int_vectorfirst () const
 return the first value
MC_int_vectorfirst ()
 return the first value
const MC_int_vectorlast () const
 return the last value
MC_int_vectorlast ()
 return the last value
const MC_int_vectorpointer () const
 get pointer on internal data
MC_int_vectorpointer_unprotected ()
 get pointer on internal data

Static Public Member Functions

static MC_int_vector_vector empty (const int &N)
 create an empty container of a given size
static MC_int_vector_vector repeat (const MC_int_vector &input, const int &N_repeat)
 repeat a MC_int_vector a certain amount of time

Private Attributes

std::vector< MC_int_vectorint_vec_list
 internal storage as a std::vector <MC_int_vector>

Friends

MC_int_vector_vector operator<< (const MC_int_vector_vector &vec, const MC_int_vector &value)
 add a value at the end of the vertex
MC_int_vector_vector operator<< (const MC_int_vector_vector &vec, const MC_int_vector_vector &to_add)
 add some values at the end of the vertex
MC_int_vector_vector operator+ (const MC_int_vector_vector &vec, const int &to_add)
 add an int to all the entries
MC_int_vector_vector operator- (const MC_int_vector_vector &vec, const int &to_add)
 substract an int to all the entries
std::ostream & operator<< (std::ostream &stream, const MC_int_vector_vector &input)

Detailed Description

Container class for MC_int_vector.

correspond to a std::vector<std::vector> > and is internaly stored as a std::vector<MC_int_vector>

Definition at line 35 of file MC_int_vector_vector.hpp.


Constructor & Destructor Documentation

mesh_conv::MC_int_vector_vector::MC_int_vector_vector (  ) 

standard constructor

Definition at line 9 of file MC_int_vector_vector.cpp.

00009 {}

mesh_conv::MC_int_vector_vector::MC_int_vector_vector ( const MC_int_vector v0  ) 

direct constructor from some MC_int_vector

Definition at line 10 of file MC_int_vector_vector.cpp.

References int_vec_list.

00010 {int_vec_list.push_back(v0);}

mesh_conv::MC_int_vector_vector::MC_int_vector_vector ( const MC_int_vector v0,
const MC_int_vector v1 
)

direct constructor from some MC_int_vector

Definition at line 11 of file MC_int_vector_vector.cpp.

References int_vec_list.

00012     {int_vec_list.push_back(v0);int_vec_list.push_back(v1);}

mesh_conv::MC_int_vector_vector::MC_int_vector_vector ( const MC_int_vector v0,
const MC_int_vector v1,
const MC_int_vector v2 
)

direct constructor from some MC_int_vector

Definition at line 13 of file MC_int_vector_vector.cpp.

References int_vec_list.

00014     {int_vec_list.push_back(v0);int_vec_list.push_back(v1);int_vec_list.push_back(v2);}

mesh_conv::MC_int_vector_vector::MC_int_vector_vector ( const MC_int_vector v0,
const MC_int_vector v1,
const MC_int_vector v2,
const MC_int_vector v3 
)

direct constructor from some MC_int_vector

Definition at line 15 of file MC_int_vector_vector.cpp.

References int_vec_list.

00016     {int_vec_list.push_back(v0);int_vec_list.push_back(v1);int_vec_list.push_back(v2);int_vec_list.push_back(v3);}

mesh_conv::MC_int_vector_vector::MC_int_vector_vector ( const MC_int_list_vector &  v  ) 

constructor from a MC_int_list_vector

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

direct constructor from a std::list <MC_int_vector>

Definition at line 185 of file MC_int_vector_vector.cpp.

References add().

00186     {
00187         for(std::list <MC_int_vector> :: const_iterator it=vec.begin();it!=vec.end();++it)
00188             add(*it);
00189     }

Here is the call graph for this function:


Member Function Documentation

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

add some values at the end of the vector

Returns:
the new current vector

Definition at line 53 of file MC_int_vector_vector.cpp.

References int_vec_list, and size().

00054     {
00055         int N=val.size();
00056         for(int k=0;k<N;++k)
00057             int_vec_list.push_back(val[k]);
00058         return *this;
00059     }

Here is the call graph for this function:

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

add a value at the end of the vector

Returns:
the current vector

Definition at line 50 of file MC_int_vector_vector.cpp.

References int_vec_list.

Referenced by mesh_conv::MC_mesh_index_vector::add_connectivity_index(), mesh_conv::MC_mesh_index_vector::add_unique_polygon(), mesh_conv::MC_mesh_index_vector::build_closed_cylinder(), mesh_conv::MC_mesh_index_vector::build_cone(), mesh_conv::MC_mesh_index_vector::build_parametric_sphere(), mesh_conv::MC_mesh_index_vector::build_square(), mesh_conv::MC_mesh_index_vector::build_torus(), mesh_conv::MC_mesh_index_vector_draw::concatenation(), mesh_conv::MC_mesh_index_vector::concatenation(), 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(), mesh_conv::MC_mesh_index_vector::get_polygon_mesh(), mesh_conv::MC_grid_index_spatial_hashing::get_voxel_within_sphere(), MC_int_vector_vector(), mesh_conv::MC_io_obj::read_obj(), mesh_conv::MC_io_obj::read_obj_texture(), mesh_conv::MC_io_off::read_off(), repeat(), 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(), mesh_conv::MC_mesh_index_vector::sweep_surface(), and mesh_conv::MC_connectivity_index::triangulated().

00050 {int_vec_list.push_back(val);return *this;}

void mesh_conv::MC_int_vector_vector::assert_bounds ( const int &  u  )  const [inline]

Assert the value stays within the bounds.

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

Definition at line 18 of file MC_int_vector_vector.cpp.

References int_vec_list.

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

00019     {
00020         if(u<0 || u>=int(int_vec_list.size()))
00021         {std::cout<<"Assert mesh_conv::MC_int_vector_vector::assert_bounds("<<u<<") failed, because size="<<int_vec_list.size()<<std::endl;}
00022     }

Here is the caller graph for this function:

void mesh_conv::MC_int_vector_vector::clear (  ) 

clear the vector to size 0

Definition at line 37 of file MC_int_vector_vector.cpp.

References int_vec_list.

00037 {int_vec_list.clear();}

std::pair< MC_int_vector_vector, MC_int_vector_vector > mesh_conv::MC_int_vector_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>

Definition at line 96 of file MC_int_vector_vector.cpp.

References add(), int_vec_list, size(), and mesh_conv::MC_int_vector::to_set().

00097     {
00098         std::set <int> set_index=index_to_delete.to_set();
00099         MC_int_vector_vector new_vec;
00100         MC_int_vector_vector deleted_vec;
00101         int N=size();
00102         for(int k=0;k<N;k++)
00103         {
00104             if(set_index.find(k)==set_index.end())
00105                 new_vec.add(int_vec_list[k]);
00106             else
00107                 deleted_vec.add(int_vec_list[k]);
00108         }
00109         return std::pair <MC_int_vector_vector,MC_int_vector_vector> (new_vec,deleted_vec);
00110     }

Here is the call graph for this function:

std::pair< MC_int_vector_vector, MC_int_vector > mesh_conv::MC_int_vector_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>

Definition at line 85 of file MC_int_vector_vector.cpp.

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

Referenced by mesh_conv::MC_mesh_index_vector::subdivide_mixed_mid_edge().

00086     {
00087         if(index_to_delete<0 || index_to_delete>=size())
00088         {std::cout<<"Error in MC_int_vector_vector::delete("<<index_to_delete<<", when size="<<size()<<std::endl;exit(-1);}
00089         MC_int_vector_vector new_vec;
00090         int N=size();
00091         for(int k=0;k<N;++k)
00092             if(k!=index_to_delete)
00093                 new_vec.add(int_vec_list[k]);
00094         return std::pair <MC_int_vector_vector,MC_int_vector>(new_vec,int_vec_list[index_to_delete]);
00095     }

Here is the call graph for this function:

Here is the caller graph for this function:

MC_int_vector_vector mesh_conv::MC_int_vector_vector::empty ( const int &  N  )  [static]

create an empty container of a given size

Definition at line 194 of file MC_int_vector_vector.cpp.

References resize().

Referenced by operator()().

00195     {MC_int_vector_vector vec;vec.resize(N);return vec;}

Here is the call graph for this function:

Here is the caller graph for this function:

MC_int_vector & mesh_conv::MC_int_vector_vector::first (  ) 

return the first value

Definition at line 133 of file MC_int_vector_vector.cpp.

References int_vec_list, and size().

00134     {
00135         if(size()>0)
00136             return int_vec_list[0];
00137         else
00138         {
00139             std::cout<<"Error, call MC_int_vector_vector::first() with size=0"<<std::endl;exit(-1);
00140             exit(-1);
00141         }
00142     }

Here is the call graph for this function:

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

return the first value

Definition at line 123 of file MC_int_vector_vector.cpp.

References int_vec_list, and size().

Referenced by set().

00124     {
00125         if(size()>0)
00126             return int_vec_list[0];
00127         else
00128         {
00129             std::cout<<"Error, call MC_int_vector_vector::first() with size=0"<<std::endl;exit(-1);
00130             exit(-1);
00131         }
00132     }

Here is the call graph for this function:

Here is the caller graph for this function:

MC_int_vector & mesh_conv::MC_int_vector_vector::last (  ) 

return the last value

Definition at line 150 of file MC_int_vector_vector.cpp.

References int_vec_list, and size().

00151     {
00152         if(size()>0)
00153             return int_vec_list[size()-1];
00154         else
00155         {std::cout<<"Error, call MC_int_vector::last() with size=0"<<std::endl;exit(-1);}
00156     }

Here is the call graph for this function:

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

return the last value

Definition at line 143 of file MC_int_vector_vector.cpp.

References int_vec_list, and size().

00144     {
00145         if(size()>0)
00146             return int_vec_list[size()-1];
00147         else
00148         {std::cout<<"Error, call MC_int_vector::last() with size=0"<<std::endl;exit(-1);}
00149     }

Here is the call graph for this function:

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

get operator from a vector of index

Definition at line 196 of file MC_int_vector_vector.cpp.

References empty(), int_vec_list, size(), and mesh_conv::MC_int_vector::size().

00197     {
00198         int N=index.size();
00199         MC_int_vector_vector vec=MC_int_vector_vector::empty(N);
00200 
00201         int N_current=size();
00202         for(int k=0;k<N;++k)
00203         {
00204             int u=index[k];
00205             if(u<0 || u>=N_current)
00206             {std::cout<<"Error in MC_int_vector_vector::operator()(MC_int_vector ), at position k="<<k<<"/"<<N<<", index "<<u<<"is not correct for size "<<N_current<<std::endl;exit(-1);}
00207             vec[k]=int_vec_list[u];
00208         }
00209         return vec;
00210     }

Here is the call graph for this function:

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

get operator with bounds checks

Definition at line 26 of file MC_int_vector_vector.cpp.

References assert_bounds(), and int_vec_list.

00027     {assert_bounds(index);return int_vec_list[index];}

Here is the call graph for this function:

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

get operator with bounds checks

Definition at line 24 of file MC_int_vector_vector.cpp.

References assert_bounds(), and int_vec_list.

00025     {assert_bounds(index);return int_vec_list[index];}

Here is the call graph for this function:

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

get operator with bounds asserts

Definition at line 30 of file MC_int_vector_vector.cpp.

References assert_bounds(), and int_vec_list.

00031     {assert_bounds(index);return int_vec_list[index];}

Here is the call graph for this function:

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

get operator with bounds asserts

Definition at line 28 of file MC_int_vector_vector.cpp.

References assert_bounds(), and int_vec_list.

00029     {assert_bounds(index);return int_vec_list[index];}

Here is the call graph for this function:

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

get pointer on internal data

Definition at line 191 of file MC_int_vector_vector.cpp.

References int_vec_list.

Referenced by mesh_conv::MC_mesh_index_vector_draw::normal_vertex_update().

00191 {return &int_vec_list[0];}

Here is the caller graph for this function:

MC_int_vector * mesh_conv::MC_int_vector_vector::pointer_unprotected (  ) 

get pointer on internal data

Warning:
unprotected

Definition at line 192 of file MC_int_vector_vector.cpp.

References int_vec_list.

00192 {return &int_vec_list[0];}

MC_int_vector_vector mesh_conv::MC_int_vector_vector::repeat ( const MC_int_vector input,
const int &  N_repeat 
) [static]

repeat a MC_int_vector a certain amount of time

ex. MC_int_vector_vector d=MC_int_vector_vectorrepeat(MC_int_vector(4,5,6),3) = [[4,5,6];[4,5,6];[4,5,6]];

Definition at line 112 of file MC_int_vector_vector.cpp.

References add().

Referenced by set().

00113     {
00114         if(N_repeat<0)
00115         {std::cout<<"Error in MC_int_vector_vector::repeat(MC_int_vector,"<<N_repeat<<"), repeat number must be >0"<<std::endl;exit(-1);}
00116 
00117         MC_int_vector_vector vec(input);
00118         for(int k=1;k<N_repeat;++k)
00119             vec.add(input);
00120         return vec;
00121     }

Here is the call graph for this function:

Here is the caller graph for this function:

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

resize the vector in deleting value of adding zeros

Returns:
the new value

Definition at line 38 of file MC_int_vector_vector.cpp.

References int_vec_list.

Referenced by empty(), mesh_conv::MC_connectivity_index::fliped_polygon(), mesh_conv::operator+(), and mesh_conv::operator-().

00039     {
00040         int N=int_vec_list.size();
00041         if(N==new_size) //same size
00042             return *this;
00043 
00044         if(new_size<0)
00045         {std::cout<<"Error in MC_int_vector_vector::resize("<<new_size<<") new size must be >0"<<std::endl;exit(-1);}
00046 
00047         int_vec_list.resize(new_size);
00048         return *this;
00049     }

Here is the caller graph for this function:

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

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

Returns:
the new vector

Definition at line 71 of file MC_int_vector_vector.cpp.

References first(), repeat(), mesh_conv::MC_int_vector::size(), and size().

00072     {
00073         MC_int_vector_vector v_new_value=new_value;
00074         if(new_value.size()!=1 && new_value.size()!=k_index.size())
00075         {std::cout<<"Error in MC_int_vector_vector::set(MC_int_vector,MC_int_vector_vector), size are not correct: "<<k_index.size()<<","<<new_value.size()<<std::endl;exit(-1);}
00076         if(new_value.size()==1)
00077             v_new_value=MC_int_vector_vector::repeat(new_value.first(),k_index.size());
00078         
00079         
00080         int N=v_new_value.size();
00081         for(int k=0;k<N;k++)
00082             set(k_index[k],v_new_value[k]);
00083         return *this;
00084     }

Here is the call graph for this function:

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

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

Returns:
the new vector

Definition at line 62 of file MC_int_vector_vector.cpp.

References int_vec_list, and size().

00063     {
00064         if(k_index<0)
00065         {std::cout<<"Error in MC_int_vector_vector::set("<<k_index<<","<<new_value<<"), index must be >0"<<std::endl;exit(-1);}
00066         if(k_index>=size())
00067             int_vec_list.resize(k_index+1);
00068         int_vec_list[k_index]=new_value;
00069         return *this;
00070     }

Here is the call graph for this function:

int mesh_conv::MC_int_vector_vector::size (  )  const

Friends And Related Function Documentation

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

add an int to all the entries

MC_int_vector_vector operator- ( const MC_int_vector_vector vec,
const int &  to_add 
) [friend]

substract an int to all the entries

std::ostream& operator<< ( std::ostream &  stream,
const MC_int_vector_vector input 
) [friend]
MC_int_vector_vector operator<< ( const MC_int_vector_vector vec,
const MC_int_vector_vector to_add 
) [friend]

add some values at the end of the vertex

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

add a value at the end of the vertex

Returns:
the current vector (copy)

Member Data Documentation

internal storage as a std::vector <MC_int_vector>

Definition at line 216 of file MC_int_vector_vector.hpp.

Referenced by add(), assert_bounds(), clear(), delete_index(), first(), last(), MC_int_vector_vector(), operator()(), operator[](), pointer(), pointer_unprotected(), resize(), set(), and size().


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

Generated on Sun Apr 18 20:24:48 2010 by  doxygen 1.6.1