diff --git a/docs/source/capi/index.rst b/docs/source/capi/index.rst index d7da3261e1..85e5c8ced3 100644 --- a/docs/source/capi/index.rst +++ b/docs/source/capi/index.rst @@ -465,13 +465,15 @@ Functions :return: Return status (negative if an error occurred) :rtype: int -.. c:function:: int openmc_statepoint_write(const char filename[]) +.. c:function:: int openmc_statepoint_write(const char filename[], const bool* write_source) Write a statepoint file :param filename: Name of file to create. If a null pointer is passed, a filename is assigned automatically. :type filename: const char[] + :param write_source: Whether to include the source bank + :type write_source: const bool* :return: Return status (negative if an error occurs) :rtype: int diff --git a/openmc/capi/core.py b/openmc/capi/core.py index 5be31ce865..bedde6e162 100644 --- a/openmc/capi/core.py +++ b/openmc/capi/core.py @@ -52,7 +52,7 @@ _dll.openmc_simulation_init.restype = c_int _dll.openmc_simulation_init.errcheck = _error_handler _dll.openmc_simulation_finalize.restype = c_int _dll.openmc_simulation_finalize.errcheck = _error_handler -_dll.openmc_statepoint_write.argtypes = [POINTER(c_char_p), POINTER(c_bool)] +_dll.openmc_statepoint_write.argtypes = [c_char_p, POINTER(c_bool)] _dll.openmc_statepoint_write.restype = c_int _dll.openmc_statepoint_write.errcheck = _error_handler diff --git a/src/state_point.F90 b/src/state_point.F90 index 1286bb63d4..2692856dc0 100644 --- a/src/state_point.F90 +++ b/src/state_point.F90 @@ -55,7 +55,7 @@ contains !=============================================================================== function openmc_statepoint_write(filename, write_source) result(err) bind(C) - type(C_PTR), intent(in), optional :: filename + type(C_PTR), value :: filename logical(C_BOOL), intent(in), optional :: write_source integer(C_INT) :: err @@ -91,7 +91,7 @@ contains err = 0 ! Set the filename - if (present(filename)) then + if (c_associated(filename)) then call c_f_pointer(filename, string, [MAX_FILE_LEN]) filename_ = to_f_string(string) else