From 5adc3b5816fe33adc17f8656fe3a731196f3ca7f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 7 Aug 2019 09:13:14 -0500 Subject: [PATCH] Document special and abstract methods for Integrators --- docs/source/_templates/myintegrator.rst | 9 +++++++++ docs/source/pythonapi/deplete.rst | 15 +++++++++++++-- openmc/deplete/integrator/abc.py | 4 +++- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 docs/source/_templates/myintegrator.rst diff --git a/docs/source/_templates/myintegrator.rst b/docs/source/_templates/myintegrator.rst new file mode 100644 index 000000000..803dfde06 --- /dev/null +++ b/docs/source/_templates/myintegrator.rst @@ -0,0 +1,9 @@ +{{ fullname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :members: + :inherited-members: + :special-members: __call__, __len__, __iter__ diff --git a/docs/source/pythonapi/deplete.rst b/docs/source/pythonapi/deplete.rst index f2964c5c8..dc95c7821 100644 --- a/docs/source/pythonapi/deplete.rst +++ b/docs/source/pythonapi/deplete.rst @@ -14,7 +14,7 @@ transport-depletion coupling algorithms `_. .. autosummary:: :toctree: generated :nosignatures: - :template: myclassinherit.rst + :template: myintegrator.rst integrator.PredictorIntegrator integrator.CECMIntegrator @@ -95,7 +95,18 @@ The following classes are abstract classes that can be used to extend the EnergyHelper TransportOperator -Each of the integrator functions also relies on a number of "helper" functions +Custom integrators can be developed by subclassing from the following abstract +base classes: + +.. autosummary:: + :toctree: generated + :nosignatures: + :template: myintegrator.rst + + Integrator + SIIntegrator + +Each of the integrator classes also relies on a number of "helper" functions as follows: .. autosummary:: diff --git a/openmc/deplete/integrator/abc.py b/openmc/deplete/integrator/abc.py index 53db536aa..cceb6ccc3 100644 --- a/openmc/deplete/integrator/abc.py +++ b/openmc/deplete/integrator/abc.py @@ -118,9 +118,11 @@ class Integrator(ABC): """ def __iter__(self): + """Return pairs of time steps in [s] and powers in [W]""" return zip(self.timesteps, self.power) def __len__(self): + """Return integer number of depletion intervals""" return len(self.timesteps) def _get_bos_data_from_operator(self, step_index, step_power, bos_conc): @@ -180,7 +182,7 @@ class Integrator(ABC): class SIIntegrator(Integrator): - """Abstract for the Stochastic Implicit Euler integrators + """Abstract class for the Stochastic Implicit Euler integrators Does not provide a ``__call__`` method, but scales and resets the number of particles used in initial transport calculation