Commit ecb1ecb1 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Move InclutionIterationData header in the IterationData headers file

parent 5dac1d6a
Loading
Loading
Loading
Loading
+169 −1
Original line number Diff line number Diff line
@@ -179,6 +179,174 @@ public:
   */
  ~ClusterIterationData();
};
// >>> END OF DEFINITION OF ClusterIterationData CLASS <<<
// >>> END OF ClusterIterationData CLASS DEFINITION <<<

// >>> DEFINITION OF InclusionIterationData CLASS <<<
/*! \brief A data structure representing the information used for a single scale
 * of the INCLUSION case.
 */
class InclusionIterationData {
protected:
  //! \brief Vectorized geometric asymmetry parameter components.
  double *vec_zpv;
  
public:
  //! \brief External layer index.
  int nimd;
  //! \brief External layer radius.
  double extr;
  
  //! \brief Pointer to a ParticleDescriptor structure.
  ParticleDescriptor *c1;
  //! \brief Vector of geometric asymmetry factors.
  double *gaps;
    //! \brief Components of extinction contribution to radiation torque on a single sphere along k.
  double **tqse;
  //! \brief Components of polarized extinction contribution to radiation torque on a single sphere along k.
  dcomplex **tqspe;
  //! \brief Components of scattering contribution to radiation torque on a single sphere along k.
  double **tqss;
  //! \brief Components of polarized scattering contribution to radiation torque on a single sphere along k.
  dcomplex **tqsps;
  //! \brief L-dependent coefficients of the geometric asymmetry parameter.
  double ****zpv;
  //! \brief Mean geometric asymmetry parameters.
  double **gapm;
  //! \brief Mean geometric asymmetry parameters referred to polarization plane.
  dcomplex **gappm;
  //! \brief Imaginary part of the harmonic functions argument.
  double *argi;
  //! \brief Argument of the harmonic functions referred to the scattering plane.
  double *args;
  //! \brief Geometric asymmetry parameters.
  double **gap;
  //! \brief Geometric asymmetry parameters referred to polarization plane.
  dcomplex **gapp;
  //! \brief Components of extinction contribution to radiation torque on the cluster along k.
  double **tqce;
  //! \brief Components of extinction contribution to radiation torque on the cluster along k referred to polarization plane.
  dcomplex **tqcpe;
  //! \brief Components of scattering contribution to radiation torque on the cluster along k.
  double **tqcs;
  //! \brief Components of scattering contribution to radiation torque on the cluster along k referred to polarization plane.
  dcomplex **tqcps;
  //! \brief Variation of unitary radiation vector. QUESTION: correct?
  double *duk;
  //! \brief Cluster extinction cross-section components referred to scattering plane.
  double **cextlr;
  //! \brief Cluster extinction cross-section components referred to meridional plane.
  double **cext;
  //! \brief Cluster Mueller Transformation Matrix components referred to scattering plane.
  double **cmullr;
  //! \brief Cluster Mueller Transformation Matrix components referred to meridional plane.
  double **cmul;
  //! \brief Geometric asymmetry parameter components.
  double *gapv;
  //! \brief Radiation extinction torque components.
  double *tqev;
  //! \brief Radiation scattering torque components.
  double *tqsv;
  //! \brief Incident unitary vector components.
  double *u;
  //! \brief Scattered unitary vector components.
  double *us;
  //! \brief Normal unitary vector components.
  double *un;
  //! \brief Normal scattered unitary vector components.
  double *uns;
  //! \brief Incident unitary vector components on polarization plane.
  double *up;
  //! \brief Scattered unitary vector components on polarization plane.
  double *ups;
  //! \brief Mean unitary vector components normal to polarization plane.
  double *unmp;
  //! \brief Mean scattered unitary vector components normal to polarization plane.
  double *unsmp;
  //! \brief Mean incident unitary vector components on polarization plane.
  double *upmp;
  //! \brief Mean scattered unitary vector components on polarization plane.
  double *upsmp;
  //! \brief Scattering angle.
  double scan;
  //! \brief Control parameter on incidence direction referred to meridional plane.
  double cfmp;
  //! \brief Control parameter on scattering direction referred to meridional plane.
  double sfmp;
  //! \brief Control parameter on incidence direction referred to scattering plane.
  double cfsp;
  //! \brief Control parameter on scattering direction referred to scattering plane.
  double sfsp;
  //! \brief SQSFI = XI^-2
  double sqsfi;
  //! \brief Vectorized scattering coefficient matrix.
  dcomplex *am_vector;
  //! \brief Scattering coefficient matrix.
  dcomplex **am;
  //! \brief Argument of harmonic functions. QUESTION: correct?
  dcomplex arg;
  //! \brief Vacuum magnitude of wave vector.
  double vk;
  //! \brief Wave number.
  double wn;
  //! \brief Normalization scale. QUESTION: correct?
  double xip;
  //! \brief Number of scales (wavelengths) to be computed.
  int number_of_scales;
  //! \brief Size of the block of scales handled by the current process.
  int xiblock;
  //! \brief Index of the first scale handled by the current process.
  int firstxi;
  //! \brief Index of the last scale handled by the current process.
  int lastxi;
  //! \brief ID of the GPU used by one MPI process.
  int proc_device;
  //! \brief Refinement mode selction flag.
  int refinemode;
  //! \brief Maximum number of refinement iterations.
  int maxrefiters;
  //! \brief Required accuracy level.
  double accuracygoal;

  /*! \brief `InclusionIterationData` default instance constructor.
   *
   * \param gconf: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` object.
   * \param sconf: `ScattererConfiguration *` Pointer to a `ScattererConfiguration` object.
   * \param mpidata: `mixMPI *` Pointer to a `mixMPI` object.
   * \param device_count: `const int` Number of offload devices available on the system.
   */
  InclusionIterationData(GeometryConfiguration *gconf, ScattererConfiguration *sconf, const mixMPI *mpidata, const int device_count);
  
  /*! \brief `InclusionIterationData` copy constructor.
   *
   * \param rhs: `const InclusionIterationData &` Reference to the `InclusionIterationData` object to be copied.
   */
  InclusionIterationData(const InclusionIterationData& rhs);

#ifdef MPI_VERSION
  /*! \brief `InclusionIterationData` MPI constructor.
   *
   * \param mpidata: `const mixMPI *` Pointer to a `mixMPI` instance.
   * \param device_count: `const int` Number of offload devices available on the system.
   */
  InclusionIterationData(const mixMPI *mpidata, const int device_count);

  /*! \brief Broadcast over MPI the InclusionIterationData instance from MPI process 0 to all others.
   *
   * When using MPI, the initial InclusionIterationData instance created by MPI process 0
   * needs to be replicated on all other processes. This function sends it using
   * MPI broadcast calls. The MPI broadcast calls in this function must match those
   * in the constructor using the mixMPI pointer.
   *
   * \param mpidata: `mixMPI *` Pointer to the mpi structure used to do the MPI broadcast.
   */
  void mpibcast(const mixMPI *mpidata);
#endif

  /*! \brief `InclusionIterationData` instance destroyer.
   */
  ~InclusionIterationData();
};
// >>> END OF InclusionIterationData CLASS DEFINITION <<< //


#endif // INCLUDE_ITERATION_DATA_H_
+1039 −1199

File changed.

Preview size limit exceeded, changes collapsed.

