Changeset 3965


Ignore:
Timestamp:
05/27/10 08:39:36 (15 years ago)
Author:
Mathieu Morlighem
Message:

moved some Dataset methods to modules

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

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/DataSet/DataSet.cpp

    r3938 r3965  
    651651}
    652652/*}}}*/
    653 /*FUNCTION DataSet::CreateKMatrix{{{1*/
    654 void  DataSet::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){
    655 
    656         vector<Object*>::iterator object;
    657         Element* element=NULL;
    658         Load* load=NULL;
    659 
    660         for ( object=objects.begin() ; object < objects.end(); object++ ){
    661                
    662                 if(EnumIsElement((*object)->Enum())){
    663 
    664                         element=(Element*)(*object);
    665                         element->CreateKMatrix(Kgg,analysis_type,sub_analysis_type);
    666                 }
    667                 if(EnumIsLoad((*object)->Enum())){
    668 
    669                         load=(Load*)(*object);
    670                         load->CreateKMatrix(Kgg,analysis_type,sub_analysis_type);
    671                 }
    672         }
    673 
    674 }
    675 /*}}}*/
    676653/*FUNCTION DataSet::CreatePartitioningVector{{{1*/
    677654void  DataSet::CreatePartitioningVector(Vec* ppartition,int numberofobjects){
     
    700677        /*Assign output pointers: */
    701678        *ppartition=partition;
    702 }
    703 /*}}}*/
    704 /*FUNCTION DataSet::CreatePVector{{{1*/
    705 void  DataSet::CreatePVector(Vec pg,int analysis_type,int sub_analysis_type){
    706 
    707         vector<Object*>::iterator object;
    708         Element* element=NULL;
    709         Load* load=NULL;
    710 
    711         for ( object=objects.begin() ; object < objects.end(); object++ ){
    712 
    713                 if(EnumIsElement((*object)->Enum())){
    714 
    715                         element=(Element*)(*object);
    716                         element->CreatePVector(pg,analysis_type,sub_analysis_type);
    717                 }
    718                 if(EnumIsLoad((*object)->Enum())){
    719 
    720                         load=(Load*)(*object);
    721                         load->CreatePVector(pg,analysis_type,sub_analysis_type);
    722                 }               
    723         }
    724 
    725679}
    726680/*}}}*/
     
    12401194
    12411195
    1242 
    1243 }
    1244 /*}}}*/
    1245 /*FUNCTION DataSet::PenaltyCreateKMatrix{{{1*/
    1246 void  DataSet::PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type){
    1247 
    1248         vector<Object*>::iterator object;
    1249         Load* load=NULL;
    1250 
    1251         for ( object=objects.begin() ; object < objects.end(); object++ ){
    1252                
    1253                 if(EnumIsLoad((*object)->Enum())){
    1254 
    1255                         load=(Load*)(*object);
    1256                         load->PenaltyCreateKMatrix(Kgg,kmax,analysis_type,sub_analysis_type);
    1257                 }
    1258         }
    1259 
    1260 }
    1261 /*}}}*/
    1262 /*FUNCTION DataSet::PenaltyCreatePVector{{{1*/
    1263 void  DataSet::PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type){
    1264 
    1265         vector<Object*>::iterator object;
    1266         Load* load=NULL;
    1267 
    1268         for ( object=objects.begin() ; object < objects.end(); object++ ){
    1269 
    1270                 if(EnumIsLoad((*object)->Enum())){
    1271 
    1272                         load=(Load*)(*object);
    1273                         load->PenaltyCreatePVector(pg,kmax,analysis_type,sub_analysis_type);
    1274                 }               
    1275         }
    12761196
    12771197}
  • issm/trunk/src/c/DataSet/DataSet.h

    r3956 r3965  
    6969                void  SetSorting(int* in_sorted_ids,int* in_id_offsets);
    7070                void  Sort();
    71                 void  CreateKMatrix(Mat Kgg, int analysis_type,int sub_analysis_type);
    72                 void  CreatePVector(Vec pg, int analysis_type,int sub_analysis_type);
    7371                void  UpdateInputsFromConstant(double constant, int name);
    7472                void  UpdateInputsFromConstant(int constant, int name);
     
    7977                void  UpdateInputsFromSolution(double* solution,int analysis_type,int sub_analysis_type);
    8078                void  GetSolutionFromInputs(Vec solution, int analysis_type, int sub_analysis_type);
    81                 void  PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type);
    82                 void  PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type);
    8379                int   RiftIsPresent();
    8480                int   MeltingIsPresent();
  • issm/trunk/src/c/modules/PenaltySystemMatricesx/PenaltySystemMatricesx.cpp

    r3913 r3965  
    1414       
    1515        int i;
    16 
    17         extern int num_procs;
    18         extern int my_rank;
    1916        double kmax;
     17        Load* load=NULL;
    2018       
    2119        /*First, get elements and loads configured: */
    22         elements->Configure(elements,loads, nodes,vertices, materials,parameters);
    23         nodes->Configure(elements,loads, nodes,vertices, materials,parameters);
    24         loads->Configure(elements, loads, nodes,vertices, materials,parameters);
     20        elements->  Configure(elements,loads, nodes,vertices, materials,parameters);
     21        nodes->     Configure(elements,loads, nodes,vertices, materials,parameters);
     22        loads->     Configure(elements, loads, nodes,vertices, materials,parameters);
    2523        parameters->Configure(elements,loads, nodes,vertices, materials,parameters);
    2624
     
    2927
    3028        /*Add penalties to stiffnesses, from loads: */
    31         if(kflag)loads->PenaltyCreateKMatrix(Kgg,kmax,analysis_type,sub_analysis_type);
    32         if(pflag)loads->PenaltyCreatePVector(pg,kmax,analysis_type,sub_analysis_type);
    33        
    34         /*Assemble matrices: */
    3529        if(kflag){
     30
     31                /*Fill stiffness matrix from loads: */
     32                for (i=0;i<loads->Size();i++){
     33                        load=(Load*)loads->GetObjectByOffset(i);
     34                        load->PenaltyCreateKMatrix(Kgg,kmax,analysis_type,sub_analysis_type);
     35                }
     36
     37                /*Assemble matrix and compress matrix to save memory: */
    3638                MatAssemblyBegin(Kgg,MAT_FINAL_ASSEMBLY);
    3739                MatAssemblyEnd(Kgg,MAT_FINAL_ASSEMBLY);
    3840                MatCompress(Kgg);
    3941        }
     42
     43        /*Add penalties to right hand side, from loads: */
    4044        if(pflag){
     45
     46                /*Fill right hand side vector, from loads: */
     47                for (i=0;i<loads->Size();i++){
     48                        load=(Load*)loads->GetObjectByOffset(i);
     49                        load->PenaltyCreatePVector(pg,kmax,analysis_type,sub_analysis_type);
     50                }
     51
     52                /*Assemble right hand side: */
    4153                VecAssemblyBegin(pg);
    4254                VecAssemblyEnd(pg);
    4355        }
    44 
    45         /*Assign output pointers:*/
    46         if(pkmax)*pkmax=kmax;
     56       
     57        /*Assign output pointer:*/
     58        if(pkmax) *pkmax=kmax;
    4759
    4860}
  • issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp

    r3913 r3965  
    1313                int kflag,int pflag,int analysis_type,int sub_analysis_type){
    1414       
    15         extern int num_procs;
    16         extern int my_rank;
    17        
    1815        /*intermediary: */
    1916        int gsize;
     17        int i,j;
    2018        int connectivity;
    2119        int numberofdofspernode;
     20        Element* element=NULL;
     21        Load*    load=NULL;
    2222       
    2323        /*output: */
     
    2626
    2727        /*First, get elements and loads configured: */
    28         elements->Configure(elements,loads, nodes,vertices, materials,parameters);
    29         nodes->Configure(elements,loads, nodes,vertices, materials,parameters);
    30         loads->Configure(elements, loads, nodes,vertices, materials,parameters);
     28        elements->  Configure(elements,loads, nodes,vertices, materials,parameters);
     29        nodes->     Configure(elements,loads, nodes,vertices, materials,parameters);
     30        loads->     Configure(elements, loads, nodes,vertices, materials,parameters);
    3131        parameters->Configure(elements,loads, nodes,vertices, materials,parameters);
    3232
     
    3838        gsize=nodes->NumberOfDofs();
    3939
    40         /*Allocate Kgg and pg: */
    41         if(kflag)Kgg=NewMat(gsize,gsize,NULL,&connectivity,&numberofdofspernode);
    42         if(pflag)pg=NewVec(gsize);
     40        /*Compute stiffness matrix*/
     41        if(kflag){
    4342
    44         /*Fill stiffness matrix and right hand side vector, from elements: */
    45         if(kflag)elements->CreateKMatrix(Kgg,analysis_type,sub_analysis_type);
    46         if(pflag)elements->CreatePVector(pg,analysis_type,sub_analysis_type);
    47        
    48         /*Fill stiffness matrix and right hand side vector, from loads: */
    49         if(kflag)loads->CreateKMatrix(Kgg,analysis_type,sub_analysis_type);
    50         if(pflag)loads->CreatePVector(pg,analysis_type,sub_analysis_type);
     43                /*Allocate Kgg*/
     44                Kgg=NewMat(gsize,gsize,NULL,&connectivity,&numberofdofspernode);
    5145
    52         /*Assemble matrices: */
    53         if(kflag){
     46                /*Fill stiffness matrix from elements: */
     47                for (i=0;i<elements->Size();i++){
     48                        element=(Element*)elements->GetObjectByOffset(i);
     49                        element->CreateKMatrix(Kgg,analysis_type,sub_analysis_type);
     50                }
     51
     52                /*Fill stiffness matrix from loads: */
     53                for (i=0;i<loads->Size();i++){
     54                        load=(Load*)loads->GetObjectByOffset(i);
     55                        load->CreateKMatrix(Kgg,analysis_type,sub_analysis_type);
     56                }
     57
     58                /*Assemble matrix and compress matrix to save memory: */
    5459                MatAssemblyBegin(Kgg,MAT_FINAL_ASSEMBLY);
    5560                MatAssemblyEnd(Kgg,MAT_FINAL_ASSEMBLY);
    5661                MatCompress(Kgg);
    5762        }
     63
     64        /*Compute Load vector*/
    5865        if(pflag){
     66
     67                /*Allocate pg*/
     68                pg=NewVec(gsize);
     69
     70                /*Fill right hand side vector, from elements: */
     71                for (i=0;i<elements->Size();i++){
     72                        element=(Element*)elements->GetObjectByOffset(i);
     73                        element->CreatePVector(pg,analysis_type,sub_analysis_type);
     74                }
     75
     76                /*Fill right hand side vector, from loads: */
     77                for (i=0;i<loads->Size();i++){
     78                        load=(Load*)loads->GetObjectByOffset(i);
     79                        load->CreatePVector(pg,analysis_type,sub_analysis_type);
     80                }
     81
     82                /*Assemble right hand side: */
    5983                VecAssemblyBegin(pg);
    6084                VecAssemblyEnd(pg);
     
    6488        *pKgg=Kgg;
    6589        *ppg=pg;
     90
    6691}
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r3956 r3965  
    48444844}
    48454845/*}}}*/
     4846/*FUNCTION Tria::UpdateInputsFromConstant(double value, int name);{{{1*/
     4847void  Tria::UpdateInputsFromConstant(double constant, int name){
     4848        /*Nothing updated for now*/
     4849}
     4850/*}}}*/
     4851/*FUNCTION Tria::UpdateInputsFromConstant(bool value, int name);{{{1*/
     4852void  Tria::UpdateInputsFromConstant(bool constant, int name){
     4853        /*Nothing updated for now*/
     4854}
     4855/*}}}*/
    48464856/*FUNCTION Tria::DepthAverageInputAtBase {{{1*/
    48474857void  Tria::DepthAverageInputAtBase(int enum_type){
  • issm/trunk/src/c/objects/Elements/Tria.h

    r3956 r3965  
    139139                void  UpdateInputsFromVector(int* vector, int name, int type);
    140140                void  UpdateInputsFromVector(bool* vector, int name, int type);
    141                 void  UpdateInputsFromConstant(double constant, int name){ISSMERROR("Not implemented yet!");};
     141                void  UpdateInputsFromConstant(double constant, int name);
    142142                void  UpdateInputsFromConstant(int constant, int name);
    143                 void  UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");};
     143                void  UpdateInputsFromConstant(bool constant, int name);
    144144                /*}}}*/
    145145
  • issm/trunk/src/c/objects/Model.cpp

    r3925 r3965  
    8888
    8989        _printf_("   reducing single point constraints vector:\n");
    90         Reducevectorgtosx(&ys,&ys0, yg->vector,nodesets);
     90        Reducevectorgtosx(&ys,yg->vector,nodesets);
    9191       
    9292        _printf_("   normalizing rigid body constraints matrix:\n");
     
    166166
    167167        _printf_("   reducing single point constraints vector:\n");
    168         Reducevectorgtosx(&ys,&ys0, yg->vector,nodesets);
     168        Reducevectorgtosx(&ys,yg->vector,nodesets);
    169169       
    170170        _printf_("   normalizing rigid body constraints matrix:\n");
Note: See TracChangeset for help on using the changeset viewer.