mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-21 06:25:30 -04:00
Automatic C++ doc generation (#3950)
Some checks failed
Tests and Coverage / filter-changes (push) Has been cancelled
dockerhub-publish-develop / main (push) Has been cancelled
dockerhub-publish-develop-dagmc-libmesh / main (push) Has been cancelled
dockerhub-publish-develop-dagmc / main (push) Has been cancelled
dockerhub-publish-develop-libmesh / main (push) Has been cancelled
Tests and Coverage / Python 3.13 (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Has been cancelled
Tests and Coverage / Python 3.14 (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Has been cancelled
Tests and Coverage / Python 3.14t (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=n, mpi=n, dagmc=n, libmesh=n, event=n (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=n, libmesh=n, event=n (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=n, mpi=y, dagmc=n, libmesh=n, event=n (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=n, libmesh=n, event=n (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=, libmesh=y, event= (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=, libmesh=, event=y (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=y, libmesh=, event= (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=, libmesh=y, event= (push) Has been cancelled
Tests and Coverage / coverage (push) Has been cancelled
Tests and Coverage / Check CI status (push) Has been cancelled
Some checks failed
Tests and Coverage / filter-changes (push) Has been cancelled
dockerhub-publish-develop / main (push) Has been cancelled
dockerhub-publish-develop-dagmc-libmesh / main (push) Has been cancelled
dockerhub-publish-develop-dagmc / main (push) Has been cancelled
dockerhub-publish-develop-libmesh / main (push) Has been cancelled
Tests and Coverage / Python 3.13 (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Has been cancelled
Tests and Coverage / Python 3.14 (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Has been cancelled
Tests and Coverage / Python 3.14t (omp=n, mpi=n, dagmc=, libmesh=, event= (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=n, mpi=n, dagmc=n, libmesh=n, event=n (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=n, libmesh=n, event=n (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=n, mpi=y, dagmc=n, libmesh=n, event=n (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=n, libmesh=n, event=n (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=, libmesh=y, event= (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=n, dagmc=, libmesh=, event=y (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=y, libmesh=, event= (push) Has been cancelled
Tests and Coverage / Python 3.12 (omp=y, mpi=y, dagmc=, libmesh=y, event= (push) Has been cancelled
Tests and Coverage / coverage (push) Has been cancelled
Tests and Coverage / Check CI status (push) Has been cancelled
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
796ae384b8
commit
db673b9acb
10 changed files with 76 additions and 38 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -25,6 +25,7 @@ examples/**/*.xml
|
|||
|
||||
# Documentation builds
|
||||
docs/build
|
||||
docs/doxygen/xml
|
||||
docs/source/_images/*.pdf
|
||||
docs/source/_images/*.aux
|
||||
docs/source/pythonapi/generated/
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ build:
|
|||
jobs:
|
||||
post_checkout:
|
||||
- git fetch --unshallow || true
|
||||
- cd docs/doxygen && doxygen && cd -
|
||||
|
||||
sphinx:
|
||||
configuration: docs/source/conf.py
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ help:
|
|||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
-rm -rf source/pythonapi/generated/
|
||||
-rm -rf doxygen/xml
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
|
|
|
|||
13
docs/doxygen/Doxyfile
Normal file
13
docs/doxygen/Doxyfile
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Doxyfile 1.9.1
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
|
||||
# Difference with default Doxyfile 1.9.1
|
||||
PROJECT_NAME = OpenMC
|
||||
QUIET = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
INPUT = ../../include/openmc/capi.h
|
||||
GENERATE_HTML = NO
|
||||
GENERATE_LATEX = NO
|
||||
GENERATE_XML = YES
|
||||
|
|
@ -46,43 +46,20 @@ Type Definitions
|
|||
Functions
|
||||
---------
|
||||
|
||||
.. c:function:: int openmc_calculate_volumes()
|
||||
..
|
||||
Once documentation is complete in capi.h, use:
|
||||
.. doxygenfile:: capi.h
|
||||
to populate this documentation without using
|
||||
.. doxygenfunction::
|
||||
for every function.
|
||||
|
||||
Run a stochastic volume calculation
|
||||
.. doxygenfunction:: openmc_calculate_volumes
|
||||
|
||||
:return: Return status (negative if an error occurred)
|
||||
:rtype: int
|
||||
.. doxygenfunction:: openmc_cell_get_fill
|
||||
|
||||
.. c:function:: int openmc_cell_get_fill(int32_t index, int* type, int32_t** indices, int32_t* n)
|
||||
.. doxygenfunction:: openmc_cell_get_id
|
||||
|
||||
Get the fill for a cell
|
||||
|
||||
:param int32_t index: Index in the cells array
|
||||
:param int* type: Type of the fill
|
||||
:param int32_t** indices: Array of material indices for cell
|
||||
:param int32_t* n: Length of indices array
|
||||
:return: Return status (negative if an error occurred)
|
||||
:rtype: int
|
||||
|
||||
.. c:function:: int openmc_cell_get_id(int32_t index, int32_t* id)
|
||||
|
||||
Get the ID of a cell
|
||||
|
||||
:param int32_t index: Index in the cells array
|
||||
:param int32_t* id: ID of the cell
|
||||
:return: Return status (negative if an error occurred)
|
||||
:rtype: int
|
||||
|
||||
.. c:function:: int openmc_cell_get_temperature(int32_t index, const int32_t* instance, double* T)
|
||||
|
||||
Get the temperature of a cell
|
||||
|
||||
:param int32_t index: Index in the cells array
|
||||
:param int32_t* instance: Which instance of the cell. If a null pointer is passed, the temperature
|
||||
of the first instance is returned.
|
||||
:param double* T: temperature of the cell
|
||||
:return: Return status (negative if an error occurred)
|
||||
:rtype: int
|
||||
.. doxygenfunction:: openmc_cell_get_temperature
|
||||
|
||||
.. c:function:: int openmc_cell_get_density(int32_t index, const int32_t* instance, double* density)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,10 @@
|
|||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
# Determine if we're on Read the Docs server
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
|
|
@ -37,6 +40,7 @@ sys.path.insert(0, os.path.abspath('../..'))
|
|||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = [
|
||||
'breathe',
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.napoleon',
|
||||
'sphinx.ext.autosummary',
|
||||
|
|
@ -47,6 +51,8 @@ extensions = [
|
|||
]
|
||||
if not on_rtd:
|
||||
extensions.append('sphinxcontrib.rsvgconverter')
|
||||
doxygen_dir = Path(__file__).parents[1] / 'doxygen'
|
||||
subprocess.run(['doxygen'], cwd=doxygen_dir, check=True)
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
|
@ -117,6 +123,11 @@ pygments_style = 'tango'
|
|||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# -- Options breathe + doxygen -------------------------------------------------
|
||||
|
||||
breathe_projects = {"OpenMC": "../doxygen/xml"}
|
||||
breathe_default_project = "OpenMC"
|
||||
breathe_domain_by_file_pattern = {"*capi.h": "c"}
|
||||
|
||||
# -- Options for HTML output ---------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ Python API. That is, from the root directory of the OpenMC repository:
|
|||
|
||||
python -m pip install ".[docs]"
|
||||
|
||||
The OpenMC documentation also uses Doxygen to automatically generate its
|
||||
C/C++ API documentation directly from the docstrings available in the source
|
||||
code. You will need to have a working installation of Doxygen to generate the
|
||||
documentation locally.
|
||||
|
||||
-----------------------------------
|
||||
Building Documentation as a Webpage
|
||||
-----------------------------------
|
||||
|
|
|
|||
|
|
@ -425,13 +425,13 @@ Each ``<dagmc_universe>`` element can have the following attributes or sub-eleme
|
|||
material) assignment. Required.
|
||||
|
||||
:temperature:
|
||||
Temperature(s) in [K] to assign to the cell. Must be ≥ 0. Multiple
|
||||
space-separated values may be given.
|
||||
Temperature(s) in [K] to assign to the cell. Must be greater than or equal
|
||||
to 0. Multiple space-separated values may be given.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:density:
|
||||
Density in [g/cm³] to assign to the cell. Must be > 0. Requires a non-void
|
||||
Density in [g/cm³] to assign to the cell. Must be greater than 0. Requires a non-void
|
||||
material fill. Multiple space-separated values may be given.
|
||||
|
||||
*Default*: None
|
||||
|
|
|
|||
|
|
@ -9,14 +9,41 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
//! Run a stochastic volume calculation
|
||||
//
|
||||
//! \return Status (negative if an error occurred)
|
||||
int openmc_calculate_volumes();
|
||||
|
||||
int openmc_cell_filter_get_bins(
|
||||
int32_t index, const int32_t** cells, int32_t* n);
|
||||
|
||||
//! Get the fill for a cell
|
||||
//
|
||||
//! \param index Index in the cells array
|
||||
//! \param type Type of the fill
|
||||
//! \param indices Array of material indices for cell
|
||||
//! \param n Length of indices array
|
||||
//! \return Status (negative if an error occurred)
|
||||
int openmc_cell_get_fill(
|
||||
int32_t index, int* type, int32_t** indices, int32_t* n);
|
||||
|
||||
//! Get the ID of a cell
|
||||
//
|
||||
//! \param index Index in the cells array
|
||||
//! \param id ID of the cell
|
||||
//! \return Status (negative if an error occurred)
|
||||
int openmc_cell_get_id(int32_t index, int32_t* id);
|
||||
|
||||
//! Get the temperature of a cell
|
||||
//
|
||||
//! \param index Index in the cells array
|
||||
//! \param instance Which instance of the cell. If a null pointer is
|
||||
//! passed, the temperature of the first instance is returned.
|
||||
//! \param T temperature of the cell
|
||||
//!\return Status (negative if an error occurred)
|
||||
int openmc_cell_get_temperature(
|
||||
int32_t index, const int32_t* instance, double* T);
|
||||
|
||||
int openmc_cell_get_density(
|
||||
int32_t index, const int32_t* instance, double* rho);
|
||||
int openmc_cell_get_translation(int32_t index, double xyz[]);
|
||||
|
|
@ -280,7 +307,7 @@ int openmc_zernike_filter_set_params(
|
|||
int openmc_particle_filter_get_bins(int32_t idx, int32_t bins[]);
|
||||
|
||||
//! Sets the mesh and energy grid for CMFD reweight
|
||||
//! \param[in] meshtyally_id id of CMFD Mesh Tally
|
||||
//! \param[in] meshtally_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
|
||||
void openmc_initialize_mesh_egrid(
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ dependencies = [
|
|||
[project.optional-dependencies]
|
||||
depletion-mpi = ["mpi4py"]
|
||||
docs = [
|
||||
"breathe",
|
||||
"sphinx",
|
||||
"sphinxcontrib-katex",
|
||||
"sphinx-numfig",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue