Changeset 23599
- Timestamp:
- 01/03/19 20:42:49 (6 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r23576 r23599 2281 2281 2282 2282 } 2283 /*}}}*/2284 void Penta::SetClone(int* minranks){/*{{{*/2285 2286 _error_("not implemented yet");2287 }2288 2289 2283 /*}}}*/ 2290 2284 void Penta::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index,int offset, int N, int M){/*{{{*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r23035 r23599 149 149 void ResetFSBasalBoundaryCondition(void); 150 150 void ResetHooks(); 151 void SetClone(int* minranks);152 151 void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index,int offset, int N,int M); 153 152 void SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index); -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r23532 r23599 3263 3263 } 3264 3264 /*}}}*/ 3265 void Tria::SetClone(int* minranks){/*{{{*/3266 3267 _error_("not implemented yet");3268 }3269 /*}}}*/3270 3265 void Tria::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index,int offset,int N, int M){/*{{{*/ 3271 3266 -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r23053 r23599 207 207 void NormalSection(IssmDouble* normal,IssmDouble* xyz_list); 208 208 void NormalTop(IssmDouble* normal,IssmDouble* xyz_list); 209 void SetClone(int* minranks);210 209 void SetTemporaryElementType(int element_type_in){_error_("not implemented yet");}; 211 210 Seg* SpawnSeg(int index1,int index2); -
issm/trunk-jpl/src/c/classes/Node.cpp
r23588 r23599 749 749 } 750 750 /*}}}*/ 751 void Node::SetClone(int* minranks){/*{{{*/752 753 int my_rank;754 755 /*recover my_rank:*/756 my_rank=IssmComm::GetRank();757 758 if (minranks[sid]==my_rank){759 indexing.clone=false;760 }761 else{762 /*!there is a cpu with lower rank that has the same node,763 therefore, I am a clone*/764 indexing.clone=true;765 }766 }767 /*}}}*/768 751 void Node::ShowTrueDofs(int* truedofs, int ncols,int setenum){/*{{{*/ 769 752 -
issm/trunk-jpl/src/c/classes/Node.h
r23588 r23599 77 77 void RelaxConstraint(int dof); 78 78 bool RequiresDofReindexing(void); 79 void SetClone(int* minranks);80 79 void SetCurrentConfiguration(DataSet* nodes,Vertices* vertices); 81 80 void ShowTrueDofs(int* truerows,int ncols,int setenum); -
issm/trunk-jpl/src/c/classes/Nodes.cpp
r23597 r23599 133 133 void Nodes::DistributeDofs(int setenum){/*{{{*/ 134 134 135 /*some check: */ 136 _assert_(setenum==GsetEnum || setenum==FsetEnum || setenum==SsetEnum); 137 135 138 int i; 136 139 int dofcount=0; … … 145 148 int num_procs = IssmComm::GetSize(); 146 149 147 /*some check: */148 _assert_(setenum==GsetEnum || setenum==FsetEnum || setenum==SsetEnum);149 150 150 /*Go through objects, and distribute dofs locally, from 0 to numberofdofsperobject*/ 151 151 for(i=0;i<this->Size();i++){ … … 155 155 156 156 /* Now every object has distributed dofs, but locally, and with a dof count starting from 157 * 0. This means the dofs between all the cpus are not unique. We now offset the dofs of each e157 * 0. This means the dofs between all the cpus are not unique. We now offset the dofs of each 158 158 * cpus by the total last dofs of the previus cpu, starting from 0. 159 159 * First: get number of dofs for each cpu*/ -
issm/trunk-jpl/src/c/classes/Vertex.cpp
r23585 r23599 138 138 int Vertex::Connectivity(void){return connectivity;}/*{{{*/ 139 139 /*}}}*/ 140 void Vertex::DistributePids(int* ppidcount){/*{{{*/141 142 /*retrieve current pid*/143 int pidcount=*ppidcount;144 145 /*This vertex is a clone! Don't distribute pids, it will get them from another cpu!*/146 if(this->clone) return;147 148 /*This vertex should distribute its pid*/149 this->pid=pidcount;150 pidcount++;151 152 /*Assign output pointers: */153 *ppidcount=pidcount;154 }155 /*}}}*/156 140 IssmDouble Vertex::GetLatitude(){/*{{{*/ 157 141 return this->latitute; … … 178 162 } 179 163 /*}}}*/ 180 void Vertex::OffsetPids(int pidcount){/*{{{*/181 182 /*This vertex is a clone, don't offset the pids*/183 if(this->clone) return;184 185 /*This vertex should offset his pid, go ahead: */186 this->pid+=pidcount;187 }188 /*}}}*/189 164 int Vertex::Pid(void){ return pid; }/*{{{*/ 190 165 /*}}}*/ 191 166 int Vertex::Lid(void){ return lid; }/*{{{*/ 192 167 /*}}}*/ 193 void Vertex::SetClone(int* minranks){/*{{{*/194 195 int my_rank;196 197 /*recover my_rank:*/198 my_rank=IssmComm::GetRank();199 200 if (minranks[this->sid]==my_rank){201 this->clone=false;202 }203 else{204 /*!there is a cpu with lower rank that has the same vertex,205 therefore, I am a clone*/206 this->clone=true;207 }208 209 }210 /*}}}*/211 void Vertex::ShowTruePids(int* truepids){/*{{{*/212 213 /*Are we a clone? : */214 if(this->clone)return;215 216 /*Ok, we are not a clone, just plug our pid into truepids: */217 truepids[this->sid]=this->pid;218 }219 /*}}}*/220 168 int Vertex::Sid(void){ return sid; }/*{{{*/ 221 /*}}}*/222 void Vertex::UpdateClonePids(int* alltruepids){/*{{{*/223 224 /*If we are not a clone, don't update, we already have pids: */225 if(!this->clone)return;226 227 /*Ok, we are a clone node, but we did not create the pid for this vertex228 * Therefore, our pid is garbage right now. Go pick it up in the alltruepids: */229 this->pid=alltruepids[this->sid];230 }231 169 /*}}}*/ 232 170 void Vertex::UpdatePosition(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* surface,IssmDouble* bed){/*{{{*/ -
issm/trunk-jpl/src/c/classes/Vertex.h
r23585 r23599 51 51 /*Vertex management:*/ 52 52 int Connectivity(void); 53 void DistributePids(int* ppidcount);54 53 IssmDouble GetLatitude(void); 55 54 IssmDouble GetLongitude(void); … … 58 57 IssmDouble GetY(void); 59 58 IssmDouble GetZ(void); 60 void OffsetPids(int pidcount);61 59 int Pid(void); 62 60 int Lid(void); 63 void SetClone(int* minranks);64 void ShowTruePids(int* borderpids);65 61 int Sid(void); 66 void UpdateClonePids(int* allborderpids);67 62 void UpdatePosition(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed); 68 63 void VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,bool spherical=false); -
issm/trunk-jpl/src/c/classes/Vertices.cpp
r23586 r23599 127 127 } 128 128 /*}}}*/ 129 void Vertices::DistributePids(int numberofobjects){/*{{{*/130 131 int num_procs;132 int my_rank;133 134 int i;135 int pidcount = 0;136 int *allpidcount = NULL;137 int *truepids = NULL;138 int *alltruepids = NULL;139 140 /*recover my_rank:*/141 my_rank=IssmComm::GetRank();142 num_procs=IssmComm::GetSize();143 144 /*Go through objects, and distribute pids locally, from 0 to numberofpidsperobject*/145 for (i=0;i<this->Size();i++){146 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));147 vertex->DistributePids(&pidcount);148 }149 150 /* Now every object has distributed pids, but locally, and with a pid count starting from151 * 0. This means the pids between all the cpus are not unique. We now offset the pids of each152 * cpus by the total last pids of the previus cpu, starting from 0.153 * First: get number of pids for each cpu*/154 allpidcount=xNew<int>(num_procs);155 ISSM_MPI_Gather(&pidcount,1,ISSM_MPI_INT,allpidcount,1,ISSM_MPI_INT,0,IssmComm::GetComm());156 ISSM_MPI_Bcast(allpidcount,num_procs,ISSM_MPI_INT,0,IssmComm::GetComm());157 158 /* Every cpu should start its own pid count at the end of the pidcount from cpu-1*/159 pidcount=0;160 if(my_rank!=0){161 for(i=0;i<my_rank;i++){162 pidcount+=allpidcount[i];163 }164 }165 for (i=0;i<this->Size();i++){166 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));167 vertex->OffsetPids(pidcount);168 }169 170 /* Finally, remember that cpus may have skipped some objects, because they were clones. For every171 * object that is not a clone, tell them to show their pids, so that later on, they can get picked172 * up by their clones: */173 truepids =xNewZeroInit<int>(numberofobjects);174 alltruepids=xNewZeroInit<int>(numberofobjects);175 for (i=0;i<this->Size();i++){176 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));177 vertex->ShowTruePids(truepids);178 }179 ISSM_MPI_Allreduce((void*)truepids,(void*)alltruepids,numberofobjects,ISSM_MPI_INT,ISSM_MPI_MAX,IssmComm::GetComm());180 181 /* Now every cpu knows the true pids of everyone else that is not a clone*/182 for(i=0;i<this->Size();i++){183 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));184 vertex->UpdateClonePids(alltruepids);185 }186 187 /* Free ressources: */188 xDelete<int>(allpidcount);189 xDelete<int>(truepids);190 xDelete<int>(alltruepids);191 }192 /*}}}*/193 129 int Vertices::NumberOfVertices(void){/*{{{*/ 194 130 … … 197 133 int vertex_max_sid; 198 134 199 if (this->Size()==0)return 0;135 if(this->Size()==0) return 0; 200 136 201 137 for(i=0;i<this->Size();i++){ -
issm/trunk-jpl/src/c/classes/Vertices.h
r23586 r23599 29 29 30 30 /*numerics:*/ 31 void DistributePids(int numberofnodes);32 31 int NumberOfVertices(void); 33 32 void LatLonList(IssmDouble** lat,IssmDouble** lon);
Note:
See TracChangeset
for help on using the changeset viewer.