+21 −26
Original line number Diff line number Diff line
@@ -475,11 +475,11 @@ ClusterOutputInfo::ClusterOutputInfo(const std::string &hdf5_name) {
    status = hdf_file->read("VEC_FKC1", str_type, vec_fkc1);
    vec_fkc2 = new double[xi_block_size];
    status = hdf_file->read("VEC_FKC2", str_type, vec_fkc2);
    // Initialize directions (they are scale-independent)
    vec_dir_tidg = new double[_num_theta];
    vec_dir_pidg = new double[_num_phi];
    vec_dir_tsdg = new double[_num_thetas];
    vec_dir_psdg = new double[_num_phis];
    // Initialize directions (they are scale-independent)
    double cti = th, cpi = ph, cts = ths, cps = phs;
    for (int di = 0; di < _num_theta; di++) {
      vec_dir_tidg[di] = cti;
@@ -4850,27 +4850,11 @@ SphereOutputInfo::SphereOutputInfo(
    vec_pschut = new double[xi_block_size]();
    vec_s0magt = new double[xi_block_size]();
  }
  vec_dir_tidg = new double[_num_theta]();
  vec_dir_pidg = new double[_num_phi]();
  vec_dir_tsdg = new double[_num_thetas]();
  vec_dir_psdg = new double[_num_phis]();
  vec_dir_scand = new double[ndirs]();
  vec_dir_cfmp = new double[ndirs]();
  vec_dir_cfsp = new double[ndirs]();
  vec_dir_sfmp = new double[ndirs]();
  vec_dir_sfsp = new double[ndirs]();
  vec_dir_un = new double[3 * ndirs]();
  vec_dir_uns = new double[3 * ndirs]();
  vec_dir_sas11 = new dcomplex[nsph * ndirs * xi_block_size]();
  vec_dir_sas21 = new dcomplex[nsph * ndirs * xi_block_size]();
  vec_dir_sas12 = new dcomplex[nsph * ndirs * xi_block_size]();
  vec_dir_sas22 = new dcomplex[nsph * ndirs * xi_block_size]();
  vec_dir_fx = new double[nsph * _num_theta * _num_phi * xi_block_size]();
  vec_dir_fy = new double[nsph * _num_theta * _num_phi * xi_block_size]();
  vec_dir_fz = new double[nsph * _num_theta * _num_phi * xi_block_size]();
  vec_dir_muls = new double[16 * nsph * ndirs * xi_block_size]();
  vec_dir_mulslr = new double[16 * nsph * ndirs * xi_block_size]();
  // Initialize directions (they are scale-independent)
  vec_dir_tidg = new double[_num_theta];
  vec_dir_pidg = new double[_num_phi];
  vec_dir_tsdg = new double[_num_thetas];
  vec_dir_psdg = new double[_num_phis];
  double cti = th, cpi = ph, cts = ths, cps = phs;
  for (int di = 0; di < _num_theta; di++) {
    vec_dir_tidg[di] = cti;
@@ -4888,10 +4872,25 @@ SphereOutputInfo::SphereOutputInfo(
    vec_dir_psdg[di] = cps;
    cps += phsstp;
  }
  vec_dir_scand = new double[ndirs]();
  vec_dir_cfmp = new double[ndirs]();
  vec_dir_cfsp = new double[ndirs]();
  vec_dir_sfmp = new double[ndirs]();
  vec_dir_sfsp = new double[ndirs]();
  vec_dir_un = new double[3 * ndirs]();
  vec_dir_uns = new double[3 * ndirs]();
  vec_dir_sas11 = new dcomplex[nsph * ndirs * xi_block_size]();
  vec_dir_sas21 = new dcomplex[nsph * ndirs * xi_block_size]();
  vec_dir_sas12 = new dcomplex[nsph * ndirs * xi_block_size]();
  vec_dir_sas22 = new dcomplex[nsph * ndirs * xi_block_size]();
  vec_dir_fx = new double[nsph * _num_theta * _num_phi * xi_block_size]();
  vec_dir_fy = new double[nsph * _num_theta * _num_phi * xi_block_size]();
  vec_dir_fz = new double[nsph * _num_theta * _num_phi * xi_block_size]();
  vec_dir_muls = new double[16 * nsph * ndirs * xi_block_size]();
  vec_dir_mulslr = new double[16 * nsph * ndirs * xi_block_size]();
}

SphereOutputInfo::SphereOutputInfo(const std::string &hdf5_name) {
  // DA QUI ; TODO: AGGIUSTARE TUTTE LE DIMENSIONI LEGATE A configurations
  unsigned int flags = H5F_ACC_RDONLY;
  HDFFile *hdf_file = new HDFFile(hdf5_name, flags);
  herr_t status = hdf_file->get_status();
@@ -5001,10 +5000,6 @@ SphereOutputInfo::SphereOutputInfo(const std::string &hdf5_name) {
      vec_s0magt = NULL;
    }
    // Initialize directions (they are scale-independent)
    _num_theta = (thstp == 0.0) ? 1 : 1 + (int)((thlst - th) / thstp);
    _num_thetas = (thsstp == 0.0) ? 1 : 1 + (int)((thslst - ths) / thsstp);
    _num_phi = (phstp == 0.0) ? 1 : 1 + (int)((phlst - ph) / phstp);
    _num_phis = (phsstp == 0.0) ? 1 : 1 + (int)((phslst - phs) / phsstp);
    vec_dir_tidg = new double[_num_theta];
    vec_dir_tsdg = new double[_num_thetas];
    vec_dir_pidg = new double[_num_phi];