Loading src/include/TransitionMatrix.h +86 −77 Original line number Original line Diff line number Diff line Loading @@ -27,19 +27,15 @@ class TransitionMatrix { class TransitionMatrix { protected: protected: //! Matrix type identifier. //! Matrix type identifier. int is; int _is; //! Maximum field expansion order. //! Maximum field expansion order. int l_max; int _l_max; //! Wave number in scale units. //! Wave number in scale units. double vk; double _vk; //! External medium refractive index. //! External medium refractive index. double exri; double _exri; //! Vectorized matrix elements. dcomplex *elements; //! Sphere radius. //! Sphere radius. double sphere_radius; double _sphere_radius; //! Matrix shape int *shape; /*! \brief Build transition matrix from a HDF5 binary input file. /*! \brief Build transition matrix from a HDF5 binary input file. * * Loading Loading @@ -78,15 +74,15 @@ class TransitionMatrix { * work for the case of a cluster of spheres. * work for the case of a cluster of spheres. * * * \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file. * \param _nlemt: `np_int` Size of the matrix (2 * LE * (LE + 2)). * \param nlemt: `np_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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _am0m: `complex double **` * \param am0m: `complex double **` */ */ static void write_hdf5( static void write_hdf5( const std::string& file_name, np_int _nlemt, int _lm, double _vk, const std::string& file_name, np_int nlemt, int lm, double vk, double _exri, dcomplex **_am0m double exri, dcomplex **am0m ); ); /*! \brief Write transition matrix data to HDF5 binary output. /*! \brief Write transition matrix data to HDF5 binary output. Loading @@ -97,16 +93,16 @@ class TransitionMatrix { * work for the case of a single sphere. * work for the case of a single sphere. * * * \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file. * \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. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _rmi: `complex double **` * \param rmi: `complex double **` * \param _rei: `complex double **` * \param rei: `complex double **` * \param _sphere_radius: `double` Radius of the sphere. * \param sphere_radius: `double` Radius of the sphere. */ */ static void write_hdf5( static void write_hdf5( const std::string& file_name, int _lm, double _vk, double _exri, const std::string& file_name, int lm, double vk, double exri, dcomplex **_rmi, dcomplex **_rei, double _sphere_radius dcomplex **rmi, dcomplex **rei, double sphere_radius ); ); /*! \brief Write the Transition Matrix to legacy binary output. /*! \brief Write the Transition Matrix to legacy binary output. Loading @@ -123,15 +119,15 @@ class TransitionMatrix { * the case of clusters of spheres. * the case of clusters of spheres. * * * \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file. * \param _nlemt: `np_int` Size of the matrix (2 * LE * (LE + 2)). * \param nlemt: `np_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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _am0m: `complex double **` * \param am0m: `complex double **` */ */ static void write_legacy( static void write_legacy( const std::string& file_name, np_int _nlemt, int _lm, double _vk, const std::string& file_name, np_int nlemt, int lm, double vk, double _exri, dcomplex **_am0m double exri, dcomplex **am0m ); ); /*! \brief Write transition matrix data to binary output using legacy format. /*! \brief Write transition matrix data to binary output using legacy format. Loading @@ -142,31 +138,45 @@ class TransitionMatrix { * to work for the case of a single sphere. * to work for the case of a single sphere. * * * \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file. * \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. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _rmi: `complex double **` * \param rmi: `complex double **` * \param _rei: `complex double **` * \param rei: `complex double **` * \param _sphere_radius: `double` Radius of the sphere. * \param radius: `double` Radius of the sphere. */ */ static void write_legacy( static void write_legacy( const std::string& file_name, int _lm, double _vk, double _exri, const std::string& file_name, int lm, double vk, double exri, dcomplex **_rmi, dcomplex **_rei, double _sphere_radius dcomplex **rmi, dcomplex **rei, double radius ); ); public: public: //! Read-only view on matrix type identifier. const int& is = _is; //! Read-only view on maximum field expansion order. const int& l_max = _l_max; //! Read-only view on wave number in scale units. const double& vk = _vk; //! Read-only view on external medium refractive index. const double& exri = _exri; //! Vectorized matrix elements. dcomplex *elements; //! Read-only view on sphere radius. const double& sphere_radius = _sphere_radius; //! Matrix shape int *shape; /*! \brief Default Transition Matrix instance constructor. /*! \brief Default Transition Matrix instance constructor. * * * \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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _elements: `complex double *` Vectorized elements of the matrix. * \param elems: `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). */ */ TransitionMatrix( TransitionMatrix( int _is, int _lm, double _vk, double _exri, dcomplex *_elements, int is, int lm, double vk, double exri, dcomplex *_elems, double radius=0.0 double _radius=0.0 ); ); /*! \brief Transition Matrix instance constructor for single sphere. /*! \brief Transition Matrix instance constructor for single sphere. Loading @@ -174,16 +184,15 @@ class TransitionMatrix { * This constructor allocates the memory structure needed to represent the transition * This constructor allocates the memory structure needed to represent the transition * matrix for the case of a single sphere. * 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. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _rmi: `complex double **` * \param rmi: `complex double **` * \param _rei: `complex double **` * \param rei: `complex double **` * \param _sphere_radius: `double` Radius of the sphere. * \param radius: `double` Radius of the sphere. */ */ TransitionMatrix( TransitionMatrix( int _lm, double _vk, double _exri, dcomplex **_rmi, int lm, double vk, double exri, dcomplex **rmi, dcomplex **rei, double radius dcomplex **_rei, double _sphere_radius ); ); /*! \brief Transition Matrix instance constructor for a cluster of spheres. /*! \brief Transition Matrix instance constructor for a cluster of spheres. Loading @@ -191,13 +200,13 @@ class TransitionMatrix { * This constructor allocates the memory structure needed to represent the transition * This constructor allocates the memory structure needed to represent the transition * matrix for the case of a cluster of spheres. * 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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _am0m: `complex double **` * \param am0m: `complex double **` */ */ TransitionMatrix(int _nlemt, int _lm, double _vk, double _exri, dcomplex **_am0m); TransitionMatrix(int nlemt, int lm, double vk, double exri, dcomplex **am0m); /*! \brief Transition Matrix instance destroyer. /*! \brief Transition Matrix instance destroyer. */ */ Loading Loading @@ -249,17 +258,17 @@ class TransitionMatrix { * depending on the requested output format. * depending on the requested output format. * * * \param file_name: `string` Name of the file to be written. * \param file_name: `string` Name of the file to be written. * \param _nlemt: `np_int` Size of the matrix (2 * LE * (LE + 2)). * \param nlemt: `np_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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _am0m: `complex double **` * \param am0m: `complex double **` * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * (default is "LEGACY"). * (default is "LEGACY"). */ */ static void write_binary( static void write_binary( const std::string& file_name, np_int _nlemt, int _lm, double _vk, const std::string& file_name, np_int nlemt, int lm, double vk, double _exri, dcomplex **_am0m, const std::string& mode="LEGACY" double exri, dcomplex **am0m, const std::string& mode="LEGACY" ); ); /*! \brief Write a single sphere Transition Matrix to a binary file without instanciating it. /*! \brief Write a single sphere Transition Matrix to a binary file without instanciating it. Loading @@ -276,18 +285,18 @@ class TransitionMatrix { * depending on the requested output format. * depending on the requested output format. * * * \param file_name: `string` Name of the file to be written. * \param file_name: `string` Name of the file to be written. * \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. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _rmi: `complex double **` * \param rmi: `complex double **` * \param _rei: `complex double **` * \param rei: `complex double **` * \param _sphere_radius: `double` Radius of the sphere. * \param sphere_radius: `double` Radius of the sphere. * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * (default is "LEGACY"). * (default is "LEGACY"). */ */ static void write_binary( static void write_binary( const std::string& file_name, int _lm, double _vk, double _exri, const std::string& file_name, int lm, double vk, double exri, dcomplex **_rmi, dcomplex **_rei, double _sphere_radius, dcomplex **rmi, dcomplex **rei, double sphere_radius, const std::string& mode="LEGACY" const std::string& mode="LEGACY" ); ); Loading src/libnptm/TransitionMatrix.cpp +140 −140 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
src/include/TransitionMatrix.h +86 −77 Original line number Original line Diff line number Diff line Loading @@ -27,19 +27,15 @@ class TransitionMatrix { class TransitionMatrix { protected: protected: //! Matrix type identifier. //! Matrix type identifier. int is; int _is; //! Maximum field expansion order. //! Maximum field expansion order. int l_max; int _l_max; //! Wave number in scale units. //! Wave number in scale units. double vk; double _vk; //! External medium refractive index. //! External medium refractive index. double exri; double _exri; //! Vectorized matrix elements. dcomplex *elements; //! Sphere radius. //! Sphere radius. double sphere_radius; double _sphere_radius; //! Matrix shape int *shape; /*! \brief Build transition matrix from a HDF5 binary input file. /*! \brief Build transition matrix from a HDF5 binary input file. * * Loading Loading @@ -78,15 +74,15 @@ class TransitionMatrix { * work for the case of a cluster of spheres. * work for the case of a cluster of spheres. * * * \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file. * \param _nlemt: `np_int` Size of the matrix (2 * LE * (LE + 2)). * \param nlemt: `np_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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _am0m: `complex double **` * \param am0m: `complex double **` */ */ static void write_hdf5( static void write_hdf5( const std::string& file_name, np_int _nlemt, int _lm, double _vk, const std::string& file_name, np_int nlemt, int lm, double vk, double _exri, dcomplex **_am0m double exri, dcomplex **am0m ); ); /*! \brief Write transition matrix data to HDF5 binary output. /*! \brief Write transition matrix data to HDF5 binary output. Loading @@ -97,16 +93,16 @@ class TransitionMatrix { * work for the case of a single sphere. * work for the case of a single sphere. * * * \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file. * \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. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _rmi: `complex double **` * \param rmi: `complex double **` * \param _rei: `complex double **` * \param rei: `complex double **` * \param _sphere_radius: `double` Radius of the sphere. * \param sphere_radius: `double` Radius of the sphere. */ */ static void write_hdf5( static void write_hdf5( const std::string& file_name, int _lm, double _vk, double _exri, const std::string& file_name, int lm, double vk, double exri, dcomplex **_rmi, dcomplex **_rei, double _sphere_radius dcomplex **rmi, dcomplex **rei, double sphere_radius ); ); /*! \brief Write the Transition Matrix to legacy binary output. /*! \brief Write the Transition Matrix to legacy binary output. Loading @@ -123,15 +119,15 @@ class TransitionMatrix { * the case of clusters of spheres. * the case of clusters of spheres. * * * \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file. * \param _nlemt: `np_int` Size of the matrix (2 * LE * (LE + 2)). * \param nlemt: `np_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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _am0m: `complex double **` * \param am0m: `complex double **` */ */ static void write_legacy( static void write_legacy( const std::string& file_name, np_int _nlemt, int _lm, double _vk, const std::string& file_name, np_int nlemt, int lm, double vk, double _exri, dcomplex **_am0m double exri, dcomplex **am0m ); ); /*! \brief Write transition matrix data to binary output using legacy format. /*! \brief Write transition matrix data to binary output using legacy format. Loading @@ -142,31 +138,45 @@ class TransitionMatrix { * to work for the case of a single sphere. * to work for the case of a single sphere. * * * \param file_name: `string` Name of the binary configuration data file. * \param file_name: `string` Name of the binary configuration data file. * \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. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _rmi: `complex double **` * \param rmi: `complex double **` * \param _rei: `complex double **` * \param rei: `complex double **` * \param _sphere_radius: `double` Radius of the sphere. * \param radius: `double` Radius of the sphere. */ */ static void write_legacy( static void write_legacy( const std::string& file_name, int _lm, double _vk, double _exri, const std::string& file_name, int lm, double vk, double exri, dcomplex **_rmi, dcomplex **_rei, double _sphere_radius dcomplex **rmi, dcomplex **rei, double radius ); ); public: public: //! Read-only view on matrix type identifier. const int& is = _is; //! Read-only view on maximum field expansion order. const int& l_max = _l_max; //! Read-only view on wave number in scale units. const double& vk = _vk; //! Read-only view on external medium refractive index. const double& exri = _exri; //! Vectorized matrix elements. dcomplex *elements; //! Read-only view on sphere radius. const double& sphere_radius = _sphere_radius; //! Matrix shape int *shape; /*! \brief Default Transition Matrix instance constructor. /*! \brief Default Transition Matrix instance constructor. * * * \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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _elements: `complex double *` Vectorized elements of the matrix. * \param elems: `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). */ */ TransitionMatrix( TransitionMatrix( int _is, int _lm, double _vk, double _exri, dcomplex *_elements, int is, int lm, double vk, double exri, dcomplex *_elems, double radius=0.0 double _radius=0.0 ); ); /*! \brief Transition Matrix instance constructor for single sphere. /*! \brief Transition Matrix instance constructor for single sphere. Loading @@ -174,16 +184,15 @@ class TransitionMatrix { * This constructor allocates the memory structure needed to represent the transition * This constructor allocates the memory structure needed to represent the transition * matrix for the case of a single sphere. * 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. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _rmi: `complex double **` * \param rmi: `complex double **` * \param _rei: `complex double **` * \param rei: `complex double **` * \param _sphere_radius: `double` Radius of the sphere. * \param radius: `double` Radius of the sphere. */ */ TransitionMatrix( TransitionMatrix( int _lm, double _vk, double _exri, dcomplex **_rmi, int lm, double vk, double exri, dcomplex **rmi, dcomplex **rei, double radius dcomplex **_rei, double _sphere_radius ); ); /*! \brief Transition Matrix instance constructor for a cluster of spheres. /*! \brief Transition Matrix instance constructor for a cluster of spheres. Loading @@ -191,13 +200,13 @@ class TransitionMatrix { * This constructor allocates the memory structure needed to represent the transition * This constructor allocates the memory structure needed to represent the transition * matrix for the case of a cluster of spheres. * 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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _am0m: `complex double **` * \param am0m: `complex double **` */ */ TransitionMatrix(int _nlemt, int _lm, double _vk, double _exri, dcomplex **_am0m); TransitionMatrix(int nlemt, int lm, double vk, double exri, dcomplex **am0m); /*! \brief Transition Matrix instance destroyer. /*! \brief Transition Matrix instance destroyer. */ */ Loading Loading @@ -249,17 +258,17 @@ class TransitionMatrix { * depending on the requested output format. * depending on the requested output format. * * * \param file_name: `string` Name of the file to be written. * \param file_name: `string` Name of the file to be written. * \param _nlemt: `np_int` Size of the matrix (2 * LE * (LE + 2)). * \param nlemt: `np_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` Wave number in scale units. * \param vk: `double` Wave number in scale units. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _am0m: `complex double **` * \param am0m: `complex double **` * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * (default is "LEGACY"). * (default is "LEGACY"). */ */ static void write_binary( static void write_binary( const std::string& file_name, np_int _nlemt, int _lm, double _vk, const std::string& file_name, np_int nlemt, int lm, double vk, double _exri, dcomplex **_am0m, const std::string& mode="LEGACY" double exri, dcomplex **am0m, const std::string& mode="LEGACY" ); ); /*! \brief Write a single sphere Transition Matrix to a binary file without instanciating it. /*! \brief Write a single sphere Transition Matrix to a binary file without instanciating it. Loading @@ -276,18 +285,18 @@ class TransitionMatrix { * depending on the requested output format. * depending on the requested output format. * * * \param file_name: `string` Name of the file to be written. * \param file_name: `string` Name of the file to be written. * \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. * \param _exri: `double` External medium refractive index. * \param exri: `double` External medium refractive index. * \param _rmi: `complex double **` * \param rmi: `complex double **` * \param _rei: `complex double **` * \param rei: `complex double **` * \param _sphere_radius: `double` Radius of the sphere. * \param sphere_radius: `double` Radius of the sphere. * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional * (default is "LEGACY"). * (default is "LEGACY"). */ */ static void write_binary( static void write_binary( const std::string& file_name, int _lm, double _vk, double _exri, const std::string& file_name, int lm, double vk, double exri, dcomplex **_rmi, dcomplex **_rei, double _sphere_radius, dcomplex **rmi, dcomplex **rei, double sphere_radius, const std::string& mode="LEGACY" const std::string& mode="LEGACY" ); ); Loading
src/libnptm/TransitionMatrix.cpp +140 −140 File changed.Preview size limit exceeded, changes collapsed. Show changes