From 33b7dcfe22a268ae22773888f50eddcc22ea0031 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 23 Oct 2020 13:46:57 -0500 Subject: [PATCH] Update documentation regarding custom sources --- docs/source/io_formats/settings.rst | 2 +- docs/source/usersguide/settings.rst | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/source/io_formats/settings.rst b/docs/source/io_formats/settings.rst index 09d7db123..588b58b47 100644 --- a/docs/source/io_formats/settings.rst +++ b/docs/source/io_formats/settings.rst @@ -465,7 +465,7 @@ attributes/sub-elements: as complex as is required to define the source for your problem. The library has a few basic requirements: - * It must contain a class that inherits from ``openmc::CustomSource``; + * It must contain a class that inherits from ``openmc::Source``; * The class must implement a function called ``sample()``; * There must be an ``openmc_create_source()`` function that creates the source as a unique pointer. This function can be used to pass parameters through to diff --git a/docs/source/usersguide/settings.rst b/docs/source/usersguide/settings.rst index 340d4af00..1d1403874 100644 --- a/docs/source/usersguide/settings.rst +++ b/docs/source/usersguide/settings.rst @@ -194,7 +194,7 @@ below. #include "openmc/source.h" #include "openmc/particle.h" - class Source : public openmc::CustomSource + class CustomSource : public openmc::Source { openmc::Particle::Bank sample(uint64_t* seed) { @@ -216,16 +216,16 @@ below. } }; - extern "C" std::unique_ptr openmc_create_source(std::string parameters) + extern "C" std::unique_ptr openmc_create_source(std::string parameters) { - return std::make_unique(); + return std::make_unique(); } The above source creates monodirectional 14.08 MeV neutrons that are distributed in a ring with a 3 cm radius. This routine is not particularly complex, but should serve as an example upon which to build more complicated sources. - .. note:: The source class must inherit from ``openmc::CustomSource`` and + .. note:: The source class must inherit from ``openmc::Source`` and implement a ``sample()`` function. .. note:: The ``openmc_create_source()`` function signature must be declared @@ -266,9 +266,9 @@ the source class when it is created: #include "openmc/source.h" #include "openmc/particle.h" - class Source : public openmc::CustomSource { + class CustomSource : public openmc::Source { public: - Source(double energy) : energy_{energy} { } + CustomSource(double energy) : energy_{energy} { } // Samples from an instance of this class. openmc::Particle::Bank sample(uint64_t* seed) @@ -293,9 +293,9 @@ the source class when it is created: double energy_; }; - extern "C" std::unique_ptr openmc_create_source(std::string parameter) { + extern "C" std::unique_ptr openmc_create_source(std::string parameter) { double energy = std::stod(parameter); - return std::make_unique(energy); + return std::make_unique(energy); } As with the basic custom source functionality, the custom source library