Skip to content

Make MCPL a Runtime Optional Dependency #3429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ option(OPENMC_ENABLE_COVERAGE "Compile with coverage analysis flags"
option(OPENMC_USE_DAGMC "Enable support for DAGMC (CAD) geometry" OFF)
option(OPENMC_USE_LIBMESH "Enable support for libMesh unstructured mesh tallies" OFF)
option(OPENMC_USE_MPI "Enable MPI" OFF)
option(OPENMC_USE_MCPL "Enable MCPL" OFF)
option(OPENMC_USE_UWUW "Enable UWUW" OFF)

message(STATUS "OPENMC_USE_OPENMP ${OPENMC_USE_OPENMP}")
Expand All @@ -46,7 +45,6 @@ message(STATUS "OPENMC_ENABLE_COVERAGE ${OPENMC_ENABLE_COVERAGE}")
message(STATUS "OPENMC_USE_DAGMC ${OPENMC_USE_DAGMC}")
message(STATUS "OPENMC_USE_LIBMESH ${OPENMC_USE_LIBMESH}")
message(STATUS "OPENMC_USE_MPI ${OPENMC_USE_MPI}")
message(STATUS "OPENMC_USE_MCPL ${OPENMC_USE_MCPL}")
message(STATUS "OPENMC_USE_UWUW ${OPENMC_USE_UWUW}")

# Warnings for deprecated options
Expand Down Expand Up @@ -189,22 +187,6 @@ if(${HDF5_VERSION} VERSION_GREATER_EQUAL 1.12.0)
list(APPEND cxxflags -DH5Oget_info_by_idx_vers=1 -DH5O_info_t_vers=1)
endif()

#===============================================================================
# MCPL
#===============================================================================

if (OPENMC_USE_MCPL)
if (NOT DEFINED MCPL_DIR)
execute_process(
COMMAND mcpl-config --show cmakedir
OUTPUT_VARIABLE MCPL_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
find_package(MCPL REQUIRED)
message(STATUS "Found MCPL: ${MCPL_DIR} (found version \"${MCPL_VERSION}\")")
endif()

#===============================================================================
# Set compile/link flags based on which compiler is being used
#===============================================================================
Expand Down Expand Up @@ -535,11 +517,6 @@ if (OPENMC_BUILD_TESTS)
add_subdirectory(tests/cpp_unit_tests)
endif()

if (OPENMC_USE_MCPL)
target_compile_definitions(libopenmc PUBLIC OPENMC_MCPL)
target_link_libraries(libopenmc MCPL::mcpl)
endif()

#===============================================================================
# Log build info that this executable can report later
#===============================================================================
Expand Down
4 changes: 0 additions & 4 deletions cmake/OpenMCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ if(@OPENMC_USE_OPENMP@)
find_package(OpenMP REQUIRED)
endif()

if(@OPENMC_USE_MCPL@)
find_package(MCPL REQUIRED HINTS @MCPL_DIR@)
endif()

if(@OPENMC_USE_UWUW@ AND NOT ${DAGMC_BUILD_UWUW})
message(FATAL_ERROR "UWUW is enabled in OpenMC but the DAGMC installation discovered was not configured with UWUW.")
endif()
4 changes: 0 additions & 4 deletions docs/source/usersguide/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,6 @@ OPENMC_USE_DAGMC
should also be defined as `DAGMC_ROOT` in the CMake configuration command.
(Default: off)

OPENMC_USE_MCPL
Turns on support for reading MCPL_ source files and writing MCPL source points
and surface sources. (Default: off)

OPENMC_USE_LIBMESH
Enables the use of unstructured mesh tallies with libMesh_. (Default: off)

Expand Down
24 changes: 11 additions & 13 deletions include/openmc/mcpl_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@

namespace openmc {

//==============================================================================
// Constants
//==============================================================================

extern "C" const bool MCPL_ENABLED;

//==============================================================================
// Functions
//==============================================================================
Expand All @@ -29,14 +23,18 @@ vector<SourceSite> mcpl_source_sites(std::string path);
//
//! \param[in] filename Path to MCPL file
//! \param[in] source_bank Vector of SourceSites to write to file for this
//! MPI rank. Note that this can't be const due to
//! it being used as work space by MPI.
//! \param[in] bank_indx Pointer to vector of site index ranges over all
//! MPI ranks. This can be computed by calling
//! calculate_parallel_index_vector on
//! source_bank.size().
//! MPI rank.
//! \param[in] bank_index Pointer to vector of site index ranges over all
//! MPI ranks.
void write_mcpl_source_point(const char* filename, span<SourceSite> source_bank,
const vector<int64_t>& bank_index);

//! Check if MCPL functionality is available
bool is_mcpl_interface_available();

//! Initialize the MCPL interface
void initialize_mcpl_interface_if_needed();

} // namespace openmc

#endif // OPENMC_MCPL_INTERFACE_H
#endif // OPENMC_MCPL_INTERFACE_H
3 changes: 0 additions & 3 deletions openmc/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ def _coord_levels():
def _libmesh_enabled():
return c_bool.in_dll(_dll, "LIBMESH_ENABLED").value

def _mcpl_enabled():
return c_bool.in_dll(_dll, "MCPL_ENABLED").value

def _uwuw_enabled():
return c_bool.in_dll(_dll, "UWUW_ENABLED").value

Expand Down
Loading