Changeset 5843


Ignore:
Timestamp:
09/16/10 11:55:33 (15 years ago)
Author:
Mathieu Morlighem
Message:

prepared Penta for Kff

Location:
issm/trunk/src/c/objects
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r5841 r5843  
    40774077}
    40784078/*}}}*/
     4079/*FUNCTION Penta::GetLocalDofList {{{1*/
     4080int*  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*/
     4127int* 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*/
     4157int 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/*}}}*/
    40794169/*FUNCTION Penta::GetParameterListOnVertices(double* pvalue,int enumtype) {{{1*/
    40804170void Penta::GetParameterListOnVertices(double* pvalue,int enumtype){
     
    55245614}
    55255615/*}}}*/
     5616/*FUNCTION Penta::NewElementMatrix{{{1*/
     5617ElementMatrix* 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*/
     5668ElementVector* 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/*}}}*/
    55265709/*FUNCTION Penta::ReduceMatrixStokes {{{1*/
    55275710void Penta::ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp){
  • issm/trunk/src/c/objects/Elements/Penta.h

    r5841 r5843  
    1919class Matpar;
    2020class Tria;
     21class ElementMatrix;
     22class ElementVector;
    2123
    2224#include "../../include/include.h"
     
    150152                void      GetDofList(int** pdoflist,int approximation_enum,int setenum);
    151153                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);
    152157                int     GetElementType(void);
    153158                void    GetParameterListOnVertices(double* pvalue,int enumtype);
     
    184189                bool    IsOnShelf(void);
    185190                bool    IsOnWater(void);
     191                ElementMatrix* NewElementMatrix(int approximation);
     192                ElementVector* NewElementVector(int approximation);
    186193                void      ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp);
    187194                void      ReduceVectorStokes(double* Pe_reduced, double* Ke_temp, double* Pe_temp);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r5840 r5843  
    50815081}
    50825082/*}}}*/
    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*/
     5084int*  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*/
     5131int* Tria::GetGlobalDofList(int approximation_enum,int setenum){
     5132
     5133        int  i,numdof,count;
     5134        int  ndof_list[NUMVERTICES];
     5135        int *doflist = NULL;
    50955136
    50965137        /*First, figure out size of doflist: */
     5138        numdof=0;
    50975139        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){
    51025145                /*Allocate: */
    5103                 doflist=(int*)xmalloc(numberofdofs*sizeof(int));
     5146                doflist=(int*)xmalloc(numdof*sizeof(int));
    51045147
    51055148                /*Populate: */
    51065149                count=0;
    51075150                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];
    51545153                }
    51555154        }
     
    51615160/*FUNCTION Tria::GetNumberOfDofs {{{1*/
    51625161int Tria::GetNumberOfDofs(int approximation_enum,int setenum){
    5163 
    5164         int i;
    51655162       
    51665163        /*output: */
    51675164        int numberofdofs=0;
    51685165
    5169         for(i=0;i<3;i++){
     5166        for(int i=0;i<NUMVERTICES;i++){
    51705167                numberofdofs+=nodes[i]->GetNumberOfDofs(approximation_enum,setenum);
    51715168        }
     
    57735770
    57745771        /*get dof lists for f and s set: */
    5775         gglobaldoflist=this->GetExternalDofList(approximation,GsetEnum);
     5772        gglobaldoflist=this->GetGlobalDofList(approximation,GsetEnum);
    57765773        if(kff){
    5777                 flocaldoflist=this->GetInternalDofList(approximation,FsetEnum);
    5778                 fglobaldoflist=this->GetExternalDofList(approximation,FsetEnum);
    5779                 slocaldoflist=this->GetInternalDofList(approximation,SsetEnum);
    5780                 sglobaldoflist=this->GetExternalDofList(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);
    57815778        }
    57825779
     
    58185815        /*get dof lists for f and s set: */
    58195816        if(!kff){
    5820                 gglobaldoflist=this->GetExternalDofList(approximation,GsetEnum);
     5817                gglobaldoflist=this->GetGlobalDofList(approximation,GsetEnum);
    58215818        }
    58225819        else{
    5823                 flocaldoflist=this->GetInternalDofList(approximation,FsetEnum);
    5824                 fglobaldoflist=this->GetExternalDofList(approximation,FsetEnum);
     5820                flocaldoflist=this->GetLocalDofList(approximation,FsetEnum);
     5821                fglobaldoflist=this->GetGlobalDofList(approximation,FsetEnum);
    58255822        }
    58265823
  • issm/trunk/src/c/objects/Elements/Tria.h

    r5840 r5843  
    153153                void      CreatePVectorThermalSheet( Vec pg);
    154154                void      CreatePVectorThermalShelf( Vec pg);
    155                 double    GetArea(void);
    156                 int       GetElementType(void);
     155                double  GetArea(void);
     156                int     GetElementType(void);
    157157                void      GetDofList(int** pdoflist,int approximation_enum,int setenum);
    158158                void      GetDofList1(int* doflist);
    159                 int*      GetInternalDofList(int approximation_enum,int setenum);
    160                 int*      GetExternalDofList(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);
     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);
    165165                void      GetSolutionFromInputsDiagnosticHoriz(Vec solution);
    166166                void      GetSolutionFromInputsDiagnosticHutter(Vec solution);
    167                 void      GetStrainRate2d(double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
     167                void    GetStrainRate2d(double* epsilon,double* xyz_list, GaussTria* gauss, Input* vx_input, Input* vy_input);
    168168                void      GradjDragStokes(Vec gradient);
    169169                void      InputUpdateFromSolutionAdjointBalancedthickness( double* solution);
  • issm/trunk/src/c/objects/Node.cpp

    r5792 r5843  
    383383}
    384384/*}}}*/
    385 /*FUNCTION Node::GetInternalDofList{{{1*/
    386 void  Node::GetInternalDofList(int* outdoflist,int approximation_enum,int setenum){
     385/*FUNCTION Node::GetLocalDofList{{{1*/
     386void  Node::GetLocalDofList(int* outdoflist,int approximation_enum,int setenum){
    387387        int i;
    388388        int count=0;
  • issm/trunk/src/c/objects/Node.h

    r5772 r5843  
    8181                int   GetConnectivity();
    8282                void  GetDofList(int* poutdoflist,int approximation_enum,int setenum);
    83                 void  GetInternalDofList(int* poutdoflist,int approximation_enum,int setenum);
     83                void  GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum);
    8484                int   GetDofList1(void);
    8585                double GetX();
Note: See TracChangeset for help on using the changeset viewer.