Changeset 5843
- Timestamp:
- 09/16/10 11:55:33 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r5841 r5843 4077 4077 } 4078 4078 /*}}}*/ 4079 /*FUNCTION Penta::GetLocalDofList {{{1*/ 4080 int* Penta::GetLocalDofList(int approximation_enum,int setenum){ 4081 4082 int i,j,count,numdof,numgdof; 4083 int ndof_list[NUMVERTICES]; 4084 int ngdof_list_cumulative[NUMVERTICES]; 4085 int *doflist = NULL; 4086 4087 /*Get number of dofs per node, and total for this given set*/ 4088 numdof=0; 4089 numgdof=0; 4090 for(i=0;i<NUMVERTICES;i++){ 4091 4092 /*Cumulative list= number of dofs before node i*/ 4093 ngdof_list_cumulative[i]=numgdof; 4094 4095 /*Number of dofs for node i for given set and for the g set*/ 4096 ndof_list[i]=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 4097 numgdof +=nodes[i]->GetNumberOfDofs(approximation_enum,GsetEnum); 4098 numdof +=ndof_list[i]; 4099 } 4100 4101 if(numdof){ 4102 /*Allocate: */ 4103 doflist=(int*)xmalloc(numdof*sizeof(int)); 4104 4105 /*Populate: */ 4106 count=0; 4107 for(i=0;i<NUMVERTICES;i++){ 4108 nodes[i]->GetLocalDofList(&doflist[count],approximation_enum,setenum); 4109 count+=ndof_list[i]; 4110 } 4111 4112 /*We now have something like: [0 1 0 2 1 2]. Offset by gsize, to get something like: [0 1 2 4 6 7]:*/ 4113 count=0; 4114 for(i=0;i<NUMVERTICES;i++){ 4115 for(j=0;j<ndof_list[i];j++){ 4116 doflist[count+j]+=ngdof_list_cumulative[i]; 4117 } 4118 count+=ndof_list[i]; 4119 } 4120 } 4121 else doflist=NULL; 4122 4123 return doflist; 4124 } 4125 /*}}}*/ 4126 /*FUNCTION Penta::GetGlobalDofList {{{1*/ 4127 int* Penta::GetGlobalDofList(int approximation_enum,int setenum){ 4128 4129 int i,numdof,count; 4130 int ndof_list[NUMVERTICES]; 4131 int *doflist = NULL; 4132 4133 /*First, figure out size of doflist: */ 4134 numdof=0; 4135 for(i=0;i<3;i++){ 4136 ndof_list[i]=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 4137 numdof+=ndof_list[i]; 4138 } 4139 4140 if(numdof){ 4141 /*Allocate: */ 4142 doflist=(int*)xmalloc(numdof*sizeof(int)); 4143 4144 /*Populate: */ 4145 count=0; 4146 for(i=0;i<3;i++){ 4147 nodes[i]->GetDofList(&doflist[count],approximation_enum,setenum); 4148 count+=ndof_list[i]; 4149 } 4150 } 4151 else doflist=NULL; 4152 4153 return doflist; 4154 } 4155 /*}}}*/ 4156 /*FUNCTION Penta::GetNumberOfDofs {{{1*/ 4157 int Penta::GetNumberOfDofs(int approximation_enum,int setenum){ 4158 4159 /*output: */ 4160 int numberofdofs=0; 4161 4162 for(int i=0;i<NUMVERTICES;i++){ 4163 numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 4164 } 4165 4166 return numberofdofs; 4167 } 4168 /*}}}*/ 4079 4169 /*FUNCTION Penta::GetParameterListOnVertices(double* pvalue,int enumtype) {{{1*/ 4080 4170 void Penta::GetParameterListOnVertices(double* pvalue,int enumtype){ … … 5524 5614 } 5525 5615 /*}}}*/ 5616 /*FUNCTION Penta::NewElementMatrix{{{1*/ 5617 ElementMatrix* Penta::NewElementMatrix(int approximation){ 5618 5619 /*parameters: */ 5620 bool kff=false; 5621 5622 /*output: */ 5623 ElementMatrix* Ke=NULL; 5624 int gsize; 5625 int fsize; 5626 int ssize; 5627 int* gglobaldoflist=NULL; 5628 int* flocaldoflist=NULL; 5629 int* fglobaldoflist=NULL; 5630 int* slocaldoflist=NULL; 5631 int* sglobaldoflist=NULL; 5632 bool square=true; 5633 5634 /*retrieve some parameters: */ 5635 this->parameters->FindParam(&kff,KffEnum); 5636 5637 /*get number of dofs in sets g,f and s: */ 5638 gsize=this->GetNumberOfDofs(approximation,GsetEnum); 5639 if(kff){ 5640 fsize=this->GetNumberOfDofs(approximation,FsetEnum); 5641 ssize=this->GetNumberOfDofs(approximation,SsetEnum); 5642 } 5643 5644 /*get dof lists for f and s set: */ 5645 gglobaldoflist=this->GetGlobalDofList(approximation,GsetEnum); 5646 if(kff){ 5647 flocaldoflist=this->GetLocalDofList(approximation,FsetEnum); 5648 fglobaldoflist=this->GetGlobalDofList(approximation,FsetEnum); 5649 slocaldoflist=this->GetLocalDofList(approximation,SsetEnum); 5650 sglobaldoflist=this->GetGlobalDofList(approximation,SsetEnum); 5651 } 5652 5653 /*Use square constructor for ElementMatrix: */ 5654 if(!kff) Ke=new ElementMatrix(square,gglobaldoflist,gsize); 5655 else Ke=new ElementMatrix(square,gglobaldoflist,gsize,flocaldoflist,fglobaldoflist,fsize,slocaldoflist,sglobaldoflist,ssize); 5656 5657 /*Free ressources and return:*/ 5658 xfree((void**)&gglobaldoflist); 5659 xfree((void**)&flocaldoflist); 5660 xfree((void**)&fglobaldoflist); 5661 xfree((void**)&slocaldoflist); 5662 xfree((void**)&sglobaldoflist); 5663 5664 return Ke; 5665 } 5666 /*}}}*/ 5667 /*FUNCTION Penta::NewElementVector{{{1*/ 5668 ElementVector* Penta::NewElementVector(int approximation){ 5669 5670 /*parameters: */ 5671 bool kff=false; 5672 5673 /*output: */ 5674 ElementVector* pe=NULL; 5675 int gsize; 5676 int fsize; 5677 int* gglobaldoflist=NULL; 5678 int* flocaldoflist=NULL; 5679 int* fglobaldoflist=NULL; 5680 5681 /*retrieve some parameters: */ 5682 this->parameters->FindParam(&kff,KffEnum); 5683 5684 /*get number of dofs in sets g,f and s: */ 5685 gsize=this->GetNumberOfDofs(approximation,GsetEnum); 5686 if(kff)fsize=this->GetNumberOfDofs(approximation,FsetEnum); 5687 5688 /*get dof lists for f and s set: */ 5689 if(!kff){ 5690 gglobaldoflist=this->GetGlobalDofList(approximation,GsetEnum); 5691 } 5692 else{ 5693 flocaldoflist=this->GetLocalDofList(approximation,FsetEnum); 5694 fglobaldoflist=this->GetGlobalDofList(approximation,FsetEnum); 5695 } 5696 5697 /*constructor for ElementVector: */ 5698 if(!kff)pe=new ElementVector(gsize,gglobaldoflist); 5699 else pe=new ElementVector(gsize,flocaldoflist,fglobaldoflist,fsize); 5700 5701 /*Free ressources and return:*/ 5702 xfree((void**)&gglobaldoflist); 5703 xfree((void**)&flocaldoflist); 5704 xfree((void**)&fglobaldoflist); 5705 5706 return pe; 5707 } 5708 /*}}}*/ 5526 5709 /*FUNCTION Penta::ReduceMatrixStokes {{{1*/ 5527 5710 void Penta::ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp){ -
issm/trunk/src/c/objects/Elements/Penta.h
r5841 r5843 19 19 class Matpar; 20 20 class Tria; 21 class ElementMatrix; 22 class ElementVector; 21 23 22 24 #include "../../include/include.h" … … 150 152 void GetDofList(int** pdoflist,int approximation_enum,int setenum); 151 153 void GetDofList1(int* doflist); 154 int* GetLocalDofList(int approximation_enum,int setenum); 155 int* GetGlobalDofList(int approximation_enum,int setenum); 156 int GetNumberOfDofs(int approximation_enum,int setenum); 152 157 int GetElementType(void); 153 158 void GetParameterListOnVertices(double* pvalue,int enumtype); … … 184 189 bool IsOnShelf(void); 185 190 bool IsOnWater(void); 191 ElementMatrix* NewElementMatrix(int approximation); 192 ElementVector* NewElementVector(int approximation); 186 193 void ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp); 187 194 void ReduceVectorStokes(double* Pe_reduced, double* Ke_temp, double* Pe_temp); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r5840 r5843 5081 5081 } 5082 5082 /*}}}*/ 5083 /*FUNCTION Tria::GetInternalDofList {{{1*/ 5084 int* Tria::GetInternalDofList(int approximation_enum,int setenum){ 5085 5086 int i,j; 5087 int numberofdofs=0; 5088 int count=0; 5089 int count2=0; 5090 int ndof; 5091 int ngdof; 5092 5093 /*output: */ 5094 int* doflist=NULL; 5083 /*FUNCTION Tria::GetLocalDofList {{{1*/ 5084 int* Tria::GetLocalDofList(int approximation_enum,int setenum){ 5085 5086 int i,j,count,numdof,numgdof; 5087 int ndof_list[NUMVERTICES]; 5088 int ngdof_list_cumulative[NUMVERTICES]; 5089 int *doflist = NULL; 5090 5091 /*Get number of dofs per node, and total for this given set*/ 5092 numdof=0; 5093 numgdof=0; 5094 for(i=0;i<NUMVERTICES;i++){ 5095 5096 /*Cumulative list= number of dofs before node i*/ 5097 ngdof_list_cumulative[i]=numgdof; 5098 5099 /*Number of dofs for node i for given set and for the g set*/ 5100 ndof_list[i]=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 5101 numgdof +=nodes[i]->GetNumberOfDofs(approximation_enum,GsetEnum); 5102 numdof +=ndof_list[i]; 5103 } 5104 5105 if(numdof){ 5106 /*Allocate: */ 5107 doflist=(int*)xmalloc(numdof*sizeof(int)); 5108 5109 /*Populate: */ 5110 count=0; 5111 for(i=0;i<NUMVERTICES;i++){ 5112 nodes[i]->GetLocalDofList(&doflist[count],approximation_enum,setenum); 5113 count+=ndof_list[i]; 5114 } 5115 5116 /*We now have something like: [0 1 0 2 1 2]. Offset by gsize, to get something like: [0 1 2 4 6 7]:*/ 5117 count=0; 5118 for(i=0;i<NUMVERTICES;i++){ 5119 for(j=0;j<ndof_list[i];j++){ 5120 doflist[count+j]+=ngdof_list_cumulative[i]; 5121 } 5122 count+=ndof_list[i]; 5123 } 5124 } 5125 else doflist=NULL; 5126 5127 return doflist; 5128 } 5129 /*}}}*/ 5130 /*FUNCTION Tria::GetGlobalDofList {{{1*/ 5131 int* Tria::GetGlobalDofList(int approximation_enum,int setenum){ 5132 5133 int i,numdof,count; 5134 int ndof_list[NUMVERTICES]; 5135 int *doflist = NULL; 5095 5136 5096 5137 /*First, figure out size of doflist: */ 5138 numdof=0; 5097 5139 for(i=0;i<3;i++){ 5098 numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 5099 } 5100 5101 if(numberofdofs){ 5140 ndof_list[i]=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 5141 numdof+=ndof_list[i]; 5142 } 5143 5144 if(numdof){ 5102 5145 /*Allocate: */ 5103 doflist=(int*)xmalloc(num berofdofs*sizeof(int));5146 doflist=(int*)xmalloc(numdof*sizeof(int)); 5104 5147 5105 5148 /*Populate: */ 5106 5149 count=0; 5107 5150 for(i=0;i<3;i++){ 5108 nodes[i]->GetInternalDofList(doflist+count,approximation_enum,setenum); 5109 count+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 5110 } 5111 5112 /*We now have something like: [0 1 0 2 0 1]. Offset by gsize, to get something like: 5113 * [0 1 2 4 5 6]:*/ 5114 count=0; 5115 count2=0; 5116 for(i=0;i<3;i++){ 5117 ndof=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 5118 for(j=count;j<count+ndof;j++)doflist[j]+=count2; 5119 count+=ndof; 5120 count2+=nodes[i]->GetNumberOfDofs(approximation_enum,GsetEnum); 5121 } 5122 5123 } 5124 else doflist=NULL; 5125 5126 return doflist; 5127 5128 } 5129 /*}}}*/ 5130 /*FUNCTION Tria::GetExternalDofList {{{1*/ 5131 int* Tria::GetExternalDofList(int approximation_enum,int setenum){ 5132 5133 int i,j; 5134 int numberofdofs=0; 5135 int count=0; 5136 5137 /*output: */ 5138 int* doflist=NULL; 5139 5140 /*First, figure out size of doflist: */ 5141 for(i=0;i<3;i++){ 5142 numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 5143 } 5144 5145 if(numberofdofs){ 5146 /*Allocate: */ 5147 doflist=(int*)xmalloc(numberofdofs*sizeof(int)); 5148 5149 /*Populate: */ 5150 count=0; 5151 for(i=0;i<3;i++){ 5152 nodes[i]->GetDofList(doflist+count,approximation_enum,setenum); 5153 count+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 5151 nodes[i]->GetDofList(&doflist[count],approximation_enum,setenum); 5152 count+=ndof_list[i]; 5154 5153 } 5155 5154 } … … 5161 5160 /*FUNCTION Tria::GetNumberOfDofs {{{1*/ 5162 5161 int Tria::GetNumberOfDofs(int approximation_enum,int setenum){ 5163 5164 int i;5165 5162 5166 5163 /*output: */ 5167 5164 int numberofdofs=0; 5168 5165 5169 for(i =0;i<3;i++){5166 for(int i=0;i<NUMVERTICES;i++){ 5170 5167 numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum); 5171 5168 } … … 5773 5770 5774 5771 /*get dof lists for f and s set: */ 5775 gglobaldoflist=this->Get ExternalDofList(approximation,GsetEnum);5772 gglobaldoflist=this->GetGlobalDofList(approximation,GsetEnum); 5776 5773 if(kff){ 5777 flocaldoflist=this->Get InternalDofList(approximation,FsetEnum);5778 fglobaldoflist=this->Get ExternalDofList(approximation,FsetEnum);5779 slocaldoflist=this->Get InternalDofList(approximation,SsetEnum);5780 sglobaldoflist=this->Get ExternalDofList(approximation,SsetEnum);5774 flocaldoflist=this->GetLocalDofList(approximation,FsetEnum); 5775 fglobaldoflist=this->GetGlobalDofList(approximation,FsetEnum); 5776 slocaldoflist=this->GetLocalDofList(approximation,SsetEnum); 5777 sglobaldoflist=this->GetGlobalDofList(approximation,SsetEnum); 5781 5778 } 5782 5779 … … 5818 5815 /*get dof lists for f and s set: */ 5819 5816 if(!kff){ 5820 gglobaldoflist=this->Get ExternalDofList(approximation,GsetEnum);5817 gglobaldoflist=this->GetGlobalDofList(approximation,GsetEnum); 5821 5818 } 5822 5819 else{ 5823 flocaldoflist=this->Get InternalDofList(approximation,FsetEnum);5824 fglobaldoflist=this->Get ExternalDofList(approximation,FsetEnum);5820 flocaldoflist=this->GetLocalDofList(approximation,FsetEnum); 5821 fglobaldoflist=this->GetGlobalDofList(approximation,FsetEnum); 5825 5822 } 5826 5823 -
issm/trunk/src/c/objects/Elements/Tria.h
r5840 r5843 153 153 void CreatePVectorThermalSheet( Vec pg); 154 154 void CreatePVectorThermalShelf( Vec pg); 155 double 156 int 155 double GetArea(void); 156 int GetElementType(void); 157 157 void GetDofList(int** pdoflist,int approximation_enum,int setenum); 158 158 void GetDofList1(int* doflist); 159 int* GetInternalDofList(int approximation_enum,int setenum);160 int* GetExternalDofList(int approximation_enum,int setenum);161 int 162 void 163 void 164 void 159 int* GetLocalDofList(int approximation_enum,int setenum); 160 int* GetGlobalDofList(int approximation_enum,int setenum); 161 int GetNumberOfDofs(int approximation_enum,int setenum); 162 void GetParameterListOnVertices(double* pvalue,int enumtype); 163 void GetParameterListOnVertices(double* pvalue,int enumtype,double defaultvalue); 164 void GetParameterValue(double* pvalue,Node* node,int enumtype); 165 165 void GetSolutionFromInputsDiagnosticHoriz(Vec solution); 166 166 void GetSolutionFromInputsDiagnosticHutter(Vec solution); 167 void 167 void GetStrainRate2d(double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input); 168 168 void GradjDragStokes(Vec gradient); 169 169 void InputUpdateFromSolutionAdjointBalancedthickness( double* solution); -
issm/trunk/src/c/objects/Node.cpp
r5792 r5843 383 383 } 384 384 /*}}}*/ 385 /*FUNCTION Node::Get InternalDofList{{{1*/386 void Node::Get InternalDofList(int* outdoflist,int approximation_enum,int setenum){385 /*FUNCTION Node::GetLocalDofList{{{1*/ 386 void Node::GetLocalDofList(int* outdoflist,int approximation_enum,int setenum){ 387 387 int i; 388 388 int count=0; -
issm/trunk/src/c/objects/Node.h
r5772 r5843 81 81 int GetConnectivity(); 82 82 void GetDofList(int* poutdoflist,int approximation_enum,int setenum); 83 void Get InternalDofList(int* poutdoflist,int approximation_enum,int setenum);83 void GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum); 84 84 int GetDofList1(void); 85 85 double GetX();
Note:
See TracChangeset
for help on using the changeset viewer.