Changeset 11527 for issm/trunk/src/c/Container/Nodes.cpp
- Timestamp:
- 02/24/12 08:12:47 (13 years ago)
- Location:
- issm/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
-
issm/trunk/src/c
- Property svn:ignore
-
old new 3 3 .ignore.txt 4 4 *.o 5 *.obj 5 6 *.exe 6 7 appscan.*
-
- Property svn:ignore
-
issm/trunk/src/c/Container/Nodes.cpp
r10522 r11527 60 60 61 61 int i; 62 63 62 int dofcount=0; 64 63 int maxdofspernode=0; … … 69 68 70 69 /*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*/ 74 73 for (i=0;i<this->Size();i++){ 75 74 Node* node=(Node*)this->GetObjectByOffset(i); … … 81 80 } 82 81 83 /* Ok, now every object has distributed dofs, but locally, and with a dof count starting from84 * 0. This means the dofs between all the cpus are not synchronized! We need to synchronize all85 * 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*/ 87 86 alldofcount=(int*)xmalloc(num_procs*sizeof(int)); 88 87 MPI_Gather(&dofcount,1,MPI_INT,alldofcount,1,MPI_INT,0,MPI_COMM_WORLD); 89 88 MPI_Bcast(alldofcount,num_procs,MPI_INT,0,MPI_COMM_WORLD); 90 89 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*/ 93 91 dofcount=0; 94 if(my_rank==0){ 95 dofcount=0; 96 } 97 else{ 92 if(my_rank!=0){ 98 93 for(i=0;i<my_rank;i++){ 99 94 dofcount+=alldofcount[i]; 100 95 } 101 96 } 102 103 /*Ok, now every cpu knows where his dofs should start. Update the dof count: */104 97 for (i=0;i<this->Size();i++){ 105 106 98 /*Check that this node corresponds to our analysis currently being carried out: */ 107 99 Node* node=(Node*)this->GetObjectByOffset(i); … … 109 101 node->OffsetDofs(dofcount,setenum); 110 102 } 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 115 106 * object that is not a clone, tell them to show their dofs, so that later on, they can get picked 116 107 * up by their clones: */ 117 108 maxdofspernode=this->MaxNumDofs(analysis_type,setenum); 118 109 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 122 112 alltruedofs=(int*)xcalloc(numnodes*maxdofspernode,sizeof(int)); 123 113 } 124 114 125 115 for (i=0;i<this->Size();i++){ 126 /*Check that this node corresponds to our analysis currently being carried out: */127 116 Node* node=(Node*)this->GetObjectByOffset(i); 128 117 if (node->InAnalysis(analysis_type)){ … … 130 119 } 131 120 } 132 133 121 MPI_Allreduce ( (void*)truedofs,(void*)alltruedofs,numnodes*maxdofspernode,MPI_INT,MPI_MAX,MPI_COMM_WORLD); 134 122 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*/ 136 124 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); 141 128 } 142 129 } … … 146 133 xfree((void**)&truedofs); 147 134 xfree((void**)&alltruedofs); 148 149 150 135 } 151 136 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.