int_vector Class Reference

#include <int_vector.h>

Collaboration diagram for int_vector:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 int_vector ()
 int_vector (const int_vector &)
 int_vector (const std::vector< int > &)
 ~int_vector ()
int size () const
int resize (int _size)
int & operator[] (int k_vertex)
int operator[] (int k_vertex) const
int_vectoroperator= (const int_vector &)
int add_unique (int k_index)
int add (int k_vertex)
int add (const std::vector< int > &_int_list)
int exists (int index_to_find) const
 check if the index exist.

Private Attributes

std::vector< int > int_list

Friends

bool operator== (const int_vector &cont_1, const int_vector &cont_2)
bool operator!= (const int_vector &cont_1, const int_vector &cont_2)


Detailed Description

Definition at line 43 of file int_vector.h.


Constructor & Destructor Documentation

int_vector::int_vector (  ) 

Definition at line 23 of file int_vector.cpp.

References int_list.

00023                       :
00024 int_list()
00025 {
00026   int_list.resize(0);
00027 }

int_vector::int_vector ( const int_vector _V  ) 

Definition at line 29 of file int_vector.cpp.

References int_list.

00029                                           :
00030   int_list()
00031 {
00032   int_list.resize(_V.int_list.size());
00033   for(int k=0;k<int(int_list.size());int_list[k]=_V.int_list[k],k++);
00034 }
int_vector::int_vector(const std::vector<int>& _V):

int_vector::int_vector ( const std::vector< int > &  _V  ) 

Definition at line 35 of file int_vector.cpp.

References int_list.

00035                                               :
00036   int_list()
00037 {
00038   int_list.resize(_V.size());
00039   for(int k=0;k<int(int_list.size());int_list[k]=_V[k],k++);  
00040 }

int_vector::~int_vector (  ) 

Definition at line 42 of file int_vector.cpp.

References int_list.

00043 {
00044   int_list.resize(0);
00045 }


Member Function Documentation

int int_vector::size (  )  const

Definition at line 47 of file int_vector.cpp.

References int_list.

Referenced by Mesh_object::build_normal_intermediate(), Mesh_object::build_normal_per_vertex(), exists(), Mesh_object::Laplacien_smooth(), and operator==().

00048 {
00049   return int_list.size();
00050 }

Here is the caller graph for this function:

int int_vector::resize ( int  _size  ) 

Definition at line 52 of file int_vector.cpp.

References int_list.

Referenced by Mesh_object::fast_subdivide_barycenter_mid_edge(), and Mesh_object::fast_subdivide_mixed_mid_edge().

00053 {
00054   if(_size>=0)
00055     {
00056       int_list.resize(_size);
00057       return(0);
00058     }
00059   else
00060     {printf("error in resize in int_vector, size[%d] is not correct\n",_size);exit(-1);}
00061 
00062   return(-1);
00063 }

Here is the caller graph for this function:

int & int_vector::operator[] ( int  k_vertex  ) 

Definition at line 65 of file int_vector.cpp.

References int_list.

00066 {
00067   if(k_vertex<0 || k_vertex>=int(int_list.size()))
00068     {printf("Error in operator [] in int_vector, k_vertex [%d] is not correct because int_list.size()=[%d] \n",k_vertex,int_list.size());exit(-1);}
00069   return int_list[k_vertex];
00070 }  

int int_vector::operator[] ( int  k_vertex  )  const

Definition at line 71 of file int_vector.cpp.

References int_list.

00072 {
00073   if(k_vertex<0 || k_vertex>=int(int_list.size()))
00074     {printf("Error in operator [] in int_vector, k_vertex [%d] is not correct because int_list.size()=[%d] \n",k_vertex,int_list.size());exit(-1);}
00075   return int_list[k_vertex];
00076 }  

int_vector & int_vector::operator= ( const int_vector _V  ) 

Definition at line 79 of file int_vector.cpp.

References int_list.

00080 {
00081   int_list.resize(_V.int_list.size());
00082   for(int k=0;k<int(_V.int_list.size());k++)
00083     int_list[k] = _V.int_list[k];
00084   return *this;
00085 }

int int_vector::add_unique ( int  k_index  ) 

Definition at line 88 of file int_vector.cpp.

References int_list.

00089 {
00090   int k=0;
00091   for(k=0;k<int(int_list.size());k++)//go through the entire list
00092     if(int_list[k]==k_index)//if already exists
00093       return(-1);
00094 
00095   int_list.push_back(k_index);//in the other case, add the vertex number
00096   return 0;
00097 }

int int_vector::add ( int  k_vertex  ) 

Definition at line 99 of file int_vector.cpp.

References int_list.

00100 {
00101   int_list.push_back(k_vertex);
00102   return(0);
00103 }

int int_vector::add ( const std::vector< int > &  _int_list  ) 

Definition at line 105 of file int_vector.cpp.

00106 {
00107   int k=0;
00108   for(k=0;k<int(_int_list.size());k++)
00109     add(_int_list[k]);
00110   return 0;
00111 }

int int_vector::exists ( int  index_to_find  )  const

check if the index exist.

If the index already exists, returns its index Else return -1

Definition at line 113 of file int_vector.cpp.

References int_list, and size().

00114 {
00115   int k=0;
00116   int N=size();
00117   for(k=0;k<N;k++)
00118     if(index_to_find==int_list[k])
00119       return k;
00120   return -1;
00121 }

Here is the call graph for this function:


Friends And Related Function Documentation

bool operator== ( const int_vector cont_1,
const int_vector cont_2 
) [friend]

Definition at line 123 of file int_vector.cpp.

00124 {
00125   if(cont_1.size()!=cont_2.size())
00126     return 0;
00127   for(int k=0;k<cont_1.size();k++)
00128     if(cont_1[k]!=cont_2[k])
00129       return 0;
00130   return 1;
00131 }

bool operator!= ( const int_vector cont_1,
const int_vector cont_2 
) [friend]

Definition at line 132 of file int_vector.cpp.

00133 {
00134   if(cont_1==cont_2)
00135     return 0;
00136   return 1;
00137 }


Member Data Documentation

std::vector<int> int_vector::int_list [private]


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

Generated on Mon Mar 30 16:56:46 2009 by  doxygen 1.5.6