Changeset 23493


Ignore:
Timestamp:
11/30/18 11:52:30 (6 years ago)
Author:
Mathieu Morlighem
Message:

NEW: making nodes a list instead of one giant dataset

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

Legend:

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

    r23489 r23493  
    182182        if(lockfilename)xDelete<char>(lockfilename);
    183183        if(elements)delete elements;
    184         if(nodes)delete nodes;
    185184        if(vertices)delete vertices;
    186185        if(this->constraints_list && this->nummodels){
     
    191190                for(int i=0;i<this->nummodels;i++) delete this->loads_list[i];
    192191                xDelete<Loads*>(loads_list);
     192        }
     193        if(this->nodes_list && this->nummodels){
     194                for(int i=0;i<this->nummodels;i++) delete this->nodes_list[i];
     195                xDelete<Nodes*>(nodes_list);
    193196        }
    194197        if(materials)delete materials;
     
    328331        output->constraints_list=xNew<Constraints*>(this->nummodels);
    329332        output->loads_list=xNew<Loads*>(this->nummodels);
     333        output->nodes_list=xNew<Nodes*>(this->nummodels);
    330334
    331335        output->profiler=static_cast<Profiler*>(this->profiler->copy());
     
    334338        output->parameters=static_cast<Parameters*>(this->parameters->Copy());
    335339        output->results=static_cast<Results*>(this->results->Copy());
    336         output->nodes=static_cast<Nodes*>(this->nodes->Copy());
    337340        output->vertices=static_cast<Vertices*>(this->vertices->Copy());
    338341        output->elements=static_cast<Elements*>(this->elements->Copy());
     
    347350                output->constraints_list[i] = static_cast<Constraints*>(this->constraints_list[i]->Copy());
    348351                output->loads_list[i] = static_cast<Loads*>(this->loads_list[i]->Copy());
     352                output->nodes_list[i] = static_cast<Nodes*>(this->nodes_list[i]->Copy());
    349353                analysis_type=output->analysis_type_list[i];
    350354                output->SetCurrentConfiguration(analysis_type);
    351355                if(i==0) VerticesDofx(output->vertices,output->parameters); //only call once, we only have one set of vertices
    352                 SpcNodesx(output->nodes,output->constraints_list[i],output->parameters,analysis_type);
    353                 NodesDofx(output->nodes,output->parameters,analysis_type);
    354                 ConfigureObjectsx(output->elements,output->loads_list[i],output->nodes,output->vertices,output->materials,output->parameters);
     356                SpcNodesx(output->nodes_list[i],output->constraints_list[i],output->parameters,analysis_type);
     357                NodesDofx(output->nodes_list[i],output->parameters,analysis_type);
     358                ConfigureObjectsx(output->elements,output->loads_list[i],output->nodes_list[i],output->vertices,output->materials,output->parameters);
    355359        }
    356360
     
    426430
    427431        /*create datasets for all analyses*/
    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);
     432        ModelProcessorx(&this->elements,&this->nodes_list,&this->vertices,&this->materials,&this->constraints_list,&this->loads_list,&this->parameters,iomodel,toolkitsoptionsfid,rootpath,this->solution_type,this->nummodels,this->analysis_type_list);
    429433
    430434        /*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
     
    471475                        xDelete<Loads*>(loads_list);
    472476                }
     477                if(this->nodes_list && this->nummodels){
     478                        for(i=0;i<this->nummodels;i++) delete this->nodes_list[i];
     479                        xDelete<Nodes*>(nodes_list);
     480                }
    473481                delete this->results;
    474                 delete this->nodes;
    475482                delete this->vertices;
    476483                delete this->elements;
     
    495502        this->parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    496503        this->results->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    497         this->nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    498504        this->vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    499505        this->elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     
    504510                this->loads_list = xNew<Loads*>(this->nummodels);
    505511                for(i=0;i<nummodels;i++) this->loads_list[i] = new Loads();
     512                this->nodes_list = xNew<Nodes*>(this->nummodels);
     513                for(i=0;i<nummodels;i++) this->nodes_list[i] = new Nodes();
    506514        }
    507515
     
    509517                this->constraints_list[i]->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    510518                this->loads_list[i]->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
     519                this->nodes_list[i]->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
    511520        }
    512521
     
    522531                        SetCurrentConfiguration(analysis_type);
    523532                        if(i==0) VerticesDofx(this->vertices,this->parameters); //only call once, we only have one set of vertices
    524                         SpcNodesx(this->nodes,this->constraints_list[i],this->parameters,analysis_type);
    525                         NodesDofx(this->nodes,this->parameters,analysis_type);
    526                         ConfigureObjectsx(this->elements,this->loads_list[i],this->nodes,this->vertices,this->materials,this->parameters);
     533                        SpcNodesx(this->nodes_list[i],this->constraints_list[i],this->parameters,analysis_type);
     534                        NodesDofx(this->nodes_list[i],this->parameters,analysis_type);
     535                        ConfigureObjectsx(this->elements,this->loads_list[i],this->nodes_list[i],this->vertices,this->materials,this->parameters);
    527536                }
    528537
     
    607616        this->loads = this->loads_list[this->analysis_counter];
    608617        this->constraints = this->constraints_list[this->analysis_counter];
     618        this->nodes = this->nodes_list[this->analysis_counter];
    609619        this->loads->SetCurrentConfiguration(elements, loads, nodes,vertices, materials,parameters);
    610620        this->elements->SetCurrentConfiguration(elements,loads, nodes,vertices, materials,parameters);
     
    26372647        /*Creating nodes and constraints*/
    26382648        /*Just SSA (2D) and P1 in this version*/
    2639         Nodes* new_nodes = new Nodes();
    26402649        Constraints** new_constraints_list = xNew<Constraints*>(this->nummodels);
     2650        Nodes** new_nodes_list = xNew<Nodes*>(this->nummodels);
    26412651
    26422652        int nodecounter         =0;
     
    26472657                if(this->loads_list[i]->Size()!=0) _error_("not supported yet");
    26482658                new_constraints_list[i] = new Constraints();
     2659                new_nodes_list[i] = new Nodes();
    26492660
    26502661                int analysis_enum = this->analysis_type_list[i];
     
    26532664                if(analysis_enum==StressbalanceVerticalAnalysisEnum) continue;
    26542665
    2655                 this->CreateNodes(newnumberofvertices,my_vertices,nodecounter,analysis_enum,new_nodes);
     2666                this->CreateNodes(newnumberofvertices,my_vertices,nodecounter,analysis_enum,new_nodes_list[i]);
    26562667                this->CreateConstraints(new_vertices,nodecounter,constraintcounter,analysis_enum,new_constraints_list[i]);
    26572668                this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements);
    26582669
    2659                 if(new_nodes->Size()) nodecounter=new_nodes->MaximumId();
     2670                if(new_nodes_list[i]->Size()) nodecounter=new_nodes_list[i]->MaximumId();
    26602671                constraintcounter = new_constraints_list[i]->NumberOfConstraints();
    26612672                /*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
     
    26632674
    26642675                new_constraints_list[i]->Presort();
     2676                new_nodes_list[i]->Presort();
    26652677        }
    26662678
    26672679        new_elements->Presort();
    2668         new_nodes->Presort();
    26692680        new_vertices->Presort();
    26702681        //this->loads->Presort();
    26712682        new_materials->Presort();
    26722683
    2673         /*reset hooks for elements, loads and nodes: */
     2684        /*reset hooks*/
    26742685        new_elements->ResetHooks();
    26752686        //this->loads->ResetHooks();
     
    26892700
    26902701                /*configure elements, loads and nodes, for this new analysis: */
    2691                 new_elements->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
    2692                 this->loads->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
     2702                new_elements->SetCurrentConfiguration(new_elements,this->loads,new_nodes_list[i],new_vertices,new_materials,this->parameters);
     2703                this->loads->SetCurrentConfiguration(new_elements,this->loads,new_nodes_list[i],new_vertices,new_materials,this->parameters);
    26932704
    26942705                /*take care of toolkits options, that depend on this analysis type (present only after model processor)*/
     
    26982709                }
    26992710
    2700                 ConfigureObjectsx(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
     2711                ConfigureObjectsx(new_elements,this->loads,new_nodes_list[i],new_vertices,new_materials,this->parameters);
    27012712                if(i==0){
    27022713                        VerticesDofx(new_vertices,this->parameters); //only call once, we only have one set of vertices
    27032714                }
    2704                 SpcNodesx(new_nodes,new_constraints_list[i],this->parameters,analysis_type);
    2705                 NodesDofx(new_nodes,this->parameters,analysis_type);
     2715                SpcNodesx(new_nodes_list[i],new_constraints_list[i],this->parameters,analysis_type);
     2716                NodesDofx(new_nodes_list[i],this->parameters,analysis_type);
    27062717        }
    27072718
     
    27122723        delete this->vertices;          this->vertices          = new_vertices;
    27132724        delete this->elements;          this->elements          = new_elements;
    2714         delete this->nodes;                     this->nodes                     = new_nodes;
    27152725        delete this->materials;         this->materials = new_materials;
    2716 
    27172726        if(this->constraints_list && this->nummodels){
    27182727                for(int i=0;i<this->nummodels;i++) delete this->constraints_list[i];
    27192728                xDelete<Constraints*>(this->constraints_list);
    27202729        }
    2721         this->constraints_list = new_constraints_list;
     2730        this->constraints_list= new_constraints_list;
     2731        if(this->nodes_list && this->nummodels){
     2732                for(int i=0;i<this->nummodels;i++) delete this->nodes_list[i];
     2733                xDelete<Nodes*>(this->nodes_list);
     2734        }
     2735        this->nodes_list = new_nodes_list;
    27222736
    27232737        GetMaskOfIceVerticesLSMx0(this);
  • issm/trunk-jpl/src/c/classes/FemModel.h

    r23488 r23493  
    4343                Elements    *elements;             //elements (one set for all analyses)
    4444                Materials   *materials;            //one set of materials, for each element
    45                 Nodes       *nodes;                //one set of nodes
    4645                Parameters  *parameters;           //one set of parameters, independent of the analysis_type
    4746                Results     *results;              //results that cannot be fit into the elements
     
    5352                Loads        *loads;
    5453                Loads       **loads_list;
     54                Nodes        *nodes;
     55                Nodes       **nodes_list;
    5556
    5657                //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/modules/ModelProcessorx/ModelProcessorx.cpp

    r23488 r23493  
    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*/
     
    2525        /*Initialize datasets*/
    2626        Elements    *elements    = new Elements();
    27         Nodes       *nodes       = new Nodes();
    2827        Vertices    *vertices    = new Vertices();
    2928        Materials   *materials   = new Materials();
     
    3433        Loads **loads = xNew<Loads*>(nummodels);
    3534        for(int i=0;i<nummodels;i++) loads[i] = new Loads();
     35        Nodes **nodes = xNew<Nodes*>(nummodels);
     36        for(int i=0;i<nummodels;i++) nodes[i] = new Nodes();
    3637
    3738
     
    5556                Analysis* analysis = EnumToAnalysis(analysis_enum);
    5657                analysis->UpdateParameters(parameters,iomodel,solution_enum,analysis_enum);
    57                 analysis->CreateNodes(nodes,iomodel);
     58                analysis->CreateNodes(nodes[i],iomodel);
    5859                analysis->CreateConstraints(constraints[i],iomodel);
    5960                analysis->CreateLoads(loads[i],iomodel);
     
    6465                 * constraints, and ids for objects created in next call to CreateDataSets
    6566                 * will need to start at the end of the updated counters: */
    66                 if(nodes->Size()) iomodel->nodecounter = nodes->MaximumId();
     67                if(nodes[i]->Size()) iomodel->nodecounter = nodes[i]->MaximumId();
    6768                iomodel->loadcounter       = loads[i]->NumberOfLoads();
    6869                iomodel->constraintcounter = constraints[i]->NumberOfConstraints();
     
    7475                constraints[i]->Presort();
    7576                loads[i]->Presort();
     77                nodes[i]->Presort();
    7678        }
    7779
     
    9496         * redone: */
    9597        elements->Presort();
    96         nodes->Presort();
    9798        vertices->Presort();
    9899        materials->Presort();
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h

    r23488 r23493  
    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*/
Note: See TracChangeset for help on using the changeset viewer.