Changeset 8800


Ignore:
Timestamp:
07/05/11 16:46:08 (14 years ago)
Author:
Eric.Larour
Message:

Modified API for modules, to take into account new constraint applications, without nodesets

Location:
issm/trunk/src/c/objects
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Element.h

    r8647 r8800  
    2828                virtual void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0;
    2929                virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0;
    30                 virtual void   CreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs,Vec dg, Vec df)=0;
    31                 virtual void   CreatePVector(Vec pg, Vec pf)=0;
     30                virtual void   CreateKMatrix(Mat Kff, Mat Kfs,Vec df)=0;
     31                virtual void   CreatePVector(Vec pf)=0;
    3232                virtual void   GetSolutionFromInputs(Vec solution)=0;
    3333                virtual int    GetNodeIndex(Node* node)=0;
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r8795 r8800  
    571571/*}}}*/
    572572/*FUNCTION Penta::CreateKMatrix {{{1*/
    573 void  Penta::CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs,Vec dg, Vec df){
     573void  Penta::CreateKMatrix(Mat Kff, Mat Kfs,Vec df){
    574574
    575575        /*retrieve parameters: */
     
    624624        /*Add to global matrix*/
    625625        if(Ke){
    626                 Ke->AddToGlobal(Kgg,Kff,Kfs);
     626                Ke->AddToGlobal(Kff,Kfs);
    627627                delete Ke;
    628628        }
    629629        /*Add to global Vector*/
    630630        if(De){
    631                 De->InsertIntoGlobal(dg,df);
     631                De->InsertIntoGlobal(df);
    632632                delete De;
    633633        }
     
    23422342/*}}}*/
    23432343/*FUNCTION Penta::CreatePVector {{{1*/
    2344 void  Penta::CreatePVector(Vec pg, Vec pf){
     2344void  Penta::CreatePVector(Vec pf){
    23452345
    23462346        /*retrive parameters: */
     
    23972397        /*Add to global Vector*/
    23982398        if(pe){
    2399                 pe->AddToGlobal(pg,pf);
     2399                pe->AddToGlobal(pf);
    24002400                delete pe;
    24012401        }
  • issm/trunk/src/c/objects/Elements/Penta.h

    r8654 r8800  
    7979                void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    8080                void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    81                 void   CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs,Vec dg,Vec df);
    82                 void   CreatePVector(Vec pg, Vec pf);
     81                void   CreateKMatrix(Mat Kff, Mat Kfs,Vec df);
     82                void   CreatePVector(Vec pf);
    8383                void   DeleteResults(void);
    8484                double DragCoefficientAbsGradient(bool process_units,int weight_index);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r8795 r8800  
    377377/*}}}*/
    378378/*FUNCTION Tria::CreateKMatrix {{{1*/
    379 void  Tria::CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs,Vec dg,Vec df){
     379void  Tria::CreateKMatrix(Mat Kff, Mat Kfs,Vec df){
    380380
    381381        /*retreive parameters: */
     
    423423        /*Add to global matrix*/
    424424        if(Ke){
    425                 Ke->AddToGlobal(Kgg,Kff,Kfs);
     425                Ke->AddToGlobal(Kff,Kfs);
    426426                delete Ke;
    427427        }
     
    13181318/*}}}*/
    13191319/*FUNCTION Tria::CreatePVector {{{1*/
    1320 void  Tria::CreatePVector(Vec pg, Vec pf){
     1320void  Tria::CreatePVector(Vec pf){
    13211321
    13221322        /*retrive parameters: */
     
    13681368        /*Add to global Vector*/
    13691369        if(pe){
    1370                 pe->AddToGlobal(pg,pf);
     1370                pe->AddToGlobal(pf);
    13711371                delete pe;
    13721372        }
  • issm/trunk/src/c/objects/Elements/Tria.h

    r8649 r8800  
    7676                void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    7777                void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
    78                 void   CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs,Vec dg,Vec df);
    79                 void   CreatePVector(Vec pg, Vec pf);
     78                void   CreateKMatrix(Mat Kff, Mat Kfs,Vec df);
     79                void   CreatePVector(Vec pf);
    8080                double DragCoefficientAbsGradient(bool process_units,int weight_index);
    8181                int    GetNodeIndex(Node* node);
  • issm/trunk/src/c/objects/FemModel.cpp

    r8386 r8800  
    3939        /*Dynamically allocate whatever is a list of length nummodels: */
    4040        analysis_type_list=(int*)xmalloc(nummodels*sizeof(int));
    41         m_nodesets=(NodeSets**)xmalloc(nummodels*sizeof(NodeSets*));
    42         m_ys=(Vec*)xmalloc(nummodels*sizeof(Vec));
    4341
    4442        /*Initialize: */
    4543        for(i=0;i<nummodels;i++)analysis_type_list[i]=analyses[i];
    46         for(i=0;i<nummodels;i++)m_nodesets[i]=NULL;
    47         for(i=0;i<nummodels;i++)m_ys[i]=NULL;
    4844
    4945        /*create datasets for all analyses*/
     
    6864                NodesDofx(nodes,parameters,analysis_type);
    6965       
    70                 _printf_(VerboseMProcessor(),"      create nodal constraints vector\n");
    71                 CreateNodalConstraintsx(&m_ys[i],nodes,analysis_type);
    72 
    73                 _printf_(VerboseMProcessor(),"      create node sets\n");
    74                 BuildNodeSetsx(&m_nodesets[i], nodes,analysis_type);
    75 
    7666                _printf_(VerboseMProcessor(),"      configuring element and loads\n");
    7767                ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
     
    10595        delete parameters;
    10696        delete results;
    107 
    108         for(i=0;i<nummodels;i++){
    109                 NodeSets* temp_nodesets=m_nodesets[i];
    110                 delete temp_nodesets;
    111                 Vec temp_ys=m_ys[i];
    112                 VecFree(&temp_ys);
    113         }
    114 
    115         /*Delete dynamically allocated arrays: */
    116         xfree((void**)&m_nodesets);
    117         xfree((void**)&m_ys);
    11897
    11998}
     
    153132        else _error_("Could not find alias for analysis_type %s in list of FemModel analyses",EnumToStringx(configuration_type));
    154133
    155         /*activate matrices/vectors: */
    156         nodesets=m_nodesets[analysis_counter];
    157         ys=m_ys[analysis_counter];
    158 
    159134        /*Now, plug analysis_counter and analysis_type inside the parameters: */
    160135        this->parameters->SetParam(analysis_counter,AnalysisCounterEnum);
  • issm/trunk/src/c/objects/FemModel.h

    r6372 r8800  
    3636                Results*            results; //results that cannot be fit into the elements (such as one time constants, arrays, strings, etc ...)
    3737
    38                 //multiple  sets of matrices/vectors for each analysis_type. m stands for multiple
    39                 NodeSets**           m_nodesets; //boundary conditions dof sets
    40                 Vec*                 m_ys; //boundary conditions, in reduced s-set
    41 
    42                 //pointers to point to sets of matrices/vectors, for a certain analysis type. activated in SetCurrentAnalysis
    43                 NodeSets*            nodesets;
    44                 Vec                  yg;
    45                 Vec                  ys;
    46 
    4738                /*constructors, destructors: */
    4839                FemModel(char* inputfilename, char* outputfilename, const int solution_type,const int* analyses,const int nummodels);
  • issm/trunk/src/c/objects/IoModel.cpp

    r8647 r8800  
    203203        IoModelFetchData(&this->shelf_dampening,iomodel_handle,"shelf_dampening");
    204204        IoModelFetchData(&this->waitonlock,iomodel_handle,"waitonlock");
    205         IoModelFetchData(&this->kff,iomodel_handle,"kff");
    206205        IoModelFetchData(&this->gl_migration,iomodel_handle,"gl_migration");
    207206        IoModelFetchData(&this->isdiagnostic,iomodel_handle,"isdiagnostic");
     
    374373        this->connectivity=0;
    375374        this->lowmem=0;
    376         this->kff=0;
    377375        this->optscal=NULL;
    378376        this->yts=0;
  • issm/trunk/src/c/objects/IoModel.h

    r8647 r8800  
    161161                double  yts;
    162162                double  waitonlock;
    163                 int     kff;
    164163                int     isdiagnostic;
    165164                int     isprognostic;
  • issm/trunk/src/c/objects/Loads/Icefront.cpp

    r8303 r8800  
    303303/*}}}*/
    304304/*FUNCTION Icefront::CreateKMatrix {{{1*/
    305 void  Icefront::CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs){
     305void  Icefront::CreateKMatrix(Mat Kff, Mat Kfs){
    306306
    307307        /*No stiffness loads applied, do nothing: */
     
    311311/*}}}*/
    312312/*FUNCTION Icefront::CreatePVector {{{1*/
    313 void  Icefront::CreatePVector(Vec pg, Vec pf){
     313void  Icefront::CreatePVector(Vec pf){
    314314
    315315        /*Checks in debugging mode*/
     
    339339        /*Add to global Vector*/
    340340        if(pe){
    341                 pe->AddToGlobal(pg,pf);
     341                pe->AddToGlobal(pf);
    342342                delete pe;
    343343        }
     
    345345/*}}}*/
    346346/*FUNCTION Icefront::PenaltyCreateKMatrix {{{1*/
    347 void  Icefront::PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs, double kmax){
     347void  Icefront::PenaltyCreateKMatrix(Mat Kff, Mat Kfs, double kmax){
    348348        /*do nothing: */
    349349        return;
     
    351351/*}}}*/
    352352/*FUNCTION Icefront::PenaltyCreatePVector{{{1*/
    353 void  Icefront::PenaltyCreatePVector(Vec pg,Vec pf,double kmax){
     353void  Icefront::PenaltyCreatePVector(Vec pf,double kmax){
    354354        /*do nothing: */
    355355        return;
  • issm/trunk/src/c/objects/Loads/Icefront.h

    r6412 r8800  
    7171                void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    7272                void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    73                 void  CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs);
    74                 void  CreatePVector(Vec pg, Vec pf);
    75                 void  PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat kfs, double kmax);
    76                 void  PenaltyCreatePVector(Vec pg,Vec pf, double kmax);
     73                void  CreateKMatrix(Mat Kff, Mat Kfs);
     74                void  CreatePVector(Vec pf);
     75                void  PenaltyCreateKMatrix(Mat Kff, Mat kfs, double kmax);
     76                void  PenaltyCreatePVector(Vec pf, double kmax);
    7777                bool  InAnalysis(int analysis_type);
    7878                /*}}}*/
  • issm/trunk/src/c/objects/Loads/Load.h

    r5772 r8800  
    2626                virtual void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
    2727                virtual void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
    28                 virtual void  CreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs)=0;
    29                 virtual void  CreatePVector(Vec pg, Vec pf)=0;
    30                 virtual void  PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs, double kmax)=0;
    31                 virtual void  PenaltyCreatePVector(Vec pg, Vec pf, double kmax)=0;
     28                virtual void  CreateKMatrix(Mat Kff, Mat Kfs)=0;
     29                virtual void  CreatePVector(Vec pf)=0;
     30                virtual void  PenaltyCreateKMatrix(Mat Kff, Mat Kfs, double kmax)=0;
     31                virtual void  PenaltyCreatePVector(Vec pf, double kmax)=0;
    3232                virtual bool  InAnalysis(int analysis_type)=0;
    3333                /*}}}*/
  • issm/trunk/src/c/objects/Loads/Numericalflux.cpp

    r8287 r8800  
    327327/*}}}*/
    328328/*FUNCTION Numericalflux::CreateKMatrix {{{1*/
    329 void  Numericalflux::CreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs){
     329void  Numericalflux::CreateKMatrix(Mat Kff, Mat Kfs){
    330330
    331331        /*recover some parameters*/
     
    351351        /*Add to global matrix*/
    352352        if(Ke){
    353                 Ke->AddToGlobal(Kgg,Kff,Kfs);
     353                Ke->AddToGlobal(Kff,Kfs);
    354354                delete Ke;
    355355        }
     
    358358/*}}}*/
    359359/*FUNCTION Numericalflux::CreatePVector {{{1*/
    360 void  Numericalflux::CreatePVector(Vec pg,Vec pf){
     360void  Numericalflux::CreatePVector(Vec pf){
    361361
    362362        /*recover some parameters*/
     
    381381        /*Add to global matrix*/
    382382        if(pe){
    383                 pe->AddToGlobal(pg,pf);
     383                pe->AddToGlobal(pf);
    384384                delete pe;
    385385        }
     
    388388/*}}}*/
    389389/*FUNCTION Numericalflux::PenaltyCreateKMatrix {{{1*/
    390 void  Numericalflux::PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs,double kmax){
     390void  Numericalflux::PenaltyCreateKMatrix(Mat Kff, Mat Kfs,double kmax){
    391391
    392392        /*No stiffness loads applied, do nothing: */
     
    396396/*}}}*/
    397397/*FUNCTION Numericalflux::PenaltyCreatePVector{{{1*/
    398 void  Numericalflux::PenaltyCreatePVector(Vec pg,Vec pf,double kmax){
     398void  Numericalflux::PenaltyCreatePVector(Vec pf,double kmax){
    399399
    400400        /*No penalty loads applied, do nothing: */
  • issm/trunk/src/c/objects/Loads/Numericalflux.h

    r8287 r8800  
    6767                void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    6868                void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    69                 void  CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs);
    70                 void  CreatePVector(Vec pg, Vec pf);
    71                 void  PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat kfs, double kmax);
    72                 void  PenaltyCreatePVector(Vec pg,Vec pf, double kmax);
     69                void  CreateKMatrix(Mat Kff, Mat Kfs);
     70                void  CreatePVector(Vec pf);
     71                void  PenaltyCreateKMatrix(Mat Kff, Mat kfs, double kmax);
     72                void  PenaltyCreatePVector(Vec pf, double kmax);
    7373                bool  InAnalysis(int analysis_type);
    7474                /*}}}*/
  • issm/trunk/src/c/objects/Loads/Pengrid.cpp

    r8490 r8800  
    286286/*}}}1*/
    287287/*FUNCTION Pengrid::CreateKMatrix {{{1*/
    288 void  Pengrid::CreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs){
     288void  Pengrid::CreateKMatrix(Mat Kff, Mat Kfs){
    289289
    290290        /*No loads applied, do nothing: */
     
    294294/*}}}1*/
    295295/*FUNCTION Pengrid::CreatePVector {{{1*/
    296 void  Pengrid::CreatePVector(Vec pg,Vec pf){
     296void  Pengrid::CreatePVector(Vec pf){
    297297
    298298        /*No loads applied, do nothing: */
     
    302302/*}}}1*/
    303303/*FUNCTION Pengrid::PenaltyCreateMatrix {{{1*/
    304 void  Pengrid::PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs,double kmax){
     304void  Pengrid::PenaltyCreateKMatrix(Mat Kff, Mat Kfs,double kmax){
    305305
    306306        /*Retrieve parameters: */
     
    325325        /*Add to global matrix*/
    326326        if(Ke){
    327                 Ke->AddToGlobal(Kgg,Kff,Kfs);
     327                Ke->AddToGlobal(Kff,Kfs);
    328328                delete Ke;
    329329        }
     
    331331/*}}}1*/
    332332/*FUNCTION Pengrid::PenaltyCreatePVector {{{1*/
    333 void  Pengrid::PenaltyCreatePVector(Vec pg,Vec pf,double kmax){
     333void  Pengrid::PenaltyCreatePVector(Vec pf,double kmax){
    334334
    335335        /*Retrieve parameters: */
     
    353353        /*Add to global Vector*/
    354354        if(pe){
    355                 pe->AddToGlobal(pg,pf);
     355                pe->AddToGlobal(pf);
    356356                delete pe;
    357357        }
  • issm/trunk/src/c/objects/Loads/Pengrid.h

    r8408 r8800  
    7272                void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    7373                void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    74                 void  CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs);
    75                 void  CreatePVector(Vec pg, Vec pf);
    76                 void  PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat kfs, double kmax);
    77                 void  PenaltyCreatePVector(Vec pg,Vec pf, double kmax);
     74                void  CreateKMatrix(Mat Kff, Mat Kfs);
     75                void  CreatePVector(Vec pf);
     76                void  PenaltyCreateKMatrix(Mat Kff, Mat kfs, double kmax);
     77                void  PenaltyCreatePVector(Vec pf, double kmax);
    7878                bool  InAnalysis(int analysis_type);
    7979                /*}}}*/
  • issm/trunk/src/c/objects/Loads/Penpair.cpp

    r8224 r8800  
    197197/*}}}1*/
    198198/*FUNCTION Penpair::CreateKMatrix {{{1*/
    199 void  Penpair::CreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs){
     199void  Penpair::CreateKMatrix(Mat Kff, Mat Kfs){
    200200        /*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/
    201201        /*No loads applied, do nothing: */
     
    205205/*}}}1*/
    206206/*FUNCTION Penpair::CreatePVector {{{1*/
    207 void  Penpair::CreatePVector(Vec pg,Vec pf){
     207void  Penpair::CreatePVector(Vec pf){
    208208
    209209        /*No loads applied, do nothing: */
     
    213213/*}}}1*/
    214214/*FUNCTION Penpair::PenaltyCreateKMatrix {{{1*/
    215 void  Penpair::PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs,double kmax){
     215void  Penpair::PenaltyCreateKMatrix(Mat Kff, Mat Kfs,double kmax){
    216216
    217217        /*Retrieve parameters: */
     
    233233        /*Add to global Vector*/
    234234        if(Ke){
    235                 Ke->AddToGlobal(Kgg,Kff,Kfs);
     235                Ke->AddToGlobal(Kff,Kfs);
    236236                delete Ke;
    237237        }
     
    239239/*}}}1*/
    240240/*FUNCTION Penpair::PenaltyCreatePVector {{{1*/
    241 void  Penpair::PenaltyCreatePVector(Vec pg,Vec pf,double kmax){
     241void  Penpair::PenaltyCreatePVector(Vec pf,double kmax){
    242242        /*No loads applied, do nothing: */
    243243        return;
  • issm/trunk/src/c/objects/Loads/Penpair.h

    r7833 r8800  
    5959                void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    6060                void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    61                 void  CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs);
    62                 void  CreatePVector(Vec pg, Vec pf);
    63                 void  PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat kfs, double kmax);
    64                 void  PenaltyCreatePVector(Vec pg,Vec pf, double kmax);
     61                void  CreateKMatrix(Mat Kff, Mat Kfs);
     62                void  CreatePVector(Vec pf);
     63                void  PenaltyCreateKMatrix(Mat Kff, Mat kfs, double kmax);
     64                void  PenaltyCreatePVector(Vec pf, double kmax);
    6565                bool  InAnalysis(int analysis_type);
    6666                /*}}}*/
  • issm/trunk/src/c/objects/Loads/Riftfront.cpp

    r8303 r8800  
    420420/*}}}*/
    421421/*FUNCTION Riftfront::PenaltyCreateKMatrix {{{1*/
    422 void  Riftfront::PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs,double kmax){
     422void  Riftfront::PenaltyCreateKMatrix(Mat Kff, Mat Kfs,double kmax){
    423423
    424424        /*Retrieve parameters: */
     
    440440        /*Add to global Vector*/
    441441        if(Ke){
    442                 Ke->AddToGlobal(Kgg,Kff,Kfs);
     442                Ke->AddToGlobal(Kff,Kfs);
    443443                delete Ke;
    444444        }
     
    446446/*}}}1*/
    447447/*FUNCTION Riftfront::PenaltyCreatePVector {{{1*/
    448 void  Riftfront::PenaltyCreatePVector(Vec pg,Vec pf,double kmax){
     448void  Riftfront::PenaltyCreatePVector(Vec pf,double kmax){
    449449
    450450        /*Retrieve parameters: */
     
    466466        /*Add to global Vector*/
    467467        if(pe){
    468                 pe->AddToGlobal(pg,pf);
     468                pe->AddToGlobal(pf);
    469469                delete pe;
    470470        }
     
    472472/*}}}1*/
    473473/*FUNCTION Riftfront::CreateKMatrix {{{1*/
    474 void  Riftfront::CreateKMatrix(Mat Kgg,Mat Kff, Mat Kfs){
     474void  Riftfront::CreateKMatrix(Mat Kff, Mat Kfs){
    475475        /*do nothing: */
    476476        return;
     
    478478/*}}}1*/
    479479/*FUNCTION Riftfront::CreatePVector {{{1*/
    480 void  Riftfront::CreatePVector(Vec pg,Vec pf){
     480void  Riftfront::CreatePVector(Vec pf){
    481481        /*do nothing: */
    482482        return;
  • issm/trunk/src/c/objects/Loads/Riftfront.h

    r6748 r8800  
    7979                void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    8080                void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
    81                 void  CreateKMatrix(Mat Kgg, Mat Kff, Mat Kfs);
    82                 void  CreatePVector(Vec pg, Vec pf);
    83                 void  PenaltyCreateKMatrix(Mat Kgg,Mat Kff, Mat kfs, double kmax);
    84                 void  PenaltyCreatePVector(Vec pg,Vec pf, double kmax);
     81                void  CreateKMatrix(Mat Kff, Mat Kfs);
     82                void  CreatePVector(Vec pf);
     83                void  PenaltyCreateKMatrix(Mat Kff, Mat kfs, double kmax);
     84                void  PenaltyCreatePVector(Vec pf, double kmax);
    8585                bool  InAnalysis(int analysis_type);
    8686                /*}}}*/
  • issm/trunk/src/c/objects/Node.cpp

    r8303 r8800  
    806806}
    807807/*}}}*/
     808/*FUNCTION Node::UpdateSpcs {{{1*/
     809void   Node::UpdateSpcs(double* ys){
     810
     811        int     count=0;
     812        int     i;
     813
     814        count=0;
     815        for(i=0;i<this->indexing.gsize;i++){
     816                if(this->indexing.s_set[i]){
     817                        this->indexing.svalues[i]=ys[this->indexing.sdoflist[count]];
     818                        count++;
     819                }
     820        }
     821}
     822/*}}}*/
     823/*FUNCTION Node::VecMerge {{{1*/
     824void   Node::VecMerge(Vec ug, double* vector_serial,int setenum){
     825
     826        double* values=NULL;
     827        int*    indices=NULL;
     828        int     count=0;
     829        int     i;
     830
     831        if(setenum==FsetEnum){
     832                if(this->indexing.fsize){
     833                        indices=(int*)xmalloc(this->indexing.fsize*sizeof(int));
     834                        values=(double*)xmalloc(this->indexing.fsize*sizeof(double));
     835
     836                        for(i=0;i<this->indexing.gsize;i++){
     837                                if(this->indexing.f_set[i]){
     838                                        values[count]=vector_serial[this->indexing.fdoflist[count]];
     839                                        indices[count]=this->indexing.gdoflist[i];
     840                                        count++;
     841                                }
     842                        }
     843
     844                        /*Add values into ug: */
     845                        VecSetValues(ug,this->indexing.fsize,indices,(const double*)values,INSERT_VALUES);
     846                }
     847        }
     848        else if(setenum==SsetEnum){
     849                if(this->indexing.ssize){
     850                        indices=(int*)xmalloc(this->indexing.ssize*sizeof(int));
     851                        values=(double*)xmalloc(this->indexing.ssize*sizeof(double));
     852
     853                        for(i=0;i<this->indexing.gsize;i++){
     854                                if(this->indexing.s_set[i]){
     855                                        values[count]=vector_serial[this->indexing.sdoflist[count]];
     856                                        indices[count]=this->indexing.gdoflist[i];
     857                                        count++;
     858                                }
     859                        }
     860
     861                        /*Add values into ug: */
     862                        VecSetValues(ug,this->indexing.ssize,indices,(const double*)values,INSERT_VALUES);
     863                }
     864        }
     865        else _error_("VecMerge can only merge from the s or f-set onto the g-set!");
     866
     867        /*Free ressources:*/
     868        xfree((void**)&values);
     869        xfree((void**)&indices);
     870}
     871/*}}}*/
     872/*FUNCTION Node::VecReduce {{{1*/
     873void   Node::VecReduce(Vec vector, double* ug_serial,int setenum){
     874
     875        double* values=NULL;
     876        int     count=0;
     877        int     i;
     878
     879        if(setenum==FsetEnum){
     880                if(this->indexing.fsize){
     881                        values=(double*)xmalloc(this->indexing.fsize*sizeof(double));
     882
     883                        for(i=0;i<this->indexing.gsize;i++){
     884                                if(this->indexing.f_set[i]){
     885                                        values[count]=ug_serial[this->indexing.gdoflist[count]];
     886                                        count++;
     887                                }
     888                        }
     889
     890                        /*Add values into ug: */
     891                        VecSetValues(vector,this->indexing.fsize,this->indexing.fdoflist,(const double*)values,INSERT_VALUES);
     892                }
     893        }
     894        else if(setenum==SsetEnum){
     895                if(this->indexing.ssize){
     896                        values=(double*)xmalloc(this->indexing.ssize*sizeof(double));
     897
     898                        for(i=0;i<this->indexing.gsize;i++){
     899                                if(this->indexing.s_set[i]){
     900                                        values[count]=ug_serial[this->indexing.gdoflist[count]];
     901                                        count++;
     902                                }
     903                        }
     904
     905                        /*Add values into ug: */
     906                        VecSetValues(vector,this->indexing.ssize,this->indexing.sdoflist,(const double*)values,INSERT_VALUES);
     907                }
     908        }
     909        else _error_("VecReduce can only merge from the s or f-set onto the g-set!");
     910
     911        /*Free ressources:*/
     912        xfree((void**)&values);
     913}
     914/*}}}*/
    808915
    809916/* DofObject routines:*/
  • issm/trunk/src/c/objects/Node.h

    r8260 r8800  
    9292                int   IsOnShelf();
    9393                int   IsOnSheet();
     94                void  UpdateSpcs(double* ys);
     95                void  VecMerge(Vec ug, double* vector_serial,int setnum);
     96                void  VecReduce(Vec vector, double* ug_serial,int setnum);
     97               
    9498                /*}}}*/
    9599                /*Dof Object routines {{{1*/
  • issm/trunk/src/c/objects/Numerics/ElementMatrix.cpp

    r7639 r8800  
    2727        this->values=NULL;
    2828        this->dofsymmetrical=false;
    29         this->kff=false;
    3029
    3130        this->row_fsize=0;
     
    9998        this->ncols=gsize;
    10099        this->dofsymmetrical=true;
    101         this->kff=Ke1->kff;
    102100
    103101        /*Gset and values*/
     
    201199ElementMatrix::ElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation){
    202200
    203         /*retrieve some parameters: */
    204         parameters->FindParam(&kff,KffEnum);
    205 
    206201        /*get Matrix size and properties*/
    207202        this->dofsymmetrical=true;
     
    216211
    217212        /*get dof lists for f and s set: */
    218         if(kff){
    219                 this->row_fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
    220                 this->row_flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
    221                 this->row_fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
    222                 this->row_ssize=GetNumberOfDofs(nodes,numnodes,SsetEnum,approximation);
    223                 this->row_slocaldoflist =GetLocalDofList( nodes,numnodes,SsetEnum,approximation);
    224                 this->row_sglobaldoflist=GetGlobalDofList(nodes,numnodes,SsetEnum,approximation);
    225         }
    226         else{
    227                 this->row_fsize=0;
    228                 this->row_flocaldoflist=NULL;
    229                 this->row_fglobaldoflist=NULL;
    230                 this->row_ssize=0;
    231                 this->row_slocaldoflist=NULL;
    232                 this->row_sglobaldoflist=NULL;
    233         }
     213        this->row_fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
     214        this->row_flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
     215        this->row_fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
     216        this->row_ssize=GetNumberOfDofs(nodes,numnodes,SsetEnum,approximation);
     217        this->row_slocaldoflist =GetLocalDofList( nodes,numnodes,SsetEnum,approximation);
     218        this->row_sglobaldoflist=GetGlobalDofList(nodes,numnodes,SsetEnum,approximation);
    234219
    235220        /*Because this matrix is "dofsymmetrical" don't do cols, we can pick them up from the rows: */
     
    261246/*ElementMatrix specific routines: */
    262247/*FUNCTION ElementMatrix::AddToGlobal{{{1*/
    263 void ElementMatrix::AddToGlobal(Mat Kgg, Mat Kff, Mat Kfs){
     248void ElementMatrix::AddToGlobal(Mat Kff, Mat Kfs){
    264249
    265250        int i,j;
     
    269254                /*only use row dofs to add values into global matrices: */
    270255               
    271                 if(!this->kff){
     256                if(this->row_fsize){
     257                        /*first, retrieve values that are in the f-set from the g-set values matrix: */
     258                        localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
     259                        for(i=0;i<this->row_fsize;i++){
     260                                for(j=0;j<this->row_fsize;j++){
     261                                        *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
     262                                }
     263                        }
    272264                        /*add local values into global  matrix, using the fglobaldoflist: */
    273                         MatSetValues(Kgg,this->nrows,this->gglobaldoflist,this->nrows,this->gglobaldoflist,(const double*)values,ADD_VALUES);
    274                 }
    275                 else{
    276                         if(this->row_fsize){
    277                                 /*first, retrieve values that are in the f-set from the g-set values matrix: */
    278                                 localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
    279                                 for(i=0;i<this->row_fsize;i++){
    280                                         for(j=0;j<this->row_fsize;j++){
    281                                                 *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
    282                                         }
     265                        MatSetValues(Kff,this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,(const double*)localvalues,ADD_VALUES);
     266
     267                        /*Free ressources:*/
     268                        xfree((void**)&localvalues);
     269                }
     270
     271
     272                if((this->row_ssize!=0) && (this->row_fsize!=0)){
     273                        /*first, retrieve values that are in the f and s-set from the g-set values matrix: */
     274                        localvalues=(double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double));
     275                        for(i=0;i<this->row_fsize;i++){
     276                                for(j=0;j<this->row_ssize;j++){
     277                                        *(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]);
    283278                                }
    284                                 /*add local values into global  matrix, using the fglobaldoflist: */
    285                                 MatSetValues(Kff,this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,(const double*)localvalues,ADD_VALUES);
    286 
    287                                 /*Free ressources:*/
    288                                 xfree((void**)&localvalues);
    289279                        }
    290 
    291 
    292                         if((this->row_ssize!=0) && (this->row_fsize!=0)){
    293                                 /*first, retrieve values that are in the f and s-set from the g-set values matrix: */
    294                                 localvalues=(double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double));
    295                                 for(i=0;i<this->row_fsize;i++){
    296                                         for(j=0;j<this->row_ssize;j++){
    297                                                 *(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]);
    298                                         }
    299                                 }
    300                                 /*add local values into global  matrix, using the fglobaldoflist: */
    301                                 MatSetValues(Kfs,this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,(const double*)localvalues,ADD_VALUES);
    302 
    303                                 /*Free ressources:*/
    304                                 xfree((void**)&localvalues);
    305                         }
     280                        /*add local values into global  matrix, using the fglobaldoflist: */
     281                        MatSetValues(Kfs,this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,(const double*)localvalues,ADD_VALUES);
     282
     283                        /*Free ressources:*/
     284                        xfree((void**)&localvalues);
    306285                }
    307286        }
     
    356335        printf("   ncols: %i\n",ncols);
    357336        printf("   dofsymmetrical: %s\n",dofsymmetrical?"true":"false");
    358         printf("   kff: %s\n",kff?"true":"false");
    359337
    360338        printf("   values: \n");
     
    403381        this->ncols =Ke->ncols;
    404382        this->dofsymmetrical=Ke->dofsymmetrical;
    405         this->kff   =Ke->kff;
    406383
    407384        this->values=(double*)xmalloc(this->nrows*this->ncols*sizeof(double));
  • issm/trunk/src/c/objects/Numerics/ElementMatrix.h

    r7639 r8800  
    2424                int      ncols;
    2525                bool     dofsymmetrical;
    26                 bool     kff;
    2726                double*  values;
    2827
     
    5958                /*}}}*/
    6059                /*ElementMatrix specific routines {{{1*/
    61                 void AddToGlobal(Mat Kgg, Mat Kff, Mat Kfs);
     60                void AddToGlobal(Mat Kff, Mat Kfs);
    6261                void Echo(void);
    6362                void CheckConsistency(void);
  • issm/trunk/src/c/objects/Numerics/ElementVector.cpp

    r7639 r8800  
    7272        /*2: Initialize static fields*/
    7373        this->nrows=gsize;
    74         this->pf=pe1->pf;
    7574
    7675        /*Gset and values*/
     
    135134ElementVector::ElementVector(Node** nodes,int numnodes,Parameters* parameters,int approximation){
    136135
    137         /*retrieve some parameters: */
    138         parameters->FindParam(&this->pf,KffEnum);
    139 
    140136        /*get Vector size and properties*/
    141137        this->nrows=GetNumberOfDofs(nodes,numnodes,GsetEnum,approximation);
     
    148144
    149145        /*Get fsize*/
    150         if(pf){
    151                 this->fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
    152                 this->flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
    153                 this->fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
    154         }
    155         else{
    156                 this->fsize=0;
    157                 this->flocaldoflist =NULL;
    158                 this->fglobaldoflist=NULL;
    159         }
     146        this->fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
     147        this->flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
     148        this->fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
    160149}
    161150/*}}}*/
     
    171160
    172161/*ElementVector specific routines: */
    173 /*FUNCTION ElementVector::AddToGlobal(Vec pg, Vec pf){{{1*/
    174 void ElementVector::AddToGlobal(Vec pg, Vec pf){
     162/*FUNCTION ElementVector::AddToGlobal(Vec pf){{{1*/
     163void ElementVector::AddToGlobal(Vec pf){
    175164
    176165        int i;
    177166        double* localvalues=NULL;
    178167
    179         if(!pf){
     168        if(this->fsize){
     169                /*first, retrieve values that are in the f-set from the g-set values vector: */
     170                localvalues=(double*)xmalloc(this->fsize*sizeof(double));
     171                for(i=0;i<this->fsize;i++){
     172                        localvalues[i]=this->values[this->flocaldoflist[i]];
     173                }
    180174                /*add local values into global  vector, using the fglobaldoflist: */
    181                 VecSetValues(pg,this->nrows,this->gglobaldoflist,(const double*)values,ADD_VALUES);
    182         }
    183         else{
    184                 if(this->fsize){
    185                         /*first, retrieve values that are in the f-set from the g-set values vector: */
    186                         localvalues=(double*)xmalloc(this->fsize*sizeof(double));
    187                         for(i=0;i<this->fsize;i++){
    188                                 localvalues[i]=this->values[this->flocaldoflist[i]];
    189                         }
    190                         /*add local values into global  vector, using the fglobaldoflist: */
    191                         VecSetValues(pf,this->fsize,this->fglobaldoflist,(const double*)localvalues,ADD_VALUES);
    192 
    193                         /*Free ressources:*/
    194                         xfree((void**)&localvalues);
    195                 }
    196         }
    197 }
    198 /*}}}*/
    199 /*FUNCTION ElementVector::InsertIntoGlobal(Vec pg, Vec pf){{{1*/
    200 void ElementVector::InsertIntoGlobal(Vec pg, Vec pf){
     175                VecSetValues(pf,this->fsize,this->fglobaldoflist,(const double*)localvalues,ADD_VALUES);
     176
     177                /*Free ressources:*/
     178                xfree((void**)&localvalues);
     179        }
     180}
     181/*}}}*/
     182/*FUNCTION ElementVector::InsertIntoGlobal(Vec pf){{{1*/
     183void ElementVector::InsertIntoGlobal(Vec pf){
    201184
    202185        int i;
    203186        double* localvalues=NULL;
    204187
    205         if(!pf){
     188        if(this->fsize){
     189                /*first, retrieve values that are in the f-set from the g-set values vector: */
     190                localvalues=(double*)xmalloc(this->fsize*sizeof(double));
     191                for(i=0;i<this->fsize;i++){
     192                        localvalues[i]=this->values[this->flocaldoflist[i]];
     193                }
    206194                /*add local values into global  vector, using the fglobaldoflist: */
    207                 VecSetValues(pg,this->nrows,this->gglobaldoflist,(const double*)values,INSERT_VALUES);
    208         }
    209         else{
    210                 if(this->fsize){
    211                         /*first, retrieve values that are in the f-set from the g-set values vector: */
    212                         localvalues=(double*)xmalloc(this->fsize*sizeof(double));
    213                         for(i=0;i<this->fsize;i++){
    214                                 localvalues[i]=this->values[this->flocaldoflist[i]];
    215                         }
    216                         /*add local values into global  vector, using the fglobaldoflist: */
    217                         VecSetValues(pf,this->fsize,this->fglobaldoflist,(const double*)localvalues,INSERT_VALUES);
    218 
    219                         /*Free ressources:*/
    220                         xfree((void**)&localvalues);
    221                 }
     195                VecSetValues(pf,this->fsize,this->fglobaldoflist,(const double*)localvalues,INSERT_VALUES);
     196
     197                /*Free ressources:*/
     198                xfree((void**)&localvalues);
    222199        }
    223200}
     
    229206        printf("Element Vector echo: \n");
    230207        printf("   nrows: %i\n",nrows);
    231         printf("   pf: %s\n",pf?"true":"false");
    232208
    233209        printf("   values: \n");
     
    252228
    253229        this->nrows =pe->nrows;
    254         this->pf    =pe->pf;
    255230
    256231        this->values=(double*)xmalloc(this->nrows*sizeof(double));
  • issm/trunk/src/c/objects/Numerics/ElementVector.h

    r7639 r8800  
    2323                int      nrows;
    2424                double*  values;
    25                 bool     pf;
    2625               
    2726                //gset
     
    4140                /*}}}*/
    4241                /*ElementVector specific routines {{{1*/
    43                 void AddToGlobal(Vec pg, Vec pf);
    44                 void InsertIntoGlobal(Vec pg, Vec pf);
     42                void AddToGlobal(Vec pf);
     43                void InsertIntoGlobal(Vec pf);
    4544                void Echo(void);
    4645                void Init(ElementVector* pe);
  • issm/trunk/src/c/objects/objects.h

    r8798 r8800  
    1515#include "./Node.h"
    1616#include "./Segment.h"
    17 #include "./NodeSets.h"
    1817#include "./IoModel.h"
    1918#include "./Patch.h"
Note: See TracChangeset for help on using the changeset viewer.