Changeset 23488


Ignore:
Timestamp:
11/29/18 17:08:07 (6 years ago)
Author:
Mathieu Morlighem
Message:

NEW: loads are now an array, analysis specific

Location:
issm/trunk-jpl/src/c
Files:
7 edited

Legend:

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

    r23487 r23488  
    188188                xDelete<Constraints*>(constraints_list);
    189189        }
    190         if(loads)delete loads;
     190        if(this->loads_list && this->nummodels){
     191                for(int i=0;i<this->nummodels;i++) delete this->loads_list[i];
     192                xDelete<Loads*>(loads_list);
     193        }
    191194        if(materials)delete materials;
    192195        if(parameters)delete parameters;
     
    324327        /*Analysis dependent arrays*/
    325328        output->constraints_list=xNew<Constraints*>(this->nummodels);
     329        output->loads_list=xNew<Loads*>(this->nummodels);
    326330
    327331        output->profiler=static_cast<Profiler*>(this->profiler->copy());
    328332
    329         output->loads=static_cast<Loads*>(this->loads->Copy());
    330333        output->materials=static_cast<Materials*>(this->materials->Copy());
    331334        output->parameters=static_cast<Parameters*>(this->parameters->Copy());
    332335        output->results=static_cast<Results*>(this->results->Copy());
    333 
    334336        output->nodes=static_cast<Nodes*>(this->nodes->Copy());
    335337        output->vertices=static_cast<Vertices*>(this->vertices->Copy());
     
    344346        for(i=0;i<nummodels;i++){
    345347                output->constraints_list[i] = static_cast<Constraints*>(this->constraints_list[i]->Copy());
     348                output->loads_list[i] = static_cast<Loads*>(this->loads_list[i]->Copy());
    346349                analysis_type=output->analysis_type_list[i];
    347350                output->SetCurrentConfiguration(analysis_type);
     
    349352                SpcNodesx(output->nodes,output->constraints_list[i],output->parameters,analysis_type);
    350353                NodesDofx(output->nodes,output->parameters,analysis_type);
    351                 ConfigureObjectsx(output->elements,output->loads,output->nodes,output->vertices,output->materials,output->parameters);
     354                ConfigureObjectsx(output->elements,output->loads_list[i],output->nodes,output->vertices,output->materials,output->parameters);
    352355        }
    353356
     
    423426
    424427        /*create datasets for all analyses*/
    425         ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints_list,&this->loads,&this->parameters,iomodel,toolkitsoptionsfid,rootpath,this->solution_type,this->nummodels,this->analysis_type_list);
     428        ModelProcessorx(&this->elements,&this->nodes,&this->vertices,&this->materials,&this->constraints_list,&this->loads_list,&this->parameters,iomodel,toolkitsoptionsfid,rootpath,this->solution_type,this->nummodels,this->analysis_type_list);
    426429
    427430        /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
     
    432435
    433436                if(VerboseMProcessor()) _printf0_("      configuring element and loads\n");
    434                 ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
     437                ConfigureObjectsx(this->elements,this->loads,this->nodes,this->vertices,this->materials,this->parameters);
    435438
    436439                if(i==0){
     
    458461
    459462        if(marshall_direction==MARSHALLING_BACKWARD){
    460                 delete this->loads;
    461463                delete this->materials;
    462464                delete this->parameters;
     
    464466                        for(i=0;i<this->nummodels;i++) delete this->constraints_list[i];
    465467                        xDelete<Constraints*>(constraints_list);
     468                }
     469                if(this->loads_list && this->nummodels){
     470                        for(i=0;i<this->nummodels;i++) delete this->loads_list[i];
     471                        xDelete<Loads*>(loads_list);
    466472                }
    467473                delete this->results;
     
    487493        MARSHALLING_DYNAMIC(analysis_type_list,int,nummodels);
    488494
    489         this->loads->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    490495        this->materials->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    491496        this->parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     
    498503                this->constraints_list = xNew<Constraints*>(this->nummodels);
    499504                for(i=0;i<nummodels;i++) this->constraints_list[i] = new Constraints();
     505                this->loads_list = xNew<Loads*>(this->nummodels);
     506                for(i=0;i<nummodels;i++) this->loads_list[i] = new Loads();
    500507        }
    501508
    502509        for(i=0;i<nummodels;i++){
    503510                this->constraints_list[i]->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     511                this->loads_list[i]->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    504512        }
    505513
     
    517525                        SpcNodesx(this->nodes,this->constraints_list[i],this->parameters,analysis_type);
    518526                        NodesDofx(this->nodes,this->parameters,analysis_type);
    519                         ConfigureObjectsx(this->elements,this->loads,this->nodes,this->vertices,this->materials,this->parameters);
     527                        ConfigureObjectsx(this->elements,this->loads_list[i],this->nodes,this->vertices,this->materials,this->parameters);
    520528                }
    521529
     
    598606
    599607        /*configure elements, loads and nodes, for this new analysis: */
     608        this->loads = this->loads_list[this->analysis_counter];
     609        this->constraints = this->constraints_list[this->analysis_counter];
     610        this->loads->SetCurrentConfiguration(elements, loads, nodes,vertices, materials,parameters);
    600611        this->elements->SetCurrentConfiguration(elements,loads, nodes,vertices, materials,parameters);
    601         this->loads->SetCurrentConfiguration(elements, loads, nodes,vertices, materials,parameters);
    602         this->constraints = this->constraints_list[this->analysis_counter];
    603612
    604613        /*take care of toolkits options, that depend on this analysis type (present only after model processor)*/
     
    26142623        this->ElementsAndVerticesPartitioning(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,&my_elements,&my_vertices);
    26152624
    2616         if(this->loads->Size()!=0) _error_("not supported yet");
    2617 
    26182625        /*Create vertices*/
    26192626        Vertices* new_vertices=new Vertices();
     
    26392646        for(int i=0;i<this->nummodels;i++){//create nodes for each analysis in analysis_type_list
    26402647
     2648                if(this->loads_list[i]->Size()!=0) _error_("not supported yet");
    26412649                new_constraints_list[i] = new Constraints();
    26422650
     
    26612669        new_nodes->Presort();
    26622670        new_vertices->Presort();
    2663         this->loads->Presort();
     2671        //this->loads->Presort();
    26642672        new_materials->Presort();
    26652673
    26662674        /*reset hooks for elements, loads and nodes: */
    26672675        new_elements->ResetHooks();
    2668         this->loads->ResetHooks();
     2676        //this->loads->ResetHooks();
    26692677        new_materials->ResetHooks();
    26702678
  • issm/trunk-jpl/src/c/classes/FemModel.h

    r23481 r23488  
    4242
    4343                Elements    *elements;             //elements (one set for all analyses)
    44                 Loads       *loads;                //one set of constraints. each constraint knows which analysis_type it handles
    4544                Materials   *materials;            //one set of materials, for each element
    4645                Nodes       *nodes;                //one set of nodes
     
    5251                Constraints  *constraints;
    5352                Constraints **constraints_list;
     53                Loads        *loads;
     54                Loads       **loads_list;
    5455
    5556                //FIXME: do we want only one class and have virtual functions? or keep 2 classes, at least rename AdaptiveMeshRefinement -> AmrNeopz
  • issm/trunk-jpl/src/c/classes/Loads/Loads.cpp

    r19198 r23488  
    121121
    122122                /*Check that this load corresponds to our analysis currently being carried out: */
    123                 if (load->InAnalysis(analysis_type)) localloads++;
     123                _assert_(load->InAnalysis(analysis_type));
     124                localloads++;
    124125        }
    125126
     
    174175
    175176                /*Check that this load corresponds to our analysis currently being carried out: */
    176                 if (load->InAnalysis(analysis_type)) localloads++;
     177                _assert_(load->InAnalysis(analysis_type));
     178                localloads++;
    177179        }
    178180
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.cpp

    r23481 r23488  
    1313#include "./ModelProcessorx.h"
    1414
    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){
     15void 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){
    1616
    1717        /*Set Verbosity once for all*/
     
    2828        Vertices    *vertices    = new Vertices();
    2929        Materials   *materials   = new Materials();
    30         Loads       *loads       = new Loads();
    3130        Parameters  *parameters  = new Parameters();
    3231
    3332        Constraints **constraints = xNew<Constraints*>(nummodels);
    3433        for(int i=0;i<nummodels;i++) constraints[i] = new Constraints();
     34        Loads **loads = xNew<Loads*>(nummodels);
     35        for(int i=0;i<nummodels;i++) loads[i] = new Loads();
    3536
    3637
     
    5657                analysis->CreateNodes(nodes,iomodel);
    5758                analysis->CreateConstraints(constraints[i],iomodel);
    58                 analysis->CreateLoads(loads,iomodel);
     59                analysis->CreateLoads(loads[i],iomodel);
    5960                analysis->UpdateElements(elements,iomodel,i,analysis_enum);
    6061                delete analysis;
     
    6465                 * will need to start at the end of the updated counters: */
    6566                if(nodes->Size()) iomodel->nodecounter = nodes->MaximumId();
    66                 iomodel->loadcounter       = loads->NumberOfLoads();
     67                iomodel->loadcounter       = loads[i]->NumberOfLoads();
    6768                iomodel->constraintcounter = constraints[i]->NumberOfConstraints();
    6869
     
    7071                _assert_(iomodel->nodecounter>=0);
    7172
    72                 /*Tell constraints that Ids are already sorted*/
     73                /*Tell datasets that Ids are already sorted*/
    7374                constraints[i]->Presort();
     75                loads[i]->Presort();
    7476        }
    7577
     
    9496        nodes->Presort();
    9597        vertices->Presort();
    96         loads->Presort();
    9798        materials->Presort();
    9899
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h

    r23481 r23488  
    99#include "../../analyses/analyses.h"
    1010
    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);
     11void 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);
    1212
    1313/*Creation of fem datasets: general drivers*/
  • issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp

    r18653 r23488  
    9999                for (i=0;i<femmodel->loads->Size();i++){
    100100                        load=xDynamicCast<Load*>(femmodel->loads->GetObjectByOffset(i));
    101                         if(load->InAnalysis(configuration_type)){
    102                                 load->PenaltyCreateKMatrix(Kff,Kfs,kmax);
    103                                 load->PenaltyCreatePVector(pf,kmax);
    104                         }
     101                        _assert_(load->InAnalysis(configuration_type));
     102                        load->PenaltyCreateKMatrix(Kff,Kfs,kmax);
     103                        load->PenaltyCreatePVector(pf,kmax);
    105104                }
    106105        }
  • issm/trunk-jpl/src/c/solutionsequences/solutionsequence_nonlinear.cpp

    r23198 r23488  
    109109        if(conserve_loads){
    110110                delete femmodel->loads;
     111                int index=femmodel->AnalysisIndex(configuration_type);
     112                femmodel->loads_list[index]=savedloads;
    111113                femmodel->loads=savedloads;
    112114        }
Note: See TracChangeset for help on using the changeset viewer.