- Timestamp:
- 09/11/20 07:26:02 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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();
Note:
See TracChangeset
for help on using the changeset viewer.