Commit 3a486d56 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Use separate classes for different application outputs

parent dbf62fed
Loading
Loading
Loading
Loading
+318 −106
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

/*! \file outputs.h
 *
 * \brief Definition of the logging system.
 * \brief Definition of the output format system.
 */
#ifndef INCLUDE_OUTPUTS_H_
#define INCLUDE_OUTPUTS_H_
@@ -26,147 +26,359 @@
//! \brief Cluster output type identifier.
#define OUT_CLST 1
//! \brief Inclusion output type identifier.
#define OUT_INCL 3
#define OUT_INCL 2
//! \brief Single sphere output type identifier.
#define OUT_SPHR 4
#define OUT_SPHR 3

/*! \brief Class to collect output information for scattering problems.
/*! \brief Class to collect output information for scattering from clusters.
 *
 * The results of the calculation can be saved in different formats.
 * It is therefore convenient to have a proper memory structure that
 * allows for storing the results and flushing them in any of the
 * permitted formats with just one operation. The purpose of the
 * `ScatteringOutputInfo` class is to provide a common wrapper for
 * the output of different scattering solvers.
 * `ClusterOutputInfo` class is to provide a wrapper for the output
 * of the cluster scattering solver.
 */
class ScatteringOutputInfo {
class ClusterOutputInfo {
protected:
  //! \brief Number of scales included in the output.
  int _xi_length;
  
public:
  //! \brief Number of spheres in the aggregate.
  int _nsph;
  int nsph;
  //! \brief Maximum internal field expansion order.
  int _li;
  int li;
  //! \brief Maximum external field expansion order.
  int _le;
  int le;
  //! \brief Maximum field expansion order.
  int _lm;
  int lm;
  //! \brief Maximum coefficient matrix dimension.
  np_int _mxndm;
  np_int mxndm;
  //! \brief Incident polarization flag.
  int _inpol;
  int inpol;
  //! \brief Number of points for transition layer integration.
  int _npnt;
  int npnt;
  //! \brief Number of points for non-transition layer integration.
  int _npntts;
  int npntts;
  //! \brief Flag for intensity.
  int _iavm;
  int iavm;
  //! \brief Flag for reference to meridional plane.
  int _isam;
  //! \brief Type of output represented.
  short _out_type;
  int isam;
  //! \brief Vector of spherical components X Cartesian coordinates.
  double *_coords_x;
  double *vec_x_coords;
  //! \brief Vector of spherical components Y Cartesian coordinates.
  double *_coords_y;
  double *vec_y_coords;
  //! \brief Vector of spherical components Z Cartesian coordinates.
  double *_coords_z;
  double *vec_z_coords;
  //! \brief First incident radiation azimuth angle.
  double _th;
  double th;
  //! \brief Incident radiation azimuth angle step.
  double _thstp;
  double thstp;
  //! \brief Last incident radiation azimuth angle.
  double _thlst;
  double thlst;
  //! \brief First scattered radiation azimuth angle.
  double _ths;
  double ths;
  //! \brief Scattered radiation azimuth angle step.
  double _thsstp;
  double thsstp;
  //! \brief Last scattered radiation azimuth angle.
  double _thslst;
  double thslst;
  //! \brief First incident radiation elevation angle.
  double _ph;
  double ph;
  //! \brief Incident radiation elevation angle step.
  double _phstp;
  double phstp;
  //! \brief Last incident radiation elevation angle.
  double _phlst;
  double phlst;
  //! \brief First scattered radiation elevation angle.
  double _phs;
  double phs;
  //! \brief Scattered radiation elevation angle step.
  double _phsstp;
  double phsstp;
  //! \brief Last scattered radiation elevation angle.
  double _phslst;

