Commit 6ccaa5da authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Build C1 objects from scatterer and geometry configurations

parent e3f61029
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -99,12 +99,10 @@ public:

  /*! \brief C1 instance constructor.
   *
   * \param ns: `int` Number of spheres.
   * \param l_max: `int` Maximum order of field expansion.
   * \param nshl: `int *` Array of number of layers in spheres.
   * \param iog: `int *` Vector of spherical units ID numbers.
   * \param gconf: `GeometryConfiguration *` Pointer to a geometry configuration object.
   * \param sconf: `ScattererConfiguration *` Pointer to a scatterer configuration object.
   */
  C1(int ns, int l_max, int *nshl, int *iog);
  C1(GeometryConfiguration *gconf, ScattererConfiguration *sconf);

  /*! \brief C1 instance constructor copying all contents from a preexisting template
   *
+8 −14
Original line number Diff line number Diff line
@@ -422,29 +422,23 @@ public:
  
  /*! \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
   * This is a specialized function to get a configuration ID through the index of
   * the sphere it applies to.
   *
   * \param index: `int` Index of the sphere.
   * \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.
  /*! \brief Get the number of layers for a given configuration.
   *
   * This is a specialized function to access the configuration ID vector.
   * This is a specialized function to get the number of layers in a specific
   * configuration.
   *
   * \return ptr: `int *` Pointer to the configuration index vector.
   * \param index: `int` Index of the configuration.
   * \return nl: `int` The number of layers for the given configuration.
   */
  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; }
  int get_nshl(int index) { return nshl_vec[index]; }
  
  /*! \brief Get the value of a parameter by name.
   *
+17 −13
Original line number Diff line number Diff line
@@ -16,14 +16,18 @@
#include "../include/types.h"
#endif

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

#ifndef INCLUDE_COMMONS_H
#include "../include/Commons.h"
#endif

C1::C1(int ns, int l_max, int *_nshl, int *_iog) {
  nlmmt = 2 * (l_max * (l_max + 2));
  nsph = ns;
  lm = l_max;
C1::C1(GeometryConfiguration *gconf, ScattererConfiguration *sconf) {
  lm = (int)gconf->get_param("l_max");
  nsph = (int)gconf->get_param("nsph");
  nlmmt = 2 * (lm * (lm + 2));

  vec_rmi = new dcomplex[nsph * lm]();
  vec_rei = new dcomplex[nsph * lm]();
@@ -36,23 +40,20 @@ C1::C1(int ns, int l_max, int *_nshl, int *_iog) {
  vec_w = new dcomplex[4 * nlmmt]();
  w = new dcomplex*[nlmmt];
  for (int wi = 0; wi < nlmmt; wi++) w[wi] = &(vec_w[4 * wi]);
  configurations = 0;
  for (int ci = 1; ci <= nsph; ci++) {
    if (_iog[ci - 1] >= ci) configurations++;
  }
  configurations = (int)sconf->get_param("configurations");
  vint = new dcomplex[16]();
  vec_vints = new dcomplex[nsph * 16]();
  vints = new dcomplex*[nsph];
  rc = new double*[nsph];
  nshl = new int[nsph]();
  rc = new double*[configurations];
  nshl = new int[configurations]();
  iog = new int[nsph]();
  int conf_index = 0;
  for (int vi = 0; vi < nsph; vi++) {
    vints[vi] = &(vec_vints[vi * 16]);
    iog[vi] = _iog[vi];
    iog[vi] = sconf->get_iog(vi);
    if (iog[vi] >= vi + 1) {
      nshl[conf_index] = _nshl[conf_index];
      rc[conf_index] = new double[_nshl[conf_index]]();
      nshl[conf_index] = sconf->get_nshl(conf_index);
      rc[conf_index] = new double[nshl[conf_index]]();
      conf_index++;
    }
  }
@@ -68,6 +69,9 @@ C1::C1(int ns, int l_max, int *_nshl, int *_iog) {
  ryy = new double[nsph]();
  rzz = new double[nsph]();
  ros = new double[nsph]();
  for (int ri = 0; ri < nsph; ri++) {
    ros[ri] = sconf->get_radius(ri);
  }

  sas = new dcomplex**[nsph];
  for (int si = 0; si < nsph; si++) {
+4 −0
Original line number Diff line number Diff line
@@ -9,6 +9,10 @@
#include "../include/types.h"
#endif

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

#ifndef INCLUDE_COMMONS_H_
#include "../include/Commons.h"
#endif
+4 −0
Original line number Diff line number Diff line
@@ -8,6 +8,10 @@
#include "../include/types.h"
#endif

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

#ifndef INCLUDE_COMMONS_H_
#include "../include/Commons.h"
#endif
Loading