Commit 80c8faa2 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Start transition to complex.h

parent 3f4e2807
Loading
Loading
Loading
Loading
+34 −32
Original line number Diff line number Diff line
/* Distributed under the terms of GPLv3 or later. See COPYING for details. */

/*! \file Commons.h
 *
 * \brief C++ porting of common data structures.
@@ -42,15 +44,15 @@ protected:
	int nlmmt;
public:
	//! \brief QUESTION: definition?
	std::complex<double> **rmi;
	dcomplex **rmi;
	//! \brief QUESTION: definition?
	std::complex<double> **rei;
	dcomplex **rei;
	//! \brief QUESTION: definition?
	std::complex<double> **w;
	dcomplex **w;
	//! \brief QUESTION: definition?
	std::complex<double> *fsas;
	dcomplex *fsas;
	//! \brief QUESTION: definition?
	std::complex<double> **vints;
	dcomplex **vints;
	//! \brief QUESTION: definition?
	double *sscs;
	//! \brief QUESTION: definition?
@@ -80,7 +82,7 @@ public:
	//! \brief Vector of numbers of spherical layers.
	int *nshl;
	//! \brief QUESTION: definition?
	std::complex<double> ***sas;
	dcomplex ***sas;

	/*! \brief C1 instance constructor.
	 *
@@ -105,13 +107,13 @@ class C2 {
	int nhspo;
public:
	//! \brief QUESTION: definition?
	std::complex<double> *ris;
	dcomplex *ris;
	//! \brief QUESTION: definition?
	std::complex<double> *dlri;
	dcomplex *dlri;
	//! \brief QUESTION: definition?
	std::complex<double> *dc0;
	dcomplex *dc0;
	//! \brief QUESTION: definition?
	std::complex<double> *vkt;
	dcomplex *vkt;
	//! Vector of scaled sizes. QUESTION: correct?
	double *vsz;

@@ -133,9 +135,9 @@ public:
class C3 {
public:
	//! \brief QUESTION: definition?
	std::complex<double> tfsas;
	dcomplex tfsas;
	//! \brief QUESTION: definition?
	std::complex<double> **tsas;
	dcomplex **tsas;
	//! \brief QUESTION: definition?
	double gcs;
	//! \brief QUESTION: definition?
@@ -210,35 +212,35 @@ protected:
	void allocate_vectors(C4 *c4);
public:
	//! \brief QUESTION: definition?
	std::complex<double> *vh;
	dcomplex *vh;
	//! \brief QUESTION: definition?
	std::complex<double> *vj0;
	dcomplex *vj0;
	//! \brief QUESTION: definition?
	std::complex<double> *vj;
	dcomplex *vj;
	//! \brief QUESTION: definition?
	std::complex<double> *vyhj;
	dcomplex *vyhj;
	//! \brief QUESTION: definition?
	std::complex<double> *vyj0;
	dcomplex *vyj0;
	//! \brief QUESTION: definition?
	std::complex<double> **am0m;
	dcomplex **am0m;
	//! \brief QUESTION: definition?
	std::complex<double> *vint;
	dcomplex *vint;
	//! \brief QUESTION: definition?
	std::complex<double> *vintm;
	dcomplex *vintm;
	//! \brief QUESTION: definition?
	std::complex<double> **vints;
	dcomplex **vints;
	//! \brief QUESTION: definition?
	std::complex<double> *vintt;
	dcomplex *vintt;
	//! \brief QUESTION: definition?
	std::complex<double> **fsac;
	dcomplex **fsac;
	//! \brief QUESTION: definition?
	std::complex<double> **sac;
	dcomplex **sac;
	//! \brief QUESTION: definition?
	std::complex<double> **fsacm;
	dcomplex **fsacm;
	//! \brief QUESTION: definition?
	double *scsc;
	//! \brief QUESTION: definition?
	std::complex<double> *scscp;
	dcomplex *scscp;
	//! \brief QUESTION: definition?
	double *ecsc;
	//! \brief QUESTION: definition?
@@ -246,11 +248,11 @@ public:
	//! \brief QUESTION: definition?
	double *scscm;
	//! \brief QUESTION: definition?
	std::complex<double> *ecscp;
	dcomplex *ecscp;
	//! \brief QUESTION: definition?
	std::complex<double> *scscpm;
	dcomplex *scscpm;
	//! \brief QUESTION: definition?
	std::complex<double> *ecscpm;
	dcomplex *ecscpm;
	//! \brief QUESTION: definition?
	double *v3j0;
	//! \brief QUESTION: definition?
@@ -296,11 +298,11 @@ protected:
	int sam_size_0;
public:
	//! \brief QUESTION: definition?
	std::complex<double> **gis;
	dcomplex **gis;
	//! \brief QUESTION: definition?
	std::complex<double> **gls;
	dcomplex **gls;
	//! \brief QUESTION: definition?
	std::complex<double> **sam;
	dcomplex **sam;

	/*! \brief C9 instance constructor.
	 *
+11 −9
Original line number Diff line number Diff line
/* Distributed under the terms of GPLv3 or later. See COPYING for details. */

