Changeset 25554
- Timestamp:
- 09/11/20 07:26:02 (5 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r25539 r25554 575 575 xDelete<int>(approximations); 576 576 577 for( int i=0;i<nodes->Size();i++){578 Node* node=xDynamicCast<Node*>( nodes->GetObjectByOffset(i));577 for(Object* & object: nodes->objects){ 578 Node* node=xDynamicCast<Node*>(object); 579 579 int sid = node->Sid(); 580 580 if(sid>=iomodel->numberofvertices+iomodel->numberofelements){ … … 975 975 case 3: 976 976 parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum)); 977 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 977 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 978 978 break; 979 979 case 4: 980 980 parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum)); 981 981 parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum)); 982 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 982 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 983 983 break; 984 984 case 5: … … 996 996 case 9: 997 997 parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum)); 998 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 998 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 999 999 break; 1000 1000 case 10: … … 1008 1008 case 11: 1009 1009 parameters->AddObject(new IntParam(FrictionCouplingEnum,2)); 1010 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 1010 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 1011 1011 break; 1012 1012 case 12: 1013 1013 parameters->AddObject(new IntParam(FrictionCouplingEnum,2)); 1014 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 1014 parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum)); 1015 1015 break; 1016 1016 default: _error_("Friction law "<<frictionlaw<<" not implemented yet"); … … 1049 1049 #endif 1050 1050 1051 1051 1052 1052 if(is_schur_cg_solver) 1053 1053 solutionsequence_schurcg(femmodel); … … 1187 1187 return; 1188 1188 default: 1189 _error_("Approximation "<<EnumToStringx(approximation)<<" not supported");1189 _error_("Approximation "<<EnumToStringx(approximation)<<"("<<approximation<<") not supported"); 1190 1190 } 1191 1191 }/*}}}*/ … … 1721 1721 IssmDouble fraction1,fraction2; 1722 1722 IssmDouble phi=element->GetGroundedPortion(xyz_list); 1723 if(phi>0.00000001 && phi<0.99999999) partly_floating=true; 1723 if(phi>0.00000001 && phi<0.99999999) partly_floating=true; 1724 1724 1725 1725 int ig=-1;// needed for driving stress parameterization … … 1748 1748 /*Compute the discontinuous surface slope for this gauss point/subelement*/ 1749 1749 this->ComputeSurfaceSlope(&slope[0],gauss_subelem,gauss,point1,fraction1,fraction2,ig,dim,element); 1750 } 1750 } 1751 1751 #endif 1752 1752 … … 2130 2130 default: 2131 2131 _error_("index "<<point1<<" not supported yet"); 2132 }//}}} 2132 }//}}} 2133 2133 } 2134 2134 if(ig>3 && ig<8){ // GREEN element … … 2151 2151 default: 2152 2152 _error_("index "<<point1<<" not supported yet"); 2153 }//}}} 2153 }//}}} 2154 2154 } 2155 2155 if(ig>7){ // RED element … … 2172 2172 default: 2173 2173 _error_("index "<<point1<<" not supported yet"); 2174 }//}}} 2174 }//}}} 2175 2175 } 2176 2176 … … 2198 2198 }/*}}}*/ 2199 2199 void StressbalanceAnalysis::NodalFunctionsDerivativesRGB(IssmDouble* dbasis_subelem,Gauss* gauss_DG,Gauss* gauss_CG,int point1,IssmDouble fraction1,IssmDouble fraction2,int ig,int dim,Element* element){/*{{{*/ 2200 2200 2201 2201 /*Fetch number of nodes for this finite element*/ 2202 2202 int numnodes = element->GetNumberOfNodes(); … … 2337 2337 /*Get Jacobian*/ 2338 2338 tria->GetJacobianInvert(&Jinv[0][0],xyz_list_RGB,gauss_CG); // gauss is not used here 2339 2339 2340 2340 /*Build dbasis CG in the subelement*/ 2341 2341 for(int i=0;i<numnodes;i++){ … … 3435 3435 /*Get type of algorithm*/ 3436 3436 int fe_FS; 3437 bool isNitsche; 3437 bool isNitsche; 3438 3438 3439 3439 element->FindParam(&fe_FS,FlowequationFeFSEnum); … … 3760 3760 Input* vz_input = NULL; 3761 3761 if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);} 3762 3762 3763 3763 /* prepare viscosity gradient for GLS */ 3764 3764 IssmDouble NodalViscosity[6]; … … 3914 3914 IssmDouble SU[3*(3+1)*6]; 3915 3915 Gauss* vert = element->NewGauss(); 3916 3916 3917 3917 element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum); 3918 3918 /* Compute the nodal values of the viscosity */ … … 3922 3922 } 3923 3923 delete vert; 3924 3924 3925 3925 /* Start looping on the number of gaussian points: */ 3926 3926 Gauss* gauss=element->NewGauss(5); … … 3973 3973 pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i]; 3974 3974 pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i]; 3975 if(dim==3) pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i]; 3975 if(dim==3) pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i]; 3976 3976 3977 3977 pe->values[i*dim+dim-1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i]; … … 4668 4668 pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i]; 4669 4669 pe->values[i*dim+1] += +rho_ice*forcey *Jdet*gauss->weight*vbasis[i]; 4670 if(dim==3) pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i]; 4670 if(dim==3) pe->values[i*dim+2] += +rho_ice*forcez*Jdet*gauss->weight*vbasis[i]; 4671 4671 4672 4672 pe->values[i*dim+dim-1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i]; … … 4795 4795 } 4796 4796 } 4797 } 4797 } 4798 4798 /* -------- Nitsche terms -------- */ 4799 4799 /* n\cdot\nabla\phi*/ … … 4814 4814 } 4815 4815 } 4816 for(int i=0;i<pnumnodes;i++){ 4816 for(int i=0;i<pnumnodes;i++){ 4817 4817 nsigma[dim*vnumnodes+i] = -FSreconditioning*pbasis[i]; 4818 4818 } … … 4832 4832 } 4833 4833 } 4834 } 4834 } 4835 4835 4836 4836 /* pressure x velocity component A12 */ -
issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
r25439 r25554 95 95 96 96 ::CreateNodes(nodes,iomodel,StressbalanceSIAAnalysisEnum,P1Enum,SIAApproximationEnum); 97 for( int i=0;i<nodes->Size();i++){98 Node* node=xDynamicCast<Node*>( nodes->GetObjectByOffset(i));97 for(Object* & object: nodes->objects){ 98 Node* node=xDynamicCast<Node*>(object); 99 99 int sid = node->Sid(); 100 100 int approximation=IoCodeToEnumVertexEquation(reCast<int>(iomodel->Data("md.flowequation.vertex_equation")[sid])); … … 602 602 for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]); 603 603 604 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 604 /*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 605 605 *so the pressure is just the pressure at the bedrock: */ 606 606 rho_ice = element->FindParam(MaterialsRhoIceEnum); … … 612 612 for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i]; 613 613 break; 614 case Domain3DEnum: 614 case Domain3DEnum: 615 615 element->GetVerticesCoordinates(&xyz_list); 616 616 element->GetInputListOnNodes(&surface[0],SurfaceEnum); -
issm/trunk-jpl/src/c/classes/Constraints/Constraints.cpp
r23588 r25554 22 22 void Constraints::ActivatePenaltyMethod(int in_analysis){/*{{{*/ 23 23 24 for( int i=0;i<this->Size();i++){25 Constraint* constraint=(Constraint*) this->GetObjectByOffset(i);24 for(Object* & object: this->objects){ 25 Constraint* constraint=(Constraint*)object; 26 26 constraint->ActivatePenaltyMethod(); 27 27 } -
issm/trunk-jpl/src/c/classes/Contours.cpp
r18064 r25554 37 37 38 38 /*open domain outline file for writing: */ 39 if((fid=fopen(domainname,"w"))==NULL) _error_("could not open domain file " << domainname); 40 41 for( int counter=0;counter<contours->Size();counter++){42 contour=(Contour<double>*) contours->GetObjectByOffset(counter);39 if((fid=fopen(domainname,"w"))==NULL) _error_("could not open domain file " << domainname); 40 int counter = 0; 41 for(Object* & object : contours->objects){ 42 contour=(Contour<double>*)object; 43 43 44 44 /*Write header: */ … … 56 56 /*Write blank line: */ 57 57 if(counter<contours->Size()-1) fprintf(fid,"\n"); 58 counter++; 58 59 } 59 60 -
issm/trunk-jpl/src/c/classes/Elements/Elements.cpp
r25379 r25554 51 51 52 52 /*Now go through all elements, and get how many nodes they own, unless they are clone nodes: */ 53 for(int i=0;i<this->Size();i++){ 54 55 Element* element=xDynamicCast<Element*>(this->GetObjectByOffset(i)); 53 for(Object* & object : this->objects){ 54 Element* element = xDynamicCast<Element*>(object); 56 55 numnodes=element->GetNumberOfNodes(); 57 56 if(numnodes>max)max=numnodes; -
issm/trunk-jpl/src/c/classes/ExternalResults/Results.cpp
r20810 r25554 33 33 int Results::AddResult(ExternalResult* in_result){/*{{{*/ 34 34 35 /*First, go through dataset of inputs and check whether any input 36 * with the same name is already in. If so, erase the corresponding 35 /*First, go through dataset of inputs and check whether any input 36 * with the same name is already in. If so, erase the corresponding 37 37 * object before adding this new one: */ 38 38 … … 40 40 _assert_(in_result); 41 41 42 for( int i=0;i<this->Size();i++){43 ExternalResult* result=xDynamicCast<ExternalResult*>( this->GetObjectByOffset(i));42 for(Object* &object : this->objects){ 43 ExternalResult* result=xDynamicCast<ExternalResult*>(object); 44 44 45 45 if(result->GetStep()==in_result->GetStep()){ … … 64 64 int Results::DeleteResult(int result_enum,int result_step){/*{{{*/ 65 65 66 for(int i=0;i<this->Size();i++){ 67 ExternalResult* result=xDynamicCast<ExternalResult*>(this->GetObjectByOffset(i)); 68 66 for(Object* &object : this->objects){ 67 ExternalResult* result=xDynamicCast<ExternalResult*>(object); 69 68 if(result->GetStep()==result_step){ 70 69 if(strcmp(result->GetResultName(),EnumToStringx(result_enum))==0){ … … 80 79 ExternalResult* Results::FindResult(int result_enum){/*{{{*/ 81 80 82 for(int i=0;i<this->Size();i++){ 83 ExternalResult* result=xDynamicCast<ExternalResult*>(this->GetObjectByOffset(i)); 84 81 for(Object* &object : this->objects){ 82 ExternalResult* result=xDynamicCast<ExternalResult*>(object); 85 83 if(result->GetResultEnum()==result_enum){ 86 84 return result; … … 99 97 parameters->FindParam(&io_gather,SettingsIoGatherEnum); 100 98 101 for( int i=0;i<this->Size();i++){102 ExternalResult* result=xDynamicCast<ExternalResult*>( this->GetObjectByOffset(i));99 for(Object* &object : this->objects){ 100 ExternalResult* result=xDynamicCast<ExternalResult*>(object); 103 101 result->WriteData(fid,io_gather); 104 102 } -
issm/trunk-jpl/src/c/classes/FemModel.cpp
r25541 r25554 108 108 this->parameters->FindParam(&isSSA,FlowequationIsSSAEnum); 109 109 this->parameters->FindParam(&domaintype,DomainTypeEnum); 110 for(int i=0;i<this->nummodels;i++) if(this->analysis_type_list[i]==StressbalanceAnalysisEnum){analysis_counter=i;break;} 110 for(int i=0;i<this->nummodels;i++) { 111 if(this->analysis_type_list[i]==StressbalanceAnalysisEnum){ 112 analysis_counter=i; 113 break; 114 } 115 } 111 116 if(analysis_counter==-1) _error_("Could not find alias for analysis_type StressbalanceAnalysisEnum in list of FemModel analyses\n"); 112 117 for(Object* & object : this->elements->objects){ … … 1182 1187 IssmDouble* segmentlist = xNewZeroInit<IssmDouble>(4*numseg); 1183 1188 IssmDouble* allsegmentlist = xNewZeroInit<IssmDouble>(4*numseg); 1184 for(int i=0;i<segments->Size();i++){ 1185 Contour<IssmDouble>* segment=(Contour<IssmDouble>*)segments->GetObjectByOffset(i); 1189 int i=0; 1190 for(Object* & object : segments->objects){ 1191 Contour<IssmDouble>* segment=(Contour<IssmDouble>*)object; 1186 1192 _assert_(segment->nods == 2); 1187 1193 segmentlist[(numseg_offset+i)*4 + 0] = segment->x[0]; … … 1189 1195 segmentlist[(numseg_offset+i)*4 + 2] = segment->x[1]; 1190 1196 segmentlist[(numseg_offset+i)*4 + 3] = segment->y[1]; 1197 i++; 1191 1198 } 1192 1199 … … 2295 2302 2296 2303 /*Go through our dependent variables, and compute the response:*/ 2297 for(int i=0;i<dependent_objects->Size();i++){ 2298 DependentObject* dep=(DependentObject*)dependent_objects->GetObjectByOffset(i); 2304 int i = 0; 2305 for(Object* & object : dependent_objects->objects){ 2306 DependentObject* dep=(DependentObject*)object; 2299 2307 dep->Responsex(&output_value,this); 2300 2308 if (my_rank==0) { … … 2307 2315 #endif 2308 2316 } 2317 i++; 2309 2318 } 2310 2319 } … … 2437 2446 2438 2447 /*Fill-in vector*/ 2439 for( int j=0;j<this->loads->Size();j++){2440 if( this->loads->GetEnum(j)==ChannelEnum){2441 Channel* channel=(Channel*) this->loads->GetObjectByOffset(j);2448 for(Object* & object : this->loads->objects){ 2449 if(object->ObjectEnum()==ChannelEnum){ 2450 Channel* channel=(Channel*)object; 2442 2451 channel->WriteChannelCrossSection(values); 2443 2452 } … … 3200 3209 CreateNumberNodeToElementConnectivity(iomodel); 3201 3210 ::CreateVertices(new_elements,new_vertices,iomodel,TransientSolutionEnum,true); 3202 for( int i=0;i<new_vertices->Size();i++){3203 Vertex *vertex=(Vertex*) new_vertices->GetObjectByOffset(i);3211 for(Object* & object : new_vertices->objects){ 3212 Vertex *vertex=(Vertex*)object; 3204 3213 int sid = vertex->Sid(); 3205 3214 vertex->x=newx[sid]; … … 3798 3807 3799 3808 /*Go through elements, and for each element, get vertices*/ 3800 for( int i=0;i<femmodel_elements->Size();i++){3801 Element* element=xDynamicCast<Element*>( femmodel_elements->GetObjectByOffset(i));3809 for(Object* & object : femmodel_elements->objects){ 3810 Element* element=xDynamicCast<Element*>(object); 3802 3811 element->GetVerticesSidList(elem_vertices); 3803 3812 vid1->SetValue(element->sid,elem_vertices[0],INS_VAL); … … 3972 3981 3973 3982 /*Get spcvx and spcvy of old mesh*/ 3974 for(int i=0;i<this->constraints_list[analysis_index]->Size();i++){ 3975 3976 Constraint* constraint=(Constraint*)this->constraints_list[analysis_index]->GetObjectByOffset(i); 3977 3983 for(Object* & object : this->constraints_list[analysis_index]->objects){ 3984 Constraint* constraint=(Constraint*)object; 3978 3985 SpcStatic* spcstatic = xDynamicCast<SpcStatic*>(constraint); 3979 3986 int dof = spcstatic->GetDof(); … … 4890 4897 * all DONE in Geographic coordinates: theta \in [-90,90], lambda \in [-180 180] 4891 4898 */ 4892 for( int i=0;i<vertices->Size();i++){4893 int sid;4894 //Vertex* vertex=(Vertex*)vertices->GetObjectByOffset(i);4895 Vertex* vertex=xDynamicCast<Vertex*>(vertices->GetObjectByOffset(i)); 4896 sid=vertex->Sid();4897 4898 lati=latitude[sid]/180*PI; longi=longitude[sid]/180*PI;radi=radius[sid];4899 for(Object* & object : vertices->objects){ 4900 Vertex* vertex=xDynamicCast<Vertex*>(object); 4901 int sid=vertex->Sid(); 4902 4903 lati=latitude[sid]/180*PI; 4904 longi=longitude[sid]/180*PI; 4905 radi=radius[sid]; 4899 4906 4900 4907 /*only first order terms are considered now: */ … … 5315 5322 } 5316 5323 else{ 5317 int j=-1;5318 5324 for(Object* & object : this->elements->objects){ 5319 5325 /*Get the right transient input*/ 5320 5326 Element* element = xDynamicCast<Element*>(object); 5321 j+=1;5322 5327 /*Get basal element*/ 5323 5328 switch(domaintype){ … … 5343 5348 element->GetInputListOnVertices(&values[0],input_enum[i]); //this is the enum to stack 5344 5349 element->GetVerticesLidList(vertexlids); 5345 Penta* penta=xDynamicCast<Penta*>( elements->GetObjectByOffset(j));5350 Penta* penta=xDynamicCast<Penta*>(object); 5346 5351 for(;;){ 5347 5352 transientinput->AddPentaTimeInput(subtime,numvertices,vertexlids,values,P1Enum); -
issm/trunk-jpl/src/c/classes/Vertices.cpp
r25508 r25554 70 70 output->sorted_ids=NULL; 71 71 int objsize = this->numsorted; 72 if(this->sorted && objsize>0 && this->id_offsets){ 72 if(this->sorted && objsize>0 && this->id_offsets){ 73 73 output->id_offsets=xNew<int>(objsize); 74 74 xMemCpy<int>(output->id_offsets,this->id_offsets,objsize); … … 154 154 155 155 /*Go through vertices, and for each vertex, object, report it cpu: */ 156 for( int i=0;i<this->Size();i++){157 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));156 for(Object* & object : this->objects){ 157 Vertex* vertex = xDynamicCast<Vertex*>(object); 158 158 lat->SetValue(vertex->sid,vertex->GetLatitude() ,INS_VAL); 159 159 lon->SetValue(vertex->sid,vertex->GetLongitude(),INS_VAL); … … 193 193 this->numberofvertices_local=this->Size(); 194 194 this->numberofmasters_local=0; 195 for( int i=0;i<this->Size();i++){196 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));195 for(Object* & object : this->objects){ 196 Vertex* vertex = xDynamicCast<Vertex*>(object); 197 197 if(!vertex->clone) this->numberofmasters_local++; 198 198 } … … 204 204 205 205 int lid = 0; 206 for( int i=0;i<this->Size();i++){207 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));206 for(Object* & object : this->objects){ 207 Vertex* vertex = xDynamicCast<Vertex*>(object); 208 208 if(!vertex->clone){ 209 209 vertex->lid=lid; … … 212 212 } 213 213 } 214 for( int i=0;i<this->Size();i++){215 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));214 for(Object* & object : this->objects){ 215 Vertex* vertex = xDynamicCast<Vertex*>(object); 216 216 if(vertex->clone){ 217 217 vertex->lid=lid; … … 229 229 xDelete<int>(all_num_masters); 230 230 231 for( int i=0;i<this->Size();i++){232 Vertex* vertex=xDynamicCast<Vertex*>(this->GetObjectByOffset(i));231 for(Object* & object : this->objects){ 232 Vertex* vertex = xDynamicCast<Vertex*>(object); 233 233 vertex->pid = vertex->lid+offset; 234 234 } -
issm/trunk-jpl/src/c/classes/kriging/Observations.cpp
r25425 r25554 283 283 } 284 284 } 285 } 285 } 286 286 287 287 /*Assign output pointer*/ … … 329 329 y = xNew<IssmPDouble>(nobs); 330 330 obs = xNew<IssmPDouble>(nobs); 331 for(int i=0;i<this->Size();i++){ 332 observation=xDynamicCast<Observation*>(this->GetObjectByOffset(i)); 331 int i=0; 332 for(Object* & object: this->objects){ 333 observation=xDynamicCast<Observation*>(object); 333 334 observation->WriteXYObs(&x[i],&y[i],&obs[i]); 335 i++; 334 336 } 335 337 } … … 455 457 if(stop) break; 456 458 } 457 } 459 } 458 460 xDelete<IssmPDouble>(dists); 459 461 xDelete<int>(tempindices); … … 499 501 /*If we have less observations than mindata, return UNDEF*/ 500 502 if(n_obs<mindata){ 501 prediction = UNDEF; 503 prediction = UNDEF; 502 504 } 503 505 else{ … … 515 517 denominator += weight; 516 518 } 517 prediction = numerator/denominator; 519 prediction = numerator/denominator; 518 520 } 519 521 … … 543 545 /*If we have less observations than mindata, return UNDEF*/ 544 546 if(n_obs<mindata){ 545 *pprediction = -999.0; 546 *perror = -999.0; 547 *pprediction = -999.0; 548 *perror = -999.0; 547 549 return; 548 550 } … … 633 635 /*If we have less observations than mindata, return UNDEF*/ 634 636 if(n_obs<mindata || n_obs<2){ 635 prediction = UNDEF; 637 prediction = UNDEF; 636 638 } 637 639 else{ … … 714 716 for(j=0;j<n;j++) gamma[j] = 0.0; 715 717 716 for( i=0;i<this->Size();i++){717 observation1=xDynamicCast<Observation*>( this->GetObjectByOffset(i));718 719 for( j=i+1;j<this->Size();j++){720 observation2=xDynamicCast<Observation*>( this->GetObjectByOffset(j));718 for(Object* & object : this->objects){ 719 observation1=xDynamicCast<Observation*>(object); 720 721 for(Object* & object : this->objects){ 722 observation2=xDynamicCast<Observation*>(object); 721 723 722 724 distance=sqrt(pow(observation1->x - observation2->x,2) + pow(observation1->y - observation2->y,2)); -
issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp
r25388 r25554 1 1 /*!\file: controladm1qn3_core.cpp 2 * \brief: core of the control solution 3 */ 2 * \brief: core of the control solution 3 */ 4 4 #include <ctime> 5 5 #include <config.h> … … 281 281 codi_global.output_indices.clear(); 282 282 #endif 283 for( int i=0;i<dependent_objects->Size();i++){284 DependentObject* dep=(DependentObject*) dependent_objects->GetObjectByOffset(i);283 for(Object* & object:dependent_objects->objects){ 284 DependentObject* dep=(DependentObject*)object 285 285 if(solution_type==TransientSolutionEnum) output_value = dep->GetValue(); 286 286 if(solution_type!=TransientSolutionEnum) dep->Responsex(&output_value,femmodel); … … 476 476 long omode; 477 477 double f; 478 double dxmin,gttol; 478 double dxmin,gttol; 479 479 int maxsteps,maxiter; 480 480 int intn,num_controls,num_cost_functions,solution_type; … … 596 596 597 597 for(int i=0;i<intn;i++) { 598 aX[i] = reCast<IssmDouble>(X[i]); 598 aX[i] = reCast<IssmDouble>(X[i]); 599 599 aG[i] = reCast<IssmDouble>(G[i]); 600 600 } -
issm/trunk-jpl/src/c/cores/controlvalidation_core.cpp
r25341 r25554 1 1 /*!\file: controlvalidation_core.cpp 2 * \brief: core of the control solution 3 */ 2 * \brief: core of the control solution 3 */ 4 4 5 5 #include "./cores.h" … … 217 217 dependents=xNew<IssmPDouble>(num_dependents); 218 218 codi_global.output_indices.clear(); 219 for( int i=0;i<dependent_objects->Size();i++){220 DependentObject* dep=(DependentObject*) dependent_objects->GetObjectByOffset(i);219 for(Object* & object:dependent_objects->objects){ 220 DependentObject* dep=(DependentObject*)object 221 221 if(solution_type==TransientSolutionEnum){ 222 222 output_value = dep->GetValue(); … … 235 235 j0 = J; 236 236 _printf0_("Initial cost function J(x) = "<<setw(12)<<setprecision(7)<<j0<<"\n"); 237 _assert_(j0>0.); 237 _assert_(j0>0.); 238 238 simul_stoptrace2(); 239 239 /*initialize direction index in the weights vector: */ … … 292 292 #if defined(_HAVE_CODIPACK_) 293 293 j=0.; 294 for( int i=0;i<dependent_objects->Size();i++){295 DependentObject* dep=(DependentObject*) dependent_objects->GetObjectByOffset(i);294 for(Object* & object:dependent_objects->objects){ 295 DependentObject* dep=(DependentObject*)object 296 296 if(solution_type==TransientSolutionEnum){ 297 297 output_value = dep->GetValue(); … … 309 309 for(int i=0;i<n;i++) Den += alpha* G[i] * scaling_factors[0]; 310 310 Ialpha = fabs((j - j0)/Den - 1.); 311 _assert_(fabs(Den)>0.); 311 _assert_(fabs(Den)>0.); 312 312 313 313 _printf0_(" " << setw(11) << setprecision (5)<<alpha<<" " << setw(11) << setprecision (5)<<Ialpha<<"\n"); -
issm/trunk-jpl/src/c/cores/love_core.cpp
r23066 r25554 1 1 /*!\file: love_core.cpp 2 * \brief: core of the LOVE numbers solution 3 */ 2 * \brief: core of the LOVE numbers solution 3 */ 4 4 5 5 #include "./cores.h" … … 48 48 /*recover materials parameters: there is only one Matlitho, chase it down the hard way:*/ 49 49 Matlitho* matlitho=NULL; 50 for ( int i=femmodel->materials->Size()-1;i>=0;i--){51 Material* material=xDynamicCast<Material*>( femmodel->materials->GetObjectByOffset(i));50 for (Object* & object: femmodel->materials->objects){ 51 Material* material=xDynamicCast<Material*>(object); 52 52 if (material->ObjectEnum()==MatlithoEnum)matlitho=xDynamicCast<Matlitho*>(material); 53 53 } … … 69 69 FourierLoveCorex(LoveKr,LoveKi,LoveHr,LoveHi,LoveLr,LoveLi,LoveKernelsReal,LoveKernelsImag, //output 70 70 nfreq,frequencies,sh_nmax,sh_nmin,g0,r0,mu0,allow_layer_deletion,forcing_type,verbosemod, //parameter inputs 71 matlitho->numlayers, matlitho->radius, matlitho->viscosity, matlitho->lame_lambda, matlitho->lame_mu, 71 matlitho->numlayers, matlitho->radius, matlitho->viscosity, matlitho->lame_lambda, matlitho->lame_mu, 72 72 matlitho->burgers_viscosity, matlitho->burgers_mu, matlitho->density, matlitho->isburgers, matlitho->issolid //matlitho inputs 73 ); 73 ); 74 74 75 75 /*Add love matrices to results:*/ -
issm/trunk-jpl/src/c/cores/transient_core.cpp
r25550 r25554 128 128 if(iscontrol && isautodiff){ 129 129 /*Go through our dependent variables, and compute the response:*/ 130 for( int i=0;i<dependent_objects->Size();i++){131 DependentObject* dep=(DependentObject*) dependent_objects->GetObjectByOffset(i);130 for(Object* & object:dependent_objects->objects){ 131 DependentObject* dep=(DependentObject*)object; 132 132 IssmDouble output_value; 133 133 dep->Responsex(&output_value,femmodel); … … 321 321 322 322 /*Go through our dependent variables, and compute the response:*/ 323 for( int i=0;i<dependent_objects->Size();i++){324 DependentObject* dep=(DependentObject*) dependent_objects->GetObjectByOffset(i);323 for(Object* & object:dependent_objects->objects){ 324 DependentObject* dep=(DependentObject*)object; 325 325 dep->Responsex(&output_value,femmodel); 326 326 dep->AddValue(output_value); … … 357 357 358 358 SetControlInputsFromVectorx(femmodel,X); 359 359 360 IssmDouble J = 0.; 360 361 if(0){ 361 for( int i=0;i<dependent_objects->Size();i++){362 DependentObject* dep=(DependentObject*) dependent_objects->GetObjectByOffset(i);362 for(Object* & object:dependent_objects->objects){ 363 DependentObject* dep=(DependentObject*)object; 363 364 J += dep->GetValue(); 364 365 } -
issm/trunk-jpl/src/c/main/kriging.cpp
r25425 r25554 1 1 /*!\file: kriging.cpp 2 2 * \brief: kriging main parallel program 3 */ 3 */ 4 4 5 5 #include "./issm.h" … … 57 57 results->AddObject(new GenericExternalResult<double*>(results->Size()+1,"predictions",predictions,ninterp,1,1,0)); 58 58 results->AddObject(new GenericExternalResult<double*>(results->Size()+1,"error",error,ninterp,1,1,0)); 59 for( int i=0;i<results->Size();i++){60 ExternalResult* result=xDynamicCast<ExternalResult*>( results->GetObjectByOffset(i));59 for(Object* & object :results->objects){ 60 ExternalResult* result=xDynamicCast<ExternalResult*>(object); 61 61 result->WriteData(output_fid,1); 62 62 } … … 104 104 105 105 rootpatharg=argv[1]; 106 if(strcmp(strstr(rootpatharg,"/"),"/")!=0){ 106 if(strcmp(strstr(rootpatharg,"/"),"/")!=0){ 107 107 rootpath = xNew<char>(strlen(rootpatharg)+2); sprintf(rootpath,"%s/",rootpatharg); 108 } 108 } 109 109 else{ 110 110 rootpath = xNew<char>(strlen(rootpatharg)+1); sprintf(rootpath,"%s",rootpatharg); 111 } 111 } 112 112 113 113 modelname=argv[2]; -
issm/trunk-jpl/src/c/modules/AllocateSystemMatricesx/AllocateSystemMatricesx.cpp
r25539 r25554 111 111 int localnumnodes = femmodel->nodes->Size(); 112 112 int numberofdofspernode = femmodel->nodes->MaxNumDofs(GsetEnum); 113 int M = femmodel->nodes->NumberOfDofs(set1enum);113 //int M = femmodel->nodes->NumberOfDofs(set1enum); 114 114 int N = femmodel->nodes->NumberOfDofs(set2enum); 115 115 int m = femmodel->nodes->NumberOfDofsLocal(set1enum); … … 117 117 int numnodesperelement = femmodel->elements->MaxNumNodes(); 118 118 int numnodesperload = femmodel->loads->MaxNumNodes(); 119 120 119 int elementssize = femmodel->elements->Size(); 121 120 int loadssize = femmodel->loads->Size(); -
issm/trunk-jpl/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp
r25539 r25554 21 21 } 22 22 if(VerboseMProcessor()) _printf0_(" Configuring loads...\n"); 23 for( int i=0;i<loads->Size();i++){24 Load* load=(Load*) loads->GetObjectByOffset(i);23 for(Object* object : loads->objects){ 24 Load* load=(Load*)object; 25 25 load->Configure(elements,loads,nodes,vertices,materials,parameters); 26 26 } 27 27 if(VerboseMProcessor()) _printf0_(" Configuring materials...\n"); 28 for( int i=0;i<materials->Size();i++){29 Material* material=(Material*) materials->GetObjectByOffset(i);28 for(Object* & object : materials->objects){ 29 Material* material=(Material*)object; 30 30 material->Configure(elements); 31 31 } -
issm/trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp
r24630 r25554 39 39 /*Deal with pengrid*/ 40 40 if(femmodel->loads->numpenalties){ 41 for( int i=0;i<femmodel->loads->Size();i++){42 Load* load=(Load*) femmodel->loads->GetObjectByOffset(i);41 for(Object* & object : femmodel->loads->objects){ 42 Load* load=(Load*)object; 43 43 if(load->ObjectEnum()==PengridEnum){ 44 44 Pengrid* pengrid=(Pengrid*)load; … … 50 50 51 51 ISSM_MPI_Reduce(&num_unstable_constraints,&sum_num_unstable_constraints,1,ISSM_MPI_INT,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 52 ISSM_MPI_Bcast(&sum_num_unstable_constraints,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 52 ISSM_MPI_Bcast(&sum_num_unstable_constraints,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 53 53 num_unstable_constraints=sum_num_unstable_constraints; 54 54 -
issm/trunk-jpl/src/c/modules/ConstraintsStatex/RiftConstraintsState.cpp
r24630 r25554 1 1 /*!\file RiftConstraintsState.cpp 2 * \brief: manage penalties for rifts 2 * \brief: manage penalties for rifts 3 3 */ 4 4 #include "./ConstraintsStateLocal.h" … … 32 32 void RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){ 33 33 34 int i;35 36 34 /* generic object pointer: */ 37 35 Riftfront* riftfront=NULL; … … 40 38 int unstable; 41 39 int sum_num_unstable_constraints; 42 int num_unstable_constraints=0; 40 int num_unstable_constraints=0; 43 41 44 42 /*Enforce constraints: */ 45 for (i=0;i<loads->Size();i++){ 46 47 if (RiftfrontEnum==loads->GetEnum(i)){ 48 49 load=(Load*)loads->GetObjectByOffset(i); 43 for (Object* & object : loads->objects){ 44 if (RiftfrontEnum==object->ObjectEnum()){ 45 load=(Load*)object; 50 46 riftfront=(Riftfront*)load; 51 47 riftfront->Constrain(&unstable); … … 55 51 56 52 ISSM_MPI_Reduce (&num_unstable_constraints,&sum_num_unstable_constraints,1,ISSM_MPI_INT,ISSM_MPI_SUM,0,IssmComm::GetComm() ); 57 ISSM_MPI_Bcast(&sum_num_unstable_constraints,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 53 ISSM_MPI_Bcast(&sum_num_unstable_constraints,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 58 54 num_unstable_constraints=sum_num_unstable_constraints; 59 55 … … 75 71 76 72 /*Enforce constraints: */ 77 for (i=0;i<loads->Size();i++){ 78 79 if (RiftfrontEnum==loads->GetEnum(i)){ 80 81 load=(Load*)loads->GetObjectByOffset(i); 73 for (Object* & object : loads->objects){ 74 if (RiftfrontEnum==object->ObjectEnum()){ 75 load=(Load*)object; 82 76 riftfront=(Riftfront*)load; 83 77 if (riftfront->IsFrozen()){ … … 90 84 /*Is there just one found? that would mean we have frozen! : */ 91 85 ISSM_MPI_Reduce (&found,&mpi_found,1,ISSM_MPI_INT,ISSM_MPI_MAX,0,IssmComm::GetComm() ); 92 ISSM_MPI_Bcast(&mpi_found,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 86 ISSM_MPI_Bcast(&mpi_found,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 93 87 found=mpi_found; 94 88 … … 106 100 107 101 /*Enforce constraints: */ 108 for (i=0;i<loads->Size();i++){ 109 110 if (RiftfrontEnum==loads->GetEnum(i)){ 111 load=(Load*)loads->GetObjectByOffset(i); 102 for (Object* & object : loads->objects){ 103 if (RiftfrontEnum==object->ObjectEnum()){ 104 load=(Load*)object; 112 105 riftfront=(Riftfront*)load; 113 106 riftfront->FreezeConstraints(); -
issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshxt.cpp
r16164 r25554 1 1 /*!\file: ContourToMeshxt.cpp 2 2 * \brief "thread" core code for interpolating values from a structured grid. 3 */ 3 */ 4 4 5 5 #ifdef HAVE_CONFIG_H … … 36 36 37 37 /*Loop through all contours: */ 38 for ( i=0;i<contours->Size();i++){39 Contour<double>* contour=(Contour<double>*) contours->GetObjectByOffset(i);38 for (Object* & object : contours->objects){ 39 Contour<double>* contour=(Contour<double>*)object; 40 40 IsInPoly(in_nod,contour->x,contour->y,contour->nods,x,y,i0,i1,edgevalue); 41 41 } -
issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp
r16164 r25554 40 40 /*Loop through all contours: */ 41 41 if(contours){ 42 for( int i=0;i<contours->Size();i++){43 Contour<IssmPDouble>* contour=(Contour<IssmPDouble>*) contours->GetObjectByOffset(i);42 for(Object* & object:contours->objects){ 43 Contour<IssmPDouble>* contour=(Contour<IssmPDouble>*)object; 44 44 IsInPoly(flags,contour->x,contour->y,contour->nods,x,y,0,nods,edgevalue); 45 45 } -
issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp
r25539 r25554 33 33 delete Je; 34 34 } 35 for ( int i=0;i<femmodel->loads->Size();i++){36 load=(Load*) femmodel->loads->GetObjectByOffset(i);35 for (Object* & object : femmodel->loads->objects){ 36 load=(Load*)object; 37 37 load->CreateJacobianMatrix(Jff); 38 38 load->PenaltyCreateJacobianMatrix(Jff,kmax); -
issm/trunk-jpl/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp
r23587 r25554 29 29 ys=new Vector<IssmDouble>(slocalsize,ssize); 30 30 31 /*go through all nodes, and for the ones corresponding to this configuration_type, fill the 31 /*go through all nodes, and for the ones corresponding to this configuration_type, fill the 32 32 * constraints vector with the constraint values: */ 33 for( int i=0;i<nodes->Size();i++){34 Node* node= (Node*)nodes->GetObjectByOffset(i);33 for(Object* & object: nodes->objects){ 34 Node* node=xDynamicCast<Node*>(object); 35 35 node->CreateNodalConstraints(ys); 36 36 } -
issm/trunk-jpl/src/c/modules/ExpToLevelSetx/ExpToLevelSetxt.cpp
r23066 r25554 1 1 /*!\file: ExpToLevelSetxt.cpp 2 2 * \brief "thread" core code for figuring out level set value from a contour and a cloud of points. 3 */ 3 */ 4 4 5 5 #ifdef HAVE_CONFIG_H … … 38 38 39 39 /*Loop through all contours: */ 40 for( i=0;i<contours->Size();i++){41 Contour<double>* contour=(Contour<double>*) contours->GetObjectByOffset(i);40 for(Object* & object : contours->objects){ 41 Contour<double>* contour=(Contour<double>*)object; 42 42 ContourToLevelSet(distance,contour->x,contour->y,contour->nods,x,y,i0,i1); 43 43 } … … 73 73 * We use the following notations: 74 74 * segment: v=(x1,y1), w=(x2,y2) 75 * point: p=(x0,y0) 75 * point: p=(x0,y0) 76 76 */ 77 77 78 78 /*Get segment length square (avoid sqrt) |w-v|^2*/ 79 double l2 = pow(x2-x1,2)+pow(y2-y1,2); 79 double l2 = pow(x2-x1,2)+pow(y2-y1,2); 80 80 81 81 /*segment is single point: v == w*/ -
issm/trunk-jpl/src/c/modules/KillIcebergsx/KillIcebergsx.cpp
r25539 r25554 20 20 21 21 /*Step 1, go through all elements and put 1 in local_mask if the element is grounded*/ 22 for(int i=0;i<femmodel->elements->Size();i++){ 23 Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); 22 int i=0; 23 for(Object* & object : femmodel->elements->objects){ 24 Element* element=xDynamicCast<Element*>(object); 24 25 if(!element->IsIceInElement()){ 25 26 /*Nothing to do, just flag element to speed up the computation*/ … … 32 33 } 33 34 } 35 i++; 34 36 } 35 37 … … 53 55 keepgoing = false; 54 56 didsomething = 0; 55 for(int i=0;i<femmodel->elements->Size();i++){ 56 Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i)); 57 int i=0; 58 for(Object* & object : femmodel->elements->objects){ 59 Element* element=xDynamicCast<Element*>(object); 57 60 58 61 if(!element_flag[i]){ … … 78 81 } 79 82 } 83 i++; 80 84 } 81 85 iter++; -
issm/trunk-jpl/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp
r23630 r25554 17 17 int ssize=nodes->NumberOfDofs(SsetEnum); 18 18 19 /*serialize uf and ys: those two vectors will be indexed by the nodes, who are the only ones 19 /*serialize uf and ys: those two vectors will be indexed by the nodes, who are the only ones 20 20 *that know which values should be plugged into ug and where: */ 21 21 if(ssize) if(flag_ys0) ys->Set(0.0); … … 33 33 34 34 /*Let nodes figure it out*/ 35 for( int i=0;i<nodes->Size();i++){36 Node* node= (Node*)nodes->GetObjectByOffset(i);35 for(Object* & object: nodes->objects){ 36 Node* node=xDynamicCast<Node*>(object); 37 37 node->VecMerge(ug,local_uf,indices_uf,local_ys,indices_ys); 38 38 } -
issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp
r23885 r25554 14 14 15 15 /*Now, go through the output definitions, and retrieve the object which corresponds to our requested response, output_string: */ 16 for( int i=0;i<output_definitions->Size();i++){17 Definition* definition=dynamic_cast<Definition*>(o utput_definitions->GetObjectByOffset(i));16 for(Object* & object : output_definitions->objects){ 17 Definition* definition=dynamic_cast<Definition*>(object); 18 18 19 19 char* name = definition->Name(); … … 42 42 43 43 /*Now, go through the output definitions, and retrieve the object which corresponds to our requested response, output_enum: */ 44 for(int i=0;i<output_definitions->Size();i++){ 45 46 //Definition* definition=xDynamicCast<Definition*>(output_definitions->GetObjectByOffset(i)); 47 Definition* definition=dynamic_cast<Definition*>(output_definitions->GetObjectByOffset(i)); 44 for(Object* & object : output_definitions->objects){ 45 Definition* definition=dynamic_cast<Definition*>(object); 48 46 49 47 int en = definition->DefinitionEnum(); … … 59 57 60 58 /*If we are here, did not find the definition for this response, not good!: */ 61 _error_("Could not find the response for output definition " << EnumToStringx(output_enum) 59 _error_("Could not find the response for output definition " << EnumToStringx(output_enum) 62 60 <<" ("<<output_enum<<")" 63 61 << " because could not find the definition itself!"); -
issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp
r23630 r25554 1 1 /*!\file Reducevectorgtofx 2 * \brief reduce petsc vector from g set to s set (free dofs), using the nodeset partitioning 2 * \brief reduce petsc vector from g set to s set (free dofs), using the nodeset partitioning 3 3 * vectors. 4 4 */ … … 29 29 30 30 /*Let nodes figure it out*/ 31 for( int i=0;i<nodes->Size();i++){32 Node* node=(Node*) nodes->GetObjectByOffset(i);31 for(Object* & object : nodes->objects){ 32 Node* node=(Node*)object; 33 33 node->VecReduce(uf,local_ug,indices_ug); 34 34 } -
issm/trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp
r24630 r25554 29 29 30 30 /*Reset pengrid to inactive mode*/ 31 for( int i=0;i<femmodel->loads->Size();i++){32 Load* load=(Load*) femmodel->loads->GetObjectByOffset(i);31 for(Object* & object : femmodel->loads->objects){ 32 Load* load=(Load*)object; 33 33 if(load->ObjectEnum()==PengridEnum){ 34 34 Pengrid* pengrid=(Pengrid*)load; … … 48 48 49 49 /*Reset pengrid to inactive mode*/ 50 for( int i=0;i<femmodel->loads->Size();i++){51 Load* load=(Load*) femmodel->loads->GetObjectByOffset(i);50 for(Object* & object: femmodel->loads->objects){ 51 Load* load=(Load*)object; 52 52 if(load->ObjectEnum()==PengridEnum){ 53 53 Pengrid* pengrid=(Pengrid*)load; -
issm/trunk-jpl/src/c/modules/SpcNodesx/SpcNodesx.cpp
r23587 r25554 10 10 void SpcNodesx(Nodes* nodes,Constraints* constraints,Parameters* parameters){ 11 11 12 for( int i=0;i<constraints->Size();i++){13 Constraint* constraint= (Constraint*)constraints->GetObjectByOffset(i);12 for(Object* & object: constraints->objects){ 13 Constraint* constraint=xDynamicCast<Constraint*>(object); 14 14 constraint->ConstrainNode(nodes,parameters); 15 15 } -
issm/trunk-jpl/src/c/modules/Trianglex/Trianglex.cpp
r22498 r25554 42 42 /*Create initial triangulation to call triangulate(). First number of points:*/ 43 43 in.numberofpoints=0; 44 for ( i=0;i<domain->Size();i++){45 contour=(Contour<IssmPDouble>*) domain->GetObjectByOffset(i);44 for (Object* & object : domain->objects){ 45 contour=(Contour<IssmPDouble>*)object; 46 46 in.numberofpoints+=contour->nods-1; 47 47 } 48 for ( i=0;i<rifts->Size();i++){49 contour=(Contour<IssmPDouble>*) rifts->GetObjectByOffset(i);48 for (Object* & object : rifts->objects){ 49 contour=(Contour<IssmPDouble>*)object; 50 50 in.numberofpoints+=contour->nods; 51 51 } … … 58 58 59 59 counter=0; 60 for ( i=0;i<domain->Size();i++){61 contour=(Contour<IssmPDouble>*) domain->GetObjectByOffset(i);60 for (Object* & object : domain->objects){ 61 contour=(Contour<IssmPDouble>*)object; 62 62 for (j=0;j<contour->nods-1;j++){ 63 63 in.pointlist[2*counter+0]=contour->x[j]; … … 66 66 } 67 67 } 68 for ( i=0;i<rifts->Size();i++){69 contour=(Contour<IssmPDouble>*) rifts->GetObjectByOffset(i);68 for (Object* & object : rifts->objects){ 69 contour=(Contour<IssmPDouble>*)object; 70 70 for (j=0;j<contour->nods;j++){ 71 71 in.pointlist[2*counter+0]=contour->x[j]; … … 85 85 /*Build segments. First figure out number of segments: holes and closed outlines have as many segments as vertices: */ 86 86 in.numberofsegments=0; 87 for ( i=0;i<domain->Size();i++){88 contour=(Contour<IssmPDouble>*) domain->GetObjectByOffset(i);87 for (Object* & object : domain->objects){ 88 contour=(Contour<IssmPDouble>*)object; 89 89 in.numberofsegments+=contour->nods-1; 90 90 } 91 for (i=0;i<rifts->Size();i++){92 contour=(Contour<IssmPDouble>*) rifts->GetObjectByOffset(i);91 for (Object* & object : rifts->objects){ 92 contour=(Contour<IssmPDouble>*)object; 93 93 /*for rifts, we have one less segment as we have vertices*/ 94 94 in.numberofsegments+=contour->nods-1; … … 99 99 counter=0; 100 100 backcounter=0; 101 for ( i=0;i<domain->Size();i++){102 contour=(Contour<IssmPDouble>*) domain->GetObjectByOffset(i);101 for (Object* & object : domain->objects){ 102 contour=(Contour<IssmPDouble>*)object; 103 103 for (j=0;j<contour->nods-2;j++){ 104 104 in.segmentlist[2*counter+0]=counter; … … 115 115 } 116 116 counter2=counter; 117 for ( i=0;i<rifts->Size();i++){118 contour=(Contour<IssmPDouble>*) rifts->GetObjectByOffset(i);117 for (Object* & object : rifts->objects){ 118 contour=(Contour<IssmPDouble>*)object; 119 119 for (j=0;j<(contour->nods-1);j++){ 120 120 in.segmentlist[2*counter2+0]=counter; -
issm/trunk-jpl/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp
r23592 r25554 19 19 yg_serial=yg->ToMPISerial(); 20 20 21 for( int i=0;i<constraints->Size();i++){22 Constraint* constraint=(Constraint*) constraints->GetObjectByOffset(i);23 if(constraint->ObjectEnum()==SpcDynamicEnum){ 21 for(Object* & object : constraints->objects){ 22 Constraint* constraint=(Constraint*)object; 23 if(constraint->ObjectEnum()==SpcDynamicEnum){ 24 24 ((SpcDynamic*)constraint)->SetDynamicConstraint(nodes,yg_serial); 25 25 } -
issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp
r19984 r25554 1 1 /*!\file VertexCoordinatesx 2 * \brief: compute a vector x,y and z of vertex coordinates by 3 * marching through all our vertices. 2 * \brief: compute a vector x,y and z of vertex coordinates by 3 * marching through all our vertices. 4 4 */ 5 5 … … 32 32 33 33 /*march through our vertices: */ 34 for( i=0;i<vertices->Size();i++){35 Vertex* vertex=(Vertex*) vertices->GetObjectByOffset(i);34 for(Object* & object : vertices->objects){ 35 Vertex* vertex=(Vertex*)object; 36 36 vertex->VertexCoordinates(vx,vy,vz,spherical); 37 37 } -
issm/trunk-jpl/src/c/solutionsequences/solutionsequence_fct.cpp
r24731 r25554 1 1 /*!\file: solutionsequence_fct.cpp 2 2 * \brief: numerical core of flux corrected transport solution 3 */ 3 */ 4 4 5 5 #include "../toolkits/toolkits.h" … … 109 109 110 110 dmax = dmax * 1.e+3; 111 for( int i=0;i<femmodel->constraints->Size();i++){112 Constraint* constraint= (Constraint*)femmodel->constraints->GetObjectByOffset(i);111 for(Object* & object: femmodel->constraints->objects){ 112 Constraint* constraint=xDynamicCast<Constraint*>(object); 113 113 constraint->PenaltyDofAndValue(&dof,&d,femmodel->nodes,femmodel->parameters); 114 114 if(dof!=-1){ … … 125 125 126 126 dmax = dmax * 1.e+3; 127 for( int i=0;i<femmodel->constraints->Size();i++){128 Constraint* constraint= (Constraint*)femmodel->constraints->GetObjectByOffset(i);127 for(Object* & object: femmodel->constraints->objects){ 128 Constraint* constraint=xDynamicCast<Constraint*>(object); 129 129 constraint->PenaltyDofAndValue(&dof,&d,femmodel->nodes,femmodel->parameters); 130 130 if(dof!=-1){ … … 180 180 if(USEPENALTYMETHOD){ 181 181 /*Option 1: Penalty method*/ 182 for( int i=0;i<femmodel->constraints->Size();i++){183 Constraint* constraint= (Constraint*)femmodel->constraints->GetObjectByOffset(i);182 for(Object* & object: femmodel->constraints->objects){ 183 Constraint* constraint=xDynamicCast<Constraint*>(object); 184 184 constraint->PenaltyDofAndValue(&dof,&d,femmodel->nodes,femmodel->parameters); 185 185 d = d*dmax; … … 195 195 IssmDouble* rows_spc = xNew<IssmDouble>(numrows); 196 196 numrows = 0; 197 for( int i=0;i<femmodel->constraints->Size();i++){198 Constraint* constraint= (Constraint*)femmodel->constraints->GetObjectByOffset(i);197 for(Object* & object: femmodel->constraints->objects){ 198 Constraint* constraint=xDynamicCast<Constraint*>(object); 199 199 constraint->PenaltyDofAndValue(&dof,&d,femmodel->nodes,femmodel->parameters); 200 200 if(dof!=-1){ … … 459 459 /*Go solve lower order solution*/ 460 460 femmodel->profiler->Start(SOLVER); 461 SolverxPetsc(&u,LHS,RHS,NULL,NULL, femmodel->parameters); 461 SolverxPetsc(&u,LHS,RHS,NULL,NULL, femmodel->parameters); 462 462 femmodel->profiler->Stop(SOLVER); 463 463 MatFree(&LHS); … … 506 506 507 507 /*Update Element inputs*/ 508 InputUpdateFromSolutionx(femmodel,uf); 508 InputUpdateFromSolutionx(femmodel,uf); 509 509 delete uf; 510 510
Note:
See TracChangeset
for help on using the changeset viewer.