Skip to content

Commit

Permalink
Remove IF(.NOT.failure) pattern (Vedran Miletic)
Browse files Browse the repository at this point in the history
svn-origin-rev: 15663
  • Loading branch information
oschuett committed Aug 6, 2015
1 parent 432ff67 commit b075cfc
Show file tree
Hide file tree
Showing 265 changed files with 64,137 additions and 66,717 deletions.
4 changes: 1 addition & 3 deletions src/common/cp_error_handling.F
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ SUBROUTINE cp_error_dealloc_ref(err_to_free, error)
CALL cp_error_common_stop('cp_error_reset',&
'error structure not initialized')
END IF
IF (.NOT. failure) THEN
CALL cp_logger_release(err_to_free%logger)
END IF
CALL cp_logger_release(err_to_free%logger)
END SUBROUTINE cp_error_dealloc_ref
! *****************************************************************************
Expand Down
90 changes: 38 additions & 52 deletions src/common/cp_para_env.F
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,19 @@ SUBROUTINE cp_para_env_create(para_env, group, source,mepos, num_pe,&
CPPrecondition(.NOT.ASSOCIATED(para_env),cp_failure_level,routineP,error,failure)
ALLOCATE(para_env,stat=stat)
CPPostcondition(stat==0,cp_failure_level,routineP,error,failure)
IF (.NOT.failure) THEN
para_env%group=group
para_env%source=0
para_env%ref_count=1
para_env%owns_group=.TRUE.
IF (PRESENT(source)) para_env%source=source
IF (PRESENT(owns_group)) para_env%owns_group=owns_group
IF (.NOT.(PRESENT(mepos).AND.PRESENT(num_pe))) THEN
CALL cp_para_env_update(para_env,error=error)
ELSE
para_env%mepos=mepos
para_env%num_pe=num_pe
END IF
para_env%ionode=para_env%mepos==para_env%source
para_env%group=group
para_env%source=0
para_env%ref_count=1
para_env%owns_group=.TRUE.
IF (PRESENT(source)) para_env%source=source
IF (PRESENT(owns_group)) para_env%owns_group=owns_group
IF (.NOT.(PRESENT(mepos).AND.PRESENT(num_pe))) THEN
CALL cp_para_env_update(para_env,error=error)
ELSE
para_env%mepos=mepos
para_env%num_pe=num_pe
END IF
para_env%ionode=para_env%mepos==para_env%source
END SUBROUTINE cp_para_env_create

! *****************************************************************************
Expand All @@ -102,10 +100,8 @@ SUBROUTINE cp_para_env_retain(para_env, error)
failure=.FALSE.

CPPrecondition(ASSOCIATED(para_env),cp_failure_level,routineP,error,failure)
IF (.NOT.failure) THEN
CPPrecondition(para_env%ref_count>0,cp_failure_level,routineP,error,failure)
para_env%ref_count=para_env%ref_count+1
END IF
CPPrecondition(para_env%ref_count>0,cp_failure_level,routineP,error,failure)
para_env%ref_count=para_env%ref_count+1
END SUBROUTINE cp_para_env_retain

! *****************************************************************************
Expand Down Expand Up @@ -168,14 +164,10 @@ SUBROUTINE cp_para_env_update(para_env, error)
failure=.FALSE.
CPPrecondition(ASSOCIATED(para_env),cp_failure_level,routineP,error,failure)
IF (.NOT.failure) THEN
CPPrecondition(para_env%ref_count>0,cp_failure_level,routineP,error,failure)
END IF
IF (.NOT.failure) THEN
CALL mp_environ(taskid=para_env%mepos,numtask=para_env%num_pe,&
groupid=para_env%group)
para_env%ionode=para_env%mepos==para_env%source
END IF
CPPrecondition(para_env%ref_count>0,cp_failure_level,routineP,error,failure)
CALL mp_environ(taskid=para_env%mepos,numtask=para_env%num_pe,&
groupid=para_env%group)
para_env%ionode=para_env%mepos==para_env%source
END SUBROUTINE cp_para_env_update
! *****************************************************************************
Expand Down Expand Up @@ -253,23 +245,21 @@ SUBROUTINE cp_cart_create(cart, group, ndims,owns_group, error)
CPPrecondition(.NOT.ASSOCIATED(cart),cp_failure_level,routineP,error,failure)
ALLOCATE(cart,stat=stat)
CPPostcondition(stat==0,cp_failure_level,routineP,error,failure)
IF (.NOT.failure) THEN
cart%owns_group=.TRUE.
IF (PRESENT(owns_group)) cart%owns_group=owns_group
cart%ndims=ndims
cart%group=group
ALLOCATE(cart%source(ndims),cart%periodic(ndims),cart%mepos(ndims),&
cart%num_pe(ndims),stat=stat)
CPPostcondition(stat==0,cp_fatal_level,routineP,error,failure)
cart%source=0
cart%mepos=0
cart%periodic=.FALSE.
cart%ref_count=1
cart%ntask=1
CALL cp_cart_update(cart,error=error)
END IF
cart%owns_group=.TRUE.
IF (PRESENT(owns_group)) cart%owns_group=owns_group
cart%ndims=ndims
cart%group=group
ALLOCATE(cart%source(ndims),cart%periodic(ndims),cart%mepos(ndims),&
cart%num_pe(ndims),stat=stat)
CPPostcondition(stat==0,cp_fatal_level,routineP,error,failure)
cart%source=0
cart%mepos=0
cart%periodic=.FALSE.
cart%ref_count=1
cart%ntask=1
CALL cp_cart_update(cart,error=error)
END SUBROUTINE cp_cart_create
! *****************************************************************************
Expand All @@ -292,11 +282,9 @@ SUBROUTINE cp_cart_update(cart,error)
CPPrecondition(ASSOCIATED(cart),cp_failure_level,routineP,error,failure)
CPPrecondition(cart%ref_count>0,cp_failure_level,routineP,error,failure)
IF (.NOT. failure) THEN
CALL mp_environ( cart%group, cart%ndims, cart%num_pe, task_coor=cart%mepos, &
periods=cart%periodic)
CALL mp_environ( numtask=cart%ntask, taskid=cart%rank, groupid=cart%group)
END IF
CALL mp_environ( cart%group, cart%ndims, cart%num_pe, task_coor=cart%mepos, &
periods=cart%periodic)
CALL mp_environ( numtask=cart%ntask, taskid=cart%rank, groupid=cart%group)
END SUBROUTINE cp_cart_update
! *****************************************************************************
Expand Down Expand Up @@ -353,10 +341,8 @@ SUBROUTINE cp_cart_retain(cart,error)
failure=.FALSE.
CPPrecondition(ASSOCIATED(cart),cp_failure_level,routineP,error,failure)
IF (.NOT. failure) THEN
CPPrecondition(cart%ref_count>0,cp_failure_level,routineP,error,failure)
cart%ref_count=cart%ref_count+1
END IF
CPPrecondition(cart%ref_count>0,cp_failure_level,routineP,error,failure)
cart%ref_count=cart%ref_count+1
END SUBROUTINE cp_cart_retain
! *****************************************************************************
Expand Down
6 changes: 2 additions & 4 deletions src/common/cp_result_types.F
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,8 @@ SUBROUTINE cp_result_retain(results,error)

failure=.FALSE.
CPPrecondition(ASSOCIATED(results),cp_failure_level,routineP,error,failure)
IF (.NOT. failure) THEN
CPPrecondition(results%ref_count>0,cp_failure_level,routineP,error,failure)
results%ref_count=results%ref_count+1
END IF
CPPrecondition(results%ref_count>0,cp_failure_level,routineP,error,failure)
results%ref_count=results%ref_count+1
END SUBROUTINE cp_result_retain

! *****************************************************************************
Expand Down
Loading

0 comments on commit b075cfc

Please sign in to comment.