Changeset 25554


Ignore:
Timestamp:
09/11/20 07:26:02 (5 years ago)
Author:
bdef
Message:

CHG: Some more iterator loop changes

Location:
issm/trunk-jpl/src/c
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp

    r25539 r25554  
    575575                        xDelete<int>(approximations);
    576576
    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);
    579579                                int   sid = node->Sid();
    580580                                if(sid>=iomodel->numberofvertices+iomodel->numberofelements){
     
    975975                case 3:
    976976                        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));
    978978                        break;
    979979                case 4:
    980980                        parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
    981981                        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));
    983983                        break;
    984984                case 5:
     
    996996                case 9:
    997997                        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));
    999999                        break;
    10001000                case 10:
     
    10081008                case 11:
    10091009                        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));
    10111011                        break;
    10121012                case 12:
    10131013                        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));
    10151015                        break;
    10161016                default: _error_("Friction law "<<frictionlaw<<" not implemented yet");
     
    10491049                #endif
    10501050
    1051                
     1051
    10521052                if(is_schur_cg_solver)
    10531053                 solutionsequence_schurcg(femmodel);
     
    11871187                        return;
    11881188                default:
    1189                         _error_("Approximation "<<EnumToStringx(approximation)<<" not supported");
     1189                        _error_("Approximation "<<EnumToStringx(approximation)<<"("<<approximation<<") not supported");
    11901190        }
    11911191}/*}}}*/
     
    17211721        IssmDouble fraction1,fraction2;
    17221722        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;
    17241724
    17251725        int ig=-1;// needed for driving stress parameterization
     
    17481748                        /*Compute the discontinuous surface slope for this gauss point/subelement*/
    17491749                        this->ComputeSurfaceSlope(&slope[0],gauss_subelem,gauss,point1,fraction1,fraction2,ig,dim,element);
    1750                 }               
     1750                }
    17511751                #endif
    17521752
     
    21302130                        default:
    21312131                                _error_("index "<<point1<<" not supported yet");
    2132                 }//}}} 
     2132                }//}}}
    21332133        }
    21342134        if(ig>3 && ig<8){ // GREEN element
     
    21512151                        default:
    21522152                                _error_("index "<<point1<<" not supported yet");
    2153                 }//}}} 
     2153                }//}}}
    21542154        }
    21552155        if(ig>7){ // RED element
     
    21722172                        default:
    21732173                                _error_("index "<<point1<<" not supported yet");
    2174                 }//}}} 
     2174                }//}}}
    21752175        }
    21762176
     
    21982198}/*}}}*/
    21992199void 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
    22012201        /*Fetch number of nodes for this finite element*/
    22022202   int numnodes = element->GetNumberOfNodes();
     
    23372337   /*Get Jacobian*/
    23382338        tria->GetJacobianInvert(&Jinv[0][0],xyz_list_RGB,gauss_CG); // gauss is not used here
    2339        
     2339
    23402340        /*Build dbasis CG in the subelement*/
    23412341        for(int i=0;i<numnodes;i++){
     
    34353435        /*Get type of algorithm*/
    34363436        int fe_FS;
    3437         bool isNitsche; 
     3437        bool isNitsche;
    34383438
    34393439        element->FindParam(&fe_FS,FlowequationFeFSEnum);
     
    37603760        Input* vz_input = NULL;
    37613761        if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
    3762        
     3762
    37633763        /* prepare viscosity gradient for GLS */
    37643764        IssmDouble NodalViscosity[6];
     
    39143914        IssmDouble SU[3*(3+1)*6];
    39153915    Gauss* vert = element->NewGauss();
    3916        
     3916
    39173917        element->FindParam(&FSreconditioning,StressbalanceFSreconditioningEnum);
    39183918        /* Compute the nodal values of the viscosity */
     
    39223922        }
    39233923        delete vert;
    3924        
     3924
    39253925        /* Start  looping on the number of gaussian points: */
    39263926        Gauss* gauss=element->NewGauss(5);
     
    39733973                        pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
    39743974                        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];
    39763976
    39773977                        pe->values[i*dim+dim-1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
     
    46684668                        pe->values[i*dim+0] += +rho_ice*forcex *Jdet*gauss->weight*vbasis[i];
    46694669                        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];
    46714671
    46724672                        pe->values[i*dim+dim-1] += -rho_ice*gravity*Jdet*gauss->weight*vbasis[i];
     
    47954795                                }
    47964796                        }
    4797                 }       
     4797                }
    47984798                /* -------- Nitsche terms -------- */
    47994799                /* n\cdot\nabla\phi*/
     
    48144814                        }
    48154815                }
    4816                 for(int i=0;i<pnumnodes;i++){   
     4816                for(int i=0;i<pnumnodes;i++){
    48174817                        nsigma[dim*vnumnodes+i] = -FSreconditioning*pbasis[i];
    48184818                }
     
    48324832                                }
    48334833                        }
    4834                 }       
     4834                }
    48354835
    48364836                /* pressure x velocity  component A12 */
  • issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp

    r25439 r25554  
    9595
    9696        ::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);
    9999                int   sid = node->Sid();
    100100                int approximation=IoCodeToEnumVertexEquation(reCast<int>(iomodel->Data("md.flowequation.vertex_equation")[sid]));
     
    602602        for(i=0;i<numnodes;i++) vel[i]=sqrt(vx[i]*vx[i] + vy[i]*vy[i] + vz[i]*vz[i]);
    603603
    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,
    605605         *so the pressure is just the pressure at the bedrock: */
    606606        rho_ice  = element->FindParam(MaterialsRhoIceEnum);
     
    612612                        for(i=0;i<numnodes;i++) pressure[i]=rho_ice*g*thickness[i];
    613613                        break;
    614                 case Domain3DEnum:   
     614                case Domain3DEnum:
    615615                        element->GetVerticesCoordinates(&xyz_list);
    616616                        element->GetInputListOnNodes(&surface[0],SurfaceEnum);
  • issm/trunk-jpl/src/c/classes/Constraints/Constraints.cpp

    r23588 r25554  
    2222void Constraints::ActivatePenaltyMethod(int in_analysis){/*{{{*/
    2323
    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;
    2626                constraint->ActivatePenaltyMethod();
    2727        }
  • issm/trunk-jpl/src/c/classes/Contours.cpp

    r18064 r25554  
    3737
    3838        /*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;
    4343
    4444                /*Write header: */
     
    5656                /*Write blank line: */
    5757                if(counter<contours->Size()-1) fprintf(fid,"\n");
     58                counter++;
    5859        }
    5960
  • issm/trunk-jpl/src/c/classes/Elements/Elements.cpp

    r25379 r25554  
    5151
    5252        /*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);
    5655                numnodes=element->GetNumberOfNodes();
    5756                if(numnodes>max)max=numnodes;
  • issm/trunk-jpl/src/c/classes/ExternalResults/Results.cpp

    r20810 r25554  
    3333int Results::AddResult(ExternalResult* in_result){/*{{{*/
    3434
    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
    3737         * object before adding this new one: */
    3838
     
    4040        _assert_(in_result);
    4141
    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);
    4444
    4545                if(result->GetStep()==in_result->GetStep()){
     
    6464int Results::DeleteResult(int result_enum,int result_step){/*{{{*/
    6565
    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);
    6968                if(result->GetStep()==result_step){
    7069                        if(strcmp(result->GetResultName(),EnumToStringx(result_enum))==0){
     
    8079ExternalResult* Results::FindResult(int result_enum){/*{{{*/
    8180
    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);
    8583                if(result->GetResultEnum()==result_enum){
    8684                        return result;
     
    9997        parameters->FindParam(&io_gather,SettingsIoGatherEnum);
    10098
    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);
    103101                result->WriteData(fid,io_gather);
    104102        }
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r25541 r25554  
    108108                this->parameters->FindParam(&isSSA,FlowequationIsSSAEnum);
    109109                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                }
    111116                if(analysis_counter==-1) _error_("Could not find alias for analysis_type StressbalanceAnalysisEnum in list of FemModel analyses\n");
    112117                for(Object* & object : this->elements->objects){
     
    11821187        IssmDouble* segmentlist    = xNewZeroInit<IssmDouble>(4*numseg);
    11831188        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;
    11861192                _assert_(segment->nods == 2);
    11871193                segmentlist[(numseg_offset+i)*4 + 0] = segment->x[0];
     
    11891195                segmentlist[(numseg_offset+i)*4 + 2] = segment->x[1];
    11901196                segmentlist[(numseg_offset+i)*4 + 3] = segment->y[1];
     1197                i++;
    11911198        }
    11921199
     
    22952302
    22962303                        /*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;
    22992307                                dep->Responsex(&output_value,this);
    23002308                                if (my_rank==0) {
     
    23072315                                        #endif
    23082316                                }
     2317                                i++;
    23092318                        }
    23102319                }
     
    24372446
    24382447                                                        /*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;
    24422451                                                                        channel->WriteChannelCrossSection(values);
    24432452                                                                }
     
    32003209        CreateNumberNodeToElementConnectivity(iomodel);
    32013210        ::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;
    32043213                int     sid = vertex->Sid();
    32053214                vertex->x=newx[sid];
     
    37983807
    37993808        /*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);
    38023811        element->GetVerticesSidList(elem_vertices);
    38033812        vid1->SetValue(element->sid,elem_vertices[0],INS_VAL);
     
    39723981
    39733982        /*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;
    39783985                SpcStatic* spcstatic = xDynamicCast<SpcStatic*>(constraint);
    39793986                int dof                                 = spcstatic->GetDof();
     
    48904897         * all DONE in Geographic coordinates: theta \in [-90,90], lambda \in [-180 180]
    48914898         */
    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];
    48994906
    49004907                /*only first order terms are considered now: */
     
    53155322                }
    53165323                else{
    5317                         int j=-1;
    53185324                        for(Object* & object : this->elements->objects){
    53195325                                /*Get the right transient input*/
    53205326                                Element* element = xDynamicCast<Element*>(object);
    5321                                 j+=1;
    53225327                                /*Get basal element*/
    53235328                                switch(domaintype){
     
    53435348                                                element->GetInputListOnVertices(&values[0],input_enum[i]); //this is the enum to stack
    53445349                                                element->GetVerticesLidList(vertexlids);
    5345                                                 Penta* penta=xDynamicCast<Penta*>(elements->GetObjectByOffset(j));
     5350                                                Penta* penta=xDynamicCast<Penta*>(object);
    53465351                                                for(;;){
    53475352                                                        transientinput->AddPentaTimeInput(subtime,numvertices,vertexlids,values,P1Enum);
  • issm/trunk-jpl/src/c/classes/Vertices.cpp

    r25508 r25554  
    7070        output->sorted_ids=NULL;
    7171        int objsize = this->numsorted;
    72         if(this->sorted && objsize>0 && this->id_offsets){     
     72        if(this->sorted && objsize>0 && this->id_offsets){
    7373                output->id_offsets=xNew<int>(objsize);
    7474                xMemCpy<int>(output->id_offsets,this->id_offsets,objsize);
     
    154154
    155155        /*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);
    158158                lat->SetValue(vertex->sid,vertex->GetLatitude() ,INS_VAL);
    159159                lon->SetValue(vertex->sid,vertex->GetLongitude(),INS_VAL);
     
    193193        this->numberofvertices_local=this->Size();
    194194        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);
    197197                if(!vertex->clone) this->numberofmasters_local++;
    198198        }
     
    204204
    205205        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);
    208208                if(!vertex->clone){
    209209                        vertex->lid=lid;
     
    212212                }
    213213        }
    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);
    216216                if(vertex->clone){
    217217                        vertex->lid=lid;
     
    229229        xDelete<int>(all_num_masters);
    230230
    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);
    233233                vertex->pid = vertex->lid+offset;
    234234        }
  • issm/trunk-jpl/src/c/classes/kriging/Observations.cpp

    r25425 r25554  
    283283                        }
    284284                }
    285         } 
     285        }
    286286
    287287        /*Assign output pointer*/
     
    329329                y   = xNew<IssmPDouble>(nobs);
    330330                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);
    333334                        observation->WriteXYObs(&x[i],&y[i],&obs[i]);
     335                        i++;
    334336                }
    335337        }
     
    455457                        if(stop) break;
    456458                }
    457         } 
     459        }
    458460        xDelete<IssmPDouble>(dists);
    459461        xDelete<int>(tempindices);
     
    499501        /*If we have less observations than mindata, return UNDEF*/
    500502        if(n_obs<mindata){
    501                 prediction = UNDEF; 
     503                prediction = UNDEF;
    502504        }
    503505        else{
     
    515517                        denominator += weight;
    516518                }
    517                 prediction = numerator/denominator; 
     519                prediction = numerator/denominator;
    518520        }
    519521
     
    543545        /*If we have less observations than mindata, return UNDEF*/
    544546        if(n_obs<mindata){
    545                 *pprediction = -999.0; 
    546                 *perror      = -999.0; 
     547                *pprediction = -999.0;
     548                *perror      = -999.0;
    547549                return;
    548550        }
     
    633635        /*If we have less observations than mindata, return UNDEF*/
    634636        if(n_obs<mindata || n_obs<2){
    635                 prediction = UNDEF; 
     637                prediction = UNDEF;
    636638        }
    637639        else{
     
    714716        for(j=0;j<n;j++) gamma[j]   = 0.0;
    715717
    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);
    721723
    722724                        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  
    11/*!\file: controladm1qn3_core.cpp
    2  * \brief: core of the control solution 
    3  */ 
     2 * \brief: core of the control solution
     3 */
    44#include <ctime>
    55#include <config.h>
     
    281281        codi_global.output_indices.clear();
    282282        #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
    285285                if(solution_type==TransientSolutionEnum) output_value = dep->GetValue();
    286286                if(solution_type!=TransientSolutionEnum) dep->Responsex(&output_value,femmodel);
     
    476476        long         omode;
    477477        double           f;
    478         double           dxmin,gttol; 
     478        double           dxmin,gttol;
    479479        int          maxsteps,maxiter;
    480480        int          intn,num_controls,num_cost_functions,solution_type;
     
    596596
    597597        for(int i=0;i<intn;i++) {
    598                 aX[i] = reCast<IssmDouble>(X[i]); 
     598                aX[i] = reCast<IssmDouble>(X[i]);
    599599                aG[i] = reCast<IssmDouble>(G[i]);
    600600        }
  • issm/trunk-jpl/src/c/cores/controlvalidation_core.cpp

    r25341 r25554  
    11/*!\file: controlvalidation_core.cpp
    2  * \brief: core of the control solution 
    3  */ 
     2 * \brief: core of the control solution
     3 */
    44
    55#include "./cores.h"
     
    217217        dependents=xNew<IssmPDouble>(num_dependents);
    218218        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
    221221                if(solution_type==TransientSolutionEnum){
    222222                        output_value = dep->GetValue();
     
    235235        j0 = J;
    236236        _printf0_("Initial cost function J(x) = "<<setw(12)<<setprecision(7)<<j0<<"\n");
    237         _assert_(j0>0.); 
     237        _assert_(j0>0.);
    238238        simul_stoptrace2();
    239239        /*initialize direction index in the weights vector: */
     
    292292                #if defined(_HAVE_CODIPACK_)
    293293                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
    296296                        if(solution_type==TransientSolutionEnum){
    297297                                output_value = dep->GetValue();
     
    309309                for(int i=0;i<n;i++) Den += alpha* G[i] * scaling_factors[0];
    310310                Ialpha = fabs((j - j0)/Den - 1.);
    311                 _assert_(fabs(Den)>0.); 
     311                _assert_(fabs(Den)>0.);
    312312
    313313                _printf0_(" " << setw(11) << setprecision (5)<<alpha<<" " << setw(11) << setprecision (5)<<Ialpha<<"\n");
  • issm/trunk-jpl/src/c/cores/love_core.cpp

    r23066 r25554  
    11/*!\file: love_core.cpp
    2  * \brief: core of the LOVE numbers solution 
    3  */ 
     2 * \brief: core of the LOVE numbers solution
     3 */
    44
    55#include "./cores.h"
     
    4848        /*recover materials parameters: there is only one Matlitho, chase it down the hard way:*/
    4949        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);
    5252                if (material->ObjectEnum()==MatlithoEnum)matlitho=xDynamicCast<Matlitho*>(material);
    5353        }
     
    6969        FourierLoveCorex(LoveKr,LoveKi,LoveHr,LoveHi,LoveLr,LoveLi,LoveKernelsReal,LoveKernelsImag,  //output
    7070                        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,
    7272                        matlitho->burgers_viscosity, matlitho->burgers_mu, matlitho->density, matlitho->isburgers, matlitho->issolid //matlitho inputs
    73                         ); 
     73                        );
    7474
    7575        /*Add love matrices to results:*/
  • issm/trunk-jpl/src/c/cores/transient_core.cpp

    r25550 r25554  
    128128                if(iscontrol && isautodiff){
    129129                        /*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;
    132132                                IssmDouble  output_value;
    133133                                dep->Responsex(&output_value,femmodel);
     
    321321
    322322                /*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;
    325325                        dep->Responsex(&output_value,femmodel);
    326326                        dep->AddValue(output_value);
     
    357357
    358358        SetControlInputsFromVectorx(femmodel,X);
     359
    359360        IssmDouble J = 0.;
    360361        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;
    363364                        J += dep->GetValue();
    364365                }
  • issm/trunk-jpl/src/c/main/kriging.cpp

    r25425 r25554  
    11/*!\file:  kriging.cpp
    22 * \brief: kriging main parallel program
    3  */ 
     3 */
    44
    55#include "./issm.h"
     
    5757                results->AddObject(new GenericExternalResult<double*>(results->Size()+1,"predictions",predictions,ninterp,1,1,0));
    5858                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);
    6161                        result->WriteData(output_fid,1);
    6262                }
     
    104104
    105105        rootpatharg=argv[1];
    106         if(strcmp(strstr(rootpatharg,"/"),"/")!=0){ 
     106        if(strcmp(strstr(rootpatharg,"/"),"/")!=0){
    107107                rootpath       = xNew<char>(strlen(rootpatharg)+2); sprintf(rootpath,"%s/",rootpatharg);
    108         } 
     108        }
    109109        else{
    110110                rootpath       = xNew<char>(strlen(rootpatharg)+1); sprintf(rootpath,"%s",rootpatharg);
    111         } 
     111        }
    112112
    113113        modelname=argv[2];
  • issm/trunk-jpl/src/c/modules/AllocateSystemMatricesx/AllocateSystemMatricesx.cpp

    r25539 r25554  
    111111        int localnumnodes       = femmodel->nodes->Size();
    112112        int numberofdofspernode = femmodel->nodes->MaxNumDofs(GsetEnum);
    113         int M                   = femmodel->nodes->NumberOfDofs(set1enum);
     113        //int M                   = femmodel->nodes->NumberOfDofs(set1enum);
    114114        int N                   = femmodel->nodes->NumberOfDofs(set2enum);
    115115        int m                   = femmodel->nodes->NumberOfDofsLocal(set1enum);
     
    117117        int numnodesperelement  = femmodel->elements->MaxNumNodes();
    118118        int numnodesperload     = femmodel->loads->MaxNumNodes();
    119 
    120119        int elementssize        = femmodel->elements->Size();
    121120        int loadssize           = femmodel->loads->Size();
  • issm/trunk-jpl/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp

    r25539 r25554  
    2121        }
    2222        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;
    2525                load->Configure(elements,loads,nodes,vertices,materials,parameters);
    2626        }
    2727        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;
    3030                material->Configure(elements);
    3131        }
  • issm/trunk-jpl/src/c/modules/ConstraintsStatex/ConstraintsStatex.cpp

    r24630 r25554  
    3939        /*Deal with pengrid*/
    4040        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;
    4343                        if(load->ObjectEnum()==PengridEnum){
    4444                                Pengrid* pengrid=(Pengrid*)load;
     
    5050
    5151        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());
    5353        num_unstable_constraints=sum_num_unstable_constraints;
    5454
  • issm/trunk-jpl/src/c/modules/ConstraintsStatex/RiftConstraintsState.cpp

    r24630 r25554  
    11/*!\file RiftConstraintsState.cpp
    2  * \brief: manage penalties for rifts 
     2 * \brief: manage penalties for rifts
    33 */
    44#include "./ConstraintsStateLocal.h"
     
    3232void RiftConstrain(int* pnum_unstable_constraints,Loads* loads,int configuration_type){
    3333
    34         int                     i;
    35 
    3634        /* generic object pointer: */
    3735        Riftfront* riftfront=NULL;
     
    4038        int unstable;
    4139        int sum_num_unstable_constraints;
    42         int num_unstable_constraints=0; 
     40        int num_unstable_constraints=0;
    4341
    4442        /*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;
    5046                        riftfront=(Riftfront*)load;
    5147                        riftfront->Constrain(&unstable);
     
    5551
    5652        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());
    5854        num_unstable_constraints=sum_num_unstable_constraints;
    5955
     
    7571
    7672        /*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;
    8276                        riftfront=(Riftfront*)load;
    8377                        if (riftfront->IsFrozen()){
     
    9084        /*Is there just one found? that would mean we have frozen! : */
    9185        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());
    9387        found=mpi_found;
    9488
     
    106100
    107101        /*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;
    112105                        riftfront=(Riftfront*)load;
    113106                        riftfront->FreezeConstraints();
  • issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshxt.cpp

    r16164 r25554  
    11/*!\file:  ContourToMeshxt.cpp
    22 * \brief  "thread" core code for interpolating values from a structured grid.
    3  */ 
     3 */
    44
    55#ifdef HAVE_CONFIG_H
     
    3636
    3737        /*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;
    4040                IsInPoly(in_nod,contour->x,contour->y,contour->nods,x,y,i0,i1,edgevalue);
    4141        }
  • issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp

    r16164 r25554  
    4040        /*Loop through all contours: */
    4141        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;
    4444                        IsInPoly(flags,contour->x,contour->y,contour->nods,x,y,0,nods,edgevalue);
    4545                }
  • issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp

    r25539 r25554  
    3333                delete Je;
    3434        }
    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;
    3737                load->CreateJacobianMatrix(Jff);
    3838                load->PenaltyCreateJacobianMatrix(Jff,kmax);
  • issm/trunk-jpl/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp

    r23587 r25554  
    2929         ys=new Vector<IssmDouble>(slocalsize,ssize);
    3030
    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
    3232         * 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);
    3535                node->CreateNodalConstraints(ys);
    3636        }
  • issm/trunk-jpl/src/c/modules/ExpToLevelSetx/ExpToLevelSetxt.cpp

    r23066 r25554  
    11/*!\file:  ExpToLevelSetxt.cpp
    22 * \brief  "thread" core code for figuring out level set value from a contour and a cloud of points.
    3  */ 
     3 */
    44
    55#ifdef HAVE_CONFIG_H
     
    3838
    3939        /*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;
    4242                ContourToLevelSet(distance,contour->x,contour->y,contour->nods,x,y,i0,i1);
    4343        }
     
    7373         * We use the following notations:
    7474         * segment: v=(x1,y1), w=(x2,y2)
    75          * point:   p=(x0,y0) 
     75         * point:   p=(x0,y0)
    7676         */
    7777
    7878   /*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);
    8080
    8181   /*segment is single point: v == w*/
  • issm/trunk-jpl/src/c/modules/KillIcebergsx/KillIcebergsx.cpp

    r25539 r25554  
    2020
    2121        /*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);
    2425                if(!element->IsIceInElement()){
    2526                        /*Nothing to do, just flag element to speed up the computation*/
     
    3233                        }
    3334                }
     35                i++;
    3436        }
    3537
     
    5355                        keepgoing    = false;
    5456                        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);
    5760
    5861                                if(!element_flag[i]){
     
    7881                                        }
    7982                                }
     83                                i++;
    8084                        }
    8185                        iter++;
  • issm/trunk-jpl/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp

    r23630 r25554  
    1717        int ssize=nodes->NumberOfDofs(SsetEnum);
    1818
    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
    2020         *that know which values should be plugged into ug and where: */
    2121        if(ssize) if(flag_ys0) ys->Set(0.0);
     
    3333
    3434        /*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);
    3737                node->VecMerge(ug,local_uf,indices_uf,local_ys,indices_ys);
    3838        }
  • issm/trunk-jpl/src/c/modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp

    r23885 r25554  
    1414
    1515        /*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*>(output_definitions->GetObjectByOffset(i));
     16        for(Object* & object : output_definitions->objects){
     17                Definition* definition=dynamic_cast<Definition*>(object);
    1818
    1919                char* name = definition->Name();
     
    4242
    4343        /*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);
    4846
    4947                int en = definition->DefinitionEnum();
     
    5957
    6058        /*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)
    6260                                <<" ("<<output_enum<<")"
    6361                                << " because could not find the definition itself!");
  • issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp

    r23630 r25554  
    11/*!\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
    33 * vectors.
    44 */
     
    2929
    3030        /*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;
    3333                node->VecReduce(uf,local_ug,indices_ug);
    3434        }
  • issm/trunk-jpl/src/c/modules/ResetConstraintsx/ResetConstraintsx.cpp

    r24630 r25554  
    2929
    3030        /*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;
    3333                if(load->ObjectEnum()==PengridEnum){
    3434                        Pengrid* pengrid=(Pengrid*)load;
     
    4848
    4949        /*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;
    5252                if(load->ObjectEnum()==PengridEnum){
    5353                        Pengrid* pengrid=(Pengrid*)load;
  • issm/trunk-jpl/src/c/modules/SpcNodesx/SpcNodesx.cpp

    r23587 r25554  
    1010void SpcNodesx(Nodes* nodes,Constraints* constraints,Parameters* parameters){
    1111
    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);
    1414                constraint->ConstrainNode(nodes,parameters);
    1515        }
  • issm/trunk-jpl/src/c/modules/Trianglex/Trianglex.cpp

    r22498 r25554  
    4242        /*Create initial triangulation to call triangulate(). First number of points:*/
    4343        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;
    4646                in.numberofpoints+=contour->nods-1;
    4747        }
    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;
    5050                in.numberofpoints+=contour->nods;
    5151        }
     
    5858
    5959        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;
    6262                for (j=0;j<contour->nods-1;j++){
    6363                        in.pointlist[2*counter+0]=contour->x[j];
     
    6666                }
    6767        }
    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;
    7070                for (j=0;j<contour->nods;j++){
    7171                        in.pointlist[2*counter+0]=contour->x[j];
     
    8585        /*Build segments. First figure out number of segments: holes and closed outlines have as many segments as vertices: */
    8686        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;
    8989                in.numberofsegments+=contour->nods-1;
    9090        }
    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;
    9393                /*for rifts, we have one less segment as we have vertices*/
    9494                in.numberofsegments+=contour->nods-1;
     
    9999        counter=0;
    100100        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;
    103103                for (j=0;j<contour->nods-2;j++){
    104104                        in.segmentlist[2*counter+0]=counter;
     
    115115        }
    116116        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;
    119119                for (j=0;j<(contour->nods-1);j++){
    120120                        in.segmentlist[2*counter2+0]=counter;
  • issm/trunk-jpl/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp

    r23592 r25554  
    1919        yg_serial=yg->ToMPISerial();
    2020
    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){
    2424                        ((SpcDynamic*)constraint)->SetDynamicConstraint(nodes,yg_serial);
    2525                }
  • issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp

    r19984 r25554  
    11/*!\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.
    44 */
    55
     
    3232
    3333        /*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;
    3636                vertex->VertexCoordinates(vx,vy,vz,spherical);
    3737        }
  • issm/trunk-jpl/src/c/solutionsequences/solutionsequence_fct.cpp

    r24731 r25554  
    11/*!\file: solutionsequence_fct.cpp
    22 * \brief: numerical core of flux corrected transport solution
    3  */ 
     3 */
    44
    55#include "../toolkits/toolkits.h"
     
    109109
    110110                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);
    113113                        constraint->PenaltyDofAndValue(&dof,&d,femmodel->nodes,femmodel->parameters);
    114114                        if(dof!=-1){
     
    125125
    126126                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);
    129129                        constraint->PenaltyDofAndValue(&dof,&d,femmodel->nodes,femmodel->parameters);
    130130                        if(dof!=-1){
     
    180180        if(USEPENALTYMETHOD){
    181181                /*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);
    184184                        constraint->PenaltyDofAndValue(&dof,&d,femmodel->nodes,femmodel->parameters);
    185185                        d = d*dmax;
     
    195195                IssmDouble* rows_spc = xNew<IssmDouble>(numrows);
    196196                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);
    199199                        constraint->PenaltyDofAndValue(&dof,&d,femmodel->nodes,femmodel->parameters);
    200200                        if(dof!=-1){
     
    459459        /*Go solve lower order solution*/
    460460        femmodel->profiler->Start(SOLVER);
    461         SolverxPetsc(&u,LHS,RHS,NULL,NULL, femmodel->parameters); 
     461        SolverxPetsc(&u,LHS,RHS,NULL,NULL, femmodel->parameters);
    462462        femmodel->profiler->Stop(SOLVER);
    463463        MatFree(&LHS);
     
    506506
    507507        /*Update Element inputs*/
    508         InputUpdateFromSolutionx(femmodel,uf); 
     508        InputUpdateFromSolutionx(femmodel,uf);
    509509        delete uf;
    510510
Note: See TracChangeset for help on using the changeset viewer.