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

Add outputs module to libnptm build instructions

parent 2c544bf0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@ else
	CXXFLAGSLIB=-static
endif # LIBMODE
NP_DOC_SRCS=../doc/src/config.dox
NP_LIBNPTM_SRCS=../src/libnptm/algebraic.cpp ../src/libnptm/clu_subs.cpp ../src/libnptm/Commons.cpp ../src/libnptm/Configuration.cpp ../src/libnptm/cublas_calls.cpp ../src/libnptm/file_io.cpp ../src/libnptm/inclu_subs.cpp ../src/libnptm/logging.cpp ../src/libnptm/lapack_calls.cpp ../src/libnptm/magma_calls.cpp ../src/libnptm/Parsers.cpp ../src/libnptm/sph_subs.cpp ../src/libnptm/tfrfme.cpp ../src/libnptm/tra_subs.cpp ../src/libnptm/TransitionMatrix.cpp ../src/libnptm/utils.cpp
NP_LIBNPTM_OBJS=../src/libnptm/algebraic.o ../src/libnptm/clu_subs.o ../src/libnptm/Commons.o ../src/libnptm/Configuration.o ../src/libnptm/cublas_calls.o ../src/libnptm/file_io.o ../src/libnptm/inclu_subs.o ../src/libnptm/logging.o ../src/libnptm/lapack_calls.o ../src/libnptm/magma_calls.o ../src/libnptm/Parsers.o ../src/libnptm/sph_subs.o ../src/libnptm/tfrfme.o ../src/libnptm/tra_subs.o ../src/libnptm/TransitionMatrix.o ../src/libnptm/utils.o
NP_LIBNPTM_SRCS=../src/libnptm/algebraic.cpp ../src/libnptm/clu_subs.cpp ../src/libnptm/Commons.cpp ../src/libnptm/Configuration.cpp ../src/libnptm/cublas_calls.cpp ../src/libnptm/file_io.cpp ../src/libnptm/inclu_subs.cpp ../src/libnptm/logging.cpp ../src/libnptm/lapack_calls.cpp ../src/libnptm/magma_calls.cpp ../src/libnptm/outputs.cpp ../src/libnptm/Parsers.cpp ../src/libnptm/sph_subs.cpp ../src/libnptm/tfrfme.cpp ../src/libnptm/tra_subs.cpp ../src/libnptm/TransitionMatrix.cpp ../src/libnptm/utils.cpp
NP_LIBNPTM_OBJS=../src/libnptm/algebraic.o ../src/libnptm/clu_subs.o ../src/libnptm/Commons.o ../src/libnptm/Configuration.o ../src/libnptm/cublas_calls.o ../src/libnptm/file_io.o ../src/libnptm/inclu_subs.o ../src/libnptm/logging.o ../src/libnptm/lapack_calls.o ../src/libnptm/magma_calls.o ../src/libnptm/outputs.o ../src/libnptm/Parsers.o ../src/libnptm/sph_subs.o ../src/libnptm/tfrfme.o ../src/libnptm/tra_subs.o ../src/libnptm/TransitionMatrix.o ../src/libnptm/utils.o
NP_CLUSTER_SRCS=../src/cluster/np_cluster.cpp ../src/cluster/cluster.cpp
NP_CLUSTER_OBJS=../src/cluster/np_cluster.o ../src/cluster/cluster.o
NP_CLUSTER_BINS=cluster/np_cluster
+148 −0
Original line number Diff line number Diff line
@@ -21,4 +21,152 @@
#ifndef INCLUDE_OUTPUTS_H_
#define INCLUDE_OUTPUTS_H_

//! \brief General output type identifier.
#define OUT_GNRL 0
//! \brief Cluster output type identifier.
#define OUT_CLST 1
//! \brief Inclusion output type identifier.
#define OUT_INCL 3
//! \brief Single sphere output type identifier.
#define OUT_SPHR 4

/*! \brief Class to collect output information for scattering problems.
 *
 * 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.
 */
