Changeset 12018


Ignore:
Timestamp:
04/16/12 19:43:13 (13 years ago)
Author:
Eric.Larour
Message:

Taking out more SERIAL protected code

Location:
issm/trunk-jpl/src/c
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/io/PrintfFunction.cpp

    r11934 r12018  
    88#include "../shared/shared.h"
    99#include "../include/include.h"
    10 
    11 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    12 #include "mex.h"
    13 #endif
    1410
    1511int PrintfFunction(const char* format,...){
     
    5349
    5450        /*Ok, if we are running in parallel, get node 0 to print*/
    55 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    56         mexPrintf(buffer);
    57 #else
    5851        if(my_rank==0)printf(buffer);
    59 #endif
    6052
    6153        /*Clean up and return*/
  • issm/trunk-jpl/src/c/modules/Solverx/Solverx.cpp

    r11760 r12018  
    3434
    3535                /*In serial mode, the Petsc Options database has not been initialized properly: */
    36                 #ifdef _SERIAL_
    37                 parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    38                 PetscOptionsFromAnalysis(parameters,analysis_type);
    39                 #endif
    4036
    4137                SolverxPetsc(&uf_vector,Kff->matrix,pf->vector,uf0_vector,df_vector,parameters);
  • issm/trunk-jpl/src/c/modules/Solverx/SolverxPetsc.cpp

    r12016 r12018  
    7878        PetscOptionsDetermineSolverType(&solver_type);
    7979
    80         /*In serial mode, the matrices have been loaded as MPIAIJ or AIJ matrices.
    81          We need to convert them if we are going to run the solvers successfully: */
    82         #ifdef _SERIAL_
    83         #if _PETSC_MAJOR_ == 2
    84         if (solver_type==MUMPSPACKAGE_LU){
    85                 /*Convert Kff to MATTAIJMUMPS: */
    86                 MatConvert(Kff,MATAIJMUMPS,MAT_REUSE_MATRIX,&Kff);
    87         }
    88         if (solver_type==MUMPSPACKAGE_CHOL){
    89                 /*Convert Kff to MATTSBAIJMUMPS: */
    90                 MatConvert(Kff,MATSBAIJMUMPS,MAT_REUSE_MATRIX,&Kff);
    91         }
    92         if (solver_type==SPOOLESPACKAGE_LU){
    93                 /*Convert Kff to MATTSBAIJMUMPS: */
    94                 MatConvert(Kff,MATAIJSPOOLES,MAT_REUSE_MATRIX,&Kff);
    95         }
    96         if (solver_type==SPOOLESPACKAGE_CHOL){
    97                 /*Convert Kff to MATTSBAIJMUMPS: */
    98                 MatConvert(Kff,MATSBAIJSPOOLES,MAT_REUSE_MATRIX,&Kff);
    99         }
    100         if (solver_type==SUPERLUDISTPACKAGE){
    101                 /*Convert Kff to MATTSBAIJMUMPS: */
    102                 MatConvert(Kff,MATSUPERLU_DIST,MAT_REUSE_MATRIX,&Kff);
    103         }
    104         if (solver_type==StokesSolverEnum){
    105                 _error_("Petsc 2 does not support multi-physics solvers");
    106         }
    107         #endif
    108         #endif
    10980        /*}}}*/
    11081        /*Check the solver is available: {{{1*/
  • issm/trunk-jpl/src/c/objects/Inputs/DoubleInput.cpp

    r12014 r12018  
    108108/*FUNCTION DoubleInput::GetInputValue(bool* pvalue) {{{1*/
    109109void DoubleInput::GetInputValue(bool* pvalue){
    110 #ifdef _SERIAL_
    111         *pvalue=(bool)value;
    112 #else
    113110        _error_("Double input of enum %s cannot return a boolean",EnumToStringx(enum_type));
    114 #endif
    115111
    116112}
     
    118114/*FUNCTION DoubleInput::GetInputValue(int* pvalue){{{1*/
    119115void DoubleInput::GetInputValue(int* pvalue){
    120 #ifdef _SERIAL_
    121         *pvalue=(int)value;
    122 #else
    123116        _error_("Double input of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));
    124 #endif
    125117
    126118}
  • issm/trunk-jpl/src/c/objects/Params/DoubleMatParam.cpp

    r12014 r12018  
    109109/*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/
    110110void  DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){
    111 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    112         int* output=NULL;
    113         int  i;
    114 
    115         output=(int*)xmalloc((int)(M*N*sizeof(int)));
    116         for(i=0;i<M*N;i++) output[i]=(int)value[i];
    117 
    118         /*Assign output pointers:*/
    119         if(pM) *pM=M;
    120         if(pN) *pN=N;
    121         *pintarray=output;
    122 #else
    123111        _error_("DoubleMat of enum %i (%s) cannot return an array of int",enum_type,EnumToStringx(enum_type));
    124 #endif
    125112}
    126113/*}}}*/
  • issm/trunk-jpl/src/c/objects/Params/DoubleParam.cpp

    r12014 r12018  
    8282/*FUNCTION DoubleParam::GetParameterValue(int* pinteger){{{1*/
    8383void DoubleParam::GetParameterValue(int* pinteger){
    84 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    85         *pinteger=(int)value;
    86 #else
    8784        _error_("Double param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type));
    88 #endif
    8985}
    9086/*}}}*/
    9187/*FUNCTION DoubleParam::GetParameterValue(bool* pbool){{{1*/
    9288void DoubleParam::GetParameterValue(bool* pbool){
    93 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    94 
    95         /*If debugging mode, cheeck that the double is 0 or 1*/
    96         _assert_(value==0 || value==1);
    97         *pbool=(bool)value;
    98 
    99 #else
    10089        _error_("Double param of enum %i (%s) cannot return an bool",enum_type,EnumToStringx(enum_type));
    101 #endif
    10290}
    10391/*}}}*/
    10492/*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM){{{1*/
    10593void DoubleParam::GetParameterValue(int** pintarray,int* pM){
    106 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    107         int* output=NULL;
    108 
    109         output=(int*)xmalloc(1*sizeof(int));
    110         *output=(int)value;
    111 
    112         /*Assign output pointers:*/
    113         if(pM) *pM=1;
    114         *pintarray=output;
    115 #else
    11694        _error_("Double param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));
    117 #endif
    11895}
    11996/*}}}*/
    12097/*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/
    12198void DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){
    122 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    123         int* output=NULL;
    124 
    125         output=(int*)xmalloc(1*sizeof(int));
    126         *output=(int)value;
    127 
    128         /*Assign output pointers:*/
    129         if(pM) *pM=1;
    130         if(pN) *pN=1;
    131         *pintarray=output;
    132 #else
    13399        _error_("Double param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type));
    134 #endif
    135100}
    136101/*}}}*/
    137102/*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM){{{1*/
    138103void DoubleParam::GetParameterValue(double** pdoublearray,int* pM){
    139 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    140         double* output=NULL;
    141 
    142         output=(double*)xmalloc(1*sizeof(double));
    143         *output=(double)value;
    144 
    145         /*Assign output podoubleers:*/
    146         if(pM) *pM=1;
    147         *pdoublearray=output;
    148 #else
    149104        _error_("Double param of enum %i (%s) cannot return an array of double",enum_type,EnumToStringx(enum_type));
    150 #endif
    151105}
    152106/*}}}*/
    153107/*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){{{1*/
    154108void DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){
    155 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    156         double* output=NULL;
    157 
    158         output=(double*)xmalloc(1*sizeof(double));
    159         *output=(double)value;
    160 
    161         /*Assign output podoubleers:*/
    162         if(pM) *pM=1;
    163         if(pN) *pN=1;
    164         *pdoublearray=output;
    165 #else
    166109        _error_("Double param of enum %i (%s) cannot return an array of double",enum_type,EnumToStringx(enum_type));
    167 #endif
    168110}
    169111/*}}}*/
  • issm/trunk-jpl/src/c/objects/Params/DoubleVecParam.cpp

    r12014 r12018  
    124124/*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{1*/
    125125void  DoubleVecParam::GetParameterValue(int** pintarray,int* pM){
    126 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    127         int* output=NULL;
    128         int i;
    129 
    130         /*Cast values into integers*/
    131         output=(int*)xmalloc(M*sizeof(int));
    132         for(i=0;i<M;i++) output[i]=(int)values[i];
    133 
    134         /*Assign output pointers:*/
    135         if(pM) *pM=M;
    136         *pintarray=output;
    137 #else
    138126        _error_("DoubleVec param of enum %i (%s) cannot return an array of int",enum_type,EnumToStringx(enum_type));
    139 #endif
    140127}
    141128/*}}}*/
  • issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp

    r11861 r12018  
    1111#include "../shared.h"
    1212#include "../../include/include.h"
    13 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    14 #include "mex.h"
    15 #endif
    1613
    1714ErrorException::ErrorException(const string &what_arg){
     
    4542        }
    4643        else{
    47                 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    48                         mexErrMsgTxt(exprintf("\n??? Error using ==> %s at %i\n%s error message: %s\n",
    49                                                         file_name.c_str(),file_line,function_name.c_str(),what()));
    50                 #else
    51                         printf("\n[%i] ??? Error using ==> %s:%i\n",my_rank,file_name.c_str(),file_line);
    52                         printf("[%i] %s error message: %s\n\n",my_rank,function_name.c_str(),what());
    53                 #endif
     44                printf("\n[%i] ??? Error using ==> %s:%i\n",my_rank,file_name.c_str(),file_line);
     45                printf("[%i] %s error message: %s\n\n",my_rank,function_name.c_str(),what());
    5446        }
    5547        return;
  • issm/trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp

    r11861 r12018  
    3030        parameters->FindParam(&strings,&numanalyses,PetscOptionsStringsEnum);
    3131
    32         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_) //do not take this away, because ISSM loads analyses as a Double Param instead of a DoubleVec Param  when running with only 1 analysis
    33         if(numanalyses==1){ analyses=(double*)xmalloc(1*sizeof(double)); parameters->FindParam(analyses,PetscOptionsAnalysesEnum);
    34         }
    35         else parameters->FindParam(&analyses,&dummy,PetscOptionsAnalysesEnum);
    36         #else
    3732        parameters->FindParam(&analyses,&dummy,PetscOptionsAnalysesEnum);
    38         #endif
    3933
    4034        if(numanalyses==0)return NULL; //we did not find petsc options, don't bother.
  • issm/trunk-jpl/src/c/shared/Numerics/Synchronize.sh

    r11402 r12018  
    2929#include "../../include/macros.h"
    3030#include "../Exceptions/exceptions.h"
    31 #ifdef _SERIAL_
    32 #include <mex.h>
    33 #endif
    3431/*}}}*/
    3532
     
    140137        if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level);
    141138
    142 #ifdef _SERIAL_
    143 
    144         mxArray* output=NULL;
    145         mxArray* input=NULL;
    146         input=mxCreateDoubleScalar((double)level);
    147 
    148         mexCallMATLAB(0,&output,1,&input,"SetVerbosityLevel");
    149 #else
    150 
    151139        verbositylevel = level;
    152140
    153 #endif
    154141}/*}}}*/
    155142/*FUNCTION GetVerbosityLevel {{{*/
    156143int  GetVerbosityLevel(void){
    157 #ifdef _SERIAL_
    158 
    159         mxArray* output=NULL;
    160         mxArray* input=NULL;
    161         double   level;
    162 
    163         mexCallMATLAB(1,&output,0,&input,"GetVerbosityLevel");
    164         level=mxGetScalar(output);
    165 
    166         verbositylevel = (int)level;
    167         return verbositylevel;
    168 
    169 #else
    170 
    171144        _assert_(verbositylevel>=0);
    172145        return verbositylevel;
    173 
    174 #endif
    175146}/*}}}*/
    176147END
  • issm/trunk-jpl/src/c/shared/Numerics/Verbosity.cpp

    r12011 r12018  
    1818#include "../../include/macros.h"
    1919#include "../Exceptions/exceptions.h"
    20 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    21 #include <mex.h>
    22 #endif
    2320/*}}}*/
    2421
  • issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h

    r12011 r12018  
    1515
    1616#include "../toolkitsenums.h"
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include "mex.h"
    20 #endif
    2117
    2218/*}}}*/
  • issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h

    r12011 r12018  
    1515
    1616#include "../toolkitsenums.h"
    17 
    18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    19 #include "mex.h"
    20 #endif
    2117
    2218/*}}}*/
  • issm/trunk-jpl/src/c/toolkits/petsc/patches/MatInvert.cpp

    r11861 r12018  
    5555        MatAssemblyBegin(inv,MAT_FINAL_ASSEMBLY);
    5656        MatAssemblyEnd(inv,MAT_FINAL_ASSEMBLY);
    57 
    58         #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
    59                 MatConvert(inv, MATSEQAIJ,MAT_REUSE_MATRIX,&inv);
    60         #else
    61                 MatConvert(inv, MATMPIAIJ,MAT_REUSE_MATRIX,&inv);
    62         #endif
     57               
     58        MatConvert(inv, MATMPIAIJ,MAT_REUSE_MATRIX,&inv);
    6359       
    6460        /*Free ressources:*/
  • issm/trunk-jpl/src/c/toolkits/triangle/triangleincludes.h

    r2214 r12018  
    66#define _TRIANGLE_INCLUDES_H_
    77
    8 #ifdef _SERIAL_
    9 
    108#ifdef _C_ //only valid for iso C, not C++
    119/*Triangle includes: */
     
    1311#endif //#ifdef _C_
    1412
    15 #endif //ifdef _SERIAL_
    16 
    1713
    1814#endif
Note: See TracChangeset for help on using the changeset viewer.