source: issm/oecreview/Archive/14312-15392/ISSM-14631-14632.diff

Last change on this file was 15393, checked in by Mathieu Morlighem, 12 years ago

NEW: adding Archive/14312-15392 for oecreview

File size: 7.3 KB
  • ../trunk-jpl/src/c/shared/Numerics/PetscOptionsFromAnalysis.cpp

     
    1 /*!\file:  PetscOptionsFromAnalysis.cpp
    2  * \brief: change petsc options using analysis type and parameters
    3  */
    4 
    5 #ifdef HAVE_CONFIG_H
    6         #include <config.h>
    7 #else
    8 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    9 #endif
    10 
    11 #include "../../classes/objects/objects.h"
    12 #include "../../Container/Parameters.h"
    13 #include "../../toolkits/toolkits.h"
    14 
    15 void PetscOptionsFromAnalysis(Parameters* parameters,int analysis_type){
    16 
    17         /*intermediary: */
    18         char* options=NULL;
    19 
    20         /*Recover first the options string for this analysis: */
    21         options=OptionsFromAnalysis(parameters,analysis_type);
    22 
    23         /*now, reset the options database with this string. Taken from petsc/install/src/sys/objects/pinit.c. This
    24          *capability is not covered by Petsc!: */
    25 
    26         #if _PETSC_MAJOR_ == 2
    27         PetscOptionsDestroy();
    28         PetscOptionsCreate();
    29         //PetscOptionsCheckInitial_Private();
    30         //PetscOptionsCheckInitial_Components();
    31         PetscOptionsSetFromOptions();
    32         PetscOptionsInsertMultipleString(options); //our patch
    33         #else
    34         PetscOptionsSetFromOptions();
    35         PetscOptionsClear();
    36         //PetscOptionsSetFromOptions();
    37         PetscOptionsInsertMultipleString(options); //our patch
    38         #endif
    39 
    40         /*Free ressources:*/
    41         xDelete<char>(options);
    42 }
  • ../trunk-jpl/src/c/shared/Numerics/ToolkitsOptionsFromAnalysis.cpp

     
     1/*!\file:  ToolkitsOptionsFromAnalysis.cpp
     2 * \brief: this is mainly for the case where we run our toolkits using petsc. In this case, we need to
     3 * plug our toolkits options directly into the petsc options database. This is the case for each analysis type
     4 * and parameters
     5 */
     6
     7#ifdef HAVE_CONFIG_H
     8        #include <config.h>
     9#else
     10#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
     11#endif
     12
     13#include "../../classes/objects/objects.h"
     14#include "../../Container/Parameters.h"
     15#include "../../toolkits/toolkits.h"
     16
     17void ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type){
     18
     19        /*intermediary: */
     20        char* options=NULL;
     21
     22        /*Recover first the options string for this analysis: */
     23        options=OptionsFromAnalysis(parameters,analysis_type);
     24
     25        /*now, reset the petsc options database with this string. Taken from petsc/install/src/sys/objects/pinit.c. This
     26         *capability is not covered by Petsc!: */
     27
     28        #ifdef _HAVE_PETSC_
     29
     30        #if _PETSC_MAJOR_ == 2
     31        PetscOptionsDestroy();
     32        PetscOptionsCreate();
     33        //PetscOptionsCheckInitial_Private();
     34        //PetscOptionsCheckInitial_Components();
     35        PetscOptionsSetFromOptions();
     36        PetscOptionsInsertMultipleString(options); //our patch
     37        #else
     38        PetscOptionsSetFromOptions();
     39        PetscOptionsClear();
     40        //PetscOptionsSetFromOptions();
     41        PetscOptionsInsertMultipleString(options); //our patch
     42        #endif
     43
     44        #endif
     45
     46        /*Free ressources:*/
     47        xDelete<char>(options);
     48}
  • ../trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp

     
    2929        int     i;
    3030
    3131        numanalyses=0;
    32         parameters->FindParam(&strings,&numanalyses,PetscOptionsStringsEnum);
     32        parameters->FindParam(&strings,&numanalyses,ToolkitsOptionsStringsEnum);
    3333
    34         parameters->FindParam(&analyses,&dummy,PetscOptionsAnalysesEnum);
     34        parameters->FindParam(&analyses,&dummy,ToolkitsOptionsAnalysesEnum);
    3535
    3636        if(numanalyses==0)return NULL; //we did not find petsc options, don't bother.
    3737
  • ../trunk-jpl/src/c/shared/Numerics/numerics.h

     
    3030char       *OptionsFromAnalysis(Parameters *parameters,int analysis_type);
    3131void        XZvectorsToCoordinateSystem(IssmDouble *T,IssmDouble*xzvectors);
    3232int         cubic(IssmDouble a, IssmDouble b, IssmDouble c, IssmDouble d, double X[3], int *num);
    33 #ifdef _HAVE_PETSC_
    34 void   PetscOptionsFromAnalysis(Parameters* parameters,int analysis_type);
    35 #endif
     33void        ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type);
    3634
    3735#endif //ifndef _NUMERICS_H_
  • ../trunk-jpl/src/c/modules/modules.h

     
    6868#include "./SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h"
    6969#include "./SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h"
    7070#include "./ModelProcessorx/ModelProcessorx.h"
    71 #include "./ParsePetscOptionsx/ParsePetscOptionsx.h"
     71#include "./ParseToolkitsOptionsx/ParseToolkitsOptionsx.h"
    7272#include "./NodalValuex/NodalValuex.h"
    7373#include "./NodeConnectivityx/NodeConnectivityx.h"
    7474#include "./NodesDofx/NodesDofx.h"
  • ../trunk-jpl/src/c/Makefile.am

     
    197197                                        ./shared/Numerics/XZvectorsToCoordinateSystem.cpp\
    198198                                        ./shared/Numerics/UnitConversion.cpp\
    199199                                        ./shared/Numerics/OptionsFromAnalysis.cpp\
     200                                        ./shared/Numerics/ToolkitsOptionsFromAnalysis.cpp\
    200201                                        ./shared/Exceptions/exceptions.h\
    201202                                        ./shared/Exceptions/Exceptions.cpp\
    202203                                        ./shared/Exceptions/exprintf.cpp\
     
    727728                                        ./toolkits/petsc/objects/PetscVec.h\
    728729                                        ./toolkits/petsc/objects/PetscVec.cpp\
    729730                                        ./toolkits/petsc/petscincludes.h\
    730                                         ./shared/Numerics/PetscOptionsFromAnalysis.cpp\
    731731                                        ./modules/Solverx/SolverxPetsc.cpp\
    732732                                        ./modules/Solverx/DofTypesToIndexSet.cpp
    733733
  • ../trunk-jpl/src/c/classes/FemModel.cpp

     
    269269        this->nodes->SetCurrentConfiguration(elements,loads, nodes,vertices, materials,parameters);
    270270        this->loads->SetCurrentConfiguration(elements, loads, nodes,vertices, materials,parameters);
    271271
    272         #ifdef _HAVE_PETSC_
    273         /*take care of petsc options, that depend on this analysis type (present only after model processor)*/
    274         if(this->parameters->Exist(PetscOptionsStringsEnum)){
    275                 PetscOptionsFromAnalysis(this->parameters,analysis_type);
    276                 if(VerboseSolver()) _pprintLine_("      petsc Options set for analysis type: " << EnumToStringx(analysis_type));
     272        /*take care of toolkits options, that depend on this analysis type (present only after model processor)*/
     273        if(this->parameters->Exist(ToolkitsOptionsStringsEnum)){
     274                ToolkitsOptionsFromAnalysis(this->parameters,analysis_type);
     275                if(VerboseSolver()) _pprintLine_("      toolkits Options set for analysis type: " << EnumToStringx(analysis_type));
    277276        }
    278         #endif
    279277
    280278}
    281279/*}}}*/
Note: See TracBrowser for help on using the repository browser.