Ignore:
Timestamp:
09/24/10 10:04:01 (14 years ago)
Author:
Eric.Larour
Message:

Commit de la mort qui tue: new way of running petsc,
where options are specified using a @petscoptions class,
which acts in a different way for each analysis_type, with
of course some defaults. This allows to change the petsc
solver on a per analysis basis.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/mex/Solver/Solver.cpp

    r5903 r6014  
    1212        Vec         uf0           = NULL;
    1313        Vec         uf            = NULL;
    14         char       *petscrc = NULL;
    1514        Parameters *parameters    = NULL;
    1615        int         verbose;
    17                
     16        int         analysis_type;
     17        char        option[100];
     18        PetscTruth  flag;
     19       
    1820        /*Matlab solver: */
    1921        mxArray* array[2];
     
    2426        /*checks on arguments on the matlab side: */
    2527        CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&SolverUsage);
     28       
     29        /*parameters: */
     30        FetchParams(&parameters,PARAMETERS);
     31        parameters->FindParam(&verbose,VerboseEnum);
    2632
    27         /*First, check solver string: */
    28         FetchParams(&parameters,PARAMETERS);
    29         parameters->FindParam(&petscrc,PetscRcEnum);
    30         int verbose; parameters->FindParam(&verbose,VerboseEnum);
     33        /*In serial mode, we have no set any petsc options, do it now: */
     34        #ifdef _SERIAL_
     35        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
     36        PetscOptionsFromAnalysis(parameters,analysis_type);
     37        #endif
    3138       
     39        /*Retrieve solver type: */
     40        PetscOptionsGetString(PETSC_NULL,"-ksp_type",&option[0],100,&flag);
     41
    3242        /*Fetch rest of data only if not running the matlab solver: */
    33         if (strcmp(petscrc,matlabstring)!=0){
     43        if (strcmp(option,"matlab")!=0){
     44       
    3445                /*Input datasets: */
    3546                FetchData(&Kff,KFF);
    3647                FetchData(&pf,PF);
    3748                FetchData(&uf0,UF0);
    38                 /*Petsc solver: */
     49
     50                /*Core module: */
    3951                Solverx(&uf, Kff, pf, uf0, parameters);
     52
    4053                /*Write output*/
    4154                WriteData(UF,uf);
     
    5568        VecFree(&uf);
    5669        delete parameters;
    57         xfree((void**)&petscrc);
    5870
    5971        MODULEEND();
     72
    6073}
    6174
Note: See TracChangeset for help on using the changeset viewer.