Commit 437d1a74 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Implement InclusionIterationData::get_size()

parent dcbc6af8
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -367,6 +367,14 @@ public:
   */
  ~InclusionIterationData();

  /*! \brief Compute the memory requirements of an instance.
   *
   * \param gconf: `GeometryConfiguration *` Pointer to a `GeometryConfiguration` object.
   * \param sconf: `ScattererConfiguration *` Pointer to a `ScattererConfiguration` object.
   * \return result: `long` Estimated size in bytes.
   */
  static long get_size(GeometryConfiguration *gconf, ScattererConfiguration *sconf);

  /*! \brief Update field expansion orders.
   *
   * \param rcf: `double **` Matrix of sphere fractional radii.
+72 −6
Original line number Diff line number Diff line
@@ -1468,9 +1468,9 @@ InclusionIterationData::InclusionIterationData(GeometryConfiguration *gconf, Sca
  vec_zpv = new double[c1->lm * 12]();
  zpv = new double***[c1->lm];
  for (int zi = 0; zi < c1->lm; zi++) {
    zpv[zi] = new double**[12];
    zpv[zi] = new double**[3];
    for (int zj = 0; zj < 3; zj++) {
      zpv[zi][zj] = new double*[4];
      zpv[zi][zj] = new double*[2];
      zpv[zi][zj][0] = vec_zpv + (zi * 12) + (zj * 4);
      zpv[zi][zj][1] = vec_zpv + (zi * 12) + (zj * 4) + 2;
    }
@@ -1625,9 +1625,9 @@ InclusionIterationData::InclusionIterationData(const InclusionIterationData& rhs
  vec_zpv = new double[c1->lm * 12];
  zpv = new double***[c1->lm];
  for (int zi = 0; zi < c1->lm; zi++) {
    zpv[zi] = new double **[12];
    zpv[zi] = new double **[3];
    for (int zj = 0; zj < 3; zj++) {
      zpv[zi][zj] = new double*[4];
      zpv[zi][zj] = new double*[2];
      zpv[zi][zj][0] = vec_zpv + (zi * 12) + (zj * 4);
      zpv[zi][zj][1] = vec_zpv + (zi * 12) + (zj * 4) + 2;
      zpv[zi][zj][0][0] = rhs.zpv[zi][zj][0][0];
@@ -1765,9 +1765,9 @@ InclusionIterationData::InclusionIterationData(const mixMPI *mpidata, const int
  MPI_Bcast(vec_zpv, c1->lm * 12, MPI_DOUBLE, 0, MPI_COMM_WORLD);
  zpv = new double***[c1->lm];
  for (int zi = 0; zi < c1->lm; zi++) {
    zpv[zi] = new double **[12];
    zpv[zi] = new double **[3];
    for (int zj = 0; zj < 3; zj++) {
      zpv[zi][zj] = new double*[4];
      zpv[zi][zj] = new double*[2];
      zpv[zi][zj][0] = vec_zpv + (zi * 12) + (zj * 4);
      zpv[zi][zj][1] = vec_zpv + (zi * 12) + (zj * 4) + 2;
    }
@@ -1945,6 +1945,72 @@ InclusionIterationData::~InclusionIterationData() {
  delete[] cmul;
}

long InclusionIterationData::get_size(GeometryConfiguration *gconf, ScattererConfiguration *sconf) {
  /*
  ParticleDescriptor *c1; double *vec_zpv; double *gaps; double **tqse; dcomplex **tqspe;
  double **tqss; dcomplex **tqsps; double ****zpv; double **gapm; dcomplex **gappm; double *argi;
  double *args; double **gap; dcomplex **gapp; double **tqce; dcomplex **tqcpe; double **tqcs;
  dcomplex **tqcps; double *duk; double **cextlr; double **cext; double **cmullr; double **cmul;
  double *gapv; double *tqev; double *tqsv; double *u; double *us; double *un; double *uns;
  double *up; double *ups; double *unmp; double *unsmp; double *upsmp; dcomplex *am_vector;
  dcomplex **am;
  37 root pointers
 
  double extr; double vk; double wn; double xip; double scan; double cfmp; double sfmp; double cfsp;
  double sfsp; double sqsfi; double accuracygoal;
  11 double values

  dcomplex arg;
  1 dcomplex value
  
  int nimd; int number_of_scales; int xiblock; int firstxi; int lastxi; int proc_device;
  int refinemode; int maxrefiters;
  8 int values

  bool is_first_scale;
  1 boolean value

  tqse = new double*[2]; tqspe = new dcomplex*[2]; tqss = new double*[2]; tqsps = new dcomplex*[2];
  tqce = new double*[2]; tqcpe = new dcomplex*[2]; tqcs = new double*[2]; tqcps = new dcomplex*[2];
  gapp = new dcomplex*[3]; gappm = new dcomplex*[3]; gap = new double*[3]; gapm = new double*[3];
  cextlr = new double*[4]; cext = new double*[4]; cmullr = new double*[4]; cmul = new double*[4];
  zpv[] = new double*[6 * LM]; am = new dcomplex*[c1->ndm];
  (44 + 6 * LM + NDM) long values
  
  gaps = new double[nsph]; tqev = new double[3]; tqsv = new double[3]; tqse[] = new double[2 * nsph];
  tqss[] = new double[2 * nsph]; tqce[] = new double[6]; tqcs[] = new double[6]; gapv = new double[3];
  gap[] = new double[6]; gapm[] = new double[6]; u = new double[3]; us = new double[3];
  un = new double[3]; uns = new double[3]; up = new double[3]; ups = new double[3]; unmp = new double[3];
  unsmp = new double[3]; upmp = new double[3]; upsmp = new double[3]; argi = new double[1];
  args = new double[1]; duk = new double[3]; cextlr[] = new double[16]; cext[] = new double[16];
  cmullr[] = new double[16]; cmul[] = new double[16]; vec_zpv = new double[LM * 12];
  (132 + 5 * NSPH + 12 * LM) double values

  tqspe[] = new dcomplex[2 * nsph]; tqsps[] = new dcomplex[2 * nsph]; tqcpe[] = new dcomplex[6];
  tqcps[] = new dcomplex[6]; gapp[] = new dcomplex[6]; gappm[] = new dcomplex[6];
  am_vector = new dcomplex[ndm * ndm];
  (24 + 4 * NSPH + NDM * NDM) dcomplex values
  
  */
  const int nsph = gconf->number_of_spheres;
  const int nlim = gconf->li * (gconf->li + 2);
  const int nlem = gconf->le * (gconf->le + 2);
  const int ndi = nsph * nlim;
  const np_int ndit = 2 * ndi;
  const int ndm = 2 * (nsph * nlim + nlem);
  const int lm = (gconf->li > gconf->le) ? gconf->li : gconf->le;
  long result = sizeof(long) * 37;
  result += sizeof(double) * 11;
  result += sizeof(dcomplex);
  result += sizeof(int) * 8;
  result += sizeof(bool);
  result += sizeof(long) * (44 + 6 * lm + ndm);
  result += sizeof(double) * (132 + 5 * nsph + 12 * lm);
  result += sizeof(dcomplex) * (24 + 4 * nsph + ndm * ndm);
  result += ParticleDescriptorInclusion::get_size(gconf, sconf);
  return result;
}

