Changeset 20935
- Timestamp:
- 07/18/16 02:53:03 (9 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/FemModel.cpp
r20871 r20935 365 365 /*Clean up*/ 366 366 delete iomodel; 367 }/*}}}*/ 368 void FemModel::InitFromFids(char* rootpath, FILE* IOMODEL, FILE* toolkitsoptionsfid, int in_solution_type, bool trace, IssmPDouble* X){/*{{{*/ 369 370 /*intermediary*/ 371 int i; 372 int analysis_type; 373 374 375 /*Initialize internal data: */ 376 this->solution_type = in_solution_type; 377 this->analysis_counter = nummodels-1; //point to last analysis_type carried out. 378 this->results = new Results(); //not initialized by CreateDataSets 379 380 /*create IoModel */ 381 IoModel* iomodel = new IoModel(IOMODEL,in_solution_type,trace,X); 382 383 /*Figure out what analyses are activated for this solution*/ 384 SolutionAnalysesList(&this->analysis_type_list,&this->nummodels,iomodel,this->solution_type); 385 386 /*create datasets for all analyses*/ 387 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); 388 389 /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */ 390 for(i=0;i<nummodels;i++){ 391 392 if(VerboseMProcessor()) _printf0_(" Processing finite element model of analysis " << EnumToStringx(analysis_type_list[i]) << ":\n"); 393 analysis_type=analysis_type_list[i]; 394 this->SetCurrentConfiguration(analysis_type); 395 396 if(i==0){ 397 if(VerboseMProcessor()) _printf0_(" creating vertex PIDs\n"); 398 VerticesDofx(vertices,parameters); 399 400 if(VerboseMProcessor()) _printf0_(" detecting active vertices\n"); 401 GetMaskOfIceVerticesLSMx(this); 402 } 403 404 if(VerboseMProcessor()) _printf0_(" resolving node constraints\n"); 405 SpcNodesx(nodes,constraints,parameters,analysis_type); 406 407 if(VerboseMProcessor()) _printf0_(" creating nodal degrees of freedom\n"); 408 NodesDofx(nodes,parameters,analysis_type); 409 410 if(VerboseMProcessor()) _printf0_(" configuring element and loads\n"); 411 ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters); 412 } 413 414 /*Clean up*/ 415 delete iomodel; 416 367 417 }/*}}}*/ 368 418 void FemModel::Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction){ /*{{{*/ … … 2650 2700 2651 2701 /*intermediary*/ 2652 int i;2653 int analysis_type;2654 2702 FILE *IOMODEL = NULL; 2655 2703 FILE *toolkitsoptionsfid = NULL; … … 2658 2706 size_t outputsize; 2659 2707 char *outputbuffer; 2660 const char* rootpath=""; //needed for Dakota runs only, which we won't do here.2708 const char* rootpath=""; //needed for Dakota runs only, which we won't do here. 2661 2709 2662 2710 /*recover my_rank:*/ 2663 2711 my_rank=IssmComm::GetRank(); 2664 2712 2665 /*Initialize internal data: */ 2666 this->solution_type = in_solution_type; 2667 this->analysis_counter = nummodels-1; //point to last analysis_type carried out. 2668 this->results = new Results(); //not initialized by CreateDataSets 2669 2670 /*Open input file on cpu 0 and create IoModel */ 2713 /*Open input file descriptor on cpu 0: */ 2671 2714 if(my_rank==0) IOMODEL = fmemopen((void*)buffer, buffersize, "rb"); 2672 IoModel* iomodel = new IoModel(IOMODEL,in_solution_type,trace,X); 2673 2674 /*Figure out what analyses are activated for this solution*/ 2675 SolutionAnalysesList(&this->analysis_type_list,&this->nummodels,iomodel,this->solution_type); 2676 2677 /*Open toolkits file: */ 2715 2716 /*Open toolkits file descriptor: */ 2678 2717 toolkitsoptionsfid=fmemopen((void*)toolkits, strlen(toolkits)+1, "r"); 2679 2718 2680 /*create datasets for all analyses*/ 2681 ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints,&this->loads,&this->parameters,iomodel,toolkitsoptionsfid,(char*)rootpath,this->solution_type,this->nummodels,this->analysis_type_list); 2682 2683 /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */ 2684 for(i=0;i<nummodels;i++){ 2685 2686 if(VerboseMProcessor()) _printf0_(" Processing finite element model of analysis " << EnumToStringx(analysis_type_list[i]) << ":\n"); 2687 analysis_type=analysis_type_list[i]; 2688 this->SetCurrentConfiguration(analysis_type); 2689 2690 if(i==0){ 2691 if(VerboseMProcessor()) _printf0_(" creating vertex PIDs\n"); 2692 VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices 2693 } 2694 2695 if(VerboseMProcessor()) _printf0_(" resolving node constraints\n"); 2696 SpcNodesx(nodes,constraints,parameters,analysis_type); 2697 2698 if(VerboseMProcessor()) _printf0_(" creating nodal degrees of freedom\n"); 2699 NodesDofx(nodes,parameters,analysis_type); 2700 2701 if(VerboseMProcessor()) _printf0_(" configuring element and loads\n"); 2702 ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters); 2703 } 2719 /*Now, go create FemModel:*/ 2720 this->InitFromFids((char*)rootpath,IOMODEL,toolkitsoptionsfid,in_solution_type,trace,X); 2704 2721 2705 2722 /*Close input file and toolkits file descriptors: */ … … 2714 2731 this->parameters->AddObject(new GenericParam<size_t*>(&outputsize,OutputBufferSizePointerEnum)); 2715 2732 2716 /*Clean up*/2717 delete iomodel;2718 2733 }/*}}}*/ 2719 2734 #endif -
issm/trunk-jpl/src/c/classes/FemModel.h
r20810 r20935 55 55 void Echo(); 56 56 void InitFromFiles(char* rootpath, char* inputfilename, char* outputfilename, char* petscfilename, char* lockfilename, char* restartfilename, const int solution_type,bool trace,IssmPDouble* X=NULL); 57 void InitFromFids(char* rootpath, FILE* IOMODEL, FILE* toolkitsoptionsfid, int in_solution_type, bool trace, IssmPDouble* X=NULL); 57 58 void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction); 58 59 void Restart(void);
Note:
See TracChangeset
for help on using the changeset viewer.