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