Ignore:
Timestamp:
02/24/12 08:12:47 (13 years ago)
Author:
Mathieu Morlighem
Message:

merged trunk-jpl and trunk for revision 11526

Location:
issm/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk

  • issm/trunk/src/c

    • Property svn:ignore
      •  

        old new  
        33.ignore.txt
        44*.o
         5*.obj
        56*.exe
        67appscan.*
  • issm/trunk/src/c/Container/Nodes.cpp

    r10522 r11527  
    6060
    6161        int  i;
    62        
    6362        int  dofcount=0;
    6463        int  maxdofspernode=0;
     
    6968
    7069        /*some check: */
    71         if ((setenum!=GsetEnum) && (setenum!=FsetEnum) && (setenum!=SsetEnum))_error_("%s%s%s"," dof distribution for set of enum type ",EnumToStringx(setenum)," not supported yet!");
    72 
    73         /*Go through objects, and distribute dofs locally, from 0 to numberofdofs: */
     70        _assert_(setenum==GsetEnum || setenum==FsetEnum || setenum==SsetEnum);
     71
     72        /*Go through objects, and distribute dofs locally, from 0 to numberofdofsperobject*/
    7473        for (i=0;i<this->Size();i++){
    7574                Node* node=(Node*)this->GetObjectByOffset(i);
     
    8180        }
    8281
    83         /*Ok, now every object has distributed dofs, but locally, and with a dof count starting from
    84          *0. This means the dofs between all the cpus are not synchronized! We need to synchronize all
    85          *dof on all cpus, and use those to update the dofs of every object: */
    86 
     82        /* Now every object has distributed dofs, but locally, and with a dof count starting from
     83         * 0. This means the dofs between all the cpus are not unique. We now offset the dofs of eache
     84         * cpus by the total last dofs of the previus cpu, starting from 0.
     85         * First: bet number of dofs for each cpu*/
    8786        alldofcount=(int*)xmalloc(num_procs*sizeof(int));
    8887        MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD);
    8988        MPI_Bcast(alldofcount,num_procs,MPI_INT,0,MPI_COMM_WORLD);
    9089
    91         /*Ok, now every cpu should start its own dof count at the end of the dofcount
    92          * from cpu-1. : */
     90        /* Every cpu should start its own dof count at the end of the dofcount from cpu-1*/
    9391        dofcount=0;
    94         if(my_rank==0){
    95                 dofcount=0;
    96         }
    97         else{
     92        if(my_rank!=0){
    9893                for(i=0;i<my_rank;i++){
    9994                        dofcount+=alldofcount[i];
    10095                }
    10196        }
    102 
    103         /*Ok, now every cpu knows where his dofs should start. Update the dof count: */
    10497        for (i=0;i<this->Size();i++){
    105 
    10698                /*Check that this node corresponds to our analysis currently being carried out: */
    10799                Node* node=(Node*)this->GetObjectByOffset(i);
     
    109101                        node->OffsetDofs(dofcount,setenum);
    110102                }
    111 
    112         }
    113 
    114         /*Finally, remember that cpus may have skipped some objects, because they were clones. For every
     103        }
     104
     105        /* Finally, remember that cpus may have skipped some objects, because they were clones. For every
    115106         * object that is not a clone, tell them to show their dofs, so that later on, they can get picked
    116107         * up by their clones: */
    117108        maxdofspernode=this->MaxNumDofs(analysis_type,setenum);
    118109        numnodes=this->NumberOfNodes(analysis_type);
    119 
    120         if (numnodes*maxdofspernode){
    121                 truedofs=(int*)xcalloc(numnodes*maxdofspernode,sizeof(int)); //initialize to 0, so that we can pick up the max
     110        if(numnodes*maxdofspernode){
     111                truedofs=   (int*)xcalloc(numnodes*maxdofspernode,sizeof(int)); //initialize to 0, so that we can pick up the max
    122112                alltruedofs=(int*)xcalloc(numnodes*maxdofspernode,sizeof(int));
    123113        }
    124114
    125115        for (i=0;i<this->Size();i++){
    126                 /*Check that this node corresponds to our analysis currently being carried out: */
    127116                Node* node=(Node*)this->GetObjectByOffset(i);
    128117                if (node->InAnalysis(analysis_type)){
     
    130119                }
    131120        }
    132 
    133121        MPI_Allreduce ( (void*)truedofs,(void*)alltruedofs,numnodes*maxdofspernode,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
    134122
    135         /*Ok, now every cpu knows the true dofs of everyone else that is not a clone. Let the clones recover those true dofs: */
     123        /* Now every cpu knows the true dofs of everyone else that is not a clone*/
    136124        for (i=0;i<this->Size();i++){
    137                 /*Check that this node corresponds to our analysis currently being carried out: */
    138                 Node* node=(Node*)this->GetObjectByOffset(i);
    139                 if (node->InAnalysis(analysis_type)){
    140                         node->UpdateCloneDofs(alltruedofs,maxdofspernode,setenum); //give maxdofspernode, column size, so that nodes can index into alltruedofs
     125                Node* node=(Node*)this->GetObjectByOffset(i);
     126                if (node->InAnalysis(analysis_type)){
     127                        node->UpdateCloneDofs(alltruedofs,maxdofspernode,setenum);
    141128                }
    142129        }
     
    146133        xfree((void**)&truedofs);
    147134        xfree((void**)&alltruedofs);
    148 
    149 
    150135}
    151136/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.