int InclusionIterationData::update_orders(double **rcf, int inner_order, int outer_order) {
  int result = 0;
  int old_lm = c1->lm;
+15 −32
Original line number Diff line number Diff line
@@ -1561,34 +1561,22 @@ long ParticleDescriptorInclusion::get_size(GeometryConfiguration* gconf, Scatter
  + NCOU * LITPOS + NSPH * LMTPOS) dcomplex values
  
  vec_ind3j = new int[(_lm + 1) * _lm]();
  ((LM + 1) * LM) int values

  v3j0 = new double[_nv3j](); scsc = new double[2](); ecsc = new double[2]();
  scscm = new double[2](); ecscm = new double[2](); rac3j = new double[_lmtpo]();
  (8 + NV3J + LMTPO) double values
  // >>> END OF SECTION NEEDED BY CLUSTER AND INCLU <<< //

  // >>> NEEDED BY INCLU <<< //
  rm0 = new dcomplex[_le];
  re0 = new dcomplex[_le];
  rmw = new dcomplex[_le];
  rew = new dcomplex[_le];
  tm = new dcomplex[_le];
  te = new dcomplex[_le];
  tm0 = new dcomplex[_le];
  te0 = new dcomplex[_le];
  for (int ti = 0; ti < _le; ti++) {
    rm0[ti] = rhs.rm0[ti];
    re0[ti] = rhs.re0[ti];
    rmw[ti] = rhs.rmw[ti];
    rew[ti] = rhs.rew[ti];
    tm[ti] = rhs.tm[ti];
    te[ti] = rhs.te[ti];
    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];
  rm0 = new dcomplex[_le]; re0 = new dcomplex[_le]; rmw = new dcomplex[_le];
  rew = new dcomplex[_le]; tm = new dcomplex[_le]; te = new dcomplex[_le];
  tm0 = new dcomplex[_le]; te0 = new dcomplex[_le]; vec_at = new dcomplex[_nlemt * _ndm];
  (8 * LE + NLEMT * NDM) dcomplex values
  
  at = new dcomplex*[_nlemt];
  for (int ai = 0; ai < _nlemt; ai++) at[ai] = vec_at + (ai * _ndm);
  (NLEMT) long values
  
  // >>> END OF SECTION NEEDED BY INCLU <<< //

  */
@@ -1623,6 +1611,7 @@ long ParticleDescriptorInclusion::get_size(GeometryConfiguration* gconf, Scatter
  const int ndi = nsph * nlim;
  const int ndit = 2 * nsph * nlim;
  const int nllt = (nlemt == 0) ? 2 * nsph * li * (li + 2) : nlemt;
  const int ndm = 2 * (nsph * nlim + nlem);
  long result = sizeof(short) * 2;
  result += sizeof(int) * 16;
  result += sizeof(long) * 20;
@@ -1631,17 +1620,6 @@ long ParticleDescriptorInclusion::get_size(GeometryConfiguration* gconf, Scatter
  result += sizeof(dcomplex) * (2 * li + num_configurations);
  result += sizeof(double) * (num_layers + num_configurations + 4 * nsph);
  result += sizeof(int) * (nsph + num_configurations);
  // >>> NEEDED BY SPHERE AND CLUSTER <<< //
  result += sizeof(long) * 12;
  result += sizeof(dcomplex) * (22 * nsph);
  result += sizeof(double) * (7 * nsph);
  result += sizeof(long) * (4 * nsph);
  // >>> NEEDED BY CLUSTER <<< //
  result += sizeof(long) * 9;
  result += sizeof(dcomplex);
  result += sizeof(double) * 3;
  result += sizeof(dcomplex) * (20 + 2 * ndi * nlem + ndit * nlemt);
  result += sizeof(long) * (2 + 2 * ndit);
  // >>> NEEDED BY CLUSTER AND INCLU <<< //
  result += sizeof(int) * 29;
  result += sizeof(long) * 25;
@@ -1650,6 +1628,11 @@ long ParticleDescriptorInclusion::get_size(GeometryConfiguration* gconf, Scatter
    4 * nllt + nlemt * nlemt + 36 + ncou * litpo + nsph * lmtpo
    + ncou * litpos + nsph * lmtpos
  );
  result += sizeof(int) * ((lm + 1) * lm);
  result += sizeof(double) * (8 + nv3j + lmtpo);
  // >>> NEEDED BY INCLU <<< //
  result += sizeof(dcomplex) * (8 * le + nlemt * ndm);
  result += sizeof(long) * nlemt;
  return result;
}