SKIRT: the design of a suite of input models for Monte Carlo radiative
  transfer simulations
  The Monte Carlo method is the most popular technique to perform radiative
transfer simulations in a general 3D geometry. The algorithms behind and
acceleration techniques for Monte Carlo radiative transfer are discussed
extensively in the literature, and many different Monte Carlo codes are
publicly available. On the contrary, the design of a suite of components that
can be used for the distribution of sources and sinks in radiative transfer
codes has received very little attention. The availability of such models, with
different degrees of complexity, has many benefits. For example, they can serve
as toy models to test new physical ingredients, or as parameterised models for
inverse radiative transfer fitting. For 3D Monte Carlo codes, this requires
algorithms to efficiently generate random positions from 3D density
distributions. We describe the design of a flexible suite of components for the
Monte Carlo radiative transfer code SKIRT. The design is based on a combination
of basic building blocks (which can be either analytical toy models or
numerical models defined on grids or a set of particles) and the extensive use
of decorators that combine and alter these building blocks to more complex
structures. For a number of decorators, e.g. those that add spiral structure or
clumpiness, we provide a detailed description of the algorithms that can be
used to generate random positions. Advantages of this decorator-based design
include code transparency, the avoidance of code duplication, and an increase
in code maintainability. Moreover, since decorators can be chained without
problems, very complex models can easily be constructed out of simple building
blocks. Finally, based on a number of test simulations, we demonstrate that our
design using customised random position generators is superior to a simpler
design based on a generic black-box random position generator.