 public:
  //! \brief Read only view on number of spheres.
  const int& nsph = _nsph;
  //! \brief Read only view on maximum internal field expansion order.
  const int& li = _li;
  //! \brief Read only view on maximum external field expansion order.
  const int& le = _le;
  //! \brief Read only view on maximum field expansion order.
  const int& lm = _lm;
  //! \brief Read only view on maximum coefficient matrix dimesnion.
  const np_int& mxndm = _mxndm;
  //! \brief Read only view on incident field polarization flag.
  const int& inpol = _inpol;
  //! \brief Read only view on number of points for transition layer integration.
  const int& npnt = _npnt;
  //! \brief Read only view on number of points for non-transition layer integration.
  const int& npntts = _npntts;
  //! \brief Read only view on intensity flag.
  const int& iavm = _iavm;
  //! \brief Read only view on meridional plane reference flag.
  const int& isam = _isam;
  //! \brief Read only view on type of output represented.
  const short& out_type = _out_type;
  //! \brief Read only view on first incident radiation azimuth angle.
  const double& th = _th;
  //! \brief Read only view on incident radiation azimuth angle step.
  const double& thstp = _thstp;
  //! \brief Read only view on last incident radiation azimuth angle.
  const double& thlst = _thlst;
  //! \brief Read only view on first scattered radiation azimuth angle.
  const double& ths = _ths;
  //! \brief Read only view on scattered radiation azimuth angle step.
  const double& thsstp = _thsstp;
  //! \brief Read only view on last scattered radiation azimuth angle.
  const double& thslst = _thslst;
  //! \brief Read only view on first incident radiation elevation angle.
  const double& ph = _ph;
  //! \brief Read only view on incident radiation elevation angle step.
  const double& phstp = _phstp;
  //! \brief Read only view on last incident radiation elevation angle.
  const double& phlst = _phlst;
  //! \brief Read only view on first scattered radiation elevation angle.
  const double& phs = _phs;
  //! \brief Read only view on scattered radiation elevation angle step.
  const double& phsstp = _phsstp;
  //! \brief Read only view on last scattered radiation elevation angle.
  const double& phslst = _phslst;
  double phslst;
  //! \brief Number of computed directions.
  int num_angles;
  //! \brief Refractive index of external medium.
  double exri;
  //! \brief Number of scales (wavelengths)
  int nxi;
  //! \brief Number of scales handled by the current process.
  int xi_block_size;
  //! \brief Number of directions to be explicitly solved.
  int ndirs;
  //! \brief Index of the wavelength for T-matrix output.
  int jwtm;
  //! \brief Vector of scale (wavelength) indices.
  int *vec_jxi;
  //! \brief Vector of vacuum wave numbers.
  double *vec_vk;
  //! \brief Vector of computed scales.
  double *vec_xi;
  //! \brief Number of sphere configurations.
  int configurations;
  //! \brief Vector of sphere sizes.
  double *vec_sphere_sizes;
  //! \brief Sphere sizes arranged for scale (rows) and configurations (columns).
  double **sphere_sizes;
  //! \brief Vector of sphere refractive indices.
  dcomplex *vec_sphere_ref_indices;
  //! \brief Sphere refractive indices arranged for scale (rows) and configurations (columns).
  dcomplex **sphere_ref_indices;
  //! \brief Vector of sphere scattering cross-sections.
  double *vec_sphere_scs;
  //! \brief Sphere scattering cross-sections for scale (rows) and configurations (columns).
  double **sphere_scs;
  //! \brief Vector of sphere absorption cross-sections.
  double *vec_sphere_abs;
  //! \brief Sphere scattering cross-sections for scale (rows) and configurations (columns).
  double **sphere_scs;
  //! \brief Vector of sphere extinction cross-sections.
  double *vec_sphere_exs;
  //! \brief Sphere extinction cross-sections for scale (rows) and configurations (columns).
  double **sphere_exs;
  //! \brief Vector of sphere albedos.
  double *vec_sphere_albs;
  //! \brief Sphere albedos for scale (rows) and configurations (columns).
  double **sphere_albeds;
  //! \brief Sphere geometric cross-sections for configurations.
  double *gs;
  //! \brief Vector of sphere forward scattering amplitudes.
  dcomplex *vec_fsas;
  //! \brief Sphere forward scattering amplitudes for scale (rows) and configuration (columns).
  dcomplex **fsas;
  //! \brief Vector of QSCHU = 4 pi IMAG(FSAS) / TOTAL_GEOM_SECTION.
  dcomplex *vec_qschus;
  //! \brief Sphere QSCHU for scale (rows) and configuration (columns).
  dcomplex **qschus;
  //! \brief Vector of PSCHU = 4 pi REAL(FSAS) / TOTAL_GEOM_SECTION.
  dcomplex *vec_pschus;
  //! \brief Sphere PSCHU for scale (rows) and configuration (columns).
  dcomplex **pschus;
  //! \brief Vector of S0MAG = ABS(FSAS) / (4 pi k^3).
  dcomplex *vec_s0mags;
  //! \brief Sphere S0MAG for scale (rows) and configuration (columns).
  dcomplex **s0mags;
  //! \brief Vector of asymmetry parameters.
  dcomplex *vec_cosavs;
  //! \brief Sphere asymmetry parameters for scale (rows) and configuration (columns).
  dcomplex **cosavs;
  //! \brief Vector of extinction contributions to radiation torques along k for parallel linear polarization.
  dcomplex *vec_tqek1;
  //! \brief Sphere extinction contributions to radiation torques along k for parallel linear polarization (scales along rows, configurations along columns).
  dcomplex **tqek1;
  //! \brief Vector of scattering contributions to radiation torques along k for parallel linear polarization.
  dcomplex *vec_tqsk1;
  //! \brief Sphere scattering contributions to radiation torques along k for parallel linear polarization (scales along rows, configurations along columns).
  dcomplex **tqsk1;
  //! \brief Vector of extinction contributions to radiation torques along k for perpendicular linear polarization.
  dcomplex *vec_tqek2;
  //! \brief Sphere extinction contributions to radiation torques along k for perpendicular linear polarization (scales along rows, configurations along columns).
  dcomplex **tqek2;
  //! \brief Vector of scattering contributions to radiation torques along k for perpendicular linear polarization.
  dcomplex *vec_tqsk2;
  //! \brief Sphere scattering contributions to radiation torques along k for perpendicular linear polarization (scales along rows, configurations along columns).
  dcomplex **tqsk2;
  //! \brief Vector of total forward scattering amplitudes.
  dcomplex *vec_fsat;
  //! \brief Vector of total QSCHU.
  double *vec_qschut;
  //! \brief Vector of total PSCHU.
  double *vec_pschut;
  //! \brief Vector of total S0MAG.
  double *vec_s0magt;
  //! \brief Total geometric section.
  double tgs;
  //! \brief Vector of cluster scattering cross-sections.
  double *vec_scc;
  //! \brief Cluster scattering cross-sections for scales (rows) and polarization (columns)
  double **scc;
  //! \brief Vector of cluster absorption cross-sections.
  double *vec_abc;
  //! \brief Cluster absorption cross-sections for scales (rows) and polarization (columns)
  double **abc;
  //! \brief Vector of cluster extinction cross-sections.
  double *vec_exc;
  //! \brief Cluster extinction cross-sections for scales (rows) and polarization (columns)
  double **exc;
  //! \brief Vector of cluster albedos.
  double *vec_albedc;
  //! \brief Cluster albedos for scales (rows) and polarization (columns)
  double **albedc;
  //! \brief Vector of cluster-to-sum-of-spheres scattering cross-section ratios.
  double *vec_sccrt;
  //! \brief Cluster-to-sum-of-spheres scattering cross-section ratios for scales (rows) and polarization (columns).
  double **sccrt;
  //! \brief Vector of cluster-to-sum-of-spheres absorption cross-section ratios.
  double *vec_abcrt;
  //! \brief Cluster-to-sum-of-spheres absorption cross-section ratios for scales (rows) and polarization (columns).
  double **abcrt;
  //! \brief Vector of cluster-to-sum-of-spheres extinction cross-section ratios.
  double *vec_excrt;
  //! \brief Cluster-to-sum-of-spheres extinction cross-section ratios for scales (rows) and polarization (columns).
  double **excrt;
  //! \brief Vector of forward scattering amplitudes for polarization parallel to incidence.
  dcomplex *vec_fsac11;
  //! \brief Vector of forward scattering amplitudes for polarization perpendicular to incidence.
  dcomplex *vec_fsac21;
  //! \brief Vector of forward scattering amplitudes for polarization parallel to incidence.
  dcomplex *vec_fsac22;
  //! \brief Vector of forward scattering amplitudes for polarization perpendicular to incidence.
  dcomplex *vec_fsac12;
  //! \brief Vector of cluster QSCHU.
  dcomplex *vec_qschuc;
  //! \brief Cluster QSCHU for scales (rows) and polarization (columns).
  dcomplex **qschuc;
  //! \brief Vector of cluster PSCHU.
  dcomplex *vec_pschuc;
  //! \brief Cluster PSCHU for scales (rows) and polarization (columns).
  dcomplex **pschuc;
  //! \brief Vector of cluster S0MAG.
  dcomplex *vec_s0magc;
  //! \brief Cluster S0MAG for scales (rows) and polarization (columns).
  dcomplex **s0magc;
  //! \brief Vector of cluster asymmetry parameters.
  dcomplex *vec_cosavc;
  //! \brief Cluster asymmetry parameters for scales (rows) and polarization (columns).
  dcomplex **cosavc;
  //! \brief Vector of optical forces along incidence direction [N].
  dcomplex *vec_fkc;
  //! \brief Optical forces along incidence direction for scales (rows) and polarization (columns).
  dcomplex **fkc;
  //! \brief Vector of incidence azimuth directions.
  double *vec_dir_tidg;
  //! \brief Vector of incidence elevation directions.
  double *vec_dir_pidg;
  //! \brief Vector of scattering azimuth directions.
  double *vec_dir_tsdg;
  //! \brief Vector of scattering elevation directions.
  double *vec_dir_psdg;
  //! \brief Vector of scattering angles.
  double *vec_dir_scand;
  //! \brief Control parameter for incidence plane referred to meridional plane.
  double *vec_dir_cfmp;
  //! \brief Control parameter for scattering plane referred to meridional plane.
  double *vec_dir_sfmp;
  //! \brief Control parameter for incidence plane referred to scattering plane.
  double *vec_dir_cfsp;
  //! \brief Control parameter for scattering plane referred to scattering plane.
  double *vec_dir_sfsp;
  //! \brief Components of the unitary vector perpendicular to incidence plane.
  double *vec_dir_uni;
  //! \brief Components of the unitary vector perpendicular to scattering plane.
  double *vec_dir_uns;
  //! \brief Vector of sphere differential scattering amplitude with polarization parallel to parallel incidence field.
  dcomplex *vec_dir_sas11;
  //! \brief Vector of sphere differential scattering amplitude with polarization perpendicular to the parallel incidence field.
  dcomplex *vec_dir_sas21;
  //! \brief Vector of sphere differential scattering amplitude with polarization perpendicular to perpendicular incidence field.
  dcomplex *vec_dir_sas12;
  //! \brief Vector of sphere differential scattering amplitude with polarization parallel the perpendicular incidence field.
  dcomplex *vec_dir_sas22;
  //! \brief Vector of sphere Mueller transormation matrices referred to meridional plane.
  dcomplex *vec_dir_muls;
  //! \brief Vector of sphere Mueller transormation matrices referred to scattering plane.
  dcomplex *vec_dir_mulslr;
  //! \brief Vector of sphere total differential scattering amplitude with polarization parallel to parallel incidence field.
  dcomplex *vec_dir_sat_11;
  //! \brief Vector of sphere total differential scattering amplitude with polarization perpendicular to the parallel incidence field.
  dcomplex *vec_dir_sat_21;
  //! \brief Vector of sphere total differential scattering amplitude with polarization perpendicular to perpendicular incidence field.
  dcomplex *vec_dir_sat_12;
  //! \brief Vector of sphere total differential scattering amplitude with polarization parallel the perpendicular incidence field.
  dcomplex *vec_dir_sat_22;
  //! \brief Vector of cluster differential scattering cross-sections.
  double *vec_dir_scc;
  //! \brief Vector of cluster differential absorption cross-sections.
  double *vec_dir_abc;
  //! \brief Vector of cluster differential extinction cross-sections.
  double *vec_dir_exc;
  //! \brief Vector of cluster differential albedos.
  double *vec_dir_albedc;
  //! \brief Vector of differential cluster-to-total scattering cross-section ratios.
  double *vec_dir_sccrt;
  //! \brief Vector of differential cluster-to-total absorption cross-section ratios.
  double *vec_dir_abcrt;
  //! \brief Vector of differential cluster-to-total extinction cross-section ratios.
  double *vec_dir_excrt;
  //! \brief Vector of differential cluster forward scattering amplitude with polarization parallel to parallel incidence field.
  dcomplex *vec_dir_fsac11;
  //! \brief Vector of differential cluster forward scattering amplitude with polarization perpendicular to the parallel incidence field.
  dcomplex *vec_dir_fsac21;
  //! \brief Vector of differential cluster forward scattering amplitude with polarization perpendicular to perpendicular incidence field.
  dcomplex *vec_dir_fsac12;
  //! \brief Vector of differential cluster forward scattering amplitude with polarization parallel the perpendicular incidence field.
  dcomplex *vec_dir_fsac22;
  //! \brief Vector of differential cluster scattering amplitude with polarization parallel to parallel incidence field.
  dcomplex *vec_dir_sac11;
  //! \brief Vector of differential cluster scattering amplitude with polarization perpendicular to the parallel incidence field.
  dcomplex *vec_dir_sac21;
  //! \brief Vector of differential cluster scattering amplitude with polarization perpendicular to perpendicular incidence field.
  dcomplex *vec_dir_sac12;
  //! \brief Vector of differential cluster scattering amplitude with polarization parallel the perpendicular incidence field.
  dcomplex *vec_dir_sac22;
  //! \brief Vector of differential cluster QSCHU.
  double *vec_dir_qschu;
  //! \brief Vector of differential cluster PSCHU.
  double *vec_dir_pschu;
  //! \brief Vector of differential cluster asymmetry parameters.
  double *vec_dir_cosav;
  //! \brief Vector of differential cluster radiation pressure forces.
  double *vec_dir_rapr;
  //! \brief Vector of differential radiation pressure force components along the polarization direction.
  double *vec_dir_fl;
  //! \brief Vector of differential radiation pressure force components perpendicular to the polarization direction.
  double *vec_dir_fr;
  //! \brief Vector of differential radiation pressure force components along the incidence direction.
  double *vec_dir_fk;
  //! \brief Vector of differential radiation pressure force components along the X axis.
  double *vec_dir_fx;
  //! \brief Vector of differential radiation pressure force components along the Y axis.
  double *vec_dir_fy;
  //! \brief Vector of differential radiation pressure force components along the Z axis.
  double *vec_dir_fx;
  //! \brief Vector of differential extinction contribution to radiation torque components along the polarization direction.
  double *vec_dir_tqer;
  //! \brief Vector of differential extinction contribution to radiation torque components perpendicular to the polarization direction.
  double *vec_dir_tqel;
  //! \brief Vector of differential extinction contribution to radiation torque components along the incidence direction.
  double *vec_dir_tqek;
  //! \brief Vector of differential extinction contribution to radiation torque components along the X axis.
  double *vec_dir_tqex;
  //! \brief Vector of differential extinction contribution to radiation torque components along the Y axis.
  double *vec_dir_tqey;
  //! \brief Vector of differential extinction contribution to radiation torque components along the Z axis.
  double *vec_dir_tqez;
  //! \brief Vector of differential scattering contribution to radiation torque components along the polarization direction.
  double *vec_dir_tqsr;
  //! \brief Vector of differential scattering contribution to radiation torque components perpendicular to the polarization direction.
  double *vec_dir_tqsl;
  //! \brief Vector of differential scattering contribution to radiation torque components along the incidence direction.
  double *vec_dir_tqsk;
  //! \brief Vector of differential scattering contribution to radiation torque components along X axis.
  double *vec_dir_tqsx;
  //! \brief Vector of differential scattering contribution to radiation torque components along Y axis.
  double *vec_dir_tqsy;
  //! \brief Vector of differential scattering contribution to radiation torque components along Z axis.
  double *vec_dir_tqsz;
  //! \brief Vector of cluster Mueller transormation matrices referred to meridional plane.
  dcomplex *vec_dir_mulc;
  //! \brief Vector of cluster Mueller transormation matrices referred to scattering plane.
  dcomplex *vec_dir_mulclr;
  
