Changeset 14435


Ignore:
Timestamp:
03/05/13 19:37:53 (12 years ago)
Author:
Mathieu Morlighem
Message:

NEW: CreateDVector is now independent of CreateKMatrix. It is more consistent

Location:
issm/trunk-jpl/src/c/classes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r14194 r14435  
    826826                for (i=0;i<this->elements->Size();i++){
    827827                        element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i));
    828                         element->CreateKMatrix(Kff_temp,NULL,NULL);
     828                        element->CreateKMatrix(Kff_temp,NULL);
    829829                }
    830830                for (i=0;i<this->loads->Size();i++){
     
    845845        for (i=0;i<this->elements->Size();i++){
    846846                element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i));
    847                 element->CreateKMatrix(Kff,Kfs,df);
     847                element->CreateKMatrix(Kff,Kfs);
    848848        }
    849849        for (i=0;i<this->loads->Size();i++){
     
    872872                        if(load->InAnalysis(configuration_type)) load->PenaltyCreatePVector(pf,kmax);
    873873                }
     874        }
     875
     876        /*Create dof vector for stiffness matrix preconditioning*/
     877        for (i=0;i<this->elements->Size();i++){
     878                element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i));
     879                element->CreateDVector(df);
    874880        }
    875881
  • issm/trunk-jpl/src/c/classes/matrix/ElementVector.cpp

    r14434 r14435  
    190190        IssmDouble* localvalues=NULL;
    191191
    192         if(this->fsize && pf){
     192        if(this->fsize){
    193193                /*first, retrieve values that are in the f-set from the g-set values vector: */
    194194                localvalues=xNew<IssmDouble>(this->fsize);
  • issm/trunk-jpl/src/c/classes/objects/Elements/Element.h

    r14378 r14435  
    3030                virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0;
    3131                virtual void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum)=0;
    32                 virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs,Vector<IssmDouble>* df)=0;
     32                virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs)=0;
     33                virtual void   CreateDVector(Vector<IssmDouble>* df)=0;
    3334                virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
    3435                virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
  • issm/trunk-jpl/src/c/classes/objects/Elements/Penta.cpp

    r14378 r14435  
    405405/*}}}*/
    406406/*FUNCTION Penta::CreateKMatrix {{{*/
    407 void  Penta::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,Vector<IssmDouble>* df){
     407void  Penta::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
    408408
    409409        /*retrieve parameters: */
    410410        ElementMatrix* Ke=NULL;
    411         ElementVector* De=NULL;
    412411        int analysis_type;
    413412        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
     
    424423                #ifdef _HAVE_DIAGNOSTIC_
    425424                case DiagnosticHorizAnalysisEnum:
    426                         Ke=CreateKMatrixDiagnosticHoriz(); De=CreateDVectorDiagnosticHoriz();
     425                        Ke=CreateKMatrixDiagnosticHoriz();
    427426                        break;
    428427                case AdjointHorizAnalysisEnum:
     
    467466                delete Ke;
    468467        }
     468}
     469/*}}}*/
     470/*FUNCTION Penta::CreateKMatrixPrognostic {{{*/
     471ElementMatrix* Penta::CreateKMatrixPrognostic(void){
     472
     473        if (!IsOnBed()) return NULL;
     474
     475        /*Depth Averaging Vx and Vy*/
     476        this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
     477        this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
     478
     479        Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria.
     480        ElementMatrix* Ke=tria->CreateKMatrixPrognostic();
     481        delete tria->material; delete tria;
     482
     483        /*Delete Vx and Vy averaged*/
     484        this->inputs->DeleteInput(VxAverageEnum);
     485        this->inputs->DeleteInput(VyAverageEnum);
     486
     487        /*clean up and return*/
     488        return Ke;
     489}
     490/*}}}*/
     491/*FUNCTION Penta::CreateBasalMassMatrix{{{*/
     492ElementMatrix* Penta::CreateBasalMassMatrix(void){
     493
     494        if (!IsOnBed()) return NULL;
     495
     496        Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria.
     497        ElementMatrix* Ke=tria->CreateMassMatrix();
     498        delete tria->material; delete tria;
     499
     500        /*clean up and return*/
     501        return Ke;
     502}
     503/*}}}*/
     504/*FUNCTION Penta::CreateDVector {{{*/
     505void  Penta::CreateDVector(Vector<IssmDouble>* df){
     506
     507        /*retrieve parameters: */
     508        ElementMatrix* Ke=NULL;
     509        ElementVector* De=NULL;
     510        int analysis_type;
     511        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
     512
     513        /*Checks in debugging {{{*/
     514        _assert_(this->nodes && this->material && this->matpar && this->verticalneighbors && this->parameters && this->inputs);
     515        /*}}}*/
     516
     517        switch(analysis_type){
     518                #ifdef _HAVE_DIAGNOSTIC_
     519                case DiagnosticHorizAnalysisEnum:
     520                        De=CreateDVectorDiagnosticHoriz();
     521                        break;
     522                #endif
     523        }
     524
    469525        /*Add to global Vector*/
    470526        if(De){
     
    472528                delete De;
    473529        }
    474 }
    475 /*}}}*/
    476 /*FUNCTION Penta::CreateKMatrixPrognostic {{{*/
    477 ElementMatrix* Penta::CreateKMatrixPrognostic(void){
    478 
    479         if (!IsOnBed()) return NULL;
    480 
    481         /*Depth Averaging Vx and Vy*/
    482         this->InputDepthAverageAtBase(VxEnum,VxAverageEnum);
    483         this->InputDepthAverageAtBase(VyEnum,VyAverageEnum);
    484 
    485         Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria.
    486         ElementMatrix* Ke=tria->CreateKMatrixPrognostic();
    487         delete tria->material; delete tria;
    488 
    489         /*Delete Vx and Vy averaged*/
    490         this->inputs->DeleteInput(VxAverageEnum);
    491         this->inputs->DeleteInput(VyAverageEnum);
    492 
    493         /*clean up and return*/
    494         return Ke;
    495 }
    496 /*}}}*/
    497 /*FUNCTION Penta::CreateBasalMassMatrix{{{*/
    498 ElementMatrix* Penta::CreateBasalMassMatrix(void){
    499 
    500         if (!IsOnBed()) return NULL;
    501 
    502         Tria* tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria.
    503         ElementMatrix* Ke=tria->CreateMassMatrix();
    504         delete tria->material; delete tria;
    505 
    506         /*clean up and return*/
    507         return Ke;
    508530}
    509531/*}}}*/
  • issm/trunk-jpl/src/c/classes/objects/Elements/Penta.h

    r14378 r14435  
    8181                void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    8282                void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
    83                 void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,Vector<IssmDouble>* df);
     83                void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
     84                void   CreateDVector(Vector<IssmDouble>* df);
    8485                void   CreatePVector(Vector<IssmDouble>* pf);
    8586                void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
  • issm/trunk-jpl/src/c/classes/objects/Elements/Tria.cpp

    r14423 r14435  
    214214/*}}}*/
    215215/*FUNCTION Tria::CreateKMatrix {{{*/
    216 void  Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,Vector<IssmDouble>* df){
     216void  Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
    217217
    218218        /*retreive parameters: */
     
    561561        delete gauss;
    562562        return Ke;
     563}
     564/*}}}*/
     565/*FUNCTION Tria::CreateDVector {{{*/
     566void  Tria::CreateDVector(Vector<IssmDouble>* df){
     567
     568        /*Nothing done yet*/
    563569}
    564570/*}}}*/
  • issm/trunk-jpl/src/c/classes/objects/Elements/Tria.h

    r14378 r14435  
    7777                void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    7878                void   SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
    79                 void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,Vector<IssmDouble>* df);
     79                void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
     80                void   CreateDVector(Vector<IssmDouble>* df);
    8081                void   CreatePVector(Vector<IssmDouble>* pf);
    8182                void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
Note: See TracChangeset for help on using the changeset viewer.