diff --git a/src/CMakeLists.txt b/CMakeLists.txt similarity index 91% rename from src/CMakeLists.txt rename to CMakeLists.txt index 12f408618..f004c28e9 100644 --- a/src/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,29 +169,29 @@ endif() # Only initialize git submodules if it is not there. User is responsible # for future updates of fox xml submodule. -if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/xml/fox/.git) - if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git) +if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/xml/fox/.git) + if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) message("-- Cloning FoX XML git repository...") execute_process(COMMAND git clone https://github.com/mit-crpg/fox.git src/xml/fox - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) execute_process(COMMAND git checkout bdc852f4f43d969fb1b179cba79295c1e095a455 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/xml/fox) + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/xml/fox) else() message("-- Initializing/Updating FoX XML submodule...") execute_process(COMMAND git submodule init - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) execute_process(COMMAND git submodule update - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif() endif() -add_subdirectory(xml/fox) +add_subdirectory(src/xml/fox) #=============================================================================== # Build OpenMC executable #=============================================================================== set(program "openmc") -file(GLOB source *.F90 xml/openmc_fox.F90) +file(GLOB source src/*.F90 src/xml/openmc_fox.F90) add_executable(${program} ${source}) target_link_libraries(${program} ${libraries} fox_dom) set_target_properties(${program} PROPERTIES @@ -203,28 +203,16 @@ set_target_properties(${program} PROPERTIES #=============================================================================== install(TARGETS ${program} RUNTIME DESTINATION bin) -install(PROGRAMS utils/plot_mesh_tally.py - DESTINATION bin - RENAME plot_mesh_tally) -install(PROGRAMS utils/statepoint_histogram.py - DESTINATION bin - RENAME statepoint_histogram) -install(PROGRAMS utils/update_inputs.py - DESTINATION bin - RENAME update_inputs) -install(PROGRAMS utils/xml_validate.py - DESTINATION bin - RENAME xml_validate) install(DIRECTORY relaxng DESTINATION share) -install(FILES ../man/man1/openmc.1 DESTINATION share/man/man1) -install(FILES ../LICENSE DESTINATION "share/doc/${program}/copyright") +install(FILES man/man1/openmc.1 DESTINATION share/man/man1) +install(FILES LICENSE DESTINATION "share/doc/${program}/copyright") find_package(PythonInterp) if(PYTHONINTERP_FOUND) install(CODE "execute_process( COMMAND ${PYTHON_EXECUTABLE} setup.py install --prefix=${CMAKE_INSTALL_PREFIX} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/utils)") + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})") endif() #=============================================================================== @@ -235,7 +223,7 @@ endif() include(CTest) # Get a list of all the tests to run -file(GLOB_RECURSE TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_*.py) +file(GLOB_RECURSE TESTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_*.py) # Check for MEM_CHECK and COVERAGE variables if (DEFINED ENV{MEM_CHECK}) diff --git a/src/Makefile b/Makefile similarity index 100% rename from src/Makefile rename to Makefile diff --git a/docs/source/quickinstall.rst b/docs/source/quickinstall.rst index 1ffebbebe..b64dfebda 100644 --- a/docs/source/quickinstall.rst +++ b/docs/source/quickinstall.rst @@ -43,8 +43,7 @@ the following commands in a terminal: git clone https://github.com/mit-crpg/openmc.git cd openmc git checkout -b master origin/master - mkdir src/build - cd src/build + mkdir build && cd build cmake .. make sudo make install diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index d06806d98..707355ddc 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -112,7 +112,7 @@ repository:: By default, the cloned repository will be set to the development branch. To switch to the source of the latest stable release, run the following commands:: - cd openmc/src + cd openmc git checkout master .. _GitHub: https://github.com/mit-crpg/openmc @@ -132,14 +132,13 @@ following .. code-block:: sh - mkdir src/build - cd src/build + mkdir build && cd build cmake .. make Note that first a build directory is created as a subdirectory of the source -directory. The Makefile in ``src/`` will automatically perform an out-of-source -build with default options. +directory. The Makefile in the top-level directory will automatically perform an +out-of-source build with default options. CMakeLists.txt Options ++++++++++++++++++++++ @@ -166,7 +165,7 @@ should be used: .. code-block:: sh - cmake -Ddebug=on /path/to/src + cmake -Ddebug=on /path/to/openmc Compiling with MPI ++++++++++++++++++ @@ -177,14 +176,14 @@ the MPI Fortran wrapper. For example, in a bash shell: .. code-block:: sh export FC=mpif90 - cmake /path/to/src + cmake /path/to/openmc Note that in many shells, an environment variable can be set for a single command, i.e. .. code-block:: sh - FC=mpif90 cmake /path/to/src + FC=mpif90 cmake /path/to/openmc Compiling with HDF5 +++++++++++++++++++ @@ -195,14 +194,14 @@ the HDF5 Fortran wrapper. For example, in a bash shell: .. code-block:: sh export FC=h5fc - cmake /path/to/src + cmake /path/to/openmc As noted above, an environment variable can typically be set for a single command, i.e. .. code-block:: sh - FC=h5fc cmake /path/to/src + FC=h5fc cmake /path/to/openmc To compile with support for both MPI and HDF5, use the parallel HDF5 wrapper ``h5pfc`` instead. Note that this requires that your HDF5 installation be @@ -216,8 +215,7 @@ the root directory of the source code: .. code-block:: sh - mkdir src/build - cd src/build + mkdir build && cd build cmake .. make make install @@ -267,7 +265,8 @@ the source code root directory: .. code-block:: sh - cd src + mkdir build && cd build + cmake .. make This will build an executable named ``openmc``. @@ -293,7 +292,6 @@ in the root directory of the OpenMC distribution: .. code-block:: sh - cd src make This will build an executable named ``openmc``. @@ -312,7 +310,6 @@ the source directory and run the following: .. code-block:: sh - cd src make test If you want more options for testing you can use ctest_ command. For example, @@ -320,7 +317,7 @@ if we wanted to run only the plot tests with 4 processors, we run: .. code-block:: sh - cd src/build + cd build ctest -j 4 -R plot If you want to run the full test suite with different build options please @@ -370,7 +367,7 @@ the following steps must be taken: .. code-block:: sh - openmc/src/utils/convert_xsdir.py xsdir31 cross_sections.xml + openmc/scripts/convert_xsdir.py xsdir31 cross_sections.xml 3. In the converted ``cross_sections.xml`` file, change the contents of the element to the absolute path of the directory containing the @@ -416,9 +413,8 @@ Running OpenMC Once you have a model built (see :ref:`usersguide_input`), you can either run the openmc executable directly from the directory containing your XML input files, or you can specify as a command-line argument the directory containing -the XML input files. For example, if the path of your OpenMC executable is -``/home/username/openmc/src/openmc`` and your XML input files are in the -directory ``/home/username/somemodel/``, one way to run the simulation would be: +the XML input files. For example, if your XML input files are in the directory +``/home/username/somemodel/``, one way to run the simulation would be: .. code-block:: sh diff --git a/src/utils/openmc/__init__.py b/openmc/__init__.py similarity index 100% rename from src/utils/openmc/__init__.py rename to openmc/__init__.py diff --git a/src/utils/openmc/checkvalue.py b/openmc/checkvalue.py similarity index 100% rename from src/utils/openmc/checkvalue.py rename to openmc/checkvalue.py diff --git a/src/utils/openmc/clean_xml.py b/openmc/clean_xml.py similarity index 100% rename from src/utils/openmc/clean_xml.py rename to openmc/clean_xml.py diff --git a/src/utils/openmc/cmfd.py b/openmc/cmfd.py similarity index 100% rename from src/utils/openmc/cmfd.py rename to openmc/cmfd.py diff --git a/src/utils/openmc/constants.py b/openmc/constants.py similarity index 100% rename from src/utils/openmc/constants.py rename to openmc/constants.py diff --git a/src/utils/openmc/element.py b/openmc/element.py similarity index 100% rename from src/utils/openmc/element.py rename to openmc/element.py diff --git a/src/utils/openmc/executor.py b/openmc/executor.py similarity index 100% rename from src/utils/openmc/executor.py rename to openmc/executor.py diff --git a/src/utils/openmc/filter.py b/openmc/filter.py similarity index 100% rename from src/utils/openmc/filter.py rename to openmc/filter.py diff --git a/src/utils/openmc/geometry.py b/openmc/geometry.py similarity index 100% rename from src/utils/openmc/geometry.py rename to openmc/geometry.py diff --git a/src/utils/openmc/material.py b/openmc/material.py similarity index 100% rename from src/utils/openmc/material.py rename to openmc/material.py diff --git a/src/utils/openmc/mesh.py b/openmc/mesh.py similarity index 100% rename from src/utils/openmc/mesh.py rename to openmc/mesh.py diff --git a/src/utils/openmc/nuclide.py b/openmc/nuclide.py similarity index 100% rename from src/utils/openmc/nuclide.py rename to openmc/nuclide.py diff --git a/src/utils/openmc/opencg_compatible.py b/openmc/opencg_compatible.py similarity index 100% rename from src/utils/openmc/opencg_compatible.py rename to openmc/opencg_compatible.py diff --git a/src/utils/openmc/particle_restart.py b/openmc/particle_restart.py similarity index 100% rename from src/utils/openmc/particle_restart.py rename to openmc/particle_restart.py diff --git a/src/utils/openmc/plots.py b/openmc/plots.py similarity index 100% rename from src/utils/openmc/plots.py rename to openmc/plots.py diff --git a/src/utils/openmc/settings.py b/openmc/settings.py similarity index 100% rename from src/utils/openmc/settings.py rename to openmc/settings.py diff --git a/src/utils/openmc/statepoint.py b/openmc/statepoint.py similarity index 100% rename from src/utils/openmc/statepoint.py rename to openmc/statepoint.py diff --git a/src/utils/openmc/summary.py b/openmc/summary.py similarity index 100% rename from src/utils/openmc/summary.py rename to openmc/summary.py diff --git a/src/utils/openmc/surface.py b/openmc/surface.py similarity index 100% rename from src/utils/openmc/surface.py rename to openmc/surface.py diff --git a/src/utils/openmc/tallies.py b/openmc/tallies.py similarity index 100% rename from src/utils/openmc/tallies.py rename to openmc/tallies.py diff --git a/src/utils/openmc/trigger.py b/openmc/trigger.py similarity index 100% rename from src/utils/openmc/trigger.py rename to openmc/trigger.py diff --git a/src/utils/openmc/universe.py b/openmc/universe.py similarity index 100% rename from src/utils/openmc/universe.py rename to openmc/universe.py diff --git a/src/utils/convert_binary.py b/scripts/convert_binary.py similarity index 100% rename from src/utils/convert_binary.py rename to scripts/convert_binary.py diff --git a/src/utils/convert_xsdata.py b/scripts/convert_xsdata.py similarity index 100% rename from src/utils/convert_xsdata.py rename to scripts/convert_xsdata.py diff --git a/src/utils/convert_xsdir.py b/scripts/convert_xsdir.py similarity index 100% rename from src/utils/convert_xsdir.py rename to scripts/convert_xsdir.py diff --git a/src/utils/memory_usage.py b/scripts/memory_usage.py similarity index 100% rename from src/utils/memory_usage.py rename to scripts/memory_usage.py diff --git a/src/utils/plot_mesh_tally.py b/scripts/plot_mesh_tally.py similarity index 100% rename from src/utils/plot_mesh_tally.py rename to scripts/plot_mesh_tally.py diff --git a/src/utils/statepoint_3d.py b/scripts/statepoint_3d.py similarity index 100% rename from src/utils/statepoint_3d.py rename to scripts/statepoint_3d.py diff --git a/src/utils/statepoint_histogram.py b/scripts/statepoint_histogram.py similarity index 100% rename from src/utils/statepoint_histogram.py rename to scripts/statepoint_histogram.py diff --git a/src/utils/tally_conv.py b/scripts/tally_conv.py similarity index 100% rename from src/utils/tally_conv.py rename to scripts/tally_conv.py diff --git a/src/utils/track.py b/scripts/track.py similarity index 100% rename from src/utils/track.py rename to scripts/track.py diff --git a/src/utils/update_inputs.py b/scripts/update_inputs.py similarity index 100% rename from src/utils/update_inputs.py rename to scripts/update_inputs.py diff --git a/src/utils/voxel.py b/scripts/voxel.py similarity index 100% rename from src/utils/voxel.py rename to scripts/voxel.py diff --git a/src/utils/xml_validate.py b/scripts/xml_validate.py similarity index 100% rename from src/utils/xml_validate.py rename to scripts/xml_validate.py diff --git a/src/utils/setup.py b/setup.py similarity index 69% rename from src/utils/setup.py rename to setup.py index 72682aea9..86047cc55 100644 --- a/src/utils/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import os from distutils.core import setup setup(name='openmc', @@ -8,4 +9,5 @@ setup(name='openmc', author='Will Boyd', author_email='wbinventor@gmail.com', url='https://github.com/mit-crpg/openmc', - packages=['openmc']) + packages=['openmc'], + scripts=[os.path.join('scripts', f) for f in os.listdir('scripts')])