Ignore:
Timestamp:
04/16/12 16:06:52 (13 years ago)
Author:
cborstad
Message:

merged trunk-jpl into trunk-jpl-damage through revision 11990

Location:
issm/branches/trunk-jpl-damage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/branches/trunk-jpl-damage

  • issm/branches/trunk-jpl-damage/src/c/objects/Numerics/ElementMatrix.cpp

    r11684 r12004  
    260260        this->CheckConsistency();
    261261
    262         #ifdef _HAVE_PETSC_
    263                 if(this->dofsymmetrical){
    264                         /*only use row dofs to add values into global matrices: */
    265                        
    266                         if(this->row_fsize){
    267                                 /*first, retrieve values that are in the f-set from the g-set values matrix: */
    268                                 localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
    269                                 for(i=0;i<this->row_fsize;i++){
    270                                         for(j=0;j<this->row_fsize;j++){
    271                                                 *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
    272                                         }
     262        if(this->dofsymmetrical){
     263                /*only use row dofs to add values into global matrices: */
     264
     265                if(this->row_fsize){
     266                        /*first, retrieve values that are in the f-set from the g-set values matrix: */
     267                        localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
     268                        for(i=0;i<this->row_fsize;i++){
     269                                for(j=0;j<this->row_fsize;j++){
     270                                        *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
    273271                                }
    274                                 /*add local values into global  matrix, using the fglobaldoflist: */
    275                                 MatSetValues(Kff->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,(const double*)localvalues,ADD_VALUES);
    276 
    277                                 /*Free ressources:*/
    278                                 xfree((void**)&localvalues);
    279                         }
    280 
    281 
    282                         if((this->row_ssize!=0) && (this->row_fsize!=0)){
    283                                 /*first, retrieve values that are in the f and s-set from the g-set values matrix: */
    284                                 localvalues=(double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double));
    285                                 for(i=0;i<this->row_fsize;i++){
    286                                         for(j=0;j<this->row_ssize;j++){
    287                                                 *(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]);
    288                                         }
     272                        }
     273                        /*add local values into global  matrix, using the fglobaldoflist: */
     274                        Kff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL);
     275
     276                        /*Free ressources:*/
     277                        xfree((void**)&localvalues);
     278                }
     279
     280
     281                if((this->row_ssize!=0) && (this->row_fsize!=0)){
     282                        /*first, retrieve values that are in the f and s-set from the g-set values matrix: */
     283                        localvalues=(double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double));
     284                        for(i=0;i<this->row_fsize;i++){
     285                                for(j=0;j<this->row_ssize;j++){
     286                                        *(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]);
    289287                                }
    290                                 /*add local values into global  matrix, using the fglobaldoflist: */
    291                                 MatSetValues(Kfs->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,(const double*)localvalues,ADD_VALUES);
    292 
    293                                 /*Free ressources:*/
    294                                 xfree((void**)&localvalues);
    295                         }
    296                 }
    297                 else{
    298                         _error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");
    299                 }
    300         #else
    301                 _error_("not supported yet!");
    302         #endif
     288                        }
     289                        /*add local values into global  matrix, using the fglobaldoflist: */
     290                        Kfs->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,localvalues,ADD_VAL);
     291
     292                        /*Free ressources:*/
     293                        xfree((void**)&localvalues);
     294                }
     295        }
     296        else{
     297                _error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");
     298        }
    303299
    304300}
     
    316312        this->CheckConsistency();
    317313
    318         #ifdef _HAVE_PETSC_
    319                 if(this->dofsymmetrical){
    320                         /*only use row dofs to add values into global matrices: */
    321 
    322                         if(this->row_fsize){
    323                                 /*first, retrieve values that are in the f-set from the g-set values matrix: */
    324                                 localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
    325                                 for(i=0;i<this->row_fsize;i++){
    326                                         for(j=0;j<this->row_fsize;j++){
    327                                                 *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
    328                                         }
     314        if(this->dofsymmetrical){
     315                /*only use row dofs to add values into global matrices: */
     316
     317                if(this->row_fsize){
     318                        /*first, retrieve values that are in the f-set from the g-set values matrix: */
     319                        localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
     320                        for(i=0;i<this->row_fsize;i++){
     321                                for(j=0;j<this->row_fsize;j++){
     322                                        *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
    329323                                }
    330                                 /*add local values into global  matrix, using the fglobaldoflist: */
    331                                 MatSetValues(Jff->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,(const double*)localvalues,ADD_VALUES);
    332 
    333                                 /*Free ressources:*/
    334                                 xfree((void**)&localvalues);
    335                         }
    336 
    337                 }
    338                 else{
    339                         _error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");
    340                 }
    341         #else
    342                 _error_("not supported yet!");
    343         #endif
     324                        }
     325                        /*add local values into global  matrix, using the fglobaldoflist: */
     326                        Jff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL);
     327
     328                        /*Free ressources:*/
     329                        xfree((void**)&localvalues);
     330                }
     331
     332        }
     333        else{
     334                _error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");
     335        }
    344336
    345337}
Note: See TracChangeset for help on using the changeset viewer.