/*! \file TransitionMatrix.h
 *
 * \brief Representation of the Transition Matrix.
@@ -19,7 +21,7 @@ class TransitionMatrix {
  //! External medium refractive index.
  double exri;
  //! Vectorized matrix elements.
  std::complex<double> *elements;
  dcomplex *elements;
  //! Sphere radius.
  double sphere_radius;
  //! Matrix shape
@@ -66,11 +68,11 @@ class TransitionMatrix {
   * \param _lm: `int` Maximum field expansion order.
   * \param _vk: `double` Wave number in scale units.
   * \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).
   */
  TransitionMatrix(
		   int _is, int _lm, double _vk, double _exri, std::complex<double> *_elements,
		   int _is, int _lm, double _vk, double _exri, dcomplex *_elements,
		   double _radius=0.0
  );

@@ -82,13 +84,13 @@ class TransitionMatrix {
   * \param _lm: `int` Maximum field expansion order.
   * \param _vk: `double` Wave number in scale units.
   * \param _exri: `double` External medium refractive index.
   * \param _rmi: Matrix of complex.
   * \param _rei: Matrix of complex.
   * \param _rmi: `complex double **`
   * \param _rei: `complex double **`
   * \param _sphere_radius: `double` Radius of the sphere.
   */
  TransitionMatrix(
		   int _lm, double _vk, double _exri, std::complex<double> **_rmi,
		   std::complex<double> **_rei, double _sphere_radius
		   int _lm, double _vk, double _exri, dcomplex **_rmi,
		   dcomplex **_rei, double _sphere_radius
  );

  /*! \brief Transition Matrix instance constructor for a cluster of spheres.
@@ -100,9 +102,9 @@ class TransitionMatrix {
   * \param _lm: `int` Maximum field expansion order.
   * \param _vk: `double` Wave number in scale units.
   * \param _exri: `double` External medium refractive index.
   * \param _am0m: Matrix of complex.
   * \param _am0m: `complex double **`
   */
  TransitionMatrix(int _nlemt, int _lm, double _vk, double _exri, std::complex<double> **_am0m);
  TransitionMatrix(int _nlemt, int _lm, double _vk, double _exri, dcomplex **_am0m);

  /*! \brief Transition Matrix instance destroyer.
   */
+4 −2
Original line number Diff line number Diff line
/* Distributed under the terms of GPLv3 or later. See COPYING for details. */

/*! \file algebraic.h
 *
 * \brief Declaration of algebraic functions with different call-backs.
@@ -23,12 +25,12 @@

/*! \brief Perform in-place matrix inversion.
 *
 * \param mat: Matrix of complex. The matrix to be inverted (must be a square matrix).
 * \param mat: `complex double **` The matrix to be inverted (must be a square matrix).
 * \param size: `lapack_int` The size of the matrix (i.e. the number of its rows or columns).
 * \param ier: `int &` Reference to an integer variable for returning a result flag.
 * \param max_size: `lapack_int` The maximum expected size (required by some call-backs,
 * optional, defaults to 0).
 */
void invert_matrix(std::complex<double> **mat, np_int size, int &ier, np_int max_size=0);
void invert_matrix(dcomplex **mat, np_int size, int &ier, np_int max_size=0);

#endif
+3 −1
Original line number Diff line number Diff line
/* Distributed under the terms of GPLv3 or later. See COPYING for details. */

/*! \file lapack_calss.h
 *
 * \brief C++ interface to LAPACK calls.
@@ -16,6 +18,6 @@
 * \param n: `lapack_int` The number of rows and columns of the [n x n] matrix.
 * \param jer: `int &` Reference to an integer return flag.
 */
void zinvert(std::complex<double> **mat, lapack_int n, int &jer);
void zinvert(dcomplex **mat, lapack_int n, int &jer);

#endif
+39 −39
Original line number Diff line number Diff line
/* Distributed under the terms of GPLv3 or later. See COPYING for details. */

/*! \file sph_subs.h
 *
 * \brief C++ porting of SPH functions and subroutines.
@@ -35,11 +37,11 @@ void aps(double ****zpv, int li, int nsph, C1 *c1, double sqk, double *gaps);
 * backward recurrence. This is the `CSPHJ` implementation of the `specfun` library.
 *
 * \param n: `int` Order of the function.
 * \param z: `complex<double>` Argument of the function.
 * \param z: `complex double` Argument of the function.
 * \param nm: `int &` Highest computed order.
 * \param csj: Vector of complex. The desired function \f$j\f$.
 * \param csj: `complex double *` The desired function \f$j\f$.
 */
void cbf(int n, std::complex<double> z, int &nm, std::complex<double> csj[]);
void cbf(int n, dcomplex z, int &nm, dcomplex *csj);

/*! \brief Clebsch-Gordan coefficients.
 *
@@ -56,10 +58,10 @@ double cg1(int lmpml, int mu, int l, int m);

/*! \brief Conjugate of a double precision complex number
 *
 * \param z: `complex<double>` The input complex number.
 * \return result: `complex<double>` The conjugate of the input number.
 * \param z: `complex double` The input complex number.
 * \return result: `complex double` The conjugate of the input number.
 */
std::complex<double> dconjg(std::complex<double> z);
dcomplex dconjg(dcomplex z);

/*! \brief Comute the continuous variation of the refractive index and of its radial derivative.
 *
@@ -95,11 +97,11 @@ void diel(int npntmo, int ns, int i, int ic, double vk, C1 *c1, C2 *c2);
 * \param c2: `C2 *` Pointer to a `C2` data structure.
 * \param jer: `int &` Reference to integer error code variable.
 * \param lcalc: `int &` Reference to integer variable recording the maximum expansion order accounted for.
 * \param arg: `complex<double> &`
 * \param arg: `complex double &`
 */
void dme(
	 int li, int i, int npnt, int npntts, double vk, double exdc, double exri,
	 C1 *c1, C2 *c2, int &jer, int &lcalc, std::complex<double> &arg
	 C1 *c1, C2 *c2, int &jer, int &lcalc, dcomplex &arg
);

/*! \brief Bessel function calculation control parameters.
@@ -118,11 +120,11 @@ double envj(int n, double x);
 * This function computes the Mueller Transformation Matrix, or Phase Matrix. See
 * Sec. 2.8.1 of Borghese, Denti & Saija (2007).
 *
 * \param vint: Vector of complex.
 * \param vint: `complex double *`
 * \param cmullr: `double **`
 * \param cmul: `double **`
 */
void mmulc(std::complex<double> *vint, double **cmullr, double **cmul);
void mmulc(dcomplex *vint, double **cmullr, double **cmul);

/*! \brief Starting point for Bessel function magnitude.
 *
@@ -168,14 +170,14 @@ void orunve(double *u1, double *u2, double *u3, int iorth, double torth);
 *
 * \param up: `double *`
 * \param un: `double *`
 * \param ylm: Vector of complex. Field polar spherical harmonics.
 * \param ylm: `complex double *` Field polar spherical harmonics.
 * \param inpol: `int` Incident field polarization type (0 - linear; 1 - circular).
 * \param lw: `int`
 * \param isq: `int`
 * \param c1: `C1 *` Pointer to a `C1` data structure.
 */
void pwma(
	  double *up, double *un, std::complex<double> *ylm, int inpol, int lw,
	  double *up, double *un, dcomplex *ylm, int inpol, int lw,
	  int isq, C1 *c1
);

@@ -189,14 +191,14 @@ void pwma(
 * \param li: `int` Maximum field expansion order.
 * \param nsph: `int` Number of spheres.
 * \param c1: `C1 *` Pointer to `C1` data structure.
 * \param tqse: Matrix of complex.
 * \param tqspe: Matrix of complex.
 * \param tqss: Matrix of complex.
 * \param tqsps: Matrix of complex.
 * \param tqse: `double **`
 * \param tqspe: `complex double **`
 * \param tqss: `double **`
 * \param tqsps: `complex double **`
 */
void rabas(
	   int inpol, int li, int nsph, C1 *c1, double **tqse, std::complex<double> **tqspe,
	   double **tqss, std::complex<double> **tqsps
	   int inpol, int li, int nsph, C1 *c1, double **tqse, dcomplex **tqspe,
	   double **tqss, dcomplex **tqsps
);

/*! \brief Real Bessel Function.
@@ -219,18 +221,17 @@ void rbf(int n, double x, int &nm, double sj[]);
 *
 * \param npntmo: `int`
 * \param step: `double`
 * \param dcc: `complex<double>`
 * \param dcc: `complex double`
 * \param x: `double &`
 * \param lpo: `int`
 * \param y1: `complex<double> &`
 * \param y2: `complex<double> &`
 * \param dy1: `complex<double> &`
 * \param dy2: `complex<double> &`
 * \param y1: `complex double &`
 * \param y2: `complex double &`
 * \param dy1: `complex double &`
 * \param dy2: `complex double &`
 */
void rkc(
	 int npntmo, double step, std::complex<double> dcc, double &x, int lpo,
	 std::complex<double> &y1, std::complex<double> &y2, std::complex<double> &dy1,
	 std::complex<double> &dy2
	 int npntmo, double step, dcomplex dcc, double &x, int lpo,
	 dcomplex &y1, dcomplex &y2, dcomplex &dy1, dcomplex &dy2
);

/*! \brief Transition layer radial function and derivative.
@@ -242,16 +243,15 @@ void rkc(
 * \param step: `double`
 * \param x: `double &`
 * \param lpo: `int`
 * \param y1: `complex<double> &`
 * \param y2: `complex<double> &`
 * \param dy1: `complex<double> &`
 * \param dy2: `complex<double> &`
 * \param y1: `complex double &`
 * \param y2: `complex double &`
 * \param dy1: `complex double &`
 * \param dy2: `complex double &`
 * \param c2: `C2 *` Pointer to a `C2` data structure.
 */
void rkt(
	 int npntmo, double step, double &x, int lpo, std::complex<double> &y1,
	 std::complex<double> &y2, std::complex<double> &dy1, std::complex<double> &dy2,
	 C2 *c2
	 int npntmo, double step, double &x, int lpo, dcomplex &y1,
	 dcomplex &y2, dcomplex &dy1, dcomplex &dy2, C2 *c2
);

/*! \brief Spherical Bessel functions.
@@ -262,9 +262,9 @@ void rkt(
 * \param n: `int` Order of the function (from 0 up).
 * \param x: `double` Argumento of the function (\f$x > 0\f$).
 * \param nm: `int &` Highest computed order.
 * \param sy: `double[]` The desired function \f$y\f$.
 * \param sy: `double *` The desired function \f$y\f$.
 */
void rnf(int n, double x, int &nm, double sy[]);
void rnf(int n, double x, int &nm, double *sy);

/*! \brief Spherical harmonics for given direction.
 *
@@ -276,11 +276,11 @@ void rnf(int n, double x, int &nm, double sy[]);
 * \param cosrph: `double` Cosine of direction's azimuth.
 * \param sinrph: `double` Sine of direction's azimuth.
 * \param ll: `int` L value expansion order.
 * \param ylm: Vector of complex. The requested spherical harmonics.
 * \param ylm: `complex double *` The requested spherical harmonics.
 */
void sphar(
	   double cosrth, double sinrth, double cosrph, double sinrph,
	   int ll, std::complex<double> *ylm
	   int ll, dcomplex *ylm
);

/*! \brief Compute scattering, absorption and extinction cross-sections.
@@ -288,14 +288,14 @@ void sphar(
 * This function computes the scattering, absorption and extinction cross-sections in terms
 * of Forward Scattering Amplitudes. See Sec. 4.2.1 in Borghese, Denti & Saija (2007).
 *
 * \param tfsas: `complex<double> &`
 * \param tfsas: `complex double &`
 * \param nsph: `int` Number of spheres.
 * \param lm: `int` Maximum field expansion order.
 * \param vk: `double` Wave number in scale units.
 * \param exri: `double` External medium refractive index.
 * \param c1: `C1 *` Pointer to a `C1` data structure.
 */
void sscr0(std::complex<double> &tfsas, int nsph, int lm, double vk, double exri, C1 *c1);
void sscr0(dcomplex &tfsas, int nsph, int lm, double vk, double exri, C1 *c1);

/*! \brief C++ Compute the scattering amplitude and the scattered field intensity.
 *
Loading