Ignore:
Timestamp:
09/19/12 09:32:34 (12 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 13393

Location:
issm/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk

  • issm/trunk/src

  • issm/trunk/src/c/modules/Solverx/Solverx.cpp

    r12706 r13395  
    1414#endif
    1515
    16 void    Solverx(Vector** puf, Matrix* Kff, Vector* pf, Vector* uf0,Vector* df, Parameters* parameters){
     16void    Solverx(Vector<IssmDouble>** puf, Matrix<IssmDouble>* Kff, Vector<IssmDouble>* pf, Vector<IssmDouble>* uf0,Vector<IssmDouble>* df, Parameters* parameters){
    1717
    1818        /*Intermediary: */
     
    2020
    2121        /*output: */
    22         Vector *uf=NULL;
     22        Vector<IssmDouble> *uf=NULL;
    2323
    2424        /*In debugging mode, check that stiffness matrix and load vectors are not NULL (they can be empty)*/
     
    2626        _assert_(pf);
    2727
    28         #ifdef _HAVE_PETSC_
    29                 Vec uf0_vector = NULL;
    30                 Vec df_vector  = NULL;
    31                 Vec uf_vector  = NULL;
    32                 if(uf0) uf0_vector = uf0->vector;
    33                 if(df)  df_vector  = df->vector;
     28        /*Initialize vector: */
     29        uf=new Vector<IssmDouble>();
    3430
    35                 /*In serial mode, the Petsc Options database has not been initialized properly: */
     31        /*According to matrix type, use specific solvers: */
     32        switch(Kff->type){
     33                #ifdef _HAVE_PETSC_
     34                case PetscMatType:{
     35                        PetscVec* uf0_vector = NULL;
     36                        PetscVec* df_vector  = NULL;
     37                        if(uf0) uf0_vector = uf0->pvector;
     38                        if(df)  df_vector  = df->pvector;
     39                        SolverxPetsc(&uf->pvector,Kff->pmatrix,pf->pvector,uf0_vector,df_vector,parameters);
     40                        break;}
     41                #endif
     42                case SeqMatType:{
     43                        SolverxSeq(&uf->svector,Kff->smatrix,pf->svector,parameters);
     44                        break;}
     45                default:
     46                          _error_("Matrix type: " << Kff->type << " not supported yet!");
     47        }
    3648
    37                 SolverxPetsc(&uf_vector,Kff->matrix,pf->vector,uf0_vector,df_vector,parameters);
    38 
    39                 /*Create vector out of petsc vector: */
    40                 uf=new Vector(uf_vector);
    41 
    42                 /*Free ressources: */
    43                 VecFree(&uf_vector);
    44         #else
    45                 #ifdef _HAVE_GSL_
    46                 SeqVec* uf_vector=NULL;
    47 
    48                 SolverxGsl(&uf_vector,Kff->matrix,pf->vector);
    49 
    50                 /*Create vector out of SeqVec vector: */
    51                 uf=new Vector(uf_vector);
    52 
    53                 /*Free ressources: */
    54                 delete uf_vector;
    55 
    56                 #else
    57                         _error2_("GSL support not compiled in!");
    58                 #endif
    59         #endif
    60 
    61         /*Assign output pointers: */
     49        /*Assign output pointers:*/
    6250        *puf=uf;
    6351}
Note: See TracChangeset for help on using the changeset viewer.