Changeset 3982


Ignore:
Timestamp:
05/28/10 15:22:16 (15 years ago)
Author:
Eric.Larour
Message:

Starting uni-model transition

Location:
issm/trunk/src/c
Files:
2 added
2 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r3947 r3982  
    2626        //diagnostic
    2727        DiagnosticAnalysisEnum,
     28        DiagnosticHorizAnalysisEnum,
     29        DiagnosticVertAnalysisEnum,
     30        DiagnosticHutterAnalysisEnum,
     31        DiagnosticStokesAnalysisEnum,
    2832        HorizAnalysisEnum,
    2933        HutterAnalysisEnum,
  • issm/trunk/src/c/Makefile.am

    r3940 r3982  
    7878                                        ./objects/Bamg/VertexOnVertex.cpp\
    7979                                        ./objects/Element.h\
    80                                         ./objects/Model.h\
    81                                         ./objects/Model.cpp\
    8280                                        ./objects/FemModel.h\
    8381                                        ./objects/FemModel.cpp\
     
    533531                                        ./objects/Bamg/VertexOnVertex.h\
    534532                                        ./objects/Element.h\
    535                                         ./objects/Model.h\
    536                                         ./objects/Model.cpp\
    537533                                        ./objects/FemModel.h\
    538534                                        ./objects/FemModel.cpp\
  • issm/trunk/src/c/modules/ModelProcessorx/CreateDataSets.cpp

    r3913 r3982  
    1616
    1717
    18 void CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle){
     18void CreateDataSets(DataSet** pelements,DataSet** pnodes, DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type){
     19
     20        /*First, partition elements and vertices. Nodes will partitioned on a per analysis_type basis: */
     21        VerticesPartitioning(&iomodel->my_elements, &iomodel->my_vertices, &iomodel->my_bordervertices, iomodel, iomodel_handle);
    1922
    2023        /*create parameters common to all solutions: */
    2124        CreateParameters(pparameters,iomodel,iomodel_handle);
     25       
    2226        CreateParametersControl(pparameters,iomodel,iomodel_handle);
    2327
    2428        /*This is just a high level driver: */
    25         if (iomodel->analysis_type==DiagnosticAnalysisEnum){
     29        if (analysis_type==DiagnosticHorizAnalysisEnum){
     30                CreateElementsNodesAndMaterialsDiagnosticHoriz(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
     31                CreateConstraintsDiagnosticHoriz(pconstraints,iomodel,iomodel_handle);
     32                CreateLoadsDiagnosticHoriz(ploads,iomodel,iomodel_handle);
     33        }
     34        else if (analysis_type==DiagnosticVertAnalysisEnum){
    2635
    27                 if (iomodel->sub_analysis_type==HorizAnalysisEnum){
     36                CreateElementsNodesAndMaterialsDiagnosticVert(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
     37                CreateConstraintsDiagnosticVert(pconstraints,iomodel,iomodel_handle);
     38                CreateLoadsDiagnosticVert(ploads,iomodel,iomodel_handle);
     39        }
     40        else if (analysis_type==DiagnosticStokesAnalysisEnum){
    2841
    29                         CreateElementsNodesAndMaterialsDiagnosticHoriz(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    30                         CreateConstraintsDiagnosticHoriz(pconstraints,iomodel,iomodel_handle);
    31                         CreateLoadsDiagnosticHoriz(ploads,iomodel,iomodel_handle);
    32                 }
    33                 else if (iomodel->sub_analysis_type==VertAnalysisEnum){
    34                
    35                         CreateElementsNodesAndMaterialsDiagnosticVert(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    36                         CreateConstraintsDiagnosticVert(pconstraints,iomodel,iomodel_handle);
    37                         CreateLoadsDiagnosticVert(ploads,iomodel,iomodel_handle);
    38                 }
    39                 else if (iomodel->sub_analysis_type==StokesAnalysisEnum){
     42                CreateElementsNodesAndMaterialsDiagnosticStokes(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
     43                CreateConstraintsDiagnosticStokes(pconstraints,iomodel,iomodel_handle);
     44                CreateLoadsDiagnosticStokes(ploads,iomodel,iomodel_handle);
     45        }
     46        else if (analysis_type==DiagnosticHutterAnalysisEnum){
    4047
    41                         CreateElementsNodesAndMaterialsDiagnosticStokes(pelements,pnodes, pvertices, pmaterials, iomodel,iomodel_handle);
    42                         CreateConstraintsDiagnosticStokes(pconstraints,iomodel,iomodel_handle);
    43                         CreateLoadsDiagnosticStokes(ploads,iomodel,iomodel_handle);
    44                 }
    45                 else if (iomodel->sub_analysis_type==HutterAnalysisEnum){
    46 
    47                         CreateElementsNodesAndMaterialsDiagnosticHutter(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    48                         CreateConstraintsDiagnosticHutter(pconstraints,iomodel,iomodel_handle);
    49                         CreateLoadsDiagnosticHutter(ploads,iomodel,iomodel_handle);
    50                 }
     48                CreateElementsNodesAndMaterialsDiagnosticHutter(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
     49                CreateConstraintsDiagnosticHutter(pconstraints,iomodel,iomodel_handle);
     50                CreateLoadsDiagnosticHutter(ploads,iomodel,iomodel_handle);
    5151        }
    52         else if (iomodel->analysis_type==SlopecomputeAnalysisEnum){
     52        else if (analysis_type==SlopecomputeAnalysisEnum){
    5353
    5454                CreateElementsNodesAndMaterialsSlopeCompute(pelements,pnodes, pvertices,pmaterials, iomodel,iomodel_handle);
     
    5656                CreateLoadsSlopeCompute(ploads,iomodel,iomodel_handle);
    5757        }
    58         else if (iomodel->analysis_type==ThermalAnalysisEnum){
     58        else if (analysis_type==ThermalAnalysisEnum){
    5959
    6060                CreateElementsNodesAndMaterialsThermal(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    6161                CreateConstraintsThermal(pconstraints,iomodel,iomodel_handle);
    6262                CreateLoadsThermal(ploads,iomodel,iomodel_handle);
    63                                        
     63
    6464        }
    65         else if (iomodel->analysis_type==MeltingAnalysisEnum){
    66                        
     65        else if (analysis_type==MeltingAnalysisEnum){
     66
    6767                CreateElementsNodesAndMaterialsMelting(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
    6868                CreateConstraintsMelting(pconstraints,iomodel,iomodel_handle);
    6969                CreateLoadsMelting(ploads,iomodel,iomodel_handle);
    7070        }
    71         else if (iomodel->analysis_type==PrognosticAnalysisEnum){
     71        else if (analysis_type==PrognosticAnalysisEnum){
    7272
    7373                CreateElementsNodesAndMaterialsPrognostic(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
     
    7575                CreateLoadsPrognostic(ploads,iomodel,iomodel_handle);
    7676        }
    77         else if (iomodel->analysis_type==Prognostic2AnalysisEnum){
     77        else if (analysis_type==Prognostic2AnalysisEnum){
    7878
    7979                CreateElementsNodesAndMaterialsPrognostic2(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
     
    8181                CreateLoadsPrognostic2(ploads,iomodel,iomodel_handle);
    8282        }
    83         else if (iomodel->analysis_type==BalancedthicknessAnalysisEnum){
     83        else if (analysis_type==BalancedthicknessAnalysisEnum){
    8484
    8585                CreateElementsNodesAndMaterialsBalancedthickness(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
     
    8787                CreateLoadsBalancedthickness(ploads,iomodel,iomodel_handle);
    8888        }
    89         else if (iomodel->analysis_type==Balancedthickness2AnalysisEnum){
     89        else if (analysis_type==Balancedthickness2AnalysisEnum){
    9090
    9191                CreateElementsNodesAndMaterialsBalancedthickness2(pelements,pnodes,pvertices, pmaterials, iomodel,iomodel_handle);
     
    9393                CreateLoadsBalancedthickness2(ploads,iomodel,iomodel_handle);
    9494        }
    95         else if (iomodel->analysis_type==BalancedvelocitiesAnalysisEnum){
     95        else if (analysis_type==BalancedvelocitiesAnalysisEnum){
    9696
    9797                CreateElementsNodesAndMaterialsBalancedvelocities(pelements,pnodes,pvertices,pmaterials, iomodel,iomodel_handle);
     
    100100        }
    101101        else{
    102 
    103                 ISSMERROR("%s%i%s%i%s"," analysis_type: ",iomodel->analysis_type," sub_analysis_type: ",iomodel->sub_analysis_type," not supported yet!");
     102                ISSMERROR("%s%i%s%i%s"," analysis_type: ",analysis_type," analysis_type: ",analysis_type," not supported yet!");
    104103
    105104        }
  • issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.h

    r3931 r3982  
    1515
    1616/*Creation of fem datasets: general drivers*/
    17 void  CreateDataSets(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
     17void  CreateDataSets(DataSet** pelements,DataSet** pnodes,DataSet** pvertices, DataSet** pmaterials, DataSet** pconstraints, DataSet** ploads,Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle,int analysis_type);
    1818void  CreateParameters(Parameters** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle);
    1919
     
    8787
    8888/*partitioning: */
    89 void  Partitioning(bool** pmy_elements, bool** pmy_vertices, bool** pmy_nodes, bool** pmy_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle);
     89void  VerticesPartitioning(bool** pmy_elements, bool** pmy_vertices, bool** pmy_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle);
     90void  NodesPartitioning(bool** pmy_nodes,bool* my_elements, bool* my_vertices, bool* my_bordervertices, IoModel* iomodel, ConstDataHandle iomodel_handle,bool continuous);
    9091
    9192/*Conectivity*/
  • issm/trunk/src/c/objects/FemModel.cpp

    r3922 r3982  
    22 * \brief: implementation of the FemModel object
    33 */
     4
    45
    56#ifdef HAVE_CONFIG_H
     
    1011
    1112#include "stdio.h"
    12 #include "../shared/shared.h"
     13#include "../DataSet/DataSet.h"
     14#include "../modules/FemModelProcessorx/FemModelProcessorx.h"
     15#include "./objects.h"
    1316#include "../include/include.h"
    14 #include "./objects.h"
     17#include "../EnumDefinitions/EnumDefinitions.h"
     18#include "../modules/modules.h"
    1519
    16 /*constructors/destructors*/
    17 /*FUNCTION FemModel::FemModel {{{1*/
    18 FemModel::FemModel(){
    1920
    20         elements=NULL;
    21         nodes=NULL;
    22         vertices=NULL;
    23         constraints=NULL;
    24         loads=NULL;
    25         materials=NULL;
    26         parameters=NULL;
     21/*Object constructors and destructor*/
     22/*FUNCTION FemModel::constructor {{{1*/
     23FemModel::FemModel(int in_nummodels){
    2724
    28         partition=NULL;
    29         tpartition=NULL;
    30         yg=NULL;
    31         Rmg=NULL;
    32         nodesets=NULL;
    33         ys=NULL;
    34         ys0=NULL;
    35         Gmn=NULL;
     25        nummodels=in_nummodels;
     26        current_analysis_type=-1;
     27       
     28        /*Dynamically allocate whatever is a list of length nummodels: */
     29        analysis_type_list=(int*)xmalloc(nummodels*sizeof(int));
     30        for(i=0;i<nummodels;i++)analysis_type_list[i]=NoneAnalysisEnum;
     31
     32        Rmg=(Mat*)xmalloc(nummodels*sizeof(Mat));
     33        for(i=0;i<nummodels;i++)Rmg[i]=NULL;
     34
     35        Gmn=(Mat*)xmalloc(nummodels*sizeof(Mat));
     36        for(i=0;i<nummodels;i++)Gmn[i]=NULL;
     37
     38        nodesets=(NodeSets**)xmalloc(nummodels*sizeof(NodeSet*));
     39        for(i=0;i<nummodels;i++)nodesets[i]=NULL;
     40
     41        yg=(Vec*)xmalloc(nummodels*sizeof(Vec));
     42        for(i=0;i<nummodels;i++)yg[i]=NULL;
     43
     44        ys=(Vec*)xmalloc(nummodels*sizeof(Vec));
     45        for(i=0;i<nummodels;i++)ys[i]=NULL;
    3646
    3747}
    38 /*}}}*/
    39 /*FUNCTION FemModel::FemModel {{{1*/
    40 FemModel::FemModel(DataSet* femmodel_elements,DataSet* femmodel_nodes,DataSet* femmodel_vertices, DataSet* femmodel_constraints,DataSet* femmodel_loads,
    41                 DataSet* femmodel_materials,Parameters* femmodel_parameters, DofVec* femmodel_partition,DofVec* femmodel_tpartition,DofVec* femmodel_yg,
    42                 Mat femmodel_Rmg,Mat femmodel_Gmn,NodeSets* femmodel_nodesets,Vec femmodel_ys,Vec femmodel_ys0){
    43 
    44 
    45         elements=femmodel_elements;
    46         nodes=femmodel_nodes;
    47         vertices=femmodel_vertices;
    48         constraints=femmodel_constraints;
    49         loads=femmodel_loads;
    50         materials=femmodel_materials;
    51         parameters=femmodel_parameters;
    52 
    53         partition=femmodel_partition;
    54         tpartition=femmodel_tpartition;
    55         yg=femmodel_yg;
    56         Rmg=femmodel_Rmg;
    57         nodesets=femmodel_nodesets;
    58         ys=femmodel_ys;
    59         ys0=femmodel_ys0;
    60         Gmn=femmodel_Gmn;
    61 
    62 }
    63 /*}}}*/
    64 /*FUNCTION FemModel::~FemModel {{{1*/
     48/*}}}1*/
     49/*FUNCTION FemModel::destructor {{{1*/
    6550FemModel::~FemModel(){
    6651
     52        int i;
     53
     54        /*Delete all the datasets: */
     55        xfree((void**)&analysis_type_list);
    6756        delete elements;
    6857        delete nodes;
    6958        delete vertices;
     59        delete constraints;
    7060        delete loads;
    71         delete constraints;
    7261        delete materials;
    7362        delete parameters;
    74 
    7563        delete partition;
    7664        delete tpartition;
     65
     66        for(i=0;i<nummodels;i++){
     67                Mat temp_Rmg=Rmg[i];
     68                MatFree(&temp_Rmg);
     69                Mat temp_Gmn=Gmn[i];
     70                MatFree(&temp_Gmn);
     71                NodeSet* temp_nodesets=nodesets[i];
     72                delete nodesets;
     73                Vec temp_yg=yg[i];
     74                VecFree(&temp_yg);
     75                Vec temp_ys=ys[i];
     76                VecFree(&temp_ys);
     77        }
     78
     79        /*Delete dynamically allocated arrays: */
     80        delete Rmg;
     81        delete Gmn;
     82        delete nodesets;
    7783        delete yg;
    78         MatFree(&Rmg);
    79         delete nodesets;
    80         VecFree(&ys);
    81         VecFree(&ys0);
    82         MatFree(&Gmn);
     84        delete ys;
    8385
    8486}
    85 /*}}}*/
     87/*}}}1*/
     88
     89/*Object management*/
     90/*FUNCTION FemModel::Echo {{{1*/
     91
     92void FemModel::Echo(void){
     93
     94        printf("FemModel echo: \n");
     95        printf("   number of fem models: %i\n",nummodels);
     96        printf("   analysis_type_list: \n");
     97        for(i=0;i<nummodels;i++)printf("     %i: %s\n",i,EnumAsString(analysis_type_list[i]));
     98        printf("   current analysis_type: \n");
     99        printf("     %i: %s\n",i,EnumAsString(analysis_type_list[current_analysis_type]));
     100
     101
     102}
     103/*}}}1*/
     104
     105/*Numerics: */
     106/*FUNCTION FemModel::AddAnalysis(ConstDataHandle FEMMODEL, int analysis_type) {{{1*/
     107void  FemModel::AddAnalysis(ConstDataHandle IOMODEL, int analysis_type){
     108
     109
     110        int i; //practical counter
     111
     112        /*Set counter: */
     113        if (current_analysis_type==-1)current_analysis_type=0;
     114        else current_analysis_type++;
     115
     116        i=current_analysis_type;
     117
     118        /*intermediary: */
     119        IoFemModel* iomodel=NULL;
     120       
     121        _printf_("   fill model with matlab workspace data\n");
     122        iomodel=new IoFemModel(IOMODEL);
     123
     124        _printf_("   create datasets:\n");
     125        CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,IOMODEL,analysis_type);
     126
     127        _printf_("   create degrees of freedom: \n");
     128        Dofx( &partition,&tpartition,elements,nodes, vertices,parameters);
     129       
     130        _printf_("   create single point constraints: \n");
     131        SpcNodesx( &yg[i], nodes,constraints);
     132       
     133        _printf_("   create rigid body constraints:\n");
     134        MpcNodesx( &Rmg[i], nodes,constraints);
     135       
     136        _printf_("   create node sets:\n");
     137        BuildNodeSetsx(&nodesets[i], nodes);
     138
     139        _printf_("   reducing single point constraints vector:\n");
     140        Reducevectorgtosx(&ys[i], yg[i]->vector,nodesets[i]);
     141       
     142        _printf_("   normalizing rigid body constraints matrix:\n");
     143        NormalizeConstraintsx(&Gmn[i], Rmg[i],nodesets[i]);
     144
     145        _printf_("   configuring element and loads:\n");
     146        ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
     147
     148        _printf_("   process parameters:\n");
     149        ProcessParamsx( parameters, partition->vector);
     150
     151        _printf_("   free ressources:\n");
     152        delete iomodel;
     153}
     154/*}}}1*/
     155/*FUNCTION FemModel::GetCurrentAnalysis {{{1*/
     156FemFemModel* FemModel::GetCurrentAnalysis(){
     157        return analysis_type_list[current_analysis_type];
     158}
     159/*}}}1*/
     160/*FUNCTION FemModel::SetCurrentAnalysis {{{1*/
     161void FemModel::SetCurrentAnalysis(int analysis_type){
     162        int found=-1;
     163        for(i=0;i<nummodels;i++){
     164                if (analysis_type_list[i]==analysis_type){
     165                        found=i;
     166                        break;
     167                }
     168        }
     169        if(found)current_analysis_type=i;
     170        else ISSMERRR("%s%s%s"," could not find analysis_type ",EnumAsString(analysis_type) " in list of FemModel analyses");
     171}
     172/*}}}1*/
     173
  • issm/trunk/src/c/objects/FemModel.h

    r3922 r3982  
    1616/*}}}*/
    1717
     18
    1819class FemModel {
    1920
     
    2223        public:
    2324
    24                 DataSet*            elements;
    25                 DataSet*            nodes;
    26                 DataSet*            vertices;
    27                 DataSet*            constraints;
    28                 DataSet*            loads;
    29                 DataSet*            materials;
    30                 Parameters*         parameters;
     25                int                 nummodels;
     26                int*                analysis_type_list; //list of analyses this femmodel is capable of.
     27                int                 current_analysis_type; //counter to the current analysis being carried out
     28               
     29                DataSet*            elements; //elements (one set for all analyses)
     30                DataSet*            nodes; //one set of nodes
     31                DataSet*            vertices; //one set of vertices
     32                DataSet*            constraints; //one set of constraints. each constraint knows which analysis_type it handles
     33                DataSet*            loads;  //one set of constraints. each constraint knows which analysis_type it handles
     34                DataSet*            materials;  //one set of materials, for each element
     35                Parameters*         parameters; //one set of parameters, independent of the analysis_type
    3136
    32                 DofVec*             partition;
     37                DofVec*             partition; //one partitioning for all elements
    3338                DofVec*             tpartition;
    34                 DofVec*             yg;
     39               
     40                //multiple  sets of vectors for each analysis_type
     41                Mat*                 Rmg; //rigid body motions matrices
     42                Mat*                 Gmn;
     43                NodeSets**           nodesets; //boundary conditions dof sets
     44                Vec*             yg; //boundary conditions in global g-set
     45                Vec*                 ys; //boundary conditions, in reduced s-set
    3546
    36                 Mat                 Rmg;
    37                 NodeSets*           nodesets;
    38                 Vec                 ys;
    39                 Vec                 ys0;
    40                 Mat                 Gmn;
     47                /*constructors, destructors: */
     48                FemModel(int nummodels);
     49                ~FemModel();
    4150
    42                 FemModel();
    43                 ~FemModel();
    44                 FemModel(DataSet* elements,DataSet* nodes,DataSet* vertices, DataSet* constraints,DataSet* loads,DataSet* materials,Parameters* parameters,
    45                                       DofVec* partition,DofVec* tpartition,DofVec* yg,Mat Rmg,Mat Gmn,NodeSets* nodesets,Vec ys,Vec ys0);
     51                /*Methods: */
     52                Echo();
     53
     54                /*Fem: */
     55                void  AddAnalysis(ConstDataHandle IOMODEL, int analysis_type);
     56                int   SetCurrentAnalysis(int analysis_type);
     57                void  GetCurrentAnalysis(void);
    4658
    4759};
  • issm/trunk/src/c/objects/IoModel.cpp

    r3931 r3982  
    130130        IoModelFetchData(&this->inputfilename,iomodel_handle,"inputfilename");
    131131        IoModelFetchData(&this->outputfilename,iomodel_handle,"outputfilename");
    132         IoModelFetchData(&this->analysis_type,iomodel_handle,"analysis_type");
    133         IoModelFetchData(&this->sub_analysis_type,iomodel_handle,"sub_analysis_type");
    134132        IoModelFetchData(&this->qmu_analysis,iomodel_handle,"qmu_analysis");
    135133        IoModelFetchData(&this->control_analysis,iomodel_handle,"control_analysis");
     
    232230        this->repository=NULL;
    233231        this->meshtype=NULL;
    234         this->analysis_type=0;
    235         this->sub_analysis_type=0;
    236232        this->qmu_analysis=0;
    237233        this->control_analysis=0;
  • issm/trunk/src/c/objects/IoModel.h

    r3931 r3982  
    2020                char*   repository;
    2121                char*   meshtype;
    22                 int     analysis_type;
    23                 int     sub_analysis_type;
    2422                int     qmu_analysis;
    2523                int     control_analysis;
  • issm/trunk/src/c/solutions/diagnostic.cpp

    r3938 r3982  
    2727        bool  control_analysis=false;
    2828
    29         /*Model: */
    30         Model* model=NULL;
     29        /*FemModel: */
     30        FemModel* femmodel=NULL;
    3131
    3232        /*Results: */
     
    5959        lockname=argv[4];
    6060
    61         /*Initialize model structure: */
     61        /*Initialize femmodel structure: */
    6262        MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime();
    63         model=new Model();
     63        femmodel=new FemModel(5);
    6464
    6565        /*Open handle to data on disk: */
    6666        fid=pfopen(inputfilename,"rb");
    6767
    68         _printf_("read and create finite element model:\n");
    69         _printf_("\n   reading diagnostic horiz model data:\n");
    70         model->AddFormulation(fid,DiagnosticAnalysisEnum,HorizAnalysisEnum);
     68        _printf_("read and create finite element femmodel:\n");
     69        _printf_("\n   reading diagnostic horiz femmodel data:\n");
     70        femmodel->AddAnalysis(fid,DiagnosticHorizAnalysisEnum);
    7171
    72         _printf_("\n   reading diagnostic vert model data:\n");
    73         model->AddFormulation(fid,DiagnosticAnalysisEnum,VertAnalysisEnum);
     72        _printf_("\n   reading diagnostic vert femmodel data:\n");
     73        femmodel->AddAnalysis(fid,DiagnosticVertAnalysisEnum);
    7474       
    75         _printf_("\n   reading diagnostic stokes model data:\n");
    76         model->AddFormulation(fid,DiagnosticAnalysisEnum,StokesAnalysisEnum);
     75        _printf_("\n   reading diagnostic stokes femmodel data:\n");
     76        femmodel->AddAnalysis(fid,DiagnosticStokesAnalysisEnum);
    7777       
    78         _printf_("\n   reading diagnostic hutter model data:\n");
    79         model->AddFormulation(fid,DiagnosticAnalysisEnum,HutterAnalysisEnum);
     78        _printf_("\n   reading diagnostic hutter femmodel data:\n");
     79        femmodel->AddAnalysis(fid,DiagnosticHutterAnalysisEnum);
    8080       
    81         _printf_("\n   reading surface and bed slope computation model data:\n");
    82         model->AddFormulation(fid,SlopecomputeAnalysisEnum);
     81        _printf_("\n   reading surface and bed slope computation femmodel data:\n");
     82        femmodel->AddAnalysis(fid,SlopecomputeAnalysisEnum);
    8383
    8484        /*get parameters: */
    85         model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    86         model->FindParam(&control_analysis,ControlAnalysisEnum);
    87         model->FindParam(&waitonlock,WaitOnLockEnum);
     85        femmodel->parameters->FindParam(&qmu_analysis,QmuAnalysisEnum);
     86        femmodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum);
     87        femmodel->parameters->FindParam(&waitonlock,WaitOnLockEnum);
    8888
    8989        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
     
    9595                        _printf_("call computational core:\n");
    9696                        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    97                         results=diagnostic_core(model);
     97                        results=diagnostic_core(femmodel);
    9898                        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    9999
     
    103103                        _printf_("call computational core:\n");
    104104                        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    105                         results=control_core(model);
     105                        results=control_core(femmodel);
    106106                        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    107107
     
    117117                #ifdef _HAVE_DAKOTA_
    118118                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    119                 Qmux(model,DiagnosticAnalysisEnum,NoneAnalysisEnum);
     119                Qmux(femmodel,DiagnosticAnalysisEnum,NoneAnalysisEnum);
    120120                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    121121                #else
     
    130130
    131131        /*Free ressources */
    132         delete model;
     132        delete femmodel;
    133133        delete results;
    134134
    135135        /*Get finish time and close*/
    136136        MPI_Barrier(MPI_COMM_WORLD); finish = MPI_Wtime( );
    137         _printf_("\n   %-34s %f seconds  \n","Model initialization elapsed time:",finish_init-start_init);
     137        _printf_("\n   %-34s %f seconds  \n","FemModel initialization elapsed time:",finish_init-start_init);
    138138        _printf_("   %-34s %f seconds  \n","Core solution elapsed time:",finish_core-start_core);
    139139        _printf_("\n   %s %i hrs %i min %i sec\n\n","Total elapsed time:",int((finish-start)/3600),int(int(finish-start)%3600/60),int(finish-start)%60);
  • issm/trunk/src/c/solutions/diagnostic_core.cpp

    r3959 r3982  
    1111#include "../include/include.h"
    1212
    13 Results* diagnostic_core(Model* model){
     13Results* diagnostic_core(FemModel* femmodel){
    1414
    1515        extern int my_rank;
    1616        int        dummy;
    17 
    18         /*fem models: */
    19         FemModel* fem_dh=NULL;
    20         FemModel* fem_dv=NULL;
    21         FemModel* fem_dhu=NULL;
    22         FemModel* fem_ds=NULL;
    23         FemModel* fem_sl=NULL;
    2417
    2518        /*output: */
     
    7063        results=new Results();
    7164
    72         //first recover parameters common to all solutions
    73         model->FindParam(&verbose,VerboseEnum);
    74         model->FindParam(&dim,DimEnum);
    75         model->FindParam(&ishutter,IsHutterEnum);
    76         model->FindParam(&ismacayealpattyn,IsMacAyealPattynEnum);
    77         model->FindParam(&numberofnodes,NumberOfNodesEnum);
    78         model->FindParam(&isstokes,IsStokesEnum);
    79         model->FindParam(&stokesreconditioning,StokesReconditioningEnum);
    80         model->FindParam(&numrifts,NumRiftsEnum);
    81         model->FindParam(&qmu_analysis,QmuAnalysisEnum);
    82 
    83         /*recover fem models: */
    84         fem_dh=model->GetFormulation(DiagnosticAnalysisEnum,HorizAnalysisEnum);
    85         fem_dv=model->GetFormulation(DiagnosticAnalysisEnum,VertAnalysisEnum);   
    86         fem_ds=model->GetFormulation(DiagnosticAnalysisEnum,StokesAnalysisEnum);
    87         fem_dhu=model->GetFormulation(DiagnosticAnalysisEnum,HutterAnalysisEnum);
    88         fem_sl=model->GetFormulation(SlopecomputeAnalysisEnum);                   
     65        //first recover parameters needed to drive the solution
     66        femmodel->parameters->FindParam(&verbose,VerboseEnum);
     67        femmodel->parameters->FindParam(&dim,DimEnum);
     68        femmodel->parameters->FindParam(&ishutter,IsHutterEnum);
     69        femmodel->parameters->FindParam(&ismacayealpattyn,IsMacAyealPattynEnum);
     70        femmodel->parameters->FindParam(&numberofnodes,NumberOfNodesEnum);
     71        femmodel->parameters->FindParam(&isstokes,IsStokesEnum);
     72        femmodel->parameters->FindParam(&stokesreconditioning,StokesReconditioningEnum);
     73        femmodel->parameters->FindParam(&numrifts,NumRiftsEnum);
     74        femmodel->parameters->FindParam(&qmu_analysis,QmuAnalysisEnum);
    8975
    9076        //specific parameters for specific models
    91         fem_dh->parameters->FindParam(&numberofdofspernode_dh,NumberOfDofsPerNodeEnum);
    92         fem_sl->parameters->FindParam(&numberofdofspernode_sl,NumberOfDofsPerNodeEnum);
    93         fem_ds->parameters->FindParam(&numberofdofspernode_ds,NumberOfDofsPerNodeEnum);
     77        femmodel->parameters->FindParam(&numberofdofspernode_dh,NumberOfDofsPerNodeEnum);
     78        femmodel->parameters->FindParam(&numberofdofspernode_sl,NumberOfDofsPerNodeEnum);
     79        femmodel->parameters->FindParam(&numberofdofspernode_ds,NumberOfDofsPerNodeEnum);
    9480
    9581        //for qmu analysis, be sure the velocity input we are starting from  is the one in the parameters: */
    9682        if(qmu_analysis){
    97                 fem_dh->parameters->FindParam(&vx,&dummy,VxEnum); model->UpdateInputsFromVector(vx,VxEnum,VertexEnum);
    98                 fem_dh->parameters->FindParam(&vy,&dummy,VyEnum); model->UpdateInputsFromVector(vy,VyEnum,VertexEnum);
    99                 fem_dh->parameters->FindParam(&vz,&dummy,VzEnum); model->UpdateInputsFromVector(vz,VzEnum,VertexEnum);
     83                femmodel->parameters->FindParam(&vx,&dummy,VxEnum); femmodel->UpdateInputsFromVector(vx,VxEnum,VertexEnum);
     84                femmodel->parameters->FindParam(&vy,&dummy,VyEnum); femmodel->UpdateInputsFromVector(vy,VyEnum,VertexEnum);
     85                femmodel->parameters->FindParam(&vz,&dummy,VzEnum); femmodel->UpdateInputsFromVector(vz,VzEnum,VertexEnum);
    10086        }
    10187
    10288        /*Compute slopes: */
    103         slope_core(&surfaceslopex,&surfaceslopey,fem_sl,SurfaceAnalysisEnum);
    104         slope_core(&bedslopex,&bedslopey,fem_sl,BedAnalysisEnum);
     89        slope_core(&surfaceslopex,&surfaceslopey,femmodel,SurfaceAnalysisEnum);
     90        slope_core(&bedslopex,&bedslopey,femmodel,BedAnalysisEnum);
    10591               
    10692        /*Update: */
  • issm/trunk/src/c/solutions/slope_core.cpp

    r3913 r3982  
    99#include "../modules/modules.h"
    1010
    11 void slope_core(Vec* pslopex,Vec* pslopey,FemModel* fem, int AnalysisEnum){
     11void slope_core(Vec* pslopex,Vec* pslopey,FemModel* femmodel, int AnalysisEnum){
    1212
    1313        /*parameters: */
     
    2424
    2525        /*Recover some parameters: */
    26         fem->parameters->FindParam(&verbose,VerboseEnum);
    27         fem->parameters->FindParam(&dim,DimEnum);
    28         fem->parameters->FindParam(&isstokes,IsStokesEnum);
    29         fem->parameters->FindParam(&ishutter,IsHutterEnum);
     26        femmodel->parameters->FindParam(&verbose,VerboseEnum);
     27        femmodel->parameters->FindParam(&dim,DimEnum);
     28        femmodel->parameters->FindParam(&isstokes,IsStokesEnum);
     29        femmodel->parameters->FindParam(&ishutter,IsHutterEnum);
    3030
    3131        if(verbose)_printf_("%s\n","computing slope (x and y derivatives)...");
     
    5959       
    6060        /*Call on core computations: */
    61         diagnostic_core_linear(&slopex,fem,SlopecomputeAnalysisEnum,xanalysis);
    62         diagnostic_core_linear(&slopey,fem,SlopecomputeAnalysisEnum,yanalysis);
     61        diagnostic_core_linear(&slopex,femmodel,SlopecomputeAnalysisEnum,xanalysis);
     62        diagnostic_core_linear(&slopey,femmodel,SlopecomputeAnalysisEnum,yanalysis);
    6363
    6464        /*extrude if we are in 3D: */
    6565        if (dim==3){
    6666                if(verbose)_printf_("%s\n","extruding slopes in 3d...");
    67                 FieldExtrudex( slopex, fem->elements,fem->nodes,fem->vertices,fem->loads,fem->materials,fem->parameters,"slopex",0);
    68                 FieldExtrudex( slopey, fem->elements,fem->nodes,fem->vertices,fem->loads,fem->materials,fem->parameters,"slopey",0);
     67                FieldExtrudex( slopex, femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"slopex",0);
     68                FieldExtrudex( slopey, femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"slopey",0);
    6969        }
    7070
Note: See TracChangeset for help on using the changeset viewer.