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

Add CLUSTER/INCLUSION vectors to ParticleDescriptorCluster::get_size()

parent ad13d19c
Loading
Loading
Loading
Loading
+164 −7
Original line number Diff line number Diff line
@@ -1167,8 +1167,8 @@ long ParticleDescriptorCluster::get_size(GeometryConfiguration* gconf, Scatterer
  dcomplex *vh; dcomplex *vj0; dcomplex *vyhj; dcomplex *vyj0; dcomplex **am0m; dcomplex **fsac;
  dcomplex **sac; dcomplex **fsacm; dcomplex *vintm; dcomplex *scscp; dcomplex *ecscp; dcomplex *scscpm;
  dcomplex *ecscpm; double *v3j0; double *scsc; double *ecsc; double *scscm; double *ecscm; int **ind3j;
  double *rac3j;
  25 root pointers
  double *rac3j; dcomplex *w; dcomplex *am0m; dcomplex *sac; dcomplex *fsac; dcomplex *fsacm; int *ind3j;
  31 root pointers

  dcomplex vj;
  1 dcomplex value
@@ -1183,13 +1183,12 @@ long ParticleDescriptorCluster::get_size(GeometryConfiguration* gconf, Scatterer
  (4 * NLLT + NLEMT * NLEMT + 36 + NCOU * LITPO + NSPH * LMTPO
  + NCOU * LITPOS + NSPH * LMTPOS) dcomplex values

  w = new dcomplex*[nllt]; am0m = new dcomplex*[_nlemt]; sac = new dcomplex*[2];
  fsac = new dcomplex*[2]; fsacm = new dcomplex*[2]; ind3j = new int*[_lm + 1];
  
  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 <<< //
  */
  const int nsph = gconf->number_of_spheres;
@@ -1244,12 +1243,14 @@ long ParticleDescriptorCluster::get_size(GeometryConfiguration* gconf, Scatterer
  result += sizeof(long) * (2 + 2 * ndit);
  // >>> NEEDED BY CLUSTER AND INCLU <<< //
  result += sizeof(int) * 29;
  result += sizeof(long) * 25;
  result += sizeof(long) * 31;
  result += sizeof(dcomplex);
  result += sizeof(dcomplex) * (
    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);
  return result;
}
// >>> End of ParticleDescriptorCluster class implementation. <<< //
@@ -1493,7 +1494,163 @@ ParticleDescriptorInclusion::ParticleDescriptorInclusion(const mixMPI *mpidata)
#endif // MPI_VERSION

long ParticleDescriptorInclusion::get_size(GeometryConfiguration* gconf, ScattererConfiguration* sconf) {
  return 0;
  /*
  // >>> COMMON TO ALL DESCRIPTOR TYPES <<< //
  short _class_type; const short& class_type = _class_type;
  2 short values
  
  int _nsph; int _li; int _max_layers; int _num_configurations; int _num_layers;
  int _nhspo; int _npnt; int _npntts; int &nsph = _nsph; int &li = _li;
  int &max_layers = _max_layers; int &num_configurations = _num_configurations;
  int &num_layers = _num_layers; int &nhspo = _nhspo; int &npnt = _npnt;
  int &npntts = _npntts;
  16 int values
  
  dcomplex *vec_rmi; dcomplex *vec_rei; dcomplex *vec_w; double *vec_rc; dcomplex **rmi;
  dcomplex **rei; dcomplex **w; dcomplex *vint; double *rxx; double *ryy; double *rzz;
  double *ros; double **rc; int *iog; int *nshl; dcomplex *ris; dcomplex *dlri; dcomplex *dc0;
  dcomplex *vkt; double *vsz;
  20 root pointers
  
  double gcs;
  1 double value

  vec_rmi = new dcomplex[_li * _nsph]; vec_rei = new dcomplex[_li * _nsph]();
  vint = new dcomplex[16](); ris = new dcomplex[_nhspo]();
  dlri = new dcomplex[_nhspo](); vkt = new dcomplex[_nsph]();
  dc0 = new dcomplex[_max_layers + 1]();
  (2 * LI * NSPH + 16 + 2 * NHSPO + NSPH + MAX_LAYERS + 1) dcomplex values

  rmi = new dcomplex*[_li]; rei = new dcomplex*[_li]; rc = new double*[num_configurations];
  (2 * LI + NUM_CONF) long values

  vec_rc = new double[num_layers](); rxx = new double[nsph](); ryy = new double[nsph]();
  rzz = new double[nsph](); ros = new double[num_configurations](); vsz = new double[_nsph]();
  (NUM_LAYERS + NUM_CONF + 4 * NSPH) double values
  
  iog = new int[nsph](); nshl = new int[num_configurations]();
  (NSPH + NUM_CONF) int values
  // >>> END OF SECTION COMMON TO ALL DESCRIPTOR TYPES <<< //

  // >>> NEEDED BY CLUSTER AND INCLU <<<
  int _le; int _lm; int _nlim; int _nlem; int _nlemt; int _ncou; int _litpo; int _litpos;
  int _lmpo; int _lmtpo; int _lmtpos; int _nv3j; int _ndi; int _ndit; int& le = _le;
  int& lm = _lm; int& nlim = _nlim; int& nlem = _nlem; int& nlemt = _nlemt; int& ncou = _ncou;
  int& litpo = _litpo; int& litpos = _litpos; int& lmpo = _lmpo; int& lmtpo = _lmtpo;
  int& lmtpos = _lmtpos; int& nv3j = _nv3j; int& ndi = _ndi; int& ndit = _ndit; int& ndm = _ndm;
  29 int values

  dcomplex *vec_am0m; dcomplex *vec_fsac; dcomplex *vec_sac; dcomplex *vec_fsacm; int *vec_ind3j;
  dcomplex *vh; dcomplex *vj0; dcomplex *vyhj; dcomplex *vyj0; dcomplex **am0m; dcomplex **fsac;
  dcomplex **sac; dcomplex **fsacm; dcomplex *vintm; dcomplex *scscp; dcomplex *ecscp; dcomplex *scscpm;
  dcomplex *ecscpm; double *v3j0; double *scsc; double *ecsc; double *scscm; double *ecscm; int **ind3j;
  double *rac3j; dcomplex* w; dcomplex *am0m; dcomplex *sac; dcomplex *fsac; dcomplex *fsacm; int *ind3j;
  31 root pointers

  dcomplex vj;
  1 dcomplex value

  vec_w = new dcomplex[nllt * 4](); vec_am0m = new dcomplex[_nlemt * _nlemt]();
  vec_fsac = new dcomplex[4](); vec_sac = new dcomplex[4]();
  vec_fsacm = new dcomplex[4](); vh = new dcomplex[_ncou * _litpo]();
  vj0 = new dcomplex[_nsph * _lmtpo](); vyhj = new dcomplex[_ncou * _litpos]();
  vyj0 = new dcomplex[_nsph * _lmtpos](); vintm = new dcomplex[16]();
  scscp = new dcomplex[2](); ecscp = new dcomplex[2](); scscpm = new dcomplex[2]();
  ecscpm = new dcomplex[2]();
  (4 * NLLT + NLEMT * NLEMT + 36 + NCOU * LITPO + NSPH * LMTPO
  + NCOU * LITPOS + NSPH * LMTPOS) dcomplex values
  
  vec_ind3j = new int[(_lm + 1) * _lm]();

  v3j0 = new double[_nv3j](); scsc = new double[2](); ecsc = new double[2]();
  scscm = new double[2](); ecscm = new double[2](); rac3j = new double[_lmtpo]();
  // >>> 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];
  at = new dcomplex*[_nlemt];
  for (int ai = 0; ai < _nlemt; ai++) at[ai] = vec_at + (ai * _ndm);
  // >>> END OF SECTION NEEDED BY INCLU <<< //

  */
  const int nsph = gconf->number_of_spheres;
  const int npnt = gconf->npnt;
  const int npntts = gconf->npntts;
  const int max_n = (npnt > npntts) ? npnt : npntts;
  const int nhspo = 2 * max_n - 1;
  const int num_configurations = sconf->configurations;
  int num_layers = 0;
  int max_layers = 1;
  for (int nli = 0; nli < num_configurations; nli++) {
    int nl = sconf->get_nshl(nli);
    if (nli == 0 && sconf->use_external_sphere) nl++;
    num_layers += nl;
    if (nl >  max_layers) max_layers = nl;
  }
  // >>> COMMON TO ALL DESCRIPTOR TYPES <<< //
  const int li = gconf->li;
  const int le = gconf->le;
  const int lm = (li > le) ? li : le;
  const int nlim = li * (li + 2);
  const int nlem = le * (le + 2);
  const int nlemt = 2 * nlem;
  const int ncou = nsph * nsph - 1;
  const int litpo = li + li + 1;
  const int litpos = litpo * litpo;
  const int lmpo = lm + 1;
  const int lmtpo = li + le + 1;
  const int lmtpos = lmtpo * lmtpo;
  const int nv3j = (lm * (lm + 1) * (2 * lm + 7)) / 6;
  const int ndi = nsph * nlim;
  const int ndit = 2 * nsph * nlim;
  const int nllt = (nlemt == 0) ? 2 * nsph * li * (li + 2) : nlemt;
  long result = sizeof(short) * 2;
  result += sizeof(int) * 16;
  result += sizeof(long) * 20;
  result += sizeof(double);
  result += sizeof(dcomplex) * (2 * li * nsph + 16 + 2 * nhspo + nsph + max_layers + 1);
  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;
  result += sizeof(dcomplex);
  result += sizeof(dcomplex) * (
    4 * nllt + nlemt * nlemt + 36 + ncou * litpo + nsph * lmtpo
    + ncou * litpos + nsph * lmtpos
  );
  return result;
}

int ParticleDescriptorInclusion::update_orders(int inner_order, int outer_order) {
+3 −1
Original line number Diff line number Diff line
@@ -939,12 +939,14 @@ def test_system_resources(model, gconf, sconf):
                required_ram_bytes += 16 * (20 + 2 * ndi * nlem + ndit * nlemt)
                required_ram_bytes += 8 * (2 + 2 * ndit)
                required_ram_bytes += 4 * 29
                required_ram_bytes += 8 * 25
                required_ram_bytes += 8 * 31
                required_ram_bytes += 16
                required_ram_bytes += 16 * (
                    4 * nllt + nlemt * nlemt + 36 + ncou * litpo + nsph * lmtpo
                    + ncou * litpos + nsph * lmtpos
                )
                required_ram_bytes += 4 * ((lm + 1) * lm)
                required_ram_bytes += 8 * (8 + nv3j + lmtpo)
            else:
                print("ERROR: unrecognized application name \"%s\""%gconf['application'])
                raise KeyError("unrecognized application name \"{0:s}\"".format(gconf['application']))