Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Updated error checks to halt execution if a bad object is passed to f…
Browse files Browse the repository at this point in the history
…ill and spill methods
  • Loading branch information
daminton committed Aug 2, 2021
1 parent 26ed1c9 commit fb9449e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
4 changes: 2 additions & 2 deletions examples/helio_swifter_comparison/swiftest_vs_swifter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"output_type": "stream",
"text": [
"Reading Swiftest file param.swiftest.in\n",
"Reading in time 1.001e+00\n",
"Reading in time 1.000e+00\n",
"Creating Dataset\n",
"Successfully converted 1463 output frames.\n",
"Successfully converted 1462 output frames.\n",
"Swiftest simulation data stored as xarray DataSet .ds\n"
]
}
Expand Down
16 changes: 10 additions & 6 deletions src/rmvs/rmvs_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module subroutine rmvs_util_append_pl(self, source, lsource_mask)

call whm_util_append_pl(self, source, lsource_mask)
class default
write(*,*) "Invalid object passed to the append method. Source must be of class rmvs_pl or its descendents"
write(*,*) "Invalid object passed to the append method. Source must be of class rmvs_pl or its descendents!"
call util_exit(FAILURE)
end select

Expand All @@ -54,7 +54,7 @@ module subroutine rmvs_util_append_tp(self, source, lsource_mask)

call util_append_tp(self, source, lsource_mask) ! Note: whm_tp does not have its own append method, so we skip back to the base class
class default
write(*,*) "Invalid object passed to the append method. Source must be of class rmvs_tp or its descendents"
write(*,*) "Invalid object passed to the append method. Source must be of class rmvs_tp or its descendents!"
call util_exit(FAILURE)
end select

Expand Down Expand Up @@ -91,7 +91,8 @@ module subroutine rmvs_util_fill_pl(self, inserts, lfill_list)

call whm_util_fill_pl(keeps, inserts, lfill_list)
class default
write(*,*) 'Error! spill method called for incompatible return type on rmvs_pl'
write(*,*) "Invalid object passed to the fill method. Source must be of class rmvs_pl or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down Expand Up @@ -120,7 +121,8 @@ module subroutine rmvs_util_fill_tp(self, inserts, lfill_list)

call util_fill_tp(keeps, inserts, lfill_list) ! Note: whm_tp does not have its own fill method, so we skip back to the base class
class default
write(*,*) 'Error! fill method called for incompatible return type on rmvs_tp'
write(*,*) "Invalid object passed to the fill method. Source must be of class rmvs_tp or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down Expand Up @@ -334,7 +336,8 @@ module subroutine rmvs_util_spill_pl(self, discards, lspill_list, ldestructive)

call whm_util_spill_pl(keeps, discards, lspill_list, ldestructive)
class default
write(*,*) 'Error! spill method called for incompatible return type on rmvs_pl'
write(*,*) "Invalid object passed to the spill method. Source must be of class rmvs_pl or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down Expand Up @@ -366,7 +369,8 @@ module subroutine rmvs_util_spill_tp(self, discards, lspill_list, ldestructive)

call util_spill_tp(keeps, discards, lspill_list, ldestructive)
class default
write(*,*) 'Error! spill method called for incompatible return type on rmvs_tp'
write(*,*) "Invalid object passed to the spill method. Source must be of class rmvs_tp or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down
16 changes: 10 additions & 6 deletions src/symba/symba_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module subroutine symba_util_append_pl(self, source, lsource_mask)

call util_append_pl(self, source, lsource_mask) ! Note: helio_pl does not have its own append method, so we skip back to the base class
class default
write(*,*) "Invalid object passed to the append method. Source must be of class symba_pl or its descendents"
write(*,*) "Invalid object passed to the append method. Source must be of class symba_pl or its descendents!"
call util_exit(FAILURE)
end select

Expand All @@ -131,7 +131,7 @@ module subroutine symba_util_append_tp(self, source, lsource_mask)

call util_append_tp(self, source, lsource_mask) ! Note: helio_tp does not have its own append method, so we skip back to the base class
class default
write(*,*) "Invalid object passed to the append method. Source must be of class symba_tp or its descendents"
write(*,*) "Invalid object passed to the append method. Source must be of class symba_tp or its descendents!"
call util_exit(FAILURE)
end select

Expand Down Expand Up @@ -254,7 +254,8 @@ module subroutine symba_util_fill_pl(self, inserts, lfill_list)

call util_fill_pl(keeps, inserts, lfill_list) ! Note: helio_pl does not have its own fill method, so we skip back to the base class
class default
write(*,*) 'Error! fill method called for incompatible return type on symba_pl'
write(*,*) "Invalid object passed to the fill method. Source must be of class symba_pl or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down Expand Up @@ -283,7 +284,8 @@ module subroutine symba_util_fill_tp(self, inserts, lfill_list)

call util_fill_tp(keeps, inserts, lfill_list) ! Note: helio_tp does not have its own fill method, so we skip back to the base class
class default
write(*,*) 'Error! fill method called for incompatible return type on symba_tp'
write(*,*) "Invalid object passed to the fill method. Source must be of class symba_tp or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down Expand Up @@ -691,7 +693,8 @@ module subroutine symba_util_spill_pl(self, discards, lspill_list, ldestructive)

call util_spill_pl(keeps, discards, lspill_list, ldestructive)
class default
write(*,*) 'Error! spill method called for incompatible return type on symba_pl'
write(*,*) "Invalid object passed to the spill method. Source must be of class symba_pl or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down Expand Up @@ -724,7 +727,8 @@ module subroutine symba_util_spill_tp(self, discards, lspill_list, ldestructive)

call util_spill_tp(keeps, discards, lspill_list, ldestructive)
class default
write(*,*) 'Error! spill method called for incompatible return type on symba_pl'
write(*,*) "Invalid object passed to the spill method. Source must be of class symba_tp or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down
5 changes: 3 additions & 2 deletions src/whm/whm_util.f90
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module subroutine whm_util_fill_pl(self, inserts, lfill_list)

call util_fill_pl(keeps, inserts, lfill_list)
class default
write(*,*) "Invalid object passed to the fill method. Inserts must be of class whm_pl or its descendents"
write(*,*) "Invalid object passed to the fill method. Inserts must be of class whm_pl or its descendents!"
call util_exit(FAILURE)
end select
end associate
Expand Down Expand Up @@ -209,7 +209,8 @@ module subroutine whm_util_spill_pl(self, discards, lspill_list, ldestructive)

call util_spill_pl(keeps, discards, lspill_list, ldestructive)
class default
write(*,*) 'Error! spill method called for incompatible return type on whm_pl'
write(*,*) "Invalid object passed to the spill method. Source must be of class whm_pl or its descendents!"
call util_exit(FAILURE)
end select
end associate

Expand Down

0 comments on commit fb9449e

Please sign in to comment.