#include <DofT.h>
Public Member Functions | |
DofT (bool create_index2dof_=false, bool create_dof2loc_=false) | |
~DofT () | |
int | insert_dof (int e, int i, D Li) |
int | glob_dof (int e, int i) |
int | glob_dof (D Lj) |
D | glob_dof (int j) |
int | size () const |
int | num_elements () const |
int | num_basis_functions () const |
std::vector< std::pair< int, int > > | glob2loc (int j) |
void | clear () |
Protected Attributes | |
bool | create_index2dof |
bool | create_dof2loc |
int | counter |
int | emax |
int | imax |
std::map< std::pair< int, int > , int > | loc2dof |
std::map< D, int, C > | dof2index |
std::map< D, int, C >::iterator | iter |
std::map< int, D > | index2dof |
std::map< int, std::vector < std::pair< int, int > > > | dof2loc |
Definition at line 13 of file DofT.h.
DofT< D, C >::DofT | ( | bool | create_index2dof_ = false , |
|
bool | create_dof2loc_ = false | |||
) | [inline] |
Definition at line 35 of file DofT.h.
References DofT< D, C >::counter, DofT< D, C >::create_dof2loc, DofT< D, C >::create_index2dof, DofT< D, C >::emax, and DofT< D, C >::imax.
00036 { 00037 counter = -1; 00038 emax = -1; 00039 imax = -1; 00040 create_index2dof = create_index2dof_; 00041 create_dof2loc = create_dof2loc_; 00042 }
void DofT< D, C >::clear | ( | ) | [inline] |
Definition at line 199 of file DofT.h.
References DofT< D, C >::counter, DofT< D, C >::dof2index, DofT< D, C >::dof2loc, DofT< D, C >::emax, DofT< D, C >::imax, DofT< D, C >::index2dof, and DofT< D, C >::loc2dof.
00200 { 00201 counter = -1; 00202 emax = -1; 00203 imax = -1; 00204 00205 loc2dof.clear(); 00206 dof2index.clear(); 00207 index2dof.clear(); 00208 dof2loc.clear(); 00209 }
std::vector< std::pair< int, int > > DofT< D, C >::glob2loc | ( | int | j | ) | [inline] |
Definition at line 181 of file DofT.h.
References DofT< D, C >::create_dof2loc, and DofT< D, C >::dof2loc.
00182 { 00183 if ( create_dof2loc ) 00184 { 00185 return dof2loc[j]; 00186 } 00187 else 00188 { 00189 std::cout <<"This structure has not been created "<<std::endl; 00190 std::cout <<"You must turn on the create_dof2loc flag before initialization!"<<std::endl; 00191 return std::vector<std::pair<int,int> >(); 00192 } 00193 00194 }
D DofT< D, C >::glob_dof | ( | int | j | ) | [inline] |
Definition at line 156 of file DofT.h.
References DofT< D, C >::create_index2dof, and DofT< D, C >::index2dof.
00157 { 00158 if ( create_index2dof) 00159 { 00160 if ( index2dof.find(j) != index2dof.end() ) 00161 { 00162 return (*(index2dof.find(j))).second; 00163 } 00164 else 00165 { 00166 std::cout <<"not found "<<std::endl; 00167 return D(); 00168 } 00169 } 00170 else 00171 { 00172 std::cout <<"This structure has not been created "<<std::endl; 00173 std::cout <<"You must turn on the create_index2dof flag before initialization!"<<std::endl; 00174 return D(); 00175 } 00176 }
int DofT< D, C >::glob_dof | ( | D | Lj | ) | [inline] |
int DofT< D, C >::glob_dof | ( | int | e, | |
int | i | |||
) | [inline] |
Definition at line 123 of file DofT.h.
References DofT< D, C >::loc2dof.
Referenced by main().
00124 { 00125 std::pair<int,int> index; 00126 index.first = e; 00127 index.second = i; 00128 if ( loc2dof.find(index) != loc2dof.end()) 00129 { 00130 return (*(loc2dof.find(index))).second; 00131 } 00132 else 00133 { 00134 return -1; 00135 } 00136 }
int DofT< D, C >::insert_dof | ( | int | e, | |
int | i, | |||
D | Li | |||
) | [inline] |
Definition at line 69 of file DofT.h.
References DofT< D, C >::counter, DofT< D, C >::create_dof2loc, DofT< D, C >::create_index2dof, DofT< D, C >::dof2index, DofT< D, C >::dof2loc, DofT< D, C >::emax, DofT< D, C >::imax, DofT< D, C >::index2dof, DofT< D, C >::iter, DofT< D, C >::loc2dof, and SyFi::p.
Referenced by main().
00070 { 00071 00072 if (e > emax) emax = e; 00073 if (i > imax) imax = i; 00074 00075 // first we update loc2dof, which always should be updated 00076 std::pair<int,int> index; 00077 index.first = e; 00078 index.second = i; 00079 int return_dof; 00080 00081 // check if the dof is new, if so 00082 // update counter, dof2index and create 00083 // a new vector in dof2loc 00084 iter = dof2index.find(Li); 00085 //dof is new 00086 if ( iter == dof2index.end() ) 00087 { 00088 counter++; 00089 return_dof = counter; 00090 dof2index[Li] = counter; 00091 loc2dof[index] = counter; 00092 if ( create_index2dof) 00093 { 00094 std::pair<int, D> p(counter, Li); 00095 index2dof.insert(p); 00096 // index2dof[counter] = Li; 00097 // 00098 } 00099 if ( create_dof2loc ) 00100 { 00101 std::vector<std::pair<int,int> > v; 00102 dof2loc[counter] = v; 00103 } 00104 } // dof is not new 00105 else 00106 { 00107 loc2dof[index] = (*iter).second; 00108 return_dof = (*iter).second; 00109 } 00110 00111 // insert (e,i) in dof2loc[Li] 00112 if (create_dof2loc) 00113 { 00114 dof2loc[return_dof].push_back(index); 00115 } 00116 00117 return return_dof; 00118 }
int DofT< D, C >::num_basis_functions | ( | ) | const [inline] |
int DofT< D, C >::num_elements | ( | ) | const [inline] |
int DofT< D, C >::size | ( | ) | const [inline] |
Definition at line 61 of file DofT.h.
References DofT< D, C >::counter.
Referenced by main().
00062 { 00063 return counter+1; 00064 }
Definition at line 17 of file DofT.h.
Referenced by DofT< D, C >::clear(), DofT< D, C >::DofT(), DofT< D, C >::insert_dof(), and DofT< D, C >::size().
bool DofT< D, C >::create_dof2loc [protected] |
Definition at line 16 of file DofT.h.
Referenced by DofT< D, C >::DofT(), DofT< D, C >::glob2loc(), and DofT< D, C >::insert_dof().
bool DofT< D, C >::create_index2dof [protected] |
Definition at line 16 of file DofT.h.
Referenced by DofT< D, C >::DofT(), DofT< D, C >::glob_dof(), and DofT< D, C >::insert_dof().
Definition at line 26 of file DofT.h.
Referenced by DofT< D, C >::clear(), DofT< D, C >::glob_dof(), and DofT< D, C >::insert_dof().
std::map<int, std::vector<std::pair<int,int> > > DofT< D, C >::dof2loc [protected] |
Definition at line 32 of file DofT.h.
Referenced by DofT< D, C >::clear(), DofT< D, C >::glob2loc(), and DofT< D, C >::insert_dof().
Definition at line 18 of file DofT.h.
Referenced by DofT< D, C >::clear(), DofT< D, C >::DofT(), DofT< D, C >::insert_dof(), and DofT< D, C >::num_elements().
Definition at line 19 of file DofT.h.
Referenced by DofT< D, C >::clear(), DofT< D, C >::DofT(), DofT< D, C >::insert_dof(), and DofT< D, C >::num_basis_functions().
Definition at line 30 of file DofT.h.
Referenced by DofT< D, C >::clear(), DofT< D, C >::glob_dof(), and DofT< D, C >::insert_dof().
Definition at line 24 of file DofT.h.
Referenced by DofT< D, C >::clear(), DofT< D, C >::glob_dof(), and DofT< D, C >::insert_dof().