Unverified Commit f8ebcc90 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

define OneCoeff struct in my_page.h as HyperOneCoeff to resolve compilation issues

parent 2270d865
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) :
  maxbondperatom = FCCBONDS;
  numcoeff = NULL;
  clist = NULL;
  cpage = new MyPage<OneCoeff>;
  cpage = new MyPage<HyperOneCoeff>;
  cpage->init(maxbondperatom,1024*maxbondperatom,1);

  // set comm sizes needed by this fix
@@ -976,7 +976,7 @@ void FixHyperLocal::build_bond_list(int natom)
    memory->sfree(clist);
    maxcoeff = atom->nmax;
    memory->create(numcoeff,maxcoeff,"hyper/local:numcoeff");
    clist = (OneCoeff **) memory->smalloc(maxcoeff*sizeof(OneCoeff *),
    clist = (HyperOneCoeff **) memory->smalloc(maxcoeff*sizeof(HyperOneCoeff *),
                                         "hyper/local:clist");
  }

@@ -1741,7 +1741,7 @@ double FixHyperLocal::memory_usage()
  bytes += 2*maxall * sizeof(double);             // maxstrain,maxstrain_domain
  if (checkbias) bytes += maxall * sizeof(tagint);  // biasflag
  bytes += maxcoeff * sizeof(int);                // numcoeff
  bytes += maxcoeff * sizeof(OneCoeff *);         // clist
  bytes += maxlocal*maxbondperatom * sizeof(OneCoeff);  // cpage estimate
  bytes += maxcoeff * sizeof(HyperOneCoeff *);         // clist
  bytes += maxlocal*maxbondperatom * sizeof(HyperOneCoeff);  // cpage estimate
  return bytes;
}
+4 −7
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ FixStyle(hyper/local,FixHyperLocal)
#include "fix_hyper.h"

namespace LAMMPS_NS {
  // forward declaration. struct HyperOneCoeff is defined in my_page.h
  struct HyperOneCoeff;

class FixHyperLocal : public FixHyper {
 public:
@@ -183,13 +185,8 @@ class FixHyperLocal : public FixHyper {

  // data structs for persisting bias coeffs when bond list is reformed

  struct OneCoeff {
    double biascoeff;
    tagint tag;
  };

  MyPage<OneCoeff> *cpage;     // pages of OneCoeff datums for clist
  OneCoeff **clist;            // ptrs to vectors of bias coeffs for each atom
  MyPage<HyperOneCoeff> *cpage;// pages of OneCoeff datums for clist
  HyperOneCoeff **clist;       // ptrs to vectors of bias coeffs for each atom
  int *numcoeff;               // # of bias coeffs per atom (one per bond)
  int maxcoeff;                // allocate sized of clist and numcoeff

+2 −3
Original line number Diff line number Diff line
@@ -257,12 +257,11 @@ void MyPage<T>::allocate() {
}

// explicit instantiations
#include "fix.h"
#include "REPLICA/fix_hyper_local.h"

namespace LAMMPS_NS {
  template class MyPage<int>;
  template class MyPage<long>;
  template class MyPage<long long>;
  template class MyPage<double>;
  template class MyPage<FixHyperLocal::OneCoeff>;
  template class MyPage<HyperOneCoeff>;
}
+7 −0
Original line number Diff line number Diff line
@@ -22,8 +22,15 @@
#define LAMMPS_MEMALIGN 64
#endif

#include "lmptype.h"

namespace LAMMPS_NS {

struct HyperOneCoeff {
  double biascoeff;
  tagint tag;
};

template<class T>
class MyPage {
 public: