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

CHG: Some more iterator loop changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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();
Note: See TracChangeset for help on using the changeset viewer.