Changeset 6014
- Timestamp:
- 09/24/10 10:04:01 (14 years ago)
- Location:
- issm/trunk
- Files:
-
- 7 added
- 4 deleted
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h ¶
r5992 r6014 367 367 VerboseEnum, 368 368 WaitOnLockEnum, 369 PetscOptionsStringsEnum, 370 PetscOptionsAnalysesEnum, 369 371 GsetEnum, 370 372 FsetEnum, -
TabularUnified issm/trunk/src/c/EnumDefinitions/EnumToString.cpp ¶
r5992 r6014 329 329 case VerboseEnum : return "Verbose"; 330 330 case WaitOnLockEnum : return "WaitOnLock"; 331 case PetscOptionsStringsEnum : return "PetscOptionsStrings"; 332 case PetscOptionsAnalysesEnum : return "PetscOptionsAnalyses"; 331 333 case GsetEnum : return "Gset"; 332 334 case FsetEnum : return "Fset"; -
TabularUnified issm/trunk/src/c/EnumDefinitions/StringToEnum.cpp ¶
r5992 r6014 327 327 else if (strcmp(name,"Verbose")==0) return VerboseEnum; 328 328 else if (strcmp(name,"WaitOnLock")==0) return WaitOnLockEnum; 329 else if (strcmp(name,"PetscOptionsStrings")==0) return PetscOptionsStringsEnum; 330 else if (strcmp(name,"PetscOptionsAnalyses")==0) return PetscOptionsAnalysesEnum; 329 331 else if (strcmp(name,"Gset")==0) return GsetEnum; 330 332 else if (strcmp(name,"Fset")==0) return FsetEnum; -
TabularUnified issm/trunk/src/c/Makefile.am ¶
r5997 r6014 251 251 ./shared/Numerics/extrema.cpp\ 252 252 ./shared/Numerics/UnitConversion.cpp\ 253 ./shared/Numerics/PetscOptionsFromAnalysis.cpp\ 253 254 ./shared/Exceptions/exceptions.h\ 254 255 ./shared/Exceptions/Exceptions.cpp\ … … 736 737 ./objects/Numerics/ElementVector.h\ 737 738 ./objects/Numerics/ElementVector.cpp\ 739 ./shared/Numerics/PetscOptionsFromAnalysis.cpp\ 738 740 ./objects/Params/Param.h\ 739 741 ./objects/Params/BoolParam.cpp\ … … 890 892 ./io/pfopen.cpp\ 891 893 ./io/pfclose.cpp\ 894 ./io/ParsePetscOptions.cpp\ 892 895 ./EnumDefinitions/EnumDefinitions.h\ 893 896 ./EnumDefinitions/EnumDefinitions.cpp\ -
TabularUnified issm/trunk/src/c/io/io.h ¶
r5172 r6014 11 11 12 12 class DataSet; 13 class Parameters; 13 14 14 15 FILE* pfopen(char* filename,char* format); … … 72 73 void WriteDataToDisk(void* data,int* pM,int* pN,char* datatype,FILE* fid); 73 74 75 /*petsc options: */ 76 void ParsePetscOptions(Parameters* parameters, char* filename); 77 74 78 #endif 75 79 -
TabularUnified issm/trunk/src/c/modules/ModelProcessorx/CreateParameters.cpp ¶
r6005 r6014 24 24 mxArray* pfield2=NULL; 25 25 #endif 26 int dummy; 27 int numpetscoptions; 28 29 /*petsc options: */ 30 double* analyses=NULL; 31 char** petscstrings=NULL; 26 32 27 33 if(*pparameters)return; //do not create parameters twice! … … 96 102 } 97 103 98 99 /*Free data: */ 104 /*Deal with petsc options: */ 105 #ifdef _SERIAL_ 106 pfield=mxGetField(iomodel_handle,0,"petscoptions_analyses"); 107 FetchData(&analyses,&numpetscoptions,pfield); 108 pfield=mxGetField(iomodel_handle,0,"petscoptions_strings"); 109 petscstrings=(char**)xmalloc(numpetscoptions*sizeof(char*)); //allocate 110 for (i=0;i<numpetscoptions;i++){ 111 pfield2=mxGetCell(pfield,i); 112 FetchData(&descriptor,pfield2); 113 petscstrings[i]=descriptor; 114 } 115 parameters->AddObject(new StringArrayParam(PetscOptionsStringsEnum,petscstrings,numpetscoptions)); 116 parameters->AddObject(new DoubleVecParam(PetscOptionsAnalysesEnum,analyses,numpetscoptions)); 117 #endif 118 119 /*Free data: {{{1*/ 100 120 xfree((void**)&tag); 101 121 for(i=0;i<iomodel->numoutput;i++){ … … 104 124 } 105 125 xfree((void**)¶meteroutput); 126 127 #ifdef _SERIAL_ 128 xfree((void**)&analyses); 129 for(i=0;i<numpetscoptions;i++){ 130 char* descriptor=petscstrings[i]; 131 xfree((void**)&descriptor); 132 } 133 xfree((void**)&petscstrings); 134 #endif 135 /*}}}*/ 106 136 107 137 /*Before returning, create parameters in case we are running Qmu or control types runs: */ -
TabularUnified issm/trunk/src/c/modules/Solverx/Solverx.cpp ¶
r5979 r6014 16 16 17 17 /*output: */ 18 Vec uf=NULL;18 Vec uf = NULL; 19 19 20 20 /*intermediary: */ 21 int local_m,local_n; 22 23 /*Solver*/ 24 KSP ksp=NULL; 25 PC pc=NULL; 26 int iteration_number; 21 int local_m; 22 int local_n; 23 int analysis_type; 24 25 /*Solver */ 26 KSP ksp = NULL; 27 PC pc = NULL; 28 int iteration_number; 27 29 PetscTruth flag; 28 int solver_type; 29 char* petscrc=NULL; 30 bool fromlocalsize=true; 30 int solver_type; 31 bool fromlocalsize = true; 31 32 32 33 … … 50 51 51 52 52 /*Process petsc rcto see if we are not using special types of external solvers: */53 PetscOptionsDetermineSolverType(&solver_type ,parameters);54 55 /*In serial mode, we don't have a petsc.rc file to boot the Petsc options. Do it now56 * using the petscrc string recover in the parameters: */53 /*Process petsc options to see if we are not using special types of external solvers: */ 54 PetscOptionsDetermineSolverType(&solver_type); 55 56 /*In serial mode, matrices have been loaded at MPIAIJ or AIJ matrices. 57 We need to convert them if we are going to run the solvers successfully: */ 57 58 #ifdef _SERIAL_ 58 59 parameters->FindParam(&petscrc,PetscRcEnum); 60 PetscOptionsInsertMultipleString(petscrc); 61 62 /*In serial mode, matrices have been loaded at MPIAIJ or AIJ matrices. 63 * We need to convert them if we are going to run the solvers successfully: */ 64 #if _PETSC_VERSION_ == 2 65 if (solver_type==MUMPSPACKAGE_LU){ 66 /*Convert Kff to MATTAIJMUMPS: */ 67 MatConvert(Kff,MATAIJMUMPS,MAT_REUSE_MATRIX,&Kff); 68 } 69 if (solver_type==MUMPSPACKAGE_CHOL){ 70 /*Convert Kff to MATTSBAIJMUMPS: */ 71 MatConvert(Kff,MATSBAIJMUMPS,MAT_REUSE_MATRIX,&Kff); 72 } 73 if (solver_type==SPOOLESPACKAGE_LU){ 74 /*Convert Kff to MATTSBAIJMUMPS: */ 75 MatConvert(Kff,MATAIJSPOOLES,MAT_REUSE_MATRIX,&Kff); 76 } 77 if (solver_type==SPOOLESPACKAGE_CHOL){ 78 /*Convert Kff to MATTSBAIJMUMPS: */ 79 MatConvert(Kff,MATSBAIJSPOOLES,MAT_REUSE_MATRIX,&Kff); 80 } 81 if (solver_type==SUPERLUDISTPACKAGE){ 82 /*Convert Kff to MATTSBAIJMUMPS: */ 83 MatConvert(Kff,MATSUPERLU_DIST,MAT_REUSE_MATRIX,&Kff); 84 } 85 #endif 59 #if _PETSC_VERSION_ == 2 60 if (solver_type==MUMPSPACKAGE_LU){ 61 /*Convert Kff to MATTAIJMUMPS: */ 62 MatConvert(Kff,MATAIJMUMPS,MAT_REUSE_MATRIX,&Kff); 63 } 64 if (solver_type==MUMPSPACKAGE_CHOL){ 65 /*Convert Kff to MATTSBAIJMUMPS: */ 66 MatConvert(Kff,MATSBAIJMUMPS,MAT_REUSE_MATRIX,&Kff); 67 } 68 if (solver_type==SPOOLESPACKAGE_LU){ 69 /*Convert Kff to MATTSBAIJMUMPS: */ 70 MatConvert(Kff,MATAIJSPOOLES,MAT_REUSE_MATRIX,&Kff); 71 } 72 if (solver_type==SPOOLESPACKAGE_CHOL){ 73 /*Convert Kff to MATTSBAIJMUMPS: */ 74 MatConvert(Kff,MATSBAIJSPOOLES,MAT_REUSE_MATRIX,&Kff); 75 } 76 if (solver_type==SUPERLUDISTPACKAGE){ 77 /*Convert Kff to MATTSBAIJMUMPS: */ 78 MatConvert(Kff,MATSUPERLU_DIST,MAT_REUSE_MATRIX,&Kff); 79 } 80 #endif 86 81 #endif 87 82 … … 92 87 93 88 #ifdef _SERIAL_ 94 95 96 97 98 99 100 89 #if _PETSC_VERSION_ == 3 90 /*specific solver?: */ 91 KSPGetPC(ksp,&pc); 92 if (solver_type==MUMPSPACKAGE_LU){ 93 PCFactorSetMatSolverPackage(pc,MAT_SOLVER_MUMPS); 94 } 95 #endif 101 96 #endif 102 97 … … 119 114 /*Free ressources:*/ 120 115 KSPFree(&ksp); 121 xfree((void**)&petscrc);122 116 123 117 /*Assign output pointers:*/ -
TabularUnified issm/trunk/src/c/objects/FemModel.cpp ¶
r5772 r6014 127 127 void FemModel::SetCurrentConfiguration(int configuration_type,int analysis_type){ 128 128 129 int verbose=0; 130 131 /*retrieve parameters: */ 132 this->parameters->FindParam(&verbose,VerboseEnum); 133 129 134 /*Use configuration_type to setup the analysis counter, the configurations of objects etc ... but use 130 135 * analysis_type to drive the element numerics. This allows for use of 1 configuration_type for several … … 156 161 this->loads->SetCurrentConfiguration(elements, loads, nodes,vertices, materials,parameters); 157 162 163 /*take care of petsc options, that depend on this analysis type: */ 164 PetscOptionsFromAnalysis(this->parameters,analysis_type); 165 166 verbose=1; 167 if(verbose){ 168 _printf_("Petsc Options set for analysis type: %s\n",EnumToString(analysis_type)); 169 PetscOptionsPrint(stdout); 170 } 171 172 158 173 } 159 174 /*}}}1*/ -
TabularUnified issm/trunk/src/c/objects/IoModel.cpp ¶
r6005 r6014 48 48 xfree((void**)&this->gridonpattyn); 49 49 } 50 xfree((void**)&this->numpetscoptions);51 50 xfree((void**)&this->elementonbed); 52 51 xfree((void**)&this->elementonsurface); … … 182 181 IoModelFetchData(&this->connectivity,iomodel_handle,"connectivity"); 183 182 IoModelFetchData(&this->lowmem,iomodel_handle,"lowmem"); 184 IoModelFetchData(&this->numpetscoptions,iomodel_handle,"numpetscoptions");185 183 IoModelFetchData(&this->viscosity_overshoot,iomodel_handle,"viscosity_overshoot"); 186 184 IoModelFetchData(&this->artdiff,iomodel_handle,"artificial_diffusivity"); … … 227 225 this->control_analysis=0; 228 226 this->control_parameter=NULL; 229 this->numpetscoptions=NULL;230 227 this->numberofvariables=0; 231 228 this->numvariabledescriptors=0; -
TabularUnified issm/trunk/src/c/objects/IoModel.h ¶
r6005 r6014 22 22 int qmu_analysis; 23 23 int control_analysis; 24 char* numpetscoptions;25 24 26 25 /*2d mesh: */ -
TabularUnified issm/trunk/src/c/objects/Params/DoubleVecParam.h ¶
r5103 r6014 41 41 ~DoubleVecParam(); 42 42 /*}}}*/ 43 /* /*Object virtual functions definitions:{{{1 */43 /*Object virtual functions definitions:{{{1 */ 44 44 void Echo(); 45 45 void DeepEcho(); -
TabularUnified issm/trunk/src/c/shared/Matlab/ModuleBoot.cpp ¶
r3328 r6014 18 18 19 19 /*Declare my_ rank and num_procs global variables!: */ 20 //int argc=2;21 //char* argv[]={"ISSM","-malloc no",NULL};22 20 my_rank=0; 23 21 num_procs=1; … … 25 23 /*Initialize Petsc: */ 26 24 PetscInitializeNoArguments(); 27 //PetscInitialize(&argc,(char***)&argv,PETSC_NULL,PETSC_NULL); 28 25 29 26 return 1; 30 27 } -
TabularUnified issm/trunk/src/c/shared/Numerics/numerics.h ¶
r5595 r6014 8 8 #include "./GaussPoints.h" 9 9 #include "./isnan.h" 10 10 11 class Input; 11 12 class Parameters; … … 24 25 void UnitConversion(double* values, int numvalues,int direction_enum, int type_enum, Parameters* parameters); 25 26 double UnitConversion(double value, int direction_enum, int type_enum, Parameters* parameters); 27 void PetscOptionsFromAnalysis(Parameters* parameters,int analysis_type); 26 28 27 29 #endif //ifndef _NUMERICS_H_ -
TabularUnified issm/trunk/src/c/solutions/issm.cpp ¶
r5974 r6014 15 15 FILE *output_fid = NULL; 16 16 char *inputfilename = NULL; 17 char *petscoptionsfilename = NULL; 17 18 char *outputfilename = NULL; 18 19 char *lockname = NULL; … … 42 43 43 44 /*Initialize Petsc and get start time*/ 44 int ierr=PetscInitialize(&argc,&argv, argv[4],"");45 int ierr=PetscInitialize(&argc,&argv,(char*)0,""); 45 46 if(ierr) ISSMERROR("Could not initialize Petsc"); 46 47 MPI_Barrier(MPI_COMM_WORLD); start=MPI_Wtime(); … … 53 54 solution_type=StringToEnum(argv[1]); 54 55 inputfilename=argv[3]; 56 petscoptionsfilename=argv[4]; 55 57 outputfilename=argv[5]; 56 58 lockname=argv[6]; … … 72 74 /*add output_fid to parameters: */ 73 75 femmodel->parameters->SetParam(output_fid,OutputFilePointerEnum); 74 76 77 /*add petsc options to parameters: */ 78 ParsePetscOptions(femmodel->parameters,petscoptionsfilename); 79 75 80 /*get parameters: */ 76 81 femmodel->parameters->FindParam(&qmu_analysis,QmuAnalysisEnum); -
TabularUnified issm/trunk/src/c/toolkits/petsc/patches/PetscOptionsDetermineSolverType.cpp ¶
r5977 r6014 1 /*!\file PetscOptionsDetermineSolverType.cpp 2 * \brief: Petsc comes with a wide array of solvers, some of them considered external (externally linked libraries). 3 To activate these solvers, Petsc uses the Options database, which is set at the command line prompt 4 when launching a Petsc executable (option -mat_type EXTERNALMATRIXTYPE). 5 6 We do not use this feature, because once the jpl-package server is launched, we cannot go back and modify 7 the command line arguments. We rely therefore on the use of the options_string sent from the Solver_client 8 module to the server Solver/ module. On the server side, we receive this options_string and plug it into the 9 options database using the routine PetscOptionsInsertMultipleSTring. Once this is done, the KSP (Petsc solver) 10 object registers these options and selects the correct solution method. 11 12 Now, for external solvers, this does not work, because the choice of external solver needs to be done when launching 13 the Petsc executable ( this way, every matrix created conforms to the external package, and the solver then 14 knows what to do directly by looking at the type of input matrix ). To circumvent this problem, we 15 still use the options_string sent by the Solver_client, and we look for the -mat_type option. If we find 16 a -mat_type option with an argument relating to an external solver, we then convert the solver matrix 17 to the external type, and the KSP object then knows what to do. 18 19 This routine parses the options_string and returns the type of external solver being used as an enum. If there is no 20 external solver used, we return a default enum. 21 22 Note: figure out if first and second should be xfreed. 1 /*!\file PetscOptionsDetermineSolverType.cpp: from the petsc options, determine what kind of solver 2 * we are using. 23 3 */ 24 4 … … 39 19 #include "../../../include/include.h" 40 20 41 void PetscOptionsDetermineSolverType(int* psolver_type ,Parameters* parameters){21 void PetscOptionsDetermineSolverType(int* psolver_type){ 42 22 43 /*The list of options is going to be pairs of the type "-option option_value"*/ 44 #if _PETSC_VERSION_ == 2 45 PetscToken *token=NULL; 46 #else 47 PetscToken token=NULL; 48 #endif 49 char* first=NULL; 50 char* second=NULL; 51 char* options_string=NULL; 52 size_t len; 53 int ignore_second; 54 int first_token=1; 55 char parallel_option[100]; 23 char option[100]; 56 24 PetscTruth flag; 57 25 … … 59 27 int solver_type=PETSCPACKAGE; 60 28 61 /*In serial, pick up the options string from parameters, and analyze it. 62 * In parallel, options are command line driven, so retrieve the mat_type 63 * option and conclude: */ 29 /*retrieve mat_type option: */ 30 PetscOptionsGetString(PETSC_NULL,"-mat_type",&option[0],100,&flag); 64 31 65 #ifdef _SERIAL_ 66 parameters->FindParam(&options_string,PetscRcEnum); 32 if (strcmp(option,"aijmumps")==0){ 33 solver_type=MUMPSPACKAGE_LU; 34 } 35 if (strcmp(option,"sbaijmumps")==0){ 36 solver_type=MUMPSPACKAGE_CHOL; 37 } 38 if (strcmp(option,"aijspooles")==0){ 39 solver_type=SPOOLESPACKAGE_LU; 40 } 41 if (strcmp(option,"sbaijspooles")==0){ 42 solver_type=SPOOLESPACKAGE_CHOL; 43 } 44 if (strcmp(option,"superlu_dist")==0){ 45 solver_type=SUPERLUDISTPACKAGE; 46 } 67 47 68 PetscTokenCreate(options_string,' ',&token);69 for (;;){70 71 /*Read next tokens*/72 if(first_token){73 PetscTokenFind(token,&first);74 }75 PetscTokenFind(token,&second);76 77 if (!first){78 /*We are at the end of options*/79 break;80 }81 if(!second){82 /*We have no second value, end the token analysis.*/83 if(first[0]!='-'){84 /*This is not good, the option does not have '-'! Get out*/85 ISSMERROR("%s%s%s","Option ",first," should be preceded by '-'!");86 }87 break;88 }89 else{90 /*Ok, we have a second token coming in. Is it another option, or 'first' option's value?*/91 if (second[0]=='-'){92 /*Second is another option, ignore it and prepare next loop step*/93 first=second;94 first_token=0;95 }96 else{97 /*Second is 'first' option's value*/98 PetscStrlen(second,&len);99 while (len > 0 && (second[len-1] == ' ' || second[len-1] == 'n')) {100 len--; second[len] = 0;101 }102 /*We now have a pair first and second. Check whether first is equal to -mat_type. If so, check103 * the second argument for the name of the external package desired.*/104 if (strcmp(first,"-mat_type")==0){105 if (strcmp(second,"aijmumps")==0){106 solver_type=MUMPSPACKAGE_LU;107 }108 if (strcmp(second,"sbaijmumps")==0){109 solver_type=MUMPSPACKAGE_CHOL;110 }111 if (strcmp(second,"aijspooles")==0){112 solver_type=SPOOLESPACKAGE_LU;113 }114 if (strcmp(second,"sbaijspooles")==0){115 solver_type=SPOOLESPACKAGE_CHOL;116 }117 if (strcmp(second,"superlu_dist")==0){118 solver_type=SUPERLUDISTPACKAGE;119 }120 }121 122 first_token=1;123 }124 }125 }126 PetscTokenDestroy(token);127 #else128 129 /*retrieve mat_type option: */130 PetscOptionsGetString(PETSC_NULL,"-mat_type",¶llel_option[0],100,&flag);131 132 if (strcmp(parallel_option,"aijmumps")==0){133 solver_type=MUMPSPACKAGE_LU;134 }135 if (strcmp(parallel_option,"sbaijmumps")==0){136 solver_type=MUMPSPACKAGE_CHOL;137 }138 if (strcmp(parallel_option,"aijspooles")==0){139 solver_type=SPOOLESPACKAGE_LU;140 }141 if (strcmp(parallel_option,"sbaijspooles")==0){142 solver_type=SPOOLESPACKAGE_CHOL;143 }144 if (strcmp(parallel_option,"superlu_dist")==0){145 solver_type=SUPERLUDISTPACKAGE;146 }147 #endif148 149 /*Clean-up and assign output*/150 xfree((void**)&options_string);151 48 *psolver_type=solver_type; 152 49 } -
TabularUnified issm/trunk/src/c/toolkits/petsc/patches/petscpatches.h ¶
r5975 r6014 9 9 #include "petscvec.h" 10 10 #include "petscksp.h" 11 #include "petscsys.h" 12 11 13 class Parameters; 12 14 … … 40 42 void MatInvert(Mat* pInv, Mat Matrix); 41 43 void PetscOptionsInsertMultipleString(char* options_string); 42 void PetscOptionsDetermineSolverType(int* psolver_type ,Parameters* parameters);44 void PetscOptionsDetermineSolverType(int* psolver_type); 43 45 void VecMerge(Vec A, Vec B, double* row_partition_vector,int row_partition_size); 44 46 void MatMultPatch(Mat A,Vec X, Vec AX); -
TabularUnified issm/trunk/src/c/toolkits/petsc/petscincludes.h ¶
r1 r6014 10 10 #include "petscvec.h" 11 11 #include "petscksp.h" 12 #include "petscsys.h" 12 13 13 14 /*our own patches: */ -
TabularUnified issm/trunk/src/m/classes/@model/model.m ¶
r6005 r6014 266 266 %PETSc and MATLAB solver string 267 267 md.petscoptions=NaN; 268 md.numpetscoptions=1; 268 md.petscoptions_analyses=[]; 269 md.petscoptions_strings={}; 269 270 270 271 %Analysis and sub_analysis -
TabularUnified issm/trunk/src/m/classes/@model/setdefaultparameters.m ¶
r6005 r6014 239 239 md.petscoptions=addoptions(md.petscoptions,DiagnosticHorizAnalysisEnum,asmoptions); 240 240 md.petscoptions=addoptions(md.petscoptions,DiagnosticVertAnalysisEnum,mumpsoptions); 241 md.numpetscoptions=3; %don't forget the default analysis!242 241 243 242 %solution speed-up -
TabularUnified issm/trunk/src/m/classes/petscoptions.m ¶
r6005 r6014 9 9 options={NoneAnalysisEnum,asmoptions}; 10 10 %used when marshalling 11 analyses=[];12 strings={};13 11 %}}} 14 12 end … … 21 19 analysis=o.options{i,1}; 22 20 ioptions=o.options{i,2}; 23 string= PetscOptions2PetscRc(ioptions);21 string=petscoptiontostring(ioptions); 24 22 disp(sprintf(' %s -> ''%s''',EnumToString(analysis),string)); 25 23 end … … 45 43 end 46 44 %}}} 47 function o=marshall(o)%{{{145 function [analyses strings]=marshall(o)%{{{1 48 46 %marshall options into analyses and strings 49 o.analyses=zeros(size(o.options,1),1);50 o.strings=cell(size(o.options,1),1);47 analyses=zeros(size(o.options,1),1); 48 strings=cell(size(o.options,1),1); 51 49 for i=1:size(o.options,1), 52 o.analyses(i)=o.options{i,1};53 o.strings{i}=petscoptiontostring(o.options{i,2});50 analyses(i)=o.options{i,1}; 51 strings{i}=petscoptiontostring(o.options{i,2}); 54 52 end 55 53 end -
TabularUnified issm/trunk/src/m/enum/EnumToString.m ¶
r5993 r6014 324 324 case VerboseEnum(), string='Verbose'; return 325 325 case WaitOnLockEnum(), string='WaitOnLock'; return 326 case PetscOptionsStringsEnum(), string='PetscOptionsStrings'; return 327 case PetscOptionsAnalysesEnum(), string='PetscOptionsAnalyses'; return 326 328 case GsetEnum(), string='Gset'; return 327 329 case FsetEnum(), string='Fset'; return -
TabularUnified issm/trunk/src/m/enum/FsetEnum.m ¶
r5993 r6014 9 9 % macro=FsetEnum() 10 10 11 macro=31 4;11 macro=316; -
TabularUnified issm/trunk/src/m/enum/GsetEnum.m ¶
r5993 r6014 9 9 % macro=GsetEnum() 10 10 11 macro=31 3;11 macro=315; -
TabularUnified issm/trunk/src/m/enum/SsetEnum.m ¶
r5993 r6014 9 9 % macro=SsetEnum() 10 10 11 macro=31 5;11 macro=317; -
TabularUnified issm/trunk/src/m/enum/StringToEnum.m ¶
r5993 r6014 322 322 elseif (strcmpi(name,'Verbose')), enum=VerboseEnum(); return 323 323 elseif (strcmpi(name,'WaitOnLock')), enum=WaitOnLockEnum(); return 324 elseif (strcmpi(name,'PetscOptionsStrings')), enum=PetscOptionsStringsEnum(); return 325 elseif (strcmpi(name,'PetscOptionsAnalyses')), enum=PetscOptionsAnalysesEnum(); return 324 326 elseif (strcmpi(name,'Gset')), enum=GsetEnum(); return 325 327 elseif (strcmpi(name,'Fset')), enum=FsetEnum(); return -
TabularUnified issm/trunk/src/m/enum/YtsEnum.m ¶
r5993 r6014 9 9 % macro=YtsEnum() 10 10 11 macro=31 6;11 macro=318; -
TabularUnified issm/trunk/src/m/model/marshall.m ¶
r6005 r6014 134 134 WriteData(fid,md.lowmem,'Integer','lowmem'); 135 135 WriteData(fid,md.optscal,'Mat','optscal'); 136 WriteData(fid,md.petscrc,'String','petscrc');137 136 WriteData(fid,md.viscosity_overshoot,'Scalar','viscosity_overshoot'); 138 137 WriteData(fid,md.stokesreconditioning,'Scalar','stokesreconditioning'); … … 180 179 WriteData(fid,md.outputfilename,'String','outputfilename'); 181 180 182 %petsc options:183 WriteData(fid,md.numpetscoptions,'Integer','numpetscoptions');184 WriteData(fid,md.petscoptions.analyses,'Mat','petscoptionsanalyses');185 for i=1:md.numpetscoptions,186 WriteData(fid,md.petscoptions.strings{i},'String',['petscoptionsstrings_' num2str(i-1)]);187 end188 189 181 %close file 190 182 st=fclose(fid); -
TabularUnified issm/trunk/src/m/model/presolve.m ¶
r6005 r6014 34 34 end 35 35 36 %package together petscoptions: 37 md.petscoptions=marshall(md.petscoptions); 38 md.numpetscoptions=size(md.petscoptions.analyses,1); 36 %package together petscoptions for serial runs 37 [md.petscoptions_analyses md.petscoptions_strings]=marshall(md.petscoptions); 38 39 %write a template file for issm to use, in parallel 40 if ~strcmpi(md.cluster.name,'none'), 41 PetscOptions2PetscFile(md.petscoptions,[md.name '.petsc']); 42 end -
TabularUnified issm/trunk/src/mex/Solver/Solver.cpp ¶
r5903 r6014 12 12 Vec uf0 = NULL; 13 13 Vec uf = NULL; 14 char *petscrc = NULL;15 14 Parameters *parameters = NULL; 16 15 int verbose; 17 16 int analysis_type; 17 char option[100]; 18 PetscTruth flag; 19 18 20 /*Matlab solver: */ 19 21 mxArray* array[2]; … … 24 26 /*checks on arguments on the matlab side: */ 25 27 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&SolverUsage); 28 29 /*parameters: */ 30 FetchParams(¶meters,PARAMETERS); 31 parameters->FindParam(&verbose,VerboseEnum); 26 32 27 /*First, check solver string: */ 28 FetchParams(¶meters,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 31 38 39 /*Retrieve solver type: */ 40 PetscOptionsGetString(PETSC_NULL,"-ksp_type",&option[0],100,&flag); 41 32 42 /*Fetch rest of data only if not running the matlab solver: */ 33 if (strcmp(petscrc,matlabstring)!=0){ 43 if (strcmp(option,"matlab")!=0){ 44 34 45 /*Input datasets: */ 35 46 FetchData(&Kff,KFF); 36 47 FetchData(&pf,PF); 37 48 FetchData(&uf0,UF0); 38 /*Petsc solver: */ 49 50 /*Core module: */ 39 51 Solverx(&uf, Kff, pf, uf0, parameters); 52 40 53 /*Write output*/ 41 54 WriteData(UF,uf); … … 55 68 VecFree(&uf); 56 69 delete parameters; 57 xfree((void**)&petscrc);58 70 59 71 MODULEEND(); 72 60 73 } 61 74 -
TabularUnified issm/trunk/src/mex/SystemMatrices/SystemMatrices.h ¶
r6005 r6014 36 36 #define PF (mxArray**)&plhs[4] 37 37 #define KMAX (mxArray**)&plhs[5] 38 #define KMAX (mxArray**)&plhs[2]39 38 40 39 /* serial arg counts: */ -
TabularUnified issm/trunk/test/NightlyRun/test101.m ¶
r5955 r6014 4 4 md=setelementstype(md,'macayeal','all'); 5 5 md.cluster=none; 6 md.verbose=1; 6 7 md=solve(md,'analysis_type',DiagnosticSolutionEnum); 7 8 -
TabularUnified issm/trunk/test/NightlyRun/test102.m ¶
r5976 r6014 1 md=mesh(model,'../Exp/Square.exp',1 50000);1 md=mesh(model,'../Exp/Square.exp',100000); 2 2 md=geography(md,'all',''); 3 3 md=parameterize(md,'../Par/SquareShelfConstrained.par'); 4 4 md=setelementstype(md,'macayeal','all'); 5 5 md=SetParallel(md,3); 6 md=extrude(md,3,1); 7 md.verbose=1; 8 9 pos=find(md.x<600000 & md.x>400000 & md.y<600000 & md.y>400000); 10 npos=length(pos); 11 md.spcvelocity(pos,1:6)=[1*ones(npos,1) 1*ones(npos,1) 0*ones(npos,1) 0*ones(npos,1) 0*ones(npos,1) 0*ones(npos,1) ]; 12 md.cluster.np=2; 6 13 md=solve(md,'analysis_type',DiagnosticSolutionEnum); 14 md=tres(md,'diagnostic'); 7 15 8 16 %Fields and tolerances to track changes
Note:
See TracChangeset
for help on using the changeset viewer.