Commit 4cb73a9c authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Set up the AT matrix as a member of ParticleDescriptorInclusion

parent fbf95ca0
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -244,21 +244,23 @@ protected:
  int _ndi;
  //! \brief NDIT = 2 * NSPH * NLIM
  int _ndit;
  //! \brief Contiguous space for AM0M
  //! \brief Contiguous space for AM0M.
  dcomplex *vec_am0m;
  //! \brief Contiguous space for FSAC
  //! \brief Contiguous space for FSAC.
  dcomplex *vec_fsac;
  //! \brief Contiguous space for SAC
  //! \brief Contiguous space for SAC.
  dcomplex *vec_sac;
  //! \brief Contiguous space for FSACM
  //! \brief Contiguous space for FSACM.
  dcomplex *vec_fsacm;
  //! \brief Contiguous space for IND3J
  //! \brief Contiguous space for IND3J.
  int *vec_ind3j;
  // >>> END OF SECTION NEEDED BY CLUSTER AND INCLU <<< //

  // >>> NEEDED BY INCLU <<< //
  //! \brief NDM = NDIT + NLEMT
  int _ndm;
  //! \brief Contiguous space for AT.
  dcomplex *vec_at;
  // >>> END OF SECTION NEEDED BY INCLU <<< //
public:
  // >>> COMMON TO ALL DESCRIPTOR TYPES <<< //
@@ -462,6 +464,8 @@ public:
  dcomplex *tm0;
  //! \brief TBD
  dcomplex *te0;
  //! \brief TBD
  dcomplex **at;
  // >>> END OF SECTION NEEDED BY INCLU <<< //
  
  /*! \brief ParticleDescriptor instance constructor.
+2 −4
Original line number Diff line number Diff line
@@ -42,19 +42,17 @@ void cnf(int n, dcomplex z, int nm, dcomplex *csj, dcomplex *csy);
/*! \brief C++ porting of EXMA.
 *
 * \param am: `dcomplex **` Field transition coefficients matrix.
 * \param at: `dcomplex **` TBD.
 * \param c1: `ParticleDescriptor *` Pointer to a ParticleDescriptor instance.
 */
void exma(dcomplex **am, dcomplex **at, ParticleDescriptor *c1);
void exma(dcomplex **am, ParticleDescriptor *c1);

/*! \brief C++ porting of INCMS.
 *
 * \param am: `dcomplex **` Field transition coefficients matrix.
 * \param at: `dcomplex **` TBD.
 * \param enti: `double` TBD.
 * \param c1: `ParticleDescriptor *` Pointer to a ParticleDescriptor instance.
 */
void incms(dcomplex **am, dcomplex **at, double enti, ParticleDescriptor *c1);
void incms(dcomplex **am, double enti, ParticleDescriptor *c1);

