Changeset 13412


Ignore:
Timestamp:
09/20/12 16:59:40 (13 years ago)
Author:
Mathieu Morlighem
Message:

CHG: lots of cleanup

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

Legend:

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

    r13056 r13412  
    2121DofIndexing::DofIndexing(){
    2222
    23         this->gsize=UNDEF;
    24         this->fsize=UNDEF;
    25         this->ssize=UNDEF;
    26         this->clone=0;
    27         this->f_set=NULL;
    28         this->s_set=NULL;
    29         this->svalues=NULL;
    30         this->doftype=NULL;
    31         this->gdoflist=NULL;
    32         this->fdoflist=NULL;
    33         this->sdoflist=NULL;
     23        this->gsize    = UNDEF;
     24        this->fsize    = UNDEF;
     25        this->ssize    = UNDEF;
     26        this->clone    = false;
     27        this->f_set    = NULL;
     28        this->s_set    = NULL;
     29        this->svalues  = NULL;
     30        this->doftype  = NULL;
     31        this->gdoflist = NULL;
     32        this->fdoflist = NULL;
     33        this->sdoflist = NULL;
    3434
    3535}
     
    4343DofIndexing::DofIndexing(DofIndexing* in){ //copy constructor
    4444
    45         int i;
    46         this->gsize=in->gsize;
    47         this->fsize=in->fsize;
    48         this->ssize=in->ssize;
    49        
    50         this->clone=in->clone;
     45        this->gsize = in->gsize;
     46        this->fsize = in->fsize;
     47        this->ssize = in->ssize;
     48        this->clone = in->clone;
    5149
    5250        if(this->gsize>0){
     
    5856        }
    5957        else{
    60                 this->f_set=NULL;
    61                 this->s_set=NULL;
    62                 this->svalues=NULL;
    63                 this->doftype=NULL;
    64                 this->gdoflist=NULL;
     58                this->f_set    = NULL;
     59                this->s_set    = NULL;
     60                this->svalues  = NULL;
     61                this->doftype  = NULL;
     62                this->gdoflist = NULL;
    6563        }
    6664        if(this->fsize>0 && this->fsize!=UNDEF)this->fdoflist=xNew<int>(this->fsize); else this->fdoflist=NULL;
     
    9593void DofIndexing::Init(int in_gsize,int* in_doftype){
    9694
    97         int i;
    9895        this->gsize=in_gsize;
    99        
    100         this->clone=0;
     96        this->clone=false;
    10197
    10298        /*allocate: */
     
    109105        }
    110106
    111         for (i=0;i<this->gsize;i++){
     107        for(int i=0;i<this->gsize;i++){
    112108                /*assume dof is free, no constraints, no rigid body constraint: */
    113109                this->f_set[i]=true;
  • issm/trunk-jpl/src/c/classes/DofIndexing.h

    r12821 r13412  
    1818
    1919                /*partitioning: */
    20                 int    clone;   //this node is replicated from another one
     20                bool clone;   //this node is replicated from another one
    2121
    2222                /*boundary conditions sets: */
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r13376 r13412  
    228228
    229229        extern int my_rank;
    230         extern int num_procs;
    231230       
    232231        /*record descriptions; */
    233232        int record_enum;
    234233        int record_length;
    235         int record_code; //1 to 7 number
     234        int record_code;     //1 to 7 number
    236235
    237236        /*records: */
    238         int  booleanint=0;
    239         int  integer=0;
    240         IssmPDouble scalar=0;
    241         char* string=NULL;
    242         int   string_size;
     237        int          booleanint  = 0;
     238        int          integer     = 0;
     239        IssmPDouble  scalar      = 0;
     240        char        *string      = NULL;
     241        int          string_size;
    243242
    244243        /*Check that some fields have been allocated*/
     
    458457
    459458        extern int my_rank;
    460         extern int num_procs;
    461        
    462459
    463460        /*output: */
     
    488485
    489486        extern int my_rank;
    490         extern int num_procs;
    491487
    492488        /*output: */
     
    515511void  IoModel::FetchData(IssmDouble* pscalar,int data_enum){
    516512
    517 
    518513        extern int my_rank;
    519         extern int num_procs;
    520        
    521514
    522515        /*output: */
     
    546539
    547540        extern int my_rank;
    548         extern int num_procs;
    549        
    550541
    551542        /*output: */
     
    597588
    598589        extern int my_rank;
    599         extern int num_procs;
    600590        int i,j;
    601591
     
    672662
    673663        extern int my_rank;
    674         extern int num_procs;
    675664
    676665        /*output: */
     
    737726
    738727        extern int my_rank;
    739         extern int num_procs;
    740        
    741728        int i;
    742729
     
    809796
    810797        extern int my_rank;
    811         extern int num_procs;
    812798
    813799        /*output: */
     
    898884void  IoModel::FetchData(Option** poption,int index){
    899885
    900         extern int my_rank;
    901         extern int num_procs;
    902 
    903886        /*output: */
    904         int     code;
    905         char   *name        = NULL;
     887        int   code;
     888        char *name = NULL;
    906889
    907890        /*First get option name*/
     
    12201203
    12211204        extern int my_rank;
    1222         extern int num_procs;
    12231205
    12241206        int found=0;
     
    13151297        #ifdef _HAVE_ADOLC_ //cannot come here unless you are running AD mode, from DeclaredIndependents:
    13161298        extern int my_rank;
    1317         extern int num_procs;
    13181299
    13191300        /*output: */
  • issm/trunk-jpl/src/c/classes/objects/Node.cpp

    r13410 r13412  
    872872
    873873        int i;
    874         extern int my_rank;
    875874        int dofcount;
    876875
     
    881880        if(setenum==SsetEnum) this->indexing.InitSet(setenum);
    882881       
    883                
    884882        /*For clone nodfs, don't distribute dofs, we will get them from another cpu in UpdateCloneDofs!*/
    885883        if(indexing.clone){
     
    888886
    889887        /*This node should distribute dofs for setenum set (eg, f_set or s_set), go ahead: */
    890 
    891888        if(setenum==GsetEnum){
    892889                for(i=0;i<this->indexing.gsize;i++){
     
    909906        else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
    910907
    911 
    912908        /*Assign output pointers: */
    913909        *pdofcount=dofcount;
    914 
    915910}
    916911/*}}}*/
     
    919914       
    920915        int i;
    921         extern int my_rank;
    922916       
    923917        if(indexing.clone){
     
    943937
    944938        int j;
    945         extern int my_rank;
    946        
     939
    947940        /*Are we a clone? : */
    948         if(indexing.clone)return;
     941        if(indexing.clone) return;
    949942
    950943        /*Ok, we are not a clone, just plug our dofs into truedofs: */
    951         if(setenum==GsetEnum)for(j=0;j<this->indexing.gsize;j++)  *(truedofs+ncols*sid+j)=indexing.gdoflist[j];
    952         else if(setenum==FsetEnum)for(j=0;j<this->indexing.fsize;j++)  *(truedofs+ncols*sid+j)=indexing.fdoflist[j];
    953         else if(setenum==SsetEnum)for(j=0;j<this->indexing.ssize;j++)  *(truedofs+ncols*sid+j)=indexing.sdoflist[j];
    954         else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
     944        switch(setenum){
     945                case GsetEnum:
     946                        for(j=0;j<this->indexing.gsize;j++) truedofs[ncols*sid+j]=indexing.gdoflist[j];
     947                        break;
     948                case FsetEnum:
     949                        for(j=0;j<this->indexing.fsize;j++) truedofs[ncols*sid+j]=indexing.fdoflist[j];
     950                        break;
     951                case SsetEnum:
     952                        for(j=0;j<this->indexing.ssize;j++) truedofs[ncols*sid+j]=indexing.sdoflist[j];
     953                        break;
     954                default:
     955                        _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
     956        }
    955957
    956958}
     
    960962
    961963        int j;
    962         extern int my_rank;
    963        
     964
    964965        /*If we are not a clone, don't update, we already have dofs!: */
    965         if(indexing.clone==0)return;
    966 
     966        if(!indexing.clone)return;
    967967
    968968        /*Ok, we are a clone node, but we did not create the dofs for this node.
    969          *      * Therefore, our doflist is garbage right now. Go pick it up in the alltruedofs: */
    970         if(setenum==GsetEnum)for(j=0;j<this->indexing.gsize;j++) indexing.gdoflist[j]=*(alltruedofs+ncols*sid+j);
    971         else if(setenum==FsetEnum)for(j=0;j<this->indexing.fsize;j++) indexing.fdoflist[j]=*(alltruedofs+ncols*sid+j);
    972         else if(setenum==SsetEnum)for(j=0;j<this->indexing.ssize;j++) indexing.sdoflist[j]=*(alltruedofs+ncols*sid+j);
    973         else _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
    974 
     969         *Therefore, our doflist is garbage right now. Go pick it up in the alltruedofs: */
     970        switch(setenum){
     971                case GsetEnum:
     972                        for(j=0;j<this->indexing.gsize;j++) indexing.gdoflist[j]=alltruedofs[ncols*sid+j];
     973                        break;
     974                case FsetEnum:
     975                        for(j=0;j<this->indexing.fsize;j++) indexing.fdoflist[j]=alltruedofs[ncols*sid+j];
     976                        break;
     977                case SsetEnum:
     978                        for(j=0;j<this->indexing.ssize;j++) indexing.sdoflist[j]=alltruedofs[ncols*sid+j];
     979                        break;
     980                default:
     981                        _error_("set of enum type " << EnumToStringx(setenum) << " not supported yet!");
     982        }
    975983}
    976984/*}}}*/
     
    981989
    982990        if (minranks[sid]==my_rank){
    983                 indexing.clone=0;
     991                indexing.clone=false;
    984992        }
    985993        else{
    986994                /*!there is a cpu with lower rank that has the same node,
    987995                therefore, I am a clone*/
    988                 indexing.clone=1;       
    989         }
    990 
    991 }
    992 /*}}}*/
     996                indexing.clone=true;   
     997        }
     998}
     999/*}}}*/
  • issm/trunk-jpl/src/c/io/PrintfFunction.cpp

    r12543 r13412  
    1717        int         string_size;
    1818        extern int  my_rank;
    19         extern int  num_procs;
    20                                                                                                                                                                                                      
    2119        //variable list of arguments
    2220        va_list args;
  • issm/trunk-jpl/src/c/matlab/io/PrintfFunction.cpp

    r12511 r13412  
    1919        int         string_size;
    2020        extern int  my_rank;
    21         extern int  num_procs;
    22                                                                                                                                                                                                      
     21
    2322        //variable list of arguments
    2423        va_list args;
  • issm/trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp

    r12515 r13412  
    1313void ConstraintsStatex(int* pconverged, int* pnum_unstable_constraints, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads,Materials* materials,  Parameters* parameters){
    1414
    15         int i;
    16 
    17         extern int num_procs;
    18         extern int my_rank;
    19        
    2015        /*output: */
    2116        int converged=0;
  • issm/trunk-jpl/src/c/modules/MassFluxx/MassFluxx.cpp

    r13073 r13412  
    1212void MassFluxx(IssmDouble* pmass_flux, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool process_units){
    1313
    14         int i,j;
    15         extern int num_procs;
    16         extern int my_rank;
    17        
    18         Element* element=NULL;
    19         int element_id;
     14        int      i,j;
     15        Element *element    = NULL;
     16        int      element_id;
    2017       
    2118        /*output: */
    2219        IssmDouble mass_flux=0;
    2320        IssmDouble all_mass_flux=0;
    24 
    2521        int  counter;
    2622
    2723        /*all segments: */
    28         IssmDouble** array=NULL;
    29         int      M;
    30         int*     mdims_array=NULL;
    31         int*     ndims_array=NULL;
     24        IssmDouble **array       = NULL;
     25        int          M;
     26        int         *mdims_array = NULL;
     27        int         *ndims_array = NULL;
    3228
    3329        /*our segments of interest: */
    34         IssmDouble*  segments=NULL;
    35         int      num_segments;
     30        IssmDouble *segments     = NULL;
     31        int         num_segments;
    3632
    3733        /*First, figure out which segment to compute our mass flux on. Start with retrieving qmu_mass_flux_segments: */
  • issm/trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp

    r13056 r13412  
    1212
    1313void ResetConstraintsx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads,Materials* materials,  Parameters* parameters){
    14 
    15         int i;
    16 
    17         extern int num_procs;
    18         extern int my_rank;
    1914
    2015        /*output: */
Note: See TracChangeset for help on using the changeset viewer.