diff --git a/include/openmc/capi.h b/include/openmc/capi.h index 43c33dd91a..f08ec5c02f 100644 --- a/include/openmc/capi.h +++ b/include/openmc/capi.h @@ -145,13 +145,13 @@ extern "C" { //! \param[in] meshtyally_id id of CMFD Mesh Tally //! \param[in] cmfd_indices indices storing spatial and energy dimensions of CMFD problem //! \param[in] norm CMFD normalization factor - extern "C" void openmc_initialize_mesh_egrid(const int meshtally_id, const int* cmfd_indices, - const double norm); + void openmc_initialize_mesh_egrid(const int meshtally_id, const int* cmfd_indices, + const double norm); //! Sets the mesh and energy grid for CMFD reweight //! \param[in] feedback whether or not to run CMFD feedback //! \param[in] cmfd_src computed CMFD source - extern "C" void openmc_cmfd_reweight(const bool feedback, const double* cmfd_src); + void openmc_cmfd_reweight(const bool feedback, const double* cmfd_src); //! Sets the fixed variables that are used for CMFD linear solver //! \param[in] indptr CSR format index pointer array of loss matrix @@ -162,10 +162,10 @@ extern "C" { //! \param[in] spectral spectral radius of CMFD matrices and tolerances //! \param[in] map coremap for problem, storing accelerated regions //! \param[in] use_all_threads whether to use all threads when running CMFD solver - extern "C" void openmc_initialize_linsolver(const int* indptr, int len_indptr, - const int* indices, int n_elements, - int dim, double spectral, - const int* map, bool use_all_threads); + void openmc_initialize_linsolver(const int* indptr, int len_indptr, + const int* indices, int n_elements, + int dim, double spectral, + const int* map, bool use_all_threads); //! Runs a Gauss Seidel linear solver to solve CMFD matrix equations //! linear solver @@ -174,9 +174,19 @@ extern "C" { //! \param[out] x unknown vector //! \param[in] tol tolerance on final error //! \return number of inner iterations required to reach convergence - extern "C" int openmc_run_linsolver(const double* A_data, const double* b, + int openmc_run_linsolver(const double* A_data, const double* b, double* x, double tol); + //! Export physical properties for model + //! \param[in] filename Filename to write to + //! \return Error code + int openmc_properties_export(const char* filename); + + //! Import physical properties for model + //! \param[in] filename Filename to read from + // \return Error code + int openmc_properties_import(const char* filename); + // Error codes extern int OPENMC_E_UNASSIGNED; extern int OPENMC_E_ALLOCATE; diff --git a/include/openmc/summary.h b/include/openmc/summary.h index 95fb0be167..ff2ab71a89 100644 --- a/include/openmc/summary.h +++ b/include/openmc/summary.h @@ -11,16 +11,6 @@ void write_nuclides(hid_t file); void write_geometry(hid_t file); void write_materials(hid_t file); -//! Export physical properties for model -//! \param[in] filename Filename to write to -//! \return Error code -extern "C" int openmc_properties_export(const char* filename); - -//! Import physical properties for model -//! \param[in] filename Filename to read from -// \return Error code -extern "C" int openmc_properties_import(const char* filename); - } #endif // OPENMC_SUMMARY_H diff --git a/src/summary.cpp b/src/summary.cpp index 29d37009b1..c2276c063e 100644 --- a/src/summary.cpp +++ b/src/summary.cpp @@ -2,6 +2,7 @@ #include +#include "openmc/capi.h" #include "openmc/cell.h" #include "openmc/file_utils.h" #include "openmc/hdf5_interface.h" @@ -136,6 +137,10 @@ void write_materials(hid_t file) close_group(materials_group); } +//============================================================================== +// C API +//============================================================================== + extern "C" int openmc_properties_export(const char* filename) { // Set a default filename if none was passed