/*! \brief C++ porting of INDME.
 *
+16 −0
Original line number Diff line number Diff line
@@ -714,6 +714,8 @@ ParticleDescriptor::ParticleDescriptor(GeometryConfiguration *gconf, ScattererCo
  te = NULL;
  tm0 = NULL;
  te0 = NULL;
  vec_at = NULL;
  at = NULL;
}

ParticleDescriptor::ParticleDescriptor(const ParticleDescriptor &rhs) {
@@ -1049,6 +1051,7 @@ void ParticleDescriptor::mpibcast(const mixMPI *mpidata) {
    MPI_Bcast(te, _le, MPI_C_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD);
    MPI_Bcast(tm0, _le, MPI_C_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD);
    MPI_Bcast(te0, _le, MPI_C_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD);
    MPI_Bcast(vec_at, _nlemt * _ndm, MPI_C_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD);
  }
}
#endif // MPI_VERSION
@@ -1085,6 +1088,8 @@ ParticleDescriptor::~ParticleDescriptor() {
    delete[] te;
    delete[] tm0;
    delete[] te0;
    delete[] at;
    delete[] vec_at;
  }
  // Inclusion/cluster class members, destroyed if sub-class is INCLUSION or CLUSTER
  if (_class_type == INCLUSION_TYPE || _class_type == CLUSTER_TYPE) {
@@ -1547,6 +1552,9 @@ ParticleDescriptorInclusion::ParticleDescriptorInclusion(GeometryConfiguration *
  te = new dcomplex[_le]();
  tm0 = new dcomplex[_le]();
  te0 = new dcomplex[_le]();
  vec_at = new dcomplex[_nlemt * _ndm]();
  at = new dcomplex*[_nlemt];
  for (int ai = 0; ai < _nlemt; ai++) at[ai] = vec_at + (ai * _nlemt);
}

ParticleDescriptorInclusion::ParticleDescriptorInclusion(const ParticleDescriptorInclusion &rhs) : ParticleDescriptor(rhs) {
@@ -1629,6 +1637,10 @@ ParticleDescriptorInclusion::ParticleDescriptorInclusion(const ParticleDescripto
    tm0[ti] = rhs.tm0[ti];
    te0[ti] = rhs.te0[ti];
  }
  vec_at = new dcomplex[_nlemt * _ndm];
  for (int vi = 0; vi < _nlemt * _ndm; vi++) vec_at[vi] = rhs.vec_at[vi];
  at = new dcomplex*[_nlemt];
  for (int ai = 0; ai < _nlemt; ai++) at[ai] = vec_at + (ai * _nlemt);
}

#ifdef MPI_VERSION
@@ -1706,6 +1718,10 @@ ParticleDescriptorInclusion::ParticleDescriptorInclusion(const mixMPI *mpidata)
  MPI_Bcast(tm0, _le, MPI_C_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD);
  te0 = new dcomplex[_le];
  MPI_Bcast(te0, _le, MPI_C_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD);
  vec_at = new dcomplex[_nlemt * _ndm];
  MPI_Bcast(vec_at, _nlemt * _ndm, MPI_C_DOUBLE_COMPLEX, 0, MPI_COMM_WORLD);
  at = new dcomplex*[_nlemt];
  for (int ai = 0; ai < _nlemt; ai++) at[ai] = vec_at + (ai * _nlemt);
}
#endif // MPI_VERSION
// >>> End of ParticleDescriptorInclusion class implementation. <<< //
+8 −6
Original line number Diff line number Diff line
@@ -74,10 +74,11 @@ void cnf(int n, dcomplex z, int nm, dcomplex *csj, dcomplex *csy) {
  }
}

void exma(dcomplex **am, dcomplex **at, ParticleDescriptor *c1) {
void exma(dcomplex **am, ParticleDescriptor *c1) {
  const dcomplex cc0 = 0.0 + I * 0.0;
  const int ndit = c1->nsph * c1->nlim * 2;
  const int ndm = ndit + c1->nlemt;
  dcomplex **at = c1->at;
  const int ndit = c1->ndit;
  const int ndm = c1->ndm;
  for (int j20 = 1; j20 <= c1->nlemt; j20++) {
    int j0 = j20 + ndit;
    for (int i20 = 1; i20 <= c1->nlemt; i20++) {
@@ -88,12 +89,13 @@ void exma(dcomplex **am, dcomplex **at, ParticleDescriptor *c1) {
  } // j20 loop
}

void incms(dcomplex **am, dcomplex **at, double enti, ParticleDescriptor *c1) {
void incms(dcomplex **am, double enti, ParticleDescriptor *c1) {
  const dcomplex cc0 = 0.0 + I * 0.0;
  dcomplex **at = c1->at;
  int nbl;
  const int ndi = c1->nsph * c1->nlim;
  const int ndi = c1->ndi;
  const int ndit = ndi + ndi;
  const int ndm = ndit + c1->nlemt;
  const int ndm = c1->ndm;
  nbl = 0;
  for (int n1 = 1; n1 < c1->nsph; n1++) {
    int in1 = (n1 - 1) * c1->nlim;