  /*! \brief `ScatteringOutputInfo` default instance constructor.
  /*! \brief `ClusterOutputInfo` default instance constructor.
   *
   * \param sc: `ScattererConfiguration *` Pointer to a `ScattererConfiguration` object.
   * \param gc: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` object.
   * \param sc: `ScattererConfiguration *` Pointer to a `ScattererConfiguration` instance.
   * \param gc: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` instance.
   * \param mpidata: `mixMPI*` Pointer to a mixMPI instance.
   * \param first_xi: `int` Index of the first scale in output (optional, default is 0).
   * \param xi_length: `int` Number of scales tobe included in output (optional, default is all).
   */   
  ScatteringOutputInfo(ScattererConfiguration *sc, GeometryConfiguration *gc);
  ClusterOutputInfo(
		    ScattererConfiguration *sc, GeometryConfiguration *gc,
		    mixMPI *mpidata, int first_xi = 0, int xi_length = 0
  );

  /*! \brief `ScatteringOutputInfo` instance destroyer.
  /*! \brief `ClusterOutputInfo` instance destroyer.
   */
  ~ScatteringOutputInfo();
};

/*! \brief Class to collect output information for cluster scattering problems.
 *
 * This class implements `ScatteringOutputInfo` properties and methods
 * that are specific for the solution of the scattering problem from an
 * aggregate of spheres.
 */
class ScatteringOutputInfo_Cluster : public ScatteringOutputInfo {
  /*! \brief `ScatteringOutputInfo_Cluste` default instance constructor.
   *
   * \param sc: `ScattererConfiguration *` Pointer to a `ScattererConfiguration` object.
   * \param gc: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` object.
   */   
 public:
  ScatteringOutputInfo_Cluster(ScattererConfiguration *sc, GeometryConfiguration * gc);
  ~ClusterOutputInfo();
};
#endif // INCLUDE_OUTPUTS_H_
+35 −50

File changed.

Preview size limit exceeded, changes collapsed.