Changeset 12018
- Timestamp:
- 04/16/12 19:43:13 (13 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/io/PrintfFunction.cpp
r11934 r12018 8 8 #include "../shared/shared.h" 9 9 #include "../include/include.h" 10 11 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)12 #include "mex.h"13 #endif14 10 15 11 int PrintfFunction(const char* format,...){ … … 53 49 54 50 /*Ok, if we are running in parallel, get node 0 to print*/ 55 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)56 mexPrintf(buffer);57 #else58 51 if(my_rank==0)printf(buffer); 59 #endif60 52 61 53 /*Clean up and return*/ -
issm/trunk-jpl/src/c/modules/Solverx/Solverx.cpp
r11760 r12018 34 34 35 35 /*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 #endif40 36 41 37 SolverxPetsc(&uf_vector,Kff->matrix,pf->vector,uf0_vector,df_vector,parameters); -
issm/trunk-jpl/src/c/modules/Solverx/SolverxPetsc.cpp
r12016 r12018 78 78 PetscOptionsDetermineSolverType(&solver_type); 79 79 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_ == 284 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 #endif108 #endif109 80 /*}}}*/ 110 81 /*Check the solver is available: {{{1*/ -
issm/trunk-jpl/src/c/objects/Inputs/DoubleInput.cpp
r12014 r12018 108 108 /*FUNCTION DoubleInput::GetInputValue(bool* pvalue) {{{1*/ 109 109 void DoubleInput::GetInputValue(bool* pvalue){ 110 #ifdef _SERIAL_111 *pvalue=(bool)value;112 #else113 110 _error_("Double input of enum %s cannot return a boolean",EnumToStringx(enum_type)); 114 #endif115 111 116 112 } … … 118 114 /*FUNCTION DoubleInput::GetInputValue(int* pvalue){{{1*/ 119 115 void DoubleInput::GetInputValue(int* pvalue){ 120 #ifdef _SERIAL_121 *pvalue=(int)value;122 #else123 116 _error_("Double input of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type)); 124 #endif125 117 126 118 } -
issm/trunk-jpl/src/c/objects/Params/DoubleMatParam.cpp
r12014 r12018 109 109 /*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/ 110 110 void 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 #else123 111 _error_("DoubleMat of enum %i (%s) cannot return an array of int",enum_type,EnumToStringx(enum_type)); 124 #endif125 112 } 126 113 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Params/DoubleParam.cpp
r12014 r12018 82 82 /*FUNCTION DoubleParam::GetParameterValue(int* pinteger){{{1*/ 83 83 void DoubleParam::GetParameterValue(int* pinteger){ 84 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)85 *pinteger=(int)value;86 #else87 84 _error_("Double param of enum %i (%s) cannot return an integer",enum_type,EnumToStringx(enum_type)); 88 #endif89 85 } 90 86 /*}}}*/ 91 87 /*FUNCTION DoubleParam::GetParameterValue(bool* pbool){{{1*/ 92 88 void 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 #else100 89 _error_("Double param of enum %i (%s) cannot return an bool",enum_type,EnumToStringx(enum_type)); 101 #endif102 90 } 103 91 /*}}}*/ 104 92 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM){{{1*/ 105 93 void 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 #else116 94 _error_("Double param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type)); 117 #endif118 95 } 119 96 /*}}}*/ 120 97 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/ 121 98 void 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 #else133 99 _error_("Double param of enum %i (%s) cannot return an array of integers",enum_type,EnumToStringx(enum_type)); 134 #endif135 100 } 136 101 /*}}}*/ 137 102 /*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM){{{1*/ 138 103 void 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 #else149 104 _error_("Double param of enum %i (%s) cannot return an array of double",enum_type,EnumToStringx(enum_type)); 150 #endif151 105 } 152 106 /*}}}*/ 153 107 /*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){{{1*/ 154 108 void 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 #else166 109 _error_("Double param of enum %i (%s) cannot return an array of double",enum_type,EnumToStringx(enum_type)); 167 #endif168 110 } 169 111 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Params/DoubleVecParam.cpp
r12014 r12018 124 124 /*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{1*/ 125 125 void 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 #else138 126 _error_("DoubleVec param of enum %i (%s) cannot return an array of int",enum_type,EnumToStringx(enum_type)); 139 #endif140 127 } 141 128 /*}}}*/ -
issm/trunk-jpl/src/c/shared/Exceptions/Exceptions.cpp
r11861 r12018 11 11 #include "../shared.h" 12 12 #include "../../include/include.h" 13 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)14 #include "mex.h"15 #endif16 13 17 14 ErrorException::ErrorException(const string &what_arg){ … … 45 42 } 46 43 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()); 54 46 } 55 47 return; -
issm/trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp
r11861 r12018 30 30 parameters->FindParam(&strings,&numanalyses,PetscOptionsStringsEnum); 31 31 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 analysis33 if(numanalyses==1){ analyses=(double*)xmalloc(1*sizeof(double)); parameters->FindParam(analyses,PetscOptionsAnalysesEnum);34 }35 else parameters->FindParam(&analyses,&dummy,PetscOptionsAnalysesEnum);36 #else37 32 parameters->FindParam(&analyses,&dummy,PetscOptionsAnalysesEnum); 38 #endif39 33 40 34 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 29 29 #include "../../include/macros.h" 30 30 #include "../Exceptions/exceptions.h" 31 #ifdef _SERIAL_32 #include <mex.h>33 #endif34 31 /*}}}*/ 35 32 … … 140 137 if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level); 141 138 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 #else150 151 139 verbositylevel = level; 152 140 153 #endif154 141 }/*}}}*/ 155 142 /*FUNCTION GetVerbosityLevel {{{*/ 156 143 int 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 #else170 171 144 _assert_(verbositylevel>=0); 172 145 return verbositylevel; 173 174 #endif175 146 }/*}}}*/ 176 147 END -
issm/trunk-jpl/src/c/shared/Numerics/Verbosity.cpp
r12011 r12018 18 18 #include "../../include/macros.h" 19 19 #include "../Exceptions/exceptions.h" 20 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)21 #include <mex.h>22 #endif23 20 /*}}}*/ 24 21 -
issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h
r12011 r12018 15 15 16 16 #include "../toolkitsenums.h" 17 18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)19 #include "mex.h"20 #endif21 17 22 18 /*}}}*/ -
issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h
r12011 r12018 15 15 16 16 #include "../toolkitsenums.h" 17 18 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)19 #include "mex.h"20 #endif21 17 22 18 /*}}}*/ -
issm/trunk-jpl/src/c/toolkits/petsc/patches/MatInvert.cpp
r11861 r12018 55 55 MatAssemblyBegin(inv,MAT_FINAL_ASSEMBLY); 56 56 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); 63 59 64 60 /*Free ressources:*/ -
issm/trunk-jpl/src/c/toolkits/triangle/triangleincludes.h
r2214 r12018 6 6 #define _TRIANGLE_INCLUDES_H_ 7 7 8 #ifdef _SERIAL_9 10 8 #ifdef _C_ //only valid for iso C, not C++ 11 9 /*Triangle includes: */ … … 13 11 #endif //#ifdef _C_ 14 12 15 #endif //ifdef _SERIAL_16 17 13 18 14 #endif
Note:
See TracChangeset
for help on using the changeset viewer.