Modify openmc_find to return instance as well. Add C API docs

This commit is contained in:
Paul Romano 2017-07-04 14:33:18 -05:00
parent 68070b12ca
commit 9d456c3ff1
6 changed files with 157 additions and 17 deletions

View file

@ -4,15 +4,39 @@
C API
=====
.. c:function:: int openmc_find(double* xyz, int rtype)
.. c:function:: void openmc_calculate_voumes()
Return the ID of the cell/material containing a given point
Run a stochastic volume calculation
.. c:function:: int openmc_cell_set_temperature(int id, double T)
Set the temperature of a cell.
:param id: ID of the cell
:type id: int
:param T: Temperature in Kelvin
:type T: double
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: void openmc_finalize()
Finalize a simulation
.. c:function:: void openmc_find(double* xyz, int rtype, int* id, int* instance)
Determine the ID of the cell/material containing a given point
:param xyz: Cartesian coordinates
:type xyz: double[3]
:param rtype: Which ID to return (1=cell, 2=material)
:type rtype: int
:rtype: int
:param id: ID of the cell/material found. If a material is requested and the
point is in a void, the ID is 0. If an error occurs, the ID is -1.
:type id: int
:param instance: If a cell is repetaed in the geometry, the instance of the
cell that was found and zero otherwise.
:type instance: int
.. c:function:: void openmc_init(int intracomm)
@ -21,9 +45,54 @@ C API
:param intracomm: MPI intracommunicator
:type intracomm: int
.. c:function:: void openmc_finalize()
.. c:function:: int openmc_load_nuclide(char name[])
Finalize a simulation
Load data for a nuclide from the HDF5 data library.
:param name: Name of the nuclide.
:type name: char[]
:return: Return status (negative if an error occurs)
:rtype: int
.. c:function:: int openmc_material_add_nuclide(int id, char name[], double density)
Add a nuclide to an existing material. If the nuclide already exists, the
density is overwritten.
:param id: ID of the material
:type id: int
:param name: Name of the nuclide
:type name: char[]
:param density: Density in atom/b-cm
:type density: double
:return: Return status (negative if an error occurs)
:rtype: int
.. c:function:: int openmc_material_get_densities(int id, double* ptr)
Get an array of nuclide densities for a material.
:param id: ID of the material
:type id: int
:param ptr: Pointer to the array of densities
:type ptr: double*
:return: Length of the array
:rtype: int
.. c:function:: int openmc_material_set_density(int id, double density)
Set the density of a material.
:param id: ID of the material
:type id: int
:param density: Density of the material in atom/b-cm
:type density: double
:return: Return status (negative if an error occurs)
:rtype: int
.. c:function:: void openmc_plot_geometry()
Run plotting mode.
.. c:function:: void openmc_reset()
@ -32,3 +101,36 @@ C API
.. c:function:: void openmc_run()
Run a simulation
.. c:function:: int openmc_set_density(double xyz[3], double density)
Set the density of a material at a given point.
:param xyz: Cartesian coordinates
:type xyz: double[3]
:param density: Density of the material to set in atom/b-cm
:type density: double
:return: Return status (negative if an error occurs)
:rtype: int
.. c:function:: int openmc_set_temperature(double xyz[3], double T)
Set the density of a cell at a given point.
:param xyz: Cartesian coordinates
:type xyz: double[3]
:param T: Temperature of the cell to set in Kelvin
:type T: double
:return: Return status (negative if an error occurs)
:rtype: int
.. c:function:: void openmc_tally_results(int i, double** ptr, int shape_[3])
Get a pointer to tally results array.
:param i: Index in the tallies array
:type i: int
:param ptr: Pointer to the results array
:type ptr: double**
:param shape_: Shape of the results array
:type shape_: int[3]

View file

@ -0,0 +1,10 @@
---------------------------------------------------
:data:`openmc.capi` -- Python bindings to the C API
---------------------------------------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
openmc.capi.OpenMCLibrary

View file

@ -47,5 +47,6 @@ Modules
mgxs
model
data
capi
examples
openmoc