Skip to content
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

Move documentation #5475

Merged
merged 3 commits into from
Jul 12, 2024
Merged
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
29 changes: 29 additions & 0 deletions .github/workflows/dispatch_opm_simulators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Dispatch to opm-python-documentation

on:
push:
branches: master
paths:
- 'python/docstrings_simulators.json'
pull_request:
branches: master
paths:
- 'python/docstrings_simulators.json'

jobs:
dispatch:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Send dispatch to opm-simulators
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
https://api.github.com/repos/${{ github.repository_owner }}/opm-python-documentation/dispatches \
-d '{"event_type":"docstrings_simulators_updated"}'
53 changes: 0 additions & 53 deletions .github/workflows/python_sphinx_docs.yml

This file was deleted.

45 changes: 25 additions & 20 deletions python/docstrings.json → python/docstrings_simulators.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,83 @@
{
"PyBlackOilSimulator":{
"type": "class",
"signature": "opm.simulators.BlackOilSimulator",
"doc": "The SummaryState class - this is where the current summary results of the simulator are stored.\nThe SummaryState class has methods to get hold of well, group and general variables."
},
"PyBlackOilSimulator_filename_constructor": {
"signature": "__init__(deck_filename: str) -> None",
"signature": "opm.simulators.BlackOilSimulator.__init__(deck_filename: str) -> None",
"doc": "Constructor using a deck file name.\n\n:param deck_filename: The file name of the deck to be used for the simulation.\n:type deck_filename: str"
},
"PyBlackOilSimulator_objects_constructor": {
"signature": "__init__(deck: Deck, state: EclipseState, schedule: Schedule, summary_config: SummaryConfig) -> None",
"signature": "opm.simulators.BlackOilSimulator.__init__(deck: Deck, state: EclipseState, schedule: Schedule, summary_config: SummaryConfig) -> None",
"doc": "Constructor using Deck, EclipseState, Schedule, and SummaryConfig objects.\n\n:param deck: Deck object.\n:type deck: Deck\n:param state: EclipseState object.\n:type state: EclipseState\n:param schedule: Schedule object.\n:type schedule: Schedule\n:param summary_config: SummaryConfig object.\n:type summary_config: SummaryConfig"
},
"advance": {
"signature": "advance(report_step: int) -> None",
"signature": "opm.simulators.BlackOilSimulator.advance(report_step: int) -> None",
"doc": "Advance the simulation to a specific report step.\n\n:param report_step: Target report step to advance to.\n:type report_step: int"
},
"checkSimulationFinished": {
"signature": "check_simulation_finished() -> bool",
"signature": "opm.simulators.BlackOilSimulator.check_simulation_finished() -> bool",
"doc": "Check if the simulation has finished.\n\n:return: True if the simulation is finished, False otherwise."
},
"currentStep": {
"signature": "current_step() -> int",
"signature": "opm.simulators.BlackOilSimulator.current_step() -> int",
"doc": "Get the current simulation step.\n\n:return: The current step number."
},
"getCellVolumes": {
"signature": "get_cell_volumes() -> NDArray[float]",
"signature": "opm.simulators.BlackOilSimulator.get_cell_volumes() -> NDArray[float]",
"doc": "Retrieve the cell volumes of the simulation grid.\n\n:return: An array of cell volumes.\n:type return: NDArray[float]"
},
"getDT": {
"signature": "get_dt() -> float",
"signature": "opm.simulators.BlackOilSimulator.get_dt() -> float",
"doc": "Get the timestep size of the last completed step.\n\n:return: Timestep size in days.\n:type return: float"
},
"getFluidStateVariable": {
"signature": "get_fluid_state_variable(name: str) -> NDArray[float]",
"signature": "opm.simulators.BlackOilSimulator.get_fluid_state_variable(name: str) -> NDArray[float]",
"doc": "Retrieve a fluid state variable for the simulation grid.\n\n:param name: The name of the variable. Valid names are 'pw' (pressure water), 'pg' (pressure gas), 'po' (pressure oil), 'rho_w' (density water), 'rho_g' (density gas), 'rho_o' (density oil)'Rs' (soultion gas-oil ratio), 'Rv' (volatile gas-oil ratio), 'Sw' (water saturation), 'Sg' (gas saturation), 'So' (oil saturation), and 'T' (temperature).\n:type name: str\n\n:return: An array of fluid state variables.\n:type return: NDArray[float]"
},
"getPorosity": {
"signature": "get_porosity() -> numpy.ndarray",
"signature": "opm.simulators.BlackOilSimulator.get_porosity() -> NDArray[float]",
"doc": "Retrieve the porosity values of the simulation grid.\n\n:return: An array of porosity values.\n:type return: numpy.ndarray"
},
"getPrimaryVarMeaning": {
"signature": "get_primary_var_meaning(variable: str) -> NDArray[int]",
"signature": "opm.simulators.BlackOilSimulator.get_primary_var_meaning(variable: str) -> NDArray[int]",
"doc": "Retrieve the primary variable meaning of the simulation grid.\n\n:param variable: The name of the variable. Valid names are 'pressure', 'water', 'gas', and 'brine'.\n:type variable: str\n\n:return: An array of primary variable meanings. See ``get_primary_variable_meaning_map()`` for more information.\n:type return: NDArray[int]"
},
"getPrimaryVarMeaningMap": {
"signature": "get_primary_var_meaning_map(variable: str) -> dict[str, int]",
"signature": "opm.simulators.BlackOilSimulator.get_primary_var_meaning_map(variable: str) -> dict[str, int]",
"doc": "Retrieve the primary variable meaning map for each primary variable.\n\n:param variable: The name of the variable. Valid names are 'pressure', 'water', 'gas', and 'brine'.\n:type variable: str\n\n:return: A dictionary of primary variable meanings. The keys are the primary variable meanings and the values are the corresponding integer codes. The integer codes are used to represent the primary variable meanings in the simulation grid. For variable name 'pressure', the valid keys are: 'Po', 'Pg', and 'Pw', for variable name 'water', the valid keys are: 'Sw', 'Rvw', 'Rsw', and 'Disabled', for variable name 'gas', the valid keys are: 'Sg', 'Rs', 'Rv', and 'Disabled', for variable name 'brine', the valid keys are: 'Cs', 'Sp', and 'Disabled'.\n:type return: dict[str, int]"
},
"getPrimaryVariable": {
"signature": "get_primary_variable(variable: str) -> NDArray[float]",
"signature": "opm.simulators.BlackOilSimulator.get_primary_variable(variable: str) -> NDArray[float]",
"doc": "Retrieve the primary variable's values for the simulation grid.\n\n:param variable: The name of the variable. Valid names are 'pressure', 'water', 'gas', and 'brine'.\n:type variable: str\n\n:return: An array of primary variable values. See ``get_primary_variable_meaning()`` for more information.\n:type return: NDArray[float]"
},
"run": {
"signature": "run() -> int",
"signature": "opm.simulators.BlackOilSimulator.run() -> int",
"doc": "Runs the simulation to completion with the provided deck file or previously set deck.\n\n:return: EXIT_SUCCESS if the simulation completes successfully."
},
"setPorosity": {
"signature": "set_porosity(array: NDArray[float]) -> None",
"signature": "opm.simulators.BlackOilSimulator.set_porosity(array: NDArray[float]) -> None",
"doc": "Set the porosity values for the simulation grid.\n\n:param array: An array of porosity values to be set.\n:type array: NDArray[float]"
},
"setPrimaryVariable": {
"signature": "set_primary_variable(variable: str, value: NDArray[float]) -> None",
"signature": "opm.simulators.BlackOilSimulator.set_primary_variable(variable: str, value: NDArray[float]) -> None",
"doc": "Set the primary variable's values for the simulation grid.\n\n:param variable: The name of the variable. Valid names are 'pressure', 'water', 'gas', and 'brine'.\n:type variable: str\n:param value: An array of primary variable values to be set. See ``get_primary_variable()`` for more information.\n:type value: NDArray[float]"
},
"setupMpi": {
"signature": "mpi_init(init: bool, finalize: bool) -> None",
"signature": "opm.simulators.BlackOilSimulator.mpi_init(init: bool, finalize: bool) -> None",
"doc": "Setup MPI for parallel simulation. This method should be called before any other method.\n:param init: Whether to call ``MPI_Init()`` or not.\n:param finalize:Whether to call ``MPI_Finalize()```when the simulator object goes out of scope.\n\n:return: None"
},
"step": {
"signature": "step() -> int",
"signature": "opm.simulators.BlackOilSimulator.step() -> int",
"doc": "Execute the next simulation report step.\n\n:return: Result of the simulation step."
},
"stepCleanup": {
"signature": "step_cleanup() -> int",
"signature": "opm.simulators.BlackOilSimulator.step_cleanup() -> int",
"doc": "Perform cleanup after the last simulation step.\n\n:return: EXIT_SUCCESS if cleanup is successful."
},
"stepInit": {
"signature": "step_init() -> int",
"signature": "opm.simulators.BlackOilSimulator.step_init() -> int",
"doc": "Initialize the simulation before taking the first report step. This method should be called before the first call to ``step()``\n\n:return: EXIT_SUCCESS if the initialization is successful."
}
}
}
41 changes: 0 additions & 41 deletions python/generate_docstring_hpp.py

