Changeset 25539 for issm/trunk-jpl/src/c/classes/Nodes.cpp
- Timestamp:
- 09/07/20 03:12:14 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Nodes.cpp
r25508 r25539 63 63 output->id_offsets=NULL; 64 64 output->sorted_ids=NULL; 65 if(this->sorted && objsize>0 && this->id_offsets){ 65 if(this->sorted && objsize>0 && this->id_offsets){ 66 66 output->id_offsets=xNew<int>(objsize); 67 67 xMemCpy<int>(output->id_offsets,this->id_offsets,objsize); … … 148 148 149 149 /*First, allocate dof lists based on fset and sset*/ 150 for( int i=0;i<this->Size();i++){151 Node* node=xDynamicCast<Node*>(this->GetObjectByOffset(i));150 for(Object* & object : this->objects){ 151 Node* node = xDynamicCast<Node*>(object); 152 152 node->AllocateDofLists(setenum); 153 153 } … … 155 155 /*Now, Build local dofs for masters first*/ 156 156 int dofcount=0; 157 for( int i=0;i<this->Size();i++){158 Node* node=xDynamicCast<Node*>(this->GetObjectByOffset(i));157 for(Object* & object : this->objects){ 158 Node* node = xDynamicCast<Node*>(object); 159 159 if(!node->IsClone()) node->DistributeLocalDofs(&dofcount,setenum); 160 160 } 161 161 /*Build local dofs for clones, they always will be at the end*/ 162 162 int dofcount_local = dofcount; 163 for( int i=0;i<this->Size();i++){164 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));163 for(Object* & object : this->objects){ 164 Node* node = xDynamicCast<Node*>(object); 165 165 if(node->IsClone()) node->DistributeLocalDofs(&dofcount_local,setenum); 166 166 } 167 167 168 /* Now every object has distributed dofs, but locally, and with a dof count starting from 168 /* Now every object has distributed dofs, but locally, and with a dof count starting from 169 169 * 0. This means the dofs between all the cpus are not unique. We now offset the dofs of each 170 170 * cpus by the total last (master) dofs of the previus cpu, starting from 0. … … 179 179 xDelete<int>(alldofcount); 180 180 181 for( int i=0;i<this->Size();i++){182 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));181 for(Object* & object : this->objects){ 182 Node* node = xDynamicCast<Node*>(object); 183 183 node->DistributeGlobalDofsMasters(offset,setenum); 184 184 } 185 185 186 /* Finally, remember that cpus may have skipped some objects, because they were clones. For every 187 * object that is not a clone, tell them to show their dofs, so that later on, they can get picked 186 /* Finally, remember that cpus may have skipped some objects, because they were clones. For every 187 * object that is not a clone, tell them to show their dofs, so that later on, they can get picked 188 188 * up by their clones: */ 189 189 int maxdofspernode = this->MaxNumDofs(setenum); … … 212 212 213 213 /*Update indexingupdateflag*/ 214 for( int i=0;i<this->Size();i++){215 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));214 for(Object* & object : this->objects){ 215 Node* node = xDynamicCast<Node*>(object); 216 216 node->ReindexingDone(); 217 217 } … … 236 236 this->numberofnodes_local=this->Size(); 237 237 this->numberofmasters_local=0; 238 for( int i=0;i<this->Size();i++){239 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));238 for(Object* & object : this->objects){ 239 Node* node = xDynamicCast<Node*>(object); 240 240 if(!node->clone) this->numberofmasters_local++; 241 241 } … … 244 244 /*2. Distribute lids (First: masters, then clones)*/ 245 245 int lid = 0; 246 for( int i=0;i<this->Size();i++){247 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));246 for(Object* & object : this->objects){ 247 Node* node = xDynamicCast<Node*>(object); 248 248 if(!node->clone) node->lid=lid++; 249 249 } 250 for( int i=0;i<this->Size();i++){251 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));250 for(Object* & object : this->objects){ 251 Node* node = xDynamicCast<Node*>(object); 252 252 if(node->clone) node->lid=lid++; 253 253 } … … 261 261 xDelete<int>(all_num_masters); 262 262 263 for( int i=0;i<this->Size();i++){264 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));263 for(Object* & object : this->objects){ 264 Node* node = xDynamicCast<Node*>(object); 265 265 node->pid = node->lid+offset; 266 266 } … … 301 301 302 302 /*Now go through all nodes, and get how many dofs they own, unless they are clone nodes: */ 303 for( int i=0;i<this->Size();i++){304 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));303 for(Object* & object : this->objects){ 304 Node* node = xDynamicCast<Node*>(object); 305 305 306 306 int numdofs=node->GetNumberOfDofs(NoneApproximationEnum,setenum); … … 332 332 333 333 /*Now go through all nodes, and get how many dofs they own, unless they are clone nodes: */ 334 for( int i=0;i<this->Size();i++){335 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));334 for(Object* & object : this->objects){ 335 Node* node = xDynamicCast<Node*>(object); 336 336 337 337 /*Ok, this object is a node, ask it to plug values into partition: */ … … 348 348 /*go through all nodes, and get how many dofs they own, unless they are clone nodes: */ 349 349 int numdofs=0; 350 for( int i=0;i<this->Size();i++){351 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));350 for(Object* & object : this->objects){ 351 Node* node = xDynamicCast<Node*>(object); 352 352 numdofs+=node->GetNumberOfDofs(NoneApproximationEnum,setenum); 353 353 } … … 376 376 377 377 /*Now go through all nodes, and get how many dofs they own, unless they are clone nodes: */ 378 for( int i=0;i<this->Size();i++){379 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));378 for(Object* & object : this->objects){ 379 Node* node = xDynamicCast<Node*>(object); 380 380 if(node->RequiresDofReindexing()){ 381 381 flag = 1; … … 408 408 409 409 /*First, go over all nodes, and masters can write their f dof and -1 for s-set*/ 410 for( int i=0;i<this->Size();i++){411 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));410 for(Object* & object : this->objects){ 411 Node* node = xDynamicCast<Node*>(object); 412 412 413 413 /*Skip if clone (will check later)*/ … … 436 436 437 437 /*Second, go over all nodes, and check that we still have what's expected...*/ 438 for( int i=0;i<this->Size();i++){439 Node* node =xDynamicCast<Node*>(this->GetObjectByOffset(i));438 for(Object* & object : this->objects){ 439 Node* node = xDynamicCast<Node*>(object); 440 440 441 441 /*Write degree of freedom if active*/
Note:
See TracChangeset
for help on using the changeset viewer.