DofT< D, C > Class Template Reference

#include <DofT.h>

List of all members.

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)
glob_dof (int j)
int size ()
vector< pair< int, int > > glob2loc (int j)
void clear ()

Protected Attributes

bool create_index2dof
bool create_dof2loc
int counter
map< pair< int, int >, int > loc2dof
map< D, int, C > dof2index
map< D, int, C >::iterator iter
map< int, D > index2dof
map< int, vector< pair< int,
int > > > 
dof2loc


Detailed Description

template<class D, class C>
class DofT< D, C >

Definition at line 15 of file DofT.h.


Constructor & Destructor Documentation

template<class D, class C>
DofT< D, C >::DofT bool  create_index2dof_ = false,
bool  create_dof2loc_ = false
[inline]
 

Definition at line 34 of file DofT.h.

References DofT< D, C >::counter, DofT< D, C >::create_dof2loc, and DofT< D, C >::create_index2dof.

00034                                                                        { 
00035     counter = -1; 
00036     create_index2dof = create_index2dof_; 
00037     create_dof2loc   = create_dof2loc; 
00038   }

template<class D, class C>
DofT< D, C >::~DofT  )  [inline]
 

Definition at line 39 of file DofT.h.

00039 {}


Member Function Documentation

template<class D, class C>
void DofT< D, C >::clear  ) 
 

Definition at line 154 of file DofT.h.

References DofT< D, C >::counter, DofT< D, C >::dof2index, DofT< D, C >::dof2loc, DofT< D, C >::index2dof, and DofT< D, C >::loc2dof.

00154                   {
00155   counter = -1; 
00156   loc2dof.clear(); 
00157   dof2index.clear(); 
00158   index2dof.clear(); 
00159   dof2loc.clear(); 
00160 }

template<class D, class C>
vector< pair< int, int > > DofT< D, C >::glob2loc int  j  ) 
 

Definition at line 141 of file DofT.h.

References DofT< D, C >::create_dof2loc, and DofT< D, C >::dof2loc.

Referenced by main().

00141                           { 
00142   if ( create_dof2loc) {
00143     return dof2loc[j]; 
00144   } else {
00145     std::cout <<"This structure has not been created "<<std::endl; 
00146     std::cout <<"You must turn on the create_dof2loc lag before initialization!"<<std::endl; 
00147     return vector<pair<int,int> >(); 
00148   }
00149 
00150 }

template<class D, class C>
D DofT< D, C >::glob_dof int  j  ) 
 

Definition at line 124 of file DofT.h.

References DofT< D, C >::create_index2dof, and DofT< D, C >::index2dof.

00124                            {
00125   if ( create_index2dof) {
00126     if ( index2dof.find(j) != index2dof.end() ) {
00127     return (*(index2dof.find(j))).second;  
00128   } else {
00129     std::cout <<"not found "<<std::endl;  
00130     return D();
00131   }
00132   } else {
00133     std::cout <<"This structure has not been created "<<std::endl; 
00134     std::cout <<"You must turn on the create_index2dof flag before initialization!"<<std::endl; 
00135     return D();
00136   }
00137 }

template<class D, class C>
int DofT< D, C >::glob_dof Lj  ) 
 

Definition at line 114 of file DofT.h.

References DofT< D, C >::dof2index.

00114                           {
00115   if ( dof2index.find(Lj) != dof2index.end())  {
00116     return (*(dof2index.find(Lj))).second;  
00117   } else { 
00118     return -1;  
00119   }
00120 }

template<class D, class C>
int DofT< D, C >::glob_dof int  e,
int  i
 

Definition at line 101 of file DofT.h.

References DofT< D, C >::loc2dof.

Referenced by main().

00101                                   { 
00102   pair<int,int> index; 
00103   index.first = e; 
00104   index.second = i; 
00105   if ( loc2dof.find(index) != loc2dof.end())  {
00106     return (*(loc2dof.find(index))).second; 
00107   } else {
00108     return -1; 
00109   }
00110 }

template<class D, class C>
int DofT< D, C >::insert_dof int  e,
int  i,
Li
 

Definition at line 63 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 >::index2dof, DofT< D, C >::iter, and DofT< D, C >::loc2dof.

Referenced by main().

00063                                          {
00064   // first we update loc2dof, which always should be updated  
00065   pair<int,int> index; 
00066   index.first = e; 
00067   index.second = i; 
00068   int return_dof; 
00069 
00070   // check if the dof is new, if so
00071   // update counter, dof2index and create
00072   // a new vector in dof2loc  
00073   iter = dof2index.find(Li); 
00074   if ( iter == dof2index.end() ) { //dof is new 
00075     counter++; 
00076     return_dof = counter; 
00077     dof2index[Li]  = counter; 
00078     loc2dof[index] = counter; 
00079     if ( create_index2dof) { 
00080       index2dof[counter] = Li; 
00081     }
00082     if ( create_dof2loc ) {
00083       vector<pair<int,int> > v; 
00084       dof2loc[counter] = v;  
00085     }
00086   } else {                       // dof is not new 
00087     loc2dof[index] = (*iter).second; 
00088     return_dof = (*iter).second;
00089   }
00090 
00091   // insert (e,i) in dof2loc[Li]  
00092   if (create_dof2loc) { 
00093     dof2loc[counter].push_back(index); 
00094   }
00095 
00096   return return_dof; 
00097 }

template<class D, class C>
int DofT< D, C >::size  ) 
 

Definition at line 57 of file DofT.h.

References DofT< D, C >::counter.

Referenced by main().

00057                    {
00058   return counter+1; 
00059 }


Member Data Documentation

template<class D, class C>
int DofT< D, C >::counter [protected]
 

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 >::size().

template<class D, class C>
bool DofT< D, C >::create_dof2loc [protected]
 

Definition at line 17 of file DofT.h.

Referenced by DofT< D, C >::DofT(), DofT< D, C >::glob2loc(), and DofT< D, C >::insert_dof().

template<class D, class C>
bool DofT< D, C >::create_index2dof [protected]
 

Definition at line 17 of file DofT.h.

Referenced by DofT< D, C >::DofT(), DofT< D, C >::glob_dof(), and DofT< D, C >::insert_dof().

template<class D, class C>
map<D,int,C> DofT< D, C >::dof2index [protected]
 

Definition at line 25 of file DofT.h.

Referenced by DofT< D, C >::clear(), DofT< D, C >::glob_dof(), and DofT< D, C >::insert_dof().

template<class D, class C>
map<int, vector<pair<int,int> > > DofT< D, C >::dof2loc [protected]
 

Definition at line 31 of file DofT.h.

Referenced by DofT< D, C >::clear(), DofT< D, C >::glob2loc(), and DofT< D, C >::insert_dof().

template<class D, class C>
map<int,D> DofT< D, C >::index2dof [protected]
 

Definition at line 29 of file DofT.h.

Referenced by DofT< D, C >::clear(), DofT< D, C >::glob_dof(), and DofT< D, C >::insert_dof().

template<class D, class C>
map<D,int,C>:: iterator DofT< D, C >::iter [protected]
 

Definition at line 26 of file DofT.h.

Referenced by DofT< D, C >::insert_dof().

template<class D, class C>
map<pair<int,int>, int> DofT< D, C >::loc2dof [protected]
 

Definition at line 23 of file DofT.h.

Referenced by DofT< D, C >::clear(), DofT< D, C >::glob_dof(), and DofT< D, C >::insert_dof().


The documentation for this class was generated from the following file:
Generated on Wed Apr 19 12:38:15 2006 for SyFi by  doxygen 1.4.4