class ScatteringOutputInfo {
 protected:
  //! \brief Number of spheres in the aggregate.
  int _nsph;
  //! \brief Maximum internal field expansion order.
  int _li;
  //! \brief Maximum external field expansion order.
  int _le;
  //! \brief Maximum field expansion order.
  int _lm;
  //! \brief Maximum coefficient matrix dimension.
  np_int _mxndm;
  //! \brief Incident polarization flag.
  int _inpol;
  //! \brief Number of points for transition layer integration.
  int _npnt;
  //! \brief Number of points for non-transition layer integration.
  int _npntts;
  //! \brief Flag for intensity.
  int _iavm;
  //! \brief Flag for reference to meridional plane.
  int _isam;
  //! \brief Type of output represented.
  short _out_type;
  //! \brief Vector of spherical components X Cartesian coordinates.
  double *_coords_x;
  //! \brief Vector of spherical components Y Cartesian coordinates.
  double *_coords_y;
  //! \brief Vector of spherical components Z Cartesian coordinates.
  double *_coords_z;
  //! \brief First incident radiation azimuth angle.
  double _th;
  //! \brief Incident radiation azimuth angle step.
  double _thstp;
  //! \brief Last incident radiation azimuth angle.
  double _thlst;
  //! \brief First scattered radiation azimuth angle.
  double _ths;
  //! \brief Scattered radiation azimuth angle step.
  double _thsstp;
  //! \brief Last scattered radiation azimuth angle.
  double _thslst;
  //! \brief First incident radiation elevation angle.
  double _ph;
  //! \brief Incident radiation elevation angle step.
  double _phstp;
  //! \brief Last incident radiation elevation angle.
  double _phlst;
  //! \brief First scattered radiation elevation angle.
  double _phs;
  //! \brief Scattered radiation elevation angle step.
  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;

  /*! \brief `ScatteringOutputInfo` default instance constructor.
   *
   * \param sc: `ScattererConfiguration *` Pointer to a `ScattererConfiguration` object.
   * \param gc: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` object.
   */   
  ScatteringOutputInfo(ScattererConfiguration *sc, GeometryConfiguration *gc);

  /*! \brief `ScatteringOutputInfo` 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);
};
#endif // INCLUDE_OUTPUTS_H_
+64 −0
Original line number Diff line number Diff line
@@ -19,6 +19,70 @@
 * \brief Implementation of the code output classes.
 */

#ifndef INCLUDE_TYPES_H_
#include "../include/types.h"
#endif

#ifndef INCLUDE_CONFIGURATION_H_
#include "../include/Configuration.h"
#endif

#ifndef INCLUDE_OUTPUTS_H_
#include "../include/outputs.h"
#endif

using namespace std;

// >> ScatteringOutputInfo CLASS IMPLEMENTATION <<
ScatteringOutputInfo::ScatteringOutputInfo(ScattererConfiguration *sc, GeometryConfiguration *gc) {
  _nsph = gc->number_of_spheres;
  _li = gc->li;
  _le = gc->le;
  _lm = gc->l_max;
  _mxndm = gc->mxndm;
  _inpol = gc->in_pol;
  _npnt = gc->npnt;
  _npntts = gc->npntts;
  _iavm = gc->iavm;
  _isam = gc->isam;
  _out_type = OUT_GNRL;
  _th = gc->in_theta_start;
  _thstp = gc->in_theta_step;
  _thlst = gc->in_theta_end;
  _ths = gc->sc_theta_start;
  _thsstp = gc->sc_theta_step;
  _thslst = gc->sc_theta_end;
  _ph = gc->in_phi_start;
  _phstp = gc->in_phi_step;
  _phlst = gc->in_phi_end;
  _phs = gc->sc_phi_start;
  _phsstp = gc->sc_phi_step;
  _phslst = gc->sc_phi_end;
  _coords_x = NULL;
  _coords_y = NULL;
  _coords_z = NULL;
}

ScatteringOutputInfo::~ScatteringOutputInfo() {
  if (_out_type != OUT_GNRL) {
    delete[] _coords_x;
    delete[] _coords_y;
    delete[] _coords_z;
  }
}
// >> END OF ScatteringOutputInfo CLASS IMPLEMENTATION <<

// >> ScatteringOutputInfo_Cluster CLASS IMPLEMENTATION <<
ScatteringOutputInfo_Cluster::ScatteringOutputInfo_Cluster(ScattererConfiguration *sc, GeometryConfiguration *gc) : ScatteringOutputInfo::ScatteringOutputInfo(sc, gc) {
  _out_type = OUT_CLST;
  _coords_x = new double[nsph];
  _coords_y = new double[nsph];
  _coords_z = new double[nsph];

  for (int i = 0; i < nsph; i++) {
    _coords_x[i] = gc->get_sph_x(i);
    _coords_y[i] = gc->get_sph_y(i);
    _coords_z[i] = gc->get_sph_z(i);
  }
}
// >> END OF ScatteringOutputInfo_Cluster CLASS IMPLEMENTATION <<