Changeset 18529
- Timestamp:
- 09/18/14 08:41:51 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r18492 r18529 342 342 ./cores/ProcessArguments.cpp\ 343 343 ./cores/ResetBoundaryConditions.cpp\ 344 ./cores/AnalysisConfiguration.cpp\345 344 ./cores/WrapperCorePointerFromSolutionEnum.cpp\ 346 345 ./cores/CorePointerFromSolutionEnum.cpp\ -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r18528 r18529 75 75 ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,&rootpath,argc,argv); 76 76 77 /*out of solution_type, figure out types of analyses needed in the femmodel: */78 AnalysisConfiguration(&analyses,&numanalyses,solution_type);79 80 77 /*Create femmodel from input files: */ 81 78 profiler->Tag(StartInit); 82 this->InitFromFiles(rootpath,binfilename,outbinfilename,petscfilename,lockfilename,solution_type ,analyses,numanalyses);79 this->InitFromFiles(rootpath,binfilename,outbinfilename,petscfilename,lockfilename,solution_type); 83 80 profiler->Tag(FinishInit); 84 81 … … 90 87 xDelete<char>(petscfilename); 91 88 xDelete<char>(rootpath); 92 93 }94 /*}}}*/95 FemModel::FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, const int in_solution_type,const int* analyses,const int nummodels){/*{{{*/96 97 /*Call InitFromFiles. This constructor is just a wrapper: */98 this->InitFromFiles(rootpath, inputfilename, outputfilename, toolkitsfilename, lockfilename, in_solution_type,analyses,nummodels);99 89 100 90 } … … 141 131 } 142 132 /*}}}*/ 143 void FemModel::InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, const int in_solution_type ,const int* analyses,const int nummodels){/*{{{*/133 void FemModel::InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* toolkitsfilename, char* lockfilename, const int in_solution_type){/*{{{*/ 144 134 145 135 /*intermediary*/ … … 154 144 my_rank=IssmComm::GetRank(); 155 145 156 /*Open input file on cpu 0: */157 if(my_rank==0) IOMODEL = pfopen0(inputfilename ,"rb");158 159 /*Open toolkits file: */160 toolkitsoptionsfid=pfopen(toolkitsfilename,"r");161 162 146 /*Initialize internal data: */ 163 this->nummodels = nummodels;164 147 this->solution_type = in_solution_type; 165 148 this->analysis_counter = nummodels-1; //point to last analysis_type carried out. 166 149 this->results = new Results(); //not initialized by CreateDataSets 167 150 168 /*Dynamically allocate whatever is a list of length nummodels: */ 169 analysis_type_list=xNew<int>(nummodels); 170 171 /*Initialize: */ 172 for(i=0;i<nummodels;i++)analysis_type_list[i]=analyses[i]; 151 /*Open input file on cpu 0 and create IoModel */ 152 if(my_rank==0) IOMODEL = pfopen0(inputfilename ,"rb"); 153 IoModel* iomodel = new IoModel(IOMODEL); 154 155 /*Figure out what analyses are activated for this solution*/ 156 SolutionAnalysesList(&this->analysis_type_list,&this->nummodels,iomodel,this->solution_type); 157 158 /*Open toolkits file: */ 159 toolkitsoptionsfid=pfopen(toolkitsfilename,"r"); 173 160 174 161 /*create datasets for all analyses*/ 175 ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints,&this->loads,&this->parameters, IOMODEL,toolkitsoptionsfid,rootpath,this->solution_type,nummodels,analyses);162 ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints,&this->loads,&this->parameters,iomodel,toolkitsoptionsfid,rootpath,this->solution_type,this->nummodels,this->analysis_type_list); 176 163 177 164 /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */ … … 209 196 this->parameters->AddObject(new StringParam(LockFileNameEnum,lockfilename)); 210 197 211 } 212 /*}}}*/ 198 /*Clean up*/ 199 delete iomodel; 200 }/*}}}*/ 213 201 void FemModel::CleanUp(void){/*{{{*/ 214 202 … … 412 400 } 413 401 /*}}}*/ 402 void FemModel::SolutionAnalysesList(int** panalyses,int* pnumanalyses,IoModel* iomodel,int solutiontype){/*{{{*/ 403 404 /*output: */ 405 int numanalyses = 0; 406 int* analyses=NULL; 407 408 /*Intermediaries*/ 409 const int MAXANALYSES = 30; 410 int analyses_temp[MAXANALYSES]; 411 412 /*Analyses lists*/ 413 switch(solutiontype){ 414 415 case StressbalanceSolutionEnum:{ 416 bool isSIA,isFS; 417 int fe_FS; 418 iomodel->Constant(&fe_FS,FlowequationFeFSEnum); 419 iomodel->Constant(&isSIA,FlowequationIsSIAEnum); 420 iomodel->Constant(&isFS,FlowequationIsFSEnum); 421 analyses_temp[numanalyses++]=StressbalanceAnalysisEnum; 422 analyses_temp[numanalyses++]=StressbalanceVerticalAnalysisEnum; 423 if(isSIA){ 424 analyses_temp[numanalyses++]=StressbalanceSIAAnalysisEnum; 425 } 426 analyses_temp[numanalyses++]=L2ProjectionBaseAnalysisEnum; 427 analyses_temp[numanalyses++]=ExtrudeFromBaseAnalysisEnum; 428 analyses_temp[numanalyses++]=DepthAverageAnalysisEnum; 429 if(fe_FS==LATaylorHoodEnum || fe_FS==LACrouzeixRaviartEnum){ 430 analyses_temp[numanalyses++]=UzawaPressureAnalysisEnum; 431 } 432 } 433 break; 434 435 case SteadystateSolutionEnum: 436 analyses_temp[numanalyses++]=StressbalanceAnalysisEnum; 437 analyses_temp[numanalyses++]=StressbalanceVerticalAnalysisEnum; 438 analyses_temp[numanalyses++]=StressbalanceSIAAnalysisEnum; 439 analyses_temp[numanalyses++]=L2ProjectionBaseAnalysisEnum; 440 analyses_temp[numanalyses++]=EnthalpyAnalysisEnum; 441 analyses_temp[numanalyses++]=ThermalAnalysisEnum; 442 analyses_temp[numanalyses++]=MeltingAnalysisEnum; 443 break; 444 445 case ThermalSolutionEnum: 446 analyses[numanalyses++]=ThermalAnalysisEnum; 447 analyses[numanalyses++]=MeltingAnalysisEnum; 448 analyses[numanalyses++]=EnthalpyAnalysisEnum; 449 break; 450 451 case HydrologySolutionEnum: 452 analyses[numanalyses++]=HydrologyShreveAnalysisEnum; 453 analyses[numanalyses++]=HydrologyDCInefficientAnalysisEnum; 454 analyses[numanalyses++]=HydrologyDCEfficientAnalysisEnum; 455 analyses[numanalyses++]=L2ProjectionBaseAnalysisEnum; 456 analyses[numanalyses++]=L2ProjectionEPLAnalysisEnum; 457 break; 458 459 case MasstransportSolutionEnum: 460 analyses[numanalyses++]=MasstransportAnalysisEnum; 461 break; 462 463 case BalancethicknessSolutionEnum: 464 analyses[numanalyses++]=BalancethicknessAnalysisEnum; 465 break; 466 467 case Balancethickness2SolutionEnum: 468 analyses[numanalyses++]=Balancethickness2AnalysisEnum; 469 break; 470 471 case BalancethicknessSoftSolutionEnum: 472 analyses[numanalyses++]=BalancethicknessAnalysisEnum; 473 break; 474 475 case BalancevelocitySolutionEnum: 476 analyses[numanalyses++]=BalancevelocityAnalysisEnum; 477 analyses[numanalyses++]=SmoothedSurfaceSlopeXAnalysisEnum; 478 analyses[numanalyses++]=SmoothedSurfaceSlopeYAnalysisEnum; 479 break; 480 481 case SurfaceSlopeSolutionEnum: 482 analyses[numanalyses++]=L2ProjectionBaseAnalysisEnum; 483 break; 484 485 case BedSlopeSolutionEnum: 486 analyses[numanalyses++]=L2ProjectionBaseAnalysisEnum; 487 break; 488 489 case GiaSolutionEnum: 490 analyses[numanalyses++]=GiaAnalysisEnum; 491 break; 492 493 case DamageEvolutionSolutionEnum: 494 analyses[numanalyses++]=DamageEvolutionAnalysisEnum; 495 break; 496 497 case TransientSolutionEnum: 498 analyses_temp[numanalyses++]=StressbalanceAnalysisEnum; 499 analyses_temp[numanalyses++]=StressbalanceVerticalAnalysisEnum; 500 analyses_temp[numanalyses++]=StressbalanceSIAAnalysisEnum; 501 analyses_temp[numanalyses++]=L2ProjectionBaseAnalysisEnum; 502 analyses_temp[numanalyses++]=ThermalAnalysisEnum; 503 analyses_temp[numanalyses++]=MeltingAnalysisEnum; 504 analyses_temp[numanalyses++]=EnthalpyAnalysisEnum; 505 analyses_temp[numanalyses++]=MasstransportAnalysisEnum; 506 analyses_temp[numanalyses++]=FreeSurfaceBaseAnalysisEnum; 507 analyses_temp[numanalyses++]=FreeSurfaceTopAnalysisEnum; 508 analyses_temp[numanalyses++]=ExtrudeFromBaseAnalysisEnum; 509 analyses_temp[numanalyses++]=ExtrudeFromTopAnalysisEnum; 510 analyses_temp[numanalyses++]=LevelsetAnalysisEnum; 511 analyses_temp[numanalyses++]=ExtrapolationAnalysisEnum; 512 analyses_temp[numanalyses++]=LsfReinitializationAnalysisEnum; 513 analyses_temp[numanalyses++]=DamageEvolutionAnalysisEnum; 514 analyses_temp[numanalyses++]=HydrologyShreveAnalysisEnum; 515 analyses_temp[numanalyses++]=HydrologyDCInefficientAnalysisEnum; 516 analyses_temp[numanalyses++]=HydrologyDCEfficientAnalysisEnum; 517 analyses_temp[numanalyses++]=L2ProjectionEPLAnalysisEnum; 518 break; 519 520 case SeaiceSolutionEnum: 521 analyses_temp[numanalyses++]=SeaiceAnalysisEnum; 522 break; 523 524 default: 525 _error_("solution type: " << EnumToStringx(solutiontype) << " not supported yet!"); 526 break; 527 } 528 529 /*Copy analyses from temp to output*/ 530 _assert_(numanalyses<MAXANALYSES); 531 analyses=xNew<int>(numanalyses); 532 for(int i=0;i<numanalyses;i++) analyses[i]=analyses_temp[i]; 533 534 /*Assign output pointers:*/ 535 if(pnumanalyses) *pnumanalyses=numanalyses; 536 if(panalyses) *panalyses=analyses; 537 else xDelete<int>(analyses); 538 }/*}}}*/ 414 539 415 540 /*Modules:*/ -
issm/trunk-jpl/src/c/classes/FemModel.h
r18528 r18529 47 47 /*constructors, destructors: */ 48 48 FemModel(int argc,char** argv,ISSM_MPI_Comm comm_init); 49 FemModel(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels);50 49 ~FemModel(); 51 50 … … 53 52 void Echo(); 54 53 FemModel* copy(); 55 void InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type,const int* analyses,const int nummodels); 54 void InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, const int solution_type); 55 void SolutionAnalysesList(int** panalyses,int* pnumanalyses,IoModel* iomodel,int solutiontype); 56 56 void CleanUp(void); 57 57 void Solve(void); -
issm/trunk-jpl/src/c/cores/cores.h
r18492 r18529 58 58 59 59 //solution configuration 60 void AnalysisConfiguration(int** pcores,int* pnumcores, int solutiontype);61 60 void CorePointerFromSolutionEnum(void (**psolutioncore)(FemModel*),Parameters* parameters,int solutiontype); 62 61 void WrapperCorePointerFromSolutionEnum(void (**psolutioncore)(FemModel*),Parameters* parameters,int solutiontype,bool nodakotacore=false); -
issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
r17757 r18529 13 13 #include "./ModelProcessorx.h" 14 14 15 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters, FILE* IOMODEL,FILE* toolkitfile, char* rootpath,const int solution_enum,const int nummodels,const int* analysis_enum_list){15 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters,IoModel* iomodel,FILE* toolkitfile, char* rootpath,const int solution_enum,const int nummodels,const int* analysis_enum_list){ 16 16 17 17 int i,analysis_enum,verbose; … … 26 26 Loads *loads = new Loads(); 27 27 Parameters *parameters = new Parameters(); 28 29 /*Initialize IoModel from input file*/30 IoModel* iomodel = new IoModel(IOMODEL);31 28 32 29 /*Fetch parameters: */ … … 128 125 if(VerboseMProcessor()) _printf0_(" done with model processor \n"); 129 126 130 /*Free resources:*/131 delete iomodel;132 133 127 /*Assign output pointers:*/ 134 128 *pelements = elements; -
issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h
r17844 r18529 9 9 #include "../../analyses/analyses.h" 10 10 11 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters, FILE* iomodel_handle,FILE* toolkitfile, char* rootpath,const int solution_type,const int nummodels,const int* analysis_type_listh);11 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters,IoModel* iomodel,FILE* toolkitfile, char* rootpath,const int solution_type,const int nummodels,const int* analysis_type_listh); 12 12 13 13 /*Creation of fem datasets: general drivers*/
Note:
See TracChangeset
for help on using the changeset viewer.