This file was deleted.

11 changes: 8 additions & 3 deletions python/simulators/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
set(PYTHON_OPM_SIMULATORS_PACKAGE_PATH ${PROJECT_BINARY_DIR}/python/opm/simulators)

# Set the path to the input docstrings.json file and the output .hpp file
set(PYTHON_DOCSTRINGS_FILE "${PROJECT_SOURCE_DIR}/python/docstrings.json")
set(PYTHON_DOCSTRINGS_FILE "${PROJECT_SOURCE_DIR}/python/docstrings_simulators.json")
set(PYTHON_DOCSTRINGS_GENERATED_HPP "${PROJECT_BINARY_DIR}/python/PyBlackOilSimulatorDoc.hpp")
# Note: If the new find_package(Python3) is used in the top level CMakeLists.txt, the variable
# ${PYTHON_EXECUTABLE} is set there to ${Python3_EXECUTABLE}
#
# Command to run the Python script

find_file(PYTHON_GENERATE_DOCSTRINGS_PY generate_docstring_hpp.py
PATHS ${opm-common_DIR} ${opm-common_PYTHON_COMMON_DIR}
PATH_SUFFIXES python NO_DEFAULT_PATH REQUIRED)

add_custom_command(
OUTPUT ${PYTHON_DOCSTRINGS_GENERATED_HPP}
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${CMAKE_SOURCE_DIR}
${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/python/generate_docstring_hpp.py
${PYTHON_DOCSTRINGS_FILE} ${PYTHON_DOCSTRINGS_GENERATED_HPP}
${PYTHON_EXECUTABLE} ${PYTHON_GENERATE_DOCSTRINGS_PY}
${PYTHON_DOCSTRINGS_FILE} ${PYTHON_DOCSTRINGS_GENERATED_HPP} PYBLACKOILSIMULATORDOC_HPP "Opm::Pybind::DocStrings"
DEPENDS ${PYTHON_DOCSTRINGS_FILE}
COMMENT "Generating PyBlackOilSimulatorDoc.hpp from JSON file"
)
Expand Down
7 changes: 0 additions & 7 deletions python/sphinx_docs/Makefile

This file was deleted.

23 changes: 0 additions & 23 deletions python/sphinx_docs/README.md

This file was deleted.

55 changes: 0 additions & 55 deletions python/sphinx_docs/docs/conf.py

This file was deleted.

16 changes: 0 additions & 16 deletions python/sphinx_docs/docs/index.rst

This file was deleted.

4 changes: 0 additions & 4 deletions python/sphinx_docs/docs/introduction.rst

This file was deleted.

4 changes: 0 additions & 4 deletions python/sphinx_docs/docs/python.rst

This file was deleted.

Loading