00001 #include <Dof.h> 00002 00003 void Dof::clear() { 00004 counter = -1; 00005 loc2dof.clear(); 00006 dof2index.clear(); 00007 index2dof.clear(); 00008 dof2loc.clear(); 00009 } 00010 00011 int Dof:: size() { 00012 return counter; 00013 } 00014 00015 int Dof:: insert_dof(int e, int i, GiNaC::ex Li){ 00016 // first we update loc2dof, which always should be updated 00017 pair<int,int> index; 00018 index.first = e; 00019 index.second = i; 00020 loc2dof[index] = Li; 00021 00022 // check if the dof is new, if so 00023 // update counter, dof2index and create 00024 // a new vector in dof2loc 00025 if (dof2index.find(Li) == dof2index.end() ) { 00026 counter++; 00027 dof2index[Li] = counter; 00028 index2dof[counter] = Li; 00029 vector<pair<int,int> > v; 00030 dof2loc[Li] = v; 00031 } 00032 00033 // insert (e,i) in dof2loc[Li] 00034 dof2loc[Li].insert(dof2loc[Li].end(), index); 00035 } 00036 00037 int Dof:: glob_dof(int e, int i) { 00038 pair<int,int> index; 00039 index.first = e; 00040 index.second = i; 00041 GiNaC::ex Li = loc2dof[index]; 00042 return dof2index[Li]; 00043 } 00044 int Dof:: glob_dof(GiNaC::ex Lj) { 00045 return dof2index[Lj]; 00046 } 00047 00048 GiNaC::ex Dof:: glob_dof(int j) { 00049 return index2dof[j]; 00050 } 00051 00052 vector<pair<int, int> > Dof:: glob2loc(int j){ 00053 GiNaC::ex Lj = index2dof[j]; 00054 return dof2loc[Lj]; 00055 } 00056 00057 00058 //vector<pair<int, int> > glob2loc(GiNaC::ex global_dof); 00059 00060 00061 00062 00063