Changeset 20936


Ignore:
Timestamp:
07/18/16 09:05:08 (9 years ago)
Author:
Mathieu Morlighem
Message:

CHG: using Eric's new InitFromFid function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r20935 r20936  
    294294
    295295        /*intermediary*/
    296         int         i;
    297         int         analysis_type;
    298         FILE       *IOMODEL = NULL;
    299         FILE       *toolkitsoptionsfid = NULL;
    300         FILE       *output_fid = NULL;
    301         int         my_rank;
     296        FILE *IOMODEL            = NULL;
     297        FILE *toolkitsoptionsfid = NULL;
     298        FILE *output_fid         = NULL;
    302299
    303300        /*recover my_rank:*/
    304         my_rank=IssmComm::GetRank();
    305 
    306         /*Initialize internal data: */
    307         this->solution_type    = in_solution_type;
    308         this->analysis_counter = nummodels-1;   //point to last analysis_type carried out.
    309         this->results          = new Results(); //not initialized by CreateDataSets
    310         /*Open input file on cpu 0 and create IoModel */
     301        int my_rank=IssmComm::GetRank();
     302
     303        /*Open input file descriptor on cpu 0: */
    311304        if(my_rank==0) IOMODEL = pfopen0(inputfilename ,"rb");
    312         IoModel* iomodel = new IoModel(IOMODEL,in_solution_type,trace,X);
    313 
    314         /*Figure out what analyses are activated for this solution*/
    315         SolutionAnalysesList(&this->analysis_type_list,&this->nummodels,iomodel,this->solution_type);
    316305
    317306        /*Open toolkits file: */
    318307        toolkitsoptionsfid=pfopen(toolkitsfilename,"r");
    319308
    320         /*create datasets for all analyses*/
    321         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);
    322 
    323 
    324         /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
    325         for(i=0;i<nummodels;i++){
    326 
    327                 if(VerboseMProcessor()) _printf0_("   Processing finite element model of analysis " << EnumToStringx(analysis_type_list[i]) << ":\n");
    328                 analysis_type=analysis_type_list[i];
    329                 this->SetCurrentConfiguration(analysis_type);
    330 
    331                 if(VerboseMProcessor()) _printf0_("      configuring element and loads\n");
    332                 ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
    333 
    334                 if(i==0){
    335                         if(VerboseMProcessor()) _printf0_("      creating vertex PIDs\n");
    336                         VerticesDofx(vertices,parameters);
    337 
    338                         if(VerboseMProcessor()) _printf0_("      detecting active vertices\n");
    339                         GetMaskOfIceVerticesLSMx(this);
    340                 }
    341 
    342                 if(VerboseMProcessor()) _printf0_("      resolving node constraints\n");
    343                 SpcNodesx(nodes,constraints,parameters,analysis_type);
    344 
    345                 if(VerboseMProcessor()) _printf0_("      creating nodal degrees of freedom\n");
    346                 NodesDofx(nodes,parameters,analysis_type);
    347         }
     309        /*Now, go create FemModel:*/
     310        this->InitFromFids(rootpath,IOMODEL,toolkitsoptionsfid,in_solution_type,trace,X);
    348311
    349312        /*Close input file and toolkits file descriptors: */
     
    363326        this->parameters->AddObject(new StringParam(RestartFileNameEnum,restartfilename));
    364327
    365         /*Clean up*/
    366         delete iomodel;
    367328}/*}}}*/
    368329void FemModel::InitFromFids(char* rootpath, FILE* IOMODEL, FILE* toolkitsoptionsfid, int in_solution_type, bool trace, IssmPDouble* X){/*{{{*/
    369330       
    370         /*intermediary*/
    371         int         i;
    372         int         analysis_type;
    373        
    374 
    375331        /*Initialize internal data: */
    376332        this->solution_type    = in_solution_type;
     
    388344
    389345        /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
    390         for(i=0;i<nummodels;i++){
     346        for(int i=0;i<nummodels;i++){
    391347
    392348                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);
     349                this->SetCurrentConfiguration(analysis_type_list[i]);
     350
     351                if(VerboseMProcessor()) _printf0_("      configuring element and loads\n");
     352                ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
    395353               
    396354                if(i==0){
     
    403361
    404362                if(VerboseMProcessor()) _printf0_("      resolving node constraints\n");
    405                 SpcNodesx(nodes,constraints,parameters,analysis_type);
     363                SpcNodesx(nodes,constraints,parameters,analysis_type_list[i]);
    406364
    407365                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);
     366                NodesDofx(nodes,parameters,analysis_type_list[i]);
    412367        }
    413368
    414369        /*Clean up*/
    415370        delete iomodel;
    416 
    417371}/*}}}*/
    418372void FemModel::Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
Note: See TracChangeset for help on using the changeset viewer.