Changeset 21861


Ignore:
Timestamp:
07/25/17 08:32:21 (8 years ago)
Author:
Mathieu Morlighem
Message:

CHG: fixing adolc

Location:
issm/trunk-jpl/src/c/classes
Files:
2 edited

Legend:

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

    r21857 r21861  
    15441544}
    15451545/*}}}*/
    1546 void FemModel::ReMesh(void){/*{{{*/
    1547 
    1548         /*Intermediaries*/
    1549         IssmDouble *newx                        = NULL;
    1550         IssmDouble *newy                        = NULL;
    1551         IssmDouble *newz                        = NULL;
    1552         int *newelementslist            = NULL;
    1553         int newnumberofvertices = -1;
    1554         int newnumberofelements = -1;
    1555         bool* my_elements                       = NULL;
    1556         int* my_vertices                        = NULL;
    1557         int elementswidth       = this->GetElementsWidth();//just tria elements in this version
    1558         int amrtype;
    1559 
    1560         /*Branch to specific amr depending on requested method*/       
    1561         parameters->FindParam(&amrtype,AmrTypeEnum);
    1562         switch(amrtype){
    1563                 #if defined(_HAVE_NEOPZ_) && !defined(_HAVE_ADOLC_)
    1564                 case AmrNeopzEnum: this->ReMeshNeopz(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); break;
    1565                 #endif
    1566 
    1567                 #if defined(_HAVE_BAMG_) && !defined(_HAVE_ADOLC_)
    1568                 case AmrBamgEnum: this->ReMeshBamg(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); break;
    1569                 #endif
    1570 
    1571                 default: _error_("not implemented yet");
    1572         }
    1573 
    1574         /*Partitioning the new mesh. Maybe ElementsAndVerticesPartitioning.cpp could be modified to set this without iomodel.*/
    1575         this->ElementsAndVerticesPartitioning(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,&my_elements,&my_vertices);
    1576 
    1577         if(this->loads->Size()!=0) _error_("not supported yet");
    1578 
    1579         /*Create vertices*/
    1580         Vertices* new_vertices=new Vertices();
    1581         this->CreateVertices(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,my_vertices,newx,newy,newz,new_vertices);
    1582 
    1583         /*Creating elements*/
    1584         /*Just Tria in this version*/
    1585         Elements* new_elements=new Elements();
    1586         this->CreateElements(newnumberofelements,elementswidth,newelementslist,my_elements,new_elements);
    1587 
    1588         /*Creating materials*/
    1589         Materials* new_materials=new Materials();
    1590         this->CreateMaterials(newnumberofelements,my_elements,new_materials);
    1591 
    1592         /*Creating nodes and constraints*/
    1593         /*Just SSA (2D) and P1 in this version*/
    1594         Nodes* new_nodes=new Nodes();
    1595         Constraints* new_constraints=new Constraints();
    1596 
    1597         int nodecounter=0;
    1598         int constraintcounter=0;
    1599         for(int i=0;i<this->nummodels;i++){//create nodes for each analysis in analysis_type_list
    1600 
    1601                 int analysis_enum = this->analysis_type_list[i];
    1602 
    1603                 /*As the domain is 2D, it is not necessary to create nodes for this analysis*/
    1604                 /*itapopo must verify if domain is not 3D. Only 2D in this version!*/
    1605                 if(analysis_enum==StressbalanceVerticalAnalysisEnum) continue;     
    1606 
    1607                 this->CreateNodes(newnumberofvertices,my_vertices,nodecounter,analysis_enum,new_nodes);
    1608                 if(analysis_enum==StressbalanceAnalysisEnum) this->CreateConstraints(newnumberofvertices,newnumberofelements,nodecounter,constraintcounter,newx,newy,my_vertices,new_constraints);
    1609                 this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements);
    1610 
    1611                 if(new_nodes->Size()) nodecounter=new_nodes->MaximumId();
    1612                 constraintcounter = new_constraints->NumberOfConstraints();
    1613                 /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
    1614                 _assert_(nodecounter>=0);
    1615         }
    1616 
    1617         new_elements->Presort();
    1618         new_nodes->Presort();
    1619         new_vertices->Presort();
    1620         this->loads->Presort();
    1621         new_materials->Presort();
    1622         new_constraints->Presort();
    1623 
    1624         /*reset hooks for elements, loads and nodes: */
    1625         new_elements->ResetHooks();
    1626         this->loads->ResetHooks();
    1627         new_materials->ResetHooks();
    1628 
    1629         /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
    1630         int analysis_type;
    1631         for(int i=0;i<this->nummodels;i++){
    1632                 analysis_type=this->analysis_type_list[i];
    1633                 //SetCurrentConfiguration(analysis_type);
    1634 
    1635                 this->analysis_counter=i;       
    1636                 /*Now, plug analysis_counter and analysis_type inside the parameters: */
    1637                 this->parameters->SetParam(this->analysis_counter,AnalysisCounterEnum);
    1638                 this->parameters->SetParam(analysis_type,AnalysisTypeEnum);
    1639                 this->parameters->SetParam(analysis_type,ConfigurationTypeEnum);
    1640 
    1641                 /*configure elements, loads and nodes, for this new analysis: */
    1642                 new_elements->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
    1643                 this->loads->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
    1644 
    1645                 /*take care of toolkits options, that depend on this analysis type (present only after model processor)*/
    1646                 if(this->parameters->Exist(ToolkitsOptionsStringsEnum)){
    1647                         ToolkitsOptionsFromAnalysis(this->parameters,analysis_type);
    1648                         if(VerboseSolver()) _printf0_("      toolkits Options set for analysis type: " << EnumToStringx(analysis_type) << "\n");
    1649                 }
    1650 
    1651                 ConfigureObjectsx(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
    1652                 if(i==0){
    1653                         VerticesDofx(new_vertices,this->parameters); //only call once, we only have one set of vertices
    1654                 }
    1655                 SpcNodesx(new_nodes,new_constraints,this->parameters,analysis_type);
    1656                 NodesDofx(new_nodes,this->parameters,analysis_type);
    1657         }
    1658 
    1659         /*Finally: interpolate all inputs and insert them into the new elements.*/
    1660         this->InterpolateInputs(new_vertices,new_elements);
    1661 
    1662         /*Delete old structure and set new pointers*/
    1663         delete this->vertices;          this->vertices          = new_vertices;
    1664         delete this->elements;          this->elements          = new_elements;
    1665         delete this->nodes;                     this->nodes                     = new_nodes;
    1666         delete this->constraints;       this->constraints       = new_constraints;
    1667         delete this->materials;         this->materials = new_materials;
    1668 
    1669         GetMaskOfIceVerticesLSMx(this);
    1670 
    1671         /*Insert MISMIP+ bed topography*/
    1672         if(false) this->BedrockFromMismipPlus();
    1673 
    1674         /*Adjust base, thickness and mask grounded ice leve set*/
    1675         if(true) this->AdjustBaseThicknessAndMask();
    1676 
    1677         /*Reset current configuration: */
    1678         analysis_type=this->analysis_type_list[this->analysis_counter];
    1679         SetCurrentConfiguration(analysis_type);
    1680 
    1681         /*Cleanup*/
    1682         xDelete<IssmDouble>(newx);
    1683         xDelete<IssmDouble>(newy);
    1684         xDelete<IssmDouble>(newz);
    1685         xDelete<int>(newelementslist);
    1686         xDelete<int>(my_vertices);
    1687         xDelete<bool>(my_elements);
    1688 }
    1689 /*}}}*/
    16901546void FemModel::RequestedDependentsx(void){/*{{{*/
    16911547
     
    24292285/*AMR*/
    24302286#if !defined(_HAVE_ADOLC_)
     2287void FemModel::ReMesh(void){/*{{{*/
     2288
     2289        /*Intermediaries*/
     2290        IssmDouble *newx                        = NULL;
     2291        IssmDouble *newy                        = NULL;
     2292        IssmDouble *newz                        = NULL;
     2293        int *newelementslist            = NULL;
     2294        int newnumberofvertices = -1;
     2295        int newnumberofelements = -1;
     2296        bool* my_elements                       = NULL;
     2297        int* my_vertices                        = NULL;
     2298        int elementswidth       = this->GetElementsWidth();//just tria elements in this version
     2299        int amrtype;
     2300
     2301        /*Branch to specific amr depending on requested method*/       
     2302        parameters->FindParam(&amrtype,AmrTypeEnum);
     2303        switch(amrtype){
     2304                #if defined(_HAVE_NEOPZ_) && !defined(_HAVE_ADOLC_)
     2305                case AmrNeopzEnum: this->ReMeshNeopz(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); break;
     2306                                                                 #endif
     2307
     2308                                                                 #if defined(_HAVE_BAMG_) && !defined(_HAVE_ADOLC_)
     2309                case AmrBamgEnum: this->ReMeshBamg(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); break;
     2310                                                                #endif
     2311
     2312                default: _error_("not implemented yet");
     2313        }
     2314
     2315        /*Partitioning the new mesh. Maybe ElementsAndVerticesPartitioning.cpp could be modified to set this without iomodel.*/
     2316        this->ElementsAndVerticesPartitioning(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,&my_elements,&my_vertices);
     2317
     2318        if(this->loads->Size()!=0) _error_("not supported yet");
     2319
     2320        /*Create vertices*/
     2321        Vertices* new_vertices=new Vertices();
     2322        this->CreateVertices(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,my_vertices,newx,newy,newz,new_vertices);
     2323
     2324        /*Creating elements*/
     2325        /*Just Tria in this version*/
     2326        Elements* new_elements=new Elements();
     2327        this->CreateElements(newnumberofelements,elementswidth,newelementslist,my_elements,new_elements);
     2328
     2329        /*Creating materials*/
     2330        Materials* new_materials=new Materials();
     2331        this->CreateMaterials(newnumberofelements,my_elements,new_materials);
     2332
     2333        /*Creating nodes and constraints*/
     2334        /*Just SSA (2D) and P1 in this version*/
     2335        Nodes* new_nodes=new Nodes();
     2336        Constraints* new_constraints=new Constraints();
     2337
     2338        int nodecounter=0;
     2339        int constraintcounter=0;
     2340        for(int i=0;i<this->nummodels;i++){//create nodes for each analysis in analysis_type_list
     2341
     2342                int analysis_enum = this->analysis_type_list[i];
     2343
     2344                /*As the domain is 2D, it is not necessary to create nodes for this analysis*/
     2345                /*itapopo must verify if domain is not 3D. Only 2D in this version!*/
     2346                if(analysis_enum==StressbalanceVerticalAnalysisEnum) continue;     
     2347
     2348                this->CreateNodes(newnumberofvertices,my_vertices,nodecounter,analysis_enum,new_nodes);
     2349                if(analysis_enum==StressbalanceAnalysisEnum) this->CreateConstraints(newnumberofvertices,newnumberofelements,nodecounter,constraintcounter,newx,newy,my_vertices,new_constraints);
     2350                this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements);
     2351
     2352                if(new_nodes->Size()) nodecounter=new_nodes->MaximumId();
     2353                constraintcounter = new_constraints->NumberOfConstraints();
     2354                /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
     2355                _assert_(nodecounter>=0);
     2356        }
     2357
     2358        new_elements->Presort();
     2359        new_nodes->Presort();
     2360        new_vertices->Presort();
     2361        this->loads->Presort();
     2362        new_materials->Presort();
     2363        new_constraints->Presort();
     2364
     2365        /*reset hooks for elements, loads and nodes: */
     2366        new_elements->ResetHooks();
     2367        this->loads->ResetHooks();
     2368        new_materials->ResetHooks();
     2369
     2370        /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
     2371        int analysis_type;
     2372        for(int i=0;i<this->nummodels;i++){
     2373                analysis_type=this->analysis_type_list[i];
     2374                //SetCurrentConfiguration(analysis_type);
     2375
     2376                this->analysis_counter=i;       
     2377                /*Now, plug analysis_counter and analysis_type inside the parameters: */
     2378                this->parameters->SetParam(this->analysis_counter,AnalysisCounterEnum);
     2379                this->parameters->SetParam(analysis_type,AnalysisTypeEnum);
     2380                this->parameters->SetParam(analysis_type,ConfigurationTypeEnum);
     2381
     2382                /*configure elements, loads and nodes, for this new analysis: */
     2383                new_elements->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
     2384                this->loads->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
     2385
     2386                /*take care of toolkits options, that depend on this analysis type (present only after model processor)*/
     2387                if(this->parameters->Exist(ToolkitsOptionsStringsEnum)){
     2388                        ToolkitsOptionsFromAnalysis(this->parameters,analysis_type);
     2389                        if(VerboseSolver()) _printf0_("      toolkits Options set for analysis type: " << EnumToStringx(analysis_type) << "\n");
     2390                }
     2391
     2392                ConfigureObjectsx(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
     2393                if(i==0){
     2394                        VerticesDofx(new_vertices,this->parameters); //only call once, we only have one set of vertices
     2395                }
     2396                SpcNodesx(new_nodes,new_constraints,this->parameters,analysis_type);
     2397                NodesDofx(new_nodes,this->parameters,analysis_type);
     2398        }
     2399
     2400        /*Finally: interpolate all inputs and insert them into the new elements.*/
     2401        this->InterpolateInputs(new_vertices,new_elements);
     2402
     2403        /*Delete old structure and set new pointers*/
     2404        delete this->vertices;          this->vertices          = new_vertices;
     2405        delete this->elements;          this->elements          = new_elements;
     2406        delete this->nodes;                     this->nodes                     = new_nodes;
     2407        delete this->constraints;       this->constraints       = new_constraints;
     2408        delete this->materials;         this->materials = new_materials;
     2409
     2410        GetMaskOfIceVerticesLSMx(this);
     2411
     2412        /*Insert MISMIP+ bed topography*/
     2413        if(false) this->BedrockFromMismipPlus();
     2414
     2415        /*Adjust base, thickness and mask grounded ice leve set*/
     2416        if(true) this->AdjustBaseThicknessAndMask();
     2417
     2418        /*Reset current configuration: */
     2419        analysis_type=this->analysis_type_list[this->analysis_counter];
     2420        SetCurrentConfiguration(analysis_type);
     2421
     2422        /*Cleanup*/
     2423        xDelete<IssmDouble>(newx);
     2424        xDelete<IssmDouble>(newy);
     2425        xDelete<IssmDouble>(newz);
     2426        xDelete<int>(newelementslist);
     2427        xDelete<int>(my_vertices);
     2428        xDelete<bool>(my_elements);
     2429}
     2430/*}}}*/
    24312431void FemModel::BedrockFromMismipPlus(void){/*{{{*/
    24322432
  • issm/trunk-jpl/src/c/classes/FemModel.h

    r21857 r21861  
    7373                void InitFromFids(char* rootpath, FILE* IOMODEL, FILE* toolkitsoptionsfid, int in_solution_type, bool trace, IssmPDouble* X=NULL);
    7474                void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
    75                 void ReMesh(void);
    7675                void Restart(void);
    7776                void SetCurrentConfiguration(int configuration_type);
     
    158157                /*AMR*/
    159158                #if !defined(_HAVE_ADOLC_)
     159                void ReMesh(void);
    160160                void BedrockFromMismipPlus(void);
    161161                void AdjustBaseThicknessAndMask(void);
Note: See TracChangeset for help on using the changeset viewer.