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

Provide method based access to the configuration parameters of SPHERE

parent 0422b47a
Loading
Loading
Loading
Loading
+59 −10
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ class GeometryConfiguration {
  //! Temporary work-around to allow cluster() and sphere() peeking in.
  friend void cluster(std::string, std::string, std::string);
  friend int cluster_jxi488_cycle(int, ScattererConfiguration *, GeometryConfiguration *, C1 *, C1_AddOns *, C2 *,  C3 *,  C4 *,  C6 *,  C9 *, std::FILE *, std::string, double *, double **, dcomplex **, double **, dcomplex **, double ****, double **, dcomplex **, int, int, int, int, int, int, int, double *, double *, double **, dcomplex **, double **, dcomplex **, double **, dcomplex **, double *, std::fstream &, double **, double **, double **, double **, double *, double *, double *, int, int, np_int, int, int, int, int, int, int, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double &, double &, double &, double &, double &, double, double, int, dcomplex, double, double, np_int, dcomplex **, int, int, Logger *);
  friend void sphere(std::string, std::string, std::string);

protected:
  //! \brief Number of spherical components.
  int number_of_spheres;
@@ -231,7 +231,7 @@ class ScattererConfiguration {
  //! Temporary work-around to allow cluster() and sphere() peeking in.
  friend void cluster(std::string, std::string, std::string);
  friend int cluster_jxi488_cycle(int, ScattererConfiguration *, GeometryConfiguration *, C1 *, C1_AddOns *, C2 *,  C3 *,  C4 *,  C6 *,  C9 *, std::FILE *, std::string, double *, double **, dcomplex **, double **, dcomplex **, double ****, double **, dcomplex **, int, int, int, int, int, int, int, double *, double *, double **, dcomplex **, double **, dcomplex **, double **, dcomplex **, double *, std::fstream &, double **, double **, double **, double **, double *, double *, double *, int, int, np_int, int, int, int, int, int, int, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double &, double &, double &, double &, double &, double, double, int, dcomplex, double, double, np_int, dcomplex **, int, int, Logger *);
  friend void sphere(std::string, std::string, std::string);

protected:
  //! \brief Matrix of dielectric parameters with size [NON_TRANS_LAYERS x N_SPHERES x N_SCALES].
  dcomplex ***dc0_matrix;
@@ -407,16 +407,45 @@ public:
   */
  static ScattererConfiguration* from_dedfb(std::string file_name);

  /*! \brief Get the ID of the configuration of a sphere by the sphere's index.
  /*! \brief Get the dielectric constant of a material for a specific wavelength.
   *
   * This is a specialized function to access the ID of the configuration group a
   * sphere belongs to, through the index of the sphere.
   * Dielectric constants are stored in a 3D complex matrix, whose dimensions map
   * to [NUMBER_OF_CONFIGURATIONS x NUMBER_OF_SPHERES x NUMBER_OF_SCALES]. This
   * function extracts such values from the matrix through their indices.
   *
   * \param index: `int` Index of the ID to be retrieved.
   * \return id: `int` The desired identifier.
   * \param i: `int` Index of the configuration.
   * \param j: `int` Index of the sphere.
   * \param k: `int` Index of the current scale.
   * \return radius: `dcomplex` The requested dielectric constant.
   */
  dcomplex get_dielectric_constant(int i, int j, int k) { return dc0_matrix[i][j][k]; }
  
  /*! \brief Get the ID of a configuration from the index of the sphere.
   *
   * This is a specialized function to a configuration ID through the index of
   * the sphere it applies to.
   *
   * \return ID: `int` ID of the configuration to be applied.
   */
  int get_iog(int index) { return iog_vec[index]; }
  
  /*! \brief Get the address of the configuration ID vector.
   *
   * This is a specialized function to access the configuration ID vector.
   *
   * \return ptr: `int *` Pointer to the configuration index vector.
   */
  int *get_iog_vec() { return iog_vec; }
  
  /*! \brief Get the address of the layer number vector.
   *
   * This is a specialized function to access the vector of layer numbers for the
   * different configurations.
   *
   * \return ptr: `int *` Pointer to the vector of layer numbers.
   */
  int *get_nshl() { return nshl_vec; }
  
  /*! \brief Get the value of a parameter by name.
   *
   * The proper way to access read-only parameters from outside a class is to define
@@ -431,13 +460,33 @@ public:
   */
  double get_param(std::string param_name);
  
  /*! \brief Get the ID of a sphere by its index.
  /*! \brief Get the radius of a sphere by its index.
   *
   * This is a specialized function to get the radius of a sphere through its
   * index.
   *
   * \param index: `int` Index of the ID to be retrieved.
   * \return radius: `double` The requested sphere radius.
   */
  double get_radius(int index) { return radii_of_spheres[index]; }
  
  /*! \brief Get the value of a scale by its index.
   *
   * This is a specialized function to access a scale (generally a wavelength),
   * through its index.
   *
   * \param index: `int` Index of the scale to be retrieved.
   * \return scale: `double` The desired scale.
   */
  double get_rcf(int row, int column) { return rcf[row][column]; }
  
  /*! \brief Get the reference variable name.
   *
   * This is a specialized function to get the name of the reference variable as a
   * string.
   *
   * \param index: `int` Index of the ID to be retrieved.
   * \return id: `int` The desired identifier.
   * \return name: `string` The name of the variable used to calculate wavelength /
   * size scaling.
   */
  std::string get_reference() { return reference_variable_name; }
  
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) {
  return conf;
}

GeometryConfiguration::get_param(std::string param_name) {
double GeometryConfiguration::get_param(std::string param_name) {
  double value;
  if (param_name.compare("number_of_spheres") == 0) value = (double)number_of_spheres;
  else if (param_name.compare("nsph") == 0) value = (double)number_of_spheres;
+177 −103

File changed.

Preview size limit exceeded, changes collapsed.