Skip to content
Snippets Groups Projects
Commit d9a85999 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Expand documentation for TransitionMatrix class

parent c0c4c3ab
No related branches found
No related tags found
No related merge requests found
...@@ -48,6 +48,9 @@ class TransitionMatrix { ...@@ -48,6 +48,9 @@ class TransitionMatrix {
int *shape; int *shape;
/*! \brief Build transition matrix from a HDF5 binary input file. /*! \brief Build transition matrix from a HDF5 binary input file.
*
* This function takes care of the specific task of building a transition
* matrix memory data structure from a HDF5 binary input file.
* *
* \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file.
* \return config: `TransitionMatrix *` Pointer to object containing the * \return config: `TransitionMatrix *` Pointer to object containing the
...@@ -64,6 +67,10 @@ class TransitionMatrix { ...@@ -64,6 +67,10 @@ class TransitionMatrix {
static TransitionMatrix *from_legacy(std::string file_name); static TransitionMatrix *from_legacy(std::string file_name);
/*! \brief Write the Transition Matrix to HDF5 binary output. /*! \brief Write the Transition Matrix to HDF5 binary output.
*
* This function takes care of the specific task of building a transition
* matrix memory data structure from a binary input file formatted according
* to the structure used by the original FORTRAN code.
* *
* \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file.
*/ */
...@@ -79,8 +86,8 @@ class TransitionMatrix { ...@@ -79,8 +86,8 @@ class TransitionMatrix {
* *
* \param _is: `int` Matrix type identifier * \param _is: `int` Matrix type identifier
* \param _lm: `int` Maximum field expansion order. * \param _lm: `int` Maximum field expansion order.
* \param _vk: `double` * \param _vk: `double` Wave number in scale units.
* \param _exri: `double` * \param _exri: `double` External medium refractive index.
* \param _elements: `complex<double> *` Vectorized elements of the matrix. * \param _elements: `complex<double> *` Vectorized elements of the matrix.
* \param _radius: `double` Radius for the single sphere case (defaults to 0.0). * \param _radius: `double` Radius for the single sphere case (defaults to 0.0).
*/ */
...@@ -90,6 +97,9 @@ class TransitionMatrix { ...@@ -90,6 +97,9 @@ class TransitionMatrix {
); );
/*! \brief Transition Matrix instance constructor for single sphere. /*! \brief Transition Matrix instance constructor for single sphere.
*
* This constructor allocates the memory structure needed to represent the transition
* matrix for the case of a single sphere.
* *
* \param _lm: `int` Maximum field expansion order. * \param _lm: `int` Maximum field expansion order.
* \param _vk: `double` Wave number in scale units. * \param _vk: `double` Wave number in scale units.
...@@ -104,11 +114,14 @@ class TransitionMatrix { ...@@ -104,11 +114,14 @@ class TransitionMatrix {
); );
/*! \brief Transition Matrix instance constructor for a cluster of spheres. /*! \brief Transition Matrix instance constructor for a cluster of spheres.
*
* This constructor allocates the memory structure needed to represent the transition
* matrix for the case of a cluster of spheres.
* *
* \param _nlemt: `int` Size of the matrix (2 * LE * (LE + 2)). * \param _nlemt: `int` Size of the matrix (2 * LE * (LE + 2)).
* \param _lm: `int` Maximum field expansion order. * \param _lm: `int` Maximum field expansion order.
* \param _vk: `double` * \param _vk: `double` Wave number in scale units.
* \param _exri: `double` * \param _exri: `double` External medium refractive index.
* \param _am0m: Matrix of complex. * \param _am0m: Matrix of complex.
*/ */
TransitionMatrix(int _nlemt, int _lm, double _vk, double _exri, std::complex<double> **_am0m); TransitionMatrix(int _nlemt, int _lm, double _vk, double _exri, std::complex<double> **_am0m);
...@@ -118,6 +131,14 @@ class TransitionMatrix { ...@@ -118,6 +131,14 @@ class TransitionMatrix {
~TransitionMatrix(); ~TransitionMatrix();
/*! \brief Build transition matrix from binary input file. /*! \brief Build transition matrix from binary input file.
*
* In some cases, it is necessary to perform calculations starting from a pre-computed
* transition matrix. If this matrix is not available in memory (e.g. because it was
* calculated by a different process), but it was saved in a binary file, this function
* can be used to load it back in memory. The function operates in two modes: "LEGACY",
* which reads the matrix data from a proprietary binary file, having the same structure
* as the one used by the original FORTRAN code, and "HDF5", which, instead, reads the
* data from an input file complying with the HDF5 format.
* *
* \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file.
* \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"]. Optional * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"]. Optional
...@@ -128,6 +149,12 @@ class TransitionMatrix { ...@@ -128,6 +149,12 @@ class TransitionMatrix {
static TransitionMatrix* from_binary(std::string file_name, std::string mode="LEGACY"); static TransitionMatrix* from_binary(std::string file_name, std::string mode="LEGACY");
/*! \brief Write the Transition Matrix to a binary file. /*! \brief Write the Transition Matrix to a binary file.
*
* This function writes a hard-copy of the transition matrix to an output file, making
* it available for subsequent processes to reload. The function operates in two modes:
* "LEGACY", which writes a proprietary binary file, using the same structure of the
* original FORTRAN code, and "HDF5", which, instead, writes the output to a file using
* the HDF5 format, thus leaving it available for inspection with external tools.
* *
* \param file_name: `string` Name of the file to be written. * \param file_name: `string` Name of the file to be written.
* \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment