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

This commit is contained in:
Axel Kohlmeyer
2020-09-07 07:57:23 -04:00
parent 2270d86519
commit f8ebcc90fb
4 changed files with 17 additions and 14 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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>;
}

View File

@ -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: